blob: a86bd2ca39ab491f84acab0840e18a881edfe120 [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#-----------------------------------------------------------------------
115# --enable-fts4
116#
117AC_ARG_ENABLE(fts4, [AS_HELP_STRING(
118 [--enable-fts4], [include fts4 support [default=yes]])],
119 [], [enable_fts4=yes])
120if test x"$enable_fts4" = "xyes"; then
121 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS4"
122fi
123#-----------------------------------------------------------------------
124
125#-----------------------------------------------------------------------
126# --enable-fts3
127#
128AC_ARG_ENABLE(fts3, [AS_HELP_STRING(
129 [--enable-fts3], [include fts3 support [default=no]])],
130 [], [])
131if test x"$enable_fts3" = "xyes" -a x"$enable_fts4" = "xno"; then
132 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS3"
133fi
danf6f8ac62013-05-27 17:19:58 +0000134#-----------------------------------------------------------------------
135
dan25727512015-10-09 14:37:15 +0000136#-----------------------------------------------------------------------
137# --enable-fts5
138#
139AC_ARG_ENABLE(fts5, [AS_HELP_STRING(
drhe632ae72018-05-04 04:49:55 +0000140 [--enable-fts5], [include fts5 support [default=yes]])],
141 [], [enable_fts5=yes])
drh582c0802016-05-04 14:20:15 +0000142if test x"$enable_fts5" = "xyes"; then
dan25727512015-10-09 14:37:15 +0000143 AC_SEARCH_LIBS(log, m)
drhdd2a8f52018-06-11 21:33:08 +0000144 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_FTS5"
dan25727512015-10-09 14:37:15 +0000145fi
dan25727512015-10-09 14:37:15 +0000146#-----------------------------------------------------------------------
147
148#-----------------------------------------------------------------------
149# --enable-json1
150#
151AC_ARG_ENABLE(json1, [AS_HELP_STRING(
drhe632ae72018-05-04 04:49:55 +0000152 [--enable-json1], [include json1 support [default=yes]])],
drhdd2a8f52018-06-11 21:33:08 +0000153 [],[enable_json1=yes])
drh582c0802016-05-04 14:20:15 +0000154if test x"$enable_json1" = "xyes"; then
drhdd2a8f52018-06-11 21:33:08 +0000155 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_JSON1"
dan25727512015-10-09 14:37:15 +0000156fi
drhdd2a8f52018-06-11 21:33:08 +0000157#-----------------------------------------------------------------------
158
159#-----------------------------------------------------------------------
160# --enable-rtree
161#
162AC_ARG_ENABLE(rtree, [AS_HELP_STRING(
163 [--enable-rtree], [include rtree support [default=yes]])],
164 [], [enable_rtree=yes])
165if test x"$enable_rtree" = "xyes"; then
drh29368ea2019-12-28 13:17:11 +0000166 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY"
drhdd2a8f52018-06-11 21:33:08 +0000167fi
dan25727512015-10-09 14:37:15 +0000168#-----------------------------------------------------------------------
169
dance6cbf92015-11-13 16:59:00 +0000170#-----------------------------------------------------------------------
drh5e18d402016-05-03 13:14:18 +0000171# --enable-session
172#
173AC_ARG_ENABLE(session, [AS_HELP_STRING(
174 [--enable-session], [enable the session extension [default=no]])],
drhdd2a8f52018-06-11 21:33:08 +0000175 [], [])
drh582c0802016-05-04 14:20:15 +0000176if test x"$enable_session" = "xyes"; then
mistachkin746127e2018-09-17 12:49:21 +0000177 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
drh5e18d402016-05-03 13:14:18 +0000178fi
drh5e18d402016-05-03 13:14:18 +0000179#-----------------------------------------------------------------------
180
181#-----------------------------------------------------------------------
drhe632ae72018-05-04 04:49:55 +0000182# --enable-debug
183#
184AC_ARG_ENABLE(debug, [AS_HELP_STRING(
185 [--enable-debug], [build with debugging features enabled [default=no]])],
drhdd2a8f52018-06-11 21:33:08 +0000186 [], [])
drhe632ae72018-05-04 04:49:55 +0000187if test x"$enable_debug" = "xyes"; then
drhdd2a8f52018-06-11 21:33:08 +0000188 BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE"
189 CFLAGS="-g -O0"
drhe632ae72018-05-04 04:49:55 +0000190fi
drhe632ae72018-05-04 04:49:55 +0000191#-----------------------------------------------------------------------
192
193#-----------------------------------------------------------------------
dance6cbf92015-11-13 16:59:00 +0000194# --enable-static-shell
195#
196AC_ARG_ENABLE(static-shell, [AS_HELP_STRING(
197 [--enable-static-shell],
198 [statically link libsqlite3 into shell tool [default=yes]])],
199 [], [enable_static_shell=yes])
drh582c0802016-05-04 14:20:15 +0000200if test x"$enable_static_shell" = "xyes"; then
dane1f1ffa2016-03-11 15:25:13 +0000201 EXTRA_SHELL_OBJ=sqlite3-sqlite3.$OBJEXT
dance6cbf92015-11-13 16:59:00 +0000202else
203 EXTRA_SHELL_OBJ=libsqlite3.la
204fi
205AC_SUBST(EXTRA_SHELL_OBJ)
206#-----------------------------------------------------------------------
207
danf6f8ac62013-05-27 17:19:58 +0000208AC_CHECK_FUNCS(posix_fallocate)
dan5a7da862018-01-18 17:46:08 +0000209AC_CHECK_HEADERS(zlib.h,[
drhdd2a8f52018-06-11 21:33:08 +0000210 AC_SEARCH_LIBS(deflate,z,[BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_HAVE_ZLIB"])
dan5a7da862018-01-18 17:46:08 +0000211])
danf6f8ac62013-05-27 17:19:58 +0000212
drh04a28c32018-01-31 01:38:44 +0000213AC_SEARCH_LIBS(system,,,[SHELL_CFLAGS="-DSQLITE_NOHAVE_SYSTEM"])
214AC_SUBST(SHELL_CFLAGS)
215
danf6f8ac62013-05-27 17:19:58 +0000216#-----------------------------------------------------------------------
217# UPDATE: Maybe it's better if users just set CFLAGS before invoking
218# configure. This option doesn't really add much...
219#
220# --enable-tempstore
221#
222# AC_ARG_ENABLE(tempstore, [AS_HELP_STRING(
223# [--enable-tempstore],
224# [in-memory temporary tables (never, no, yes, always) [default=no]])],
225# [], [enable_tempstore=no])
226# AC_MSG_CHECKING([for whether or not to store temp tables in-memory])
227# case "$enable_tempstore" in
228# never ) TEMP_STORE=0 ;;
229# no ) TEMP_STORE=1 ;;
230# always ) TEMP_STORE=3 ;;
231# yes ) TEMP_STORE=3 ;;
232# * )
233# TEMP_STORE=1
234# enable_tempstore=yes
235# ;;
236# esac
237# AC_MSG_RESULT($enable_tempstore)
238# AC_SUBST(TEMP_STORE)
239#-----------------------------------------------------------------------
240
241AC_OUTPUT