blob: 8ed6baa6d568bfee9a3eaee10dd3e6bbeb3c9e5c [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
drh54414bb2005-10-10 00:05:50 +0000119# $Revision: 1.20 $
drh71eb93e2001-09-28 01:34:43 +0000120
121#########
122# Programs needed
123#
124AC_PROG_LIBTOOL
125AC_PROG_INSTALL
126
127#########
128# 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,
155 [ --with-hints=FILE Read configuration options from FILE],
156 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#
186default_build_cflags="-g"
187if test "$config_BUILD_CC" = ""; then
188 AC_PROG_CC
189 if test "$cross_compiling" = "yes"; then
190 AC_MSG_ERROR([unable to find a compiler for building build tools])
191 fi
192 BUILD_CC=$CC
193 default_build_cflags=$CFLAGS
194else
195 BUILD_CC=$config_BUILD_CC
196 AC_MSG_CHECKING([host compiler])
197 CC=$BUILD_CC
198 AC_MSG_RESULT($BUILD_CC)
199fi
200AC_MSG_CHECKING([switches for the host compiler])
201if test "$config_BUILD_CFLAGS" != ""; then
202 CFLAGS=$config_BUILD_CFLAGS
203 BUILD_CFLAGS=$config_BUILD_CFLAGS
204else
205 BUILD_CFLAGS=$default_build_cflags
206fi
207AC_MSG_RESULT($BUILD_CFLAGS)
208if test "$config_BUILD_LIBS" != ""; then
209 BUILD_LIBS=$config_BUILD_LIBS
210fi
211AC_SUBST(BUILD_CC)
212AC_SUBST(BUILD_CFLAGS)
213AC_SUBST(BUILD_LIBS)
214
215##########
216# Locate a compiler that converts C code into *.o files that run on
217# the target machine.
218#
219AC_MSG_CHECKING([target compiler])
220if test "$config_TARGET_CC" != ""; then
221 TARGET_CC=$config_TARGET_CC
222else
223 TARGET_CC=$BUILD_CC
224fi
225AC_MSG_RESULT($TARGET_CC)
226AC_MSG_CHECKING([switches on the target compiler])
227if test "$config_TARGET_CFLAGS" != ""; then
228 TARGET_CFLAGS=$config_TARGET_CFLAGS
229else
230 TARGET_CFLAGS=$BUILD_CFLAGS
231fi
232AC_MSG_RESULT($TARGET_CFLAGS)
233AC_MSG_CHECKING([target linker])
234if test "$config_TARGET_LINK" = ""; then
235 TARGET_LINK=$TARGET_CC
236else
237 TARGET_LINK=$config_TARGET_LINK
238fi
239AC_MSG_RESULT($TARGET_LINK)
240AC_MSG_CHECKING([switches on the target compiler])
241if test "$config_TARGET_TFLAGS" != ""; then
242 TARGET_TFLAGS=$config_TARGET_TFLAGS
243else
244 TARGET_TFLAGS=$BUILD_CFLAGS
245fi
246if test "$config_TARGET_RANLIB" != ""; then
247 TARGET_RANLIB=$config_TARGET_RANLIB
248else
249 AC_PROG_RANLIB
250 TARGET_RANLIB=$RANLIB
251fi
252if test "$config_TARGET_AR" != ""; then
253 TARGET_AR=$config_TARGET_AR
254else
255 TARGET_AR='ar cr'
256fi
257AC_MSG_RESULT($TARGET_TFLAGS)
258AC_SUBST(TARGET_CC)
259AC_SUBST(TARGET_CFLAGS)
260AC_SUBST(TARGET_LINK)
261AC_SUBST(TARGET_LFLAGS)
262AC_SUBST(TARGET_RANLIB)
263AC_SUBST(TARGET_AR)
264
265# Set the $cross variable if we are cross-compiling. Make
266# it 0 if we are not.
267#
268AC_MSG_CHECKING([if host and target compilers are the same])
269if test "$BUILD_CC" = "$TARGET_CC"; then
270 cross=0
271 AC_MSG_RESULT(yes)
272else
273 cross=1
274 AC_MSG_RESULT(no)
275fi
276
277##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000278# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000279#
dougcurrie0f290bf2004-06-21 18:57:29 +0000280AC_ARG_ENABLE(threadsafe,
281[ --enable-threadsafe Support threadsafe operation],,enable_threadsafe=no)
282AC_MSG_CHECKING([whether to support threadsafe operation])
283if test "$enable_threadsafe" = "no"; then
284 THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000285 AC_MSG_RESULT([no])
286else
dougcurrie0f290bf2004-06-21 18:57:29 +0000287 THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000288 AC_MSG_RESULT([yes])
289fi
dougcurrie0f290bf2004-06-21 18:57:29 +0000290AC_SUBST(THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000291
dougcurrie65623c72004-09-20 14:57:23 +0000292if test "$THREADSAFE" = "1"; then
293 LIBS=""
294 AC_CHECK_LIB(pthread, pthread_create)
295 TARGET_THREAD_LIB="$LIBS"
296 LIBS=""
297else
298 TARGET_THREAD_LIB=""
299fi
300AC_SUBST(TARGET_THREAD_LIB)
301
paulb0208cc2003-04-13 18:26:49 +0000302##########
xdong3b5543c2003-09-23 00:36:50 +0000303# Do we want to support release
304#
305AC_ARG_ENABLE(releasemode,
306[ --enable-releasemode Support libtool link to release mode],,enable_releasemode=no)
307AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
308if test "$enable_releasemode" = "no"; then
309 ALLOWRELEASE=""
310 AC_MSG_RESULT([no])
311else
312 ALLOWRELEASE="-release `cat VERSION`"
313 AC_MSG_RESULT([yes])
314fi
315AC_SUBST(ALLOWRELEASE)
316
317##########
paulb0208cc2003-04-13 18:26:49 +0000318# Do we want temporary databases in memory
319#
dougcurrie0f290bf2004-06-21 18:57:29 +0000320AC_ARG_ENABLE(tempstore,
drh54414bb2005-10-10 00:05:50 +0000321[ --enable-tempstore Use an in-ram database for temporary tables (never,no,yes,always)],,enable_tempstore=no)
paulb0208cc2003-04-13 18:26:49 +0000322AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000323case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000324 never )
paul2dc96f92003-04-20 11:46:34 +0000325 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000326 AC_MSG_RESULT([never])
327 ;;
328 no )
paul2dc96f92003-04-20 11:46:34 +0000329 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000330 AC_MSG_RESULT([no])
331 ;;
332 always )
dougcurrie0f290bf2004-06-21 18:57:29 +0000333 TEMP_STORE=3
paulb0208cc2003-04-13 18:26:49 +0000334 AC_MSG_RESULT([always])
335 ;;
drh54414bb2005-10-10 00:05:50 +0000336 yes )
337 TEMP_STORE=3
338 AC_MSG_RESULT([always])
339 ;;
paulb0208cc2003-04-13 18:26:49 +0000340 * )
drh54414bb2005-10-10 00:05:50 +0000341 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000342 AC_MSG_RESULT([yes])
343 ;;
344esac
paul2dc96f92003-04-20 11:46:34 +0000345
paul2dc96f92003-04-20 11:46:34 +0000346AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000347
drh71eb93e2001-09-28 01:34:43 +0000348###########
349# Lots of things are different if we are compiling for Windows using
350# the CYGWIN environment. So check for that special case and handle
351# things accordingly.
352#
353AC_MSG_CHECKING([if executables have the .exe suffix])
354if test "$config_BUILD_EXEEXT" = ".exe"; then
355 CYGWIN=yes
356 AC_MSG_RESULT(yes)
357else
358 AC_MSG_RESULT(unknown)
359fi
360if test "$CYGWIN" != "yes"; then
361 AC_CYGWIN
362fi
363if test "$CYGWIN" = "yes"; then
364 BUILD_EXEEXT=.exe
365else
dougcurrie6194a5f2003-12-19 20:09:51 +0000366 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000367fi
368if test "$cross" = "0"; then
369 TARGET_EXEEXT=$BUILD_EXEEXT
370else
371 TARGET_EXEEXT=$config_TARGET_EXEEXT
372fi
373if test "$TARGET_EXEEXT" = ".exe"; then
374 OS_UNIX=0
375 OS_WIN=1
376 tclsubdir=win
dougcurrie0f290bf2004-06-21 18:57:29 +0000377 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_WIN=1"
drh71eb93e2001-09-28 01:34:43 +0000378else
379 OS_UNIX=1
380 OS_WIN=0
381 tclsubdir=unix
dougcurrie0f290bf2004-06-21 18:57:29 +0000382 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000383fi
drh71eb93e2001-09-28 01:34:43 +0000384
385AC_SUBST(BUILD_EXEEXT)
386AC_SUBST(OS_UNIX)
387AC_SUBST(OS_WIN)
388AC_SUBST(TARGET_EXEEXT)
389
390##########
391# Extract generic linker options from the environment.
392#
393if test "$config_TARGET_LIBS" != ""; then
394 TARGET_LIBS=$config_TARGET_LIBS
395else
396 TARGET_LIBS=""
397fi
398AC_SUBST(TARGET_LIBS)
399
400##########
drh7b5717e2004-11-25 13:50:01 +0000401# Figure out all the parameters needed to compile against Tcl.
drh71eb93e2001-09-28 01:34:43 +0000402#
drh7b5717e2004-11-25 13:50:01 +0000403# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
404# macros in the in the tcl.m4 file of the standard TCL distribution.
405# Those macros could not be used directly since we have to make some
406# minor changes to accomodate systems that do not have TCL installed.
drh71eb93e2001-09-28 01:34:43 +0000407#
drh7b5717e2004-11-25 13:50:01 +0000408AC_ARG_ENABLE(tcl, [ --disable-tcl do not build TCL extension],
409 [use_tcl=$enableval],[use_tcl=yes])
410if test "${use_tcl}" = "yes" ; then
drhb571b452004-12-10 02:20:27 +0000411 AC_ARG_WITH(tcl, [ --with-tcl=DIR directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
drh7b5717e2004-11-25 13:50:01 +0000412 AC_MSG_CHECKING([for Tcl configuration])
413 AC_CACHE_VAL(ac_cv_c_tclconfig,[
414 # First check to see if --with-tcl was specified.
415 if test x"${with_tclconfig}" != x ; then
416 if test -f "${with_tclconfig}/tclConfig.sh" ; then
417 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
418 else
419 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
420 fi
drh71eb93e2001-09-28 01:34:43 +0000421 fi
drh7b5717e2004-11-25 13:50:01 +0000422 # then check for a private Tcl installation
423 if test x"${ac_cv_c_tclconfig}" = x ; then
424 for i in \
425 ../tcl \
426 `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
427 `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
428 `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
429 ../../tcl \
430 `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
431 `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
432 `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
433 ../../../tcl \
434 `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
435 `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
436 `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
437 do
438 if test -f "$i/unix/tclConfig.sh" ; then
439 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
440 break
441 fi
442 done
443 fi
444
445 # check in a few common install locations
446 if test x"${ac_cv_c_tclconfig}" = x ; then
447 for i in \
448 `ls -d ${libdir} 2>/dev/null` \
449 `ls -d /usr/local/lib 2>/dev/null` \
450 `ls -d /usr/contrib/lib 2>/dev/null` \
451 `ls -d /usr/lib 2>/dev/null`
452 do
453 if test -f "$i/tclConfig.sh" ; then
454 ac_cv_c_tclconfig=`(cd $i; pwd)`
455 break
456 fi
457 done
458 fi
459
460 # check in a few other private locations
461 if test x"${ac_cv_c_tclconfig}" = x ; then
462 for i in \
463 ${srcdir}/../tcl \
464 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
465 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
466 `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
467 do
468 if test -f "$i/unix/tclConfig.sh" ; then
469 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
470 break
471 fi
472 done
473 fi
474 ])
475
476 if test x"${ac_cv_c_tclconfig}" = x ; then
477 use_tcl=no
478 AC_MSG_WARN(Can't find Tcl configuration definitions)
479 AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
480 AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
481 else
482 TCL_BIN_DIR=${ac_cv_c_tclconfig}
483 AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
484
485 AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
486 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
487 AC_MSG_RESULT([loading])
488 . $TCL_BIN_DIR/tclConfig.sh
489 else
490 AC_MSG_RESULT([file not found])
491 fi
492
493 #
494 # If the TCL_BIN_DIR is the build directory (not the install directory),
495 # then set the common variable name to the value of the build variables.
496 # For example, the variable TCL_LIB_SPEC will be set to the value
497 # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
498 # instead of TCL_BUILD_LIB_SPEC since it will work with both an
499 # installed and uninstalled version of Tcl.
500 #
501
502 if test -f $TCL_BIN_DIR/Makefile ; then
503 TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
504 TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
505 TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
506 fi
507
508 #
509 # eval is required to do the TCL_DBGX substitution
510 #
511
512 eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
513 eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
514 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
515
516 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
517 eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
518 eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
519
520 AC_SUBST(TCL_VERSION)
521 AC_SUBST(TCL_BIN_DIR)
522 AC_SUBST(TCL_SRC_DIR)
523 AC_SUBST(TCL_LIBS)
524 AC_SUBST(TCL_INCLUDE_SPEC)
525
526 AC_SUBST(TCL_LIB_FILE)
527 AC_SUBST(TCL_LIB_FLAG)
528 AC_SUBST(TCL_LIB_SPEC)
529
530 AC_SUBST(TCL_STUB_LIB_FILE)
531 AC_SUBST(TCL_STUB_LIB_FLAG)
532 AC_SUBST(TCL_STUB_LIB_SPEC)
533 fi
drh71eb93e2001-09-28 01:34:43 +0000534fi
drh7b5717e2004-11-25 13:50:01 +0000535if test "${use_tcl}" = "no" ; then
536 HAVE_TCL=""
537else
538 HAVE_TCL=1
drh71eb93e2001-09-28 01:34:43 +0000539fi
drh7b5717e2004-11-25 13:50:01 +0000540AC_SUBST(HAVE_TCL)
drh71eb93e2001-09-28 01:34:43 +0000541
542##########
543# Figure out what C libraries are required to compile programs
544# that use "readline()" library.
545#
546if test "$config_TARGET_READLINE_LIBS" != ""; then
547 TARGET_READLINE_LIBS="$config_TARGET_READLINE_LIBS"
548else
549 CC=$TARGET_CC
550 LIBS=""
paul38372372003-04-22 08:04:49 +0000551 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap])
552 AC_CHECK_LIB([readline], [readline])
drh71eb93e2001-09-28 01:34:43 +0000553 TARGET_READLINE_LIBS="$LIBS"
554fi
555AC_SUBST(TARGET_READLINE_LIBS)
556
557##########
558# Figure out where to get the READLINE header files.
559#
560AC_MSG_CHECKING([readline header files])
561found=no
562if test "$config_TARGET_READLINE_INC" != ""; then
563 TARGET_READLINE_INC=$config_TARGET_READLINE_INC
564 found=yes
565fi
566if test "$found" = "yes"; then
567 AC_MSG_RESULT($TARGET_READLINE_INC)
568else
569 AC_MSG_RESULT(not specified: still searching...)
570 AC_CHECK_HEADER(readline.h, [found=yes])
571fi
572if test "$found" = "no"; then
dougcurrie6194a5f2003-12-19 20:09:51 +0000573 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
drh71eb93e2001-09-28 01:34:43 +0000574 AC_CHECK_FILE($dir/include/readline.h, found=yes)
575 if test "$found" = "yes"; then
576 TARGET_READLINE_INC="-I$dir/include"
577 break
578 fi
579 AC_CHECK_FILE($dir/include/readline/readline.h, found=yes)
580 if test "$found" = "yes"; then
581 TARGET_READLINE_INC="-I$dir/include/readline"
582 break
583 fi
584 done
585fi
586if test "$found" = "yes"; then
587 if test "$TARGET_READLINE_LIBS" = ""; then
588 TARGET_HAVE_READLINE=0
589 else
590 TARGET_HAVE_READLINE=1
591 fi
592else
593 TARGET_HAVE_READLINE=0
594fi
595AC_SUBST(TARGET_READLINE_INC)
596AC_SUBST(TARGET_HAVE_READLINE)
597
598#########
tpoindex9d9f76c2005-01-03 21:28:56 +0000599# check for debug enabled
600AC_ARG_ENABLE(debug, [ --enable-debug enable debugging & verbose explain],
601 [use_debug=$enableval],[use_debug=no])
602if test "${use_debug}" = "yes" ; then
603 TARGET_DEBUG=""
604else
605 TARGET_DEBUG="-DNDEBUG"
606fi
607AC_SUBST(TARGET_DEBUG)
608
609#########
drh71eb93e2001-09-28 01:34:43 +0000610# Figure out whether or not we have a "usleep()" function.
611#
612AC_CHECK_FUNC(usleep, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_USLEEP=1"])
613
drhaf6edf52005-10-04 18:38:49 +0000614#--------------------------------------------------------------------
615# Redefine fdatasync as fsync on systems that lack fdatasync
616#--------------------------------------------------------------------
617
drhf2f23912005-10-05 10:29:36 +0000618AC_CHECK_FUNC(fdatasync, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_FDATASYNC=1"])
drhaf6edf52005-10-04 18:38:49 +0000619
drh71eb93e2001-09-28 01:34:43 +0000620#########
621# Generate the output files.
622#
a.rottmannc7e93832003-03-24 09:39:32 +0000623AC_OUTPUT([
624Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000625sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000626])