blob: 5a607de05459a4bff0eaa10c02c861f5b4eb3ff6 [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])
15
16# Use automake.
17AM_INIT_AUTOMAKE([foreign])
18
19AC_SYS_LARGEFILE
20
21# Check for required programs.
22AC_PROG_CC
danf6f8ac62013-05-27 17:19:58 +000023AC_PROG_LIBTOOL
24AC_PROG_MKDIR_P
25
26# Check for library functions that SQLite can optionally use.
27AC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r])
28AC_FUNC_STRERROR_R
29
30AC_CONFIG_FILES([Makefile sqlite3.pc])
31AC_SUBST(BUILD_CFLAGS)
32
dan00dae0a2016-05-28 15:09:35 +000033#-------------------------------------------------------------------------
34# Two options to enable readline compatible libraries:
35#
drhe44b8352015-10-30 14:25:57 +000036# --enable-editline
danf6f8ac62013-05-27 17:19:58 +000037# --enable-readline
38#
dan00dae0a2016-05-28 15:09:35 +000039# Both are enabled by default. If, after command line processing both are
40# still enabled, the script searches for editline first and automatically
41# disables readline if it is found. So, to use readline explicitly, the
42# user must pass "--disable-editline". To disable command line editing
43# support altogether, "--disable-editline --disable-readline".
44#
45# When searching for either library, check for headers before libraries
46# as some distros supply packages that contain libraries but not header
47# files, which come as a separate development package.
48#
49AC_ARG_ENABLE(editline, [AS_HELP_STRING([--enable-editline],[use BSD libedit])])
50AC_ARG_ENABLE(readline, [AS_HELP_STRING([--enable-readline],[use readline])])
51
52AS_IF([ test x"$enable_editline" != xno ],[
53 AC_CHECK_HEADERS([editline/readline.h],[
54 sLIBS=$LIBS
55 LIBS=""
56 AC_SEARCH_LIBS([readline],[edit],[
57 AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline)
drhdb528522017-03-23 19:51:38 +000058 READLINE_LIBS="$LIBS -ltinfo"
dan00dae0a2016-05-28 15:09:35 +000059 enable_readline=no
drhdb528522017-03-23 19:51:38 +000060 ],[],[-ltinfo])
dan00dae0a2016-05-28 15:09:35 +000061 AS_UNSET(ac_cv_search_readline)
62 LIBS=$sLIBS
63 ])
64])
65
66AS_IF([ test x"$enable_readline" != xno ],[
67 AC_CHECK_HEADERS([readline/readline.h],[
68 sLIBS=$LIBS
69 LIBS=""
70 AC_SEARCH_LIBS(tgetent, termcap curses ncurses ncursesw, [], [])
71 AC_SEARCH_LIBS(readline,[readline edit], [
72 AC_DEFINE([HAVE_READLINE],1,Define to use readline or wrapper)
73 READLINE_LIBS=$LIBS
74 ])
75 LIBS=$sLIBS
76 ])
77])
78
danf6f8ac62013-05-27 17:19:58 +000079AC_SUBST(READLINE_LIBS)
80#-----------------------------------------------------------------------
81
82#-----------------------------------------------------------------------
83# --enable-threadsafe
84#
85AC_ARG_ENABLE(threadsafe, [AS_HELP_STRING(
86 [--enable-threadsafe], [build a thread-safe library [default=yes]])],
87 [], [enable_threadsafe=yes])
88THREADSAFE_FLAGS=-DSQLITE_THREADSAFE=0
89if test x"$enable_threadsafe" != "xno"; then
90 THREADSAFE_FLAGS="-D_REENTRANT=1 -DSQLITE_THREADSAFE=1"
drhba60fbb2016-01-28 02:47:32 +000091 AC_SEARCH_LIBS(pthread_create, pthread)
drh13c808a2016-01-13 21:23:48 +000092 AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
danf6f8ac62013-05-27 17:19:58 +000093fi
94AC_SUBST(THREADSAFE_FLAGS)
95#-----------------------------------------------------------------------
96
97#-----------------------------------------------------------------------
98# --enable-dynamic-extensions
99#
100AC_ARG_ENABLE(dynamic-extensions, [AS_HELP_STRING(
101 [--enable-dynamic-extensions], [support loadable extensions [default=yes]])],
102 [], [enable_dynamic_extensions=yes])
103if test x"$enable_dynamic_extensions" != "xno"; then
104 AC_SEARCH_LIBS(dlopen, dl)
105else
106 DYNAMIC_EXTENSION_FLAGS=-DSQLITE_OMIT_LOAD_EXTENSION=1
107fi
108AC_MSG_CHECKING([for whether to support dynamic extensions])
109AC_MSG_RESULT($enable_dynamic_extensions)
110AC_SUBST(DYNAMIC_EXTENSION_FLAGS)
111#-----------------------------------------------------------------------
112
dan25727512015-10-09 14:37:15 +0000113#-----------------------------------------------------------------------
114# --enable-fts5
115#
116AC_ARG_ENABLE(fts5, [AS_HELP_STRING(
117 [--enable-fts5], [include fts5 support [default=no]])],
118 [], [enable_fts5=no])
drh582c0802016-05-04 14:20:15 +0000119if test x"$enable_fts5" = "xyes"; then
dan25727512015-10-09 14:37:15 +0000120 AC_SEARCH_LIBS(log, m)
121 FTS5_FLAGS=-DSQLITE_ENABLE_FTS5
122fi
123AC_SUBST(FTS5_FLAGS)
124#-----------------------------------------------------------------------
125
126#-----------------------------------------------------------------------
127# --enable-json1
128#
129AC_ARG_ENABLE(json1, [AS_HELP_STRING(
130 [--enable-json1], [include json1 support [default=no]])],
131 [], [enable_json1=no])
drh582c0802016-05-04 14:20:15 +0000132if test x"$enable_json1" = "xyes"; then
dan25727512015-10-09 14:37:15 +0000133 JSON1_FLAGS=-DSQLITE_ENABLE_JSON1
134fi
135AC_SUBST(JSON1_FLAGS)
136#-----------------------------------------------------------------------
137
dance6cbf92015-11-13 16:59:00 +0000138#-----------------------------------------------------------------------
drh5e18d402016-05-03 13:14:18 +0000139# --enable-session
140#
141AC_ARG_ENABLE(session, [AS_HELP_STRING(
142 [--enable-session], [enable the session extension [default=no]])],
143 [], [enable_session=no])
drh582c0802016-05-04 14:20:15 +0000144if test x"$enable_session" = "xyes"; then
drh5e18d402016-05-03 13:14:18 +0000145 SESSION_FLAGS="-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
146fi
147AC_SUBST(SESSION_FLAGS)
148#-----------------------------------------------------------------------
149
150#-----------------------------------------------------------------------
dance6cbf92015-11-13 16:59:00 +0000151# --enable-static-shell
152#
153AC_ARG_ENABLE(static-shell, [AS_HELP_STRING(
154 [--enable-static-shell],
155 [statically link libsqlite3 into shell tool [default=yes]])],
156 [], [enable_static_shell=yes])
drh582c0802016-05-04 14:20:15 +0000157if test x"$enable_static_shell" = "xyes"; then
dane1f1ffa2016-03-11 15:25:13 +0000158 EXTRA_SHELL_OBJ=sqlite3-sqlite3.$OBJEXT
dance6cbf92015-11-13 16:59:00 +0000159else
160 EXTRA_SHELL_OBJ=libsqlite3.la
161fi
162AC_SUBST(EXTRA_SHELL_OBJ)
163#-----------------------------------------------------------------------
164
danf6f8ac62013-05-27 17:19:58 +0000165AC_CHECK_FUNCS(posix_fallocate)
166
167#-----------------------------------------------------------------------
168# UPDATE: Maybe it's better if users just set CFLAGS before invoking
169# configure. This option doesn't really add much...
170#
171# --enable-tempstore
172#
173# AC_ARG_ENABLE(tempstore, [AS_HELP_STRING(
174# [--enable-tempstore],
175# [in-memory temporary tables (never, no, yes, always) [default=no]])],
176# [], [enable_tempstore=no])
177# AC_MSG_CHECKING([for whether or not to store temp tables in-memory])
178# case "$enable_tempstore" in
179# never ) TEMP_STORE=0 ;;
180# no ) TEMP_STORE=1 ;;
181# always ) TEMP_STORE=3 ;;
182# yes ) TEMP_STORE=3 ;;
183# * )
184# TEMP_STORE=1
185# enable_tempstore=yes
186# ;;
187# esac
188# AC_MSG_RESULT($enable_tempstore)
189# AC_SUBST(TEMP_STORE)
190#-----------------------------------------------------------------------
191
192AC_OUTPUT