blob: 981d7cc2c5644ac933dfff3b94a36abdf7b5e7dd [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
mlcreechb87057f2008-03-06 07:19:20 +000095# $Revision: 1.34 $
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#########
mlcreechb87057f2008-03-06 07:19:20 +0000105# Check for needed/wanted data types
106AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t,
107 uint16_t, uint32_t, uint64_t, uintptr_t])
108
109#########
110# Check for needed/wanted headers
111AC_CHECK_HEADERS(sys/types.h, stdlib.h, stdint.h, inttypes.h)
112
113#########
drh71eb93e2001-09-28 01:34:43 +0000114# Set up an appropriate program prefix
115#
116if test "$program_prefix" = "NONE"; then
117 program_prefix=""
118fi
119AC_SUBST(program_prefix)
120
drh4b2266a2004-11-27 15:52:16 +0000121VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
122echo "Version set to $VERSION"
a.rottmannc7e93832003-03-24 09:39:32 +0000123AC_SUBST(VERSION)
drh4b2266a2004-11-27 15:52:16 +0000124RELEASE=`cat $srcdir/VERSION`
125echo "Release set to $RELEASE"
126AC_SUBST(RELEASE)
drh26d0e2a2005-07-06 13:51:27 +0000127VERSION_NUMBER=[`cat $srcdir/VERSION \
drhb7977832005-02-16 03:45:51 +0000128 | sed 's/[^0-9]/ /g' \
drh26d0e2a2005-07-06 13:51:27 +0000129 | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
drhb7977832005-02-16 03:45:51 +0000130echo "Version number set to $VERSION_NUMBER"
131AC_SUBST(VERSION_NUMBER)
a.rottmannc7e93832003-03-24 09:39:32 +0000132
drh71eb93e2001-09-28 01:34:43 +0000133#########
134# Check to see if the --with-hints=FILE option is used. If there is none,
135# then check for a files named "$host.hints" and ../$hosts.hints where
136# $host is the hostname of the build system. If still no hints are
137# found, try looking in $system.hints and ../$system.hints where
138# $system is the result of uname -s.
139#
140AC_ARG_WITH(hints,
drh94e4f822006-02-15 02:00:25 +0000141 AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
drh71eb93e2001-09-28 01:34:43 +0000142 hints=$withval)
143if test "$hints" = ""; then
144 host=`hostname | sed 's/\..*//'`
145 if test -r $host.hints; then
146 hints=$host.hints
147 else
148 if test -r ../$host.hints; then
149 hints=../$host.hints
150 fi
151 fi
152fi
153if test "$hints" = ""; then
154 sys=`uname -s`
155 if test -r $sys.hints; then
156 hints=$sys.hints
157 else
158 if test -r ../$sys.hints; then
159 hints=../$sys.hints
160 fi
161 fi
162fi
163if test "$hints" != ""; then
164 AC_MSG_RESULT(reading hints from $hints)
165 . $hints
166fi
167
168#########
169# Locate a compiler for the build machine. This compiler should
170# generate command-line programs that run on the build machine.
171#
vapierc8a15302007-02-17 14:31:55 +0000172if test x"$cross_compiling" = xno; then
173 BUILD_CC=$CC
174 BUILD_CFLAGS=$CFLAGS
drh71eb93e2001-09-28 01:34:43 +0000175else
vapierc8a15302007-02-17 14:31:55 +0000176 if test "${BUILD_CC+set}" != set; then
177 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
178 fi
179 if test "${BUILD_CFLAGS+set}" != set; then
180 BUILD_CFLAGS="-g"
181 fi
drh71eb93e2001-09-28 01:34:43 +0000182fi
183AC_SUBST(BUILD_CC)
184AC_SUBST(BUILD_CFLAGS)
drh71eb93e2001-09-28 01:34:43 +0000185
186##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000187# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000188#
dougcurrie0f290bf2004-06-21 18:57:29 +0000189AC_ARG_ENABLE(threadsafe,
drh5a3032b2007-09-03 16:12:09 +0000190AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
dougcurrie0f290bf2004-06-21 18:57:29 +0000191AC_MSG_CHECKING([whether to support threadsafe operation])
192if test "$enable_threadsafe" = "no"; then
drh5a3032b2007-09-03 16:12:09 +0000193 SQLITE_THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000194 AC_MSG_RESULT([no])
195else
drh5a3032b2007-09-03 16:12:09 +0000196 SQLITE_THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000197 AC_MSG_RESULT([yes])
198fi
drh5a3032b2007-09-03 16:12:09 +0000199AC_SUBST(SQLITE_THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000200
drh5a3032b2007-09-03 16:12:09 +0000201if test "$SQLITE_THREADSAFE" = "1"; then
dougcurrie65623c72004-09-20 14:57:23 +0000202 LIBS=""
203 AC_CHECK_LIB(pthread, pthread_create)
204 TARGET_THREAD_LIB="$LIBS"
205 LIBS=""
206else
207 TARGET_THREAD_LIB=""
208fi
209AC_SUBST(TARGET_THREAD_LIB)
210
paulb0208cc2003-04-13 18:26:49 +0000211##########
drh91636d52005-11-24 23:14:00 +0000212# Do we want to allow a connection created in one thread to be used
213# in another thread. This does not work on many Linux systems (ex: RedHat 9)
214# due to bugs in the threading implementations. This is thus off by default.
215#
216AC_ARG_ENABLE(cross-thread-connections,
drh94e4f822006-02-15 02:00:25 +0000217AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
drh91636d52005-11-24 23:14:00 +0000218AC_MSG_CHECKING([whether to allow connections to be shared across threads])
219if test "$enable_xthreadconnect" = "no"; then
220 XTHREADCONNECT=''
221 AC_MSG_RESULT([no])
222else
223 XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
224 AC_MSG_RESULT([yes])
225fi
226AC_SUBST(XTHREADCONNECT)
227
228##########
drh8e2e2a12006-02-01 01:55:17 +0000229# Do we want to set threadsOverrideEachOthersLocks variable to be 1 (true) by
230# default. Normally, a test at runtime is performed to determine the
231# appropriate value of this variable. Use this option only if you're sure that
232# threads can safely override each others locks in all runtime situations.
233#
234AC_ARG_ENABLE(threads-override-locks,
drh94e4f822006-02-15 02:00:25 +0000235AC_HELP_STRING([--enable-threads-override-locks],[Threads can override each others locks]),,enable_threads_override_locks=no)
drh8e2e2a12006-02-01 01:55:17 +0000236AC_MSG_CHECKING([whether threads can override each others locks])
237if test "$enable_threads_override_locks" = "no"; then
238 THREADSOVERRIDELOCKS='-1'
239 AC_MSG_RESULT([no])
240else
241 THREADSOVERRIDELOCKS='1'
242 AC_MSG_RESULT([yes])
243fi
244AC_SUBST(THREADSOVERRIDELOCKS)
245
246##########
xdong3b5543c2003-09-23 00:36:50 +0000247# Do we want to support release
248#
249AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000250AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000251AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
252if test "$enable_releasemode" = "no"; then
253 ALLOWRELEASE=""
254 AC_MSG_RESULT([no])
255else
drh0b47d342007-11-27 14:50:06 +0000256 ALLOWRELEASE="-release `cat $srcdir/VERSION`"
xdong3b5543c2003-09-23 00:36:50 +0000257 AC_MSG_RESULT([yes])
258fi
259AC_SUBST(ALLOWRELEASE)
260
261##########
paulb0208cc2003-04-13 18:26:49 +0000262# Do we want temporary databases in memory
263#
dougcurrie0f290bf2004-06-21 18:57:29 +0000264AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000265AC_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 +0000266AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000267case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000268 never )
paul2dc96f92003-04-20 11:46:34 +0000269 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000270 AC_MSG_RESULT([never])
271 ;;
272 no )
paul2dc96f92003-04-20 11:46:34 +0000273 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000274 AC_MSG_RESULT([no])
275 ;;
276 always )
dougcurrie0f290bf2004-06-21 18:57:29 +0000277 TEMP_STORE=3
paulb0208cc2003-04-13 18:26:49 +0000278 AC_MSG_RESULT([always])
279 ;;
drh54414bb2005-10-10 00:05:50 +0000280 yes )
281 TEMP_STORE=3
282 AC_MSG_RESULT([always])
283 ;;
paulb0208cc2003-04-13 18:26:49 +0000284 * )
drh54414bb2005-10-10 00:05:50 +0000285 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000286 AC_MSG_RESULT([yes])
287 ;;
288esac
paul2dc96f92003-04-20 11:46:34 +0000289
paul2dc96f92003-04-20 11:46:34 +0000290AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000291
drh71eb93e2001-09-28 01:34:43 +0000292###########
293# Lots of things are different if we are compiling for Windows using
294# the CYGWIN environment. So check for that special case and handle
295# things accordingly.
296#
297AC_MSG_CHECKING([if executables have the .exe suffix])
298if test "$config_BUILD_EXEEXT" = ".exe"; then
299 CYGWIN=yes
300 AC_MSG_RESULT(yes)
301else
302 AC_MSG_RESULT(unknown)
303fi
304if test "$CYGWIN" != "yes"; then
305 AC_CYGWIN
306fi
307if test "$CYGWIN" = "yes"; then
308 BUILD_EXEEXT=.exe
309else
dougcurrie6194a5f2003-12-19 20:09:51 +0000310 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000311fi
vapierc8a15302007-02-17 14:31:55 +0000312if test x"$cross_compiling" = xno; then
drh71eb93e2001-09-28 01:34:43 +0000313 TARGET_EXEEXT=$BUILD_EXEEXT
314else
315 TARGET_EXEEXT=$config_TARGET_EXEEXT
316fi
317if test "$TARGET_EXEEXT" = ".exe"; then
drh60a1e4b2006-06-03 18:02:15 +0000318 if test $OS2_SHELL ; then
319 OS_UNIX=0
320 OS_WIN=0
321 OS_OS2=1
322 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_OS2=1"
323 if test "$ac_compiler_gnu" == "yes" ; then
324 TARGET_CFLAGS="$TARGET_CFLAGS -Zomf -Zexe -Zmap"
325 BUILD_CFLAGS="$BUILD_CFLAGS -Zomf -Zexe"
326 fi
327 else
328 OS_UNIX=0
329 OS_WIN=1
330 OS_OS2=0
331 tclsubdir=win
332 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_WIN=1"
333 fi
drh71eb93e2001-09-28 01:34:43 +0000334else
335 OS_UNIX=1
336 OS_WIN=0
drh60a1e4b2006-06-03 18:02:15 +0000337 OS_OS2=0
drh71eb93e2001-09-28 01:34:43 +0000338 tclsubdir=unix
dougcurrie0f290bf2004-06-21 18:57:29 +0000339 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000340fi
drh71eb93e2001-09-28 01:34:43 +0000341
342AC_SUBST(BUILD_EXEEXT)
343AC_SUBST(OS_UNIX)
344AC_SUBST(OS_WIN)
drh60a1e4b2006-06-03 18:02:15 +0000345AC_SUBST(OS_OS2)
drh71eb93e2001-09-28 01:34:43 +0000346AC_SUBST(TARGET_EXEEXT)
347
348##########
drh7b5717e2004-11-25 13:50:01 +0000349# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000350#
drh7b5717e2004-11-25 13:50:01 +0000351# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
352# macros in the in the tcl.m4 file of the standard TCL distribution.
353# Those macros could not be used directly since we have to make some
354# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000355#
drh94e4f822006-02-15 02:00:25 +0000356AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000357 [use_tcl=$enableval],[use_tcl=yes])
358if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000359 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 +0000360 AC_MSG_CHECKING([for Tcl configuration])
361 AC_CACHE_VAL(ac_cv_c_tclconfig,[
362 # First check to see if --with-tcl was specified.
363 if test x"${with_tclconfig}" != x ; then
364 if test -f "${with_tclconfig}/tclConfig.sh" ; then
365 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
366 else
367 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
368 fi
drh71eb93e2001-09-28 01:34:43 +0000369 fi
drh7b5717e2004-11-25 13:50:01 +0000370 # then check for a private Tcl installation
371 if test x"${ac_cv_c_tclconfig}" = x ; then
372 for i in \
373 ../tcl \
374 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
375 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
376 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
377 ../../tcl \
378 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
379 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
380 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
381 ../../../tcl \
382 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
383 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
384 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
385 do
386 if test -f "$i/unix/tclConfig.sh" ; then
387 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
388 break
389 fi
390 done
391 fi
392
393 # check in a few common install locations
394 if test x"${ac_cv_c_tclconfig}" = x ; then
395 for i in \
396 `ls -d ${libdir} 2>/dev/null` \
397 `ls -d /usr/local/lib 2>/dev/null` \
398 `ls -d /usr/contrib/lib 2>/dev/null` \
399 `ls -d /usr/lib 2>/dev/null`
400 do
401 if test -f "$i/tclConfig.sh" ; then
402 ac_cv_c_tclconfig=`(cd $i; pwd)`
403 break
404 fi
405 done
406 fi
407
408 # check in a few other private locations
409 if test x"${ac_cv_c_tclconfig}" = x ; then
410 for i in \
411 ${srcdir}/../tcl \
412 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
413 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
414 `ls -dr ${srcdir}/../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
424 if test x"${ac_cv_c_tclconfig}" = x ; then
425 use_tcl=no
426 AC_MSG_WARN(Can't find Tcl configuration definitions)
427 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
428 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
429 else
430 TCL_BIN_DIR=${ac_cv_c_tclconfig}
431 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
432
433 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
434 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
435 AC_MSG_RESULT([loading])
436 . $TCL_BIN_DIR/tclConfig.sh
437 else
438 AC_MSG_RESULT([file not found])
439 fi
440
441 #
442 # If the TCL_BIN_DIR is the build directory (not the install directory),
443 # then set the common variable name to the value of the build variables.
444 # For example, the variable TCL_LIB_SPEC will be set to the value
445 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
446 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
447 # installed and uninstalled version of Tcl.
448 #
449
450 if test -f $TCL_BIN_DIR/Makefile ; then
451 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
452 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
453 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
454 fi
455
456 #
457 # eval is required to do the TCL_DBGX substitution
458 #
459
460 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
461 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
462 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
463
464 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
465 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
466 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
467
468 AC_SUBST(TCL_VERSION)
469 AC_SUBST(TCL_BIN_DIR)
470 AC_SUBST(TCL_SRC_DIR)
471 AC_SUBST(TCL_LIBS)
472 AC_SUBST(TCL_INCLUDE_SPEC)
473
474 AC_SUBST(TCL_LIB_FILE)
475 AC_SUBST(TCL_LIB_FLAG)
476 AC_SUBST(TCL_LIB_SPEC)
477
478 AC_SUBST(TCL_STUB_LIB_FILE)
479 AC_SUBST(TCL_STUB_LIB_FLAG)
480 AC_SUBST(TCL_STUB_LIB_SPEC)
481 fi
drh71eb93e2001-09-28 01:34:43 +0000482fi
drh7b5717e2004-11-25 13:50:01 +0000483if test "${use_tcl}" = "no" ; then
484 HAVE_TCL=""
485else
486 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000487fi
drh7b5717e2004-11-25 13:50:01 +0000488AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000489
490##########
491# Figure out what C libraries are required to compile programs
492# that use "readline()" library.
493#
vapier4c10a8a2007-02-17 14:28:26 +0000494TARGET_READLINE_LIBS=""
495TARGET_READLINE_INC=""
496TARGET_HAVE_READLINE=0
497AC_ARG_ENABLE([readline],
498 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
499 [with_readline=$enableval],
500 [with_readline=auto])
501
502if test x"$with_readline" != xno; then
503 found="yes"
504
505 AC_ARG_WITH([readline-lib],
506 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
507 [with_readline_lib=$withval],
508 [with_readline_lib="auto"])
509 if test "x$with_readline_lib" = xauto; then
510 save_LIBS="$LIBS"
511 LIBS=""
512 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
513 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
514 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
515 LIBS="$save_LIBS"
516 else
517 TARGET_READLINE_LIBS="$with_readline_lib"
518 fi
519
520 AC_ARG_WITH([readline-inc],
521 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
522 [with_readline_inc=$withval],
523 [with_readline_inc="auto"])
524 if test "x$with_readline_inc" = xauto; then
525 AC_CHECK_HEADER(readline.h, [found="yes"], [
526 found="no"
527 if test "$cross_compiling" != yes; then
528 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
529 for subdir in include include/readline; do
530 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
531 if test "$found" = "yes"; then
532 TARGET_READLINE_INC="-I$dir/$subdir"
533 break
534 fi
535 done
536 test "$found" = "yes" && break
537 done
538 fi
539 ])
540 else
541 TARGET_READLINE_INC="$with_readline_inc"
542 fi
543
544 if test x"$found" = xno; then
545 TARGET_READLINE_LIBS=""
546 TARGET_READLINE_INC=""
547 TARGET_HAVE_READLINE=0
548 else
549 TARGET_HAVE_READLINE=1
550 fi
drh71eb93e2001-09-28 01:34:43 +0000551fi
vapier4c10a8a2007-02-17 14:28:26 +0000552
drh71eb93e2001-09-28 01:34:43 +0000553AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000554AC_SUBST(TARGET_READLINE_INC)
555AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000556
557##########
drhf1878b42006-01-23 18:06:52 +0000558# Figure out what C libraries are required to compile programs
559# that use "fdatasync()" function.
560#
drhf1878b42006-01-23 18:06:52 +0000561AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000562
drh71eb93e2001-09-28 01:34:43 +0000563#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000564# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000565AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000566 [use_debug=$enableval],[use_debug=no])
567if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000568 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000569else
570 TARGET_DEBUG="-DNDEBUG"
571fi
572AC_SUBST(TARGET_DEBUG)
573
574#########
mlcreech94984912008-03-04 19:03:08 +0000575# See whether we should use the amalgamation to build
576AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
577 [Disable the amalgamation and instead build all files separately (currently needed to build the test fixture)]),
578 [use_amalgamation=$enableval],[use_amalgamation=yes])
579if test "${use_amalgamation}" = "yes" ; then
580 USE_AMALGAMATION=1
581else
582 USE_AMALGAMATION=0
583fi
584AC_SUBST(USE_AMALGAMATION)
585
586#########
mlcreecha4edab02008-03-06 04:14:17 +0000587# See whether we should allow loadable extensions
588AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
589 [Enable loading of external extensions]),
590 [use_loadextension=$enableval],[use_loadextension=no])
591if test "${use_loadextension}" = "yes" ; then
592 LOADEXTENSION_FLAGS=""
593else
594 LOADEXTENSION_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
595fi
596AC_SUBST(LOADEXTENSION_FLAGS)
597
598#########
drh71eb93e2001-09-28 01:34:43 +0000599# Figure out whether or not we have a "usleep()" function.
600#
601AC_CHECK_FUNC(usleep, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_USLEEP=1"])
602
drhaf6edf52005-10-04 18:38:49 +0000603#--------------------------------------------------------------------
604# Redefine fdatasync as fsync on systems that lack fdatasync
605#--------------------------------------------------------------------
606
drhf2f23912005-10-05 10:29:36 +0000607AC_CHECK_FUNC(fdatasync, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_FDATASYNC=1"])
drhaf6edf52005-10-04 18:38:49 +0000608
drh71eb93e2001-09-28 01:34:43 +0000609#########
mlcreechb87057f2008-03-06 07:19:20 +0000610# Output the config header
611AC_CONFIG_HEADERS(src/config.h)
612
613#########
drh71eb93e2001-09-28 01:34:43 +0000614# Generate the output files.
615#
a.rottmannc7e93832003-03-24 09:39:32 +0000616AC_OUTPUT([
617Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000618sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000619])