xref: /sqlite-3.40.0/configure.ac (revision 38d69855)
1#
2# 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#    TCL_*
49#
50#        Lots of values are read in from the tclConfig.sh script,
51#        if that script is available.  This values are used for
52#        constructing and installing the TCL extension.
53#
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#
67#    TARGET_EXEEXT
68#
69#        The filename extension for executables on the
70#        target platform.  "" for Unix and ".exe" for windows.
71#
72# This configure.in file is easy to reuse on other projects.  Just
73# change the argument to AC_INIT().  And disable any features that
74# you don't need (for example BLT) by erasing or commenting out
75# the corresponding code.
76#
77AC_INIT(sqlite, m4_esyscmd([cat VERSION | tr -d '\n']))
78
79dnl Make sure the local VERSION file matches this configure script
80sqlite_version_sanity_check=`cat $srcdir/VERSION | tr -d '\n'`
81if test "$PACKAGE_VERSION" != "$sqlite_version_sanity_check" ; then
82AC_MSG_ERROR([configure script is out of date:
83 configure \$PACKAGE_VERSION = $PACKAGE_VERSION
84 top level VERSION file     = $sqlite_version_sanity_check
85please regen with autoconf])
86fi
87
88#########
89# Programs needed
90#
91AC_PROG_LIBTOOL
92AC_PROG_INSTALL
93
94#########
95# Enable large file support (if special flags are necessary)
96#
97AC_SYS_LARGEFILE
98
99#########
100# Check for needed/wanted data types
101AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t,
102                uint16_t, uint32_t, uint64_t, uintptr_t])
103
104#########
105# Check for needed/wanted headers
106AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h])
107
108#########
109# Figure out whether or not we have these functions
110#
111AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime])
112
113#########
114# By default, we use the amalgamation (this may be changed below...)
115#
116USE_AMALGAMATION=1
117
118#########
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.6 tclsh8.5 tclsh], none)
124if test "$TCLSH_CMD" = "none"; then
125  # If we can't find a local tclsh, then building the amalgamation will fail.
126  # We act as though --disable-amalgamation has been used.
127  echo "Warning: can't find tclsh - defaulting to non-amalgamation build."
128  USE_AMALGAMATION=0
129  TCLSH_CMD="tclsh"
130fi
131AC_SUBST(TCLSH_CMD)
132
133AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin])
134if test "x${TCLLIBDIR+set}" != "xset" ; then
135  TCLLIBDIR='$(libdir)'
136  for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do
137    TCLLIBDIR=$i
138    break
139  done
140  TCLLIBDIR="${TCLLIBDIR}/sqlite3"
141fi
142
143
144#########
145# Set up an appropriate program prefix
146#
147if test "$program_prefix" = "NONE"; then
148  program_prefix=""
149fi
150AC_SUBST(program_prefix)
151
152VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
153AC_MSG_NOTICE(Version set to $VERSION)
154AC_SUBST(VERSION)
155RELEASE=`cat $srcdir/VERSION`
156AC_MSG_NOTICE(Release set to $RELEASE)
157AC_SUBST(RELEASE)
158VERSION_NUMBER=[`cat $srcdir/VERSION \
159                           | sed 's/[^0-9]/ /g' \
160                | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
161AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
162AC_SUBST(VERSION_NUMBER)
163
164#########
165# Locate a compiler for the build machine.  This compiler should
166# generate command-line programs that run on the build machine.
167#
168if test x"$cross_compiling" = xno; then
169	BUILD_CC=$CC
170	BUILD_CFLAGS=$CFLAGS
171else
172	if test "${BUILD_CC+set}" != set; then
173		AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
174	fi
175	if test "${BUILD_CFLAGS+set}" != set; then
176		BUILD_CFLAGS="-g"
177	fi
178fi
179AC_SUBST(BUILD_CC)
180
181##########
182# Do we want to support multithreaded use of sqlite
183#
184AC_ARG_ENABLE(threadsafe,
185AC_HELP_STRING([--disable-threadsafe],[Disable mutexing]),,enable_threadsafe=yes)
186AC_MSG_CHECKING([whether to support threadsafe operation])
187if test "$enable_threadsafe" = "no"; then
188  SQLITE_THREADSAFE=0
189  AC_MSG_RESULT([no])
190else
191  SQLITE_THREADSAFE=1
192  AC_MSG_RESULT([yes])
193fi
194AC_SUBST(SQLITE_THREADSAFE)
195
196if test "$SQLITE_THREADSAFE" = "1"; then
197  AC_SEARCH_LIBS(pthread_create, pthread)
198  AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
199fi
200
201##########
202# Do we want to support release
203#
204AC_ARG_ENABLE(releasemode,
205AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
206AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
207if test "$enable_releasemode" = "no"; then
208  ALLOWRELEASE=""
209  AC_MSG_RESULT([no])
210else
211  ALLOWRELEASE="-release `cat $srcdir/VERSION`"
212  AC_MSG_RESULT([yes])
213fi
214AC_SUBST(ALLOWRELEASE)
215
216##########
217# Do we want temporary databases in memory
218#
219AC_ARG_ENABLE(tempstore,
220AC_HELP_STRING([--enable-tempstore],[Use an in-ram database for temporary tables (never,no,yes,always)]),,enable_tempstore=no)
221AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
222case "$enable_tempstore" in
223  never )
224    TEMP_STORE=0
225    AC_MSG_RESULT([never])
226  ;;
227  no )
228    TEMP_STORE=1
229    AC_MSG_RESULT([no])
230  ;;
231  yes )
232     TEMP_STORE=2
233    AC_MSG_RESULT([yes])
234  ;;
235  always )
236     TEMP_STORE=3
237    AC_MSG_RESULT([always])
238  ;;
239  * )
240    TEMP_STORE=1
241    AC_MSG_RESULT([no])
242  ;;
243esac
244
245AC_SUBST(TEMP_STORE)
246
247###########
248# Lots of things are different if we are compiling for Windows using
249# the CYGWIN environment.  So check for that special case and handle
250# things accordingly.
251#
252AC_MSG_CHECKING([if executables have the .exe suffix])
253if test "$config_BUILD_EXEEXT" = ".exe"; then
254  CYGWIN=yes
255  AC_MSG_RESULT(yes)
256else
257  AC_MSG_RESULT(unknown)
258fi
259if test "$CYGWIN" != "yes"; then
260  AC_CYGWIN
261fi
262if test "$CYGWIN" = "yes"; then
263  BUILD_EXEEXT=.exe
264else
265  BUILD_EXEEXT=$EXEEXT
266fi
267if test x"$cross_compiling" = xno; then
268  TARGET_EXEEXT=$BUILD_EXEEXT
269else
270  TARGET_EXEEXT=$config_TARGET_EXEEXT
271fi
272if test "$TARGET_EXEEXT" = ".exe"; then
273  SQLITE_OS_UNIX=0
274  SQLITE_OS_WIN=1
275  CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
276else
277  SQLITE_OS_UNIX=1
278  SQLITE_OS_WIN=0
279  CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
280fi
281
282AC_SUBST(BUILD_EXEEXT)
283AC_SUBST(SQLITE_OS_UNIX)
284AC_SUBST(SQLITE_OS_WIN)
285AC_SUBST(TARGET_EXEEXT)
286
287##########
288# Figure out all the parameters needed to compile against Tcl.
289#
290# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
291# macros in the in the tcl.m4 file of the standard TCL distribution.
292# Those macros could not be used directly since we have to make some
293# minor changes to accomodate systems that do not have TCL installed.
294#
295AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
296      [use_tcl=$enableval],[use_tcl=yes])
297if test "${use_tcl}" = "yes" ; then
298  AC_ARG_WITH(tcl, AC_HELP_STRING([--with-tcl=DIR],[directory containing tcl configuration (tclConfig.sh)]), with_tclconfig=${withval})
299  AC_MSG_CHECKING([for Tcl configuration])
300  AC_CACHE_VAL(ac_cv_c_tclconfig,[
301    # First check to see if --with-tcl was specified.
302    if test x"${with_tclconfig}" != x ; then
303      if test -f "${with_tclconfig}/tclConfig.sh" ; then
304        ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
305      else
306        AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
307      fi
308    fi
309
310    # Start autosearch by asking tclsh
311    if test x"${ac_cv_c_tclconfig}" = x ; then
312      if test x"$cross_compiling" = xno; then
313        for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
314        do
315          if test -f "$i/tclConfig.sh" ; then
316            ac_cv_c_tclconfig="$i"
317            break
318          fi
319        done
320      fi
321    fi
322
323    # On ubuntu 14.10, $auto_path on tclsh is not quite correct.
324    # So try again after applying corrections.
325    if test x"${ac_cv_c_tclconfig}" = x ; then
326      if test x"$cross_compiling" = xno; then
327        for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'`
328        do
329          if test -f "$i/tclConfig.sh" ; then
330            ac_cv_c_tclconfig="$i"
331            break
332          fi
333        done
334      fi
335    fi
336
337    # then check for a private Tcl installation
338    if test x"${ac_cv_c_tclconfig}" = x ; then
339      for i in \
340            ../tcl \
341            `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
342            `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
343            `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
344            ../../tcl \
345            `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
346            `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
347            `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
348            ../../../tcl \
349            `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
350            `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
351            `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
352      do
353        if test -f "$i/unix/tclConfig.sh" ; then
354          ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
355          break
356        fi
357      done
358    fi
359
360    # check in a few common install locations
361    if test x"${ac_cv_c_tclconfig}" = x ; then
362      for i in \
363            `ls -d ${libdir} 2>/dev/null` \
364            `ls -d /usr/local/lib 2>/dev/null` \
365            `ls -d /usr/contrib/lib 2>/dev/null` \
366            `ls -d /usr/lib 2>/dev/null`
367      do
368        if test -f "$i/tclConfig.sh" ; then
369           ac_cv_c_tclconfig=`(cd $i; pwd)`
370           break
371        fi
372      done
373    fi
374
375    # check in a few other private locations
376    if test x"${ac_cv_c_tclconfig}" = x ; then
377      for i in \
378         ${srcdir}/../tcl \
379         `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
380         `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
381         `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
382      do
383        if test -f "$i/unix/tclConfig.sh" ; then
384          ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
385          break
386        fi
387      done
388    fi
389  ])
390
391  if test x"${ac_cv_c_tclconfig}" = x ; then
392    use_tcl=no
393    AC_MSG_WARN(Can't find Tcl configuration definitions)
394    AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
395    AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
396  else
397    TCL_BIN_DIR=${ac_cv_c_tclconfig}
398    AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
399
400    AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
401    if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
402      AC_MSG_RESULT([loading])
403      . $TCL_BIN_DIR/tclConfig.sh
404    else
405      AC_MSG_RESULT([file not found])
406    fi
407
408    #
409    # If the TCL_BIN_DIR is the build directory (not the install directory),
410    # then set the common variable name to the value of the build variables.
411    # For example, the variable TCL_LIB_SPEC will be set to the value
412    # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
413    # instead of TCL_BUILD_LIB_SPEC since it will work with both an
414    # installed and uninstalled version of Tcl.
415    #
416
417    if test -f $TCL_BIN_DIR/Makefile ; then
418      TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
419      TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
420      TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
421    fi
422
423    #
424    # eval is required to do the TCL_DBGX substitution
425    #
426
427    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
428    eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
429    eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
430
431    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
432    eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
433    eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
434
435    AC_SUBST(TCL_VERSION)
436    AC_SUBST(TCL_BIN_DIR)
437    AC_SUBST(TCL_SRC_DIR)
438    AC_SUBST(TCL_INCLUDE_SPEC)
439
440    AC_SUBST(TCL_LIB_FILE)
441    AC_SUBST(TCL_LIB_FLAG)
442    AC_SUBST(TCL_LIB_SPEC)
443
444    AC_SUBST(TCL_STUB_LIB_FILE)
445    AC_SUBST(TCL_STUB_LIB_FLAG)
446    AC_SUBST(TCL_STUB_LIB_SPEC)
447    AC_SUBST(TCL_SHLIB_SUFFIX)
448  fi
449fi
450if test "${use_tcl}" = "no" ; then
451  HAVE_TCL=""
452else
453  HAVE_TCL=1
454fi
455AC_SUBST(HAVE_TCL)
456
457##########
458# Figure out what C libraries are required to compile programs
459# that use "readline()" library.
460#
461TARGET_READLINE_LIBS=""
462TARGET_READLINE_INC=""
463TARGET_HAVE_READLINE=0
464TARGET_HAVE_EDITLINE=0
465AC_ARG_ENABLE([editline],
466	[AC_HELP_STRING([--enable-editline],[enable BSD editline support])],
467	[with_editline=$enableval],
468	[with_editline=auto])
469AC_ARG_ENABLE([readline],
470	[AC_HELP_STRING([--disable-readline],[disable readline support])],
471	[with_readline=$enableval],
472	[with_readline=auto])
473
474if test x"$with_editline" != xno; then
475        sLIBS=$LIBS
476        LIBS=""
477	TARGET_HAVE_EDITLINE=1
478	AC_SEARCH_LIBS(readline,edit,[with_readline=no],[TARGET_HAVE_EDITLINE=0])
479        TARGET_READLINE_LIBS=$LIBS
480        LIBS=$sLIBS
481fi
482if test x"$with_readline" != xno; then
483	found="yes"
484
485	AC_ARG_WITH([readline-lib],
486		[AC_HELP_STRING([--with-readline-lib],[specify readline library])],
487		[with_readline_lib=$withval],
488		[with_readline_lib="auto"])
489	if test "x$with_readline_lib" = xauto; then
490		save_LIBS="$LIBS"
491		LIBS=""
492		AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
493		AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
494		TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
495		LIBS="$save_LIBS"
496	else
497		TARGET_READLINE_LIBS="$with_readline_lib"
498	fi
499
500	AC_ARG_WITH([readline-inc],
501		[AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
502		[with_readline_inc=$withval],
503		[with_readline_inc="auto"])
504	if test "x$with_readline_inc" = xauto; then
505		AC_CHECK_HEADER(readline.h, [found="yes"], [
506			found="no"
507			if test "$cross_compiling" != yes; then
508				for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
509					for subdir in include include/readline; do
510						AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
511						if test "$found" = "yes"; then
512							TARGET_READLINE_INC="-I$dir/$subdir"
513							break
514						fi
515					done
516					test "$found" = "yes" && break
517				done
518			fi
519		])
520	else
521		TARGET_READLINE_INC="$with_readline_inc"
522	fi
523
524	if test x"$found" = xno; then
525		TARGET_READLINE_LIBS=""
526		TARGET_READLINE_INC=""
527		TARGET_HAVE_READLINE=0
528	else
529		TARGET_HAVE_READLINE=1
530	fi
531fi
532
533AC_SUBST(TARGET_READLINE_LIBS)
534AC_SUBST(TARGET_READLINE_INC)
535AC_SUBST(TARGET_HAVE_READLINE)
536AC_SUBST(TARGET_HAVE_EDITLINE)
537
538##########
539# Figure out what C libraries are required to compile programs
540# that use "fdatasync()" function.
541#
542AC_SEARCH_LIBS(fdatasync, [rt])
543
544#########
545# check for debug enabled
546AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
547      [use_debug=$enableval],[use_debug=no])
548if test "${use_debug}" = "yes" ; then
549  TARGET_DEBUG="-DSQLITE_DEBUG=1"
550else
551  TARGET_DEBUG="-DNDEBUG"
552fi
553AC_SUBST(TARGET_DEBUG)
554
555#########
556# See whether we should use the amalgamation to build
557AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
558      [Disable the amalgamation and instead build all files separately]),
559      [use_amalgamation=$enableval],[use_amalgamation=yes])
560if test "${use_amalgamation}" != "yes" ; then
561  USE_AMALGAMATION=0
562fi
563AC_SUBST(USE_AMALGAMATION)
564
565#########
566# See whether we should allow loadable extensions
567AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension],
568      [Disable loading of external extensions]),
569      [use_loadextension=$enableval],[use_loadextension=yes])
570if test "${use_loadextension}" = "yes" ; then
571  OPT_FEATURE_FLAGS=""
572  AC_SEARCH_LIBS(dlopen, dl)
573else
574  OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
575fi
576
577#########
578# See whether we should enable Full Text Search extensions
579AC_ARG_ENABLE(fts3, AC_HELP_STRING([--enable-fts3],
580      [Enable the FTS3 extension]),
581      [enable_fts3=yes],[enable_fts3=no])
582if test "${enable_fts3}" = "yes" ; then
583  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS3"
584fi
585AC_ARG_ENABLE(fts4, AC_HELP_STRING([--enable-fts4],
586      [Enable the FTS4 extension]),
587      [enable_fts4=yes],[enable_fts4=no])
588if test "${enable_fts4}" = "yes" ; then
589  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS4"
590  AC_SEARCH_LIBS([log],[m])
591fi
592AC_ARG_ENABLE(fts5, AC_HELP_STRING([--enable-fts5],
593      [Enable the FTS5 extension]),
594      [enable_fts5=yes],[enable_fts5=no])
595if test "${enable_fts5}" = "yes" ; then
596  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS5"
597  AC_SEARCH_LIBS([log],[m])
598fi
599
600#########
601# See whether we should enable JSON1
602AC_ARG_ENABLE(json1, AC_HELP_STRING([--enable-json1],
603      [Enable the JSON1 extension]),
604      [enable_json1=yes],[enable_json1=no])
605if test "${enable_json1}" = "yes" ; then
606  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_JSON1"
607fi
608
609#########
610# See whether we should enable RTREE
611AC_ARG_ENABLE(rtree, AC_HELP_STRING([--enable-rtree],
612      [Enable the RTREE extension]),
613      [enable_rtree=yes],[enable_rtree=no])
614if test "${enable_rtree}" = "yes" ; then
615  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_RTREE"
616fi
617
618#########
619# attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
620for option in $CFLAGS $CPPFLAGS
621do
622  case $option in
623    -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
624    -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
625  esac
626done
627AC_SUBST(OPT_FEATURE_FLAGS)
628
629
630# attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
631ac_temp_CFLAGS=""
632for option in $CFLAGS
633do
634  case $option in
635    -DSQLITE_OMIT*) ;;
636    -DSQLITE_ENABLE*) ;;
637    *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
638  esac
639done
640CFLAGS=$ac_temp_CFLAGS
641
642
643# attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
644ac_temp_CPPFLAGS=""
645for option in $CPPFLAGS
646do
647  case $option in
648    -DSQLITE_OMIT*) ;;
649    -DSQLITE_ENABLE*) ;;
650    *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
651  esac
652done
653CPPFLAGS=$ac_temp_CPPFLAGS
654
655
656# attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
657ac_temp_BUILD_CFLAGS=""
658for option in $BUILD_CFLAGS
659do
660  case $option in
661    -DSQLITE_OMIT*) ;;
662    -DSQLITE_ENABLE*) ;;
663    *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
664  esac
665done
666BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
667
668
669#########
670# See whether we should use GCOV
671AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
672      [Enable coverage testing using gcov]),
673      [use_gcov=$enableval],[use_gcov=no])
674if test "${use_gcov}" = "yes" ; then
675  USE_GCOV=1
676else
677  USE_GCOV=0
678fi
679AC_SUBST(USE_GCOV)
680
681
682#########
683# Output the config header
684AC_CONFIG_HEADERS(config.h)
685
686#########
687# Generate the output files.
688#
689AC_SUBST(BUILD_CFLAGS)
690AC_OUTPUT([
691Makefile
692sqlite3.pc
693])
694