blob: e55f822d683357ef2a75991eeb4726dc0539f118 [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
mlcreech636a9952008-05-05 22:52:56 +000095# $Revision: 1.45 $
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#########
mlcreech636a9952008-05-05 22:52:56 +0000105# Enable large file support (if special flags are necessary)
106#
107AC_SYS_LARGEFILE
108
109#########
mlcreechb87057f2008-03-06 07:19:20 +0000110# Check for needed/wanted data types
111AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t,
112 uint16_t, uint32_t, uint64_t, uintptr_t])
113
114#########
115# Check for needed/wanted headers
mlcreech5b0a9eb2008-03-09 01:38:09 +0000116AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h])
117
118#########
119# Figure out whether or not we have these functions
120#
121AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r])
122
mlcreechab1c47b2008-03-09 02:51:10 +0000123#########
mlcreechf3868112008-03-11 18:03:30 +0000124# By default, we use the amalgamation (this may be changed below...)
125#
126USE_AMALGAMATION=1
127
128#########
mlcreechab1c47b2008-03-09 02:51:10 +0000129# See whether we can run specific tclsh versions known to work well;
130# if not, then we fall back to plain tclsh.
131# TODO: try other versions before falling back?
132#
mlcreechf3868112008-03-11 18:03:30 +0000133AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.4 tclsh], none)
134if test "$TCLSH_CMD" = "none"; then
135 # If we can't find a local tclsh, then building the amalgamation will fail.
136 # We act as though --disable-amalgamation has been used.
137 echo "Warning: can't find tclsh - defaulting to non-amalgamation build."
138 USE_AMALGAMATION=0
139 TCLSH_CMD="tclsh"
140fi
mlcreechab1c47b2008-03-09 02:51:10 +0000141AC_SUBST(TCLSH_CMD)
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/'`]
153echo "Version set to $VERSION"
a.rottmannc7e93832003-03-24 09:39:32 +0000154AC_SUBST(VERSION)
drh4b2266a2004-11-27 15:52:16 +0000155RELEASE=`cat $srcdir/VERSION`
156echo "Release set to $RELEASE"
157AC_SUBST(RELEASE)
drh26d0e2a2005-07-06 13:51:27 +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}'`]
drhb7977832005-02-16 03:45:51 +0000161echo "Version number set to $VERSION_NUMBER"
162AC_SUBST(VERSION_NUMBER)
a.rottmannc7e93832003-03-24 09:39:32 +0000163
drh71eb93e2001-09-28 01:34:43 +0000164#########
165# Check to see if the --with-hints=FILE option is used. If there is none,
166# then check for a files named "$host.hints" and ../$hosts.hints where
167# $host is the hostname of the build system. If still no hints are
168# found, try looking in $system.hints and ../$system.hints where
169# $system is the result of uname -s.
170#
171AC_ARG_WITH(hints,
drh94e4f822006-02-15 02:00:25 +0000172 AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
drh71eb93e2001-09-28 01:34:43 +0000173 hints=$withval)
174if test "$hints" = ""; then
175 host=`hostname | sed 's/\..*//'`
176 if test -r $host.hints; then
177 hints=$host.hints
178 else
179 if test -r ../$host.hints; then
180 hints=../$host.hints
181 fi
182 fi
183fi
184if test "$hints" = ""; then
185 sys=`uname -s`
186 if test -r $sys.hints; then
187 hints=$sys.hints
188 else
189 if test -r ../$sys.hints; then
190 hints=../$sys.hints
191 fi
192 fi
193fi
194if test "$hints" != ""; then
195 AC_MSG_RESULT(reading hints from $hints)
196 . $hints
197fi
198
199#########
200# Locate a compiler for the build machine. This compiler should
201# generate command-line programs that run on the build machine.
202#
vapierc8a15302007-02-17 14:31:55 +0000203if test x"$cross_compiling" = xno; then
204 BUILD_CC=$CC
205 BUILD_CFLAGS=$CFLAGS
drh71eb93e2001-09-28 01:34:43 +0000206else
vapierc8a15302007-02-17 14:31:55 +0000207 if test "${BUILD_CC+set}" != set; then
208 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
209 fi
210 if test "${BUILD_CFLAGS+set}" != set; then
211 BUILD_CFLAGS="-g"
212 fi
drh71eb93e2001-09-28 01:34:43 +0000213fi
214AC_SUBST(BUILD_CC)
drh71eb93e2001-09-28 01:34:43 +0000215
216##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000217# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000218#
dougcurrie0f290bf2004-06-21 18:57:29 +0000219AC_ARG_ENABLE(threadsafe,
drh5a3032b2007-09-03 16:12:09 +0000220AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
dougcurrie0f290bf2004-06-21 18:57:29 +0000221AC_MSG_CHECKING([whether to support threadsafe operation])
222if test "$enable_threadsafe" = "no"; then
drh5a3032b2007-09-03 16:12:09 +0000223 SQLITE_THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000224 AC_MSG_RESULT([no])
225else
drh5a3032b2007-09-03 16:12:09 +0000226 SQLITE_THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000227 AC_MSG_RESULT([yes])
228fi
drh5a3032b2007-09-03 16:12:09 +0000229AC_SUBST(SQLITE_THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000230
drh5a3032b2007-09-03 16:12:09 +0000231if test "$SQLITE_THREADSAFE" = "1"; then
mlcreechc658b0f2008-03-09 02:20:11 +0000232 AC_SEARCH_LIBS(pthread_create, pthread)
dougcurrie65623c72004-09-20 14:57:23 +0000233fi
dougcurrie65623c72004-09-20 14:57:23 +0000234
paulb0208cc2003-04-13 18:26:49 +0000235##########
drh91636d52005-11-24 23:14:00 +0000236# Do we want to allow a connection created in one thread to be used
237# in another thread. This does not work on many Linux systems (ex: RedHat 9)
238# due to bugs in the threading implementations. This is thus off by default.
239#
240AC_ARG_ENABLE(cross-thread-connections,
drh94e4f822006-02-15 02:00:25 +0000241AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
drh91636d52005-11-24 23:14:00 +0000242AC_MSG_CHECKING([whether to allow connections to be shared across threads])
243if test "$enable_xthreadconnect" = "no"; then
244 XTHREADCONNECT=''
245 AC_MSG_RESULT([no])
246else
247 XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
248 AC_MSG_RESULT([yes])
249fi
250AC_SUBST(XTHREADCONNECT)
251
252##########
drh8e2e2a12006-02-01 01:55:17 +0000253# Do we want to set threadsOverrideEachOthersLocks variable to be 1 (true) by
254# default. Normally, a test at runtime is performed to determine the
255# appropriate value of this variable. Use this option only if you're sure that
256# threads can safely override each others locks in all runtime situations.
257#
258AC_ARG_ENABLE(threads-override-locks,
drh94e4f822006-02-15 02:00:25 +0000259AC_HELP_STRING([--enable-threads-override-locks],[Threads can override each others locks]),,enable_threads_override_locks=no)
drh8e2e2a12006-02-01 01:55:17 +0000260AC_MSG_CHECKING([whether threads can override each others locks])
261if test "$enable_threads_override_locks" = "no"; then
262 THREADSOVERRIDELOCKS='-1'
263 AC_MSG_RESULT([no])
264else
265 THREADSOVERRIDELOCKS='1'
266 AC_MSG_RESULT([yes])
267fi
268AC_SUBST(THREADSOVERRIDELOCKS)
269
270##########
xdong3b5543c2003-09-23 00:36:50 +0000271# Do we want to support release
272#
273AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000274AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000275AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
276if test "$enable_releasemode" = "no"; then
277 ALLOWRELEASE=""
278 AC_MSG_RESULT([no])
279else
drh0b47d342007-11-27 14:50:06 +0000280 ALLOWRELEASE="-release `cat $srcdir/VERSION`"
xdong3b5543c2003-09-23 00:36:50 +0000281 AC_MSG_RESULT([yes])
282fi
283AC_SUBST(ALLOWRELEASE)
284
285##########
paulb0208cc2003-04-13 18:26:49 +0000286# Do we want temporary databases in memory
287#
dougcurrie0f290bf2004-06-21 18:57:29 +0000288AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000289AC_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 +0000290AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000291case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000292 never )
paul2dc96f92003-04-20 11:46:34 +0000293 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000294 AC_MSG_RESULT([never])
295 ;;
296 no )
paul2dc96f92003-04-20 11:46:34 +0000297 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000298 AC_MSG_RESULT([no])
299 ;;
300 always )
dougcurrie0f290bf2004-06-21 18:57:29 +0000301 TEMP_STORE=3
paulb0208cc2003-04-13 18:26:49 +0000302 AC_MSG_RESULT([always])
303 ;;
drh54414bb2005-10-10 00:05:50 +0000304 yes )
305 TEMP_STORE=3
306 AC_MSG_RESULT([always])
307 ;;
paulb0208cc2003-04-13 18:26:49 +0000308 * )
drh54414bb2005-10-10 00:05:50 +0000309 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000310 AC_MSG_RESULT([yes])
311 ;;
312esac
paul2dc96f92003-04-20 11:46:34 +0000313
paul2dc96f92003-04-20 11:46:34 +0000314AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000315
drh71eb93e2001-09-28 01:34:43 +0000316###########
317# Lots of things are different if we are compiling for Windows using
318# the CYGWIN environment. So check for that special case and handle
319# things accordingly.
320#
321AC_MSG_CHECKING([if executables have the .exe suffix])
322if test "$config_BUILD_EXEEXT" = ".exe"; then
323 CYGWIN=yes
324 AC_MSG_RESULT(yes)
325else
326 AC_MSG_RESULT(unknown)
327fi
328if test "$CYGWIN" != "yes"; then
329 AC_CYGWIN
330fi
331if test "$CYGWIN" = "yes"; then
332 BUILD_EXEEXT=.exe
333else
dougcurrie6194a5f2003-12-19 20:09:51 +0000334 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000335fi
vapierc8a15302007-02-17 14:31:55 +0000336if test x"$cross_compiling" = xno; then
drh71eb93e2001-09-28 01:34:43 +0000337 TARGET_EXEEXT=$BUILD_EXEEXT
338else
339 TARGET_EXEEXT=$config_TARGET_EXEEXT
340fi
341if test "$TARGET_EXEEXT" = ".exe"; then
drh60a1e4b2006-06-03 18:02:15 +0000342 if test $OS2_SHELL ; then
343 OS_UNIX=0
344 OS_WIN=0
345 OS_OS2=1
mlcreech8390bc32008-03-06 08:54:38 +0000346 CFLAGS="$CFLAGS -DOS_OS2=1"
mlcreech57ee0522008-04-14 22:57:55 +0000347 if test "$ac_compiler_gnu" = "yes" ; then
mlcreech8390bc32008-03-06 08:54:38 +0000348 CFLAGS="$CFLAGS -Zomf -Zexe -Zmap"
drh60a1e4b2006-06-03 18:02:15 +0000349 BUILD_CFLAGS="$BUILD_CFLAGS -Zomf -Zexe"
350 fi
351 else
352 OS_UNIX=0
353 OS_WIN=1
354 OS_OS2=0
355 tclsubdir=win
mlcreech8390bc32008-03-06 08:54:38 +0000356 CFLAGS="$CFLAGS -DOS_WIN=1"
drh60a1e4b2006-06-03 18:02:15 +0000357 fi
drh71eb93e2001-09-28 01:34:43 +0000358else
359 OS_UNIX=1
360 OS_WIN=0
drh60a1e4b2006-06-03 18:02:15 +0000361 OS_OS2=0
drh71eb93e2001-09-28 01:34:43 +0000362 tclsubdir=unix
mlcreech8390bc32008-03-06 08:54:38 +0000363 CFLAGS="$CFLAGS -DOS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000364fi
drh71eb93e2001-09-28 01:34:43 +0000365
366AC_SUBST(BUILD_EXEEXT)
367AC_SUBST(OS_UNIX)
368AC_SUBST(OS_WIN)
drh60a1e4b2006-06-03 18:02:15 +0000369AC_SUBST(OS_OS2)
drh71eb93e2001-09-28 01:34:43 +0000370AC_SUBST(TARGET_EXEEXT)
371
372##########
drh7b5717e2004-11-25 13:50:01 +0000373# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000374#
drh7b5717e2004-11-25 13:50:01 +0000375# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
376# macros in the in the tcl.m4 file of the standard TCL distribution.
377# Those macros could not be used directly since we have to make some
378# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000379#
drh94e4f822006-02-15 02:00:25 +0000380AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000381 [use_tcl=$enableval],[use_tcl=yes])
382if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000383 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 +0000384 AC_MSG_CHECKING([for Tcl configuration])
385 AC_CACHE_VAL(ac_cv_c_tclconfig,[
386 # First check to see if --with-tcl was specified.
387 if test x"${with_tclconfig}" != x ; then
388 if test -f "${with_tclconfig}/tclConfig.sh" ; then
389 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
390 else
391 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
392 fi
drh71eb93e2001-09-28 01:34:43 +0000393 fi
drh7b5717e2004-11-25 13:50:01 +0000394 # then check for a private Tcl installation
395 if test x"${ac_cv_c_tclconfig}" = x ; then
396 for i in \
397 ../tcl \
398 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
399 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
400 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
401 ../../tcl \
402 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
403 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
404 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
405 ../../../tcl \
406 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
407 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
408 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
409 do
410 if test -f "$i/unix/tclConfig.sh" ; then
411 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
412 break
413 fi
414 done
415 fi
416
417 # check in a few common install locations
418 if test x"${ac_cv_c_tclconfig}" = x ; then
419 for i in \
420 `ls -d ${libdir} 2>/dev/null` \
421 `ls -d /usr/local/lib 2>/dev/null` \
422 `ls -d /usr/contrib/lib 2>/dev/null` \
423 `ls -d /usr/lib 2>/dev/null`
424 do
425 if test -f "$i/tclConfig.sh" ; then
426 ac_cv_c_tclconfig=`(cd $i; pwd)`
427 break
428 fi
429 done
430 fi
431
432 # check in a few other private locations
433 if test x"${ac_cv_c_tclconfig}" = x ; then
434 for i in \
435 ${srcdir}/../tcl \
436 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
437 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
438 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
439 do
440 if test -f "$i/unix/tclConfig.sh" ; then
441 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
442 break
443 fi
444 done
445 fi
446 ])
447
448 if test x"${ac_cv_c_tclconfig}" = x ; then
449 use_tcl=no
450 AC_MSG_WARN(Can't find Tcl configuration definitions)
451 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
452 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
453 else
454 TCL_BIN_DIR=${ac_cv_c_tclconfig}
455 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
456
457 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
458 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
459 AC_MSG_RESULT([loading])
460 . $TCL_BIN_DIR/tclConfig.sh
461 else
462 AC_MSG_RESULT([file not found])
463 fi
464
465 #
466 # If the TCL_BIN_DIR is the build directory (not the install directory),
467 # then set the common variable name to the value of the build variables.
468 # For example, the variable TCL_LIB_SPEC will be set to the value
469 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
470 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
471 # installed and uninstalled version of Tcl.
472 #
473
mlcreechab1c47b2008-03-09 02:51:10 +0000474 if test -f $TCL_BIN_DIR/Makefile ; then
drh7b5717e2004-11-25 13:50:01 +0000475 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
476 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
477 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
478 fi
479
480 #
481 # eval is required to do the TCL_DBGX substitution
482 #
483
484 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
485 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
486 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
487
488 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
489 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
490 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
491
492 AC_SUBST(TCL_VERSION)
493 AC_SUBST(TCL_BIN_DIR)
494 AC_SUBST(TCL_SRC_DIR)
495 AC_SUBST(TCL_LIBS)
496 AC_SUBST(TCL_INCLUDE_SPEC)
497
498 AC_SUBST(TCL_LIB_FILE)
499 AC_SUBST(TCL_LIB_FLAG)
500 AC_SUBST(TCL_LIB_SPEC)
501
502 AC_SUBST(TCL_STUB_LIB_FILE)
503 AC_SUBST(TCL_STUB_LIB_FLAG)
504 AC_SUBST(TCL_STUB_LIB_SPEC)
505 fi
drh71eb93e2001-09-28 01:34:43 +0000506fi
drh7b5717e2004-11-25 13:50:01 +0000507if test "${use_tcl}" = "no" ; then
508 HAVE_TCL=""
509else
510 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000511fi
drh7b5717e2004-11-25 13:50:01 +0000512AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000513
514##########
515# Figure out what C libraries are required to compile programs
516# that use "readline()" library.
517#
vapier4c10a8a2007-02-17 14:28:26 +0000518TARGET_READLINE_LIBS=""
519TARGET_READLINE_INC=""
520TARGET_HAVE_READLINE=0
521AC_ARG_ENABLE([readline],
522 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
523 [with_readline=$enableval],
524 [with_readline=auto])
525
526if test x"$with_readline" != xno; then
527 found="yes"
528
529 AC_ARG_WITH([readline-lib],
530 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
531 [with_readline_lib=$withval],
532 [with_readline_lib="auto"])
533 if test "x$with_readline_lib" = xauto; then
534 save_LIBS="$LIBS"
535 LIBS=""
536 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
537 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
538 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
539 LIBS="$save_LIBS"
540 else
541 TARGET_READLINE_LIBS="$with_readline_lib"
542 fi
543
544 AC_ARG_WITH([readline-inc],
545 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
546 [with_readline_inc=$withval],
547 [with_readline_inc="auto"])
548 if test "x$with_readline_inc" = xauto; then
549 AC_CHECK_HEADER(readline.h, [found="yes"], [
550 found="no"
551 if test "$cross_compiling" != yes; then
552 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
553 for subdir in include include/readline; do
554 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
555 if test "$found" = "yes"; then
556 TARGET_READLINE_INC="-I$dir/$subdir"
557 break
558 fi
559 done
560 test "$found" = "yes" && break
561 done
562 fi
563 ])
564 else
565 TARGET_READLINE_INC="$with_readline_inc"
566 fi
567
568 if test x"$found" = xno; then
569 TARGET_READLINE_LIBS=""
570 TARGET_READLINE_INC=""
571 TARGET_HAVE_READLINE=0
572 else
573 TARGET_HAVE_READLINE=1
574 fi
drh71eb93e2001-09-28 01:34:43 +0000575fi
vapier4c10a8a2007-02-17 14:28:26 +0000576
drh71eb93e2001-09-28 01:34:43 +0000577AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000578AC_SUBST(TARGET_READLINE_INC)
579AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000580
581##########
drhf1878b42006-01-23 18:06:52 +0000582# Figure out what C libraries are required to compile programs
583# that use "fdatasync()" function.
584#
drhf1878b42006-01-23 18:06:52 +0000585AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000586
drh71eb93e2001-09-28 01:34:43 +0000587#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000588# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000589AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000590 [use_debug=$enableval],[use_debug=no])
591if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000592 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000593else
594 TARGET_DEBUG="-DNDEBUG"
595fi
596AC_SUBST(TARGET_DEBUG)
597
598#########
mlcreech94984912008-03-04 19:03:08 +0000599# See whether we should use the amalgamation to build
600AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
mlcreech969b2cd2008-03-14 04:11:03 +0000601 [Disable the amalgamation and instead build all files separately]),
mlcreech94984912008-03-04 19:03:08 +0000602 [use_amalgamation=$enableval],[use_amalgamation=yes])
mlcreechf3868112008-03-11 18:03:30 +0000603if test "${use_amalgamation}" != "yes" ; then
mlcreech94984912008-03-04 19:03:08 +0000604 USE_AMALGAMATION=0
605fi
606AC_SUBST(USE_AMALGAMATION)
607
608#########
mlcreecha4edab02008-03-06 04:14:17 +0000609# See whether we should allow loadable extensions
610AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
611 [Enable loading of external extensions]),
612 [use_loadextension=$enableval],[use_loadextension=no])
613if test "${use_loadextension}" = "yes" ; then
614 LOADEXTENSION_FLAGS=""
615else
616 LOADEXTENSION_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
617fi
618AC_SUBST(LOADEXTENSION_FLAGS)
619
mlcreechaac7b932008-04-01 02:45:22 +0000620#########
621# See whether we should allow loadable extensions
622AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
623 [Enable coverage testing using gcov]),
624 [use_gcov=$enableval],[use_gcov=no])
625if test "${use_gcov}" = "yes" ; then
626 USE_GCOV=1
627else
628 USE_GCOV=0
629fi
630AC_SUBST(USE_GCOV)
631
drhaf6edf52005-10-04 18:38:49 +0000632
drh71eb93e2001-09-28 01:34:43 +0000633#########
mlcreechb87057f2008-03-06 07:19:20 +0000634# Output the config header
mlcreech23797062008-03-20 02:25:35 +0000635AC_CONFIG_HEADERS(config.h)
mlcreechb87057f2008-03-06 07:19:20 +0000636
637#########
drh71eb93e2001-09-28 01:34:43 +0000638# Generate the output files.
639#
mlcreech8390bc32008-03-06 08:54:38 +0000640AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000641AC_OUTPUT([
642Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000643sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000644])