1
2#-----------------------------------------------------------------------
3# Supports the following non-standard switches.
4#
5#   --enable-threadsafe
6#   --enable-readline
7#   --enable-dynamic-extensions
8#
9
10AC_PREREQ(2.61)
11AC_INIT(sqlite, 3.7.2, http://www.sqlite.org)
12AC_CONFIG_SRCDIR([sqlite3.c])
13
14# Use automake.
15AM_INIT_AUTOMAKE([foreign])
16AM_MAINTAINER_MODE
17
18AC_SYS_LARGEFILE
19
20# Check for required programs.
21AC_PROG_CC
22AC_PROG_RANLIB
23AC_PROG_LIBTOOL
24
25# Check for library functions that SQLite can optionally use.
26AC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r])
27
28AC_CONFIG_FILES([Makefile sqlite3.pc])
29AC_SUBST(BUILD_CFLAGS)
30
31#-----------------------------------------------------------------------
32#   --enable-readline
33#
34AC_ARG_ENABLE(readline, [AS_HELP_STRING(
35  [--enable-readline], 
36  [use readline in shell tool (yes, no) [default=yes]])], 
37  [], [enable_readline=yes])
38if test x"$enable_readline" != xno ; then
39  sLIBS=$LIBS
40  LIBS=""
41  AC_SEARCH_LIBS(tgetent, curses ncurses ncursesw, [], [])
42  AC_SEARCH_LIBS(readline, readline, [], [enable_readline=no])
43  AC_CHECK_FUNCS(readline, [], [])
44  READLINE_LIBS=$LIBS
45  LIBS=$sLIBS
46fi
47AC_SUBST(READLINE_LIBS)
48#-----------------------------------------------------------------------
49
50#-----------------------------------------------------------------------
51#   --enable-threadsafe
52#
53AC_ARG_ENABLE(threadsafe, [AS_HELP_STRING(
54  [--enable-threadsafe], [build a thread-safe library [default=yes]])], 
55  [], [enable_threadsafe=yes])
56THREADSAFE_FLAGS=-DSQLITE_THREADSAFE=0
57if test x"$enable_threadsafe" != "xno"; then
58  THREADSAFE_FLAGS=-DSQLITE_THREADSAFE=1
59  AC_SEARCH_LIBS(pthread_create, pthread)
60fi
61AC_SUBST(THREADSAFE_FLAGS)
62#-----------------------------------------------------------------------
63
64#-----------------------------------------------------------------------
65#   --enable-dynamic-extensions
66#
67AC_ARG_ENABLE(dynamic-extensions, [AS_HELP_STRING(
68  [--enable-dynamic-extensions], [support loadable extensions [default=yes]])], 
69  [], [enable_dynamic_extensions=yes])
70if test x"$enable_dynamic_extensions" != "xno"; then
71  AC_SEARCH_LIBS(dlopen, dl)
72else
73  DYNAMIC_EXTENSION_FLAGS=-DSQLITE_OMIT_LOAD_EXTENSION=1
74fi
75AC_MSG_CHECKING([for whether to support dynamic extensions])
76AC_MSG_RESULT($enable_dynamic_extensions)
77AC_SUBST(DYNAMIC_EXTENSION_FLAGS)
78#-----------------------------------------------------------------------
79
80#-----------------------------------------------------------------------
81# UPDATE: Maybe it's better if users just set CFLAGS before invoking
82# configure. This option doesn't really add much...
83#
84#   --enable-tempstore
85#
86# AC_ARG_ENABLE(tempstore, [AS_HELP_STRING(
87#   [--enable-tempstore], 
88#   [in-memory temporary tables (never, no, yes, always) [default=no]])], 
89#   [], [enable_tempstore=no])
90# AC_MSG_CHECKING([for whether or not to store temp tables in-memory])
91# case "$enable_tempstore" in
92#   never )  TEMP_STORE=0 ;;
93#   no )     TEMP_STORE=1 ;;
94#   always ) TEMP_STORE=3 ;;
95#   yes )    TEMP_STORE=3 ;;
96#   * )
97#     TEMP_STORE=1
98#     enable_tempstore=yes
99#   ;;
100# esac
101# AC_MSG_RESULT($enable_tempstore)
102# AC_SUBST(TEMP_STORE)
103#-----------------------------------------------------------------------
104
105AC_OUTPUT
106