blob: d6abc1a817109f95f2cd9400959a4b40572b53c7 [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
mlcreechab1c47b2008-03-09 02:51:10 +000095# $Revision: 1.39 $
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#########
119# See whether we can run specific tclsh versions known to work well;
120# if not, then we fall back to plain tclsh.
121# TODO: try other versions before falling back?
122#
123AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.4 tclsh], tclsh)
124AC_SUBST(TCLSH_CMD)
125
mlcreechb87057f2008-03-06 07:19:20 +0000126
127#########
drh71eb93e2001-09-28 01:34:43 +0000128# Set up an appropriate program prefix
129#
130if test "$program_prefix" = "NONE"; then
131 program_prefix=""
132fi
133AC_SUBST(program_prefix)
134
drh4b2266a2004-11-27 15:52:16 +0000135VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
136echo "Version set to $VERSION"
a.rottmannc7e93832003-03-24 09:39:32 +0000137AC_SUBST(VERSION)
drh4b2266a2004-11-27 15:52:16 +0000138RELEASE=`cat $srcdir/VERSION`
139echo "Release set to $RELEASE"
140AC_SUBST(RELEASE)
drh26d0e2a2005-07-06 13:51:27 +0000141VERSION_NUMBER=[`cat $srcdir/VERSION \
drhb7977832005-02-16 03:45:51 +0000142 | sed 's/[^0-9]/ /g' \
drh26d0e2a2005-07-06 13:51:27 +0000143 | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
drhb7977832005-02-16 03:45:51 +0000144echo "Version number set to $VERSION_NUMBER"
145AC_SUBST(VERSION_NUMBER)
a.rottmannc7e93832003-03-24 09:39:32 +0000146
drh71eb93e2001-09-28 01:34:43 +0000147#########
148# Check to see if the --with-hints=FILE option is used. If there is none,
149# then check for a files named "$host.hints" and ../$hosts.hints where
150# $host is the hostname of the build system. If still no hints are
151# found, try looking in $system.hints and ../$system.hints where
152# $system is the result of uname -s.
153#
154AC_ARG_WITH(hints,
drh94e4f822006-02-15 02:00:25 +0000155 AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
drh71eb93e2001-09-28 01:34:43 +0000156 hints=$withval)
157if test "$hints" = ""; then
158 host=`hostname | sed 's/\..*//'`
159 if test -r $host.hints; then
160 hints=$host.hints
161 else
162 if test -r ../$host.hints; then
163 hints=../$host.hints
164 fi
165 fi
166fi
167if test "$hints" = ""; then
168 sys=`uname -s`
169 if test -r $sys.hints; then
170 hints=$sys.hints
171 else
172 if test -r ../$sys.hints; then
173 hints=../$sys.hints
174 fi
175 fi
176fi
177if test "$hints" != ""; then
178 AC_MSG_RESULT(reading hints from $hints)
179 . $hints
180fi
181
182#########
183# Locate a compiler for the build machine. This compiler should
184# generate command-line programs that run on the build machine.
185#
vapierc8a15302007-02-17 14:31:55 +0000186if test x"$cross_compiling" = xno; then
187 BUILD_CC=$CC
188 BUILD_CFLAGS=$CFLAGS
drh71eb93e2001-09-28 01:34:43 +0000189else
vapierc8a15302007-02-17 14:31:55 +0000190 if test "${BUILD_CC+set}" != set; then
191 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
192 fi
193 if test "${BUILD_CFLAGS+set}" != set; then
194 BUILD_CFLAGS="-g"
195 fi
drh71eb93e2001-09-28 01:34:43 +0000196fi
197AC_SUBST(BUILD_CC)
drh71eb93e2001-09-28 01:34:43 +0000198
199##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000200# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000201#
dougcurrie0f290bf2004-06-21 18:57:29 +0000202AC_ARG_ENABLE(threadsafe,
drh5a3032b2007-09-03 16:12:09 +0000203AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes)
dougcurrie0f290bf2004-06-21 18:57:29 +0000204AC_MSG_CHECKING([whether to support threadsafe operation])
205if test "$enable_threadsafe" = "no"; then
drh5a3032b2007-09-03 16:12:09 +0000206 SQLITE_THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000207 AC_MSG_RESULT([no])
208else
drh5a3032b2007-09-03 16:12:09 +0000209 SQLITE_THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000210 AC_MSG_RESULT([yes])
211fi
drh5a3032b2007-09-03 16:12:09 +0000212AC_SUBST(SQLITE_THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000213
drh5a3032b2007-09-03 16:12:09 +0000214if test "$SQLITE_THREADSAFE" = "1"; then
mlcreechc658b0f2008-03-09 02:20:11 +0000215 AC_SEARCH_LIBS(pthread_create, pthread)
dougcurrie65623c72004-09-20 14:57:23 +0000216fi
dougcurrie65623c72004-09-20 14:57:23 +0000217
paulb0208cc2003-04-13 18:26:49 +0000218##########
drh91636d52005-11-24 23:14:00 +0000219# Do we want to allow a connection created in one thread to be used
220# in another thread. This does not work on many Linux systems (ex: RedHat 9)
221# due to bugs in the threading implementations. This is thus off by default.
222#
223AC_ARG_ENABLE(cross-thread-connections,
drh94e4f822006-02-15 02:00:25 +0000224AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
drh91636d52005-11-24 23:14:00 +0000225AC_MSG_CHECKING([whether to allow connections to be shared across threads])
226if test "$enable_xthreadconnect" = "no"; then
227 XTHREADCONNECT=''
228 AC_MSG_RESULT([no])
229else
230 XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
231 AC_MSG_RESULT([yes])
232fi
233AC_SUBST(XTHREADCONNECT)
234
235##########
drh8e2e2a12006-02-01 01:55:17 +0000236# Do we want to set threadsOverrideEachOthersLocks variable to be 1 (true) by
237# default. Normally, a test at runtime is performed to determine the
238# appropriate value of this variable. Use this option only if you're sure that
239# threads can safely override each others locks in all runtime situations.
240#
241AC_ARG_ENABLE(threads-override-locks,
drh94e4f822006-02-15 02:00:25 +0000242AC_HELP_STRING([--enable-threads-override-locks],[Threads can override each others locks]),,enable_threads_override_locks=no)
drh8e2e2a12006-02-01 01:55:17 +0000243AC_MSG_CHECKING([whether threads can override each others locks])
244if test "$enable_threads_override_locks" = "no"; then
245 THREADSOVERRIDELOCKS='-1'
246 AC_MSG_RESULT([no])
247else
248 THREADSOVERRIDELOCKS='1'
249 AC_MSG_RESULT([yes])
250fi
251AC_SUBST(THREADSOVERRIDELOCKS)
252
253##########
xdong3b5543c2003-09-23 00:36:50 +0000254# Do we want to support release
255#
256AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000257AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000258AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
259if test "$enable_releasemode" = "no"; then
260 ALLOWRELEASE=""
261 AC_MSG_RESULT([no])
262else
drh0b47d342007-11-27 14:50:06 +0000263 ALLOWRELEASE="-release `cat $srcdir/VERSION`"
xdong3b5543c2003-09-23 00:36:50 +0000264 AC_MSG_RESULT([yes])
265fi
266AC_SUBST(ALLOWRELEASE)
267
268##########
paulb0208cc2003-04-13 18:26:49 +0000269# Do we want temporary databases in memory
270#
dougcurrie0f290bf2004-06-21 18:57:29 +0000271AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000272AC_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 +0000273AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000274case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000275 never )
paul2dc96f92003-04-20 11:46:34 +0000276 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000277 AC_MSG_RESULT([never])
278 ;;
279 no )
paul2dc96f92003-04-20 11:46:34 +0000280 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000281 AC_MSG_RESULT([no])
282 ;;
283 always )
dougcurrie0f290bf2004-06-21 18:57:29 +0000284 TEMP_STORE=3
paulb0208cc2003-04-13 18:26:49 +0000285 AC_MSG_RESULT([always])
286 ;;
drh54414bb2005-10-10 00:05:50 +0000287 yes )
288 TEMP_STORE=3
289 AC_MSG_RESULT([always])
290 ;;
paulb0208cc2003-04-13 18:26:49 +0000291 * )
drh54414bb2005-10-10 00:05:50 +0000292 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000293 AC_MSG_RESULT([yes])
294 ;;
295esac
paul2dc96f92003-04-20 11:46:34 +0000296
paul2dc96f92003-04-20 11:46:34 +0000297AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000298
drh71eb93e2001-09-28 01:34:43 +0000299###########
300# Lots of things are different if we are compiling for Windows using
301# the CYGWIN environment. So check for that special case and handle
302# things accordingly.
303#
304AC_MSG_CHECKING([if executables have the .exe suffix])
305if test "$config_BUILD_EXEEXT" = ".exe"; then
306 CYGWIN=yes
307 AC_MSG_RESULT(yes)
308else
309 AC_MSG_RESULT(unknown)
310fi
311if test "$CYGWIN" != "yes"; then
312 AC_CYGWIN
313fi
314if test "$CYGWIN" = "yes"; then
315 BUILD_EXEEXT=.exe
316else
dougcurrie6194a5f2003-12-19 20:09:51 +0000317 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000318fi
vapierc8a15302007-02-17 14:31:55 +0000319if test x"$cross_compiling" = xno; then
drh71eb93e2001-09-28 01:34:43 +0000320 TARGET_EXEEXT=$BUILD_EXEEXT
321else
322 TARGET_EXEEXT=$config_TARGET_EXEEXT
323fi
324if test "$TARGET_EXEEXT" = ".exe"; then
drh60a1e4b2006-06-03 18:02:15 +0000325 if test $OS2_SHELL ; then
326 OS_UNIX=0
327 OS_WIN=0
328 OS_OS2=1
mlcreech8390bc32008-03-06 08:54:38 +0000329 CFLAGS="$CFLAGS -DOS_OS2=1"
drh60a1e4b2006-06-03 18:02:15 +0000330 if test "$ac_compiler_gnu" == "yes" ; then
mlcreech8390bc32008-03-06 08:54:38 +0000331 CFLAGS="$CFLAGS -Zomf -Zexe -Zmap"
drh60a1e4b2006-06-03 18:02:15 +0000332 BUILD_CFLAGS="$BUILD_CFLAGS -Zomf -Zexe"
333 fi
334 else
335 OS_UNIX=0
336 OS_WIN=1
337 OS_OS2=0
338 tclsubdir=win
mlcreech8390bc32008-03-06 08:54:38 +0000339 CFLAGS="$CFLAGS -DOS_WIN=1"
drh60a1e4b2006-06-03 18:02:15 +0000340 fi
drh71eb93e2001-09-28 01:34:43 +0000341else
342 OS_UNIX=1
343 OS_WIN=0
drh60a1e4b2006-06-03 18:02:15 +0000344 OS_OS2=0
drh71eb93e2001-09-28 01:34:43 +0000345 tclsubdir=unix
mlcreech8390bc32008-03-06 08:54:38 +0000346 CFLAGS="$CFLAGS -DOS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000347fi
drh71eb93e2001-09-28 01:34:43 +0000348
349AC_SUBST(BUILD_EXEEXT)
350AC_SUBST(OS_UNIX)
351AC_SUBST(OS_WIN)
drh60a1e4b2006-06-03 18:02:15 +0000352AC_SUBST(OS_OS2)
drh71eb93e2001-09-28 01:34:43 +0000353AC_SUBST(TARGET_EXEEXT)
354
355##########
drh7b5717e2004-11-25 13:50:01 +0000356# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000357#
drh7b5717e2004-11-25 13:50:01 +0000358# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
359# macros in the in the tcl.m4 file of the standard TCL distribution.
360# Those macros could not be used directly since we have to make some
361# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000362#
drh94e4f822006-02-15 02:00:25 +0000363AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000364 [use_tcl=$enableval],[use_tcl=yes])
365if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000366 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 +0000367 AC_MSG_CHECKING([for Tcl configuration])
368 AC_CACHE_VAL(ac_cv_c_tclconfig,[
369 # First check to see if --with-tcl was specified.
370 if test x"${with_tclconfig}" != x ; then
371 if test -f "${with_tclconfig}/tclConfig.sh" ; then
372 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
373 else
374 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
375 fi
drh71eb93e2001-09-28 01:34:43 +0000376 fi
drh7b5717e2004-11-25 13:50:01 +0000377 # then check for a private Tcl installation
378 if test x"${ac_cv_c_tclconfig}" = x ; then
379 for i in \
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 ../../tcl \
385 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
386 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
387 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
388 ../../../tcl \
389 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
390 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
391 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
392 do
393 if test -f "$i/unix/tclConfig.sh" ; then
394 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
395 break
396 fi
397 done
398 fi
399
400 # check in a few common install locations
401 if test x"${ac_cv_c_tclconfig}" = x ; then
402 for i in \
403 `ls -d ${libdir} 2>/dev/null` \
404 `ls -d /usr/local/lib 2>/dev/null` \
405 `ls -d /usr/contrib/lib 2>/dev/null` \
406 `ls -d /usr/lib 2>/dev/null`
407 do
408 if test -f "$i/tclConfig.sh" ; then
409 ac_cv_c_tclconfig=`(cd $i; pwd)`
410 break
411 fi
412 done
413 fi
414
415 # check in a few other private locations
416 if test x"${ac_cv_c_tclconfig}" = x ; then
417 for i in \
418 ${srcdir}/../tcl \
419 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
420 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
421 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
422 do
423 if test -f "$i/unix/tclConfig.sh" ; then
424 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
425 break
426 fi
427 done
428 fi
429 ])
430
431 if test x"${ac_cv_c_tclconfig}" = x ; then
432 use_tcl=no
433 AC_MSG_WARN(Can't find Tcl configuration definitions)
434 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
435 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
436 else
437 TCL_BIN_DIR=${ac_cv_c_tclconfig}
438 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
439
440 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
441 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
442 AC_MSG_RESULT([loading])
443 . $TCL_BIN_DIR/tclConfig.sh
444 else
445 AC_MSG_RESULT([file not found])
446 fi
447
448 #
449 # If the TCL_BIN_DIR is the build directory (not the install directory),
450 # then set the common variable name to the value of the build variables.
451 # For example, the variable TCL_LIB_SPEC will be set to the value
452 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
453 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
454 # installed and uninstalled version of Tcl.
455 #
456
mlcreechab1c47b2008-03-09 02:51:10 +0000457 if test -f $TCL_BIN_DIR/Makefile ; then
drh7b5717e2004-11-25 13:50:01 +0000458 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
459 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
460 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
461 fi
462
463 #
464 # eval is required to do the TCL_DBGX substitution
465 #
466
467 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
468 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
469 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
470
471 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
472 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
473 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
474
475 AC_SUBST(TCL_VERSION)
476 AC_SUBST(TCL_BIN_DIR)
477 AC_SUBST(TCL_SRC_DIR)
478 AC_SUBST(TCL_LIBS)
479 AC_SUBST(TCL_INCLUDE_SPEC)
480
481 AC_SUBST(TCL_LIB_FILE)
482 AC_SUBST(TCL_LIB_FLAG)
483 AC_SUBST(TCL_LIB_SPEC)
484
485 AC_SUBST(TCL_STUB_LIB_FILE)
486 AC_SUBST(TCL_STUB_LIB_FLAG)
487 AC_SUBST(TCL_STUB_LIB_SPEC)
488 fi
drh71eb93e2001-09-28 01:34:43 +0000489fi
drh7b5717e2004-11-25 13:50:01 +0000490if test "${use_tcl}" = "no" ; then
491 HAVE_TCL=""
492else
493 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000494fi
drh7b5717e2004-11-25 13:50:01 +0000495AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000496
497##########
498# Figure out what C libraries are required to compile programs
499# that use "readline()" library.
500#
vapier4c10a8a2007-02-17 14:28:26 +0000501TARGET_READLINE_LIBS=""
502TARGET_READLINE_INC=""
503TARGET_HAVE_READLINE=0
504AC_ARG_ENABLE([readline],
505 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
506 [with_readline=$enableval],
507 [with_readline=auto])
508
509if test x"$with_readline" != xno; then
510 found="yes"
511
512 AC_ARG_WITH([readline-lib],
513 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
514 [with_readline_lib=$withval],
515 [with_readline_lib="auto"])
516 if test "x$with_readline_lib" = xauto; then
517 save_LIBS="$LIBS"
518 LIBS=""
519 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
520 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
521 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
522 LIBS="$save_LIBS"
523 else
524 TARGET_READLINE_LIBS="$with_readline_lib"
525 fi
526
527 AC_ARG_WITH([readline-inc],
528 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
529 [with_readline_inc=$withval],
530 [with_readline_inc="auto"])
531 if test "x$with_readline_inc" = xauto; then
532 AC_CHECK_HEADER(readline.h, [found="yes"], [
533 found="no"
534 if test "$cross_compiling" != yes; then
535 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
536 for subdir in include include/readline; do
537 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
538 if test "$found" = "yes"; then
539 TARGET_READLINE_INC="-I$dir/$subdir"
540 break
541 fi
542 done
543 test "$found" = "yes" && break
544 done
545 fi
546 ])
547 else
548 TARGET_READLINE_INC="$with_readline_inc"
549 fi
550
551 if test x"$found" = xno; then
552 TARGET_READLINE_LIBS=""
553 TARGET_READLINE_INC=""
554 TARGET_HAVE_READLINE=0
555 else
556 TARGET_HAVE_READLINE=1
557 fi
drh71eb93e2001-09-28 01:34:43 +0000558fi
vapier4c10a8a2007-02-17 14:28:26 +0000559
drh71eb93e2001-09-28 01:34:43 +0000560AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000561AC_SUBST(TARGET_READLINE_INC)
562AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000563
564##########
drhf1878b42006-01-23 18:06:52 +0000565# Figure out what C libraries are required to compile programs
566# that use "fdatasync()" function.
567#
drhf1878b42006-01-23 18:06:52 +0000568AC_SEARCH_LIBS(fdatasync, [rt])
drhf1878b42006-01-23 18:06:52 +0000569
drh71eb93e2001-09-28 01:34:43 +0000570#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000571# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000572AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000573 [use_debug=$enableval],[use_debug=no])
574if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000575 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000576else
577 TARGET_DEBUG="-DNDEBUG"
578fi
579AC_SUBST(TARGET_DEBUG)
580
581#########
mlcreech94984912008-03-04 19:03:08 +0000582# See whether we should use the amalgamation to build
583AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
584 [Disable the amalgamation and instead build all files separately (currently needed to build the test fixture)]),
585 [use_amalgamation=$enableval],[use_amalgamation=yes])
586if test "${use_amalgamation}" = "yes" ; then
587 USE_AMALGAMATION=1
588else
589 USE_AMALGAMATION=0
590fi
591AC_SUBST(USE_AMALGAMATION)
592
593#########
mlcreecha4edab02008-03-06 04:14:17 +0000594# See whether we should allow loadable extensions
595AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension],
596 [Enable loading of external extensions]),
597 [use_loadextension=$enableval],[use_loadextension=no])
598if test "${use_loadextension}" = "yes" ; then
599 LOADEXTENSION_FLAGS=""
600else
601 LOADEXTENSION_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
602fi
603AC_SUBST(LOADEXTENSION_FLAGS)
604
drhaf6edf52005-10-04 18:38:49 +0000605
drh71eb93e2001-09-28 01:34:43 +0000606#########
mlcreechb87057f2008-03-06 07:19:20 +0000607# Output the config header
608AC_CONFIG_HEADERS(src/config.h)
609
610#########
drh71eb93e2001-09-28 01:34:43 +0000611# Generate the output files.
612#
mlcreech8390bc32008-03-06 08:54:38 +0000613AC_SUBST(BUILD_CFLAGS)
a.rottmannc7e93832003-03-24 09:39:32 +0000614AC_OUTPUT([
615Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000616sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000617])