blob: 839b63eb2defd979f8b87be98b673efbb3505188 [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
mlcreechc658b0f2008-03-09 02:20:11 +000095# $Revision: 1.38 $
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
mlcreech5b0a9eb2008-03-09 01:38:09 +0000111AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h])
112
113#########
114# Figure out whether or not we have these functions
115#
116AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r])
117
mlcreechb87057f2008-03-06 07:19:20 +0000118
119#########
drh71eb93e2001-09-28 01:34:43 +0000120# Set up an appropriate program prefix
121#
122if test "$program_prefix" = "NONE"; then
123 program_prefix=""
124fi
125AC_SUBST(program_prefix)
126
drh4b2266a2004-11-27 15:52:16 +0000127VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
128echo "Version set to $VERSION"
a.rottmannc7e93832003-03-24 09:39:32 +0000129AC_SUBST(VERSION)
drh4b2266a2004-11-27 15:52:16 +0000130RELEASE=`cat $srcdir/VERSION`
131echo "Release set to $RELEASE"
132AC_SUBST(RELEASE)
drh26d0e2a2005-07-06 13:51:27 +0000133VERSION_NUMBER=[`cat $srcdir/VERSION \
drhb7977832005-02-16 03:45:51 +0000134 | sed 's/[^0-9]/ /g' \
drh26d0e2a2005-07-06 13:51:27 +0000135 | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
drhb7977832005-02-16 03:45:51 +0000136echo "Version number set to $VERSION_NUMBER"
137AC_SUBST(VERSION_NUMBER)
a.rottmannc7e93832003-03-24 09:39:32 +0000138
drh71eb93e2001-09-28 01:34:43 +0000139#########
140# Check to see if the --with-hints=FILE option is used. If there is none,
141# then check for a files named "$host.hints" and ../$hosts.hints where
142# $host is the hostname of the build system. If still no hints are
143# found, try looking in $system.hints and ../$system.hints where
144# $system is the result of uname -s.
145#
146AC_ARG_WITH(hints,
drh94e4f822006-02-15 02:00:25 +0000147 AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
drh71eb93e2001-09-28 01:34:43 +0000148 hints=$withval)
149if test "$hints" = ""; then
150 host=`hostname | sed 's/\..*//'`
151 if test -r $host.hints; then
152 hints=$host.hints
153 else
154 if test -r ../$host.hints; then
155 hints=../$host.hints
156 fi
157 fi
158fi
159if test "$hints" = ""; then
160 sys=`uname -s`
161 if test -r $sys.hints; then
162 hints=$sys.hints
163 else
164 if test -r ../$sys.hints; then
165 hints=../$sys.hints
166 fi
167 fi
168fi
169if test "$hints" != ""; then
170 AC_MSG_RESULT(reading hints from $hints)
171 . $hints
172fi
173
174#########
175# Locate a compiler for the build machine. This compiler should
176# generate command-line programs that run on the build machine.
177#
vapierc8a15302007-02-17 14:31:55 +0000178if test x"$cross_compiling" = xno; then
179 BUILD_CC=$CC
180 BUILD_CFLAGS=$CFLAGS
drh71eb93e2001-09-28 01:34:43 +0000181else
vapierc8a15302007-02-17 14:31:55 +0000182 if test "${BUILD_CC+set}" != set; then
183 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
184 fi
185 if test "${BUILD_CFLAGS+set}" != set; then
186 BUILD_CFLAGS="-g"
187 fi
drh71eb93e2001-09-28 01:34:43 +0000188fi
189AC_SUBST(BUILD_CC)
drh71eb93e2001-09-28 01:34:43 +0000190
191##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000192# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000193#
dougcurrie0f290bf2004-06-21 18:57:29 +0000194AC_ARG_ENABLE(threadsafe,
drh5a3032b2007-09-03 16:12:09 +0000195AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
dougcurrie0f290bf2004-06-21 18:57:29 +0000196AC_MSG_CHECKING([whether to support threadsafe operation])
197if test "$enable_threadsafe" = "no"; then
drh5a3032b2007-09-03 16:12:09 +0000198 SQLITE_THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000199 AC_MSG_RESULT([no])
200else
drh5a3032b2007-09-03 16:12:09 +0000201 SQLITE_THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000202 AC_MSG_RESULT([yes])
203fi
drh5a3032b2007-09-03 16:12:09 +0000204AC_SUBST(SQLITE_THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000205
drh5a3032b2007-09-03 16:12:09 +0000206if test "$SQLITE_THREADSAFE" = "1"; then
mlcreechc658b0f2008-03-09 02:20:11 +0000207 AC_SEARCH_LIBS(pthread_create, pthread)
dougcurrie65623c72004-09-20 14:57:23 +0000208fi
dougcurrie65623c72004-09-20 14:57:23 +0000209
paulb0208cc2003-04-13 18:26:49 +0000210##########
drh91636d52005-11-24 23:14:00 +0000211# Do we want to allow a connection created in one thread to be used
212# in another thread. This does not work on many Linux systems (ex: RedHat 9)
213# due to bugs in the threading implementations. This is thus off by default.
214#
215AC_ARG_ENABLE(cross-thread-connections,
drh94e4f822006-02-15 02:00:25 +0000216AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
drh91636d52005-11-24 23:14:00 +0000217AC_MSG_CHECKING([whether to allow connections to be shared across threads])
218if test "$enable_xthreadconnect" = "no"; then
219 XTHREADCONNECT=''
220 AC_MSG_RESULT([no])
221else
222 XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
223 AC_MSG_RESULT([yes])
224fi
225AC_SUBST(XTHREADCONNECT)
226
227##########
drh8e2e2a12006-02-01 01:55:17 +0000228# Do we want to set threadsOverrideEachOthersLocks variable to be 1 (true) by
229# default. Normally, a test at runtime is performed to determine the
230# appropriate value of this variable. Use this option only if you're sure that
231# threads can safely override each others locks in all runtime situations.
232#
233AC_ARG_ENABLE(threads-override-locks,
drh94e4f822006-02-15 02:00:25 +0000234AC_HELP_STRING([--enable-threads-override-locks],[Threads can override each others locks]),,enable_threads_override_locks=no)
drh8e2e2a12006-02-01 01:55:17 +0000235AC_MSG_CHECKING([whether threads can override each others locks])
236if test "$enable_threads_override_locks" = "no"; then
237 THREADSOVERRIDELOCKS='-1'
238 AC_MSG_RESULT([no])
239else
240 THREADSOVERRIDELOCKS='1'
241 AC_MSG_RESULT([yes])
242fi
243AC_SUBST(THREADSOVERRIDELOCKS)
244
245##########
xdong3b5543c2003-09-23 00:36:50 +0000246# Do we want to support release
247#
248AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000249AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000250AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
251if test "$enable_releasemode" = "no"; then
252 ALLOWRELEASE=""
253 AC_MSG_RESULT([no])
254else
drh0b47d342007-11-27 14:50:06 +0000255 ALLOWRELEASE="-release `cat $srcdir/VERSION`"
xdong3b5543c2003-09-23 00:36:50 +0000256 AC_MSG_RESULT([yes])
257fi
258AC_SUBST(ALLOWRELEASE)
259
260##########
paulb0208cc2003-04-13 18:26:49 +0000261# Do we want temporary databases in memory
262#
dougcurrie0f290bf2004-06-21 18:57:29 +0000263AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000264AC_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 +0000265AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000266case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000267 never )
paul2dc96f92003-04-20 11:46:34 +0000268 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000269 AC_MSG_RESULT([never])
270 ;;
271 no )
paul2dc96f92003-04-20 11:46:34 +0000272 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000273 AC_MSG_RESULT([no])
274 ;;
275 always )
dougcurrie0f290bf2004-06-21 18:57:29 +0000276 TEMP_STORE=3
paulb0208cc2003-04-13 18:26:49 +0000277 AC_MSG_RESULT([always])
278 ;;
drh54414bb2005-10-10 00:05:50 +0000279 yes )
280 TEMP_STORE=3
281 AC_MSG_RESULT([always])
282 ;;
paulb0208cc2003-04-13 18:26:49 +0000283 * )
drh54414bb2005-10-10 00:05:50 +0000284 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000285 AC_MSG_RESULT([yes])
286 ;;
287esac
paul2dc96f92003-04-20 11:46:34 +0000288
paul2dc96f92003-04-20 11:46:34 +0000289AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000290
drh71eb93e2001-09-28 01:34:43 +0000291###########
292# Lots of things are different if we are compiling for Windows using
293# the CYGWIN environment. So check for that special case and handle
294# things accordingly.
295#
296AC_MSG_CHECKING([if executables have the .exe suffix])
297if test "$config_BUILD_EXEEXT" = ".exe"; then
298 CYGWIN=yes
299 AC_MSG_RESULT(yes)
300else
301 AC_MSG_RESULT(unknown)
302fi
303if test "$CYGWIN" != "yes"; then
304 AC_CYGWIN
305fi
306if test "$CYGWIN" = "yes"; then
307 BUILD_EXEEXT=.exe
308else
dougcurrie6194a5f2003-12-19 20:09:51 +0000309 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000310fi
vapierc8a15302007-02-17 14:31:55 +0000311if test x"$cross_compiling" = xno; then
drh71eb93e2001-09-28 01:34:43 +0000312 TARGET_EXEEXT=$BUILD_EXEEXT
313else
314 TARGET_EXEEXT=$config_TARGET_EXEEXT
315fi
316if test "$TARGET_EXEEXT" = ".exe"; then
drh60a1e4b2006-06-03 18:02:15 +0000317 if test $OS2_SHELL ; then
318 OS_UNIX=0
319 OS_WIN=0
320 OS_OS2=1
mlcreech8390bc32008-03-06 08:54:38 +0000321 CFLAGS="$CFLAGS -DOS_OS2=1"
drh60a1e4b2006-06-03 18:02:15 +0000322 if test "$ac_compiler_gnu" == "yes" ; then
mlcreech8390bc32008-03-06 08:54:38 +0000323 CFLAGS="$CFLAGS -Zomf -Zexe -Zmap"
drh60a1e4b2006-06-03 18:02:15 +0000324 BUILD_CFLAGS="$BUILD_CFLAGS -Zomf -Zexe"
325 fi
326 else
327 OS_UNIX=0
328 OS_WIN=1
329 OS_OS2=0
330 tclsubdir=win
mlcreech8390bc32008-03-06 08:54:38 +0000331 CFLAGS="$CFLAGS -DOS_WIN=1"
drh60a1e4b2006-06-03 18:02:15 +0000332 fi
drh71eb93e2001-09-28 01:34:43 +0000333else
334 OS_UNIX=1
335 OS_WIN=0
drh60a1e4b2006-06-03 18:02:15 +0000336 OS_OS2=0
drh71eb93e2001-09-28 01:34:43 +0000337 tclsubdir=unix
mlcreech8390bc32008-03-06 08:54:38 +0000338 CFLAGS="$CFLAGS -DOS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000339fi
drh71eb93e2001-09-28 01:34:43 +0000340
341AC_SUBST(BUILD_EXEEXT)
342AC_SUBST(OS_UNIX)
343AC_SUBST(OS_WIN)
drh60a1e4b2006-06-03 18:02:15 +0000344AC_SUBST(OS_OS2)
drh71eb93e2001-09-28 01:34:43 +0000345AC_SUBST(TARGET_EXEEXT)
346
347##########
drh7b5717e2004-11-25 13:50:01 +0000348# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000349#
drh7b5717e2004-11-25 13:50:01 +0000350# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
351# macros in the in the tcl.m4 file of the standard TCL distribution.
352# Those macros could not be used directly since we have to make some
353# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000354#
drh94e4f822006-02-15 02:00:25 +0000355AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000356 [use_tcl=$enableval],[use_tcl=yes])
357if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000358 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 +0000359 AC_MSG_CHECKING([for Tcl configuration])
360 AC_CACHE_VAL(ac_cv_c_tclconfig,[
361 # First check to see if --with-tcl was specified.
362 if test x"${with_tclconfig}" != x ; then
363 if test -f "${with_tclconfig}/tclConfig.sh" ; then
364 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
365 else
366 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
367 fi
drh71eb93e2001-09-28 01:34:43 +0000368 fi
drh7b5717e2004-11-25 13:50:01 +0000369 # then check for a private Tcl installation
370 if test x"${ac_cv_c_tclconfig}" = x ; then
371 for i in \
372 ../tcl \
373 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
374 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
375 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
376 ../../tcl \
377 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
378 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
379 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
380 ../../../tcl \
381 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
382 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
383 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
384 do
385 if test -f "$i/unix/tclConfig.sh" ; then
386 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
387 break
388 fi
389 done
390 fi
391
392 # check in a few common install locations
393 if test x"${ac_cv_c_tclconfig}" = x ; then
394 for i in \
395 `ls -d ${libdir} 2>/dev/null` \
396 `ls -d /usr/local/lib 2>/dev/null` \
397 `ls -d /usr/contrib/lib 2>/dev/null` \
398 `ls -d /usr/lib 2>/dev/null`
399 do
400 if test -f "$i/tclConfig.sh" ; then
401 ac_cv_c_tclconfig=`(cd $i; pwd)`
402 break
403 fi
404 done
405 fi
406
407 # check in a few other private locations
408 if test x"${ac_cv_c_tclconfig}" = x ; then
409 for i in \
410 ${srcdir}/../tcl \
411 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
412 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
413 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
414 do
415 if test -f "$i/unix/tclConfig.sh" ; then
416 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
417 break
418 fi
419 done
420 fi
421 ])
422
423 if test x"${ac_cv_c_tclconfig}" = x ; then
424 use_tcl=no
425 AC_MSG_WARN(Can't find Tcl configuration definitions)
426 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
427 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
428 else
429 TCL_BIN_DIR=${ac_cv_c_tclconfig}
430 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
431
432 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
433 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
434 AC_MSG_RESULT([loading])
435 . $TCL_BIN_DIR/tclConfig.sh
436 else
437 AC_MSG_RESULT([file not found])
438 fi
439
440 #
441 # If the TCL_BIN_DIR is the build directory (not the install directory),
442 # then set the common variable name to the value of the build variables.
443 # For example, the variable TCL_LIB_SPEC will be set to the value
444 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
445 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
446 # installed and uninstalled version of Tcl.
447 #
448
449 if test -f $TCL_BIN_DIR/Makefile ; then
450 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
451 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
452 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
453 fi
454
455 #
456 # eval is required to do the TCL_DBGX substitution
457 #
458
459 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
460 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
461 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
462
463 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
464 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
465 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
466
467 AC_SUBST(TCL_VERSION)
468 AC_SUBST(TCL_BIN_DIR)
469 AC_SUBST(TCL_SRC_DIR)
470 AC_SUBST(TCL_LIBS)
471 AC_SUBST(TCL_INCLUDE_SPEC)
472
473 AC_SUBST(TCL_LIB_FILE)
474 AC_SUBST(TCL_LIB_FLAG)
475 AC_SUBST(TCL_LIB_SPEC)
476
477 AC_SUBST(TCL_STUB_LIB_FILE)
478 AC_SUBST(TCL_STUB_LIB_FLAG)
479 AC_SUBST(TCL_STUB_LIB_SPEC)
480 fi
drh71eb93e2001-09-28 01:34:43 +0000481fi
drh7b5717e2004-11-25 13:50:01 +0000482if test "${use_tcl}" = "no" ; then
483 HAVE_TCL=""
484else
485 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000486fi
drh7b5717e2004-11-25 13:50:01 +0000487AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000488
489##########
490# Figure out what C libraries are required to compile programs
491# that use "readline()" library.
492#
vapier4c10a8a2007-02-17 14:28:26 +0000493TARGET_READLINE_LIBS=""
494TARGET_READLINE_INC=""
495TARGET_HAVE_READLINE=0
496AC_ARG_ENABLE([readline],
497 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
498 [with_readline=$enableval],
499 [with_readline=auto])
500
501if test x"$with_readline" != xno; then
502 found="yes"
503
504 AC_ARG_WITH([readline-lib],
505 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
506 [with_readline_lib=$withval],
507 [with_readline_lib="auto"])
508 if test "x$with_readline_lib" = xauto; then
509 save_LIBS="$LIBS"
510 LIBS=""
511 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
512 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
513 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
514 LIBS="$save_LIBS"
515 else
516 TARGET_READLINE_LIBS="$with_readline_lib"
517 fi
518
519 AC_ARG_WITH([readline-inc],
520 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
521 [with_readline_inc=$withval],
522 [with_readline_inc="auto"])
523 if test "x$with_readline_inc" = xauto; then
524 AC_CHECK_HEADER(readline.h, [found="yes"], [
525 found="no"
526 if test "$cross_compiling" != yes; then
527 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
528 for subdir in include include/readline; do
529 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
530 if test "$found" = "yes"; then
531 TARGET_READLINE_INC="-I$dir/$subdir"
532 break
533 fi
534 done
535 test "$found" = "yes" && break
536 done
537 fi
538 ])
539 else
540 TARGET_READLINE_INC="$with_readline_inc"
541 fi
542
543 if test x"$found" = xno; then
544 TARGET_READLINE_LIBS=""
545 TARGET_READLINE_INC=""
546 TARGET_HAVE_READLINE=0
547 else
548 TARGET_HAVE_READLINE=1
549 fi
drh71eb93e2001-09-28 01:34:43 +0000550fi
vapier4c10a8a2007-02-17 14:28:26 +0000551
drh71eb93e2001-09-28 01:34:43 +0000552AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000553AC_SUBST(TARGET_READLINE_INC)
554AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000555
556##########
drhf1878b42006-01-23 18:06:52 +0000557# Figure out what C libraries are required to compile programs
558# that use "fdatasync()" function.
559#
drhf1878b42006-01-23 18:06:52 +0000560AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000561
drh71eb93e2001-09-28 01:34:43 +0000562#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000563# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000564AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000565 [use_debug=$enableval],[use_debug=no])
566if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000567 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000568else
569 TARGET_DEBUG="-DNDEBUG"
570fi
571AC_SUBST(TARGET_DEBUG)
572
573#########
mlcreech94984912008-03-04 19:03:08 +0000574# See whether we should use the amalgamation to build
575AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
576 [Disable the amalgamation and instead build all files separately (currently needed to build the test fixture)]),
577 [use_amalgamation=$enableval],[use_amalgamation=yes])
578if test "${use_amalgamation}" = "yes" ; then
579 USE_AMALGAMATION=1
580else
581 USE_AMALGAMATION=0
582fi
583AC_SUBST(USE_AMALGAMATION)
584
585#########
mlcreecha4edab02008-03-06 04:14:17 +0000586# See whether we should allow loadable extensions
587AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
588 [Enable loading of external extensions]),
589 [use_loadextension=$enableval],[use_loadextension=no])
590if test "${use_loadextension}" = "yes" ; then
591 LOADEXTENSION_FLAGS=""
592else
593 LOADEXTENSION_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
594fi
595AC_SUBST(LOADEXTENSION_FLAGS)
596
drhaf6edf52005-10-04 18:38:49 +0000597
drh71eb93e2001-09-28 01:34:43 +0000598#########
mlcreechb87057f2008-03-06 07:19:20 +0000599# Output the config header
600AC_CONFIG_HEADERS(src/config.h)
601
602#########
drh71eb93e2001-09-28 01:34:43 +0000603# Generate the output files.
604#
mlcreech8390bc32008-03-06 08:54:38 +0000605AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000606AC_OUTPUT([
607Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000608sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000609])