blob: 4a7043ede1da7734ea783b973d0f767e167b53db [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
vapierfaa68db2009-04-01 07:38:31 +000092dnl Make sure the local VERSION file matches this configure script
danielk19776f050aa2009-04-25 08:39:14 +000093sqlite_version_sanity_check=`cat $srcdir/VERSION | tr -d '\n'`
vapierfaa68db2009-04-01 07:38:31 +000094if test "$PACKAGE_VERSION" != "$sqlite_version_sanity_check" ; then
95AC_MSG_ERROR([configure script is out of date:
96 configure \$PACKAGE_VERSION = $PACKAGE_VERSION
97 top level VERSION file = $sqlite_version_sanity_check
98please regen with autoconf])
99fi
100
drh71eb93e2001-09-28 01:34:43 +0000101dnl Put the RCS revision string after AC_INIT so that it will also
102dnl show in in configure.
103# The following RCS revision string applies to configure.in
danielk19776f050aa2009-04-25 08:39:14 +0000104# $Revision: 1.56 $
drh71eb93e2001-09-28 01:34:43 +0000105
106#########
107# Programs needed
108#
109AC_PROG_LIBTOOL
110AC_PROG_INSTALL
drhf1878b42006-01-23 18:06:52 +0000111AC_PROG_AWK
drh71eb93e2001-09-28 01:34:43 +0000112
113#########
mlcreech636a9952008-05-05 22:52:56 +0000114# Enable large file support (if special flags are necessary)
115#
116AC_SYS_LARGEFILE
117
118#########
mlcreechb87057f2008-03-06 07:19:20 +0000119# Check for needed/wanted data types
120AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t,
121 uint16_t, uint32_t, uint64_t, uintptr_t])
122
123#########
124# Check for needed/wanted headers
drh86c5a932012-02-08 12:13:28 +0000125AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h])
mlcreech5b0a9eb2008-03-09 01:38:09 +0000126
127#########
128# Figure out whether or not we have these functions
129#
drh6a8ab6d2011-11-09 01:53:25 +0000130AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r localtime_s utime malloc_usable_size])
mlcreech5b0a9eb2008-03-09 01:38:09 +0000131
mlcreechab1c47b2008-03-09 02:51:10 +0000132#########
mlcreechf3868112008-03-11 18:03:30 +0000133# By default, we use the amalgamation (this may be changed below...)
134#
135USE_AMALGAMATION=1
136
137#########
mlcreechab1c47b2008-03-09 02:51:10 +0000138# See whether we can run specific tclsh versions known to work well;
139# if not, then we fall back to plain tclsh.
140# TODO: try other versions before falling back?
141#
drhd7ceb372010-07-27 16:42:22 +0000142AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.5 tclsh], none)
mlcreechf3868112008-03-11 18:03:30 +0000143if test "$TCLSH_CMD" = "none"; then
144 # If we can't find a local tclsh, then building the amalgamation will fail.
145 # We act as though --disable-amalgamation has been used.
146 echo "Warning: can't find tclsh - defaulting to non-amalgamation build."
147 USE_AMALGAMATION=0
148 TCLSH_CMD="tclsh"
149fi
mlcreechab1c47b2008-03-09 02:51:10 +0000150AC_SUBST(TCLSH_CMD)
151
vapier6d120f32009-01-28 04:46:14 +0000152AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin])
153if test "x${TCLLIBDIR+set}" != "xset" ; then
154 TCLLIBDIR='$(libdir)'
155 for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do
156 TCLLIBDIR=$i
157 break
158 done
159 TCLLIBDIR="${TCLLIBDIR}/sqlite3"
160fi
161
mlcreechb87057f2008-03-06 07:19:20 +0000162
163#########
drh71eb93e2001-09-28 01:34:43 +0000164# Set up an appropriate program prefix
165#
166if test "$program_prefix" = "NONE"; then
167 program_prefix=""
168fi
169AC_SUBST(program_prefix)
170
drh4b2266a2004-11-27 15:52:16 +0000171VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
vapier695f0972009-01-26 21:43:16 +0000172AC_MSG_NOTICE(Version set to $VERSION)
a.rottmannc7e93832003-03-24 09:39:32 +0000173AC_SUBST(VERSION)
drh4b2266a2004-11-27 15:52:16 +0000174RELEASE=`cat $srcdir/VERSION`
vapier695f0972009-01-26 21:43:16 +0000175AC_MSG_NOTICE(Release set to $RELEASE)
drh4b2266a2004-11-27 15:52:16 +0000176AC_SUBST(RELEASE)
vapier695f0972009-01-26 21:43:16 +0000177VERSION_NUMBER=[`cat $srcdir/VERSION \
drhb7977832005-02-16 03:45:51 +0000178 | sed 's/[^0-9]/ /g' \
drh26d0e2a2005-07-06 13:51:27 +0000179 | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
vapier695f0972009-01-26 21:43:16 +0000180AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
drhb7977832005-02-16 03:45:51 +0000181AC_SUBST(VERSION_NUMBER)
a.rottmannc7e93832003-03-24 09:39:32 +0000182
drh71eb93e2001-09-28 01:34:43 +0000183#########
184# Check to see if the --with-hints=FILE option is used. If there is none,
185# then check for a files named "$host.hints" and ../$hosts.hints where
186# $host is the hostname of the build system. If still no hints are
187# found, try looking in $system.hints and ../$system.hints where
188# $system is the result of uname -s.
189#
190AC_ARG_WITH(hints,
drh94e4f822006-02-15 02:00:25 +0000191 AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
drh71eb93e2001-09-28 01:34:43 +0000192 hints=$withval)
193if test "$hints" = ""; then
194 host=`hostname | sed 's/\..*//'`
195 if test -r $host.hints; then
196 hints=$host.hints
197 else
198 if test -r ../$host.hints; then
199 hints=../$host.hints
200 fi
201 fi
202fi
203if test "$hints" = ""; then
204 sys=`uname -s`
205 if test -r $sys.hints; then
206 hints=$sys.hints
207 else
208 if test -r ../$sys.hints; then
209 hints=../$sys.hints
210 fi
211 fi
212fi
213if test "$hints" != ""; then
214 AC_MSG_RESULT(reading hints from $hints)
215 . $hints
216fi
217
218#########
219# Locate a compiler for the build machine. This compiler should
220# generate command-line programs that run on the build machine.
221#
vapierc8a15302007-02-17 14:31:55 +0000222if test x"$cross_compiling" = xno; then
223 BUILD_CC=$CC
224 BUILD_CFLAGS=$CFLAGS
drh71eb93e2001-09-28 01:34:43 +0000225else
vapierc8a15302007-02-17 14:31:55 +0000226 if test "${BUILD_CC+set}" != set; then
227 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
228 fi
229 if test "${BUILD_CFLAGS+set}" != set; then
230 BUILD_CFLAGS="-g"
231 fi
drh71eb93e2001-09-28 01:34:43 +0000232fi
233AC_SUBST(BUILD_CC)
drh71eb93e2001-09-28 01:34:43 +0000234
235##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000236# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000237#
dougcurrie0f290bf2004-06-21 18:57:29 +0000238AC_ARG_ENABLE(threadsafe,
drh5a3032b2007-09-03 16:12:09 +0000239AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
dougcurrie0f290bf2004-06-21 18:57:29 +0000240AC_MSG_CHECKING([whether to support threadsafe operation])
241if test "$enable_threadsafe" = "no"; then
drh5a3032b2007-09-03 16:12:09 +0000242 SQLITE_THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000243 AC_MSG_RESULT([no])
244else
drh5a3032b2007-09-03 16:12:09 +0000245 SQLITE_THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000246 AC_MSG_RESULT([yes])
247fi
drh5a3032b2007-09-03 16:12:09 +0000248AC_SUBST(SQLITE_THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000249
drh5a3032b2007-09-03 16:12:09 +0000250if test "$SQLITE_THREADSAFE" = "1"; then
mlcreechc658b0f2008-03-09 02:20:11 +0000251 AC_SEARCH_LIBS(pthread_create, pthread)
dougcurrie65623c72004-09-20 14:57:23 +0000252fi
dougcurrie65623c72004-09-20 14:57:23 +0000253
paulb0208cc2003-04-13 18:26:49 +0000254##########
drh91636d52005-11-24 23:14:00 +0000255# Do we want to allow a connection created in one thread to be used
256# in another thread. This does not work on many Linux systems (ex: RedHat 9)
257# due to bugs in the threading implementations. This is thus off by default.
258#
259AC_ARG_ENABLE(cross-thread-connections,
drh94e4f822006-02-15 02:00:25 +0000260AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
drh91636d52005-11-24 23:14:00 +0000261AC_MSG_CHECKING([whether to allow connections to be shared across threads])
262if test "$enable_xthreadconnect" = "no"; then
263 XTHREADCONNECT=''
264 AC_MSG_RESULT([no])
265else
266 XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
267 AC_MSG_RESULT([yes])
268fi
269AC_SUBST(XTHREADCONNECT)
270
271##########
xdong3b5543c2003-09-23 00:36:50 +0000272# Do we want to support release
273#
274AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000275AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000276AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
277if test "$enable_releasemode" = "no"; then
278 ALLOWRELEASE=""
279 AC_MSG_RESULT([no])
280else
drh0b47d342007-11-27 14:50:06 +0000281 ALLOWRELEASE="-release `cat $srcdir/VERSION`"
xdong3b5543c2003-09-23 00:36:50 +0000282 AC_MSG_RESULT([yes])
283fi
284AC_SUBST(ALLOWRELEASE)
285
286##########
paulb0208cc2003-04-13 18:26:49 +0000287# Do we want temporary databases in memory
288#
dougcurrie0f290bf2004-06-21 18:57:29 +0000289AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000290AC_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 +0000291AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000292case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000293 never )
paul2dc96f92003-04-20 11:46:34 +0000294 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000295 AC_MSG_RESULT([never])
296 ;;
297 no )
paul2dc96f92003-04-20 11:46:34 +0000298 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000299 AC_MSG_RESULT([no])
300 ;;
drh54414bb2005-10-10 00:05:50 +0000301 yes )
drh8b727472009-01-19 18:18:40 +0000302 TEMP_STORE=2
303 AC_MSG_RESULT([yes])
304 ;;
305 always )
drh54414bb2005-10-10 00:05:50 +0000306 TEMP_STORE=3
307 AC_MSG_RESULT([always])
308 ;;
paulb0208cc2003-04-13 18:26:49 +0000309 * )
drh54414bb2005-10-10 00:05:50 +0000310 TEMP_STORE=1
drh8b727472009-01-19 18:18:40 +0000311 AC_MSG_RESULT([no])
paulb0208cc2003-04-13 18:26:49 +0000312 ;;
313esac
paul2dc96f92003-04-20 11:46:34 +0000314
paul2dc96f92003-04-20 11:46:34 +0000315AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000316
drh71eb93e2001-09-28 01:34:43 +0000317###########
318# Lots of things are different if we are compiling for Windows using
319# the CYGWIN environment. So check for that special case and handle
320# things accordingly.
321#
322AC_MSG_CHECKING([if executables have the .exe suffix])
323if test "$config_BUILD_EXEEXT" = ".exe"; then
324 CYGWIN=yes
325 AC_MSG_RESULT(yes)
326else
327 AC_MSG_RESULT(unknown)
328fi
329if test "$CYGWIN" != "yes"; then
330 AC_CYGWIN
331fi
332if test "$CYGWIN" = "yes"; then
333 BUILD_EXEEXT=.exe
334else
dougcurrie6194a5f2003-12-19 20:09:51 +0000335 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000336fi
vapierc8a15302007-02-17 14:31:55 +0000337if test x"$cross_compiling" = xno; then
drh71eb93e2001-09-28 01:34:43 +0000338 TARGET_EXEEXT=$BUILD_EXEEXT
339else
340 TARGET_EXEEXT=$config_TARGET_EXEEXT
341fi
342if test "$TARGET_EXEEXT" = ".exe"; then
drh60a1e4b2006-06-03 18:02:15 +0000343 if test $OS2_SHELL ; then
danielk197729bafea2008-06-26 10:41:19 +0000344 SQLITE_OS_UNIX=0
345 SQLITE_OS_WIN=0
346 SQLITE_OS_OS2=1
347 CFLAGS="$CFLAGS -DSQLITE_OS_OS2=1"
drh60a1e4b2006-06-03 18:02:15 +0000348 else
danielk197729bafea2008-06-26 10:41:19 +0000349 SQLITE_OS_UNIX=0
350 SQLITE_OS_WIN=1
351 SQLITE_OS_OS2=0
danielk197729bafea2008-06-26 10:41:19 +0000352 CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
drh60a1e4b2006-06-03 18:02:15 +0000353 fi
drh71eb93e2001-09-28 01:34:43 +0000354else
danielk197729bafea2008-06-26 10:41:19 +0000355 SQLITE_OS_UNIX=1
356 SQLITE_OS_WIN=0
357 SQLITE_OS_OS2=0
danielk197729bafea2008-06-26 10:41:19 +0000358 CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000359fi
drh71eb93e2001-09-28 01:34:43 +0000360
361AC_SUBST(BUILD_EXEEXT)
danielk197729bafea2008-06-26 10:41:19 +0000362AC_SUBST(SQLITE_OS_UNIX)
363AC_SUBST(SQLITE_OS_WIN)
364AC_SUBST(SQLITE_OS_OS2)
drh71eb93e2001-09-28 01:34:43 +0000365AC_SUBST(TARGET_EXEEXT)
366
367##########
drh7b5717e2004-11-25 13:50:01 +0000368# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000369#
drh7b5717e2004-11-25 13:50:01 +0000370# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
371# macros in the in the tcl.m4 file of the standard TCL distribution.
372# Those macros could not be used directly since we have to make some
373# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000374#
drh94e4f822006-02-15 02:00:25 +0000375AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000376 [use_tcl=$enableval],[use_tcl=yes])
377if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000378 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 +0000379 AC_MSG_CHECKING([for Tcl configuration])
380 AC_CACHE_VAL(ac_cv_c_tclconfig,[
381 # First check to see if --with-tcl was specified.
382 if test x"${with_tclconfig}" != x ; then
383 if test -f "${with_tclconfig}/tclConfig.sh" ; then
384 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
385 else
386 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
387 fi
drh71eb93e2001-09-28 01:34:43 +0000388 fi
vapierfe7e82e2009-01-26 21:39:33 +0000389
390 # Start autosearch by asking tclsh
drhe74f4652012-08-15 16:06:54 +0000391 if test x"${ac_cv_c_tclconfig}" = x ; then
392 if test x"$cross_compiling" = xno; then
393 for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
394 do
395 if test -f "$i/tclConfig.sh" ; then
396 ac_cv_c_tclconfig="$i"
397 break
398 fi
399 done
400 fi
vapierfe7e82e2009-01-26 21:39:33 +0000401 fi
402
drh7b5717e2004-11-25 13:50:01 +0000403 # then check for a private Tcl installation
404 if test x"${ac_cv_c_tclconfig}" = x ; then
405 for i in \
406 ../tcl \
407 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
408 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
409 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
410 ../../tcl \
411 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
412 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
413 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
414 ../../../tcl \
415 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
416 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
417 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
418 do
419 if test -f "$i/unix/tclConfig.sh" ; then
420 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
421 break
422 fi
423 done
424 fi
425
426 # check in a few common install locations
427 if test x"${ac_cv_c_tclconfig}" = x ; then
428 for i in \
429 `ls -d ${libdir} 2>/dev/null` \
430 `ls -d /usr/local/lib 2>/dev/null` \
431 `ls -d /usr/contrib/lib 2>/dev/null` \
432 `ls -d /usr/lib 2>/dev/null`
433 do
434 if test -f "$i/tclConfig.sh" ; then
435 ac_cv_c_tclconfig=`(cd $i; pwd)`
436 break
437 fi
438 done
439 fi
440
441 # check in a few other private locations
442 if test x"${ac_cv_c_tclconfig}" = x ; then
443 for i in \
444 ${srcdir}/../tcl \
445 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
446 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
447 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
448 do
449 if test -f "$i/unix/tclConfig.sh" ; then
450 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
451 break
452 fi
453 done
454 fi
455 ])
456
457 if test x"${ac_cv_c_tclconfig}" = x ; then
458 use_tcl=no
459 AC_MSG_WARN(Can't find Tcl configuration definitions)
460 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
461 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
462 else
463 TCL_BIN_DIR=${ac_cv_c_tclconfig}
464 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
465
466 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
467 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
468 AC_MSG_RESULT([loading])
469 . $TCL_BIN_DIR/tclConfig.sh
470 else
471 AC_MSG_RESULT([file not found])
472 fi
473
474 #
475 # If the TCL_BIN_DIR is the build directory (not the install directory),
476 # then set the common variable name to the value of the build variables.
477 # For example, the variable TCL_LIB_SPEC will be set to the value
478 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
479 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
480 # installed and uninstalled version of Tcl.
481 #
482
mlcreechab1c47b2008-03-09 02:51:10 +0000483 if test -f $TCL_BIN_DIR/Makefile ; then
drh7b5717e2004-11-25 13:50:01 +0000484 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
485 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
486 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
487 fi
488
489 #
490 # eval is required to do the TCL_DBGX substitution
491 #
492
493 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
494 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
495 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
496
497 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
498 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
499 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
500
501 AC_SUBST(TCL_VERSION)
502 AC_SUBST(TCL_BIN_DIR)
503 AC_SUBST(TCL_SRC_DIR)
drh7b5717e2004-11-25 13:50:01 +0000504 AC_SUBST(TCL_INCLUDE_SPEC)
505
506 AC_SUBST(TCL_LIB_FILE)
507 AC_SUBST(TCL_LIB_FLAG)
508 AC_SUBST(TCL_LIB_SPEC)
509
510 AC_SUBST(TCL_STUB_LIB_FILE)
511 AC_SUBST(TCL_STUB_LIB_FLAG)
512 AC_SUBST(TCL_STUB_LIB_SPEC)
513 fi
drh71eb93e2001-09-28 01:34:43 +0000514fi
drh7b5717e2004-11-25 13:50:01 +0000515if test "${use_tcl}" = "no" ; then
516 HAVE_TCL=""
517else
518 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000519fi
drh7b5717e2004-11-25 13:50:01 +0000520AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000521
522##########
523# Figure out what C libraries are required to compile programs
524# that use "readline()" library.
525#
vapier4c10a8a2007-02-17 14:28:26 +0000526TARGET_READLINE_LIBS=""
527TARGET_READLINE_INC=""
528TARGET_HAVE_READLINE=0
529AC_ARG_ENABLE([readline],
530 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
531 [with_readline=$enableval],
532 [with_readline=auto])
533
534if test x"$with_readline" != xno; then
535 found="yes"
536
537 AC_ARG_WITH([readline-lib],
538 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
539 [with_readline_lib=$withval],
540 [with_readline_lib="auto"])
541 if test "x$with_readline_lib" = xauto; then
542 save_LIBS="$LIBS"
543 LIBS=""
544 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
545 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
546 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
547 LIBS="$save_LIBS"
548 else
549 TARGET_READLINE_LIBS="$with_readline_lib"
550 fi
551
552 AC_ARG_WITH([readline-inc],
553 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
554 [with_readline_inc=$withval],
555 [with_readline_inc="auto"])
556 if test "x$with_readline_inc" = xauto; then
557 AC_CHECK_HEADER(readline.h, [found="yes"], [
558 found="no"
559 if test "$cross_compiling" != yes; then
560 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
561 for subdir in include include/readline; do
562 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
563 if test "$found" = "yes"; then
564 TARGET_READLINE_INC="-I$dir/$subdir"
565 break
566 fi
567 done
568 test "$found" = "yes" && break
569 done
570 fi
571 ])
572 else
573 TARGET_READLINE_INC="$with_readline_inc"
574 fi
575
576 if test x"$found" = xno; then
577 TARGET_READLINE_LIBS=""
578 TARGET_READLINE_INC=""
579 TARGET_HAVE_READLINE=0
580 else
581 TARGET_HAVE_READLINE=1
582 fi
drh71eb93e2001-09-28 01:34:43 +0000583fi
vapier4c10a8a2007-02-17 14:28:26 +0000584
drh71eb93e2001-09-28 01:34:43 +0000585AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000586AC_SUBST(TARGET_READLINE_INC)
587AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000588
589##########
drhf1878b42006-01-23 18:06:52 +0000590# Figure out what C libraries are required to compile programs
591# that use "fdatasync()" function.
592#
drhf1878b42006-01-23 18:06:52 +0000593AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000594
drh71eb93e2001-09-28 01:34:43 +0000595#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000596# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000597AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000598 [use_debug=$enableval],[use_debug=no])
599if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000600 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000601else
602 TARGET_DEBUG="-DNDEBUG"
603fi
604AC_SUBST(TARGET_DEBUG)
605
606#########
mlcreech94984912008-03-04 19:03:08 +0000607# See whether we should use the amalgamation to build
608AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
mlcreech969b2cd2008-03-14 04:11:03 +0000609 [Disable the amalgamation and instead build all files separately]),
mlcreech94984912008-03-04 19:03:08 +0000610 [use_amalgamation=$enableval],[use_amalgamation=yes])
mlcreechf3868112008-03-11 18:03:30 +0000611if test "${use_amalgamation}" != "yes" ; then
mlcreech94984912008-03-04 19:03:08 +0000612 USE_AMALGAMATION=0
613fi
614AC_SUBST(USE_AMALGAMATION)
615
616#########
mlcreecha4edab02008-03-06 04:14:17 +0000617# See whether we should allow loadable extensions
618AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
619 [Enable loading of external extensions]),
620 [use_loadextension=$enableval],[use_loadextension=no])
621if test "${use_loadextension}" = "yes" ; then
shanefbedede2008-07-22 05:05:01 +0000622 OPT_FEATURE_FLAGS=""
drhdbe4b882011-06-20 18:00:17 +0000623 AC_SEARCH_LIBS(dlopen, dl)
mlcreecha4edab02008-03-06 04:14:17 +0000624else
shanefbedede2008-07-22 05:05:01 +0000625 OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
mlcreecha4edab02008-03-06 04:14:17 +0000626fi
mlcreecha4edab02008-03-06 04:14:17 +0000627
mlcreechaac7b932008-04-01 02:45:22 +0000628#########
shaneb1cd7302008-10-22 18:27:31 +0000629# attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000630for option in $CFLAGS $CPPFLAGS
631do
632 case $option in
danielk197733a14782008-08-04 14:50:05 +0000633 -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
shaneb1cd7302008-10-22 18:27:31 +0000634 -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000635 esac
636done
637AC_SUBST(OPT_FEATURE_FLAGS)
638
639
shaneb1cd7302008-10-22 18:27:31 +0000640# attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000641ac_temp_CFLAGS=""
642for option in $CFLAGS
643do
644 case $option in
645 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000646 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000647 *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000648 esac
649done
650CFLAGS=$ac_temp_CFLAGS
651
652
shaneb1cd7302008-10-22 18:27:31 +0000653# attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000654ac_temp_CPPFLAGS=""
655for option in $CPPFLAGS
656do
657 case $option in
658 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000659 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000660 *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000661 esac
662done
663CPPFLAGS=$ac_temp_CPPFLAGS
664
665
shaneb1cd7302008-10-22 18:27:31 +0000666# attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
shanefbedede2008-07-22 05:05:01 +0000667ac_temp_BUILD_CFLAGS=""
668for option in $BUILD_CFLAGS
669do
670 case $option in
671 -DSQLITE_OMIT*) ;;
shaneb1cd7302008-10-22 18:27:31 +0000672 -DSQLITE_ENABLE*) ;;
danielk197733a14782008-08-04 14:50:05 +0000673 *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
shanefbedede2008-07-22 05:05:01 +0000674 esac
675done
676BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
677
678
679#########
680# See whether we should use GCOV
mlcreechaac7b932008-04-01 02:45:22 +0000681AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
682 [Enable coverage testing using gcov]),
683 [use_gcov=$enableval],[use_gcov=no])
684if test "${use_gcov}" = "yes" ; then
685 USE_GCOV=1
686else
687 USE_GCOV=0
688fi
689AC_SUBST(USE_GCOV)
690
drhaf6edf52005-10-04 18:38:49 +0000691
drh71eb93e2001-09-28 01:34:43 +0000692#########
mlcreechb87057f2008-03-06 07:19:20 +0000693# Output the config header
mlcreech23797062008-03-20 02:25:35 +0000694AC_CONFIG_HEADERS(config.h)
mlcreechb87057f2008-03-06 07:19:20 +0000695
696#########
drh71eb93e2001-09-28 01:34:43 +0000697# Generate the output files.
698#
mlcreech8390bc32008-03-06 08:54:38 +0000699AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000700AC_OUTPUT([
701Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000702sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000703])