xref: /sqlite-3.40.0/configure.ac (revision dfe4e6bb)
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.6 tclsh8.5 tclsh], none)
124if test "$TCLSH_CMD" = "none"; then
125  # If we can't find a local tclsh, then building the amalgamation will fail.
126  # We act as though --disable-amalgamation has been used.
127  echo "Warning: can't find tclsh - defaulting to non-amalgamation build."
128  USE_AMALGAMATION=0
129  TCLSH_CMD="tclsh"
130fi
131AC_SUBST(TCLSH_CMD)
132
133AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin])
134if test "x${TCLLIBDIR+set}" != "xset" ; then
135  TCLLIBDIR='$(libdir)'
136  for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do
137    TCLLIBDIR=$i
138    break
139  done
140  TCLLIBDIR="${TCLLIBDIR}/sqlite3"
141fi
142
143
144#########
145# Set up an appropriate program prefix
146#
147if test "$program_prefix" = "NONE"; then
148  program_prefix=""
149fi
150AC_SUBST(program_prefix)
151
152VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
153AC_MSG_NOTICE(Version set to $VERSION)
154AC_SUBST(VERSION)
155RELEASE=`cat $srcdir/VERSION`
156AC_MSG_NOTICE(Release set to $RELEASE)
157AC_SUBST(RELEASE)
158VERSION_NUMBER=[`cat $srcdir/VERSION \
159                           | sed 's/[^0-9]/ /g' \
160                | awk '{printf "%d%03d%03d",$1,$2,$3}'`]
161AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
162AC_SUBST(VERSION_NUMBER)
163
164#########
165# Locate a compiler for the build machine.  This compiler should
166# generate command-line programs that run on the build machine.
167#
168if test x"$cross_compiling" = xno; then
169	BUILD_CC=$CC
170	BUILD_CFLAGS=$CFLAGS
171else
172	if test "${BUILD_CC+set}" != set; then
173		AC_CHECK_PROGS(BUILD_CC, gcc cc cl)
174	fi
175	if test "${BUILD_CFLAGS+set}" != set; then
176		BUILD_CFLAGS="-g"
177	fi
178fi
179AC_SUBST(BUILD_CC)
180
181##########
182# Do we want to support multithreaded use of sqlite
183#
184AC_ARG_ENABLE(threadsafe,
185AC_HELP_STRING([--disable-threadsafe],[Disable mutexing]),,enable_threadsafe=yes)
186AC_MSG_CHECKING([whether to support threadsafe operation])
187if test "$enable_threadsafe" = "no"; then
188  SQLITE_THREADSAFE=0
189  AC_MSG_RESULT([no])
190else
191  SQLITE_THREADSAFE=1
192  AC_MSG_RESULT([yes])
193fi
194AC_SUBST(SQLITE_THREADSAFE)
195
196if test "$SQLITE_THREADSAFE" = "1"; then
197  AC_SEARCH_LIBS(pthread_create, pthread)
198  AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
199fi
200
201##########
202# Do we want to support release
203#
204AC_ARG_ENABLE(releasemode,
205AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no)
206AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
207if test "$enable_releasemode" = "no"; then
208  ALLOWRELEASE=""
209  AC_MSG_RESULT([no])
210else
211  ALLOWRELEASE="-release `cat $srcdir/VERSION`"
212  AC_MSG_RESULT([yes])
213fi
214AC_SUBST(ALLOWRELEASE)
215
216##########
217# Do we want temporary databases in memory
218#
219AC_ARG_ENABLE(tempstore,
220AC_HELP_STRING([--enable-tempstore],[Use an in-ram database for temporary tables (never,no,yes,always)]),,enable_tempstore=no)
221AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
222case "$enable_tempstore" in
223  never )
224    TEMP_STORE=0
225    AC_MSG_RESULT([never])
226  ;;
227  no )
228    TEMP_STORE=1
229    AC_MSG_RESULT([no])
230  ;;
231  yes )
232     TEMP_STORE=2
233    AC_MSG_RESULT([yes])
234  ;;
235  always )
236     TEMP_STORE=3
237    AC_MSG_RESULT([always])
238  ;;
239  * )
240    TEMP_STORE=1
241    AC_MSG_RESULT([no])
242  ;;
243esac
244
245AC_SUBST(TEMP_STORE)
246
247###########
248# Lots of things are different if we are compiling for Windows using
249# the CYGWIN environment.  So check for that special case and handle
250# things accordingly.
251#
252AC_MSG_CHECKING([if executables have the .exe suffix])
253if test "$config_BUILD_EXEEXT" = ".exe"; then
254  CYGWIN=yes
255  AC_MSG_RESULT(yes)
256else
257  AC_MSG_RESULT(unknown)
258fi
259if test "$CYGWIN" != "yes"; then
260  AC_CYGWIN
261fi
262if test "$CYGWIN" = "yes"; then
263  BUILD_EXEEXT=.exe
264else
265  BUILD_EXEEXT=$EXEEXT
266fi
267if test x"$cross_compiling" = xno; then
268  TARGET_EXEEXT=$BUILD_EXEEXT
269else
270  TARGET_EXEEXT=$config_TARGET_EXEEXT
271fi
272if test "$TARGET_EXEEXT" = ".exe"; then
273  SQLITE_OS_UNIX=0
274  SQLITE_OS_WIN=1
275  CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1"
276else
277  SQLITE_OS_UNIX=1
278  SQLITE_OS_WIN=0
279  CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1"
280fi
281
282AC_SUBST(BUILD_EXEEXT)
283AC_SUBST(SQLITE_OS_UNIX)
284AC_SUBST(SQLITE_OS_WIN)
285AC_SUBST(TARGET_EXEEXT)
286
287##########
288# Figure out all the parameters needed to compile against Tcl.
289#
290# This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG
291# macros in the in the tcl.m4 file of the standard TCL distribution.
292# Those macros could not be used directly since we have to make some
293# minor changes to accomodate systems that do not have TCL installed.
294#
295AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]),
296      [use_tcl=$enableval],[use_tcl=yes])
297if test "${use_tcl}" = "yes" ; then
298  AC_ARG_WITH(tcl, AC_HELP_STRING([--with-tcl=DIR],[directory containing tcl configuration (tclConfig.sh)]), with_tclconfig=${withval})
299  AC_MSG_CHECKING([for Tcl configuration])
300  AC_CACHE_VAL(ac_cv_c_tclconfig,[
301    # First check to see if --with-tcl was specified.
302    if test x"${with_tclconfig}" != x ; then
303      if test -f "${with_tclconfig}/tclConfig.sh" ; then
304        ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
305      else
306        AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
307      fi
308    fi
309
310    # Start autosearch by asking tclsh
311    if test x"${ac_cv_c_tclconfig}" = x ; then
312      if test x"$cross_compiling" = xno; then
313        for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}`
314        do
315          if test -f "$i/tclConfig.sh" ; then
316            ac_cv_c_tclconfig="$i"
317            break
318          fi
319        done
320      fi
321    fi
322
323    # On ubuntu 14.10, $auto_path on tclsh is not quite correct.
324    # So try again after applying corrections.
325    if test x"${ac_cv_c_tclconfig}" = x ; then
326      if test x"$cross_compiling" = xno; then
327        for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD} | sed 's,/tcltk/tcl,/tcl,g'`
328        do
329          if test -f "$i/tclConfig.sh" ; then
330            ac_cv_c_tclconfig="$i"
331            break
332          fi
333        done
334      fi
335    fi
336
337    # 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
350
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
373
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
388
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  ])
404
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)
413
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
463fi
464if test "${use_tcl}" = "no" ; then
465  HAVE_TCL=""
466else
467  HAVE_TCL=1
468fi
469AC_SUBST(HAVE_TCL)
470
471##########
472# Figure out what C libraries are required to compile programs
473# that use "readline()" library.
474#
475TARGET_READLINE_LIBS=""
476TARGET_READLINE_INC=""
477TARGET_HAVE_READLINE=0
478TARGET_HAVE_EDITLINE=0
479AC_ARG_ENABLE([editline],
480	[AC_HELP_STRING([--enable-editline],[enable BSD editline support])],
481	[with_editline=$enableval],
482	[with_editline=auto])
483AC_ARG_ENABLE([readline],
484	[AC_HELP_STRING([--disable-readline],[disable readline support])],
485	[with_readline=$enableval],
486	[with_readline=auto])
487
488if 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
495fi
496if test x"$with_readline" != xno; then
497	found="yes"
498
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
513
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
537
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
545fi
546
547AC_SUBST(TARGET_READLINE_LIBS)
548AC_SUBST(TARGET_READLINE_INC)
549AC_SUBST(TARGET_HAVE_READLINE)
550AC_SUBST(TARGET_HAVE_EDITLINE)
551
552##########
553# Figure out what C libraries are required to compile programs
554# that use "fdatasync()" function.
555#
556AC_SEARCH_LIBS(fdatasync, [rt])
557
558#########
559# check for debug enabled
560AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]),
561      [use_debug=$enableval],[use_debug=no])
562if test "${use_debug}" = "yes" ; then
563  TARGET_DEBUG="-DSQLITE_DEBUG=1"
564else
565  TARGET_DEBUG="-DNDEBUG"
566fi
567AC_SUBST(TARGET_DEBUG)
568
569#########
570# See whether we should use the amalgamation to build
571AC_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])
574if test "${use_amalgamation}" != "yes" ; then
575  USE_AMALGAMATION=0
576fi
577AC_SUBST(USE_AMALGAMATION)
578
579#########
580# See whether we should allow loadable extensions
581AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension],
582      [Disable loading of external extensions]),
583      [use_loadextension=$enableval],[use_loadextension=yes])
584if test "${use_loadextension}" = "yes" ; then
585  OPT_FEATURE_FLAGS=""
586  AC_SEARCH_LIBS(dlopen, dl)
587else
588  OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
589fi
590
591##########
592# Do we want to support memsys3 and/or memsys5
593#
594AC_ARG_ENABLE(memsys5,
595  AC_HELP_STRING([--enable-memsys5],[Enable MEMSYS5]),
596  [enable_memsys5=yes],[enable_memsys5=no])
597AC_MSG_CHECKING([whether to support MEMSYS5])
598if test "${enable_memsys5}" = "yes"; then
599  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_MEMSYS5"
600  AC_MSG_RESULT([yes])
601else
602  AC_MSG_RESULT([no])
603fi
604AC_ARG_ENABLE(memsys3,
605  AC_HELP_STRING([--enable-memsys3],[Enable MEMSYS3]),
606  [enable_memsys3=yes],[enable_memsys3=no])
607AC_MSG_CHECKING([whether to support MEMSYS3])
608if test "${enable_memsys3}" = "yes" -a "${enable_memsys5}" = "no"; then
609  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_MEMSYS3"
610  AC_MSG_RESULT([yes])
611else
612  AC_MSG_RESULT([no])
613fi
614
615#########
616# See whether we should enable Full Text Search extensions
617AC_ARG_ENABLE(fts3, AC_HELP_STRING([--enable-fts3],
618      [Enable the FTS3 extension]),
619      [enable_fts3=yes],[enable_fts3=no])
620if test "${enable_fts3}" = "yes" ; then
621  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS3"
622fi
623AC_ARG_ENABLE(fts4, AC_HELP_STRING([--enable-fts4],
624      [Enable the FTS4 extension]),
625      [enable_fts4=yes],[enable_fts4=no])
626if test "${enable_fts4}" = "yes" ; then
627  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]),
632      [enable_fts5=yes],[enable_fts5=no])
633if test "${enable_fts5}" = "yes" ; then
634  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_FTS5"
635  AC_SEARCH_LIBS([log],[m])
636fi
637
638#########
639# See whether we should enable JSON1
640AC_ARG_ENABLE(json1, AC_HELP_STRING([--enable-json1],
641      [Enable the JSON1 extension]),
642      [enable_json1=yes],[enable_json1=no])
643if test "${enable_json1}" = "yes" ; then
644  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_JSON1"
645fi
646
647#########
648# See whether we should enable RTREE
649AC_ARG_ENABLE(rtree, AC_HELP_STRING([--enable-rtree],
650      [Enable the RTREE extension]),
651      [enable_rtree=yes],[enable_rtree=no])
652if test "${enable_rtree}" = "yes" ; then
653  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_RTREE"
654fi
655
656#########
657# See whether we should enable the SESSION extension
658AC_ARG_ENABLE(session, AC_HELP_STRING([--enable-session],
659      [Enable the SESSION extension]),
660      [enable_session=yes],[enable_session=no])
661if test "${enable_session}" = "yes" ; then
662  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_SESSION"
663  OPT_FEATURE_FLAGS+=" -DSQLITE_ENABLE_PREUPDATE_HOOK"
664fi
665
666#########
667# attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter
668for option in $CFLAGS $CPPFLAGS
669do
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
674done
675AC_SUBST(OPT_FEATURE_FLAGS)
676
677
678# attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter
679ac_temp_CFLAGS=""
680for option in $CFLAGS
681do
682  case $option in
683    -DSQLITE_OMIT*) ;;
684    -DSQLITE_ENABLE*) ;;
685    *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";;
686  esac
687done
688CFLAGS=$ac_temp_CFLAGS
689
690
691# attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter
692ac_temp_CPPFLAGS=""
693for option in $CPPFLAGS
694do
695  case $option in
696    -DSQLITE_OMIT*) ;;
697    -DSQLITE_ENABLE*) ;;
698    *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";;
699  esac
700done
701CPPFLAGS=$ac_temp_CPPFLAGS
702
703
704# attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter
705ac_temp_BUILD_CFLAGS=""
706for option in $BUILD_CFLAGS
707do
708  case $option in
709    -DSQLITE_OMIT*) ;;
710    -DSQLITE_ENABLE*) ;;
711    *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";;
712  esac
713done
714BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS
715
716
717#########
718# See whether we should use GCOV
719AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov],
720      [Enable coverage testing using gcov]),
721      [use_gcov=$enableval],[use_gcov=no])
722if test "${use_gcov}" = "yes" ; then
723  USE_GCOV=1
724else
725  USE_GCOV=0
726fi
727AC_SUBST(USE_GCOV)
728
729
730#########
731# Output the config header
732AC_CONFIG_HEADERS(config.h)
733
734#########
735# Generate the output files.
736#
737AC_SUBST(BUILD_CFLAGS)
738AC_OUTPUT([
739Makefile
740sqlite3.pc
741])
742