Make sure all the auto-extension mechanism function signatures match up precisely.
[sqlite.git] / configure.ac
blobc9e3af922089505f72f0d680b5b1fae78f5cf339
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:
7 #    srcdir
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.
13 #    bindir
15 #        The name of the directory where executables should be
16 #        written by the "install" target of the makefile.
18 #    program_prefix
20 #        Add this prefix to the names of all executables that run
21 #        on the target machine.  Default: ""
23 #    ENABLE_SHARED
25 #        True if shared libraries should be generated.
27 #    BUILD_CC
29 #        The name of a command that is used to convert C
30 #        source files into executables that run on the build
31 #        platform.
33 #    BUILD_CFLAGS
35 #        Switches that the build compiler needs in order to construct
36 #        command-line programs.
38 #    BUILD_LIBS
40 #        Libraries that the build compiler needs in order to construct
41 #        command-line programs.
43 #    BUILD_EXEEXT
45 #        The filename extension for executables on the build
46 #        platform.  "" for Unix and ".exe" for Windows.
48 #    TCL_*
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.
54 #    TARGET_READLINE_LIBS
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".
61 #    TARGET_READLINE_INC
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.
67 #    TARGET_EXEEXT
69 #        The filename extension for executables on the
70 #        target platform.  "" for Unix and ".exe" for windows.
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.
77 AC_INIT(sqlite, m4_esyscmd([cat VERSION | tr -d '\n']))
79 dnl Make sure the local VERSION file matches this configure script
80 sqlite_version_sanity_check=`cat $srcdir/VERSION | tr -d '\n'`
81 if test "$PACKAGE_VERSION" != "$sqlite_version_sanity_check" ; then
82 AC_MSG_ERROR([configure script is out of date:
83  configure \$PACKAGE_VERSION = $PACKAGE_VERSION
84  top level VERSION file     = $sqlite_version_sanity_check
85 please regen with autoconf])
88 #########
89 # Programs needed
91 AC_PROG_LIBTOOL
92 AC_PROG_INSTALL
94 #########
95 # Enable large file support (if special flags are necessary)
97 AC_SYS_LARGEFILE
99 #########
100 # Check for needed/wanted data types
101 AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t,
102                 uint16_t, uint32_t, uint64_t, uintptr_t])
104 #########
105 # Check for needed/wanted headers
106 AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h])
108 #########
109 # Figure out whether or not we have these functions
111 AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64])
113 #########
114 # By default, we use the amalgamation (this may be changed below...)
116 USE_AMALGAMATION=1
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?
123 AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.6 tclsh8.5 tclsh], none)
124 if 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"
131 AC_SUBST(TCLSH_CMD)
133 AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin])
134 if 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"
144 #########
145 # Set up an appropriate program prefix
147 if test "$program_prefix" = "NONE"; then
148   program_prefix=""
150 AC_SUBST(program_prefix)
152 VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
153 AC_MSG_NOTICE(Version set to $VERSION)
154 AC_SUBST(VERSION)
155 RELEASE=`cat $srcdir/VERSION`
156 AC_MSG_NOTICE(Release set to $RELEASE)
157 AC_SUBST(RELEASE)
158 VERSION_NUMBER=[`cat $srcdir/VERSION \
159                            | sed 's/[^0-9]/ /g' \
160                 | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
161 AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
162 AC_SUBST(VERSION_NUMBER)
164 #########
165 # Locate a compiler for the build machine.  This compiler should
166 # generate command-line programs that run on the build machine.
168 if test x"$cross_compiling" = xno; then
169         BUILD_CC=$CC
170         BUILD_CFLAGS=$CFLAGS
171 else
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
179 AC_SUBST(BUILD_CC)
181 ##########
182 # Do we want to support multithreaded use of sqlite
184 AC_ARG_ENABLE(threadsafe, 
185 AC_HELP_STRING([--disable-threadsafe],[Disable mutexing]),,enable_threadsafe=yes)
186 AC_MSG_CHECKING([whether to support threadsafe operation])
187 if test "$enable_threadsafe" = "no"; then
188   SQLITE_THREADSAFE=0
189   AC_MSG_RESULT([no])
190 else
191   SQLITE_THREADSAFE=1
192   AC_MSG_RESULT([yes])
194 AC_SUBST(SQLITE_THREADSAFE)
196 if test "$SQLITE_THREADSAFE" = "1"; then
197   AC_SEARCH_LIBS(pthread_create, pthread)
198   AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
201 ##########
202 # Do we want to support release
204 AC_ARG_ENABLE(releasemode, 
205 AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
206 AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
207 if test "$enable_releasemode" = "no"; then
208   ALLOWRELEASE=""
209   AC_MSG_RESULT([no])
210 else
211   ALLOWRELEASE="-release `cat $srcdir/VERSION`"
212   AC_MSG_RESULT([yes])
214 AC_SUBST(ALLOWRELEASE)
216 ##########
217 # Do we want temporary databases in memory
219 AC_ARG_ENABLE(tempstore, 
220 AC_HELP_STRING([--enable-tempstore],[Use an in-ram database for temporary tables (never,no,yes,always)]),,enable_tempstore=no)
221 AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
222 case "$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   ;;
243 esac
245 AC_SUBST(TEMP_STORE)
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.
252 AC_MSG_CHECKING([if executables have the .exe suffix])
253 if test "$config_BUILD_EXEEXT" = ".exe"; then
254   CYGWIN=yes
255   AC_MSG_RESULT(yes)
256 else
257   AC_MSG_RESULT(unknown)
259 if test "$CYGWIN" != "yes"; then
260   AC_CYGWIN
262 if test "$CYGWIN" = "yes"; then
263   BUILD_EXEEXT=.exe
264 else
265   BUILD_EXEEXT=$EXEEXT
267 if test x"$cross_compiling" = xno; then
268   TARGET_EXEEXT=$BUILD_EXEEXT
269 else
270   TARGET_EXEEXT=$config_TARGET_EXEEXT
272 if test "$TARGET_EXEEXT" = ".exe"; then
273   SQLITE_OS_UNIX=0
274   SQLITE_OS_WIN=1
275   CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
276 else
277   SQLITE_OS_UNIX=1
278   SQLITE_OS_WIN=0
279   CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
282 AC_SUBST(BUILD_EXEEXT)
283 AC_SUBST(SQLITE_OS_UNIX)
284 AC_SUBST(SQLITE_OS_WIN)
285 AC_SUBST(TARGET_EXEEXT)
287 ##########
288 # Figure out all the parameters needed to compile against Tcl.
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.
295 AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
296       [use_tcl=$enableval],[use_tcl=yes])
297 if 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
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
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
337     # Recent versions of Xcode on Macs hid the tclConfig.sh file
338     # in a strange place.
339     if test x"${ac_cv_c_tclconfig}" = x ; then
340       if test x"$cross_compiling" = xno; then
341         for i in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk/usr/lib
342         do
343           if test -f "$i/tclConfig.sh" ; then
344             ac_cv_c_tclconfig="$i"
345             break
346           fi
347         done
348       fi
349     fi
351     # then check for a private Tcl installation
352     if test x"${ac_cv_c_tclconfig}" = x ; then
353       for i in \
354             ../tcl \
355             `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
356             `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
357             `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
358             ../../tcl \
359             `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
360             `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
361             `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
362             ../../../tcl \
363             `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
364             `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
365             `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
366       do
367         if test -f "$i/unix/tclConfig.sh" ; then
368           ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
369           break
370         fi
371       done
372     fi
374     # check in a few common install locations
375     if test x"${ac_cv_c_tclconfig}" = x ; then
376       for i in \
377             `ls -d ${libdir} 2>/dev/null` \
378             `ls -d /usr/local/lib 2>/dev/null` \
379             `ls -d /usr/contrib/lib 2>/dev/null` \
380             `ls -d /usr/lib 2>/dev/null`
381       do
382         if test -f "$i/tclConfig.sh" ; then
383            ac_cv_c_tclconfig=`(cd $i; pwd)`
384            break
385         fi
386       done
387     fi
389     # check in a few other private locations
390     if test x"${ac_cv_c_tclconfig}" = x ; then
391       for i in \
392          ${srcdir}/../tcl \
393          `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
394          `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
395          `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
396       do
397         if test -f "$i/unix/tclConfig.sh" ; then
398           ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
399           break
400         fi
401       done
402     fi
403   ])
405   if test x"${ac_cv_c_tclconfig}" = x ; then
406     use_tcl=no
407     AC_MSG_WARN(Can't find Tcl configuration definitions)
408     AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
409     AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
410   else
411     TCL_BIN_DIR=${ac_cv_c_tclconfig}
412     AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
414     AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
415     if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
416       AC_MSG_RESULT([loading])
417       . $TCL_BIN_DIR/tclConfig.sh
418     else
419       AC_MSG_RESULT([file not found])
420     fi
421     
422     #
423     # If the TCL_BIN_DIR is the build directory (not the install directory),
424     # then set the common variable name to the value of the build variables.
425     # For example, the variable TCL_LIB_SPEC will be set to the value
426     # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
427     # instead of TCL_BUILD_LIB_SPEC since it will work with both an
428     # installed and uninstalled version of Tcl.
429     #
430     
431     if test -f $TCL_BIN_DIR/Makefile ; then
432       TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
433       TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
434       TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
435     fi
436     
437     #
438     # eval is required to do the TCL_DBGX substitution
439     #
440     
441     eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
442     eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
443     eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
444     
445     eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
446     eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
447     eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
448     
449     AC_SUBST(TCL_VERSION)
450     AC_SUBST(TCL_BIN_DIR)
451     AC_SUBST(TCL_SRC_DIR)
452     AC_SUBST(TCL_INCLUDE_SPEC)
453     
454     AC_SUBST(TCL_LIB_FILE)
455     AC_SUBST(TCL_LIB_FLAG)
456     AC_SUBST(TCL_LIB_SPEC)
457     
458     AC_SUBST(TCL_STUB_LIB_FILE)
459     AC_SUBST(TCL_STUB_LIB_FLAG)
460     AC_SUBST(TCL_STUB_LIB_SPEC)
461     AC_SUBST(TCL_SHLIB_SUFFIX)
462   fi
464 if test "${use_tcl}" = "no" ; then
465   HAVE_TCL=""
466 else
467   HAVE_TCL=1
469 AC_SUBST(HAVE_TCL)
471 ##########
472 # Figure out what C libraries are required to compile programs
473 # that use "readline()" library.
475 TARGET_READLINE_LIBS=""
476 TARGET_READLINE_INC=""
477 TARGET_HAVE_READLINE=0
478 TARGET_HAVE_EDITLINE=0
479 AC_ARG_ENABLE([editline],
480         [AC_HELP_STRING([--enable-editline],[enable BSD editline support])],
481         [with_editline=$enableval],
482         [with_editline=auto])
483 AC_ARG_ENABLE([readline],
484         [AC_HELP_STRING([--disable-readline],[disable readline support])],
485         [with_readline=$enableval],
486         [with_readline=auto])
488 if test x"$with_editline" != xno; then
489         sLIBS=$LIBS
490         LIBS=""
491         TARGET_HAVE_EDITLINE=1
492         AC_SEARCH_LIBS(readline,edit,[with_readline=no],[TARGET_HAVE_EDITLINE=0])
493         TARGET_READLINE_LIBS=$LIBS
494         LIBS=$sLIBS
496 if test x"$with_readline" != xno; then
497         found="yes"
499         AC_ARG_WITH([readline-lib],
500                 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
501                 [with_readline_lib=$withval],
502                 [with_readline_lib="auto"])
503         if test "x$with_readline_lib" = xauto; then
504                 save_LIBS="$LIBS"
505                 LIBS=""
506                 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
507                 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
508                 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
509                 LIBS="$save_LIBS"
510         else
511                 TARGET_READLINE_LIBS="$with_readline_lib"
512         fi
514         AC_ARG_WITH([readline-inc],
515                 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
516                 [with_readline_inc=$withval],
517                 [with_readline_inc="auto"])
518         if test "x$with_readline_inc" = xauto; then
519                 AC_CHECK_HEADER(readline.h, [found="yes"], [
520                         found="no"
521                         if test "$cross_compiling" != yes; then
522                                 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
523                                         for subdir in include include/readline; do
524                                                 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
525                                                 if test "$found" = "yes"; then
526                                                         TARGET_READLINE_INC="-I$dir/$subdir"
527                                                         break
528                                                 fi
529                                         done
530                                         test "$found" = "yes" && break
531                                 done
532                         fi
533                 ])
534         else
535                 TARGET_READLINE_INC="$with_readline_inc"
536         fi
538         if test x"$found" = xno; then
539                 TARGET_READLINE_LIBS=""
540                 TARGET_READLINE_INC=""
541                 TARGET_HAVE_READLINE=0
542         else
543                 TARGET_HAVE_READLINE=1
544         fi
547 AC_SUBST(TARGET_READLINE_LIBS)
548 AC_SUBST(TARGET_READLINE_INC)
549 AC_SUBST(TARGET_HAVE_READLINE)
550 AC_SUBST(TARGET_HAVE_EDITLINE)
552 ##########
553 # Figure out what C libraries are required to compile programs
554 # that use "fdatasync()" function.
556 AC_SEARCH_LIBS(fdatasync, [rt])
558 #########
559 # check for debug enabled
560 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
561       [use_debug=$enableval],[use_debug=no])
562 if test "${use_debug}" = "yes" ; then
563   TARGET_DEBUG="-DSQLITE_DEBUG=1"
564 else
565   TARGET_DEBUG="-DNDEBUG"
567 AC_SUBST(TARGET_DEBUG)
569 #########
570 # See whether we should use the amalgamation to build
571 AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
572       [Disable the amalgamation and instead build all files separately]),
573       [use_amalgamation=$enableval],[use_amalgamation=yes])
574 if test "${use_amalgamation}" != "yes" ; then
575   USE_AMALGAMATION=0
577 AC_SUBST(USE_AMALGAMATION)
579 #########
580 # See whether we should allow loadable extensions
581 AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension],
582       [Disable loading of external extensions]),
583       [use_loadextension=$enableval],[use_loadextension=yes])
584 if test "${use_loadextension}" = "yes" ; then
585   OPT_FEATURE_FLAGS=""
586   AC_SEARCH_LIBS(dlopen, dl)
587 else
588   OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
591 ##########
592 # Do we want to support memsys3 and/or memsys5
594 AC_ARG_ENABLE(memsys5, 
595   AC_HELP_STRING([--enable-memsys5],[Enable MEMSYS5]),
596   [enable_memsys5=yes],[enable_memsys5=no])
597 AC_MSG_CHECKING([whether to support MEMSYS5])
598 if test "${enable_memsys5}" = "yes"; then
599   OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_MEMSYS5"
600   AC_MSG_RESULT([yes])
601 else
602   AC_MSG_RESULT([no])
604 AC_ARG_ENABLE(memsys3, 
605   AC_HELP_STRING([--enable-memsys3],[Enable MEMSYS3]),
606   [enable_memsys3=yes],[enable_memsys3=no])
607 AC_MSG_CHECKING([whether to support MEMSYS3])
608 if test "${enable_memsys3}" = "yes" -a "${enable_memsys5}" = "no"; then
609   OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_MEMSYS3"
610   AC_MSG_RESULT([yes])
611 else
612   AC_MSG_RESULT([no])
615 #########
616 # See whether we should enable Full Text Search extensions
617 AC_ARG_ENABLE(fts3, AC_HELP_STRING([--enable-fts3],
618       [Enable the FTS3 extension]),
619       [enable_fts3=yes],[enable_fts3=no])
620 if test "${enable_fts3}" = "yes" ; then
621   OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS3"
623 AC_ARG_ENABLE(fts4, AC_HELP_STRING([--enable-fts4],
624       [Enable the FTS4 extension]),
625       [enable_fts4=yes],[enable_fts4=no])
626 if test "${enable_fts4}" = "yes" ; then
627   OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS4"
628   AC_SEARCH_LIBS([log],[m])
630 AC_ARG_ENABLE(fts5, AC_HELP_STRING([--enable-fts5],
631       [Enable the FTS5 extension]),
632       [enable_fts5=yes],[enable_fts5=no])
633 if test "${enable_fts5}" = "yes" ; then
634   OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS5"
635   AC_SEARCH_LIBS([log],[m])
638 #########
639 # See whether we should enable JSON1
640 AC_ARG_ENABLE(json1, AC_HELP_STRING([--enable-json1],
641       [Enable the JSON1 extension]),
642       [enable_json1=yes],[enable_json1=no])
643 if test "${enable_json1}" = "yes" ; then
644   OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_JSON1"
647 #########
648 # See whether we should enable RTREE
649 AC_ARG_ENABLE(rtree, AC_HELP_STRING([--enable-rtree],
650       [Enable the RTREE extension]),
651       [enable_rtree=yes],[enable_rtree=no])
652 if test "${enable_rtree}" = "yes" ; then
653   OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_RTREE"
656 #########
657 # See whether we should enable the SESSION extension
658 AC_ARG_ENABLE(session, AC_HELP_STRING([--enable-session],
659       [Enable the SESSION extension]),
660       [enable_session=yes],[enable_session=no])
661 if test "${enable_session}" = "yes" ; then
662   OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_SESSION"
663   OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_PREUPDATE_HOOK"
666 #########
667 # attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
668 for option in $CFLAGS $CPPFLAGS
670   case $option in
671     -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
672     -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
673   esac
674 done
675 AC_SUBST(OPT_FEATURE_FLAGS)
678 # attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
679 ac_temp_CFLAGS=""
680 for option in $CFLAGS
682   case $option in
683     -DSQLITE_OMIT*) ;;
684     -DSQLITE_ENABLE*) ;;
685     *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
686   esac
687 done
688 CFLAGS=$ac_temp_CFLAGS
691 # attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
692 ac_temp_CPPFLAGS=""
693 for option in $CPPFLAGS
695   case $option in
696     -DSQLITE_OMIT*) ;;
697     -DSQLITE_ENABLE*) ;;
698     *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
699   esac
700 done
701 CPPFLAGS=$ac_temp_CPPFLAGS
704 # attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
705 ac_temp_BUILD_CFLAGS=""
706 for option in $BUILD_CFLAGS
708   case $option in
709     -DSQLITE_OMIT*) ;;
710     -DSQLITE_ENABLE*) ;;
711     *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
712   esac
713 done
714 BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
717 #########
718 # See whether we should use GCOV
719 AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
720       [Enable coverage testing using gcov]),
721       [use_gcov=$enableval],[use_gcov=no])
722 if test "${use_gcov}" = "yes" ; then
723   USE_GCOV=1
724 else
725   USE_GCOV=0
727 AC_SUBST(USE_GCOV)
730 #########
731 # Output the config header
732 AC_CONFIG_HEADERS(config.h)
734 #########
735 # Generate the output files.
737 AC_SUBST(BUILD_CFLAGS)
738 AC_OUTPUT([
739 Makefile
740 sqlite3.pc