blob: 6a6aa2eb2d45d897ba7c55df216f2b961a4b6903 [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
mlcreech57ee0522008-04-14 22:57:55 +000095# $Revision: 1.44 $
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
mlcreechab1c47b2008-03-09 02:51:10 +0000118#########
mlcreechf3868112008-03-11 18:03:30 +0000119# By default, we use the amalgamation (this may be changed below...)
120#
121USE_AMALGAMATION=1
122
123#########
mlcreechab1c47b2008-03-09 02:51:10 +0000124# See whether we can run specific tclsh versions known to work well;
125# if not, then we fall back to plain tclsh.
126# TODO: try other versions before falling back?
127#
mlcreechf3868112008-03-11 18:03:30 +0000128AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.4 tclsh], none)
129if test "$TCLSH_CMD" = "none"; then
130 # If we can't find a local tclsh, then building the amalgamation will fail.
131 # We act as though --disable-amalgamation has been used.
132 echo "Warning: can't find tclsh - defaulting to non-amalgamation build."
133 USE_AMALGAMATION=0
134 TCLSH_CMD="tclsh"
135fi
mlcreechab1c47b2008-03-09 02:51:10 +0000136AC_SUBST(TCLSH_CMD)
137
mlcreechb87057f2008-03-06 07:19:20 +0000138
139#########
drh71eb93e2001-09-28 01:34:43 +0000140# Set up an appropriate program prefix
141#
142if test "$program_prefix" = "NONE"; then
143 program_prefix=""
144fi
145AC_SUBST(program_prefix)
146
drh4b2266a2004-11-27 15:52:16 +0000147VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
148echo "Version set to $VERSION"
a.rottmannc7e93832003-03-24 09:39:32 +0000149AC_SUBST(VERSION)
drh4b2266a2004-11-27 15:52:16 +0000150RELEASE=`cat $srcdir/VERSION`
151echo "Release set to $RELEASE"
152AC_SUBST(RELEASE)
drh26d0e2a2005-07-06 13:51:27 +0000153VERSION_NUMBER=[`cat $srcdir/VERSION \
drhb7977832005-02-16 03:45:51 +0000154 | sed 's/[^0-9]/ /g' \
drh26d0e2a2005-07-06 13:51:27 +0000155 | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
drhb7977832005-02-16 03:45:51 +0000156echo "Version number set to $VERSION_NUMBER"
157AC_SUBST(VERSION_NUMBER)
a.rottmannc7e93832003-03-24 09:39:32 +0000158
drh71eb93e2001-09-28 01:34:43 +0000159#########
160# Check to see if the --with-hints=FILE option is used. If there is none,
161# then check for a files named "$host.hints" and ../$hosts.hints where
162# $host is the hostname of the build system. If still no hints are
163# found, try looking in $system.hints and ../$system.hints where
164# $system is the result of uname -s.
165#
166AC_ARG_WITH(hints,
drh94e4f822006-02-15 02:00:25 +0000167 AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
drh71eb93e2001-09-28 01:34:43 +0000168 hints=$withval)
169if test "$hints" = ""; then
170 host=`hostname | sed 's/\..*//'`
171 if test -r $host.hints; then
172 hints=$host.hints
173 else
174 if test -r ../$host.hints; then
175 hints=../$host.hints
176 fi
177 fi
178fi
179if test "$hints" = ""; then
180 sys=`uname -s`
181 if test -r $sys.hints; then
182 hints=$sys.hints
183 else
184 if test -r ../$sys.hints; then
185 hints=../$sys.hints
186 fi
187 fi
188fi
189if test "$hints" != ""; then
190 AC_MSG_RESULT(reading hints from $hints)
191 . $hints
192fi
193
194#########
195# Locate a compiler for the build machine. This compiler should
196# generate command-line programs that run on the build machine.
197#
vapierc8a15302007-02-17 14:31:55 +0000198if test x"$cross_compiling" = xno; then
199 BUILD_CC=$CC
200 BUILD_CFLAGS=$CFLAGS
drh71eb93e2001-09-28 01:34:43 +0000201else
vapierc8a15302007-02-17 14:31:55 +0000202 if test "${BUILD_CC+set}" != set; then
203 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
204 fi
205 if test "${BUILD_CFLAGS+set}" != set; then
206 BUILD_CFLAGS="-g"
207 fi
drh71eb93e2001-09-28 01:34:43 +0000208fi
209AC_SUBST(BUILD_CC)
drh71eb93e2001-09-28 01:34:43 +0000210
211##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000212# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000213#
dougcurrie0f290bf2004-06-21 18:57:29 +0000214AC_ARG_ENABLE(threadsafe,
drh5a3032b2007-09-03 16:12:09 +0000215AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
dougcurrie0f290bf2004-06-21 18:57:29 +0000216AC_MSG_CHECKING([whether to support threadsafe operation])
217if test "$enable_threadsafe" = "no"; then
drh5a3032b2007-09-03 16:12:09 +0000218 SQLITE_THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000219 AC_MSG_RESULT([no])
220else
drh5a3032b2007-09-03 16:12:09 +0000221 SQLITE_THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000222 AC_MSG_RESULT([yes])
223fi
drh5a3032b2007-09-03 16:12:09 +0000224AC_SUBST(SQLITE_THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000225
drh5a3032b2007-09-03 16:12:09 +0000226if test "$SQLITE_THREADSAFE" = "1"; then
mlcreechc658b0f2008-03-09 02:20:11 +0000227 AC_SEARCH_LIBS(pthread_create, pthread)
dougcurrie65623c72004-09-20 14:57:23 +0000228fi
dougcurrie65623c72004-09-20 14:57:23 +0000229
paulb0208cc2003-04-13 18:26:49 +0000230##########
drh91636d52005-11-24 23:14:00 +0000231# Do we want to allow a connection created in one thread to be used
232# in another thread. This does not work on many Linux systems (ex: RedHat 9)
233# due to bugs in the threading implementations. This is thus off by default.
234#
235AC_ARG_ENABLE(cross-thread-connections,
drh94e4f822006-02-15 02:00:25 +0000236AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
drh91636d52005-11-24 23:14:00 +0000237AC_MSG_CHECKING([whether to allow connections to be shared across threads])
238if test "$enable_xthreadconnect" = "no"; then
239 XTHREADCONNECT=''
240 AC_MSG_RESULT([no])
241else
242 XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
243 AC_MSG_RESULT([yes])
244fi
245AC_SUBST(XTHREADCONNECT)
246
247##########
drh8e2e2a12006-02-01 01:55:17 +0000248# Do we want to set threadsOverrideEachOthersLocks variable to be 1 (true) by
249# default. Normally, a test at runtime is performed to determine the
250# appropriate value of this variable. Use this option only if you're sure that
251# threads can safely override each others locks in all runtime situations.
252#
253AC_ARG_ENABLE(threads-override-locks,
drh94e4f822006-02-15 02:00:25 +0000254AC_HELP_STRING([--enable-threads-override-locks],[Threads can override each others locks]),,enable_threads_override_locks=no)
drh8e2e2a12006-02-01 01:55:17 +0000255AC_MSG_CHECKING([whether threads can override each others locks])
256if test "$enable_threads_override_locks" = "no"; then
257 THREADSOVERRIDELOCKS='-1'
258 AC_MSG_RESULT([no])
259else
260 THREADSOVERRIDELOCKS='1'
261 AC_MSG_RESULT([yes])
262fi
263AC_SUBST(THREADSOVERRIDELOCKS)
264
265##########
xdong3b5543c2003-09-23 00:36:50 +0000266# Do we want to support release
267#
268AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000269AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000270AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
271if test "$enable_releasemode" = "no"; then
272 ALLOWRELEASE=""
273 AC_MSG_RESULT([no])
274else
drh0b47d342007-11-27 14:50:06 +0000275 ALLOWRELEASE="-release `cat $srcdir/VERSION`"
xdong3b5543c2003-09-23 00:36:50 +0000276 AC_MSG_RESULT([yes])
277fi
278AC_SUBST(ALLOWRELEASE)
279
280##########
paulb0208cc2003-04-13 18:26:49 +0000281# Do we want temporary databases in memory
282#
dougcurrie0f290bf2004-06-21 18:57:29 +0000283AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000284AC_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 +0000285AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000286case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000287 never )
paul2dc96f92003-04-20 11:46:34 +0000288 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000289 AC_MSG_RESULT([never])
290 ;;
291 no )
paul2dc96f92003-04-20 11:46:34 +0000292 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000293 AC_MSG_RESULT([no])
294 ;;
295 always )
dougcurrie0f290bf2004-06-21 18:57:29 +0000296 TEMP_STORE=3
paulb0208cc2003-04-13 18:26:49 +0000297 AC_MSG_RESULT([always])
298 ;;
drh54414bb2005-10-10 00:05:50 +0000299 yes )
300 TEMP_STORE=3
301 AC_MSG_RESULT([always])
302 ;;
paulb0208cc2003-04-13 18:26:49 +0000303 * )
drh54414bb2005-10-10 00:05:50 +0000304 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000305 AC_MSG_RESULT([yes])
306 ;;
307esac
paul2dc96f92003-04-20 11:46:34 +0000308
paul2dc96f92003-04-20 11:46:34 +0000309AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000310
drh71eb93e2001-09-28 01:34:43 +0000311###########
312# Lots of things are different if we are compiling for Windows using
313# the CYGWIN environment. So check for that special case and handle
314# things accordingly.
315#
316AC_MSG_CHECKING([if executables have the .exe suffix])
317if test "$config_BUILD_EXEEXT" = ".exe"; then
318 CYGWIN=yes
319 AC_MSG_RESULT(yes)
320else
321 AC_MSG_RESULT(unknown)
322fi
323if test "$CYGWIN" != "yes"; then
324 AC_CYGWIN
325fi
326if test "$CYGWIN" = "yes"; then
327 BUILD_EXEEXT=.exe
328else
dougcurrie6194a5f2003-12-19 20:09:51 +0000329 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000330fi
vapierc8a15302007-02-17 14:31:55 +0000331if test x"$cross_compiling" = xno; then
drh71eb93e2001-09-28 01:34:43 +0000332 TARGET_EXEEXT=$BUILD_EXEEXT
333else
334 TARGET_EXEEXT=$config_TARGET_EXEEXT
335fi
336if test "$TARGET_EXEEXT" = ".exe"; then
drh60a1e4b2006-06-03 18:02:15 +0000337 if test $OS2_SHELL ; then
338 OS_UNIX=0
339 OS_WIN=0
340 OS_OS2=1
mlcreech8390bc32008-03-06 08:54:38 +0000341 CFLAGS="$CFLAGS -DOS_OS2=1"
mlcreech57ee0522008-04-14 22:57:55 +0000342 if test "$ac_compiler_gnu" = "yes" ; then
mlcreech8390bc32008-03-06 08:54:38 +0000343 CFLAGS="$CFLAGS -Zomf -Zexe -Zmap"
drh60a1e4b2006-06-03 18:02:15 +0000344 BUILD_CFLAGS="$BUILD_CFLAGS -Zomf -Zexe"
345 fi
346 else
347 OS_UNIX=0
348 OS_WIN=1
349 OS_OS2=0
350 tclsubdir=win
mlcreech8390bc32008-03-06 08:54:38 +0000351 CFLAGS="$CFLAGS -DOS_WIN=1"
drh60a1e4b2006-06-03 18:02:15 +0000352 fi
drh71eb93e2001-09-28 01:34:43 +0000353else
354 OS_UNIX=1
355 OS_WIN=0
drh60a1e4b2006-06-03 18:02:15 +0000356 OS_OS2=0
drh71eb93e2001-09-28 01:34:43 +0000357 tclsubdir=unix
mlcreech8390bc32008-03-06 08:54:38 +0000358 CFLAGS="$CFLAGS -DOS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000359fi
drh71eb93e2001-09-28 01:34:43 +0000360
361AC_SUBST(BUILD_EXEEXT)
362AC_SUBST(OS_UNIX)
363AC_SUBST(OS_WIN)
drh60a1e4b2006-06-03 18:02:15 +0000364AC_SUBST(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
drh7b5717e2004-11-25 13:50:01 +0000389 # then check for a private Tcl installation
390 if test x"${ac_cv_c_tclconfig}" = x ; then
391 for i in \
392 ../tcl \
393 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
394 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
395 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
396 ../../tcl \
397 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
398 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
399 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
400 ../../../tcl \
401 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
402 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
403 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
404 do
405 if test -f "$i/unix/tclConfig.sh" ; then
406 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
407 break
408 fi
409 done
410 fi
411
412 # check in a few common install locations
413 if test x"${ac_cv_c_tclconfig}" = x ; then
414 for i in \
415 `ls -d ${libdir} 2>/dev/null` \
416 `ls -d /usr/local/lib 2>/dev/null` \
417 `ls -d /usr/contrib/lib 2>/dev/null` \
418 `ls -d /usr/lib 2>/dev/null`
419 do
420 if test -f "$i/tclConfig.sh" ; then
421 ac_cv_c_tclconfig=`(cd $i; pwd)`
422 break
423 fi
424 done
425 fi
426
427 # check in a few other private locations
428 if test x"${ac_cv_c_tclconfig}" = x ; then
429 for i in \
430 ${srcdir}/../tcl \
431 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
432 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
433 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
434 do
435 if test -f "$i/unix/tclConfig.sh" ; then
436 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
437 break
438 fi
439 done
440 fi
441 ])
442
443 if test x"${ac_cv_c_tclconfig}" = x ; then
444 use_tcl=no
445 AC_MSG_WARN(Can't find Tcl configuration definitions)
446 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
447 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
448 else
449 TCL_BIN_DIR=${ac_cv_c_tclconfig}
450 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
451
452 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
453 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
454 AC_MSG_RESULT([loading])
455 . $TCL_BIN_DIR/tclConfig.sh
456 else
457 AC_MSG_RESULT([file not found])
458 fi
459
460 #
461 # If the TCL_BIN_DIR is the build directory (not the install directory),
462 # then set the common variable name to the value of the build variables.
463 # For example, the variable TCL_LIB_SPEC will be set to the value
464 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
465 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
466 # installed and uninstalled version of Tcl.
467 #
468
mlcreechab1c47b2008-03-09 02:51:10 +0000469 if test -f $TCL_BIN_DIR/Makefile ; then
drh7b5717e2004-11-25 13:50:01 +0000470 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
471 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
472 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
473 fi
474
475 #
476 # eval is required to do the TCL_DBGX substitution
477 #
478
479 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
480 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
481 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
482
483 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
484 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
485 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
486
487 AC_SUBST(TCL_VERSION)
488 AC_SUBST(TCL_BIN_DIR)
489 AC_SUBST(TCL_SRC_DIR)
490 AC_SUBST(TCL_LIBS)
491 AC_SUBST(TCL_INCLUDE_SPEC)
492
493 AC_SUBST(TCL_LIB_FILE)
494 AC_SUBST(TCL_LIB_FLAG)
495 AC_SUBST(TCL_LIB_SPEC)
496
497 AC_SUBST(TCL_STUB_LIB_FILE)
498 AC_SUBST(TCL_STUB_LIB_FLAG)
499 AC_SUBST(TCL_STUB_LIB_SPEC)
500 fi
drh71eb93e2001-09-28 01:34:43 +0000501fi
drh7b5717e2004-11-25 13:50:01 +0000502if test "${use_tcl}" = "no" ; then
503 HAVE_TCL=""
504else
505 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000506fi
drh7b5717e2004-11-25 13:50:01 +0000507AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000508
509##########
510# Figure out what C libraries are required to compile programs
511# that use "readline()" library.
512#
vapier4c10a8a2007-02-17 14:28:26 +0000513TARGET_READLINE_LIBS=""
514TARGET_READLINE_INC=""
515TARGET_HAVE_READLINE=0
516AC_ARG_ENABLE([readline],
517 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
518 [with_readline=$enableval],
519 [with_readline=auto])
520
521if test x"$with_readline" != xno; then
522 found="yes"
523
524 AC_ARG_WITH([readline-lib],
525 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
526 [with_readline_lib=$withval],
527 [with_readline_lib="auto"])
528 if test "x$with_readline_lib" = xauto; then
529 save_LIBS="$LIBS"
530 LIBS=""
531 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
532 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
533 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
534 LIBS="$save_LIBS"
535 else
536 TARGET_READLINE_LIBS="$with_readline_lib"
537 fi
538
539 AC_ARG_WITH([readline-inc],
540 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
541 [with_readline_inc=$withval],
542 [with_readline_inc="auto"])
543 if test "x$with_readline_inc" = xauto; then
544 AC_CHECK_HEADER(readline.h, [found="yes"], [
545 found="no"
546 if test "$cross_compiling" != yes; then
547 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
548 for subdir in include include/readline; do
549 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
550 if test "$found" = "yes"; then
551 TARGET_READLINE_INC="-I$dir/$subdir"
552 break
553 fi
554 done
555 test "$found" = "yes" && break
556 done
557 fi
558 ])
559 else
560 TARGET_READLINE_INC="$with_readline_inc"
561 fi
562
563 if test x"$found" = xno; then
564 TARGET_READLINE_LIBS=""
565 TARGET_READLINE_INC=""
566 TARGET_HAVE_READLINE=0
567 else
568 TARGET_HAVE_READLINE=1
569 fi
drh71eb93e2001-09-28 01:34:43 +0000570fi
vapier4c10a8a2007-02-17 14:28:26 +0000571
drh71eb93e2001-09-28 01:34:43 +0000572AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000573AC_SUBST(TARGET_READLINE_INC)
574AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000575
576##########
drhf1878b42006-01-23 18:06:52 +0000577# Figure out what C libraries are required to compile programs
578# that use "fdatasync()" function.
579#
drhf1878b42006-01-23 18:06:52 +0000580AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000581
drh71eb93e2001-09-28 01:34:43 +0000582#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000583# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000584AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000585 [use_debug=$enableval],[use_debug=no])
586if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000587 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000588else
589 TARGET_DEBUG="-DNDEBUG"
590fi
591AC_SUBST(TARGET_DEBUG)
592
593#########
mlcreech94984912008-03-04 19:03:08 +0000594# See whether we should use the amalgamation to build
595AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
mlcreech969b2cd2008-03-14 04:11:03 +0000596 [Disable the amalgamation and instead build all files separately]),
mlcreech94984912008-03-04 19:03:08 +0000597 [use_amalgamation=$enableval],[use_amalgamation=yes])
mlcreechf3868112008-03-11 18:03:30 +0000598if test "${use_amalgamation}" != "yes" ; then
mlcreech94984912008-03-04 19:03:08 +0000599 USE_AMALGAMATION=0
600fi
601AC_SUBST(USE_AMALGAMATION)
602
603#########
mlcreecha4edab02008-03-06 04:14:17 +0000604# See whether we should allow loadable extensions
605AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
606 [Enable loading of external extensions]),
607 [use_loadextension=$enableval],[use_loadextension=no])
608if test "${use_loadextension}" = "yes" ; then
609 LOADEXTENSION_FLAGS=""
610else
611 LOADEXTENSION_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
612fi
613AC_SUBST(LOADEXTENSION_FLAGS)
614
mlcreechaac7b932008-04-01 02:45:22 +0000615#########
616# See whether we should allow loadable extensions
617AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
618 [Enable coverage testing using gcov]),
619 [use_gcov=$enableval],[use_gcov=no])
620if test "${use_gcov}" = "yes" ; then
621 USE_GCOV=1
622else
623 USE_GCOV=0
624fi
625AC_SUBST(USE_GCOV)
626
drhaf6edf52005-10-04 18:38:49 +0000627
drh71eb93e2001-09-28 01:34:43 +0000628#########
mlcreechb87057f2008-03-06 07:19:20 +0000629# Output the config header
mlcreech23797062008-03-20 02:25:35 +0000630AC_CONFIG_HEADERS(config.h)
mlcreechb87057f2008-03-06 07:19:20 +0000631
632#########
drh71eb93e2001-09-28 01:34:43 +0000633# Generate the output files.
634#
mlcreech8390bc32008-03-06 08:54:38 +0000635AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000636AC_OUTPUT([
637Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000638sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000639])