1
2#-----------------------------------------------------------------------
3# Supports the following non-standard switches.
4#
5#   --enable-threadsafe
6#   --enable-readline
7#   --enable-editline
8#   --enable-static-shell
9#   --enable-dynamic-extensions
10#
11
12AC_PREREQ(2.61)
13AC_INIT(sqlite, 3.14.1, http://www.sqlite.org)
14AC_CONFIG_SRCDIR([sqlite3.c])
15
16# Use automake.
17AM_INIT_AUTOMAKE([foreign])
18
19AC_SYS_LARGEFILE
20
21# Check for required programs.
22AC_PROG_CC
23AC_PROG_LIBTOOL
24AC_PROG_MKDIR_P
25
26# Check for library functions that SQLite can optionally use.
27AC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r])
28AC_FUNC_STRERROR_R
29
30AC_CONFIG_FILES([Makefile sqlite3.pc])
31AC_SUBST(BUILD_CFLAGS)
32
33#-------------------------------------------------------------------------
34# Two options to enable readline compatible libraries: 
35#
36#   --enable-editline
37#   --enable-readline
38#
39# Both are enabled by default. If, after command line processing both are
40# still enabled, the script searches for editline first and automatically
41# disables readline if it is found. So, to use readline explicitly, the
42# user must pass "--disable-editline". To disable command line editing
43# support altogether, "--disable-editline --disable-readline".
44#
45# When searching for either library, check for headers before libraries 
46# as some distros supply packages that contain libraries but not header
47# files, which come as a separate development package.
48#
49AC_ARG_ENABLE(editline, [AS_HELP_STRING([--enable-editline],[use BSD libedit])])
50AC_ARG_ENABLE(readline, [AS_HELP_STRING([--enable-readline],[use readline])])
51
52AS_IF([ test x"$enable_editline" != xno ],[
53  AC_CHECK_HEADERS([editline/readline.h],[
54    sLIBS=$LIBS
55    LIBS=""
56    AC_SEARCH_LIBS([readline],[edit],[
57      AC_DEFINE([HAVE_EDITLINE],1,Define to use BSD editline)
58      READLINE_LIBS=$LIBS
59      enable_readline=no
60    ])
61    AS_UNSET(ac_cv_search_readline)
62    LIBS=$sLIBS
63  ])
64])
65
66AS_IF([ test x"$enable_readline" != xno ],[
67  AC_CHECK_HEADERS([readline/readline.h],[
68    sLIBS=$LIBS
69    LIBS=""
70    AC_SEARCH_LIBS(tgetent, termcap curses ncurses ncursesw, [], [])
71    AC_SEARCH_LIBS(readline,[readline edit], [
72      AC_DEFINE([HAVE_READLINE],1,Define to use readline or wrapper)
73      READLINE_LIBS=$LIBS
74    ])
75    LIBS=$sLIBS
76  ])
77])
78
79AC_SUBST(READLINE_LIBS)
80#-----------------------------------------------------------------------
81
82#-----------------------------------------------------------------------
83#   --enable-threadsafe
84#
85AC_ARG_ENABLE(threadsafe, [AS_HELP_STRING(
86  [--enable-threadsafe], [build a thread-safe library [default=yes]])], 
87  [], [enable_threadsafe=yes])
88THREADSAFE_FLAGS=-DSQLITE_THREADSAFE=0
89if test x"$enable_threadsafe" != "xno"; then
90  THREADSAFE_FLAGS="-D_REENTRANT=1 -DSQLITE_THREADSAFE=1"
91  AC_SEARCH_LIBS(pthread_create, pthread)
92  AC_SEARCH_LIBS(pthread_mutexattr_init, pthread)
93fi
94AC_SUBST(THREADSAFE_FLAGS)
95#-----------------------------------------------------------------------
96
97#-----------------------------------------------------------------------
98#   --enable-dynamic-extensions
99#
100AC_ARG_ENABLE(dynamic-extensions, [AS_HELP_STRING(
101  [--enable-dynamic-extensions], [support loadable extensions [default=yes]])], 
102  [], [enable_dynamic_extensions=yes])
103if test x"$enable_dynamic_extensions" != "xno"; then
104  AC_SEARCH_LIBS(dlopen, dl)
105else
106  DYNAMIC_EXTENSION_FLAGS=-DSQLITE_OMIT_LOAD_EXTENSION=1
107fi
108AC_MSG_CHECKING([for whether to support dynamic extensions])
109AC_MSG_RESULT($enable_dynamic_extensions)
110AC_SUBST(DYNAMIC_EXTENSION_FLAGS)
111#-----------------------------------------------------------------------
112
113#-----------------------------------------------------------------------
114#   --enable-fts5
115#
116AC_ARG_ENABLE(fts5, [AS_HELP_STRING(
117  [--enable-fts5], [include fts5 support [default=no]])], 
118  [], [enable_fts5=no])
119if test x"$enable_fts5" = "xyes"; then
120  AC_SEARCH_LIBS(log, m)
121  FTS5_FLAGS=-DSQLITE_ENABLE_FTS5
122fi
123AC_SUBST(FTS5_FLAGS)
124#-----------------------------------------------------------------------
125
126#-----------------------------------------------------------------------
127#   --enable-json1
128#
129AC_ARG_ENABLE(json1, [AS_HELP_STRING(
130  [--enable-json1], [include json1 support [default=no]])], 
131  [], [enable_json1=no])
132if test x"$enable_json1" = "xyes"; then
133  JSON1_FLAGS=-DSQLITE_ENABLE_JSON1
134fi
135AC_SUBST(JSON1_FLAGS)
136#-----------------------------------------------------------------------
137
138#-----------------------------------------------------------------------
139#   --enable-session
140#
141AC_ARG_ENABLE(session, [AS_HELP_STRING(
142  [--enable-session], [enable the session extension [default=no]])], 
143  [], [enable_session=no])
144if test x"$enable_session" = "xyes"; then
145  SESSION_FLAGS="-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
146fi
147AC_SUBST(SESSION_FLAGS)
148#-----------------------------------------------------------------------
149
150#-----------------------------------------------------------------------
151#   --enable-static-shell
152#
153AC_ARG_ENABLE(static-shell, [AS_HELP_STRING(
154  [--enable-static-shell], 
155  [statically link libsqlite3 into shell tool [default=yes]])], 
156  [], [enable_static_shell=yes])
157if test x"$enable_static_shell" = "xyes"; then
158  EXTRA_SHELL_OBJ=sqlite3-sqlite3.$OBJEXT
159else
160  EXTRA_SHELL_OBJ=libsqlite3.la
161fi
162AC_SUBST(EXTRA_SHELL_OBJ)
163#-----------------------------------------------------------------------
164
165AC_CHECK_FUNCS(posix_fallocate)
166
167#-----------------------------------------------------------------------
168# UPDATE: Maybe it's better if users just set CFLAGS before invoking
169# configure. This option doesn't really add much...
170#
171#   --enable-tempstore
172#
173# AC_ARG_ENABLE(tempstore, [AS_HELP_STRING(
174#   [--enable-tempstore], 
175#   [in-memory temporary tables (never, no, yes, always) [default=no]])], 
176#   [], [enable_tempstore=no])
177# AC_MSG_CHECKING([for whether or not to store temp tables in-memory])
178# case "$enable_tempstore" in
179#   never )  TEMP_STORE=0 ;;
180#   no )     TEMP_STORE=1 ;;
181#   always ) TEMP_STORE=3 ;;
182#   yes )    TEMP_STORE=3 ;;
183#   * )
184#     TEMP_STORE=1
185#     enable_tempstore=yes
186#   ;;
187# esac
188# AC_MSG_RESULT($enable_tempstore)
189# AC_SUBST(TEMP_STORE)
190#-----------------------------------------------------------------------
191
192AC_OUTPUT
193