blob: 3a437c90837f069c94078161e8296ac7d8b8b726 [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
vapier6d120f32009-01-28 04:46:14 +000095# $Revision: 1.54 $
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
vapier6d120f32009-01-28 04:46:14 +0000143AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin])
144if test "x${TCLLIBDIR+set}" != "xset" ; then
145 TCLLIBDIR='$(libdir)'
146 for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do
147 TCLLIBDIR=$i
148 break
149 done
150 TCLLIBDIR="${TCLLIBDIR}/sqlite3"
151fi
152
mlcreechb87057f2008-03-06 07:19:20 +0000153
154#########
drh71eb93e2001-09-28 01:34:43 +0000155# Set up an appropriate program prefix
156#
157if test "$program_prefix" = "NONE"; then
158 program_prefix=""
159fi
160AC_SUBST(program_prefix)
161
drh4b2266a2004-11-27 15:52:16 +0000162VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
vapier695f0972009-01-26 21:43:16 +0000163AC_MSG_NOTICE(Version set to $VERSION)
a.rottmannc7e93832003-03-24 09:39:32 +0000164AC_SUBST(VERSION)
drh4b2266a2004-11-27 15:52:16 +0000165RELEASE=`cat $srcdir/VERSION`
vapier695f0972009-01-26 21:43:16 +0000166AC_MSG_NOTICE(Release set to $RELEASE)
drh4b2266a2004-11-27 15:52:16 +0000167AC_SUBST(RELEASE)
vapier695f0972009-01-26 21:43:16 +0000168VERSION_NUMBER=[`cat $srcdir/VERSION \
drhb7977832005-02-16 03:45:51 +0000169 | sed 's/[^0-9]/ /g' \
drh26d0e2a2005-07-06 13:51:27 +0000170 | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
vapier695f0972009-01-26 21:43:16 +0000171AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
drhb7977832005-02-16 03:45:51 +0000172AC_SUBST(VERSION_NUMBER)
a.rottmannc7e93832003-03-24 09:39:32 +0000173
drh71eb93e2001-09-28 01:34:43 +0000174#########
175# Check to see if the --with-hints=FILE option is used. If there is none,
176# then check for a files named "$host.hints" and ../$hosts.hints where
177# $host is the hostname of the build system. If still no hints are
178# found, try looking in $system.hints and ../$system.hints where
179# $system is the result of uname -s.
180#
181AC_ARG_WITH(hints,
drh94e4f822006-02-15 02:00:25 +0000182 AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
drh71eb93e2001-09-28 01:34:43 +0000183 hints=$withval)
184if test "$hints" = ""; then
185 host=`hostname | sed 's/\..*//'`
186 if test -r $host.hints; then
187 hints=$host.hints
188 else
189 if test -r ../$host.hints; then
190 hints=../$host.hints
191 fi
192 fi
193fi
194if test "$hints" = ""; then
195 sys=`uname -s`
196 if test -r $sys.hints; then
197 hints=$sys.hints
198 else
199 if test -r ../$sys.hints; then
200 hints=../$sys.hints
201 fi
202 fi
203fi
204if test "$hints" != ""; then
205 AC_MSG_RESULT(reading hints from $hints)
206 . $hints
207fi
208
209#########
210# Locate a compiler for the build machine. This compiler should
211# generate command-line programs that run on the build machine.
212#
vapierc8a15302007-02-17 14:31:55 +0000213if test x"$cross_compiling" = xno; then
214 BUILD_CC=$CC
215 BUILD_CFLAGS=$CFLAGS
drh71eb93e2001-09-28 01:34:43 +0000216else
vapierc8a15302007-02-17 14:31:55 +0000217 if test "${BUILD_CC+set}" != set; then
218 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
219 fi
220 if test "${BUILD_CFLAGS+set}" != set; then
221 BUILD_CFLAGS="-g"
222 fi
drh71eb93e2001-09-28 01:34:43 +0000223fi
224AC_SUBST(BUILD_CC)
drh71eb93e2001-09-28 01:34:43 +0000225
226##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000227# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000228#
dougcurrie0f290bf2004-06-21 18:57:29 +0000229AC_ARG_ENABLE(threadsafe,
drh5a3032b2007-09-03 16:12:09 +0000230AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
dougcurrie0f290bf2004-06-21 18:57:29 +0000231AC_MSG_CHECKING([whether to support threadsafe operation])
232if test "$enable_threadsafe" = "no"; then
drh5a3032b2007-09-03 16:12:09 +0000233 SQLITE_THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000234 AC_MSG_RESULT([no])
235else
drh5a3032b2007-09-03 16:12:09 +0000236 SQLITE_THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000237 AC_MSG_RESULT([yes])
238fi
drh5a3032b2007-09-03 16:12:09 +0000239AC_SUBST(SQLITE_THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000240
drh5a3032b2007-09-03 16:12:09 +0000241if test "$SQLITE_THREADSAFE" = "1"; then
mlcreechc658b0f2008-03-09 02:20:11 +0000242 AC_SEARCH_LIBS(pthread_create, pthread)
dougcurrie65623c72004-09-20 14:57:23 +0000243fi
dougcurrie65623c72004-09-20 14:57:23 +0000244
paulb0208cc2003-04-13 18:26:49 +0000245##########
drh91636d52005-11-24 23:14:00 +0000246# Do we want to allow a connection created in one thread to be used
247# in another thread. This does not work on many Linux systems (ex: RedHat 9)
248# due to bugs in the threading implementations. This is thus off by default.
249#
250AC_ARG_ENABLE(cross-thread-connections,
drh94e4f822006-02-15 02:00:25 +0000251AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
drh91636d52005-11-24 23:14:00 +0000252AC_MSG_CHECKING([whether to allow connections to be shared across threads])
253if test "$enable_xthreadconnect" = "no"; then
254 XTHREADCONNECT=''
255 AC_MSG_RESULT([no])
256else
257 XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
258 AC_MSG_RESULT([yes])
259fi
260AC_SUBST(XTHREADCONNECT)
261
262##########
drh8e2e2a12006-02-01 01:55:17 +0000263# Do we want to set threadsOverrideEachOthersLocks variable to be 1 (true) by
264# default. Normally, a test at runtime is performed to determine the
265# appropriate value of this variable. Use this option only if you're sure that
266# threads can safely override each others locks in all runtime situations.
267#
268AC_ARG_ENABLE(threads-override-locks,
drh94e4f822006-02-15 02:00:25 +0000269AC_HELP_STRING([--enable-threads-override-locks],[Threads can override each others locks]),,enable_threads_override_locks=no)
drh8e2e2a12006-02-01 01:55:17 +0000270AC_MSG_CHECKING([whether threads can override each others locks])
271if test "$enable_threads_override_locks" = "no"; then
272 THREADSOVERRIDELOCKS='-1'
273 AC_MSG_RESULT([no])
274else
275 THREADSOVERRIDELOCKS='1'
276 AC_MSG_RESULT([yes])
277fi
278AC_SUBST(THREADSOVERRIDELOCKS)
279
280##########
xdong3b5543c2003-09-23 00:36:50 +0000281# Do we want to support release
282#
283AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000284AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000285AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
286if test "$enable_releasemode" = "no"; then
287 ALLOWRELEASE=""
288 AC_MSG_RESULT([no])
289else
drh0b47d342007-11-27 14:50:06 +0000290 ALLOWRELEASE="-release `cat $srcdir/VERSION`"
xdong3b5543c2003-09-23 00:36:50 +0000291 AC_MSG_RESULT([yes])
292fi
293AC_SUBST(ALLOWRELEASE)
294
295##########
paulb0208cc2003-04-13 18:26:49 +0000296# Do we want temporary databases in memory
297#
dougcurrie0f290bf2004-06-21 18:57:29 +0000298AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000299AC_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 +0000300AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000301case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000302 never )
paul2dc96f92003-04-20 11:46:34 +0000303 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000304 AC_MSG_RESULT([never])
305 ;;
306 no )
paul2dc96f92003-04-20 11:46:34 +0000307 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000308 AC_MSG_RESULT([no])
309 ;;
drh54414bb2005-10-10 00:05:50 +0000310 yes )
drh8b727472009-01-19 18:18:40 +0000311 TEMP_STORE=2
312 AC_MSG_RESULT([yes])
313 ;;
314 always )
drh54414bb2005-10-10 00:05:50 +0000315 TEMP_STORE=3
316 AC_MSG_RESULT([always])
317 ;;
paulb0208cc2003-04-13 18:26:49 +0000318 * )
drh54414bb2005-10-10 00:05:50 +0000319 TEMP_STORE=1
drh8b727472009-01-19 18:18:40 +0000320 AC_MSG_RESULT([no])
paulb0208cc2003-04-13 18:26:49 +0000321 ;;
322esac
paul2dc96f92003-04-20 11:46:34 +0000323
paul2dc96f92003-04-20 11:46:34 +0000324AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000325
drh71eb93e2001-09-28 01:34:43 +0000326###########
327# Lots of things are different if we are compiling for Windows using
328# the CYGWIN environment. So check for that special case and handle
329# things accordingly.
330#
331AC_MSG_CHECKING([if executables have the .exe suffix])
332if test "$config_BUILD_EXEEXT" = ".exe"; then
333 CYGWIN=yes
334 AC_MSG_RESULT(yes)
335else
336 AC_MSG_RESULT(unknown)
337fi
338if test "$CYGWIN" != "yes"; then
339 AC_CYGWIN
340fi
341if test "$CYGWIN" = "yes"; then
342 BUILD_EXEEXT=.exe
343else
dougcurrie6194a5f2003-12-19 20:09:51 +0000344 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000345fi
vapierc8a15302007-02-17 14:31:55 +0000346if test x"$cross_compiling" = xno; then
drh71eb93e2001-09-28 01:34:43 +0000347 TARGET_EXEEXT=$BUILD_EXEEXT
348else
349 TARGET_EXEEXT=$config_TARGET_EXEEXT
350fi
351if test "$TARGET_EXEEXT" = ".exe"; then
drh60a1e4b2006-06-03 18:02:15 +0000352 if test $OS2_SHELL ; then
danielk197729bafea2008-06-26 10:41:19 +0000353 SQLITE_OS_UNIX=0
354 SQLITE_OS_WIN=0
355 SQLITE_OS_OS2=1
356 CFLAGS="$CFLAGS -DSQLITE_OS_OS2=1"
drh60a1e4b2006-06-03 18:02:15 +0000357 else
danielk197729bafea2008-06-26 10:41:19 +0000358 SQLITE_OS_UNIX=0
359 SQLITE_OS_WIN=1
360 SQLITE_OS_OS2=0
danielk197729bafea2008-06-26 10:41:19 +0000361 CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
drh60a1e4b2006-06-03 18:02:15 +0000362 fi
drh71eb93e2001-09-28 01:34:43 +0000363else
danielk197729bafea2008-06-26 10:41:19 +0000364 SQLITE_OS_UNIX=1
365 SQLITE_OS_WIN=0
366 SQLITE_OS_OS2=0
danielk197729bafea2008-06-26 10:41:19 +0000367 CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000368fi
drh71eb93e2001-09-28 01:34:43 +0000369
370AC_SUBST(BUILD_EXEEXT)
danielk197729bafea2008-06-26 10:41:19 +0000371AC_SUBST(SQLITE_OS_UNIX)
372AC_SUBST(SQLITE_OS_WIN)
373AC_SUBST(SQLITE_OS_OS2)
drh71eb93e2001-09-28 01:34:43 +0000374AC_SUBST(TARGET_EXEEXT)
375
376##########
drh7b5717e2004-11-25 13:50:01 +0000377# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000378#
drh7b5717e2004-11-25 13:50:01 +0000379# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
380# macros in the in the tcl.m4 file of the standard TCL distribution.
381# Those macros could not be used directly since we have to make some
382# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000383#
drh94e4f822006-02-15 02:00:25 +0000384AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000385 [use_tcl=$enableval],[use_tcl=yes])
386if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000387 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 +0000388 AC_MSG_CHECKING([for Tcl configuration])
389 AC_CACHE_VAL(ac_cv_c_tclconfig,[
390 # First check to see if --with-tcl was specified.
391 if test x"${with_tclconfig}" != x ; then
392 if test -f "${with_tclconfig}/tclConfig.sh" ; then
393 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
394 else
395 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
396 fi
drh71eb93e2001-09-28 01:34:43 +0000397 fi
vapierfe7e82e2009-01-26 21:39:33 +0000398
399 # Start autosearch by asking tclsh
400 if test x"$cross_compiling" = xno; then
401 for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
402 do
403 if test -f "$i/tclConfig.sh" ; then
404 ac_cv_c_tclconfig="$i"
405 break
406 fi
407 done
408 fi
409
drh7b5717e2004-11-25 13:50:01 +0000410 # then check for a private Tcl installation
411 if test x"${ac_cv_c_tclconfig}" = x ; then
412 for i in \
413 ../tcl \
414 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
415 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
416 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
417 ../../tcl \
418 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
419 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
420 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
421 ../../../tcl \
422 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
423 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
424 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
425 do
426 if test -f "$i/unix/tclConfig.sh" ; then
427 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
428 break
429 fi
430 done
431 fi
432
433 # check in a few common install locations
434 if test x"${ac_cv_c_tclconfig}" = x ; then
435 for i in \
436 `ls -d ${libdir} 2>/dev/null` \
437 `ls -d /usr/local/lib 2>/dev/null` \
438 `ls -d /usr/contrib/lib 2>/dev/null` \
439 `ls -d /usr/lib 2>/dev/null`
440 do
441 if test -f "$i/tclConfig.sh" ; then
442 ac_cv_c_tclconfig=`(cd $i; pwd)`
443 break
444 fi
445 done
446 fi
447
448 # check in a few other private locations
449 if test x"${ac_cv_c_tclconfig}" = x ; then
450 for i in \
451 ${srcdir}/../tcl \
452 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
453 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
454 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
455 do
456 if test -f "$i/unix/tclConfig.sh" ; then
457 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
458 break
459 fi
460 done
461 fi
462 ])
463
464 if test x"${ac_cv_c_tclconfig}" = x ; then
465 use_tcl=no
466 AC_MSG_WARN(Can't find Tcl configuration definitions)
467 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
468 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
469 else
470 TCL_BIN_DIR=${ac_cv_c_tclconfig}
471 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
472
473 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
474 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
475 AC_MSG_RESULT([loading])
476 . $TCL_BIN_DIR/tclConfig.sh
477 else
478 AC_MSG_RESULT([file not found])
479 fi
480
481 #
482 # If the TCL_BIN_DIR is the build directory (not the install directory),
483 # then set the common variable name to the value of the build variables.
484 # For example, the variable TCL_LIB_SPEC will be set to the value
485 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
486 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
487 # installed and uninstalled version of Tcl.
488 #
489
mlcreechab1c47b2008-03-09 02:51:10 +0000490 if test -f $TCL_BIN_DIR/Makefile ; then
drh7b5717e2004-11-25 13:50:01 +0000491 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
492 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
493 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
494 fi
495
496 #
497 # eval is required to do the TCL_DBGX substitution
498 #
499
500 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
501 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
502 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
503
504 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
505 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
506 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
507
508 AC_SUBST(TCL_VERSION)
509 AC_SUBST(TCL_BIN_DIR)
510 AC_SUBST(TCL_SRC_DIR)
511 AC_SUBST(TCL_LIBS)
512 AC_SUBST(TCL_INCLUDE_SPEC)
513
514 AC_SUBST(TCL_LIB_FILE)
515 AC_SUBST(TCL_LIB_FLAG)
516 AC_SUBST(TCL_LIB_SPEC)
517
518 AC_SUBST(TCL_STUB_LIB_FILE)
519 AC_SUBST(TCL_STUB_LIB_FLAG)
520 AC_SUBST(TCL_STUB_LIB_SPEC)
521 fi
drh71eb93e2001-09-28 01:34:43 +0000522fi
drh7b5717e2004-11-25 13:50:01 +0000523if test "${use_tcl}" = "no" ; then
524 HAVE_TCL=""
525else
526 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000527fi
drh7b5717e2004-11-25 13:50:01 +0000528AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000529
530##########
531# Figure out what C libraries are required to compile programs
532# that use "readline()" library.
533#
vapier4c10a8a2007-02-17 14:28:26 +0000534TARGET_READLINE_LIBS=""
535TARGET_READLINE_INC=""
536TARGET_HAVE_READLINE=0
537AC_ARG_ENABLE([readline],
538 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
539 [with_readline=$enableval],
540 [with_readline=auto])
541
542if test x"$with_readline" != xno; then
543 found="yes"
544
545 AC_ARG_WITH([readline-lib],
546 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
547 [with_readline_lib=$withval],
548 [with_readline_lib="auto"])
549 if test "x$with_readline_lib" = xauto; then
550 save_LIBS="$LIBS"
551 LIBS=""
552 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
553 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
554 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
555 LIBS="$save_LIBS"
556 else
557 TARGET_READLINE_LIBS="$with_readline_lib"
558 fi
559
560 AC_ARG_WITH([readline-inc],
561 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
562 [with_readline_inc=$withval],
563 [with_readline_inc="auto"])
564 if test "x$with_readline_inc" = xauto; then
565 AC_CHECK_HEADER(readline.h, [found="yes"], [
566 found="no"
567 if test "$cross_compiling" != yes; then
568 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
569 for subdir in include include/readline; do
570 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
571 if test "$found" = "yes"; then
572 TARGET_READLINE_INC="-I$dir/$subdir"
573 break
574 fi
575 done
576 test "$found" = "yes" && break
577 done
578 fi
579 ])
580 else
581 TARGET_READLINE_INC="$with_readline_inc"
582 fi
583
584 if test x"$found" = xno; then
585 TARGET_READLINE_LIBS=""
586 TARGET_READLINE_INC=""
587 TARGET_HAVE_READLINE=0
588 else
589 TARGET_HAVE_READLINE=1
590 fi
drh71eb93e2001-09-28 01:34:43 +0000591fi
vapier4c10a8a2007-02-17 14:28:26 +0000592
drh71eb93e2001-09-28 01:34:43 +0000593AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000594AC_SUBST(TARGET_READLINE_INC)
595AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000596
597##########
drhf1878b42006-01-23 18:06:52 +0000598# Figure out what C libraries are required to compile programs
599# that use "fdatasync()" function.
600#
drhf1878b42006-01-23 18:06:52 +0000601AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000602
drh71eb93e2001-09-28 01:34:43 +0000603#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000604# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000605AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000606 [use_debug=$enableval],[use_debug=no])
607if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000608 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000609else
610 TARGET_DEBUG="-DNDEBUG"
611fi
612AC_SUBST(TARGET_DEBUG)
613
614#########
mlcreech94984912008-03-04 19:03:08 +0000615# See whether we should use the amalgamation to build
616AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
mlcreech969b2cd2008-03-14 04:11:03 +0000617 [Disable the amalgamation and instead build all files separately]),
mlcreech94984912008-03-04 19:03:08 +0000618 [use_amalgamation=$enableval],[use_amalgamation=yes])
mlcreechf3868112008-03-11 18:03:30 +0000619if test "${use_amalgamation}" != "yes" ; then
mlcreech94984912008-03-04 19:03:08 +0000620 USE_AMALGAMATION=0
621fi
622AC_SUBST(USE_AMALGAMATION)
623
624#########
mlcreecha4edab02008-03-06 04:14:17 +0000625# See whether we should allow loadable extensions
626AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
627 [Enable loading of external extensions]),
628 [use_loadextension=$enableval],[use_loadextension=no])
629if test "${use_loadextension}" = "yes" ; then
shanefbedede2008-07-22 05:05:01 +0000630 OPT_FEATURE_FLAGS=""
mlcreecha4edab02008-03-06 04:14:17 +0000631else
shanefbedede2008-07-22 05:05:01 +0000632 OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
mlcreecha4edab02008-03-06 04:14:17 +0000633fi
mlcreecha4edab02008-03-06 04:14:17 +0000634
mlcreechaac7b932008-04-01 02:45:22 +0000635#########
shaneb1cd7302008-10-22 18:27:31 +0000636# attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000637for option in $CFLAGS $CPPFLAGS
638do
639 case $option in
danielk197733a14782008-08-04 14:50:05 +0000640 -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
shaneb1cd7302008-10-22 18:27:31 +0000641 -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000642 esac
643done
644AC_SUBST(OPT_FEATURE_FLAGS)
645
646
shaneb1cd7302008-10-22 18:27:31 +0000647# attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000648ac_temp_CFLAGS=""
649for option in $CFLAGS
650do
651 case $option in
652 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000653 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000654 *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000655 esac
656done
657CFLAGS=$ac_temp_CFLAGS
658
659
shaneb1cd7302008-10-22 18:27:31 +0000660# attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000661ac_temp_CPPFLAGS=""
662for option in $CPPFLAGS
663do
664 case $option in
665 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000666 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000667 *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000668 esac
669done
670CPPFLAGS=$ac_temp_CPPFLAGS
671
672
shaneb1cd7302008-10-22 18:27:31 +0000673# attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000674ac_temp_BUILD_CFLAGS=""
675for option in $BUILD_CFLAGS
676do
677 case $option in
678 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000679 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000680 *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000681 esac
682done
683BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
684
685
686#########
687# See whether we should use GCOV
mlcreechaac7b932008-04-01 02:45:22 +0000688AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
689 [Enable coverage testing using gcov]),
690 [use_gcov=$enableval],[use_gcov=no])
691if test "${use_gcov}" = "yes" ; then
692 USE_GCOV=1
693else
694 USE_GCOV=0
695fi
696AC_SUBST(USE_GCOV)
697
drhaf6edf52005-10-04 18:38:49 +0000698
drh71eb93e2001-09-28 01:34:43 +0000699#########
mlcreechb87057f2008-03-06 07:19:20 +0000700# Output the config header
mlcreech23797062008-03-20 02:25:35 +0000701AC_CONFIG_HEADERS(config.h)
mlcreechb87057f2008-03-06 07:19:20 +0000702
703#########
drh71eb93e2001-09-28 01:34:43 +0000704# Generate the output files.
705#
mlcreech8390bc32008-03-06 08:54:38 +0000706AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000707AC_OUTPUT([
708Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000709sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000710])