blob: 0c7a32db1f7fb255c5147399f3114695b6233e9a [file] [log] [blame]
danf6f8ac62013-05-27 17:19:58 +00001
2#-----------------------------------------------------------------------
3# Supports the following non-standard switches.
4#
5# --enable-threadsafe
6# --enable-readline
dance6cbf92015-11-13 16:59:00 +00007# --enable-editline
8# --enable-static-shell
danf6f8ac62013-05-27 17:19:58 +00009# --enable-dynamic-extensions
10#
11
12AC_PREREQ(2.61)
dan991c5d62015-12-15 19:32:12 +000013AC_INIT(sqlite, --SQLITE-VERSION--, http://www.sqlite.org)
danf6f8ac62013-05-27 17:19:58 +000014AC_CONFIG_SRCDIR([sqlite3.c])
dan4544e282017-10-26 15:21:56 +000015AC_CONFIG_AUX_DIR([.])
danf6f8ac62013-05-27 17:19:58 +000016
17# Use automake.
18AM_INIT_AUTOMAKE([foreign])
19
20AC_SYS_LARGEFILE
21
22# Check for required programs.
23AC_PROG_CC
danf6f8ac62013-05-27 17:19:58 +000024AC_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])
drhdd2a8f52018-06-11 21:33:08 +000032BUILD_CFLAGS=
danf6f8ac62013-05-27 17:19:58 +000033AC_SUBST(BUILD_CFLAGS)
34
dan00dae0a2016-05-28 15:09:35 +000035#-------------------------------------------------------------------------
36# Two options to enable readline compatible libraries:
37#
drhe44b8352015-10-30 14:25:57 +000038# --enable-editline
danf6f8ac62013-05-27 17:19:58 +000039# --enable-readline
40#
dan00dae0a2016-05-28 15:09:35 +000041# Both are enabled by default. If, after command line processing both are
42# still enabled, the script searches for editline first and automatically
43# disables readline if it is found. So, to use readline explicitly, the
44# user must pass "--disable-editline". To disable command line editing
45# support altogether, "--disable-editline --disable-readline".
46#
47# When searching for either library, check for headers before libraries
48# as some distros supply packages that contain libraries but not header
49# files, which come as a separate development package.
50#
51AC_ARG_ENABLE(editline, [AS_HELP_STRING([--enable-editline],[use BSD libedit])])
52AC_ARG_ENABLE(readline, [AS_HELP_STRING([--enable-readline],[use readline])])
53
54AS_IF([ test x"$enable_editline" != xno ],[
55 AC_CHECK_HEADERS([editline/readline.h],[
56 sLIBS=$LIBS
57 LIBS=""
58 AC_SEARCH_LIBS([readline],[edit],[
59 AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline)
drhdb528522017-03-23 19:51:38 +000060 READLINE_LIBS="$LIBS -ltinfo"
dan00dae0a2016-05-28 15:09:35 +000061 enable_readline=no
drhdb528522017-03-23 19:51:38 +000062 ],[],[-ltinfo])
dan00dae0a2016-05-28 15:09:35 +000063 AS_UNSET(ac_cv_search_readline)
64 LIBS=$sLIBS
65 ])
66])
67
68AS_IF([ test x"$enable_readline" != xno ],[
69 AC_CHECK_HEADERS([readline/readline.h],[
70 sLIBS=$LIBS
71 LIBS=""
72 AC_SEARCH_LIBS(tgetent, termcap curses ncurses ncursesw, [], [])
73 AC_SEARCH_LIBS(readline,[readline edit], [
74 AC_DEFINE([HAVE_READLINE],1,Define to use readline or wrapper)
75 READLINE_LIBS=$LIBS
76 ])
77 LIBS=$sLIBS
78 ])
79])
80
danf6f8ac62013-05-27 17:19:58 +000081AC_SUBST(READLINE_LIBS)
82#-----------------------------------------------------------------------
83
84#-----------------------------------------------------------------------
85# --enable-threadsafe
86#
87AC_ARG_ENABLE(threadsafe, [AS_HELP_STRING(
88 [--enable-threadsafe], [build a thread-safe library [default=yes]])],
89 [], [enable_threadsafe=yes])
drhd0a05382020-12-11 14:34:58 +000090if test x"$enable_threadsafe" == "xno"; then
91 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_THREADSAFE=0"
92else
drhdd2a8f52018-06-11 21:33:08 +000093 BUILD_CFLAGS="$BUILD_CFLAGS -D_REENTRANT=1 -DSQLITE_THREADSAFE=1"
drhba60fbb2016-01-28 02:47:32 +000094 AC_SEARCH_LIBS(pthread_create, pthread)
drh13c808a2016-01-13 21:23:48 +000095 AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
danf6f8ac62013-05-27 17:19:58 +000096fi
danf6f8ac62013-05-27 17:19:58 +000097#-----------------------------------------------------------------------
98
99#-----------------------------------------------------------------------
100# --enable-dynamic-extensions
101#
102AC_ARG_ENABLE(dynamic-extensions, [AS_HELP_STRING(
103 [--enable-dynamic-extensions], [support loadable extensions [default=yes]])],
104 [], [enable_dynamic_extensions=yes])
105if test x"$enable_dynamic_extensions" != "xno"; then
106 AC_SEARCH_LIBS(dlopen, dl)
107else
drhdd2a8f52018-06-11 21:33:08 +0000108 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_OMIT_LOAD_EXTENSION=1"
danf6f8ac62013-05-27 17:19:58 +0000109fi
110AC_MSG_CHECKING([for whether to support dynamic extensions])
111AC_MSG_RESULT($enable_dynamic_extensions)
drhdd2a8f52018-06-11 21:33:08 +0000112#-----------------------------------------------------------------------
113
114#-----------------------------------------------------------------------
drhe7a37702021-03-09 17:09:00 +0000115# --enable-math
116#
117AC_ARG_ENABLE(math, [AS_HELP_STRING(
118 [--enable-math], [SQL math functions [default=yes]])],
119 [], [enable_math=yes])
120AC_MSG_CHECKING([SQL math functions])
121if test x"$enable_math" = "xyes"; then
122 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_MATH_FUNCTIONS"
123 AC_MSG_RESULT([enabled])
124 AC_SEARCH_LIBS(ceil, m)
125else
126 AC_MSG_RESULT([disabled])
127fi
128#-----------------------------------------------------------------------
129
130#-----------------------------------------------------------------------
drhdd2a8f52018-06-11 21:33:08 +0000131# --enable-fts4
132#
133AC_ARG_ENABLE(fts4, [AS_HELP_STRING(
134 [--enable-fts4], [include fts4 support [default=yes]])],
135 [], [enable_fts4=yes])
drhe7a37702021-03-09 17:09:00 +0000136AC_MSG_CHECKING([FTS4 extension])
drhdd2a8f52018-06-11 21:33:08 +0000137if test x"$enable_fts4" = "xyes"; then
138 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS4"
drhe7a37702021-03-09 17:09:00 +0000139 AC_MSG_RESULT([enabled])
140else
141 AC_MSG_RESULT([disabled])
drhdd2a8f52018-06-11 21:33:08 +0000142fi
143#-----------------------------------------------------------------------
144
145#-----------------------------------------------------------------------
146# --enable-fts3
147#
148AC_ARG_ENABLE(fts3, [AS_HELP_STRING(
149 [--enable-fts3], [include fts3 support [default=no]])],
150 [], [])
drhe7a37702021-03-09 17:09:00 +0000151AC_MSG_CHECKING([FTS3 extension])
drhdd2a8f52018-06-11 21:33:08 +0000152if test x"$enable_fts3" = "xyes" -a x"$enable_fts4" = "xno"; then
153 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS3"
drhe7a37702021-03-09 17:09:00 +0000154 AC_MSG_RESULT([enabled])
155else
156 AC_MSG_RESULT([disabled])
drhdd2a8f52018-06-11 21:33:08 +0000157fi
danf6f8ac62013-05-27 17:19:58 +0000158#-----------------------------------------------------------------------
159
dan25727512015-10-09 14:37:15 +0000160#-----------------------------------------------------------------------
161# --enable-fts5
162#
163AC_ARG_ENABLE(fts5, [AS_HELP_STRING(
drhe632ae72018-05-04 04:49:55 +0000164 [--enable-fts5], [include fts5 support [default=yes]])],
165 [], [enable_fts5=yes])
drhe7a37702021-03-09 17:09:00 +0000166AC_MSG_CHECKING([FTS5 extension])
drh582c0802016-05-04 14:20:15 +0000167if test x"$enable_fts5" = "xyes"; then
drhe7a37702021-03-09 17:09:00 +0000168 AC_MSG_RESULT([enabled])
dan25727512015-10-09 14:37:15 +0000169 AC_SEARCH_LIBS(log, m)
drhdd2a8f52018-06-11 21:33:08 +0000170 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS5"
drhe7a37702021-03-09 17:09:00 +0000171else
172 AC_MSG_RESULT([disabled])
dan25727512015-10-09 14:37:15 +0000173fi
dan25727512015-10-09 14:37:15 +0000174#-----------------------------------------------------------------------
175
176#-----------------------------------------------------------------------
drhdd2a8f52018-06-11 21:33:08 +0000177# --enable-rtree
178#
179AC_ARG_ENABLE(rtree, [AS_HELP_STRING(
180 [--enable-rtree], [include rtree support [default=yes]])],
181 [], [enable_rtree=yes])
drhe7a37702021-03-09 17:09:00 +0000182AC_MSG_CHECKING([RTREE extension])
drhdd2a8f52018-06-11 21:33:08 +0000183if test x"$enable_rtree" = "xyes"; then
drh29368ea2019-12-28 13:17:11 +0000184 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY"
drhe7a37702021-03-09 17:09:00 +0000185 AC_MSG_RESULT([enabled])
186else
187 AC_MSG_RESULT([disabled])
drhdd2a8f52018-06-11 21:33:08 +0000188fi
dan25727512015-10-09 14:37:15 +0000189#-----------------------------------------------------------------------
190
dance6cbf92015-11-13 16:59:00 +0000191#-----------------------------------------------------------------------
drh5e18d402016-05-03 13:14:18 +0000192# --enable-session
193#
194AC_ARG_ENABLE(session, [AS_HELP_STRING(
195 [--enable-session], [enable the session extension [default=no]])],
drhdd2a8f52018-06-11 21:33:08 +0000196 [], [])
drhe7a37702021-03-09 17:09:00 +0000197AC_MSG_CHECKING([Session extension])
drh582c0802016-05-04 14:20:15 +0000198if test x"$enable_session" = "xyes"; then
mistachkin746127e2018-09-17 12:49:21 +0000199 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
drhe7a37702021-03-09 17:09:00 +0000200 AC_MSG_RESULT([enabled])
201else
202 AC_MSG_RESULT([disabled])
drh5e18d402016-05-03 13:14:18 +0000203fi
drh5e18d402016-05-03 13:14:18 +0000204#-----------------------------------------------------------------------
205
206#-----------------------------------------------------------------------
drhe632ae72018-05-04 04:49:55 +0000207# --enable-debug
208#
209AC_ARG_ENABLE(debug, [AS_HELP_STRING(
210 [--enable-debug], [build with debugging features enabled [default=no]])],
drhdd2a8f52018-06-11 21:33:08 +0000211 [], [])
drhe7a37702021-03-09 17:09:00 +0000212AC_MSG_CHECKING([Build type])
drhe632ae72018-05-04 04:49:55 +0000213if test x"$enable_debug" = "xyes"; then
drhdd2a8f52018-06-11 21:33:08 +0000214 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE"
215 CFLAGS="-g -O0"
drhe7a37702021-03-09 17:09:00 +0000216 AC_MSG_RESULT([debug])
217else
218 AC_MSG_RESULT([release])
drhe632ae72018-05-04 04:49:55 +0000219fi
drhe632ae72018-05-04 04:49:55 +0000220#-----------------------------------------------------------------------
221
222#-----------------------------------------------------------------------
dance6cbf92015-11-13 16:59:00 +0000223# --enable-static-shell
224#
225AC_ARG_ENABLE(static-shell, [AS_HELP_STRING(
226 [--enable-static-shell],
227 [statically link libsqlite3 into shell tool [default=yes]])],
228 [], [enable_static_shell=yes])
drh582c0802016-05-04 14:20:15 +0000229if test x"$enable_static_shell" = "xyes"; then
dane1f1ffa2016-03-11 15:25:13 +0000230 EXTRA_SHELL_OBJ=sqlite3-sqlite3.$OBJEXT
dance6cbf92015-11-13 16:59:00 +0000231else
232 EXTRA_SHELL_OBJ=libsqlite3.la
233fi
234AC_SUBST(EXTRA_SHELL_OBJ)
235#-----------------------------------------------------------------------
236
danf6f8ac62013-05-27 17:19:58 +0000237AC_CHECK_FUNCS(posix_fallocate)
dan5a7da862018-01-18 17:46:08 +0000238AC_CHECK_HEADERS(zlib.h,[
drhdd2a8f52018-06-11 21:33:08 +0000239 AC_SEARCH_LIBS(deflate,z,[BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_HAVE_ZLIB"])
dan5a7da862018-01-18 17:46:08 +0000240])
danf6f8ac62013-05-27 17:19:58 +0000241
drh04a28c32018-01-31 01:38:44 +0000242AC_SEARCH_LIBS(system,,,[SHELL_CFLAGS="-DSQLITE_NOHAVE_SYSTEM"])
243AC_SUBST(SHELL_CFLAGS)
244
danf6f8ac62013-05-27 17:19:58 +0000245#-----------------------------------------------------------------------
246# UPDATE: Maybe it's better if users just set CFLAGS before invoking
247# configure. This option doesn't really add much...
248#
249# --enable-tempstore
250#
251# AC_ARG_ENABLE(tempstore, [AS_HELP_STRING(
252# [--enable-tempstore],
253# [in-memory temporary tables (never, no, yes, always) [default=no]])],
254# [], [enable_tempstore=no])
255# AC_MSG_CHECKING([for whether or not to store temp tables in-memory])
256# case "$enable_tempstore" in
257# never ) TEMP_STORE=0 ;;
258# no ) TEMP_STORE=1 ;;
259# always ) TEMP_STORE=3 ;;
260# yes ) TEMP_STORE=3 ;;
261# * )
262# TEMP_STORE=1
263# enable_tempstore=yes
264# ;;
265# esac
266# AC_MSG_RESULT($enable_tempstore)
267# AC_SUBST(TEMP_STORE)
268#-----------------------------------------------------------------------
269
270AC_OUTPUT