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