Fix comment typo in the fileio.c extension. No changes to code.
[sqlite.git] / configure.ac
blobb3a0dd299f15f97dbb9e73a7cb8dfffd539e242c
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 LT_INIT
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 # Figure out all the name of a working tclsh and parameters needed to compile against Tcl.
120 # The --with-tcl= and/or --with-tclsh= configuration arguments might be useful for this.
122 AC_ARG_WITH(tclsh, AS_HELP_STRING([--with-tclsh=PATHNAME],[full pathname of a tclsh to use]))
123 AC_ARG_WITH(tcl, AS_HELP_STRING([--with-tcl=DIR],[directory containing (tclConfig.sh)]))
124 AC_ARG_ENABLE(tcl, AS_HELP_STRING([--disable-tcl],[omit building accessory programs that require TCL-dev]),
125       [use_tcl=$enableval],[use_tcl=yes])
126 original_use_tcl=${use_tcl}
127 if test x"${with_tclsh}" == x -a x"${with_tcl}" == x; then
128   AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.6 tclsh tclsh9.0],none)
129   with_tclsh=${TCLSH_CMD}
131 if test x"${with_tclsh}" != x -a x"${with_tclsh}" != xnone; then
132   TCLSH_CMD=${with_tclsh}
133   AC_MSG_RESULT([using tclsh at "$TCLSH_CMD"])
134   if test x"${use_tcl}" = "xyes"; then
135     with_tcl=`${with_tclsh} <${srcdir}/tool/find_tclconfig.tcl`
136     if test x"${with_tcl}" != x; then
137       AC_MSG_RESULT([$TCLSH_CMD recommends the tclConfig.sh at ${with_tcl}])
138     else
139       AC_MSG_WARN([$TCLSH_CMD is unable to recommend a tclConfig.sh])
140       use_tcl=no
141     fi
142   fi
144 if test x"${use_tcl}" = "xyes"; then
145   if test x"${with_tcl}" != x; then
146     if test -r ${with_tcl}/tclConfig.sh; then
147       tclconfig="${with_tcl}/tclConfig.sh"
148     else
149       for i in tcl8.6 tcl9.0 lib; do
150         if test -r ${with_tcl}/$i/tclConfig.sh; then
151           tclconfig=${with_tcl}/$i/tclConfig.sh
152           break
153         fi
154       done
155     fi
156     if test ! -r "${tclconfig}"; then
157       AC_MSG_ERROR([no tclConfig.sh file found under ${with_tcl}])
158     fi
159   else
160     # If we have not yet found a tclConfig.sh file, look in $libdir whic is
161     # set automatically by autoconf or by the --prefix command-line option.
162     # See https://sqlite.org/forum/forumpost/e04e693439a22457
163     libdir=${prefix}/lib
164     if test -r ${libdir}/tclConfig.sh; then
165       tclconfig=${libdir}/tclConfig.sh
166     else
167       for i in tcl8.6 tcl9.0 lib; do
168         if test -r ${libdir}/$i/tclConfig.sh; then
169           tclconfig=${libdir}/$i/tclConfig.sh
170           break
171         fi
172       done
173     fi
174     if test ! -r "${tclconfig}"; then
175       AC_MSG_ERROR([cannot find a usable tclConfig.sh file. 
176         Use --with-tcl=DIR to specify a directory where tclConfig.sh can be found.
177         SQLite does not use TCL internally, but TCL is required to build SQLite
178         from canonical sources and TCL is required for testing.])
179     fi
180   fi
181   AC_MSG_RESULT([loading TCL configuration from ${tclconfig}])
182   . ${tclconfig}
183   AC_SUBST(TCL_INCLUDE_SPEC)
184   AC_SUBST(TCL_LIB_SPEC)
185   AC_SUBST(TCL_STUB_LIB_SPEC)
186   # There are lots of other configuration variables that are provided by the
187   # tclConfig.sh file and that could be included here.  But as of right now,
188   # TCL_LIB_SPEC is the only what that the Makefile uses.
189   HAVE_TCL=1
190 elif test x"${original_use_tcl}" = "xno"; then
191   AC_MSG_RESULT([unable to run tests because of --disable-tcl])
192   HAVE_TCL=0
193 else
194   AC_MSG_RESULT([unable to run tests because no tclConfig.sh file could be located])
195   HAVE_TCL=0
197 AC_SUBST(HAVE_TCL)
198 if test x"$TCLSH_CMD" == x; then
199   TCLSH_CMD=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION}
200   if test ! -x ${TCLSH_CMD}; then
201     TCLSH_CMD_2=${TCL_EXEC_PREFIX}/bin/tclsh
202     if test ! -x ${TCLSH_CMD_2}; then
203       AC_MSG_WARN([cannot find a usable tclsh at either ${TCLSH_CMD} or ${TCLSH_CMD_2}])
204       TCLSH_CMD=none
205     else
206       TCLSH_CMD=${TCLSH_CMD_2}
207     fi
208   fi
210 if test "$TCLSH_CMD" = "none"; then
211   # If we can't find a local tclsh, then building the amalgamation will fail.
212   # We act as though --disable-amalgamation has been used.
213   AC_MSG_WARN([Warning: can't find tclsh - defaulting to non-amalgamation build.])
214   USE_AMALGAMATION=0
215   TCLSH_CMD="tclsh"
217 AC_SUBST(TCLSH_CMD)
219 AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin])
220 if test "x${TCLLIBDIR+set}" != "xset" ; then
221   for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do
222     if test -d $i ; then
223       TCLLIBDIR=$i
224       break
225     fi
226   done
227   TCLLIBDIR="${TCLLIBDIR}/sqlite3"
230 #########
231 # Set up options for running tests.
233 AC_ARG_ENABLE(test-status, AS_HELP_STRING([--enable-test-status],[Full-screen status of tests]),
234       [use_vt100=$enableval],[use_vt100=no])
235 if test $use_vt100 != no; then
236   TSTRNNR_OPTS=--status
237 else
238   TSTRNNR_OPTS=
240 AC_SUBST(TSTRNNR_OPTS)
243 #########
244 # Set up an appropriate program prefix
246 if test "$program_prefix" = "NONE"; then
247   program_prefix=""
249 AC_SUBST(program_prefix)
251 VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
252 AC_MSG_NOTICE(Version set to $VERSION)
253 AC_SUBST(VERSION)
254 RELEASE=`cat $srcdir/VERSION`
255 AC_MSG_NOTICE(Release set to $RELEASE)
256 AC_SUBST(RELEASE)
258 ##########
259 # Handle --with-wasi-sdk=DIR
261 # This must be early because it changes the toolchain.
263 AC_ARG_WITH(wasi-sdk,
264 AS_HELP_STRING([--with-wasi-sdk=DIR],
265        [directory containing the WASI SDK. Triggers cross-compile to WASM.]), with_wasisdk=${withval})
266 AC_MSG_CHECKING([for WASI SDK directory])
267 AC_CACHE_VAL(ac_cv_c_wasi_sdk,[
268   # First check to see if --with-tcl was specified.
269   if test x"${with_wasi_sdk}" != x ; then
270     if ! test -d "${with_wasi_sdk}" ; then
271       AC_MSG_ERROR([${with_wasi_sdk} directory doesn't exist])
272     fi
273     AC_MSG_RESULT([${with_wasi_sdk}: using wasi-sdk clang, disabling: tcl, CLI shell, DLL])
274     use_wasi_sdk=yes
275   else
276     use_wasi_sdk=no
277   fi
279 if test "${use_wasi_sdk}" = "no" ; then
280   HAVE_WASI_SDK=""
281   AC_MSG_RESULT([no])
282 else
283   HAVE_WASI_SDK=1
284 # Changing --host and --target have no effect here except to possibly
285 # cause confusion. autoconf has finished processing them by this
286 # point.
288 #  host_alias=wasm32-wasi
289 #  target=wasm32-wasi
291 # Merely changing CC and LD to the wasi-sdk's is enough to get
292 # sqlite3.o building in WASM format.
293   CC="${with_wasi_sdk}/bin/clang"
294   LD="${with_wasi_sdk}/bin/wasm-ld"
295   RANLIB="${with_wasi_sdk}/bin/llvm-ranlib"
296   cross_compiling=yes
297   enable_threadsafe=no
298   use_tcl=no
299   enable_tcl=no
300   # libtool is apparently hard-coded to use gcc for linking DLLs, so
301   # we disable the DLL build...
302   enable_shared=no
303   AC_MSG_RESULT([yes])
305 AC_SUBST(HAVE_WASI_SDK)
308 #########
309 # Locate a compiler for the build machine.  This compiler should
310 # generate command-line programs that run on the build machine.
312 if test x"$cross_compiling" = xno; then
313         BUILD_CC=$CC
314         BUILD_CFLAGS=$CFLAGS
315 else
316         if test "${BUILD_CC+set}" != set; then
317                 AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
318         fi
319         if test "${BUILD_CFLAGS+set}" != set; then
320                 BUILD_CFLAGS="-g"
321         fi
323 AC_SUBST(BUILD_CC)
325 ##########
326 # Do we want to support multithreaded use of sqlite
328 AC_ARG_ENABLE(threadsafe, 
329 AS_HELP_STRING([--disable-threadsafe],[Disable mutexing]))
330 AC_MSG_CHECKING([whether to support threadsafe operation])
331 if test "$enable_threadsafe" = "no"; then
332   SQLITE_THREADSAFE=0
333   AC_MSG_RESULT([no])
334 else
335   SQLITE_THREADSAFE=1
336   AC_MSG_RESULT([yes])
338 AC_SUBST(SQLITE_THREADSAFE)
340 if test "$SQLITE_THREADSAFE" = "1"; then
341   AC_SEARCH_LIBS(pthread_create, pthread)
342   AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
345 ##########
346 # Do we want to support release
348 AC_ARG_ENABLE(releasemode, 
349 AS_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
350 AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
351 if test "$enable_releasemode" = "no"; then
352   ALLOWRELEASE=""
353   AC_MSG_RESULT([no])
354 else
355   ALLOWRELEASE="-release `cat $srcdir/VERSION`"
356   AC_MSG_RESULT([yes])
358 AC_SUBST(ALLOWRELEASE)
360 ##########
361 # Do we want temporary databases in memory
363 AC_ARG_ENABLE(tempstore, 
364 AS_HELP_STRING([--enable-tempstore],[Use an in-ram database for temporary tables (never,no,yes,always)]),,enable_tempstore=no)
365 AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
366 case "$enable_tempstore" in
367   never ) 
368     TEMP_STORE=0
369     AC_MSG_RESULT([never])
370   ;;
371   no ) 
372     TEMP_STORE=1
373     AC_MSG_RESULT([no])
374   ;;
375   yes ) 
376      TEMP_STORE=2
377     AC_MSG_RESULT([yes])
378   ;;
379   always ) 
380      TEMP_STORE=3
381     AC_MSG_RESULT([always])
382   ;;
383   * ) 
384     TEMP_STORE=1
385     AC_MSG_RESULT([no])
386   ;;
387 esac
389 AC_SUBST(TEMP_STORE)
391 ###########
392 # Lots of things are different if we are compiling for Windows using
393 # the CYGWIN environment.  So check for that special case and handle
394 # things accordingly.
396 AC_MSG_CHECKING([if executables have the .exe suffix])
397 if test "$config_BUILD_EXEEXT" = ".exe"; then
398   CYGWIN=yes
399   AC_MSG_RESULT(yes)
400 else
401   AC_MSG_RESULT(unknown)
403 if test "$CYGWIN" != "yes"; then
404   m4_warn([obsolete],
405 [AC_CYGWIN is obsolete: use AC_CANONICAL_HOST and check if $host_os
406 matches *cygwin*])dnl
407 AC_CANONICAL_HOST
408 case $host_os in
409   *cygwin* ) CYGWIN=yes;;
410          * ) CYGWIN=no;;
411 esac
414 if test "$CYGWIN" = "yes"; then
415   BUILD_EXEEXT=.exe
416 else
417   BUILD_EXEEXT=$EXEEXT
419 if test x"$cross_compiling" = xno; then
420   TARGET_EXEEXT=$BUILD_EXEEXT
421 else
422   TARGET_EXEEXT=$config_TARGET_EXEEXT
424 if test "$TARGET_EXEEXT" = ".exe"; then
425   SQLITE_OS_UNIX=0
426   SQLITE_OS_WIN=1
427   CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
428 else
429   SQLITE_OS_UNIX=1
430   SQLITE_OS_WIN=0
431   CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
434 AC_SUBST(BUILD_EXEEXT)
435 AC_SUBST(SQLITE_OS_UNIX)
436 AC_SUBST(SQLITE_OS_WIN)
437 AC_SUBST(TARGET_EXEEXT)
439 ##########
440 # Figure out what C libraries are required to compile programs
441 # that use "readline()" library.
443 TARGET_READLINE_LIBS=""
444 TARGET_READLINE_INC=""
445 TARGET_HAVE_READLINE=0
446 TARGET_HAVE_EDITLINE=0
447 AC_ARG_ENABLE([editline],
448         [AS_HELP_STRING([--enable-editline],[enable BSD editline support])],
449         [with_editline=$enableval],
450         [with_editline=auto])
451 AC_ARG_ENABLE([readline],
452         [AS_HELP_STRING([--disable-readline],[disable readline support])],
453         [with_readline=$enableval],
454         [with_readline=auto])
456 if test x"$with_editline" != xno; then
457         sLIBS=$LIBS
458         LIBS=""
459         TARGET_HAVE_EDITLINE=1
460         AC_SEARCH_LIBS(readline,edit,[with_readline=no],[TARGET_HAVE_EDITLINE=0])
461         TARGET_READLINE_LIBS=$LIBS
462         LIBS=$sLIBS
464 if test x"$with_readline" != xno; then
465         found="yes"
467         AC_ARG_WITH([readline-lib],
468                 [AS_HELP_STRING([--with-readline-lib],[specify readline library])],
469                 [with_readline_lib=$withval],
470                 [with_readline_lib="auto"])
471         if test "x$with_readline_lib" = xauto; then
472                 save_LIBS="$LIBS"
473                 LIBS=""
474                 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""])
475                 AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"])
476                 TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS"
477                 LIBS="$save_LIBS"
478         else
479                 TARGET_READLINE_LIBS="$with_readline_lib"
480         fi
482         AC_ARG_WITH([readline-inc],
483                 [AS_HELP_STRING([--with-readline-inc],[specify readline include paths])],
484                 [with_readline_inc=$withval],
485                 [with_readline_inc="auto"])
486         if test "x$with_readline_inc" = xauto; then
487                 AC_CHECK_HEADER(readline.h, [found="yes"], [
488                         found="no"
489                         if test "$cross_compiling" != yes; then
490                                 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
491                                         for subdir in include include/readline; do
492                                                 AC_CHECK_FILE($dir/$subdir/readline.h, found=yes)
493                                                 if test "$found" = "yes"; then
494                                                         TARGET_READLINE_INC="-I$dir/$subdir"
495                                                         break
496                                                 fi
497                                         done
498                                         test "$found" = "yes" && break
499                                 done
500                         fi
501                 ])
502         else
503                 TARGET_READLINE_INC="$with_readline_inc"
504         fi
506         if test x"$found" = xno; then
507                 TARGET_READLINE_LIBS=""
508                 TARGET_READLINE_INC=""
509                 TARGET_HAVE_READLINE=0
510         else
511                 TARGET_HAVE_READLINE=1
512         fi
514 AC_ARG_WITH([linenoise],
515             [AS_HELP_STRING([--with-linenoise=DIR],[source directory for linenoise library])],
516             [with_linenoise=$withval],
517             [with_linenoise="no"])
518 if test "x$with_linenoise" != "xno"; then
519    TARGET_HAVE_READLINE=0
520    TARGET_HAVE_EDITLINE=0
521    TARGET_HAVE_LINENOISE=1
522    TARGET_READLINE_INC="-I${with_linenoise}"
523    TARGET_READLINE_LIBS="${with_linenoise}/linenoise.c"
524    echo "using linenoise source code at ${with_linenoise}"
525 else
526    TARGET_HAVE_LINENOISE=0
527    echo "not using linenoise"
530 AC_SUBST(TARGET_READLINE_LIBS)
531 AC_SUBST(TARGET_READLINE_INC)
532 AC_SUBST(TARGET_HAVE_READLINE)
533 AC_SUBST(TARGET_HAVE_EDITLINE)
534 AC_SUBST(TARGET_HAVE_LINENOISE)
537 ##########
538 # Figure out what C libraries are required to compile programs
539 # that use "fdatasync()" function.
541 AC_SEARCH_LIBS(fdatasync, [rt])
543 #########
544 # check for debug enabled
545 AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[enable debugging & verbose explain]))
546 AC_MSG_CHECKING([build type])
547 if test "${enable_debug}" = "yes" ; then
548   TARGET_DEBUG="-DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall"
549   AC_MSG_RESULT([debug])
550 else
551   TARGET_DEBUG="-DNDEBUG"
552   AC_MSG_RESULT([release])
554 AC_SUBST(TARGET_DEBUG)
556 #########
557 # See whether we should use the amalgamation to build
559 AC_ARG_ENABLE(amalgamation, AS_HELP_STRING([--disable-amalgamation],
560       [Disable the amalgamation and instead build all files separately]))
561 if test "${enable_amalgamation}" = "no" ; then
562   USE_AMALGAMATION=0
564 AC_SUBST(USE_AMALGAMATION)
566 #########
567 # Look for zlib.  Only needed by extensions and by the sqlite3.exe shell
568 AC_CHECK_HEADERS(zlib.h)
569 AC_SEARCH_LIBS(deflate, z, [HAVE_ZLIB="-DSQLITE_HAVE_ZLIB=1"], [HAVE_ZLIB=""])
570 AC_SUBST(HAVE_ZLIB)
572 #########
573 # See whether we should allow loadable extensions
574 AC_ARG_ENABLE(load-extension, AS_HELP_STRING([--disable-load-extension],
575       [Disable loading of external extensions]),,[enable_load_extension=yes])
576 if test "${enable_load_extension}" = "yes" ; then
577   OPT_FEATURE_FLAGS=""
578   AC_SEARCH_LIBS(dlopen, dl)
579 else
580   OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
583 ##########
584 # Do we want to support math functions
586 AC_ARG_ENABLE(math, 
587 AS_HELP_STRING([--disable-math],[Disable math functions]))
588 AC_MSG_CHECKING([whether to support math functions])
589 if test "$enable_math" = "no"; then
590   AC_MSG_RESULT([no])
591 else
592   AC_MSG_RESULT([yes])
593   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MATH_FUNCTIONS"
594   AC_SEARCH_LIBS(ceil, m)
597 ##########
598 # Do we want to support JSON functions
600 AC_ARG_ENABLE(json, 
601 AS_HELP_STRING([--disable-json],[Disable JSON functions]))
602 AC_MSG_CHECKING([whether to support JSON functions])
603 if test "$enable_json" = "no"; then
604   AC_MSG_RESULT([no])
605   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_OMIT_JSON"
606 else
607   AC_MSG_RESULT([yes])
610 ########
611 # The --enable-all argument is short-hand to enable
612 # multiple extensions.
613 AC_ARG_ENABLE(all, AS_HELP_STRING([--enable-all],
614       [Enable FTS4, FTS5, Geopoly, RTree, Sessions]))
616 ##########
617 # Do we want to support memsys3 and/or memsys5
619 AC_ARG_ENABLE(memsys5, 
620   AS_HELP_STRING([--enable-memsys5],[Enable MEMSYS5]))
621 AC_MSG_CHECKING([whether to support MEMSYS5])
622 if test "${enable_memsys5}" = "yes"; then
623   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MEMSYS5"
624   AC_MSG_RESULT([yes])
625 else
626   AC_MSG_RESULT([no])
628 AC_ARG_ENABLE(memsys3, 
629   AS_HELP_STRING([--enable-memsys3],[Enable MEMSYS3]))
630 AC_MSG_CHECKING([whether to support MEMSYS3])
631 if test "${enable_memsys3}" = "yes" -a "${enable_memsys5}" = "no"; then
632   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_MEMSYS3"
633   AC_MSG_RESULT([yes])
634 else
635   AC_MSG_RESULT([no])
638 #########
639 # See whether we should enable Full Text Search extensions
640 AC_ARG_ENABLE(fts3, AS_HELP_STRING([--enable-fts3],
641       [Enable the FTS3 extension]))
642 AC_MSG_CHECKING([whether to support FTS3])
643 if test "${enable_fts3}" = "yes" ; then
644   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS3"
645   AC_MSG_RESULT([yes])
646 else
647   AC_MSG_RESULT([no])
649 AC_ARG_ENABLE(fts4, AS_HELP_STRING([--enable-fts4],
650       [Enable the FTS4 extension]))
651 AC_MSG_CHECKING([whether to support FTS4])
652 if test "${enable_fts4}" = "yes" -o "${enable_all}" = "yes" ; then
653   AC_MSG_RESULT([yes])
654   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS4"
655   AC_SEARCH_LIBS([log],[m])
656 else
657   AC_MSG_RESULT([no])
659 AC_ARG_ENABLE(fts5, AS_HELP_STRING([--enable-fts5],
660       [Enable the FTS5 extension]))
661 AC_MSG_CHECKING([whether to support FTS5])
662 if test "${enable_fts5}" = "yes" -o "${enable_all}" = "yes" ; then
663   AC_MSG_RESULT([yes])
664   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_FTS5"
665   AC_SEARCH_LIBS([log],[m])
666 else
667   AC_MSG_RESULT([no])
670 #########
671 # See whether we should enable the LIMIT clause on UPDATE and DELETE
672 # statements.
673 AC_ARG_ENABLE(update-limit, AS_HELP_STRING([--enable-update-limit],
674       [Enable the UPDATE/DELETE LIMIT clause]))
675 AC_MSG_CHECKING([whether to support LIMIT on UPDATE and DELETE statements])
676 if test "${enable_update_limit}" = "yes" ; then
677   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT"
678   AC_MSG_RESULT([yes])
679 else
680   AC_MSG_RESULT([no])
683 #########
684 # See whether we should enable GEOPOLY
685 AC_ARG_ENABLE(geopoly, AS_HELP_STRING([--enable-geopoly],
686       [Enable the GEOPOLY extension]),
687       [enable_geopoly=yes],[enable_geopoly=no])
688 AC_MSG_CHECKING([whether to support GEOPOLY])
689 if test "${enable_geopoly}" = "yes" -o "${enable_all}" = "yes" ; then
690   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_GEOPOLY"
691   enable_rtree=yes
692   AC_MSG_RESULT([yes])
693 else
694   AC_MSG_RESULT([no])
697 #########
698 # See whether we should enable RTREE
699 AC_ARG_ENABLE(rtree, AS_HELP_STRING([--enable-rtree],
700       [Enable the RTREE extension]))
701 AC_MSG_CHECKING([whether to support RTREE])
702 if test "${enable_rtree}" = "yes" ; then
703   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_RTREE"
704   AC_MSG_RESULT([yes])
705 else
706   AC_MSG_RESULT([no])
709 #########
710 # See whether we should enable the SESSION extension
711 AC_ARG_ENABLE(session, AS_HELP_STRING([--enable-session],
712       [Enable the SESSION extension]))
713 AC_MSG_CHECKING([whether to support SESSION])
714 if test "${enable_session}" = "yes" -o "${enable_all}" = "yes" ; then
715   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_SESSION"
716   OPT_FEATURE_FLAGS="${OPT_FEATURE_FLAGS} -DSQLITE_ENABLE_PREUPDATE_HOOK"
717   AC_MSG_RESULT([yes])
718 else
719   AC_MSG_RESULT([no])
722 #########
723 # attempt to duplicate any OMITS and ENABLES into the ${OPT_FEATURE_FLAGS} parameter
724 for option in $CFLAGS $CPPFLAGS
726   case $option in
727     -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
728     -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";;
729   esac
730 done
731 AC_SUBST(OPT_FEATURE_FLAGS)
734 # attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
735 ac_temp_CFLAGS=""
736 for option in $CFLAGS
738   case $option in
739     -DSQLITE_OMIT*) ;;
740     -DSQLITE_ENABLE*) ;;
741     *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
742   esac
743 done
744 CFLAGS=$ac_temp_CFLAGS
747 # attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
748 ac_temp_CPPFLAGS=""
749 for option in $CPPFLAGS
751   case $option in
752     -DSQLITE_OMIT*) ;;
753     -DSQLITE_ENABLE*) ;;
754     *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
755   esac
756 done
757 CPPFLAGS=$ac_temp_CPPFLAGS
760 # attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
761 ac_temp_BUILD_CFLAGS=""
762 for option in $BUILD_CFLAGS
764   case $option in
765     -DSQLITE_OMIT*) ;;
766     -DSQLITE_ENABLE*) ;;
767     *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
768   esac
769 done
770 BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
773 #########
774 # See whether we should use GCOV
775 AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],
776       [Enable coverage testing using gcov]))
777 if test "${use_gcov}" = "yes" ; then
778   USE_GCOV=1
779 else
780   USE_GCOV=0
782 AC_SUBST(USE_GCOV)
784 #########
785 # Enable/disabled amalagamation line macros
786 ########
787 AMALGAMATION_LINE_MACROS=--linemacros=0
788 if test "${amalgamation_line_macros}" = "yes" ; then
789   AMALGAMATION_LINE_MACROS=--linemacros=1
791 if test "${amalgamation_line_macros}" = "no" ; then
792   AMALGAMATION_LINE_MACROS=--linemacros=0
794 AC_SUBST(AMALGAMATION_LINE_MACROS)
796 #########
797 # Output the config header
798 AC_CONFIG_HEADERS(sqlite_cfg.h)
800 #########
801 # Generate the output files.
803 AC_SUBST(BUILD_CFLAGS)
804 AC_CONFIG_FILES([
805 Makefile
806 sqlite3.pc
808 AC_OUTPUT