blob: 8e7ce9623d1bad8170c8def8b1105de1cd3198a7 [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#
72# The generated configure script will make an attempt to guess
73# at all of the above parameters. You can override any of
74# the guesses by setting the environment variable named
75# "config_AAAA" where "AAAA" is the name of the parameter
76# described above. (Exception: srcdir cannot be set this way.)
77# If you have a file that sets one or more of these environment
78# variables, you can invoke configure as follows:
79#
80# configure --with-hints=FILE
81#
82# where FILE is the name of the file that sets the environment
83# variables. FILE should be an absolute pathname.
84#
drh71eb93e2001-09-28 01:34:43 +000085# This configure.in file is easy to reuse on other projects. Just
86# change the argument to AC_INIT(). And disable any features that
87# you don't need (for example BLT) by erasing or commenting out
88# the corresponding code.
89#
mlcreechb87057f2008-03-06 07:19:20 +000090AC_INIT(sqlite, m4_esyscmd([cat VERSION | tr -d '\n']))
drh71eb93e2001-09-28 01:34:43 +000091
92dnl Put the RCS revision string after AC_INIT so that it will also
93dnl show in in configure.
94# The following RCS revision string applies to configure.in
mlcreech5b0a9eb2008-03-09 01:38:09 +000095# $Revision: 1.37 $
drh71eb93e2001-09-28 01:34:43 +000096
97#########
98# Programs needed
99#
100AC_PROG_LIBTOOL
101AC_PROG_INSTALL
drhf1878b42006-01-23 18:06:52 +0000102AC_PROG_AWK
drh71eb93e2001-09-28 01:34:43 +0000103
104#########
mlcreechb87057f2008-03-06 07:19:20 +0000105# Check for needed/wanted data types
106AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t,
107 uint16_t, uint32_t, uint64_t, uintptr_t])
108
109#########
110# Check for needed/wanted headers
mlcreech5b0a9eb2008-03-09 01:38:09 +0000111AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h])
112
113#########
114# Figure out whether or not we have these functions
115#
116AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r])
117
mlcreechb87057f2008-03-06 07:19:20 +0000118
119#########
drh71eb93e2001-09-28 01:34:43 +0000120# Set up an appropriate program prefix
121#
122if test "$program_prefix" = "NONE"; then
123 program_prefix=""
124fi
125AC_SUBST(program_prefix)
126
drh4b2266a2004-11-27 15:52:16 +0000127VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
128echo "Version set to $VERSION"
a.rottmannc7e93832003-03-24 09:39:32 +0000129AC_SUBST(VERSION)
drh4b2266a2004-11-27 15:52:16 +0000130RELEASE=`cat $srcdir/VERSION`
131echo "Release set to $RELEASE"
132AC_SUBST(RELEASE)
drh26d0e2a2005-07-06 13:51:27 +0000133VERSION_NUMBER=[`cat $srcdir/VERSION \
drhb7977832005-02-16 03:45:51 +0000134 | sed 's/[^0-9]/ /g' \
drh26d0e2a2005-07-06 13:51:27 +0000135 | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
drhb7977832005-02-16 03:45:51 +0000136echo "Version number set to $VERSION_NUMBER"
137AC_SUBST(VERSION_NUMBER)
a.rottmannc7e93832003-03-24 09:39:32 +0000138
drh71eb93e2001-09-28 01:34:43 +0000139#########
140# Check to see if the --with-hints=FILE option is used. If there is none,
141# then check for a files named "$host.hints" and ../$hosts.hints where
142# $host is the hostname of the build system. If still no hints are
143# found, try looking in $system.hints and ../$system.hints where
144# $system is the result of uname -s.
145#
146AC_ARG_WITH(hints,
drh94e4f822006-02-15 02:00:25 +0000147 AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
drh71eb93e2001-09-28 01:34:43 +0000148 hints=$withval)
149if test "$hints" = ""; then
150 host=`hostname | sed 's/\..*//'`
151 if test -r $host.hints; then
152 hints=$host.hints
153 else
154 if test -r ../$host.hints; then
155 hints=../$host.hints
156 fi
157 fi
158fi
159if test "$hints" = ""; then
160 sys=`uname -s`
161 if test -r $sys.hints; then
162 hints=$sys.hints
163 else
164 if test -r ../$sys.hints; then
165 hints=../$sys.hints
166 fi
167 fi
168fi
169if test "$hints" != ""; then
170 AC_MSG_RESULT(reading hints from $hints)
171 . $hints
172fi
173
174#########
175# Locate a compiler for the build machine. This compiler should
176# generate command-line programs that run on the build machine.
177#
vapierc8a15302007-02-17 14:31:55 +0000178if test x"$cross_compiling" = xno; then
179 BUILD_CC=$CC
180 BUILD_CFLAGS=$CFLAGS
drh71eb93e2001-09-28 01:34:43 +0000181else
vapierc8a15302007-02-17 14:31:55 +0000182 if test "${BUILD_CC+set}" != set; then
183 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
184 fi
185 if test "${BUILD_CFLAGS+set}" != set; then
186 BUILD_CFLAGS="-g"
187 fi
drh71eb93e2001-09-28 01:34:43 +0000188fi
189AC_SUBST(BUILD_CC)
drh71eb93e2001-09-28 01:34:43 +0000190
191##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000192# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000193#
dougcurrie0f290bf2004-06-21 18:57:29 +0000194AC_ARG_ENABLE(threadsafe,
drh5a3032b2007-09-03 16:12:09 +0000195AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
dougcurrie0f290bf2004-06-21 18:57:29 +0000196AC_MSG_CHECKING([whether to support threadsafe operation])
197if test "$enable_threadsafe" = "no"; then
drh5a3032b2007-09-03 16:12:09 +0000198 SQLITE_THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000199 AC_MSG_RESULT([no])
200else
drh5a3032b2007-09-03 16:12:09 +0000201 SQLITE_THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000202 AC_MSG_RESULT([yes])
203fi
drh5a3032b2007-09-03 16:12:09 +0000204AC_SUBST(SQLITE_THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000205
drh5a3032b2007-09-03 16:12:09 +0000206if test "$SQLITE_THREADSAFE" = "1"; then
dougcurrie65623c72004-09-20 14:57:23 +0000207 LIBS=""
208 AC_CHECK_LIB(pthread, pthread_create)
209 TARGET_THREAD_LIB="$LIBS"
210 LIBS=""
211else
212 TARGET_THREAD_LIB=""
213fi
214AC_SUBST(TARGET_THREAD_LIB)
215
paulb0208cc2003-04-13 18:26:49 +0000216##########
drh91636d52005-11-24 23:14:00 +0000217# Do we want to allow a connection created in one thread to be used
218# in another thread. This does not work on many Linux systems (ex: RedHat 9)
219# due to bugs in the threading implementations. This is thus off by default.
220#
221AC_ARG_ENABLE(cross-thread-connections,
drh94e4f822006-02-15 02:00:25 +0000222AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
drh91636d52005-11-24 23:14:00 +0000223AC_MSG_CHECKING([whether to allow connections to be shared across threads])
224if test "$enable_xthreadconnect" = "no"; then
225 XTHREADCONNECT=''
226 AC_MSG_RESULT([no])
227else
228 XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
229 AC_MSG_RESULT([yes])
230fi
231AC_SUBST(XTHREADCONNECT)
232
233##########
drh8e2e2a12006-02-01 01:55:17 +0000234# Do we want to set threadsOverrideEachOthersLocks variable to be 1 (true) by
235# default. Normally, a test at runtime is performed to determine the
236# appropriate value of this variable. Use this option only if you're sure that
237# threads can safely override each others locks in all runtime situations.
238#
239AC_ARG_ENABLE(threads-override-locks,
drh94e4f822006-02-15 02:00:25 +0000240AC_HELP_STRING([--enable-threads-override-locks],[Threads can override each others locks]),,enable_threads_override_locks=no)
drh8e2e2a12006-02-01 01:55:17 +0000241AC_MSG_CHECKING([whether threads can override each others locks])
242if test "$enable_threads_override_locks" = "no"; then
243 THREADSOVERRIDELOCKS='-1'
244 AC_MSG_RESULT([no])
245else
246 THREADSOVERRIDELOCKS='1'
247 AC_MSG_RESULT([yes])
248fi
249AC_SUBST(THREADSOVERRIDELOCKS)
250
251##########
xdong3b5543c2003-09-23 00:36:50 +0000252# Do we want to support release
253#
254AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000255AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000256AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
257if test "$enable_releasemode" = "no"; then
258 ALLOWRELEASE=""
259 AC_MSG_RESULT([no])
260else
drh0b47d342007-11-27 14:50:06 +0000261 ALLOWRELEASE="-release `cat $srcdir/VERSION`"
xdong3b5543c2003-09-23 00:36:50 +0000262 AC_MSG_RESULT([yes])
263fi
264AC_SUBST(ALLOWRELEASE)
265
266##########
paulb0208cc2003-04-13 18:26:49 +0000267# Do we want temporary databases in memory
268#
dougcurrie0f290bf2004-06-21 18:57:29 +0000269AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000270AC_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 +0000271AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000272case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000273 never )
paul2dc96f92003-04-20 11:46:34 +0000274 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000275 AC_MSG_RESULT([never])
276 ;;
277 no )
paul2dc96f92003-04-20 11:46:34 +0000278 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000279 AC_MSG_RESULT([no])
280 ;;
281 always )
dougcurrie0f290bf2004-06-21 18:57:29 +0000282 TEMP_STORE=3
paulb0208cc2003-04-13 18:26:49 +0000283 AC_MSG_RESULT([always])
284 ;;
drh54414bb2005-10-10 00:05:50 +0000285 yes )
286 TEMP_STORE=3
287 AC_MSG_RESULT([always])
288 ;;
paulb0208cc2003-04-13 18:26:49 +0000289 * )
drh54414bb2005-10-10 00:05:50 +0000290 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000291 AC_MSG_RESULT([yes])
292 ;;
293esac
paul2dc96f92003-04-20 11:46:34 +0000294
paul2dc96f92003-04-20 11:46:34 +0000295AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000296
drh71eb93e2001-09-28 01:34:43 +0000297###########
298# Lots of things are different if we are compiling for Windows using
299# the CYGWIN environment. So check for that special case and handle
300# things accordingly.
301#
302AC_MSG_CHECKING([if executables have the .exe suffix])
303if test "$config_BUILD_EXEEXT" = ".exe"; then
304 CYGWIN=yes
305 AC_MSG_RESULT(yes)
306else
307 AC_MSG_RESULT(unknown)
308fi
309if test "$CYGWIN" != "yes"; then
310 AC_CYGWIN
311fi
312if test "$CYGWIN" = "yes"; then
313 BUILD_EXEEXT=.exe
314else
dougcurrie6194a5f2003-12-19 20:09:51 +0000315 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000316fi
vapierc8a15302007-02-17 14:31:55 +0000317if test x"$cross_compiling" = xno; then
drh71eb93e2001-09-28 01:34:43 +0000318 TARGET_EXEEXT=$BUILD_EXEEXT
319else
320 TARGET_EXEEXT=$config_TARGET_EXEEXT
321fi
322if test "$TARGET_EXEEXT" = ".exe"; then
drh60a1e4b2006-06-03 18:02:15 +0000323 if test $OS2_SHELL ; then
324 OS_UNIX=0
325 OS_WIN=0
326 OS_OS2=1
mlcreech8390bc32008-03-06 08:54:38 +0000327 CFLAGS="$CFLAGS -DOS_OS2=1"
drh60a1e4b2006-06-03 18:02:15 +0000328 if test "$ac_compiler_gnu" == "yes" ; then
mlcreech8390bc32008-03-06 08:54:38 +0000329 CFLAGS="$CFLAGS -Zomf -Zexe -Zmap"
drh60a1e4b2006-06-03 18:02:15 +0000330 BUILD_CFLAGS="$BUILD_CFLAGS -Zomf -Zexe"
331 fi
332 else
333 OS_UNIX=0
334 OS_WIN=1
335 OS_OS2=0
336 tclsubdir=win
mlcreech8390bc32008-03-06 08:54:38 +0000337 CFLAGS="$CFLAGS -DOS_WIN=1"
drh60a1e4b2006-06-03 18:02:15 +0000338 fi
drh71eb93e2001-09-28 01:34:43 +0000339else
340 OS_UNIX=1
341 OS_WIN=0
drh60a1e4b2006-06-03 18:02:15 +0000342 OS_OS2=0
drh71eb93e2001-09-28 01:34:43 +0000343 tclsubdir=unix
mlcreech8390bc32008-03-06 08:54:38 +0000344 CFLAGS="$CFLAGS -DOS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000345fi
drh71eb93e2001-09-28 01:34:43 +0000346
347AC_SUBST(BUILD_EXEEXT)
348AC_SUBST(OS_UNIX)
349AC_SUBST(OS_WIN)
drh60a1e4b2006-06-03 18:02:15 +0000350AC_SUBST(OS_OS2)
drh71eb93e2001-09-28 01:34:43 +0000351AC_SUBST(TARGET_EXEEXT)
352
353##########
drh7b5717e2004-11-25 13:50:01 +0000354# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000355#
drh7b5717e2004-11-25 13:50:01 +0000356# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
357# macros in the in the tcl.m4 file of the standard TCL distribution.
358# Those macros could not be used directly since we have to make some
359# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000360#
drh94e4f822006-02-15 02:00:25 +0000361AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000362 [use_tcl=$enableval],[use_tcl=yes])
363if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000364 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 +0000365 AC_MSG_CHECKING([for Tcl configuration])
366 AC_CACHE_VAL(ac_cv_c_tclconfig,[
367 # First check to see if --with-tcl was specified.
368 if test x"${with_tclconfig}" != x ; then
369 if test -f "${with_tclconfig}/tclConfig.sh" ; then
370 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
371 else
372 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
373 fi
drh71eb93e2001-09-28 01:34:43 +0000374 fi
drh7b5717e2004-11-25 13:50:01 +0000375 # then check for a private Tcl installation
376 if test x"${ac_cv_c_tclconfig}" = x ; then
377 for i in \
378 ../tcl \
379 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
380 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
381 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
382 ../../tcl \
383 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
384 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
385 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
386 ../../../tcl \
387 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
388 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
389 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
390 do
391 if test -f "$i/unix/tclConfig.sh" ; then
392 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
393 break
394 fi
395 done
396 fi
397
398 # check in a few common install locations
399 if test x"${ac_cv_c_tclconfig}" = x ; then
400 for i in \
401 `ls -d ${libdir} 2>/dev/null` \
402 `ls -d /usr/local/lib 2>/dev/null` \
403 `ls -d /usr/contrib/lib 2>/dev/null` \
404 `ls -d /usr/lib 2>/dev/null`
405 do
406 if test -f "$i/tclConfig.sh" ; then
407 ac_cv_c_tclconfig=`(cd $i; pwd)`
408 break
409 fi
410 done
411 fi
412
413 # check in a few other private locations
414 if test x"${ac_cv_c_tclconfig}" = x ; then
415 for i in \
416 ${srcdir}/../tcl \
417 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
418 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
419 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
420 do
421 if test -f "$i/unix/tclConfig.sh" ; then
422 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
423 break
424 fi
425 done
426 fi
427 ])
428
429 if test x"${ac_cv_c_tclconfig}" = x ; then
430 use_tcl=no
431 AC_MSG_WARN(Can't find Tcl configuration definitions)
432 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
433 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
434 else
435 TCL_BIN_DIR=${ac_cv_c_tclconfig}
436 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
437
438 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
439 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
440 AC_MSG_RESULT([loading])
441 . $TCL_BIN_DIR/tclConfig.sh
442 else
443 AC_MSG_RESULT([file not found])
444 fi
445
446 #
447 # If the TCL_BIN_DIR is the build directory (not the install directory),
448 # then set the common variable name to the value of the build variables.
449 # For example, the variable TCL_LIB_SPEC will be set to the value
450 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
451 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
452 # installed and uninstalled version of Tcl.
453 #
454
455 if test -f $TCL_BIN_DIR/Makefile ; then
456 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
457 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
458 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
459 fi
460
461 #
462 # eval is required to do the TCL_DBGX substitution
463 #
464
465 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
466 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
467 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
468
469 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
470 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
471 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
472
473 AC_SUBST(TCL_VERSION)
474 AC_SUBST(TCL_BIN_DIR)
475 AC_SUBST(TCL_SRC_DIR)
476 AC_SUBST(TCL_LIBS)
477 AC_SUBST(TCL_INCLUDE_SPEC)
478
479 AC_SUBST(TCL_LIB_FILE)
480 AC_SUBST(TCL_LIB_FLAG)
481 AC_SUBST(TCL_LIB_SPEC)
482
483 AC_SUBST(TCL_STUB_LIB_FILE)
484 AC_SUBST(TCL_STUB_LIB_FLAG)
485 AC_SUBST(TCL_STUB_LIB_SPEC)
486 fi
drh71eb93e2001-09-28 01:34:43 +0000487fi
drh7b5717e2004-11-25 13:50:01 +0000488if test "${use_tcl}" = "no" ; then
489 HAVE_TCL=""
490else
491 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000492fi
drh7b5717e2004-11-25 13:50:01 +0000493AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000494
495##########
496# Figure out what C libraries are required to compile programs
497# that use "readline()" library.
498#
vapier4c10a8a2007-02-17 14:28:26 +0000499TARGET_READLINE_LIBS=""
500TARGET_READLINE_INC=""
501TARGET_HAVE_READLINE=0
502AC_ARG_ENABLE([readline],
503 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
504 [with_readline=$enableval],
505 [with_readline=auto])
506
507if test x"$with_readline" != xno; then
508 found="yes"
509
510 AC_ARG_WITH([readline-lib],
511 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
512 [with_readline_lib=$withval],
513 [with_readline_lib="auto"])
514 if test "x$with_readline_lib" = xauto; then
515 save_LIBS="$LIBS"
516 LIBS=""
517 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
518 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
519 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
520 LIBS="$save_LIBS"
521 else
522 TARGET_READLINE_LIBS="$with_readline_lib"
523 fi
524
525 AC_ARG_WITH([readline-inc],
526 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
527 [with_readline_inc=$withval],
528 [with_readline_inc="auto"])
529 if test "x$with_readline_inc" = xauto; then
530 AC_CHECK_HEADER(readline.h, [found="yes"], [
531 found="no"
532 if test "$cross_compiling" != yes; then
533 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
534 for subdir in include include/readline; do
535 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
536 if test "$found" = "yes"; then
537 TARGET_READLINE_INC="-I$dir/$subdir"
538 break
539 fi
540 done
541 test "$found" = "yes" && break
542 done
543 fi
544 ])
545 else
546 TARGET_READLINE_INC="$with_readline_inc"
547 fi
548
549 if test x"$found" = xno; then
550 TARGET_READLINE_LIBS=""
551 TARGET_READLINE_INC=""
552 TARGET_HAVE_READLINE=0
553 else
554 TARGET_HAVE_READLINE=1
555 fi
drh71eb93e2001-09-28 01:34:43 +0000556fi
vapier4c10a8a2007-02-17 14:28:26 +0000557
drh71eb93e2001-09-28 01:34:43 +0000558AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000559AC_SUBST(TARGET_READLINE_INC)
560AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000561
562##########
drhf1878b42006-01-23 18:06:52 +0000563# Figure out what C libraries are required to compile programs
564# that use "fdatasync()" function.
565#
drhf1878b42006-01-23 18:06:52 +0000566AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000567
drh71eb93e2001-09-28 01:34:43 +0000568#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000569# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000570AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000571 [use_debug=$enableval],[use_debug=no])
572if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000573 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000574else
575 TARGET_DEBUG="-DNDEBUG"
576fi
577AC_SUBST(TARGET_DEBUG)
578
579#########
mlcreech94984912008-03-04 19:03:08 +0000580# See whether we should use the amalgamation to build
581AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
582 [Disable the amalgamation and instead build all files separately (currently needed to build the test fixture)]),
583 [use_amalgamation=$enableval],[use_amalgamation=yes])
584if test "${use_amalgamation}" = "yes" ; then
585 USE_AMALGAMATION=1
586else
587 USE_AMALGAMATION=0
588fi
589AC_SUBST(USE_AMALGAMATION)
590
591#########
mlcreecha4edab02008-03-06 04:14:17 +0000592# See whether we should allow loadable extensions
593AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
594 [Enable loading of external extensions]),
595 [use_loadextension=$enableval],[use_loadextension=no])
596if test "${use_loadextension}" = "yes" ; then
597 LOADEXTENSION_FLAGS=""
598else
599 LOADEXTENSION_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
600fi
601AC_SUBST(LOADEXTENSION_FLAGS)
602
drhaf6edf52005-10-04 18:38:49 +0000603
drh71eb93e2001-09-28 01:34:43 +0000604#########
mlcreechb87057f2008-03-06 07:19:20 +0000605# Output the config header
606AC_CONFIG_HEADERS(src/config.h)
607
608#########
drh71eb93e2001-09-28 01:34:43 +0000609# Generate the output files.
610#
mlcreech8390bc32008-03-06 08:54:38 +0000611AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000612AC_OUTPUT([
613Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000614sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000615])