blob: 11ab81d3428b55fcf00e84ee8c7051c083106eca [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#
drh39311122015-01-15 17:38:35 +0000111AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime])
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#
mistachkinfe27b082013-08-28 18:06:26 +0000123AC_CHECK_PROGS(TCLSH_CMD, [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
mlcreechc658b0f2008-03-09 02:20:11 +0000197 AC_SEARCH_LIBS(pthread_create, pthread)
dougcurrie65623c72004-09-20 14:57:23 +0000198fi
dougcurrie65623c72004-09-20 14:57:23 +0000199
paulb0208cc2003-04-13 18:26:49 +0000200##########
xdong3b5543c2003-09-23 00:36:50 +0000201# Do we want to support release
202#
203AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000204AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000205AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
206if test "$enable_releasemode" = "no"; then
207 ALLOWRELEASE=""
208 AC_MSG_RESULT([no])
209else
drh0b47d342007-11-27 14:50:06 +0000210 ALLOWRELEASE="-release `cat $srcdir/VERSION`"
xdong3b5543c2003-09-23 00:36:50 +0000211 AC_MSG_RESULT([yes])
212fi
213AC_SUBST(ALLOWRELEASE)
214
215##########
paulb0208cc2003-04-13 18:26:49 +0000216# Do we want temporary databases in memory
217#
dougcurrie0f290bf2004-06-21 18:57:29 +0000218AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000219AC_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 +0000220AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000221case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000222 never )
paul2dc96f92003-04-20 11:46:34 +0000223 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000224 AC_MSG_RESULT([never])
225 ;;
226 no )
paul2dc96f92003-04-20 11:46:34 +0000227 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000228 AC_MSG_RESULT([no])
229 ;;
drh54414bb2005-10-10 00:05:50 +0000230 yes )
drh8b727472009-01-19 18:18:40 +0000231 TEMP_STORE=2
232 AC_MSG_RESULT([yes])
233 ;;
234 always )
drh54414bb2005-10-10 00:05:50 +0000235 TEMP_STORE=3
236 AC_MSG_RESULT([always])
237 ;;
paulb0208cc2003-04-13 18:26:49 +0000238 * )
drh54414bb2005-10-10 00:05:50 +0000239 TEMP_STORE=1
drh8b727472009-01-19 18:18:40 +0000240 AC_MSG_RESULT([no])
paulb0208cc2003-04-13 18:26:49 +0000241 ;;
242esac
paul2dc96f92003-04-20 11:46:34 +0000243
paul2dc96f92003-04-20 11:46:34 +0000244AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000245
drh71eb93e2001-09-28 01:34:43 +0000246###########
247# Lots of things are different if we are compiling for Windows using
248# the CYGWIN environment. So check for that special case and handle
249# things accordingly.
250#
251AC_MSG_CHECKING([if executables have the .exe suffix])
252if test "$config_BUILD_EXEEXT" = ".exe"; then
253 CYGWIN=yes
254 AC_MSG_RESULT(yes)
255else
256 AC_MSG_RESULT(unknown)
257fi
258if test "$CYGWIN" != "yes"; then
259 AC_CYGWIN
260fi
261if test "$CYGWIN" = "yes"; then
262 BUILD_EXEEXT=.exe
263else
dougcurrie6194a5f2003-12-19 20:09:51 +0000264 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000265fi
vapierc8a15302007-02-17 14:31:55 +0000266if test x"$cross_compiling" = xno; then
drh71eb93e2001-09-28 01:34:43 +0000267 TARGET_EXEEXT=$BUILD_EXEEXT
268else
269 TARGET_EXEEXT=$config_TARGET_EXEEXT
270fi
271if test "$TARGET_EXEEXT" = ".exe"; then
mistachkinfe27b082013-08-28 18:06:26 +0000272 SQLITE_OS_UNIX=0
273 SQLITE_OS_WIN=1
274 CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
drh71eb93e2001-09-28 01:34:43 +0000275else
danielk197729bafea2008-06-26 10:41:19 +0000276 SQLITE_OS_UNIX=1
277 SQLITE_OS_WIN=0
danielk197729bafea2008-06-26 10:41:19 +0000278 CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000279fi
drh71eb93e2001-09-28 01:34:43 +0000280
281AC_SUBST(BUILD_EXEEXT)
danielk197729bafea2008-06-26 10:41:19 +0000282AC_SUBST(SQLITE_OS_UNIX)
283AC_SUBST(SQLITE_OS_WIN)
drh71eb93e2001-09-28 01:34:43 +0000284AC_SUBST(TARGET_EXEEXT)
285
286##########
drh7b5717e2004-11-25 13:50:01 +0000287# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000288#
drh7b5717e2004-11-25 13:50:01 +0000289# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
290# macros in the in the tcl.m4 file of the standard TCL distribution.
291# Those macros could not be used directly since we have to make some
292# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000293#
drh94e4f822006-02-15 02:00:25 +0000294AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000295 [use_tcl=$enableval],[use_tcl=yes])
296if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000297 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 +0000298 AC_MSG_CHECKING([for Tcl configuration])
299 AC_CACHE_VAL(ac_cv_c_tclconfig,[
300 # First check to see if --with-tcl was specified.
301 if test x"${with_tclconfig}" != x ; then
302 if test -f "${with_tclconfig}/tclConfig.sh" ; then
303 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
304 else
305 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
306 fi
drh71eb93e2001-09-28 01:34:43 +0000307 fi
vapierfe7e82e2009-01-26 21:39:33 +0000308
309 # Start autosearch by asking tclsh
drhe74f4652012-08-15 16:06:54 +0000310 if test x"${ac_cv_c_tclconfig}" = x ; then
311 if test x"$cross_compiling" = xno; then
312 for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
313 do
314 if test -f "$i/tclConfig.sh" ; then
315 ac_cv_c_tclconfig="$i"
316 break
317 fi
318 done
319 fi
vapierfe7e82e2009-01-26 21:39:33 +0000320 fi
321
drhf960a642015-05-30 22:57:49 +0000322 # On ubuntu 14.10, $auto_path on tclsh is not quite correct.
323 # So try again after applying corrections.
324 if test x"${ac_cv_c_tclconfig}" = x ; then
325 if test x"$cross_compiling" = xno; then
326 for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'`
327 do
328 if test -f "$i/tclConfig.sh" ; then
329 ac_cv_c_tclconfig="$i"
330 break
331 fi
332 done
333 fi
334 fi
335
drh7b5717e2004-11-25 13:50:01 +0000336 # then check for a private Tcl installation
337 if test x"${ac_cv_c_tclconfig}" = x ; then
338 for i in \
339 ../tcl \
340 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
341 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
342 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
343 ../../tcl \
344 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
345 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
346 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
347 ../../../tcl \
348 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
349 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
350 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
351 do
352 if test -f "$i/unix/tclConfig.sh" ; then
353 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
354 break
355 fi
356 done
357 fi
358
359 # check in a few common install locations
360 if test x"${ac_cv_c_tclconfig}" = x ; then
361 for i in \
362 `ls -d ${libdir} 2>/dev/null` \
363 `ls -d /usr/local/lib 2>/dev/null` \
364 `ls -d /usr/contrib/lib 2>/dev/null` \
365 `ls -d /usr/lib 2>/dev/null`
366 do
367 if test -f "$i/tclConfig.sh" ; then
368 ac_cv_c_tclconfig=`(cd $i; pwd)`
369 break
370 fi
371 done
372 fi
373
374 # check in a few other private locations
375 if test x"${ac_cv_c_tclconfig}" = x ; then
376 for i in \
377 ${srcdir}/../tcl \
378 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
379 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
380 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
381 do
382 if test -f "$i/unix/tclConfig.sh" ; then
383 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
384 break
385 fi
386 done
387 fi
388 ])
389
390 if test x"${ac_cv_c_tclconfig}" = x ; then
391 use_tcl=no
392 AC_MSG_WARN(Can't find Tcl configuration definitions)
393 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
394 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
395 else
396 TCL_BIN_DIR=${ac_cv_c_tclconfig}
397 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
398
399 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
400 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
401 AC_MSG_RESULT([loading])
402 . $TCL_BIN_DIR/tclConfig.sh
403 else
404 AC_MSG_RESULT([file not found])
405 fi
406
407 #
408 # If the TCL_BIN_DIR is the build directory (not the install directory),
409 # then set the common variable name to the value of the build variables.
410 # For example, the variable TCL_LIB_SPEC will be set to the value
411 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
412 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
413 # installed and uninstalled version of Tcl.
414 #
415
mlcreechab1c47b2008-03-09 02:51:10 +0000416 if test -f $TCL_BIN_DIR/Makefile ; then
drh7b5717e2004-11-25 13:50:01 +0000417 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
418 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
419 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
420 fi
421
422 #
423 # eval is required to do the TCL_DBGX substitution
424 #
425
426 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
427 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
428 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
429
430 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
431 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
432 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
433
434 AC_SUBST(TCL_VERSION)
435 AC_SUBST(TCL_BIN_DIR)
436 AC_SUBST(TCL_SRC_DIR)
drh7b5717e2004-11-25 13:50:01 +0000437 AC_SUBST(TCL_INCLUDE_SPEC)
438
439 AC_SUBST(TCL_LIB_FILE)
440 AC_SUBST(TCL_LIB_FLAG)
441 AC_SUBST(TCL_LIB_SPEC)
442
443 AC_SUBST(TCL_STUB_LIB_FILE)
444 AC_SUBST(TCL_STUB_LIB_FLAG)
445 AC_SUBST(TCL_STUB_LIB_SPEC)
drhd881ce82015-03-31 17:01:52 +0000446 AC_SUBST(TCL_SHLIB_SUFFIX)
drh7b5717e2004-11-25 13:50:01 +0000447 fi
drh71eb93e2001-09-28 01:34:43 +0000448fi
drh7b5717e2004-11-25 13:50:01 +0000449if test "${use_tcl}" = "no" ; then
450 HAVE_TCL=""
451else
452 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000453fi
drh7b5717e2004-11-25 13:50:01 +0000454AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000455
456##########
457# Figure out what C libraries are required to compile programs
458# that use "readline()" library.
459#
vapier4c10a8a2007-02-17 14:28:26 +0000460TARGET_READLINE_LIBS=""
461TARGET_READLINE_INC=""
462TARGET_HAVE_READLINE=0
463AC_ARG_ENABLE([readline],
464 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
465 [with_readline=$enableval],
466 [with_readline=auto])
467
468if test x"$with_readline" != xno; then
469 found="yes"
470
471 AC_ARG_WITH([readline-lib],
472 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
473 [with_readline_lib=$withval],
474 [with_readline_lib="auto"])
475 if test "x$with_readline_lib" = xauto; then
476 save_LIBS="$LIBS"
477 LIBS=""
478 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
479 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
480 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
481 LIBS="$save_LIBS"
482 else
483 TARGET_READLINE_LIBS="$with_readline_lib"
484 fi
485
486 AC_ARG_WITH([readline-inc],
487 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
488 [with_readline_inc=$withval],
489 [with_readline_inc="auto"])
490 if test "x$with_readline_inc" = xauto; then
491 AC_CHECK_HEADER(readline.h, [found="yes"], [
492 found="no"
493 if test "$cross_compiling" != yes; then
494 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
495 for subdir in include include/readline; do
496 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
497 if test "$found" = "yes"; then
498 TARGET_READLINE_INC="-I$dir/$subdir"
499 break
500 fi
501 done
502 test "$found" = "yes" && break
503 done
504 fi
505 ])
506 else
507 TARGET_READLINE_INC="$with_readline_inc"
508 fi
509
510 if test x"$found" = xno; then
511 TARGET_READLINE_LIBS=""
512 TARGET_READLINE_INC=""
513 TARGET_HAVE_READLINE=0
514 else
515 TARGET_HAVE_READLINE=1
516 fi
drh71eb93e2001-09-28 01:34:43 +0000517fi
vapier4c10a8a2007-02-17 14:28:26 +0000518
drh71eb93e2001-09-28 01:34:43 +0000519AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000520AC_SUBST(TARGET_READLINE_INC)
521AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000522
523##########
drhf1878b42006-01-23 18:06:52 +0000524# Figure out what C libraries are required to compile programs
525# that use "fdatasync()" function.
526#
drhf1878b42006-01-23 18:06:52 +0000527AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000528
drh71eb93e2001-09-28 01:34:43 +0000529#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000530# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000531AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000532 [use_debug=$enableval],[use_debug=no])
533if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000534 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000535else
536 TARGET_DEBUG="-DNDEBUG"
537fi
538AC_SUBST(TARGET_DEBUG)
539
540#########
mlcreech94984912008-03-04 19:03:08 +0000541# See whether we should use the amalgamation to build
542AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
mlcreech969b2cd2008-03-14 04:11:03 +0000543 [Disable the amalgamation and instead build all files separately]),
mlcreech94984912008-03-04 19:03:08 +0000544 [use_amalgamation=$enableval],[use_amalgamation=yes])
mlcreechf3868112008-03-11 18:03:30 +0000545if test "${use_amalgamation}" != "yes" ; then
mlcreech94984912008-03-04 19:03:08 +0000546 USE_AMALGAMATION=0
547fi
548AC_SUBST(USE_AMALGAMATION)
549
550#########
mlcreecha4edab02008-03-06 04:14:17 +0000551# See whether we should allow loadable extensions
drh05c7e0b2015-01-10 14:27:17 +0000552AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension],
553 [Disable loading of external extensions]),
554 [use_loadextension=$enableval],[use_loadextension=yes])
mlcreecha4edab02008-03-06 04:14:17 +0000555if test "${use_loadextension}" = "yes" ; then
shanefbedede2008-07-22 05:05:01 +0000556 OPT_FEATURE_FLAGS=""
drhdbe4b882011-06-20 18:00:17 +0000557 AC_SEARCH_LIBS(dlopen, dl)
mlcreecha4edab02008-03-06 04:14:17 +0000558else
shanefbedede2008-07-22 05:05:01 +0000559 OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
mlcreecha4edab02008-03-06 04:14:17 +0000560fi
mlcreecha4edab02008-03-06 04:14:17 +0000561
mlcreechaac7b932008-04-01 02:45:22 +0000562#########
drhce1d9f52015-10-09 12:48:33 +0000563# See whether we should enable Full Text Search extensions
564AC_ARG_ENABLE(fts3, AC_HELP_STRING([--enable-fts3],
565 [Enable the FTS3 extension]),
566 [enable_fts3=yes],[enable_fts3=no])
567if test "${enable_fts3}" = "yes" ; then
568 OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS3"
569fi
570AC_ARG_ENABLE(fts4, AC_HELP_STRING([--enable-fts4],
571 [Enable the FTS4 extension]),
572 [enable_fts4=yes],[enable_fts4=no])
573if test "${enable_fts4}" = "yes" ; then
574 OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS4"
575 AC_SEARCH_LIBS([log],[m])
576fi
577AC_ARG_ENABLE(fts5, AC_HELP_STRING([--enable-fts5],
578 [Enable the FTS5 extension]),
579 [enable_fts5=yes],[enable_fts5=no])
580if test "${enable_fts5}" = "yes" ; then
581 OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS5"
582 AC_SEARCH_LIBS([log],[m])
583fi
584
585#########
586# See whether we should enable JSON1
587AC_ARG_ENABLE(json1, AC_HELP_STRING([--enable-json1],
588 [Enable the JSON1 extension]),
589 [enable_json1=yes],[enable_json1=no])
590if test "${enable_json1}" = "yes" ; then
591 OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_JSON1"
592fi
593
594#########
595# See whether we should enable RTREE
596AC_ARG_ENABLE(rtree, AC_HELP_STRING([--enable-rtree],
597 [Enable the RTREE extension]),
598 [enable_rtree=yes],[enable_rtree=no])
599if test "${enable_rtree}" = "yes" ; then
600 OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_RTREE"
601fi
602
603#########
shaneb1cd7302008-10-22 18:27:31 +0000604# attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000605for option in $CFLAGS $CPPFLAGS
606do
607 case $option in
danielk197733a14782008-08-04 14:50:05 +0000608 -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
shaneb1cd7302008-10-22 18:27:31 +0000609 -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000610 esac
611done
612AC_SUBST(OPT_FEATURE_FLAGS)
613
614
shaneb1cd7302008-10-22 18:27:31 +0000615# attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000616ac_temp_CFLAGS=""
617for option in $CFLAGS
618do
619 case $option in
620 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000621 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000622 *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000623 esac
624done
625CFLAGS=$ac_temp_CFLAGS
626
627
shaneb1cd7302008-10-22 18:27:31 +0000628# attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000629ac_temp_CPPFLAGS=""
630for option in $CPPFLAGS
631do
632 case $option in
633 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000634 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000635 *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000636 esac
637done
638CPPFLAGS=$ac_temp_CPPFLAGS
639
640
shaneb1cd7302008-10-22 18:27:31 +0000641# attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000642ac_temp_BUILD_CFLAGS=""
643for option in $BUILD_CFLAGS
644do
645 case $option in
646 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000647 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000648 *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000649 esac
650done
651BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
652
653
654#########
655# See whether we should use GCOV
mlcreechaac7b932008-04-01 02:45:22 +0000656AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
657 [Enable coverage testing using gcov]),
658 [use_gcov=$enableval],[use_gcov=no])
659if test "${use_gcov}" = "yes" ; then
660 USE_GCOV=1
661else
662 USE_GCOV=0
663fi
664AC_SUBST(USE_GCOV)
665
drhaf6edf52005-10-04 18:38:49 +0000666
drh71eb93e2001-09-28 01:34:43 +0000667#########
mlcreechb87057f2008-03-06 07:19:20 +0000668# Output the config header
mlcreech23797062008-03-20 02:25:35 +0000669AC_CONFIG_HEADERS(config.h)
mlcreechb87057f2008-03-06 07:19:20 +0000670
671#########
drh71eb93e2001-09-28 01:34:43 +0000672# Generate the output files.
673#
mlcreech8390bc32008-03-06 08:54:38 +0000674AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000675AC_OUTPUT([
676Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000677sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000678])