blob: ace5d5d667f05ad05b76444ea4dcee6fe5c508dd [file] [log] [blame]
drh71eb93e2001-09-28 01:34:43 +00001#
drh71eb93e2001-09-28 01:34:43 +00002# The build process allows for using a cross-compiler. But the default
3# action is to target the same platform that we are running on. The
4# configure script needs to discover the following properties of the
5# build and target systems:
6#
7# srcdir
8#
9# The is the name of the directory that contains the
10# "configure" shell script. All source files are
11# located relative to this directory.
12#
13# bindir
14#
15# The name of the directory where executables should be
16# written by the "install" target of the makefile.
17#
18# program_prefix
19#
20# Add this prefix to the names of all executables that run
21# on the target machine. Default: ""
22#
23# ENABLE_SHARED
24#
25# True if shared libraries should be generated.
26#
27# BUILD_CC
28#
29# The name of a command that is used to convert C
30# source files into executables that run on the build
31# platform.
32#
33# BUILD_CFLAGS
34#
35# Switches that the build compiler needs in order to construct
36# command-line programs.
37#
38# BUILD_LIBS
39#
40# Libraries that the build compiler needs in order to construct
41# command-line programs.
42#
43# BUILD_EXEEXT
44#
45# The filename extension for executables on the build
46# platform. "" for Unix and ".exe" for Windows.
47#
drh7b5717e2004-11-25 13:50:01 +000048# TCL_*
drh71eb93e2001-09-28 01:34:43 +000049#
drh7b5717e2004-11-25 13:50:01 +000050# Lots of values are read in from the tclConfig.sh script,
drh4b2266a2004-11-27 15:52:16 +000051# if that script is available. This values are used for
52# constructing and installing the TCL extension.
drh71eb93e2001-09-28 01:34:43 +000053#
54# TARGET_READLINE_LIBS
55#
56# This is the library directives passed to the target linker
57# that cause the executable to link against the readline library.
58# This might be a switch like "-lreadline" or pathnames of library
59# file like "../../src/libreadline.a".
60#
61# TARGET_READLINE_INC
62#
63# This variables define the directory that contain header
64# files for the readline library. If the compiler is able
65# to find <readline.h> on its own, then this can be blank.
66#
drh71eb93e2001-09-28 01:34:43 +000067# TARGET_EXEEXT
68#
69# The filename extension for executables on the
70# target platform. "" for Unix and ".exe" for windows.
71#
drh71eb93e2001-09-28 01:34:43 +000072# This configure.in file is easy to reuse on other projects. Just
73# change the argument to AC_INIT(). And disable any features that
74# you don't need (for example BLT) by erasing or commenting out
75# the corresponding code.
76#
mlcreechb87057f2008-03-06 07:19:20 +000077AC_INIT(sqlite, m4_esyscmd([cat VERSION | tr -d '\n']))
drh71eb93e2001-09-28 01:34:43 +000078
vapierfaa68db2009-04-01 07:38:31 +000079dnl Make sure the local VERSION file matches this configure script
danielk19776f050aa2009-04-25 08:39:14 +000080sqlite_version_sanity_check=`cat $srcdir/VERSION | tr -d '\n'`
vapierfaa68db2009-04-01 07:38:31 +000081if test "$PACKAGE_VERSION" != "$sqlite_version_sanity_check" ; then
82AC_MSG_ERROR([configure script is out of date:
83 configure \$PACKAGE_VERSION = $PACKAGE_VERSION
84 top level VERSION file = $sqlite_version_sanity_check
85please regen with autoconf])
86fi
87
drh71eb93e2001-09-28 01:34:43 +000088#########
89# Programs needed
90#
91AC_PROG_LIBTOOL
92AC_PROG_INSTALL
93
94#########
mlcreech636a9952008-05-05 22:52:56 +000095# Enable large file support (if special flags are necessary)
96#
97AC_SYS_LARGEFILE
98
99#########
mlcreechb87057f2008-03-06 07:19:20 +0000100# Check for needed/wanted data types
101AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t,
102 uint16_t, uint32_t, uint64_t, uintptr_t])
103
104#########
105# Check for needed/wanted headers
drh86c5a932012-02-08 12:13:28 +0000106AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h])
mlcreech5b0a9eb2008-03-09 01:38:09 +0000107
108#########
109# Figure out whether or not we have these functions
110#
drhe32a2562016-03-04 02:38:00 +0000111AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64])
mlcreech5b0a9eb2008-03-09 01:38:09 +0000112
mlcreechab1c47b2008-03-09 02:51:10 +0000113#########
mlcreechf3868112008-03-11 18:03:30 +0000114# By default, we use the amalgamation (this may be changed below...)
115#
116USE_AMALGAMATION=1
117
118#########
mlcreechab1c47b2008-03-09 02:51:10 +0000119# See whether we can run specific tclsh versions known to work well;
120# if not, then we fall back to plain tclsh.
121# TODO: try other versions before falling back?
122#
drh0b11bcb2017-09-22 00:24:44 +0000123AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.7 tclsh8.6 tclsh8.5 tclsh], none)
mlcreechf3868112008-03-11 18:03:30 +0000124if test "$TCLSH_CMD" = "none"; then
125 # If we can't find a local tclsh, then building the amalgamation will fail.
126 # We act as though --disable-amalgamation has been used.
127 echo "Warning: can't find tclsh - defaulting to non-amalgamation build."
128 USE_AMALGAMATION=0
129 TCLSH_CMD="tclsh"
130fi
mlcreechab1c47b2008-03-09 02:51:10 +0000131AC_SUBST(TCLSH_CMD)
132
vapier6d120f32009-01-28 04:46:14 +0000133AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin])
134if test "x${TCLLIBDIR+set}" != "xset" ; then
135 TCLLIBDIR='$(libdir)'
136 for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do
137 TCLLIBDIR=$i
138 break
139 done
140 TCLLIBDIR="${TCLLIBDIR}/sqlite3"
141fi
142
mlcreechb87057f2008-03-06 07:19:20 +0000143
144#########
drh71eb93e2001-09-28 01:34:43 +0000145# Set up an appropriate program prefix
146#
147if test "$program_prefix" = "NONE"; then
148 program_prefix=""
149fi
150AC_SUBST(program_prefix)
151
drh4b2266a2004-11-27 15:52:16 +0000152VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
vapier695f0972009-01-26 21:43:16 +0000153AC_MSG_NOTICE(Version set to $VERSION)
a.rottmannc7e93832003-03-24 09:39:32 +0000154AC_SUBST(VERSION)
drh4b2266a2004-11-27 15:52:16 +0000155RELEASE=`cat $srcdir/VERSION`
vapier695f0972009-01-26 21:43:16 +0000156AC_MSG_NOTICE(Release set to $RELEASE)
drh4b2266a2004-11-27 15:52:16 +0000157AC_SUBST(RELEASE)
vapier695f0972009-01-26 21:43:16 +0000158VERSION_NUMBER=[`cat $srcdir/VERSION \
drhb7977832005-02-16 03:45:51 +0000159 | sed 's/[^0-9]/ /g' \
drh26d0e2a2005-07-06 13:51:27 +0000160 | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
vapier695f0972009-01-26 21:43:16 +0000161AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
drhb7977832005-02-16 03:45:51 +0000162AC_SUBST(VERSION_NUMBER)
a.rottmannc7e93832003-03-24 09:39:32 +0000163
drh71eb93e2001-09-28 01:34:43 +0000164#########
drh71eb93e2001-09-28 01:34:43 +0000165# Locate a compiler for the build machine. This compiler should
166# generate command-line programs that run on the build machine.
167#
vapierc8a15302007-02-17 14:31:55 +0000168if test x"$cross_compiling" = xno; then
169 BUILD_CC=$CC
170 BUILD_CFLAGS=$CFLAGS
drh71eb93e2001-09-28 01:34:43 +0000171else
vapierc8a15302007-02-17 14:31:55 +0000172 if test "${BUILD_CC+set}" != set; then
173 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
174 fi
175 if test "${BUILD_CFLAGS+set}" != set; then
176 BUILD_CFLAGS="-g"
177 fi
drh71eb93e2001-09-28 01:34:43 +0000178fi
179AC_SUBST(BUILD_CC)
drh71eb93e2001-09-28 01:34:43 +0000180
181##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000182# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000183#
dougcurrie0f290bf2004-06-21 18:57:29 +0000184AC_ARG_ENABLE(threadsafe,
drh05c7e0b2015-01-10 14:27:17 +0000185AC_HELP_STRING([--disable-threadsafe],[Disable mutexing]),,enable_threadsafe=yes)
dougcurrie0f290bf2004-06-21 18:57:29 +0000186AC_MSG_CHECKING([whether to support threadsafe operation])
187if test "$enable_threadsafe" = "no"; then
drh5a3032b2007-09-03 16:12:09 +0000188 SQLITE_THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000189 AC_MSG_RESULT([no])
190else
drh5a3032b2007-09-03 16:12:09 +0000191 SQLITE_THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000192 AC_MSG_RESULT([yes])
193fi
drh5a3032b2007-09-03 16:12:09 +0000194AC_SUBST(SQLITE_THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000195
drh5a3032b2007-09-03 16:12:09 +0000196if test "$SQLITE_THREADSAFE" = "1"; then
drhba60fbb2016-01-28 02:47:32 +0000197 AC_SEARCH_LIBS(pthread_create, pthread)
drh13c808a2016-01-13 21:23:48 +0000198 AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
dougcurrie65623c72004-09-20 14:57:23 +0000199fi
dougcurrie65623c72004-09-20 14:57:23 +0000200
paulb0208cc2003-04-13 18:26:49 +0000201##########
xdong3b5543c2003-09-23 00:36:50 +0000202# Do we want to support release
203#
204AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000205AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000206AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
207if test "$enable_releasemode" = "no"; then
208 ALLOWRELEASE=""
209 AC_MSG_RESULT([no])
210else
drh0b47d342007-11-27 14:50:06 +0000211 ALLOWRELEASE="-release `cat $srcdir/VERSION`"
xdong3b5543c2003-09-23 00:36:50 +0000212 AC_MSG_RESULT([yes])
213fi
214AC_SUBST(ALLOWRELEASE)
215
216##########
paulb0208cc2003-04-13 18:26:49 +0000217# Do we want temporary databases in memory
218#
dougcurrie0f290bf2004-06-21 18:57:29 +0000219AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000220AC_HELP_STRING([--enable-tempstore],[Use an in-ram database for temporary tables (never,no,yes,always)]),,enable_tempstore=no)
paulb0208cc2003-04-13 18:26:49 +0000221AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000222case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000223 never )
paul2dc96f92003-04-20 11:46:34 +0000224 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000225 AC_MSG_RESULT([never])
226 ;;
227 no )
paul2dc96f92003-04-20 11:46:34 +0000228 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000229 AC_MSG_RESULT([no])
230 ;;
drh54414bb2005-10-10 00:05:50 +0000231 yes )
drh8b727472009-01-19 18:18:40 +0000232 TEMP_STORE=2
233 AC_MSG_RESULT([yes])
234 ;;
235 always )
drh54414bb2005-10-10 00:05:50 +0000236 TEMP_STORE=3
237 AC_MSG_RESULT([always])
238 ;;
paulb0208cc2003-04-13 18:26:49 +0000239 * )
drh54414bb2005-10-10 00:05:50 +0000240 TEMP_STORE=1
drh8b727472009-01-19 18:18:40 +0000241 AC_MSG_RESULT([no])
paulb0208cc2003-04-13 18:26:49 +0000242 ;;
243esac
paul2dc96f92003-04-20 11:46:34 +0000244
paul2dc96f92003-04-20 11:46:34 +0000245AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000246
drh71eb93e2001-09-28 01:34:43 +0000247###########
248# Lots of things are different if we are compiling for Windows using
249# the CYGWIN environment. So check for that special case and handle
250# things accordingly.
251#
252AC_MSG_CHECKING([if executables have the .exe suffix])
253if test "$config_BUILD_EXEEXT" = ".exe"; then
254 CYGWIN=yes
255 AC_MSG_RESULT(yes)
256else
257 AC_MSG_RESULT(unknown)
258fi
259if test "$CYGWIN" != "yes"; then
260 AC_CYGWIN
261fi
262if test "$CYGWIN" = "yes"; then
263 BUILD_EXEEXT=.exe
264else
dougcurrie6194a5f2003-12-19 20:09:51 +0000265 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000266fi
vapierc8a15302007-02-17 14:31:55 +0000267if test x"$cross_compiling" = xno; then
drh71eb93e2001-09-28 01:34:43 +0000268 TARGET_EXEEXT=$BUILD_EXEEXT
269else
270 TARGET_EXEEXT=$config_TARGET_EXEEXT
271fi
272if test "$TARGET_EXEEXT" = ".exe"; then
mistachkinfe27b082013-08-28 18:06:26 +0000273 SQLITE_OS_UNIX=0
274 SQLITE_OS_WIN=1
275 CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
drh71eb93e2001-09-28 01:34:43 +0000276else
danielk197729bafea2008-06-26 10:41:19 +0000277 SQLITE_OS_UNIX=1
278 SQLITE_OS_WIN=0
danielk197729bafea2008-06-26 10:41:19 +0000279 CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000280fi
drh71eb93e2001-09-28 01:34:43 +0000281
282AC_SUBST(BUILD_EXEEXT)
danielk197729bafea2008-06-26 10:41:19 +0000283AC_SUBST(SQLITE_OS_UNIX)
284AC_SUBST(SQLITE_OS_WIN)
drh71eb93e2001-09-28 01:34:43 +0000285AC_SUBST(TARGET_EXEEXT)
286
287##########
drh7b5717e2004-11-25 13:50:01 +0000288# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000289#
drh7b5717e2004-11-25 13:50:01 +0000290# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
291# macros in the in the tcl.m4 file of the standard TCL distribution.
292# Those macros could not be used directly since we have to make some
293# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000294#
drh94e4f822006-02-15 02:00:25 +0000295AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000296 [use_tcl=$enableval],[use_tcl=yes])
297if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000298 AC_ARG_WITH(tcl, AC_HELP_STRING([--with-tcl=DIR],[directory containing tcl configuration (tclConfig.sh)]), with_tclconfig=${withval})
drh7b5717e2004-11-25 13:50:01 +0000299 AC_MSG_CHECKING([for Tcl configuration])
300 AC_CACHE_VAL(ac_cv_c_tclconfig,[
301 # First check to see if --with-tcl was specified.
302 if test x"${with_tclconfig}" != x ; then
303 if test -f "${with_tclconfig}/tclConfig.sh" ; then
304 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
305 else
306 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
307 fi
drh71eb93e2001-09-28 01:34:43 +0000308 fi
vapierfe7e82e2009-01-26 21:39:33 +0000309
310 # Start autosearch by asking tclsh
drhe74f4652012-08-15 16:06:54 +0000311 if test x"${ac_cv_c_tclconfig}" = x ; then
312 if test x"$cross_compiling" = xno; then
313 for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
314 do
315 if test -f "$i/tclConfig.sh" ; then
316 ac_cv_c_tclconfig="$i"
317 break
318 fi
319 done
320 fi
vapierfe7e82e2009-01-26 21:39:33 +0000321 fi
322
drhf960a642015-05-30 22:57:49 +0000323 # On ubuntu 14.10, $auto_path on tclsh is not quite correct.
324 # So try again after applying corrections.
325 if test x"${ac_cv_c_tclconfig}" = x ; then
326 if test x"$cross_compiling" = xno; then
327 for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'`
328 do
329 if test -f "$i/tclConfig.sh" ; then
330 ac_cv_c_tclconfig="$i"
331 break
332 fi
333 done
334 fi
335 fi
336
drh68314742016-05-23 00:10:58 +0000337 # Recent versions of Xcode on Macs hid the tclConfig.sh file
338 # in a strange place.
339 if test x"${ac_cv_c_tclconfig}" = x ; then
340 if test x"$cross_compiling" = xno; then
341 for i in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk/usr/lib
342 do
343 if test -f "$i/tclConfig.sh" ; then
344 ac_cv_c_tclconfig="$i"
345 break
346 fi
347 done
348 fi
349 fi
350
drh7b5717e2004-11-25 13:50:01 +0000351 # then check for a private Tcl installation
352 if test x"${ac_cv_c_tclconfig}" = x ; then
353 for i in \
354 ../tcl \
355 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
356 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
357 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
358 ../../tcl \
359 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
360 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
361 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
362 ../../../tcl \
363 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
364 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
365 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
366 do
367 if test -f "$i/unix/tclConfig.sh" ; then
368 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
369 break
370 fi
371 done
372 fi
373
374 # check in a few common install locations
375 if test x"${ac_cv_c_tclconfig}" = x ; then
376 for i in \
377 `ls -d ${libdir} 2>/dev/null` \
378 `ls -d /usr/local/lib 2>/dev/null` \
379 `ls -d /usr/contrib/lib 2>/dev/null` \
380 `ls -d /usr/lib 2>/dev/null`
381 do
382 if test -f "$i/tclConfig.sh" ; then
383 ac_cv_c_tclconfig=`(cd $i; pwd)`
384 break
385 fi
386 done
387 fi
388
389 # check in a few other private locations
390 if test x"${ac_cv_c_tclconfig}" = x ; then
391 for i in \
392 ${srcdir}/../tcl \
393 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
394 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
395 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
396 do
397 if test -f "$i/unix/tclConfig.sh" ; then
398 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
399 break
400 fi
401 done
402 fi
403 ])
404
405 if test x"${ac_cv_c_tclconfig}" = x ; then
406 use_tcl=no
407 AC_MSG_WARN(Can't find Tcl configuration definitions)
408 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
409 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
410 else
411 TCL_BIN_DIR=${ac_cv_c_tclconfig}
412 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
413
414 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
415 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
416 AC_MSG_RESULT([loading])
417 . $TCL_BIN_DIR/tclConfig.sh
418 else
419 AC_MSG_RESULT([file not found])
420 fi
421
422 #
423 # If the TCL_BIN_DIR is the build directory (not the install directory),
424 # then set the common variable name to the value of the build variables.
425 # For example, the variable TCL_LIB_SPEC will be set to the value
426 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
427 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
428 # installed and uninstalled version of Tcl.
429 #
430
mlcreechab1c47b2008-03-09 02:51:10 +0000431 if test -f $TCL_BIN_DIR/Makefile ; then
drh7b5717e2004-11-25 13:50:01 +0000432 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
433 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
434 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
435 fi
436
437 #
438 # eval is required to do the TCL_DBGX substitution
439 #
440
441 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
442 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
443 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
444
445 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
446 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
447 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
448
449 AC_SUBST(TCL_VERSION)
450 AC_SUBST(TCL_BIN_DIR)
451 AC_SUBST(TCL_SRC_DIR)
drh7b5717e2004-11-25 13:50:01 +0000452 AC_SUBST(TCL_INCLUDE_SPEC)
453
454 AC_SUBST(TCL_LIB_FILE)
455 AC_SUBST(TCL_LIB_FLAG)
456 AC_SUBST(TCL_LIB_SPEC)
457
458 AC_SUBST(TCL_STUB_LIB_FILE)
459 AC_SUBST(TCL_STUB_LIB_FLAG)
460 AC_SUBST(TCL_STUB_LIB_SPEC)
drhd881ce82015-03-31 17:01:52 +0000461 AC_SUBST(TCL_SHLIB_SUFFIX)
drh7b5717e2004-11-25 13:50:01 +0000462 fi
drh71eb93e2001-09-28 01:34:43 +0000463fi
drh7b5717e2004-11-25 13:50:01 +0000464if test "${use_tcl}" = "no" ; then
465 HAVE_TCL=""
466else
467 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000468fi
drh7b5717e2004-11-25 13:50:01 +0000469AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000470
471##########
472# Figure out what C libraries are required to compile programs
473# that use "readline()" library.
474#
vapier4c10a8a2007-02-17 14:28:26 +0000475TARGET_READLINE_LIBS=""
476TARGET_READLINE_INC=""
477TARGET_HAVE_READLINE=0
drhe44b8352015-10-30 14:25:57 +0000478TARGET_HAVE_EDITLINE=0
479AC_ARG_ENABLE([editline],
480 [AC_HELP_STRING([--enable-editline],[enable BSD editline support])],
481 [with_editline=$enableval],
482 [with_editline=auto])
vapier4c10a8a2007-02-17 14:28:26 +0000483AC_ARG_ENABLE([readline],
drhe44b8352015-10-30 14:25:57 +0000484 [AC_HELP_STRING([--disable-readline],[disable readline support])],
vapier4c10a8a2007-02-17 14:28:26 +0000485 [with_readline=$enableval],
486 [with_readline=auto])
487
drhe44b8352015-10-30 14:25:57 +0000488if test x"$with_editline" != xno; then
489 sLIBS=$LIBS
490 LIBS=""
491 TARGET_HAVE_EDITLINE=1
492 AC_SEARCH_LIBS(readline,edit,[with_readline=no],[TARGET_HAVE_EDITLINE=0])
493 TARGET_READLINE_LIBS=$LIBS
494 LIBS=$sLIBS
495fi
vapier4c10a8a2007-02-17 14:28:26 +0000496if test x"$with_readline" != xno; then
497 found="yes"
498
499 AC_ARG_WITH([readline-lib],
500 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
501 [with_readline_lib=$withval],
502 [with_readline_lib="auto"])
503 if test "x$with_readline_lib" = xauto; then
504 save_LIBS="$LIBS"
505 LIBS=""
506 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
507 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
508 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
509 LIBS="$save_LIBS"
510 else
511 TARGET_READLINE_LIBS="$with_readline_lib"
512 fi
513
514 AC_ARG_WITH([readline-inc],
515 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
516 [with_readline_inc=$withval],
517 [with_readline_inc="auto"])
518 if test "x$with_readline_inc" = xauto; then
519 AC_CHECK_HEADER(readline.h, [found="yes"], [
520 found="no"
521 if test "$cross_compiling" != yes; then
522 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
523 for subdir in include include/readline; do
524 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
525 if test "$found" = "yes"; then
526 TARGET_READLINE_INC="-I$dir/$subdir"
527 break
528 fi
529 done
530 test "$found" = "yes" && break
531 done
532 fi
533 ])
534 else
535 TARGET_READLINE_INC="$with_readline_inc"
536 fi
537
538 if test x"$found" = xno; then
539 TARGET_READLINE_LIBS=""
540 TARGET_READLINE_INC=""
541 TARGET_HAVE_READLINE=0
542 else
543 TARGET_HAVE_READLINE=1
544 fi
drh71eb93e2001-09-28 01:34:43 +0000545fi
vapier4c10a8a2007-02-17 14:28:26 +0000546
drh71eb93e2001-09-28 01:34:43 +0000547AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000548AC_SUBST(TARGET_READLINE_INC)
549AC_SUBST(TARGET_HAVE_READLINE)
drhe44b8352015-10-30 14:25:57 +0000550AC_SUBST(TARGET_HAVE_EDITLINE)
drh71eb93e2001-09-28 01:34:43 +0000551
552##########
drhf1878b42006-01-23 18:06:52 +0000553# Figure out what C libraries are required to compile programs
554# that use "fdatasync()" function.
555#
drhf1878b42006-01-23 18:06:52 +0000556AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000557
drh71eb93e2001-09-28 01:34:43 +0000558#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000559# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000560AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000561 [use_debug=$enableval],[use_debug=no])
562if test "${use_debug}" = "yes" ; then
drh32d0eba2017-04-05 10:54:14 +0000563 TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0"
tpoindex9d9f76c2005-01-03 21:28:56 +0000564else
565 TARGET_DEBUG="-DNDEBUG"
566fi
567AC_SUBST(TARGET_DEBUG)
568
569#########
mlcreech94984912008-03-04 19:03:08 +0000570# See whether we should use the amalgamation to build
571AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
mlcreech969b2cd2008-03-14 04:11:03 +0000572 [Disable the amalgamation and instead build all files separately]),
mlcreech94984912008-03-04 19:03:08 +0000573 [use_amalgamation=$enableval],[use_amalgamation=yes])
mlcreechf3868112008-03-11 18:03:30 +0000574if test "${use_amalgamation}" != "yes" ; then
mlcreech94984912008-03-04 19:03:08 +0000575 USE_AMALGAMATION=0
576fi
577AC_SUBST(USE_AMALGAMATION)
578
579#########
mlcreecha4edab02008-03-06 04:14:17 +0000580# See whether we should allow loadable extensions
drh05c7e0b2015-01-10 14:27:17 +0000581AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension],
582 [Disable loading of external extensions]),
583 [use_loadextension=$enableval],[use_loadextension=yes])
mlcreecha4edab02008-03-06 04:14:17 +0000584if test "${use_loadextension}" = "yes" ; then
shanefbedede2008-07-22 05:05:01 +0000585 OPT_FEATURE_FLAGS=""
drhdbe4b882011-06-20 18:00:17 +0000586 AC_SEARCH_LIBS(dlopen, dl)
mlcreecha4edab02008-03-06 04:14:17 +0000587else
shanefbedede2008-07-22 05:05:01 +0000588 OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
mlcreecha4edab02008-03-06 04:14:17 +0000589fi
mlcreecha4edab02008-03-06 04:14:17 +0000590
drhc530b9c2016-07-25 11:27:22 +0000591##########
592# Do we want to support memsys3 and/or memsys5
593#
drhc530b9c2016-07-25 11:27:22 +0000594AC_ARG_ENABLE(memsys5,
drh26197d12016-07-25 11:32:09 +0000595 AC_HELP_STRING([--enable-memsys5],[Enable MEMSYS5]),
596 [enable_memsys5=yes],[enable_memsys5=no])
drhc530b9c2016-07-25 11:27:22 +0000597AC_MSG_CHECKING([whether to support MEMSYS5])
drh26197d12016-07-25 11:32:09 +0000598if test "${enable_memsys5}" = "yes"; then
drh8c9ed052017-05-29 17:43:06 +0000599 OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MEMSYS5"
drhc530b9c2016-07-25 11:27:22 +0000600 AC_MSG_RESULT([yes])
601else
602 AC_MSG_RESULT([no])
603fi
drh5d513ba2016-07-25 11:57:21 +0000604AC_ARG_ENABLE(memsys3,
605 AC_HELP_STRING([--enable-memsys3],[Enable MEMSYS3]),
606 [enable_memsys3=yes],[enable_memsys3=no])
607AC_MSG_CHECKING([whether to support MEMSYS3])
608if test "${enable_memsys3}" = "yes" -a "${enable_memsys5}" = "no"; then
drh8c9ed052017-05-29 17:43:06 +0000609 OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MEMSYS3"
drh5d513ba2016-07-25 11:57:21 +0000610 AC_MSG_RESULT([yes])
611else
612 AC_MSG_RESULT([no])
613fi
drhc530b9c2016-07-25 11:27:22 +0000614
mlcreechaac7b932008-04-01 02:45:22 +0000615#########
drhce1d9f52015-10-09 12:48:33 +0000616# See whether we should enable Full Text Search extensions
617AC_ARG_ENABLE(fts3, AC_HELP_STRING([--enable-fts3],
618 [Enable the FTS3 extension]),
619 [enable_fts3=yes],[enable_fts3=no])
620if test "${enable_fts3}" = "yes" ; then
drh8c9ed052017-05-29 17:43:06 +0000621 OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS3"
drhce1d9f52015-10-09 12:48:33 +0000622fi
623AC_ARG_ENABLE(fts4, AC_HELP_STRING([--enable-fts4],
624 [Enable the FTS4 extension]),
625 [enable_fts4=yes],[enable_fts4=no])
626if test "${enable_fts4}" = "yes" ; then
drh8c9ed052017-05-29 17:43:06 +0000627 OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS4"
drhce1d9f52015-10-09 12:48:33 +0000628 AC_SEARCH_LIBS([log],[m])
629fi
630AC_ARG_ENABLE(fts5, AC_HELP_STRING([--enable-fts5],
631 [Enable the FTS5 extension]),
632 [enable_fts5=yes],[enable_fts5=no])
633if test "${enable_fts5}" = "yes" ; then
drh8c9ed052017-05-29 17:43:06 +0000634 OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS5"
drhce1d9f52015-10-09 12:48:33 +0000635 AC_SEARCH_LIBS([log],[m])
636fi
637
638#########
639# See whether we should enable JSON1
640AC_ARG_ENABLE(json1, AC_HELP_STRING([--enable-json1],
641 [Enable the JSON1 extension]),
642 [enable_json1=yes],[enable_json1=no])
643if test "${enable_json1}" = "yes" ; then
drh8c9ed052017-05-29 17:43:06 +0000644 OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_JSON1"
drhce1d9f52015-10-09 12:48:33 +0000645fi
646
647#########
drh83bebdd2017-08-28 17:00:12 +0000648# See whether we should enable the LIMIT clause on UPDATE and DELETE
649# statements.
650AC_ARG_ENABLE(update-limit, AC_HELP_STRING([--enable-update-limit],
651 [Enable the UPDATE/DELETE LIMIT clause]),
652 [enable_udlimit=yes],[enable_udlimit=no])
653if test "${enable_udlimit}" = "yes" ; then
654 OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT"
655fi
656
657#########
drhce1d9f52015-10-09 12:48:33 +0000658# See whether we should enable RTREE
659AC_ARG_ENABLE(rtree, AC_HELP_STRING([--enable-rtree],
660 [Enable the RTREE extension]),
661 [enable_rtree=yes],[enable_rtree=no])
662if test "${enable_rtree}" = "yes" ; then
drh8c9ed052017-05-29 17:43:06 +0000663 OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_RTREE"
drhce1d9f52015-10-09 12:48:33 +0000664fi
665
666#########
drh5e18d402016-05-03 13:14:18 +0000667# See whether we should enable the SESSION extension
668AC_ARG_ENABLE(session, AC_HELP_STRING([--enable-session],
669 [Enable the SESSION extension]),
670 [enable_session=yes],[enable_session=no])
671if test "${enable_session}" = "yes" ; then
drh8c9ed052017-05-29 17:43:06 +0000672 OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_SESSION"
673 OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_PREUPDATE_HOOK"
drh5e18d402016-05-03 13:14:18 +0000674fi
675
676#########
drh8c9ed052017-05-29 17:43:06 +0000677# attempt to duplicate any OMITS and ENABLES into the ${OPT_FEATURE_FLAGS} parameter
shanefbedede2008-07-22 05:05:01 +0000678for option in $CFLAGS $CPPFLAGS
679do
680 case $option in
danielk197733a14782008-08-04 14:50:05 +0000681 -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
shaneb1cd7302008-10-22 18:27:31 +0000682 -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000683 esac
684done
685AC_SUBST(OPT_FEATURE_FLAGS)
686
687
shaneb1cd7302008-10-22 18:27:31 +0000688# attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000689ac_temp_CFLAGS=""
690for option in $CFLAGS
691do
692 case $option in
693 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000694 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000695 *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000696 esac
697done
698CFLAGS=$ac_temp_CFLAGS
699
700
shaneb1cd7302008-10-22 18:27:31 +0000701# attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000702ac_temp_CPPFLAGS=""
703for option in $CPPFLAGS
704do
705 case $option in
706 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000707 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000708 *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000709 esac
710done
711CPPFLAGS=$ac_temp_CPPFLAGS
712
713
shaneb1cd7302008-10-22 18:27:31 +0000714# attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000715ac_temp_BUILD_CFLAGS=""
716for option in $BUILD_CFLAGS
717do
718 case $option in
719 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000720 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000721 *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000722 esac
723done
724BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
725
726
727#########
728# See whether we should use GCOV
mlcreechaac7b932008-04-01 02:45:22 +0000729AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
730 [Enable coverage testing using gcov]),
731 [use_gcov=$enableval],[use_gcov=no])
732if test "${use_gcov}" = "yes" ; then
733 USE_GCOV=1
734else
735 USE_GCOV=0
736fi
737AC_SUBST(USE_GCOV)
738
drhaf6edf52005-10-04 18:38:49 +0000739
drh71eb93e2001-09-28 01:34:43 +0000740#########
mlcreechb87057f2008-03-06 07:19:20 +0000741# Output the config header
mlcreech23797062008-03-20 02:25:35 +0000742AC_CONFIG_HEADERS(config.h)
mlcreechb87057f2008-03-06 07:19:20 +0000743
744#########
drh71eb93e2001-09-28 01:34:43 +0000745# Generate the output files.
746#
mlcreech8390bc32008-03-06 08:54:38 +0000747AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000748AC_OUTPUT([
749Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000750sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000751])