drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 1 | # |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 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 | # |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 48 | # TCL_* |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 49 | # |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 50 | # Lots of values are read in from the tclConfig.sh script, |
drh | 4b2266a | 2004-11-27 15:52:16 +0000 | [diff] [blame] | 51 | # if that script is available. This values are used for |
| 52 | # constructing and installing the TCL extension. |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 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 | # |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 67 | # TARGET_EXEEXT |
| 68 | # |
| 69 | # The filename extension for executables on the |
| 70 | # target platform. "" for Unix and ".exe" for windows. |
| 71 | # |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 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 | # |
mlcreech | b87057f | 2008-03-06 07:19:20 +0000 | [diff] [blame] | 77 | AC_INIT(sqlite, m4_esyscmd([cat VERSION | tr -d '\n'])) |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 78 | |
vapier | faa68db | 2009-04-01 07:38:31 +0000 | [diff] [blame] | 79 | dnl Make sure the local VERSION file matches this configure script |
danielk1977 | 6f050aa | 2009-04-25 08:39:14 +0000 | [diff] [blame] | 80 | sqlite_version_sanity_check=`cat $srcdir/VERSION | tr -d '\n'` |
vapier | faa68db | 2009-04-01 07:38:31 +0000 | [diff] [blame] | 81 | if test "$PACKAGE_VERSION" != "$sqlite_version_sanity_check" ; then |
| 82 | AC_MSG_ERROR([configure script is out of date: |
| 83 | configure \$PACKAGE_VERSION = $PACKAGE_VERSION |
| 84 | top level VERSION file = $sqlite_version_sanity_check |
| 85 | please regen with autoconf]) |
| 86 | fi |
| 87 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 88 | ######### |
| 89 | # Programs needed |
| 90 | # |
| 91 | AC_PROG_LIBTOOL |
| 92 | AC_PROG_INSTALL |
drh | f1878b4 | 2006-01-23 18:06:52 +0000 | [diff] [blame] | 93 | AC_PROG_AWK |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 94 | |
| 95 | ######### |
mlcreech | 636a995 | 2008-05-05 22:52:56 +0000 | [diff] [blame] | 96 | # Enable large file support (if special flags are necessary) |
| 97 | # |
| 98 | AC_SYS_LARGEFILE |
| 99 | |
| 100 | ######### |
mlcreech | b87057f | 2008-03-06 07:19:20 +0000 | [diff] [blame] | 101 | # Check for needed/wanted data types |
| 102 | AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t, |
| 103 | uint16_t, uint32_t, uint64_t, uintptr_t]) |
| 104 | |
| 105 | ######### |
| 106 | # Check for needed/wanted headers |
drh | 86c5a93 | 2012-02-08 12:13:28 +0000 | [diff] [blame] | 107 | AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h]) |
mlcreech | 5b0a9eb | 2008-03-09 01:38:09 +0000 | [diff] [blame] | 108 | |
| 109 | ######### |
| 110 | # Figure out whether or not we have these functions |
| 111 | # |
drh | 3931112 | 2015-01-15 17:38:35 +0000 | [diff] [blame] | 112 | AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime]) |
mlcreech | 5b0a9eb | 2008-03-09 01:38:09 +0000 | [diff] [blame] | 113 | |
mlcreech | ab1c47b | 2008-03-09 02:51:10 +0000 | [diff] [blame] | 114 | ######### |
mlcreech | f386811 | 2008-03-11 18:03:30 +0000 | [diff] [blame] | 115 | # By default, we use the amalgamation (this may be changed below...) |
| 116 | # |
| 117 | USE_AMALGAMATION=1 |
| 118 | |
| 119 | ######### |
mlcreech | ab1c47b | 2008-03-09 02:51:10 +0000 | [diff] [blame] | 120 | # See whether we can run specific tclsh versions known to work well; |
| 121 | # if not, then we fall back to plain tclsh. |
| 122 | # TODO: try other versions before falling back? |
| 123 | # |
mistachkin | fe27b08 | 2013-08-28 18:06:26 +0000 | [diff] [blame] | 124 | AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.6 tclsh8.5 tclsh], none) |
mlcreech | f386811 | 2008-03-11 18:03:30 +0000 | [diff] [blame] | 125 | if test "$TCLSH_CMD" = "none"; then |
| 126 | # If we can't find a local tclsh, then building the amalgamation will fail. |
| 127 | # We act as though --disable-amalgamation has been used. |
| 128 | echo "Warning: can't find tclsh - defaulting to non-amalgamation build." |
| 129 | USE_AMALGAMATION=0 |
| 130 | TCLSH_CMD="tclsh" |
| 131 | fi |
mlcreech | ab1c47b | 2008-03-09 02:51:10 +0000 | [diff] [blame] | 132 | AC_SUBST(TCLSH_CMD) |
| 133 | |
vapier | 6d120f3 | 2009-01-28 04:46:14 +0000 | [diff] [blame] | 134 | AC_ARG_VAR([TCLLIBDIR], [Where to install tcl plugin]) |
| 135 | if test "x${TCLLIBDIR+set}" != "xset" ; then |
| 136 | TCLLIBDIR='$(libdir)' |
| 137 | for i in `echo 'puts stdout $auto_path' | ${TCLSH_CMD}` ; do |
| 138 | TCLLIBDIR=$i |
| 139 | break |
| 140 | done |
| 141 | TCLLIBDIR="${TCLLIBDIR}/sqlite3" |
| 142 | fi |
| 143 | |
mlcreech | b87057f | 2008-03-06 07:19:20 +0000 | [diff] [blame] | 144 | |
| 145 | ######### |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 146 | # Set up an appropriate program prefix |
| 147 | # |
| 148 | if test "$program_prefix" = "NONE"; then |
| 149 | program_prefix="" |
| 150 | fi |
| 151 | AC_SUBST(program_prefix) |
| 152 | |
drh | 4b2266a | 2004-11-27 15:52:16 +0000 | [diff] [blame] | 153 | VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`] |
vapier | 695f097 | 2009-01-26 21:43:16 +0000 | [diff] [blame] | 154 | AC_MSG_NOTICE(Version set to $VERSION) |
a.rottmann | c7e9383 | 2003-03-24 09:39:32 +0000 | [diff] [blame] | 155 | AC_SUBST(VERSION) |
drh | 4b2266a | 2004-11-27 15:52:16 +0000 | [diff] [blame] | 156 | RELEASE=`cat $srcdir/VERSION` |
vapier | 695f097 | 2009-01-26 21:43:16 +0000 | [diff] [blame] | 157 | AC_MSG_NOTICE(Release set to $RELEASE) |
drh | 4b2266a | 2004-11-27 15:52:16 +0000 | [diff] [blame] | 158 | AC_SUBST(RELEASE) |
vapier | 695f097 | 2009-01-26 21:43:16 +0000 | [diff] [blame] | 159 | VERSION_NUMBER=[`cat $srcdir/VERSION \ |
drh | b797783 | 2005-02-16 03:45:51 +0000 | [diff] [blame] | 160 | | sed 's/[^0-9]/ /g' \ |
drh | 26d0e2a | 2005-07-06 13:51:27 +0000 | [diff] [blame] | 161 | | awk '{printf "%d%03d%03d",$1,$2,$3}'`] |
vapier | 695f097 | 2009-01-26 21:43:16 +0000 | [diff] [blame] | 162 | AC_MSG_NOTICE(Version number set to $VERSION_NUMBER) |
drh | b797783 | 2005-02-16 03:45:51 +0000 | [diff] [blame] | 163 | AC_SUBST(VERSION_NUMBER) |
a.rottmann | c7e9383 | 2003-03-24 09:39:32 +0000 | [diff] [blame] | 164 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 165 | ######### |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 166 | # Locate a compiler for the build machine. This compiler should |
| 167 | # generate command-line programs that run on the build machine. |
| 168 | # |
vapier | c8a1530 | 2007-02-17 14:31:55 +0000 | [diff] [blame] | 169 | if test x"$cross_compiling" = xno; then |
| 170 | BUILD_CC=$CC |
| 171 | BUILD_CFLAGS=$CFLAGS |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 172 | else |
vapier | c8a1530 | 2007-02-17 14:31:55 +0000 | [diff] [blame] | 173 | if test "${BUILD_CC+set}" != set; then |
| 174 | AC_CHECK_PROGS(BUILD_CC, gcc cc cl) |
| 175 | fi |
| 176 | if test "${BUILD_CFLAGS+set}" != set; then |
| 177 | BUILD_CFLAGS="-g" |
| 178 | fi |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 179 | fi |
| 180 | AC_SUBST(BUILD_CC) |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 181 | |
| 182 | ########## |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 183 | # Do we want to support multithreaded use of sqlite |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 184 | # |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 185 | AC_ARG_ENABLE(threadsafe, |
drh | 05c7e0b | 2015-01-10 14:27:17 +0000 | [diff] [blame] | 186 | AC_HELP_STRING([--disable-threadsafe],[Disable mutexing]),,enable_threadsafe=yes) |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 187 | AC_MSG_CHECKING([whether to support threadsafe operation]) |
| 188 | if test "$enable_threadsafe" = "no"; then |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 189 | SQLITE_THREADSAFE=0 |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 190 | AC_MSG_RESULT([no]) |
| 191 | else |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 192 | SQLITE_THREADSAFE=1 |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 193 | AC_MSG_RESULT([yes]) |
| 194 | fi |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 195 | AC_SUBST(SQLITE_THREADSAFE) |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 196 | |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 197 | if test "$SQLITE_THREADSAFE" = "1"; then |
mlcreech | c658b0f | 2008-03-09 02:20:11 +0000 | [diff] [blame] | 198 | AC_SEARCH_LIBS(pthread_create, pthread) |
dougcurrie | 65623c7 | 2004-09-20 14:57:23 +0000 | [diff] [blame] | 199 | fi |
dougcurrie | 65623c7 | 2004-09-20 14:57:23 +0000 | [diff] [blame] | 200 | |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 201 | ########## |
xdong | 3b5543c | 2003-09-23 00:36:50 +0000 | [diff] [blame] | 202 | # Do we want to support release |
| 203 | # |
| 204 | AC_ARG_ENABLE(releasemode, |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 205 | AC_HELP_STRING([--enable-releasemode],[Support libtool link to release mode]),,enable_releasemode=no) |
xdong | 3b5543c | 2003-09-23 00:36:50 +0000 | [diff] [blame] | 206 | AC_MSG_CHECKING([whether to support shared library linked as release mode or not]) |
| 207 | if test "$enable_releasemode" = "no"; then |
| 208 | ALLOWRELEASE="" |
| 209 | AC_MSG_RESULT([no]) |
| 210 | else |
drh | 0b47d34 | 2007-11-27 14:50:06 +0000 | [diff] [blame] | 211 | ALLOWRELEASE="-release `cat $srcdir/VERSION`" |
xdong | 3b5543c | 2003-09-23 00:36:50 +0000 | [diff] [blame] | 212 | AC_MSG_RESULT([yes]) |
| 213 | fi |
| 214 | AC_SUBST(ALLOWRELEASE) |
| 215 | |
| 216 | ########## |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 217 | # Do we want temporary databases in memory |
| 218 | # |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 219 | AC_ARG_ENABLE(tempstore, |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 220 | AC_HELP_STRING([--enable-tempstore],[Use an in-ram database for temporary tables (never,no,yes,always)]),,enable_tempstore=no) |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 221 | AC_MSG_CHECKING([whether to use an in-ram database for temporary tables]) |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 222 | case "$enable_tempstore" in |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 223 | never ) |
paul | 2dc96f9 | 2003-04-20 11:46:34 +0000 | [diff] [blame] | 224 | TEMP_STORE=0 |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 225 | AC_MSG_RESULT([never]) |
| 226 | ;; |
| 227 | no ) |
paul | 2dc96f9 | 2003-04-20 11:46:34 +0000 | [diff] [blame] | 228 | TEMP_STORE=1 |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 229 | AC_MSG_RESULT([no]) |
| 230 | ;; |
drh | 54414bb | 2005-10-10 00:05:50 +0000 | [diff] [blame] | 231 | yes ) |
drh | 8b72747 | 2009-01-19 18:18:40 +0000 | [diff] [blame] | 232 | TEMP_STORE=2 |
| 233 | AC_MSG_RESULT([yes]) |
| 234 | ;; |
| 235 | always ) |
drh | 54414bb | 2005-10-10 00:05:50 +0000 | [diff] [blame] | 236 | TEMP_STORE=3 |
| 237 | AC_MSG_RESULT([always]) |
| 238 | ;; |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 239 | * ) |
drh | 54414bb | 2005-10-10 00:05:50 +0000 | [diff] [blame] | 240 | TEMP_STORE=1 |
drh | 8b72747 | 2009-01-19 18:18:40 +0000 | [diff] [blame] | 241 | AC_MSG_RESULT([no]) |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 242 | ;; |
| 243 | esac |
paul | 2dc96f9 | 2003-04-20 11:46:34 +0000 | [diff] [blame] | 244 | |
paul | 2dc96f9 | 2003-04-20 11:46:34 +0000 | [diff] [blame] | 245 | AC_SUBST(TEMP_STORE) |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 246 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 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 | # |
| 252 | AC_MSG_CHECKING([if executables have the .exe suffix]) |
| 253 | if test "$config_BUILD_EXEEXT" = ".exe"; then |
| 254 | CYGWIN=yes |
| 255 | AC_MSG_RESULT(yes) |
| 256 | else |
| 257 | AC_MSG_RESULT(unknown) |
| 258 | fi |
| 259 | if test "$CYGWIN" != "yes"; then |
| 260 | AC_CYGWIN |
| 261 | fi |
| 262 | if test "$CYGWIN" = "yes"; then |
| 263 | BUILD_EXEEXT=.exe |
| 264 | else |
dougcurrie | 6194a5f | 2003-12-19 20:09:51 +0000 | [diff] [blame] | 265 | BUILD_EXEEXT=$EXEEXT |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 266 | fi |
vapier | c8a1530 | 2007-02-17 14:31:55 +0000 | [diff] [blame] | 267 | if test x"$cross_compiling" = xno; then |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 268 | TARGET_EXEEXT=$BUILD_EXEEXT |
| 269 | else |
| 270 | TARGET_EXEEXT=$config_TARGET_EXEEXT |
| 271 | fi |
| 272 | if test "$TARGET_EXEEXT" = ".exe"; then |
mistachkin | fe27b08 | 2013-08-28 18:06:26 +0000 | [diff] [blame] | 273 | SQLITE_OS_UNIX=0 |
| 274 | SQLITE_OS_WIN=1 |
| 275 | CFLAGS="$CFLAGS -DSQLITE_OS_WIN=1" |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 276 | else |
danielk1977 | 29bafea | 2008-06-26 10:41:19 +0000 | [diff] [blame] | 277 | SQLITE_OS_UNIX=1 |
| 278 | SQLITE_OS_WIN=0 |
danielk1977 | 29bafea | 2008-06-26 10:41:19 +0000 | [diff] [blame] | 279 | CFLAGS="$CFLAGS -DSQLITE_OS_UNIX=1" |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 280 | fi |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 281 | |
| 282 | AC_SUBST(BUILD_EXEEXT) |
danielk1977 | 29bafea | 2008-06-26 10:41:19 +0000 | [diff] [blame] | 283 | AC_SUBST(SQLITE_OS_UNIX) |
| 284 | AC_SUBST(SQLITE_OS_WIN) |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 285 | AC_SUBST(TARGET_EXEEXT) |
| 286 | |
| 287 | ########## |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 288 | # Figure out all the parameters needed to compile against Tcl. |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 289 | # |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 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. |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 294 | # |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 295 | AC_ARG_ENABLE(tcl, AC_HELP_STRING([--disable-tcl],[do not build TCL extension]), |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 296 | [use_tcl=$enableval],[use_tcl=yes]) |
| 297 | if test "${use_tcl}" = "yes" ; then |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 298 | AC_ARG_WITH(tcl, AC_HELP_STRING([--with-tcl=DIR],[directory containing tcl configuration (tclConfig.sh)]), with_tclconfig=${withval}) |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 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 |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 308 | fi |
vapier | fe7e82e | 2009-01-26 21:39:33 +0000 | [diff] [blame] | 309 | |
| 310 | # Start autosearch by asking tclsh |
drh | e74f465 | 2012-08-15 16:06:54 +0000 | [diff] [blame] | 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 |
vapier | fe7e82e | 2009-01-26 21:39:33 +0000 | [diff] [blame] | 321 | fi |
| 322 | |
drh | f960a64 | 2015-05-30 22:57:49 +0000 | [diff] [blame] | 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 | |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 337 | # then check for a private Tcl installation |
| 338 | if test x"${ac_cv_c_tclconfig}" = x ; then |
| 339 | for i in \ |
| 340 | ../tcl \ |
| 341 | `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ |
| 342 | `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ |
| 343 | `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ |
| 344 | ../../tcl \ |
| 345 | `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ |
| 346 | `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ |
| 347 | `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ |
| 348 | ../../../tcl \ |
| 349 | `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ |
| 350 | `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ |
| 351 | `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` |
| 352 | do |
| 353 | if test -f "$i/unix/tclConfig.sh" ; then |
| 354 | ac_cv_c_tclconfig=`(cd $i/unix; pwd)` |
| 355 | break |
| 356 | fi |
| 357 | done |
| 358 | fi |
| 359 | |
| 360 | # check in a few common install locations |
| 361 | if test x"${ac_cv_c_tclconfig}" = x ; then |
| 362 | for i in \ |
| 363 | `ls -d ${libdir} 2>/dev/null` \ |
| 364 | `ls -d /usr/local/lib 2>/dev/null` \ |
| 365 | `ls -d /usr/contrib/lib 2>/dev/null` \ |
| 366 | `ls -d /usr/lib 2>/dev/null` |
| 367 | do |
| 368 | if test -f "$i/tclConfig.sh" ; then |
| 369 | ac_cv_c_tclconfig=`(cd $i; pwd)` |
| 370 | break |
| 371 | fi |
| 372 | done |
| 373 | fi |
| 374 | |
| 375 | # check in a few other private locations |
| 376 | if test x"${ac_cv_c_tclconfig}" = x ; then |
| 377 | for i in \ |
| 378 | ${srcdir}/../tcl \ |
| 379 | `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ |
| 380 | `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ |
| 381 | `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` |
| 382 | do |
| 383 | if test -f "$i/unix/tclConfig.sh" ; then |
| 384 | ac_cv_c_tclconfig=`(cd $i/unix; pwd)` |
| 385 | break |
| 386 | fi |
| 387 | done |
| 388 | fi |
| 389 | ]) |
| 390 | |
| 391 | if test x"${ac_cv_c_tclconfig}" = x ; then |
| 392 | use_tcl=no |
| 393 | AC_MSG_WARN(Can't find Tcl configuration definitions) |
| 394 | AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***) |
| 395 | AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***) |
| 396 | else |
| 397 | TCL_BIN_DIR=${ac_cv_c_tclconfig} |
| 398 | AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh) |
| 399 | |
| 400 | AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) |
| 401 | if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then |
| 402 | AC_MSG_RESULT([loading]) |
| 403 | . $TCL_BIN_DIR/tclConfig.sh |
| 404 | else |
| 405 | AC_MSG_RESULT([file not found]) |
| 406 | fi |
| 407 | |
| 408 | # |
| 409 | # If the TCL_BIN_DIR is the build directory (not the install directory), |
| 410 | # then set the common variable name to the value of the build variables. |
| 411 | # For example, the variable TCL_LIB_SPEC will be set to the value |
| 412 | # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC |
| 413 | # instead of TCL_BUILD_LIB_SPEC since it will work with both an |
| 414 | # installed and uninstalled version of Tcl. |
| 415 | # |
| 416 | |
mlcreech | ab1c47b | 2008-03-09 02:51:10 +0000 | [diff] [blame] | 417 | if test -f $TCL_BIN_DIR/Makefile ; then |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 418 | TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} |
| 419 | TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} |
| 420 | TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} |
| 421 | fi |
| 422 | |
| 423 | # |
| 424 | # eval is required to do the TCL_DBGX substitution |
| 425 | # |
| 426 | |
| 427 | eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" |
| 428 | eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" |
| 429 | eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" |
| 430 | |
| 431 | eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" |
| 432 | eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" |
| 433 | eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" |
| 434 | |
| 435 | AC_SUBST(TCL_VERSION) |
| 436 | AC_SUBST(TCL_BIN_DIR) |
| 437 | AC_SUBST(TCL_SRC_DIR) |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 438 | AC_SUBST(TCL_INCLUDE_SPEC) |
| 439 | |
| 440 | AC_SUBST(TCL_LIB_FILE) |
| 441 | AC_SUBST(TCL_LIB_FLAG) |
| 442 | AC_SUBST(TCL_LIB_SPEC) |
| 443 | |
| 444 | AC_SUBST(TCL_STUB_LIB_FILE) |
| 445 | AC_SUBST(TCL_STUB_LIB_FLAG) |
| 446 | AC_SUBST(TCL_STUB_LIB_SPEC) |
drh | d881ce8 | 2015-03-31 17:01:52 +0000 | [diff] [blame] | 447 | AC_SUBST(TCL_SHLIB_SUFFIX) |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 448 | fi |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 449 | fi |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 450 | if test "${use_tcl}" = "no" ; then |
| 451 | HAVE_TCL="" |
| 452 | else |
| 453 | HAVE_TCL=1 |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 454 | fi |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 455 | AC_SUBST(HAVE_TCL) |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 456 | |
| 457 | ########## |
| 458 | # Figure out what C libraries are required to compile programs |
| 459 | # that use "readline()" library. |
| 460 | # |
vapier | 4c10a8a | 2007-02-17 14:28:26 +0000 | [diff] [blame] | 461 | TARGET_READLINE_LIBS="" |
| 462 | TARGET_READLINE_INC="" |
| 463 | TARGET_HAVE_READLINE=0 |
| 464 | AC_ARG_ENABLE([readline], |
| 465 | [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])], |
| 466 | [with_readline=$enableval], |
| 467 | [with_readline=auto]) |
| 468 | |
| 469 | if test x"$with_readline" != xno; then |
| 470 | found="yes" |
| 471 | |
| 472 | AC_ARG_WITH([readline-lib], |
| 473 | [AC_HELP_STRING([--with-readline-lib],[specify readline library])], |
| 474 | [with_readline_lib=$withval], |
| 475 | [with_readline_lib="auto"]) |
| 476 | if test "x$with_readline_lib" = xauto; then |
| 477 | save_LIBS="$LIBS" |
| 478 | LIBS="" |
| 479 | AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""]) |
| 480 | AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"]) |
| 481 | TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS" |
| 482 | LIBS="$save_LIBS" |
| 483 | else |
| 484 | TARGET_READLINE_LIBS="$with_readline_lib" |
| 485 | fi |
| 486 | |
| 487 | AC_ARG_WITH([readline-inc], |
| 488 | [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])], |
| 489 | [with_readline_inc=$withval], |
| 490 | [with_readline_inc="auto"]) |
| 491 | if test "x$with_readline_inc" = xauto; then |
| 492 | AC_CHECK_HEADER(readline.h, [found="yes"], [ |
| 493 | found="no" |
| 494 | if test "$cross_compiling" != yes; then |
| 495 | for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do |
| 496 | for subdir in include include/readline; do |
| 497 | AC_CHECK_FILE($dir/$subdir/readline.h, found=yes) |
| 498 | if test "$found" = "yes"; then |
| 499 | TARGET_READLINE_INC="-I$dir/$subdir" |
| 500 | break |
| 501 | fi |
| 502 | done |
| 503 | test "$found" = "yes" && break |
| 504 | done |
| 505 | fi |
| 506 | ]) |
| 507 | else |
| 508 | TARGET_READLINE_INC="$with_readline_inc" |
| 509 | fi |
| 510 | |
| 511 | if test x"$found" = xno; then |
| 512 | TARGET_READLINE_LIBS="" |
| 513 | TARGET_READLINE_INC="" |
| 514 | TARGET_HAVE_READLINE=0 |
| 515 | else |
| 516 | TARGET_HAVE_READLINE=1 |
| 517 | fi |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 518 | fi |
vapier | 4c10a8a | 2007-02-17 14:28:26 +0000 | [diff] [blame] | 519 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 520 | AC_SUBST(TARGET_READLINE_LIBS) |
vapier | 4c10a8a | 2007-02-17 14:28:26 +0000 | [diff] [blame] | 521 | AC_SUBST(TARGET_READLINE_INC) |
| 522 | AC_SUBST(TARGET_HAVE_READLINE) |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 523 | |
| 524 | ########## |
drh | f1878b4 | 2006-01-23 18:06:52 +0000 | [diff] [blame] | 525 | # Figure out what C libraries are required to compile programs |
| 526 | # that use "fdatasync()" function. |
| 527 | # |
drh | f1878b4 | 2006-01-23 18:06:52 +0000 | [diff] [blame] | 528 | AC_SEARCH_LIBS(fdatasync, [rt]) |
drh | f1878b4 | 2006-01-23 18:06:52 +0000 | [diff] [blame] | 529 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 530 | ######### |
tpoindex | 9d9f76c | 2005-01-03 21:28:56 +0000 | [diff] [blame] | 531 | # check for debug enabled |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 532 | AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]), |
tpoindex | 9d9f76c | 2005-01-03 21:28:56 +0000 | [diff] [blame] | 533 | [use_debug=$enableval],[use_debug=no]) |
| 534 | if test "${use_debug}" = "yes" ; then |
drh | eae3a0d | 2006-03-03 20:37:52 +0000 | [diff] [blame] | 535 | TARGET_DEBUG="-DSQLITE_DEBUG=1" |
tpoindex | 9d9f76c | 2005-01-03 21:28:56 +0000 | [diff] [blame] | 536 | else |
| 537 | TARGET_DEBUG="-DNDEBUG" |
| 538 | fi |
| 539 | AC_SUBST(TARGET_DEBUG) |
| 540 | |
| 541 | ######### |
mlcreech | 9498491 | 2008-03-04 19:03:08 +0000 | [diff] [blame] | 542 | # See whether we should use the amalgamation to build |
| 543 | AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation], |
mlcreech | 969b2cd | 2008-03-14 04:11:03 +0000 | [diff] [blame] | 544 | [Disable the amalgamation and instead build all files separately]), |
mlcreech | 9498491 | 2008-03-04 19:03:08 +0000 | [diff] [blame] | 545 | [use_amalgamation=$enableval],[use_amalgamation=yes]) |
mlcreech | f386811 | 2008-03-11 18:03:30 +0000 | [diff] [blame] | 546 | if test "${use_amalgamation}" != "yes" ; then |
mlcreech | 9498491 | 2008-03-04 19:03:08 +0000 | [diff] [blame] | 547 | USE_AMALGAMATION=0 |
| 548 | fi |
| 549 | AC_SUBST(USE_AMALGAMATION) |
| 550 | |
| 551 | ######### |
mlcreech | a4edab0 | 2008-03-06 04:14:17 +0000 | [diff] [blame] | 552 | # See whether we should allow loadable extensions |
drh | 05c7e0b | 2015-01-10 14:27:17 +0000 | [diff] [blame] | 553 | AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--disable-load-extension], |
| 554 | [Disable loading of external extensions]), |
| 555 | [use_loadextension=$enableval],[use_loadextension=yes]) |
mlcreech | a4edab0 | 2008-03-06 04:14:17 +0000 | [diff] [blame] | 556 | if test "${use_loadextension}" = "yes" ; then |
shane | fbedede | 2008-07-22 05:05:01 +0000 | [diff] [blame] | 557 | OPT_FEATURE_FLAGS="" |
drh | dbe4b88 | 2011-06-20 18:00:17 +0000 | [diff] [blame] | 558 | AC_SEARCH_LIBS(dlopen, dl) |
mlcreech | a4edab0 | 2008-03-06 04:14:17 +0000 | [diff] [blame] | 559 | else |
shane | fbedede | 2008-07-22 05:05:01 +0000 | [diff] [blame] | 560 | OPT_FEATURE_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1" |
mlcreech | a4edab0 | 2008-03-06 04:14:17 +0000 | [diff] [blame] | 561 | fi |
mlcreech | a4edab0 | 2008-03-06 04:14:17 +0000 | [diff] [blame] | 562 | |
mlcreech | aac7b93 | 2008-04-01 02:45:22 +0000 | [diff] [blame] | 563 | ######### |
shane | b1cd730 | 2008-10-22 18:27:31 +0000 | [diff] [blame] | 564 | # attempt to duplicate any OMITS and ENABLES into the $(OPT_FEATURE_FLAGS) parameter |
shane | fbedede | 2008-07-22 05:05:01 +0000 | [diff] [blame] | 565 | for option in $CFLAGS $CPPFLAGS |
| 566 | do |
| 567 | case $option in |
danielk1977 | 33a1478 | 2008-08-04 14:50:05 +0000 | [diff] [blame] | 568 | -DSQLITE_OMIT*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";; |
shane | b1cd730 | 2008-10-22 18:27:31 +0000 | [diff] [blame] | 569 | -DSQLITE_ENABLE*) OPT_FEATURE_FLAGS="$OPT_FEATURE_FLAGS $option";; |
shane | fbedede | 2008-07-22 05:05:01 +0000 | [diff] [blame] | 570 | esac |
| 571 | done |
| 572 | AC_SUBST(OPT_FEATURE_FLAGS) |
| 573 | |
| 574 | |
shane | b1cd730 | 2008-10-22 18:27:31 +0000 | [diff] [blame] | 575 | # attempt to remove any OMITS and ENABLES from the $(CFLAGS) parameter |
shane | fbedede | 2008-07-22 05:05:01 +0000 | [diff] [blame] | 576 | ac_temp_CFLAGS="" |
| 577 | for option in $CFLAGS |
| 578 | do |
| 579 | case $option in |
| 580 | -DSQLITE_OMIT*) ;; |
shane | b1cd730 | 2008-10-22 18:27:31 +0000 | [diff] [blame] | 581 | -DSQLITE_ENABLE*) ;; |
danielk1977 | 33a1478 | 2008-08-04 14:50:05 +0000 | [diff] [blame] | 582 | *) ac_temp_CFLAGS="$ac_temp_CFLAGS $option";; |
shane | fbedede | 2008-07-22 05:05:01 +0000 | [diff] [blame] | 583 | esac |
| 584 | done |
| 585 | CFLAGS=$ac_temp_CFLAGS |
| 586 | |
| 587 | |
shane | b1cd730 | 2008-10-22 18:27:31 +0000 | [diff] [blame] | 588 | # attempt to remove any OMITS and ENABLES from the $(CPPFLAGS) parameter |
shane | fbedede | 2008-07-22 05:05:01 +0000 | [diff] [blame] | 589 | ac_temp_CPPFLAGS="" |
| 590 | for option in $CPPFLAGS |
| 591 | do |
| 592 | case $option in |
| 593 | -DSQLITE_OMIT*) ;; |
shane | b1cd730 | 2008-10-22 18:27:31 +0000 | [diff] [blame] | 594 | -DSQLITE_ENABLE*) ;; |
danielk1977 | 33a1478 | 2008-08-04 14:50:05 +0000 | [diff] [blame] | 595 | *) ac_temp_CPPFLAGS="$ac_temp_CPPFLAGS $option";; |
shane | fbedede | 2008-07-22 05:05:01 +0000 | [diff] [blame] | 596 | esac |
| 597 | done |
| 598 | CPPFLAGS=$ac_temp_CPPFLAGS |
| 599 | |
| 600 | |
shane | b1cd730 | 2008-10-22 18:27:31 +0000 | [diff] [blame] | 601 | # attempt to remove any OMITS and ENABLES from the $(BUILD_CFLAGS) parameter |
shane | fbedede | 2008-07-22 05:05:01 +0000 | [diff] [blame] | 602 | ac_temp_BUILD_CFLAGS="" |
| 603 | for option in $BUILD_CFLAGS |
| 604 | do |
| 605 | case $option in |
| 606 | -DSQLITE_OMIT*) ;; |
shane | b1cd730 | 2008-10-22 18:27:31 +0000 | [diff] [blame] | 607 | -DSQLITE_ENABLE*) ;; |
danielk1977 | 33a1478 | 2008-08-04 14:50:05 +0000 | [diff] [blame] | 608 | *) ac_temp_BUILD_CFLAGS="$ac_temp_BUILD_CFLAGS $option";; |
shane | fbedede | 2008-07-22 05:05:01 +0000 | [diff] [blame] | 609 | esac |
| 610 | done |
| 611 | BUILD_CFLAGS=$ac_temp_BUILD_CFLAGS |
| 612 | |
| 613 | |
| 614 | ######### |
| 615 | # See whether we should use GCOV |
mlcreech | aac7b93 | 2008-04-01 02:45:22 +0000 | [diff] [blame] | 616 | AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov], |
| 617 | [Enable coverage testing using gcov]), |
| 618 | [use_gcov=$enableval],[use_gcov=no]) |
| 619 | if test "${use_gcov}" = "yes" ; then |
| 620 | USE_GCOV=1 |
| 621 | else |
| 622 | USE_GCOV=0 |
| 623 | fi |
| 624 | AC_SUBST(USE_GCOV) |
| 625 | |
drh | af6edf5 | 2005-10-04 18:38:49 +0000 | [diff] [blame] | 626 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 627 | ######### |
mlcreech | b87057f | 2008-03-06 07:19:20 +0000 | [diff] [blame] | 628 | # Output the config header |
mlcreech | 2379706 | 2008-03-20 02:25:35 +0000 | [diff] [blame] | 629 | AC_CONFIG_HEADERS(config.h) |
mlcreech | b87057f | 2008-03-06 07:19:20 +0000 | [diff] [blame] | 630 | |
| 631 | ######### |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 632 | # Generate the output files. |
| 633 | # |
mlcreech | 8390bc3 | 2008-03-06 08:54:38 +0000 | [diff] [blame] | 634 | AC_SUBST(BUILD_CFLAGS) |
a.rottmann | c7e9383 | 2003-03-24 09:39:32 +0000 | [diff] [blame] | 635 | AC_OUTPUT([ |
| 636 | Makefile |
dougcurrie | 12b3444 | 2004-07-19 03:24:59 +0000 | [diff] [blame] | 637 | sqlite3.pc |
a.rottmann | c7e9383 | 2003-03-24 09:39:32 +0000 | [diff] [blame] | 638 | ]) |