blob: 7573525f9e855a9e352a3b12031ab82852d84b4b [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#
48# TARGET_CC
49#
50# The name of a command that runs on the build platform
51# and converts C source files into *.o files for the
52# target platform. In other words, the cross-compiler.
53#
54# TARGET_CFLAGS
55#
56# Switches that the target compiler needs to turn C source files
57# into *.o files. Do not include TARGET_TCL_INC in this list.
58# Makefiles might add additional switches such as "-I.".
59#
drh7b5717e2004-11-25 13:50:01 +000060# TCL_*
drh71eb93e2001-09-28 01:34:43 +000061#
drh7b5717e2004-11-25 13:50:01 +000062# Lots of values are read in from the tclConfig.sh script,
drh4b2266a2004-11-27 15:52:16 +000063# if that script is available. This values are used for
64# constructing and installing the TCL extension.
drh71eb93e2001-09-28 01:34:43 +000065#
66# TARGET_READLINE_LIBS
67#
68# This is the library directives passed to the target linker
69# that cause the executable to link against the readline library.
70# This might be a switch like "-lreadline" or pathnames of library
71# file like "../../src/libreadline.a".
72#
73# TARGET_READLINE_INC
74#
75# This variables define the directory that contain header
76# files for the readline library. If the compiler is able
77# to find <readline.h> on its own, then this can be blank.
78#
79# TARGET_LINK
80#
81# The name of the linker that combines *.o files generated
82# by TARGET_CC into executables for the target platform.
83#
84# TARGET_LIBS
85#
86# Additional libraries or other switch that the target linker needs
87# to build an executable on the target. Do not include
88# on this list any libraries in TARGET_TCL_LIBS and
89# TARGET_READLINE_LIBS, etc.
90#
91# TARGET_EXEEXT
92#
93# The filename extension for executables on the
94# target platform. "" for Unix and ".exe" for windows.
95#
96# The generated configure script will make an attempt to guess
97# at all of the above parameters. You can override any of
98# the guesses by setting the environment variable named
99# "config_AAAA" where "AAAA" is the name of the parameter
100# described above. (Exception: srcdir cannot be set this way.)
101# If you have a file that sets one or more of these environment
102# variables, you can invoke configure as follows:
103#
104# configure --with-hints=FILE
105#
106# where FILE is the name of the file that sets the environment
107# variables. FILE should be an absolute pathname.
108#
drh71eb93e2001-09-28 01:34:43 +0000109# This configure.in file is easy to reuse on other projects. Just
110# change the argument to AC_INIT(). And disable any features that
111# you don't need (for example BLT) by erasing or commenting out
112# the corresponding code.
113#
114AC_INIT(src/sqlite.h.in)
115
116dnl Put the RCS revision string after AC_INIT so that it will also
117dnl show in in configure.
118# The following RCS revision string applies to configure.in
vapier4c10a8a2007-02-17 14:28:26 +0000119# $Revision: 1.27 $
drh71eb93e2001-09-28 01:34:43 +0000120
121#########
122# Programs needed
123#
124AC_PROG_LIBTOOL
125AC_PROG_INSTALL
drhf1878b42006-01-23 18:06:52 +0000126AC_PROG_AWK
drh71eb93e2001-09-28 01:34:43 +0000127
128#########
129# Set up an appropriate program prefix
130#
131if test "$program_prefix" = "NONE"; then
132 program_prefix=""
133fi
134AC_SUBST(program_prefix)
135
drh4b2266a2004-11-27 15:52:16 +0000136VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
137echo "Version set to $VERSION"
a.rottmannc7e93832003-03-24 09:39:32 +0000138AC_SUBST(VERSION)
drh4b2266a2004-11-27 15:52:16 +0000139RELEASE=`cat $srcdir/VERSION`
140echo "Release set to $RELEASE"
141AC_SUBST(RELEASE)
drh26d0e2a2005-07-06 13:51:27 +0000142VERSION_NUMBER=[`cat $srcdir/VERSION \
drhb7977832005-02-16 03:45:51 +0000143 | sed 's/[^0-9]/ /g' \
drh26d0e2a2005-07-06 13:51:27 +0000144 | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
drhb7977832005-02-16 03:45:51 +0000145echo "Version number set to $VERSION_NUMBER"
146AC_SUBST(VERSION_NUMBER)
a.rottmannc7e93832003-03-24 09:39:32 +0000147
drh71eb93e2001-09-28 01:34:43 +0000148#########
149# Check to see if the --with-hints=FILE option is used. If there is none,
150# then check for a files named "$host.hints" and ../$hosts.hints where
151# $host is the hostname of the build system. If still no hints are
152# found, try looking in $system.hints and ../$system.hints where
153# $system is the result of uname -s.
154#
155AC_ARG_WITH(hints,
drh94e4f822006-02-15 02:00:25 +0000156 AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]),
drh71eb93e2001-09-28 01:34:43 +0000157 hints=$withval)
158if test "$hints" = ""; then
159 host=`hostname | sed 's/\..*//'`
160 if test -r $host.hints; then
161 hints=$host.hints
162 else
163 if test -r ../$host.hints; then
164 hints=../$host.hints
165 fi
166 fi
167fi
168if test "$hints" = ""; then
169 sys=`uname -s`
170 if test -r $sys.hints; then
171 hints=$sys.hints
172 else
173 if test -r ../$sys.hints; then
174 hints=../$sys.hints
175 fi
176 fi
177fi
178if test "$hints" != ""; then
179 AC_MSG_RESULT(reading hints from $hints)
180 . $hints
181fi
182
183#########
184# Locate a compiler for the build machine. This compiler should
185# generate command-line programs that run on the build machine.
186#
187default_build_cflags="-g"
188if test "$config_BUILD_CC" = ""; then
189 AC_PROG_CC
190 if test "$cross_compiling" = "yes"; then
191 AC_MSG_ERROR([unable to find a compiler for building build tools])
192 fi
193 BUILD_CC=$CC
194 default_build_cflags=$CFLAGS
195else
196 BUILD_CC=$config_BUILD_CC
197 AC_MSG_CHECKING([host compiler])
198 CC=$BUILD_CC
199 AC_MSG_RESULT($BUILD_CC)
200fi
201AC_MSG_CHECKING([switches for the host compiler])
202if test "$config_BUILD_CFLAGS" != ""; then
203 CFLAGS=$config_BUILD_CFLAGS
204 BUILD_CFLAGS=$config_BUILD_CFLAGS
205else
206 BUILD_CFLAGS=$default_build_cflags
207fi
208AC_MSG_RESULT($BUILD_CFLAGS)
209if test "$config_BUILD_LIBS" != ""; then
210 BUILD_LIBS=$config_BUILD_LIBS
211fi
212AC_SUBST(BUILD_CC)
213AC_SUBST(BUILD_CFLAGS)
214AC_SUBST(BUILD_LIBS)
215
216##########
217# Locate a compiler that converts C code into *.o files that run on
218# the target machine.
219#
220AC_MSG_CHECKING([target compiler])
221if test "$config_TARGET_CC" != ""; then
222 TARGET_CC=$config_TARGET_CC
223else
224 TARGET_CC=$BUILD_CC
225fi
226AC_MSG_RESULT($TARGET_CC)
227AC_MSG_CHECKING([switches on the target compiler])
228if test "$config_TARGET_CFLAGS" != ""; then
229 TARGET_CFLAGS=$config_TARGET_CFLAGS
230else
231 TARGET_CFLAGS=$BUILD_CFLAGS
232fi
233AC_MSG_RESULT($TARGET_CFLAGS)
234AC_MSG_CHECKING([target linker])
235if test "$config_TARGET_LINK" = ""; then
236 TARGET_LINK=$TARGET_CC
237else
238 TARGET_LINK=$config_TARGET_LINK
239fi
240AC_MSG_RESULT($TARGET_LINK)
241AC_MSG_CHECKING([switches on the target compiler])
242if test "$config_TARGET_TFLAGS" != ""; then
243 TARGET_TFLAGS=$config_TARGET_TFLAGS
244else
245 TARGET_TFLAGS=$BUILD_CFLAGS
246fi
247if test "$config_TARGET_RANLIB" != ""; then
248 TARGET_RANLIB=$config_TARGET_RANLIB
249else
250 AC_PROG_RANLIB
251 TARGET_RANLIB=$RANLIB
252fi
253if test "$config_TARGET_AR" != ""; then
254 TARGET_AR=$config_TARGET_AR
255else
256 TARGET_AR='ar cr'
257fi
258AC_MSG_RESULT($TARGET_TFLAGS)
259AC_SUBST(TARGET_CC)
260AC_SUBST(TARGET_CFLAGS)
261AC_SUBST(TARGET_LINK)
262AC_SUBST(TARGET_LFLAGS)
263AC_SUBST(TARGET_RANLIB)
264AC_SUBST(TARGET_AR)
265
266# Set the $cross variable if we are cross-compiling. Make
267# it 0 if we are not.
268#
269AC_MSG_CHECKING([if host and target compilers are the same])
270if test "$BUILD_CC" = "$TARGET_CC"; then
271 cross=0
272 AC_MSG_RESULT(yes)
273else
274 cross=1
275 AC_MSG_RESULT(no)
276fi
277
278##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000279# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000280#
dougcurrie0f290bf2004-06-21 18:57:29 +0000281AC_ARG_ENABLE(threadsafe,
drh94e4f822006-02-15 02:00:25 +0000282AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=no)
dougcurrie0f290bf2004-06-21 18:57:29 +0000283AC_MSG_CHECKING([whether to support threadsafe operation])
284if test "$enable_threadsafe" = "no"; then
285 THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000286 AC_MSG_RESULT([no])
287else
dougcurrie0f290bf2004-06-21 18:57:29 +0000288 THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000289 AC_MSG_RESULT([yes])
290fi
dougcurrie0f290bf2004-06-21 18:57:29 +0000291AC_SUBST(THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000292
dougcurrie65623c72004-09-20 14:57:23 +0000293if test "$THREADSAFE" = "1"; then
294 LIBS=""
295 AC_CHECK_LIB(pthread, pthread_create)
296 TARGET_THREAD_LIB="$LIBS"
297 LIBS=""
298else
299 TARGET_THREAD_LIB=""
300fi
301AC_SUBST(TARGET_THREAD_LIB)
302
paulb0208cc2003-04-13 18:26:49 +0000303##########
drh91636d52005-11-24 23:14:00 +0000304# Do we want to allow a connection created in one thread to be used
305# in another thread. This does not work on many Linux systems (ex: RedHat 9)
306# due to bugs in the threading implementations. This is thus off by default.
307#
308AC_ARG_ENABLE(cross-thread-connections,
drh94e4f822006-02-15 02:00:25 +0000309AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no)
drh91636d52005-11-24 23:14:00 +0000310AC_MSG_CHECKING([whether to allow connections to be shared across threads])
311if test "$enable_xthreadconnect" = "no"; then
312 XTHREADCONNECT=''
313 AC_MSG_RESULT([no])
314else
315 XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1'
316 AC_MSG_RESULT([yes])
317fi
318AC_SUBST(XTHREADCONNECT)
319
320##########
drh8e2e2a12006-02-01 01:55:17 +0000321# Do we want to set threadsOverrideEachOthersLocks variable to be 1 (true) by
322# default. Normally, a test at runtime is performed to determine the
323# appropriate value of this variable. Use this option only if you're sure that
324# threads can safely override each others locks in all runtime situations.
325#
326AC_ARG_ENABLE(threads-override-locks,
drh94e4f822006-02-15 02:00:25 +0000327AC_HELP_STRING([--enable-threads-override-locks],[Threads can override each others locks]),,enable_threads_override_locks=no)
drh8e2e2a12006-02-01 01:55:17 +0000328AC_MSG_CHECKING([whether threads can override each others locks])
329if test "$enable_threads_override_locks" = "no"; then
330 THREADSOVERRIDELOCKS='-1'
331 AC_MSG_RESULT([no])
332else
333 THREADSOVERRIDELOCKS='1'
334 AC_MSG_RESULT([yes])
335fi
336AC_SUBST(THREADSOVERRIDELOCKS)
337
338##########
xdong3b5543c2003-09-23 00:36:50 +0000339# Do we want to support release
340#
341AC_ARG_ENABLE(releasemode,
drh94e4f822006-02-15 02:00:25 +0000342AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
xdong3b5543c2003-09-23 00:36:50 +0000343AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
344if test "$enable_releasemode" = "no"; then
345 ALLOWRELEASE=""
346 AC_MSG_RESULT([no])
347else
348 ALLOWRELEASE="-release `cat VERSION`"
349 AC_MSG_RESULT([yes])
350fi
351AC_SUBST(ALLOWRELEASE)
352
353##########
paulb0208cc2003-04-13 18:26:49 +0000354# Do we want temporary databases in memory
355#
dougcurrie0f290bf2004-06-21 18:57:29 +0000356AC_ARG_ENABLE(tempstore,
drh94e4f822006-02-15 02:00:25 +0000357AC_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 +0000358AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000359case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000360 never )
paul2dc96f92003-04-20 11:46:34 +0000361 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000362 AC_MSG_RESULT([never])
363 ;;
364 no )
paul2dc96f92003-04-20 11:46:34 +0000365 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000366 AC_MSG_RESULT([no])
367 ;;
368 always )
dougcurrie0f290bf2004-06-21 18:57:29 +0000369 TEMP_STORE=3
paulb0208cc2003-04-13 18:26:49 +0000370 AC_MSG_RESULT([always])
371 ;;
drh54414bb2005-10-10 00:05:50 +0000372 yes )
373 TEMP_STORE=3
374 AC_MSG_RESULT([always])
375 ;;
paulb0208cc2003-04-13 18:26:49 +0000376 * )
drh54414bb2005-10-10 00:05:50 +0000377 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000378 AC_MSG_RESULT([yes])
379 ;;
380esac
paul2dc96f92003-04-20 11:46:34 +0000381
paul2dc96f92003-04-20 11:46:34 +0000382AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000383
drh71eb93e2001-09-28 01:34:43 +0000384###########
385# Lots of things are different if we are compiling for Windows using
386# the CYGWIN environment. So check for that special case and handle
387# things accordingly.
388#
389AC_MSG_CHECKING([if executables have the .exe suffix])
390if test "$config_BUILD_EXEEXT" = ".exe"; then
391 CYGWIN=yes
392 AC_MSG_RESULT(yes)
393else
394 AC_MSG_RESULT(unknown)
395fi
396if test "$CYGWIN" != "yes"; then
397 AC_CYGWIN
398fi
399if test "$CYGWIN" = "yes"; then
400 BUILD_EXEEXT=.exe
401else
dougcurrie6194a5f2003-12-19 20:09:51 +0000402 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000403fi
404if test "$cross" = "0"; then
405 TARGET_EXEEXT=$BUILD_EXEEXT
406else
407 TARGET_EXEEXT=$config_TARGET_EXEEXT
408fi
409if test "$TARGET_EXEEXT" = ".exe"; then
drh60a1e4b2006-06-03 18:02:15 +0000410 if test $OS2_SHELL ; then
411 OS_UNIX=0
412 OS_WIN=0
413 OS_OS2=1
414 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_OS2=1"
415 if test "$ac_compiler_gnu" == "yes" ; then
416 TARGET_CFLAGS="$TARGET_CFLAGS -Zomf -Zexe -Zmap"
417 BUILD_CFLAGS="$BUILD_CFLAGS -Zomf -Zexe"
418 fi
419 else
420 OS_UNIX=0
421 OS_WIN=1
422 OS_OS2=0
423 tclsubdir=win
424 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_WIN=1"
425 fi
drh71eb93e2001-09-28 01:34:43 +0000426else
427 OS_UNIX=1
428 OS_WIN=0
drh60a1e4b2006-06-03 18:02:15 +0000429 OS_OS2=0
drh71eb93e2001-09-28 01:34:43 +0000430 tclsubdir=unix
dougcurrie0f290bf2004-06-21 18:57:29 +0000431 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000432fi
drh71eb93e2001-09-28 01:34:43 +0000433
434AC_SUBST(BUILD_EXEEXT)
435AC_SUBST(OS_UNIX)
436AC_SUBST(OS_WIN)
drh60a1e4b2006-06-03 18:02:15 +0000437AC_SUBST(OS_OS2)
drh71eb93e2001-09-28 01:34:43 +0000438AC_SUBST(TARGET_EXEEXT)
439
440##########
441# Extract generic linker options from the environment.
442#
443if test "$config_TARGET_LIBS" != ""; then
444 TARGET_LIBS=$config_TARGET_LIBS
445else
446 TARGET_LIBS=""
447fi
drh71eb93e2001-09-28 01:34:43 +0000448
449##########
drh7b5717e2004-11-25 13:50:01 +0000450# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000451#
drh7b5717e2004-11-25 13:50:01 +0000452# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
453# macros in the in the tcl.m4 file of the standard TCL distribution.
454# Those macros could not be used directly since we have to make some
455# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000456#
drh94e4f822006-02-15 02:00:25 +0000457AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
drh7b5717e2004-11-25 13:50:01 +0000458 [use_tcl=$enableval],[use_tcl=yes])
459if test "${use_tcl}" = "yes" ; then
drh94e4f822006-02-15 02:00:25 +0000460 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 +0000461 AC_MSG_CHECKING([for Tcl configuration])
462 AC_CACHE_VAL(ac_cv_c_tclconfig,[
463 # First check to see if --with-tcl was specified.
464 if test x"${with_tclconfig}" != x ; then
465 if test -f "${with_tclconfig}/tclConfig.sh" ; then
466 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
467 else
468 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
469 fi
drh71eb93e2001-09-28 01:34:43 +0000470 fi
drh7b5717e2004-11-25 13:50:01 +0000471 # then check for a private Tcl installation
472 if test x"${ac_cv_c_tclconfig}" = x ; then
473 for i in \
474 ../tcl \
475 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
476 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
477 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
478 ../../tcl \
479 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
480 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
481 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
482 ../../../tcl \
483 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
484 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
485 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
486 do
487 if test -f "$i/unix/tclConfig.sh" ; then
488 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
489 break
490 fi
491 done
492 fi
493
494 # check in a few common install locations
495 if test x"${ac_cv_c_tclconfig}" = x ; then
496 for i in \
497 `ls -d ${libdir} 2>/dev/null` \
498 `ls -d /usr/local/lib 2>/dev/null` \
499 `ls -d /usr/contrib/lib 2>/dev/null` \
500 `ls -d /usr/lib 2>/dev/null`
501 do
502 if test -f "$i/tclConfig.sh" ; then
503 ac_cv_c_tclconfig=`(cd $i; pwd)`
504 break
505 fi
506 done
507 fi
508
509 # check in a few other private locations
510 if test x"${ac_cv_c_tclconfig}" = x ; then
511 for i in \
512 ${srcdir}/../tcl \
513 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
514 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
515 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
516 do
517 if test -f "$i/unix/tclConfig.sh" ; then
518 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
519 break
520 fi
521 done
522 fi
523 ])
524
525 if test x"${ac_cv_c_tclconfig}" = x ; then
526 use_tcl=no
527 AC_MSG_WARN(Can't find Tcl configuration definitions)
528 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
529 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
530 else
531 TCL_BIN_DIR=${ac_cv_c_tclconfig}
532 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
533
534 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
535 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
536 AC_MSG_RESULT([loading])
537 . $TCL_BIN_DIR/tclConfig.sh
538 else
539 AC_MSG_RESULT([file not found])
540 fi
541
542 #
543 # If the TCL_BIN_DIR is the build directory (not the install directory),
544 # then set the common variable name to the value of the build variables.
545 # For example, the variable TCL_LIB_SPEC will be set to the value
546 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
547 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
548 # installed and uninstalled version of Tcl.
549 #
550
551 if test -f $TCL_BIN_DIR/Makefile ; then
552 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
553 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
554 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
555 fi
556
557 #
558 # eval is required to do the TCL_DBGX substitution
559 #
560
561 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
562 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
563 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
564
565 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
566 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
567 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
568
569 AC_SUBST(TCL_VERSION)
570 AC_SUBST(TCL_BIN_DIR)
571 AC_SUBST(TCL_SRC_DIR)
572 AC_SUBST(TCL_LIBS)
573 AC_SUBST(TCL_INCLUDE_SPEC)
574
575 AC_SUBST(TCL_LIB_FILE)
576 AC_SUBST(TCL_LIB_FLAG)
577 AC_SUBST(TCL_LIB_SPEC)
578
579 AC_SUBST(TCL_STUB_LIB_FILE)
580 AC_SUBST(TCL_STUB_LIB_FLAG)
581 AC_SUBST(TCL_STUB_LIB_SPEC)
582 fi
drh71eb93e2001-09-28 01:34:43 +0000583fi
drh7b5717e2004-11-25 13:50:01 +0000584if test "${use_tcl}" = "no" ; then
585 HAVE_TCL=""
586else
587 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000588fi
drh7b5717e2004-11-25 13:50:01 +0000589AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000590
591##########
592# Figure out what C libraries are required to compile programs
593# that use "readline()" library.
594#
vapier4c10a8a2007-02-17 14:28:26 +0000595TARGET_READLINE_LIBS=""
596TARGET_READLINE_INC=""
597TARGET_HAVE_READLINE=0
598AC_ARG_ENABLE([readline],
599 [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])],
600 [with_readline=$enableval],
601 [with_readline=auto])
602
603if test x"$with_readline" != xno; then
604 found="yes"
605
606 AC_ARG_WITH([readline-lib],
607 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
608 [with_readline_lib=$withval],
609 [with_readline_lib="auto"])
610 if test "x$with_readline_lib" = xauto; then
611 save_LIBS="$LIBS"
612 LIBS=""
613 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
614 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
615 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
616 LIBS="$save_LIBS"
617 else
618 TARGET_READLINE_LIBS="$with_readline_lib"
619 fi
620
621 AC_ARG_WITH([readline-inc],
622 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
623 [with_readline_inc=$withval],
624 [with_readline_inc="auto"])
625 if test "x$with_readline_inc" = xauto; then
626 AC_CHECK_HEADER(readline.h, [found="yes"], [
627 found="no"
628 if test "$cross_compiling" != yes; then
629 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
630 for subdir in include include/readline; do
631 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
632 if test "$found" = "yes"; then
633 TARGET_READLINE_INC="-I$dir/$subdir"
634 break
635 fi
636 done
637 test "$found" = "yes" && break
638 done
639 fi
640 ])
641 else
642 TARGET_READLINE_INC="$with_readline_inc"
643 fi
644
645 if test x"$found" = xno; then
646 TARGET_READLINE_LIBS=""
647 TARGET_READLINE_INC=""
648 TARGET_HAVE_READLINE=0
649 else
650 TARGET_HAVE_READLINE=1
651 fi
drh71eb93e2001-09-28 01:34:43 +0000652fi
vapier4c10a8a2007-02-17 14:28:26 +0000653
drh71eb93e2001-09-28 01:34:43 +0000654AC_SUBST(TARGET_READLINE_LIBS)
vapier4c10a8a2007-02-17 14:28:26 +0000655AC_SUBST(TARGET_READLINE_INC)
656AC_SUBST(TARGET_HAVE_READLINE)
drh71eb93e2001-09-28 01:34:43 +0000657
658##########
drhf1878b42006-01-23 18:06:52 +0000659# Figure out what C libraries are required to compile programs
660# that use "fdatasync()" function.
661#
662CC=$TARGET_CC
663LIBS=$TARGET_LIBS
664AC_SEARCH_LIBS(fdatasync, [rt])
665TARGET_LIBS="$LIBS"
666
drh71eb93e2001-09-28 01:34:43 +0000667#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000668# check for debug enabled
drh94e4f822006-02-15 02:00:25 +0000669AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
tpoindex9d9f76c2005-01-03 21:28:56 +0000670 [use_debug=$enableval],[use_debug=no])
671if test "${use_debug}" = "yes" ; then
drheae3a0d2006-03-03 20:37:52 +0000672 TARGET_DEBUG="-DSQLITE_DEBUG=1"
tpoindex9d9f76c2005-01-03 21:28:56 +0000673else
674 TARGET_DEBUG="-DNDEBUG"
675fi
676AC_SUBST(TARGET_DEBUG)
677
678#########
drh71eb93e2001-09-28 01:34:43 +0000679# Figure out whether or not we have a "usleep()" function.
680#
681AC_CHECK_FUNC(usleep, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_USLEEP=1"])
682
drhaf6edf52005-10-04 18:38:49 +0000683#--------------------------------------------------------------------
684# Redefine fdatasync as fsync on systems that lack fdatasync
685#--------------------------------------------------------------------
686
drhf2f23912005-10-05 10:29:36 +0000687AC_CHECK_FUNC(fdatasync, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_FDATASYNC=1"])
drhaf6edf52005-10-04 18:38:49 +0000688
drh71eb93e2001-09-28 01:34:43 +0000689#########
drhf1878b42006-01-23 18:06:52 +0000690# Put out accumulated miscellaneous LIBRARIES
691#
692AC_SUBST(TARGET_LIBS)
693
694#########
drh71eb93e2001-09-28 01:34:43 +0000695# Generate the output files.
696#
a.rottmannc7e93832003-03-24 09:39:32 +0000697AC_OUTPUT([
698Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000699sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000700])