blob: 8f18106aa2aab8d9b4cdfc5057449ea8ddd25e96 [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
shanefbedede2008-07-22 05:05:01 +000095# $Revision: 1.47 $
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 ;;
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
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"
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
danielk197729bafea2008-06-26 10:41:19 +0000352 SQLITE_OS_UNIX=0
353 SQLITE_OS_WIN=1
354 SQLITE_OS_OS2=0
danielk197729bafea2008-06-26 10:41:19 +0000355 CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
drh60a1e4b2006-06-03 18:02:15 +0000356 fi
drh71eb93e2001-09-28 01:34:43 +0000357else
danielk197729bafea2008-06-26 10:41:19 +0000358 SQLITE_OS_UNIX=1
359 SQLITE_OS_WIN=0
360 SQLITE_OS_OS2=0
danielk197729bafea2008-06-26 10:41:19 +0000361 CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000362fi
drh71eb93e2001-09-28 01:34:43 +0000363
364AC_SUBST(BUILD_EXEEXT)
danielk197729bafea2008-06-26 10:41:19 +0000365AC_SUBST(SQLITE_OS_UNIX)
366AC_SUBST(SQLITE_OS_WIN)
367AC_SUBST(SQLITE_OS_OS2)
drh71eb93e2001-09-28 01:34:43 +0000368AC_SUBST(TARGET_EXEEXT)
369
370##########
drh7b5717e2004-11-25 13:50:01 +0000371# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000372#
drh7b5717e2004-11-25 13:50:01 +0000373# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
374# macros in the in the tcl.m4 file of the standard TCL distribution.
375# Those macros could not be used directly since we have to make some
376# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000377#
drh94e4f822006-02-15 02:00:25 +0000378AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000379 [use_tcl=$enableval],[use_tcl=yes])
380if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000381 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 +0000382 AC_MSG_CHECKING([for Tcl configuration])
383 AC_CACHE_VAL(ac_cv_c_tclconfig,[
384 # First check to see if --with-tcl was specified.
385 if test x"${with_tclconfig}" != x ; then
386 if test -f "${with_tclconfig}/tclConfig.sh" ; then
387 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
388 else
389 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
390 fi
drh71eb93e2001-09-28 01:34:43 +0000391 fi
drh7b5717e2004-11-25 13:50:01 +0000392 # then check for a private Tcl installation
393 if test x"${ac_cv_c_tclconfig}" = x ; then
394 for i in \
395 ../tcl \
396 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
397 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
398 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
399 ../../tcl \
400 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
401 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
402 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
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 do
408 if test -f "$i/unix/tclConfig.sh" ; then
409 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
410 break
411 fi
412 done
413 fi
414
415 # check in a few common install locations
416 if test x"${ac_cv_c_tclconfig}" = x ; then
417 for i in \
418 `ls -d ${libdir} 2>/dev/null` \
419 `ls -d /usr/local/lib 2>/dev/null` \
420 `ls -d /usr/contrib/lib 2>/dev/null` \
421 `ls -d /usr/lib 2>/dev/null`
422 do
423 if test -f "$i/tclConfig.sh" ; then
424 ac_cv_c_tclconfig=`(cd $i; pwd)`
425 break
426 fi
427 done
428 fi
429
430 # check in a few other private locations
431 if test x"${ac_cv_c_tclconfig}" = x ; then
432 for i in \
433 ${srcdir}/../tcl \
434 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
435 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
436 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
437 do
438 if test -f "$i/unix/tclConfig.sh" ; then
439 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
440 break
441 fi
442 done
443 fi
444 ])
445
446 if test x"${ac_cv_c_tclconfig}" = x ; then
447 use_tcl=no
448 AC_MSG_WARN(Can't find Tcl configuration definitions)
449 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
450 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
451 else
452 TCL_BIN_DIR=${ac_cv_c_tclconfig}
453 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
454
455 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
456 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
457 AC_MSG_RESULT([loading])
458 . $TCL_BIN_DIR/tclConfig.sh
459 else
460 AC_MSG_RESULT([file not found])
461 fi
462
463 #
464 # If the TCL_BIN_DIR is the build directory (not the install directory),
465 # then set the common variable name to the value of the build variables.
466 # For example, the variable TCL_LIB_SPEC will be set to the value
467 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
468 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
469 # installed and uninstalled version of Tcl.
470 #
471
mlcreechab1c47b2008-03-09 02:51:10 +0000472 if test -f $TCL_BIN_DIR/Makefile ; then
drh7b5717e2004-11-25 13:50:01 +0000473 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
474 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
475 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
476 fi
477
478 #
479 # eval is required to do the TCL_DBGX substitution
480 #
481
482 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
483 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
484 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
485
486 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
487 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
488 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
489
490 AC_SUBST(TCL_VERSION)
491 AC_SUBST(TCL_BIN_DIR)
492 AC_SUBST(TCL_SRC_DIR)
493 AC_SUBST(TCL_LIBS)
494 AC_SUBST(TCL_INCLUDE_SPEC)
495
496 AC_SUBST(TCL_LIB_FILE)
497 AC_SUBST(TCL_LIB_FLAG)
498 AC_SUBST(TCL_LIB_SPEC)
499
500 AC_SUBST(TCL_STUB_LIB_FILE)
501 AC_SUBST(TCL_STUB_LIB_FLAG)
502 AC_SUBST(TCL_STUB_LIB_SPEC)
503 fi
drh71eb93e2001-09-28 01:34:43 +0000504fi
drh7b5717e2004-11-25 13:50:01 +0000505if test "${use_tcl}" = "no" ; then
506 HAVE_TCL=""
507else
508 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000509fi
drh7b5717e2004-11-25 13:50:01 +0000510AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000511
512##########
513# Figure out what C libraries are required to compile programs
514# that use "readline()" library.
515#
vapier4c10a8a2007-02-17 14:28:26 +0000516TARGET_READLINE_LIBS=""
517TARGET_READLINE_INC=""
518TARGET_HAVE_READLINE=0
519AC_ARG_ENABLE([readline],
520 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
521 [with_readline=$enableval],
522 [with_readline=auto])
523
524if test x"$with_readline" != xno; then
525 found="yes"
526
527 AC_ARG_WITH([readline-lib],
528 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
529 [with_readline_lib=$withval],
530 [with_readline_lib="auto"])
531 if test "x$with_readline_lib" = xauto; then
532 save_LIBS="$LIBS"
533 LIBS=""
534 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
535 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
536 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
537 LIBS="$save_LIBS"
538 else
539 TARGET_READLINE_LIBS="$with_readline_lib"
540 fi
541
542 AC_ARG_WITH([readline-inc],
543 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
544 [with_readline_inc=$withval],
545 [with_readline_inc="auto"])
546 if test "x$with_readline_inc" = xauto; then
547 AC_CHECK_HEADER(readline.h, [found="yes"], [
548 found="no"
549 if test "$cross_compiling" != yes; then
550 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
551 for subdir in include include/readline; do
552 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
553 if test "$found" = "yes"; then
554 TARGET_READLINE_INC="-I$dir/$subdir"
555 break
556 fi
557 done
558 test "$found" = "yes" && break
559 done
560 fi
561 ])
562 else
563 TARGET_READLINE_INC="$with_readline_inc"
564 fi
565
566 if test x"$found" = xno; then
567 TARGET_READLINE_LIBS=""
568 TARGET_READLINE_INC=""
569 TARGET_HAVE_READLINE=0
570 else
571 TARGET_HAVE_READLINE=1
572 fi
drh71eb93e2001-09-28 01:34:43 +0000573fi
vapier4c10a8a2007-02-17 14:28:26 +0000574
drh71eb93e2001-09-28 01:34:43 +0000575AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000576AC_SUBST(TARGET_READLINE_INC)
577AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000578
579##########
drhf1878b42006-01-23 18:06:52 +0000580# Figure out what C libraries are required to compile programs
581# that use "fdatasync()" function.
582#
drhf1878b42006-01-23 18:06:52 +0000583AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000584
drh71eb93e2001-09-28 01:34:43 +0000585#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000586# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000587AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000588 [use_debug=$enableval],[use_debug=no])
589if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000590 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000591else
592 TARGET_DEBUG="-DNDEBUG"
593fi
594AC_SUBST(TARGET_DEBUG)
595
596#########
mlcreech94984912008-03-04 19:03:08 +0000597# See whether we should use the amalgamation to build
598AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
mlcreech969b2cd2008-03-14 04:11:03 +0000599 [Disable the amalgamation and instead build all files separately]),
mlcreech94984912008-03-04 19:03:08 +0000600 [use_amalgamation=$enableval],[use_amalgamation=yes])
mlcreechf3868112008-03-11 18:03:30 +0000601if test "${use_amalgamation}" != "yes" ; then
mlcreech94984912008-03-04 19:03:08 +0000602 USE_AMALGAMATION=0
603fi
604AC_SUBST(USE_AMALGAMATION)
605
606#########
mlcreecha4edab02008-03-06 04:14:17 +0000607# See whether we should allow loadable extensions
608AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
609 [Enable loading of external extensions]),
610 [use_loadextension=$enableval],[use_loadextension=no])
611if test "${use_loadextension}" = "yes" ; then
shanefbedede2008-07-22 05:05:01 +0000612 OPT_FEATURE_FLAGS=""
mlcreecha4edab02008-03-06 04:14:17 +0000613else
shanefbedede2008-07-22 05:05:01 +0000614 OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
mlcreecha4edab02008-03-06 04:14:17 +0000615fi
mlcreecha4edab02008-03-06 04:14:17 +0000616
mlcreechaac7b932008-04-01 02:45:22 +0000617#########
shanefbedede2008-07-22 05:05:01 +0000618# attempt to duplicate any OMITS into the $(OPT_FEATURE_FLAGS) parameter
619for option in $CFLAGS $CPPFLAGS
620do
621 case $option in
622 -DSQLITE_OMIT*) OPT_FEATURE_FLAGS+=" $option";;
623 esac
624done
625AC_SUBST(OPT_FEATURE_FLAGS)
626
627
628# attempt to remove any OMITS from the $(CFLAGS) parameter
629ac_temp_CFLAGS=""
630for option in $CFLAGS
631do
632 case $option in
633 -DSQLITE_OMIT*) ;;
634 *) ac_temp_CFLAGS+=" $option";;
635 esac
636done
637CFLAGS=$ac_temp_CFLAGS
638
639
640# attempt to remove any OMITS from the $(CPPFLAGS) parameter
641ac_temp_CPPFLAGS=""
642for option in $CPPFLAGS
643do
644 case $option in
645 -DSQLITE_OMIT*) ;;
646 *) ac_temp_CPPFLAGS+=" $option";;
647 esac
648done
649CPPFLAGS=$ac_temp_CPPFLAGS
650
651
652# attempt to remove any OMITS from the $(BUILD_CFLAGS) parameter
653ac_temp_BUILD_CFLAGS=""
654for option in $BUILD_CFLAGS
655do
656 case $option in
657 -DSQLITE_OMIT*) ;;
658 *) ac_temp_BUILD_CFLAGS+=" $option";;
659 esac
660done
661BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
662
663
664#########
665# See whether we should use GCOV
mlcreechaac7b932008-04-01 02:45:22 +0000666AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
667 [Enable coverage testing using gcov]),
668 [use_gcov=$enableval],[use_gcov=no])
669if test "${use_gcov}" = "yes" ; then
670 USE_GCOV=1
671else
672 USE_GCOV=0
673fi
674AC_SUBST(USE_GCOV)
675
drhaf6edf52005-10-04 18:38:49 +0000676
drh71eb93e2001-09-28 01:34:43 +0000677#########
mlcreechb87057f2008-03-06 07:19:20 +0000678# Output the config header
mlcreech23797062008-03-20 02:25:35 +0000679AC_CONFIG_HEADERS(config.h)
mlcreechb87057f2008-03-06 07:19:20 +0000680
681#########
drh71eb93e2001-09-28 01:34:43 +0000682# Generate the output files.
683#
mlcreech8390bc32008-03-06 08:54:38 +0000684AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000685AC_OUTPUT([
686Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000687sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000688])