Snapshot of upstream SQLite 3.37.2
[sqlcipher.git] / configure.ac
blob32fe0d229a3a23d6db32cd0fdb28f5aa596174ff
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.7 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     if test -d $i ; then
138       TCLLIBDIR=$i
139       break
140     fi
141   done
142   TCLLIBDIR="${TCLLIBDIR}/sqlite3"
146 #########
147 # Set up an appropriate program prefix
149 if test "$program_prefix" = "NONE"; then
150   program_prefix=""
152 AC_SUBST(program_prefix)
154 VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
155 AC_MSG_NOTICE(Version set to $VERSION)
156 AC_SUBST(VERSION)
157 RELEASE=`cat $srcdir/VERSION`
158 AC_MSG_NOTICE(Release set to $RELEASE)
159 AC_SUBST(RELEASE)
161 #########
162 # Locate a compiler for the build machine.  This compiler should
163 # generate command-line programs that run on the build machine.
165 if test x"$cross_compiling" = xno; then
166         BUILD_CC=$CC
167         BUILD_CFLAGS=$CFLAGS
168 else
169         if test "${BUILD_CC+set}" != set; then
170                 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
171         fi
172         if test "${BUILD_CFLAGS+set}" != set; then
173                 BUILD_CFLAGS="-g"
174         fi
176 AC_SUBST(BUILD_CC)
178 ##########
179 # Do we want to support multithreaded use of sqlite
181 AC_ARG_ENABLE(threadsafe, 
182 AC_HELP_STRING([--disable-threadsafe],[Disable mutexing]))
183 AC_MSG_CHECKING([whether to support threadsafe operation])
184 if test "$enable_threadsafe" = "no"; then
185   SQLITE_THREADSAFE=0
186   AC_MSG_RESULT([no])
187 else
188   SQLITE_THREADSAFE=1
189   AC_MSG_RESULT([yes])
191 AC_SUBST(SQLITE_THREADSAFE)
193 if test "$SQLITE_THREADSAFE" = "1"; then
194   AC_SEARCH_LIBS(pthread_create, pthread)
195   AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
198 ##########
199 # Do we want to support release
201 AC_ARG_ENABLE(releasemode, 
202 AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
203 AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
204 if test "$enable_releasemode" = "no"; then
205   ALLOWRELEASE=""
206   AC_MSG_RESULT([no])
207 else
208   ALLOWRELEASE="-release `cat $srcdir/VERSION`"
209   AC_MSG_RESULT([yes])
211 AC_SUBST(ALLOWRELEASE)
213 ##########
214 # Do we want temporary databases in memory
216 AC_ARG_ENABLE(tempstore, 
217 AC_HELP_STRING([--enable-tempstore],[Use an in-ram database for temporary tables (never,no,yes,always)]),,enable_tempstore=no)
218 AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
219 case "$enable_tempstore" in
220   never ) 
221     TEMP_STORE=0
222     AC_MSG_RESULT([never])
223   ;;
224   no ) 
225     TEMP_STORE=1
226     AC_MSG_RESULT([no])
227   ;;
228   yes ) 
229      TEMP_STORE=2
230     AC_MSG_RESULT([yes])
231   ;;
232   always ) 
233      TEMP_STORE=3
234     AC_MSG_RESULT([always])
235   ;;
236   * ) 
237     TEMP_STORE=1
238     AC_MSG_RESULT([no])
239   ;;
240 esac
242 AC_SUBST(TEMP_STORE)
244 ###########
245 # Lots of things are different if we are compiling for Windows using
246 # the CYGWIN environment.  So check for that special case and handle
247 # things accordingly.
249 AC_MSG_CHECKING([if executables have the .exe suffix])
250 if test "$config_BUILD_EXEEXT" = ".exe"; then
251   CYGWIN=yes
252   AC_MSG_RESULT(yes)
253 else
254   AC_MSG_RESULT(unknown)
256 if test "$CYGWIN" != "yes"; then
257   AC_CYGWIN
259 if test "$CYGWIN" = "yes"; then
260   BUILD_EXEEXT=.exe
261 else
262   BUILD_EXEEXT=$EXEEXT
264 if test x"$cross_compiling" = xno; then
265   TARGET_EXEEXT=$BUILD_EXEEXT
266 else
267   TARGET_EXEEXT=$config_TARGET_EXEEXT
269 if test "$TARGET_EXEEXT" = ".exe"; then
270   SQLITE_OS_UNIX=0
271   SQLITE_OS_WIN=1
272   CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
273 else
274   SQLITE_OS_UNIX=1
275   SQLITE_OS_WIN=0
276   CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
279 AC_SUBST(BUILD_EXEEXT)
280 AC_SUBST(SQLITE_OS_UNIX)
281 AC_SUBST(SQLITE_OS_WIN)
282 AC_SUBST(TARGET_EXEEXT)
284 ##########
285 # Figure out all the parameters needed to compile against Tcl.
287 # This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
288 # macros in the in the tcl.m4 file of the standard TCL distribution.
289 # Those macros could not be used directly since we have to make some
290 # minor changes to accomodate systems that do not have TCL installed.
292 AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
293       [use_tcl=$enableval],[use_tcl=yes])
294 if test "${use_tcl}" = "yes" ; then
295   AC_ARG_WITH(tcl, AC_HELP_STRING([--with-tcl=DIR],[directory containing tcl configuration (tclConfig.sh)]), with_tclconfig=${withval})
296   AC_MSG_CHECKING([for Tcl configuration])
297   AC_CACHE_VAL(ac_cv_c_tclconfig,[
298     # First check to see if --with-tcl was specified.
299     if test x"${with_tclconfig}" != x ; then
300       if test -f "${with_tclconfig}/tclConfig.sh" ; then
301         ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
302       else
303         AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
304       fi
305     fi
307     # Start autosearch by asking tclsh
308     if test x"${ac_cv_c_tclconfig}" = x ; then
309       if test x"$cross_compiling" = xno; then
310         for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
311         do
312           if test -f "$i/tclConfig.sh" ; then
313             ac_cv_c_tclconfig="$i"
314             break
315           fi
316         done
317       fi
318     fi
320     # On ubuntu 14.10, $auto_path on tclsh is not quite correct.
321     # So try again after applying corrections.
322     if test x"${ac_cv_c_tclconfig}" = x ; then
323       if test x"$cross_compiling" = xno; then
324         for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'`
325         do
326           if test -f "$i/tclConfig.sh" ; then
327             ac_cv_c_tclconfig="$i"
328             break
329           fi
330         done
331       fi
332     fi
334     # Recent versions of Xcode on Macs hid the tclConfig.sh file
335     # in a strange place.
336     if test x"${ac_cv_c_tclconfig}" = x ; then
337       if test x"$cross_compiling" = xno; then
338         for i in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk/usr/lib
339         do
340           if test -f "$i/tclConfig.sh" ; then
341             ac_cv_c_tclconfig="$i"
342             break
343           fi
344         done
345       fi
346     fi
348     # then check for a private Tcl installation
349     if test x"${ac_cv_c_tclconfig}" = x ; then
350       for i in \
351             ../tcl \
352             `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
353             `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
354             `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
355             ../../tcl \
356             `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
357             `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
358             `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
359             ../../../tcl \
360             `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
361             `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
362             `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null`
363       do
364         if test -f "$i/unix/tclConfig.sh" ; then
365           ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
366           break
367         fi
368       done
369     fi
371     # check in a few common install locations
372     if test x"${ac_cv_c_tclconfig}" = x ; then
373       for i in \
374             `ls -d ${libdir} 2>/dev/null` \
375             `ls -d /usr/local/lib 2>/dev/null` \
376             `ls -d /usr/contrib/lib 2>/dev/null` \
377             `ls -d /usr/lib 2>/dev/null`
378       do
379         if test -f "$i/tclConfig.sh" ; then
380            ac_cv_c_tclconfig=`(cd $i; pwd)`
381            break
382         fi
383       done
384     fi
386     # check in a few other private locations
387     if test x"${ac_cv_c_tclconfig}" = x ; then
388       for i in \
389          ${srcdir}/../tcl \
390          `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
391          `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
392          `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null`
393       do
394         if test -f "$i/unix/tclConfig.sh" ; then
395           ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
396           break
397         fi
398       done
399     fi
400   ])
402   if test x"${ac_cv_c_tclconfig}" = x ; then
403     use_tcl=no
404     AC_MSG_WARN(Can't find Tcl configuration definitions)
405     AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***)
406     AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***)
407   else
408     TCL_BIN_DIR=${ac_cv_c_tclconfig}
409     AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
411     AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
412     if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
413       AC_MSG_RESULT([loading])
414       . $TCL_BIN_DIR/tclConfig.sh
415     else
416       AC_MSG_RESULT([file not found])
417     fi
418     
419     #
420     # If the TCL_BIN_DIR is the build directory (not the install directory),
421     # then set the common variable name to the value of the build variables.
422     # For example, the variable TCL_LIB_SPEC will be set to the value
423     # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
424     # instead of TCL_BUILD_LIB_SPEC since it will work with both an
425     # installed and uninstalled version of Tcl.
426     #
427     
428     if test -f $TCL_BIN_DIR/Makefile ; then
429       TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
430       TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
431       TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
432     fi
433     
434     #
435     # eval is required to do the TCL_DBGX substitution
436     #
437     
438     eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
439     eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
440     eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
441     
442     eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
443     eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
444     eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
445     
446     AC_SUBST(TCL_VERSION)
447     AC_SUBST(TCL_BIN_DIR)
448     AC_SUBST(TCL_SRC_DIR)
449     AC_SUBST(TCL_INCLUDE_SPEC)
450     
451     AC_SUBST(TCL_LIB_FILE)
452     AC_SUBST(TCL_LIB_FLAG)
453     AC_SUBST(TCL_LIB_SPEC)
454     
455     AC_SUBST(TCL_STUB_LIB_FILE)
456     AC_SUBST(TCL_STUB_LIB_FLAG)
457     AC_SUBST(TCL_STUB_LIB_SPEC)
458     AC_SUBST(TCL_SHLIB_SUFFIX)
459   fi
461 if test "${use_tcl}" = "no" ; then
462   HAVE_TCL=""
463 else
464   HAVE_TCL=1
466 AC_SUBST(HAVE_TCL)
468 ##########
469 # Figure out what C libraries are required to compile programs
470 # that use "readline()" library.
472 TARGET_READLINE_LIBS=""
473 TARGET_READLINE_INC=""
474 TARGET_HAVE_READLINE=0
475 TARGET_HAVE_EDITLINE=0
476 AC_ARG_ENABLE([editline],
477         [AC_HELP_STRING([--enable-editline],[enable BSD editline support])],
478         [with_editline=$enableval],
479         [with_editline=auto])
480 AC_ARG_ENABLE([readline],
481         [AC_HELP_STRING([--disable-readline],[disable readline support])],
482         [with_readline=$enableval],
483         [with_readline=auto])
485 if test x"$with_editline" != xno; then
486         sLIBS=$LIBS
487         LIBS=""
488         TARGET_HAVE_EDITLINE=1
489         AC_SEARCH_LIBS(readline,edit,[with_readline=no],[TARGET_HAVE_EDITLINE=0])
490         TARGET_READLINE_LIBS=$LIBS
491         LIBS=$sLIBS
493 if test x"$with_readline" != xno; then
494         found="yes"
496         AC_ARG_WITH([readline-lib],
497                 [AC_HELP_STRING([--with-readline-lib],[specify readline library])],
498                 [with_readline_lib=$withval],
499                 [with_readline_lib="auto"])
500         if test "x$with_readline_lib" = xauto; then
501                 save_LIBS="$LIBS"
502                 LIBS=""
503                 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
504                 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
505                 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
506                 LIBS="$save_LIBS"
507         else
508                 TARGET_READLINE_LIBS="$with_readline_lib"
509         fi
511         AC_ARG_WITH([readline-inc],
512                 [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])],
513                 [with_readline_inc=$withval],
514                 [with_readline_inc="auto"])
515         if test "x$with_readline_inc" = xauto; then
516                 AC_CHECK_HEADER(readline.h, [found="yes"], [
517                         found="no"
518                         if test "$cross_compiling" != yes; then
519                                 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
520                                         for subdir in include include/readline; do
521                                                 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
522                                                 if test "$found" = "yes"; then
523                                                         TARGET_READLINE_INC="-I$dir/$subdir"
524                                                         break
525                                                 fi
526                                         done
527                                         test "$found" = "yes" && break
528                                 done
529                         fi
530                 ])
531         else
532                 TARGET_READLINE_INC="$with_readline_inc"
533         fi
535         if test x"$found" = xno; then
536                 TARGET_READLINE_LIBS=""
537                 TARGET_READLINE_INC=""
538                 TARGET_HAVE_READLINE=0
539         else
540                 TARGET_HAVE_READLINE=1
541         fi
544 AC_SUBST(TARGET_READLINE_LIBS)
545 AC_SUBST(TARGET_READLINE_INC)
546 AC_SUBST(TARGET_HAVE_READLINE)
547 AC_SUBST(TARGET_HAVE_EDITLINE)
549 ##########
550 # Figure out what C libraries are required to compile programs
551 # that use "fdatasync()" function.
553 AC_SEARCH_LIBS(fdatasync, [rt])
555 #########
556 # check for debug enabled
557 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]))
558 AC_MSG_CHECKING([build type])
559 if test "${enable_debug}" = "yes" ; then
560   TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0"
561   AC_MSG_RESULT([debug])
562 else
563   TARGET_DEBUG="-DNDEBUG"
564   AC_MSG_RESULT([release])
566 AC_SUBST(TARGET_DEBUG)
568 #########
569 # See whether we should use the amalgamation to build
570 AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation],
571       [Disable the amalgamation and instead build all files separately]))
572 if test "${enable_amalgamation}" = "no" ; then
573   USE_AMALGAMATION=0
575 AC_SUBST(USE_AMALGAMATION)
577 #########
578 # Look for zlib.  Only needed by extensions and by the sqlite3.exe shell
579 AC_CHECK_HEADERS(zlib.h)
580 AC_SEARCH_LIBS(deflate, z, [HAVE_ZLIB="-DSQLITE_HAVE_ZLIB=1"], [HAVE_ZLIB=""])
581 AC_SUBST(HAVE_ZLIB)
583 #########
584 # See whether we should allow loadable extensions
585 AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension],
586       [Disable loading of external extensions]),,[enable_load_extension=yes])
587 if test "${enable_load_extension}" = "yes" ; then
588   OPT_FEATURE_FLAGS=""
589   AC_SEARCH_LIBS(dlopen, dl)
590 else
591   OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
594 ##########
595 # Do we want to support math functions
597 AC_ARG_ENABLE(math, 
598 AC_HELP_STRING([--disable-math],[Disable math functions]))
599 AC_MSG_CHECKING([whether to support math functions])
600 if test "$enable_math" = "no"; then
601   AC_MSG_RESULT([no])
602 else
603   AC_MSG_RESULT([yes])
604   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MATH_FUNCTIONS"
605   AC_SEARCH_LIBS(ceil, m)
609 ########
610 # The --enable-all argument is short-hand to enable
611 # multiple extensions.
612 AC_ARG_ENABLE(all, AC_HELP_STRING([--enable-all],
613       [Enable FTS4, FTS5, Geopoly, JSON, RTree, Sessions]))
615 ##########
616 # Do we want to support memsys3 and/or memsys5
618 AC_ARG_ENABLE(memsys5, 
619   AC_HELP_STRING([--enable-memsys5],[Enable MEMSYS5]))
620 AC_MSG_CHECKING([whether to support MEMSYS5])
621 if test "${enable_memsys5}" = "yes"; then
622   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MEMSYS5"
623   AC_MSG_RESULT([yes])
624 else
625   AC_MSG_RESULT([no])
627 AC_ARG_ENABLE(memsys3, 
628   AC_HELP_STRING([--enable-memsys3],[Enable MEMSYS3]))
629 AC_MSG_CHECKING([whether to support MEMSYS3])
630 if test "${enable_memsys3}" = "yes" -a "${enable_memsys5}" = "no"; then
631   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MEMSYS3"
632   AC_MSG_RESULT([yes])
633 else
634   AC_MSG_RESULT([no])
637 #########
638 # See whether we should enable Full Text Search extensions
639 AC_ARG_ENABLE(fts3, AC_HELP_STRING([--enable-fts3],
640       [Enable the FTS3 extension]))
641 AC_MSG_CHECKING([whether to support FTS3])
642 if test "${enable_fts3}" = "yes" ; then
643   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS3"
644   AC_MSG_RESULT([yes])
645 else
646   AC_MSG_RESULT([no])
648 AC_ARG_ENABLE(fts4, AC_HELP_STRING([--enable-fts4],
649       [Enable the FTS4 extension]))
650 AC_MSG_CHECKING([whether to support FTS4])
651 if test "${enable_fts4}" = "yes" -o "${enable_all}" = "yes" ; then
652   AC_MSG_RESULT([yes])
653   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS4"
654   AC_SEARCH_LIBS([log],[m])
655 else
656   AC_MSG_RESULT([no])
658 AC_ARG_ENABLE(fts5, AC_HELP_STRING([--enable-fts5],
659       [Enable the FTS5 extension]))
660 AC_MSG_CHECKING([whether to support FTS5])
661 if test "${enable_fts5}" = "yes" -o "${enable_all}" = "yes" ; then
662   AC_MSG_RESULT([yes])
663   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS5"
664   AC_SEARCH_LIBS([log],[m])
665 else
666   AC_MSG_RESULT([no])
669 #########
670 # See whether we should enable JSON1
671 AC_ARG_ENABLE(json1, AC_HELP_STRING([--enable-json1],[Enable the JSON1 extension]))
672 AC_MSG_CHECKING([whether to support JSON])
673 if test "${enable_json1}" = "yes" -o "${enable_all}" = "yes" ; then
674   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_JSON1"
675   AC_MSG_RESULT([yes])
676 else
677   AC_MSG_RESULT([no])
680 #########
681 # See whether we should enable the LIMIT clause on UPDATE and DELETE
682 # statements.
683 AC_ARG_ENABLE(update-limit, AC_HELP_STRING([--enable-update-limit],
684       [Enable the UPDATE/DELETE LIMIT clause]))
685 AC_MSG_CHECKING([whether to support LIMIT on UPDATE and DELETE statements])
686 if test "${enable_update_limit}" = "yes" ; then
687   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT"
688   AC_MSG_RESULT([yes])
689 else
690   AC_MSG_RESULT([no])
693 #########
694 # See whether we should enable GEOPOLY
695 AC_ARG_ENABLE(geopoly, AC_HELP_STRING([--enable-geopoly],
696       [Enable the GEOPOLY extension]),
697       [enable_geopoly=yes],[enable_geopoly=no])
698 AC_MSG_CHECKING([whether to support GEOPOLY])
699 if test "${enable_geopoly}" = "yes" -o "${enable_all}" = "yes" ; then
700   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_GEOPOLY"
701   enable_rtree=yes
702   AC_MSG_RESULT([yes])
703 else
704   AC_MSG_RESULT([no])
707 #########
708 # See whether we should enable RTREE
709 AC_ARG_ENABLE(rtree, AC_HELP_STRING([--enable-rtree],
710       [Enable the RTREE extension]))
711 AC_MSG_CHECKING([whether to support RTREE])
712 if test "${enable_rtree}" = "yes" ; then
713   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_RTREE"
714   AC_MSG_RESULT([yes])
715 else
716   AC_MSG_RESULT([no])
719 #########
720 # See whether we should enable the SESSION extension
721 AC_ARG_ENABLE(session, AC_HELP_STRING([--enable-session],
722       [Enable the SESSION extension]))
723 AC_MSG_CHECKING([whether to support SESSION])
724 if test "${enable_session}" = "yes" -o "${enable_all}" = "yes" ; then
725   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_SESSION"
726   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_PREUPDATE_HOOK"
727   AC_MSG_RESULT([yes])
728 else
729   AC_MSG_RESULT([no])
732 #########
733 # attempt to duplicate any OMITS and ENABLES into the ${OPT_FEATURE_FLAGS} parameter
734 for option in $CFLAGS $CPPFLAGS
736   case $option in
737     -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
738     -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
739   esac
740 done
741 AC_SUBST(OPT_FEATURE_FLAGS)
744 # attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
745 ac_temp_CFLAGS=""
746 for option in $CFLAGS
748   case $option in
749     -DSQLITE_OMIT*) ;;
750     -DSQLITE_ENABLE*) ;;
751     *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
752   esac
753 done
754 CFLAGS=$ac_temp_CFLAGS
757 # attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
758 ac_temp_CPPFLAGS=""
759 for option in $CPPFLAGS
761   case $option in
762     -DSQLITE_OMIT*) ;;
763     -DSQLITE_ENABLE*) ;;
764     *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
765   esac
766 done
767 CPPFLAGS=$ac_temp_CPPFLAGS
770 # attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
771 ac_temp_BUILD_CFLAGS=""
772 for option in $BUILD_CFLAGS
774   case $option in
775     -DSQLITE_OMIT*) ;;
776     -DSQLITE_ENABLE*) ;;
777     *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
778   esac
779 done
780 BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
783 #########
784 # See whether we should use GCOV
785 AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
786       [Enable coverage testing using gcov]))
787 if test "${use_gcov}" = "yes" ; then
788   USE_GCOV=1
789 else
790   USE_GCOV=0
792 AC_SUBST(USE_GCOV)
794 #########
795 # Enable/disabled amalagamation line macros
796 ########
797 AMALGAMATION_LINE_MACROS=--linemacros=0
798 if test "${amalgamation_line_macros}" = "yes" ; then
799   AMALGAMATION_LINE_MACROS=--linemacros=1
801 if test "${amalgamation_line_macros}" = "no" ; then
802   AMALGAMATION_LINE_MACROS=--linemacros=0
804 AC_SUBST(AMALGAMATION_LINE_MACROS)
806 #########
807 # Output the config header
808 AC_CONFIG_HEADERS(config.h)
810 #########
811 # Generate the output files.
813 AC_SUBST(BUILD_CFLAGS)
814 AC_OUTPUT([
815 Makefile
816 sqlite3.pc