blob: 0905512b55faf8807999e41880dc178f5f8e06c4 [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
vapierfe7e82e2009-01-26 21:39:33 +000095# $Revision: 1.52 $
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#
shanefbedede2008-07-22 05:05:01 +0000121AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s])
mlcreech5b0a9eb2008-03-09 01:38:09 +0000122
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 ;;
drh54414bb2005-10-10 00:05:50 +0000300 yes )
drh8b727472009-01-19 18:18:40 +0000301 TEMP_STORE=2
302 AC_MSG_RESULT([yes])
303 ;;
304 always )
drh54414bb2005-10-10 00:05:50 +0000305 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
drh8b727472009-01-19 18:18:40 +0000310 AC_MSG_RESULT([no])
paulb0208cc2003-04-13 18:26:49 +0000311 ;;
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
danielk197729bafea2008-06-26 10:41:19 +0000343 SQLITE_OS_UNIX=0
344 SQLITE_OS_WIN=0
345 SQLITE_OS_OS2=1
346 CFLAGS="$CFLAGS -DSQLITE_OS_OS2=1"
drh60a1e4b2006-06-03 18:02:15 +0000347 else
danielk197729bafea2008-06-26 10:41:19 +0000348 SQLITE_OS_UNIX=0
349 SQLITE_OS_WIN=1
350 SQLITE_OS_OS2=0
danielk197729bafea2008-06-26 10:41:19 +0000351 CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
drh60a1e4b2006-06-03 18:02:15 +0000352 fi
drh71eb93e2001-09-28 01:34:43 +0000353else
danielk197729bafea2008-06-26 10:41:19 +0000354 SQLITE_OS_UNIX=1
355 SQLITE_OS_WIN=0
356 SQLITE_OS_OS2=0
danielk197729bafea2008-06-26 10:41:19 +0000357 CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000358fi
drh71eb93e2001-09-28 01:34:43 +0000359
360AC_SUBST(BUILD_EXEEXT)
danielk197729bafea2008-06-26 10:41:19 +0000361AC_SUBST(SQLITE_OS_UNIX)
362AC_SUBST(SQLITE_OS_WIN)
363AC_SUBST(SQLITE_OS_OS2)
drh71eb93e2001-09-28 01:34:43 +0000364AC_SUBST(TARGET_EXEEXT)
365
366##########
drh7b5717e2004-11-25 13:50:01 +0000367# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000368#
drh7b5717e2004-11-25 13:50:01 +0000369# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
370# macros in the in the tcl.m4 file of the standard TCL distribution.
371# Those macros could not be used directly since we have to make some
372# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000373#
drh94e4f822006-02-15 02:00:25 +0000374AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000375 [use_tcl=$enableval],[use_tcl=yes])
376if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000377 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 +0000378 AC_MSG_CHECKING([for Tcl configuration])
379 AC_CACHE_VAL(ac_cv_c_tclconfig,[
380 # First check to see if --with-tcl was specified.
381 if test x"${with_tclconfig}" != x ; then
382 if test -f "${with_tclconfig}/tclConfig.sh" ; then
383 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
384 else
385 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
386 fi
drh71eb93e2001-09-28 01:34:43 +0000387 fi
vapierfe7e82e2009-01-26 21:39:33 +0000388
389 # Start autosearch by asking tclsh
390 if test x"$cross_compiling" = xno; then
391 for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
392 do
393 if test -f "$i/tclConfig.sh" ; then
394 ac_cv_c_tclconfig="$i"
395 break
396 fi
397 done
398 fi
399
drh7b5717e2004-11-25 13:50:01 +0000400 # then check for a private Tcl installation
401 if test x"${ac_cv_c_tclconfig}" = x ; then
402 for i in \
403 ../tcl \
404 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
405 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
406 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
407 ../../tcl \
408 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
409 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
410 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
411 ../../../tcl \
412 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
413 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
414 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
415 do
416 if test -f "$i/unix/tclConfig.sh" ; then
417 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
418 break
419 fi
420 done
421 fi
422
423 # check in a few common install locations
424 if test x"${ac_cv_c_tclconfig}" = x ; then
425 for i in \
426 `ls -d ${libdir} 2>/dev/null` \
427 `ls -d /usr/local/lib 2>/dev/null` \
428 `ls -d /usr/contrib/lib 2>/dev/null` \
429 `ls -d /usr/lib 2>/dev/null`
430 do
431 if test -f "$i/tclConfig.sh" ; then
432 ac_cv_c_tclconfig=`(cd $i; pwd)`
433 break
434 fi
435 done
436 fi
437
438 # check in a few other private locations
439 if test x"${ac_cv_c_tclconfig}" = x ; then
440 for i in \
441 ${srcdir}/../tcl \
442 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
443 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
444 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
445 do
446 if test -f "$i/unix/tclConfig.sh" ; then
447 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
448 break
449 fi
450 done
451 fi
452 ])
453
454 if test x"${ac_cv_c_tclconfig}" = x ; then
455 use_tcl=no
456 AC_MSG_WARN(Can't find Tcl configuration definitions)
457 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
458 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
459 else
460 TCL_BIN_DIR=${ac_cv_c_tclconfig}
461 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
462
463 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
464 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
465 AC_MSG_RESULT([loading])
466 . $TCL_BIN_DIR/tclConfig.sh
467 else
468 AC_MSG_RESULT([file not found])
469 fi
470
471 #
472 # If the TCL_BIN_DIR is the build directory (not the install directory),
473 # then set the common variable name to the value of the build variables.
474 # For example, the variable TCL_LIB_SPEC will be set to the value
475 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
476 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
477 # installed and uninstalled version of Tcl.
478 #
479
mlcreechab1c47b2008-03-09 02:51:10 +0000480 if test -f $TCL_BIN_DIR/Makefile ; then
drh7b5717e2004-11-25 13:50:01 +0000481 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
482 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
483 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
484 fi
485
486 #
487 # eval is required to do the TCL_DBGX substitution
488 #
489
490 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
491 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
492 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
493
494 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
495 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
496 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
497
498 AC_SUBST(TCL_VERSION)
499 AC_SUBST(TCL_BIN_DIR)
500 AC_SUBST(TCL_SRC_DIR)
501 AC_SUBST(TCL_LIBS)
502 AC_SUBST(TCL_INCLUDE_SPEC)
503
504 AC_SUBST(TCL_LIB_FILE)
505 AC_SUBST(TCL_LIB_FLAG)
506 AC_SUBST(TCL_LIB_SPEC)
507
508 AC_SUBST(TCL_STUB_LIB_FILE)
509 AC_SUBST(TCL_STUB_LIB_FLAG)
510 AC_SUBST(TCL_STUB_LIB_SPEC)
511 fi
drh71eb93e2001-09-28 01:34:43 +0000512fi
drh7b5717e2004-11-25 13:50:01 +0000513if test "${use_tcl}" = "no" ; then
514 HAVE_TCL=""
515else
516 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000517fi
drh7b5717e2004-11-25 13:50:01 +0000518AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000519
520##########
521# Figure out what C libraries are required to compile programs
522# that use "readline()" library.
523#
vapier4c10a8a2007-02-17 14:28:26 +0000524TARGET_READLINE_LIBS=""
525TARGET_READLINE_INC=""
526TARGET_HAVE_READLINE=0
527AC_ARG_ENABLE([readline],
528 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
529 [with_readline=$enableval],
530 [with_readline=auto])
531
532if test x"$with_readline" != xno; then
533 found="yes"
534
535 AC_ARG_WITH([readline-lib],
536 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
537 [with_readline_lib=$withval],
538 [with_readline_lib="auto"])
539 if test "x$with_readline_lib" = xauto; then
540 save_LIBS="$LIBS"
541 LIBS=""
542 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
543 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
544 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
545 LIBS="$save_LIBS"
546 else
547 TARGET_READLINE_LIBS="$with_readline_lib"
548 fi
549
550 AC_ARG_WITH([readline-inc],
551 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
552 [with_readline_inc=$withval],
553 [with_readline_inc="auto"])
554 if test "x$with_readline_inc" = xauto; then
555 AC_CHECK_HEADER(readline.h, [found="yes"], [
556 found="no"
557 if test "$cross_compiling" != yes; then
558 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
559 for subdir in include include/readline; do
560 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
561 if test "$found" = "yes"; then
562 TARGET_READLINE_INC="-I$dir/$subdir"
563 break
564 fi
565 done
566 test "$found" = "yes" && break
567 done
568 fi
569 ])
570 else
571 TARGET_READLINE_INC="$with_readline_inc"
572 fi
573
574 if test x"$found" = xno; then
575 TARGET_READLINE_LIBS=""
576 TARGET_READLINE_INC=""
577 TARGET_HAVE_READLINE=0
578 else
579 TARGET_HAVE_READLINE=1
580 fi
drh71eb93e2001-09-28 01:34:43 +0000581fi
vapier4c10a8a2007-02-17 14:28:26 +0000582
drh71eb93e2001-09-28 01:34:43 +0000583AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000584AC_SUBST(TARGET_READLINE_INC)
585AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000586
587##########
drhf1878b42006-01-23 18:06:52 +0000588# Figure out what C libraries are required to compile programs
589# that use "fdatasync()" function.
590#
drhf1878b42006-01-23 18:06:52 +0000591AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000592
drh71eb93e2001-09-28 01:34:43 +0000593#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000594# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000595AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000596 [use_debug=$enableval],[use_debug=no])
597if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000598 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000599else
600 TARGET_DEBUG="-DNDEBUG"
601fi
602AC_SUBST(TARGET_DEBUG)
603
604#########
mlcreech94984912008-03-04 19:03:08 +0000605# See whether we should use the amalgamation to build
606AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
mlcreech969b2cd2008-03-14 04:11:03 +0000607 [Disable the amalgamation and instead build all files separately]),
mlcreech94984912008-03-04 19:03:08 +0000608 [use_amalgamation=$enableval],[use_amalgamation=yes])
mlcreechf3868112008-03-11 18:03:30 +0000609if test "${use_amalgamation}" != "yes" ; then
mlcreech94984912008-03-04 19:03:08 +0000610 USE_AMALGAMATION=0
611fi
612AC_SUBST(USE_AMALGAMATION)
613
614#########
mlcreecha4edab02008-03-06 04:14:17 +0000615# See whether we should allow loadable extensions
616AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
617 [Enable loading of external extensions]),
618 [use_loadextension=$enableval],[use_loadextension=no])
619if test "${use_loadextension}" = "yes" ; then
shanefbedede2008-07-22 05:05:01 +0000620 OPT_FEATURE_FLAGS=""
mlcreecha4edab02008-03-06 04:14:17 +0000621else
shanefbedede2008-07-22 05:05:01 +0000622 OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
mlcreecha4edab02008-03-06 04:14:17 +0000623fi
mlcreecha4edab02008-03-06 04:14:17 +0000624
mlcreechaac7b932008-04-01 02:45:22 +0000625#########
shaneb1cd7302008-10-22 18:27:31 +0000626# attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000627for option in $CFLAGS $CPPFLAGS
628do
629 case $option in
danielk197733a14782008-08-04 14:50:05 +0000630 -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
shaneb1cd7302008-10-22 18:27:31 +0000631 -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000632 esac
633done
634AC_SUBST(OPT_FEATURE_FLAGS)
635
636
shaneb1cd7302008-10-22 18:27:31 +0000637# attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000638ac_temp_CFLAGS=""
639for option in $CFLAGS
640do
641 case $option in
642 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000643 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000644 *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000645 esac
646done
647CFLAGS=$ac_temp_CFLAGS
648
649
shaneb1cd7302008-10-22 18:27:31 +0000650# attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000651ac_temp_CPPFLAGS=""
652for option in $CPPFLAGS
653do
654 case $option in
655 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000656 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000657 *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000658 esac
659done
660CPPFLAGS=$ac_temp_CPPFLAGS
661
662
shaneb1cd7302008-10-22 18:27:31 +0000663# attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000664ac_temp_BUILD_CFLAGS=""
665for option in $BUILD_CFLAGS
666do
667 case $option in
668 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000669 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000670 *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000671 esac
672done
673BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
674
675
676#########
677# See whether we should use GCOV
mlcreechaac7b932008-04-01 02:45:22 +0000678AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
679 [Enable coverage testing using gcov]),
680 [use_gcov=$enableval],[use_gcov=no])
681if test "${use_gcov}" = "yes" ; then
682 USE_GCOV=1
683else
684 USE_GCOV=0
685fi
686AC_SUBST(USE_GCOV)
687
drhaf6edf52005-10-04 18:38:49 +0000688
drh71eb93e2001-09-28 01:34:43 +0000689#########
mlcreechb87057f2008-03-06 07:19:20 +0000690# Output the config header
mlcreech23797062008-03-20 02:25:35 +0000691AC_CONFIG_HEADERS(config.h)
mlcreechb87057f2008-03-06 07:19:20 +0000692
693#########
drh71eb93e2001-09-28 01:34:43 +0000694# Generate the output files.
695#
mlcreech8390bc32008-03-06 08:54:38 +0000696AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000697AC_OUTPUT([
698Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000699sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000700])