xref: /freebsd/contrib/sqlite3/configure.ac (revision 63cbe8d1d95f97e93929ec66f1138693d08dd9f6)
1
2#-----------------------------------------------------------------------
3# Supports the following non-standard switches.
4#
5#   --enable-threadsafe
6#   --enable-readline
7#   --enable-editline
8#   --enable-static-shell
9#   --enable-dynamic-extensions
10#
11
12AC_PREREQ(2.61)
13AC_INIT(sqlite, 3.23.1, http://www.sqlite.org)
14AC_CONFIG_SRCDIR([sqlite3.c])
15AC_CONFIG_AUX_DIR([.])
16
17# Use automake.
18AM_INIT_AUTOMAKE([foreign])
19
20AC_SYS_LARGEFILE
21
22# Check for required programs.
23AC_PROG_CC
24AC_PROG_LIBTOOL
25AC_PROG_MKDIR_P
26
27# Check for library functions that SQLite can optionally use.
28AC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r])
29AC_FUNC_STRERROR_R
30
31AC_CONFIG_FILES([Makefile sqlite3.pc])
32AC_SUBST(BUILD_CFLAGS)
33
34#-------------------------------------------------------------------------
35# Two options to enable readline compatible libraries:
36#
37#   --enable-editline
38#   --enable-readline
39#
40# Both are enabled by default. If, after command line processing both are
41# still enabled, the script searches for editline first and automatically
42# disables readline if it is found. So, to use readline explicitly, the
43# user must pass "--disable-editline". To disable command line editing
44# support altogether, "--disable-editline --disable-readline".
45#
46# When searching for either library, check for headers before libraries
47# as some distros supply packages that contain libraries but not header
48# files, which come as a separate development package.
49#
50AC_ARG_ENABLE(editline, [AS_HELP_STRING([--enable-editline],[use BSD libedit])])
51AC_ARG_ENABLE(readline, [AS_HELP_STRING([--enable-readline],[use readline])])
52
53AS_IF([ test x"$enable_editline" != xno ],[
54  AC_CHECK_HEADERS([editline/readline.h],[
55    sLIBS=$LIBS
56    LIBS=""
57    AC_SEARCH_LIBS([readline],[edit],[
58      AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline)
59      READLINE_LIBS="$LIBS -ltinfo"
60      enable_readline=no
61    ],[],[-ltinfo])
62    AS_UNSET(ac_cv_search_readline)
63    LIBS=$sLIBS
64  ])
65])
66
67AS_IF([ test x"$enable_readline" != xno ],[
68  AC_CHECK_HEADERS([readline/readline.h],[
69    sLIBS=$LIBS
70    LIBS=""
71    AC_SEARCH_LIBS(tgetent, termcap curses ncurses ncursesw, [], [])
72    AC_SEARCH_LIBS(readline,[readline edit], [
73      AC_DEFINE([HAVE_READLINE],1,Define to use readline or wrapper)
74      READLINE_LIBS=$LIBS
75    ])
76    LIBS=$sLIBS
77  ])
78])
79
80AC_SUBST(READLINE_LIBS)
81#-----------------------------------------------------------------------
82
83#-----------------------------------------------------------------------
84#   --enable-threadsafe
85#
86AC_ARG_ENABLE(threadsafe, [AS_HELP_STRING(
87  [--enable-threadsafe], [build a thread-safe library [default=yes]])],
88  [], [enable_threadsafe=yes])
89THREADSAFE_FLAGS=-DSQLITE_THREADSAFE=0
90if test x"$enable_threadsafe" != "xno"; then
91  THREADSAFE_FLAGS="-D_REENTRANT=1 -DSQLITE_THREADSAFE=1"
92  AC_SEARCH_LIBS(pthread_create, pthread)
93  AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
94fi
95AC_SUBST(THREADSAFE_FLAGS)
96#-----------------------------------------------------------------------
97
98#-----------------------------------------------------------------------
99#   --enable-dynamic-extensions
100#
101AC_ARG_ENABLE(dynamic-extensions, [AS_HELP_STRING(
102  [--enable-dynamic-extensions], [support loadable extensions [default=yes]])],
103  [], [enable_dynamic_extensions=yes])
104if test x"$enable_dynamic_extensions" != "xno"; then
105  AC_SEARCH_LIBS(dlopen, dl)
106else
107  DYNAMIC_EXTENSION_FLAGS=-DSQLITE_OMIT_LOAD_EXTENSION=1
108fi
109AC_MSG_CHECKING([for whether to support dynamic extensions])
110AC_MSG_RESULT($enable_dynamic_extensions)
111AC_SUBST(DYNAMIC_EXTENSION_FLAGS)
112#-----------------------------------------------------------------------
113
114#-----------------------------------------------------------------------
115#   --enable-fts5
116#
117AC_ARG_ENABLE(fts5, [AS_HELP_STRING(
118  [--enable-fts5], [include fts5 support [default=no]])],
119  [], [enable_fts5=no])
120if test x"$enable_fts5" = "xyes"; then
121  AC_SEARCH_LIBS(log, m)
122  FTS5_FLAGS=-DSQLITE_ENABLE_FTS5
123fi
124AC_SUBST(FTS5_FLAGS)
125#-----------------------------------------------------------------------
126
127#-----------------------------------------------------------------------
128#   --enable-json1
129#
130AC_ARG_ENABLE(json1, [AS_HELP_STRING(
131  [--enable-json1], [include json1 support [default=no]])],
132  [], [enable_json1=no])
133if test x"$enable_json1" = "xyes"; then
134  JSON1_FLAGS=-DSQLITE_ENABLE_JSON1
135fi
136AC_SUBST(JSON1_FLAGS)
137#-----------------------------------------------------------------------
138
139#-----------------------------------------------------------------------
140#   --enable-session
141#
142AC_ARG_ENABLE(session, [AS_HELP_STRING(
143  [--enable-session], [enable the session extension [default=no]])],
144  [], [enable_session=no])
145if test x"$enable_session" = "xyes"; then
146  SESSION_FLAGS="-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
147fi
148AC_SUBST(SESSION_FLAGS)
149#-----------------------------------------------------------------------
150
151#-----------------------------------------------------------------------
152#   --enable-static-shell
153#
154AC_ARG_ENABLE(static-shell, [AS_HELP_STRING(
155  [--enable-static-shell],
156  [statically link libsqlite3 into shell tool [default=yes]])],
157  [], [enable_static_shell=yes])
158if test x"$enable_static_shell" = "xyes"; then
159  EXTRA_SHELL_OBJ=sqlite3-sqlite3.$OBJEXT
160else
161  EXTRA_SHELL_OBJ=libsqlite3.la
162fi
163AC_SUBST(EXTRA_SHELL_OBJ)
164#-----------------------------------------------------------------------
165
166AC_CHECK_FUNCS(posix_fallocate)
167AC_CHECK_HEADERS(zlib.h,[
168  AC_SEARCH_LIBS(deflate,z,[ZLIB_FLAGS="-DSQLITE_HAVE_ZLIB"])
169])
170AC_SUBST(ZLIB_FLAGS)
171
172AC_SEARCH_LIBS(system,,,[SHELL_CFLAGS="-DSQLITE_NOHAVE_SYSTEM"])
173AC_SUBST(SHELL_CFLAGS)
174
175#-----------------------------------------------------------------------
176# UPDATE: Maybe it's better if users just set CFLAGS before invoking
177# configure. This option doesn't really add much...
178#
179#   --enable-tempstore
180#
181# AC_ARG_ENABLE(tempstore, [AS_HELP_STRING(
182#   [--enable-tempstore],
183#   [in-memory temporary tables (never, no, yes, always) [default=no]])],
184#   [], [enable_tempstore=no])
185# AC_MSG_CHECKING([for whether or not to store temp tables in-memory])
186# case "$enable_tempstore" in
187#   never )  TEMP_STORE=0 ;;
188#   no )     TEMP_STORE=1 ;;
189#   always ) TEMP_STORE=3 ;;
190#   yes )    TEMP_STORE=3 ;;
191#   * )
192#     TEMP_STORE=1
193#     enable_tempstore=yes
194#   ;;
195# esac
196# AC_MSG_RESULT($enable_tempstore)
197# AC_SUBST(TEMP_STORE)
198#-----------------------------------------------------------------------
199
200AC_OUTPUT
201