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