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 | # |
| 72 | # The generated configure script will make an attempt to guess |
| 73 | # at all of the above parameters. You can override any of |
| 74 | # the guesses by setting the environment variable named |
| 75 | # "config_AAAA" where "AAAA" is the name of the parameter |
| 76 | # described above. (Exception: srcdir cannot be set this way.) |
| 77 | # If you have a file that sets one or more of these environment |
| 78 | # variables, you can invoke configure as follows: |
| 79 | # |
| 80 | # configure --with-hints=FILE |
| 81 | # |
| 82 | # where FILE is the name of the file that sets the environment |
| 83 | # variables. FILE should be an absolute pathname. |
| 84 | # |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 85 | # This configure.in file is easy to reuse on other projects. Just |
| 86 | # change the argument to AC_INIT(). And disable any features that |
| 87 | # you don't need (for example BLT) by erasing or commenting out |
| 88 | # the corresponding code. |
| 89 | # |
mlcreech | b87057f | 2008-03-06 07:19:20 +0000 | [diff] [blame] | 90 | AC_INIT(sqlite, m4_esyscmd([cat VERSION | tr -d '\n'])) |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 91 | |
| 92 | dnl Put the RCS revision string after AC_INIT so that it will also |
| 93 | dnl show in in configure. |
| 94 | # The following RCS revision string applies to configure.in |
mlcreech | 636a995 | 2008-05-05 22:52:56 +0000 | [diff] [blame] | 95 | # $Revision: 1.45 $ |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 96 | |
| 97 | ######### |
| 98 | # Programs needed |
| 99 | # |
| 100 | AC_PROG_LIBTOOL |
| 101 | AC_PROG_INSTALL |
drh | f1878b4 | 2006-01-23 18:06:52 +0000 | [diff] [blame] | 102 | AC_PROG_AWK |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 103 | |
| 104 | ######### |
mlcreech | 636a995 | 2008-05-05 22:52:56 +0000 | [diff] [blame] | 105 | # Enable large file support (if special flags are necessary) |
| 106 | # |
| 107 | AC_SYS_LARGEFILE |
| 108 | |
| 109 | ######### |
mlcreech | b87057f | 2008-03-06 07:19:20 +0000 | [diff] [blame] | 110 | # Check for needed/wanted data types |
| 111 | AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t, |
| 112 | uint16_t, uint32_t, uint64_t, uintptr_t]) |
| 113 | |
| 114 | ######### |
| 115 | # Check for needed/wanted headers |
mlcreech | 5b0a9eb | 2008-03-09 01:38:09 +0000 | [diff] [blame] | 116 | AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h]) |
| 117 | |
| 118 | ######### |
| 119 | # Figure out whether or not we have these functions |
| 120 | # |
| 121 | AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r]) |
| 122 | |
mlcreech | ab1c47b | 2008-03-09 02:51:10 +0000 | [diff] [blame] | 123 | ######### |
mlcreech | f386811 | 2008-03-11 18:03:30 +0000 | [diff] [blame] | 124 | # By default, we use the amalgamation (this may be changed below...) |
| 125 | # |
| 126 | USE_AMALGAMATION=1 |
| 127 | |
| 128 | ######### |
mlcreech | ab1c47b | 2008-03-09 02:51:10 +0000 | [diff] [blame] | 129 | # See whether we can run specific tclsh versions known to work well; |
| 130 | # if not, then we fall back to plain tclsh. |
| 131 | # TODO: try other versions before falling back? |
| 132 | # |
mlcreech | f386811 | 2008-03-11 18:03:30 +0000 | [diff] [blame] | 133 | AC_CHECK_PROGS(TCLSH_CMD, [tclsh8.4 tclsh], none) |
| 134 | if test "$TCLSH_CMD" = "none"; then |
| 135 | # If we can't find a local tclsh, then building the amalgamation will fail. |
| 136 | # We act as though --disable-amalgamation has been used. |
| 137 | echo "Warning: can't find tclsh - defaulting to non-amalgamation build." |
| 138 | USE_AMALGAMATION=0 |
| 139 | TCLSH_CMD="tclsh" |
| 140 | fi |
mlcreech | ab1c47b | 2008-03-09 02:51:10 +0000 | [diff] [blame] | 141 | AC_SUBST(TCLSH_CMD) |
| 142 | |
mlcreech | b87057f | 2008-03-06 07:19:20 +0000 | [diff] [blame] | 143 | |
| 144 | ######### |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 145 | # Set up an appropriate program prefix |
| 146 | # |
| 147 | if test "$program_prefix" = "NONE"; then |
| 148 | program_prefix="" |
| 149 | fi |
| 150 | AC_SUBST(program_prefix) |
| 151 | |
drh | 4b2266a | 2004-11-27 15:52:16 +0000 | [diff] [blame] | 152 | VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`] |
| 153 | echo "Version set to $VERSION" |
a.rottmann | c7e9383 | 2003-03-24 09:39:32 +0000 | [diff] [blame] | 154 | AC_SUBST(VERSION) |
drh | 4b2266a | 2004-11-27 15:52:16 +0000 | [diff] [blame] | 155 | RELEASE=`cat $srcdir/VERSION` |
| 156 | echo "Release set to $RELEASE" |
| 157 | AC_SUBST(RELEASE) |
drh | 26d0e2a | 2005-07-06 13:51:27 +0000 | [diff] [blame] | 158 | VERSION_NUMBER=[`cat $srcdir/VERSION \ |
drh | b797783 | 2005-02-16 03:45:51 +0000 | [diff] [blame] | 159 | | sed 's/[^0-9]/ /g' \ |
drh | 26d0e2a | 2005-07-06 13:51:27 +0000 | [diff] [blame] | 160 | | awk '{printf "%d%03d%03d",$1,$2,$3}'`] |
drh | b797783 | 2005-02-16 03:45:51 +0000 | [diff] [blame] | 161 | echo "Version number set to $VERSION_NUMBER" |
| 162 | AC_SUBST(VERSION_NUMBER) |
a.rottmann | c7e9383 | 2003-03-24 09:39:32 +0000 | [diff] [blame] | 163 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 164 | ######### |
| 165 | # Check to see if the --with-hints=FILE option is used. If there is none, |
| 166 | # then check for a files named "$host.hints" and ../$hosts.hints where |
| 167 | # $host is the hostname of the build system. If still no hints are |
| 168 | # found, try looking in $system.hints and ../$system.hints where |
| 169 | # $system is the result of uname -s. |
| 170 | # |
| 171 | AC_ARG_WITH(hints, |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 172 | AC_HELP_STRING([--with-hints=FILE],[Read configuration options from FILE]), |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 173 | hints=$withval) |
| 174 | if test "$hints" = ""; then |
| 175 | host=`hostname | sed 's/\..*//'` |
| 176 | if test -r $host.hints; then |
| 177 | hints=$host.hints |
| 178 | else |
| 179 | if test -r ../$host.hints; then |
| 180 | hints=../$host.hints |
| 181 | fi |
| 182 | fi |
| 183 | fi |
| 184 | if test "$hints" = ""; then |
| 185 | sys=`uname -s` |
| 186 | if test -r $sys.hints; then |
| 187 | hints=$sys.hints |
| 188 | else |
| 189 | if test -r ../$sys.hints; then |
| 190 | hints=../$sys.hints |
| 191 | fi |
| 192 | fi |
| 193 | fi |
| 194 | if test "$hints" != ""; then |
| 195 | AC_MSG_RESULT(reading hints from $hints) |
| 196 | . $hints |
| 197 | fi |
| 198 | |
| 199 | ######### |
| 200 | # Locate a compiler for the build machine. This compiler should |
| 201 | # generate command-line programs that run on the build machine. |
| 202 | # |
vapier | c8a1530 | 2007-02-17 14:31:55 +0000 | [diff] [blame] | 203 | if test x"$cross_compiling" = xno; then |
| 204 | BUILD_CC=$CC |
| 205 | BUILD_CFLAGS=$CFLAGS |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 206 | else |
vapier | c8a1530 | 2007-02-17 14:31:55 +0000 | [diff] [blame] | 207 | if test "${BUILD_CC+set}" != set; then |
| 208 | AC_CHECK_PROGS(BUILD_CC, gcc cc cl) |
| 209 | fi |
| 210 | if test "${BUILD_CFLAGS+set}" != set; then |
| 211 | BUILD_CFLAGS="-g" |
| 212 | fi |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 213 | fi |
| 214 | AC_SUBST(BUILD_CC) |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 215 | |
| 216 | ########## |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 217 | # Do we want to support multithreaded use of sqlite |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 218 | # |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 219 | AC_ARG_ENABLE(threadsafe, |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 220 | AC_HELP_STRING([--enable-threadsafe],[Support threadsafe operation]),,enable_threadsafe=yes) |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 221 | AC_MSG_CHECKING([whether to support threadsafe operation]) |
| 222 | if test "$enable_threadsafe" = "no"; then |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 223 | SQLITE_THREADSAFE=0 |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 224 | AC_MSG_RESULT([no]) |
| 225 | else |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 226 | SQLITE_THREADSAFE=1 |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 227 | AC_MSG_RESULT([yes]) |
| 228 | fi |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 229 | AC_SUBST(SQLITE_THREADSAFE) |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 230 | |
drh | 5a3032b | 2007-09-03 16:12:09 +0000 | [diff] [blame] | 231 | if test "$SQLITE_THREADSAFE" = "1"; then |
mlcreech | c658b0f | 2008-03-09 02:20:11 +0000 | [diff] [blame] | 232 | AC_SEARCH_LIBS(pthread_create, pthread) |
dougcurrie | 65623c7 | 2004-09-20 14:57:23 +0000 | [diff] [blame] | 233 | fi |
dougcurrie | 65623c7 | 2004-09-20 14:57:23 +0000 | [diff] [blame] | 234 | |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 235 | ########## |
drh | 91636d5 | 2005-11-24 23:14:00 +0000 | [diff] [blame] | 236 | # Do we want to allow a connection created in one thread to be used |
| 237 | # in another thread. This does not work on many Linux systems (ex: RedHat 9) |
| 238 | # due to bugs in the threading implementations. This is thus off by default. |
| 239 | # |
| 240 | AC_ARG_ENABLE(cross-thread-connections, |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 241 | AC_HELP_STRING([--enable-cross-thread-connections],[Allow connection sharing across threads]),,enable_xthreadconnect=no) |
drh | 91636d5 | 2005-11-24 23:14:00 +0000 | [diff] [blame] | 242 | AC_MSG_CHECKING([whether to allow connections to be shared across threads]) |
| 243 | if test "$enable_xthreadconnect" = "no"; then |
| 244 | XTHREADCONNECT='' |
| 245 | AC_MSG_RESULT([no]) |
| 246 | else |
| 247 | XTHREADCONNECT='-DSQLITE_ALLOW_XTHREAD_CONNECT=1' |
| 248 | AC_MSG_RESULT([yes]) |
| 249 | fi |
| 250 | AC_SUBST(XTHREADCONNECT) |
| 251 | |
| 252 | ########## |
drh | 8e2e2a1 | 2006-02-01 01:55:17 +0000 | [diff] [blame] | 253 | # Do we want to set threadsOverrideEachOthersLocks variable to be 1 (true) by |
| 254 | # default. Normally, a test at runtime is performed to determine the |
| 255 | # appropriate value of this variable. Use this option only if you're sure that |
| 256 | # threads can safely override each others locks in all runtime situations. |
| 257 | # |
| 258 | AC_ARG_ENABLE(threads-override-locks, |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 259 | AC_HELP_STRING([--enable-threads-override-locks],[Threads can override each others locks]),,enable_threads_override_locks=no) |
drh | 8e2e2a1 | 2006-02-01 01:55:17 +0000 | [diff] [blame] | 260 | AC_MSG_CHECKING([whether threads can override each others locks]) |
| 261 | if test "$enable_threads_override_locks" = "no"; then |
| 262 | THREADSOVERRIDELOCKS='-1' |
| 263 | AC_MSG_RESULT([no]) |
| 264 | else |
| 265 | THREADSOVERRIDELOCKS='1' |
| 266 | AC_MSG_RESULT([yes]) |
| 267 | fi |
| 268 | AC_SUBST(THREADSOVERRIDELOCKS) |
| 269 | |
| 270 | ########## |
xdong | 3b5543c | 2003-09-23 00:36:50 +0000 | [diff] [blame] | 271 | # Do we want to support release |
| 272 | # |
| 273 | AC_ARG_ENABLE(releasemode, |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 274 | 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] | 275 | AC_MSG_CHECKING([whether to support shared library linked as release mode or not]) |
| 276 | if test "$enable_releasemode" = "no"; then |
| 277 | ALLOWRELEASE="" |
| 278 | AC_MSG_RESULT([no]) |
| 279 | else |
drh | 0b47d34 | 2007-11-27 14:50:06 +0000 | [diff] [blame] | 280 | ALLOWRELEASE="-release `cat $srcdir/VERSION`" |
xdong | 3b5543c | 2003-09-23 00:36:50 +0000 | [diff] [blame] | 281 | AC_MSG_RESULT([yes]) |
| 282 | fi |
| 283 | AC_SUBST(ALLOWRELEASE) |
| 284 | |
| 285 | ########## |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 286 | # Do we want temporary databases in memory |
| 287 | # |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 288 | AC_ARG_ENABLE(tempstore, |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 289 | 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] | 290 | AC_MSG_CHECKING([whether to use an in-ram database for temporary tables]) |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 291 | case "$enable_tempstore" in |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 292 | never ) |
paul | 2dc96f9 | 2003-04-20 11:46:34 +0000 | [diff] [blame] | 293 | TEMP_STORE=0 |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 294 | AC_MSG_RESULT([never]) |
| 295 | ;; |
| 296 | no ) |
paul | 2dc96f9 | 2003-04-20 11:46:34 +0000 | [diff] [blame] | 297 | TEMP_STORE=1 |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 298 | AC_MSG_RESULT([no]) |
| 299 | ;; |
| 300 | always ) |
dougcurrie | 0f290bf | 2004-06-21 18:57:29 +0000 | [diff] [blame] | 301 | TEMP_STORE=3 |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 302 | AC_MSG_RESULT([always]) |
| 303 | ;; |
drh | 54414bb | 2005-10-10 00:05:50 +0000 | [diff] [blame] | 304 | yes ) |
| 305 | TEMP_STORE=3 |
| 306 | AC_MSG_RESULT([always]) |
| 307 | ;; |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 308 | * ) |
drh | 54414bb | 2005-10-10 00:05:50 +0000 | [diff] [blame] | 309 | TEMP_STORE=1 |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 310 | AC_MSG_RESULT([yes]) |
| 311 | ;; |
| 312 | esac |
paul | 2dc96f9 | 2003-04-20 11:46:34 +0000 | [diff] [blame] | 313 | |
paul | 2dc96f9 | 2003-04-20 11:46:34 +0000 | [diff] [blame] | 314 | AC_SUBST(TEMP_STORE) |
paul | b0208cc | 2003-04-13 18:26:49 +0000 | [diff] [blame] | 315 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 316 | ########### |
| 317 | # Lots of things are different if we are compiling for Windows using |
| 318 | # the CYGWIN environment. So check for that special case and handle |
| 319 | # things accordingly. |
| 320 | # |
| 321 | AC_MSG_CHECKING([if executables have the .exe suffix]) |
| 322 | if test "$config_BUILD_EXEEXT" = ".exe"; then |
| 323 | CYGWIN=yes |
| 324 | AC_MSG_RESULT(yes) |
| 325 | else |
| 326 | AC_MSG_RESULT(unknown) |
| 327 | fi |
| 328 | if test "$CYGWIN" != "yes"; then |
| 329 | AC_CYGWIN |
| 330 | fi |
| 331 | if test "$CYGWIN" = "yes"; then |
| 332 | BUILD_EXEEXT=.exe |
| 333 | else |
dougcurrie | 6194a5f | 2003-12-19 20:09:51 +0000 | [diff] [blame] | 334 | BUILD_EXEEXT=$EXEEXT |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 335 | fi |
vapier | c8a1530 | 2007-02-17 14:31:55 +0000 | [diff] [blame] | 336 | if test x"$cross_compiling" = xno; then |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 337 | TARGET_EXEEXT=$BUILD_EXEEXT |
| 338 | else |
| 339 | TARGET_EXEEXT=$config_TARGET_EXEEXT |
| 340 | fi |
| 341 | if test "$TARGET_EXEEXT" = ".exe"; then |
drh | 60a1e4b | 2006-06-03 18:02:15 +0000 | [diff] [blame] | 342 | if test $OS2_SHELL ; then |
| 343 | OS_UNIX=0 |
| 344 | OS_WIN=0 |
| 345 | OS_OS2=1 |
mlcreech | 8390bc3 | 2008-03-06 08:54:38 +0000 | [diff] [blame] | 346 | CFLAGS="$CFLAGS -DOS_OS2=1" |
mlcreech | 57ee052 | 2008-04-14 22:57:55 +0000 | [diff] [blame] | 347 | if test "$ac_compiler_gnu" = "yes" ; then |
mlcreech | 8390bc3 | 2008-03-06 08:54:38 +0000 | [diff] [blame] | 348 | CFLAGS="$CFLAGS -Zomf -Zexe -Zmap" |
drh | 60a1e4b | 2006-06-03 18:02:15 +0000 | [diff] [blame] | 349 | BUILD_CFLAGS="$BUILD_CFLAGS -Zomf -Zexe" |
| 350 | fi |
| 351 | else |
| 352 | OS_UNIX=0 |
| 353 | OS_WIN=1 |
| 354 | OS_OS2=0 |
| 355 | tclsubdir=win |
mlcreech | 8390bc3 | 2008-03-06 08:54:38 +0000 | [diff] [blame] | 356 | CFLAGS="$CFLAGS -DOS_WIN=1" |
drh | 60a1e4b | 2006-06-03 18:02:15 +0000 | [diff] [blame] | 357 | fi |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 358 | else |
| 359 | OS_UNIX=1 |
| 360 | OS_WIN=0 |
drh | 60a1e4b | 2006-06-03 18:02:15 +0000 | [diff] [blame] | 361 | OS_OS2=0 |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 362 | tclsubdir=unix |
mlcreech | 8390bc3 | 2008-03-06 08:54:38 +0000 | [diff] [blame] | 363 | CFLAGS="$CFLAGS -DOS_UNIX=1" |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 364 | fi |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 365 | |
| 366 | AC_SUBST(BUILD_EXEEXT) |
| 367 | AC_SUBST(OS_UNIX) |
| 368 | AC_SUBST(OS_WIN) |
drh | 60a1e4b | 2006-06-03 18:02:15 +0000 | [diff] [blame] | 369 | AC_SUBST(OS_OS2) |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 370 | AC_SUBST(TARGET_EXEEXT) |
| 371 | |
| 372 | ########## |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 373 | # Figure out all the parameters needed to compile against Tcl. |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 374 | # |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 375 | # This code is derived from the SC_PATH_TCLCONFIG and SC_LOAD_TCLCONFIG |
| 376 | # macros in the in the tcl.m4 file of the standard TCL distribution. |
| 377 | # Those macros could not be used directly since we have to make some |
| 378 | # minor changes to accomodate systems that do not have TCL installed. |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 379 | # |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 380 | 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] | 381 | [use_tcl=$enableval],[use_tcl=yes]) |
| 382 | if test "${use_tcl}" = "yes" ; then |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 383 | 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] | 384 | AC_MSG_CHECKING([for Tcl configuration]) |
| 385 | AC_CACHE_VAL(ac_cv_c_tclconfig,[ |
| 386 | # First check to see if --with-tcl was specified. |
| 387 | if test x"${with_tclconfig}" != x ; then |
| 388 | if test -f "${with_tclconfig}/tclConfig.sh" ; then |
| 389 | ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` |
| 390 | else |
| 391 | AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh]) |
| 392 | fi |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 393 | fi |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 394 | # then check for a private Tcl installation |
| 395 | if test x"${ac_cv_c_tclconfig}" = x ; then |
| 396 | for i in \ |
| 397 | ../tcl \ |
| 398 | `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ |
| 399 | `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ |
| 400 | `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ |
| 401 | ../../tcl \ |
| 402 | `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ |
| 403 | `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ |
| 404 | `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ |
| 405 | ../../../tcl \ |
| 406 | `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ |
| 407 | `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ |
| 408 | `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` |
| 409 | do |
| 410 | if test -f "$i/unix/tclConfig.sh" ; then |
| 411 | ac_cv_c_tclconfig=`(cd $i/unix; pwd)` |
| 412 | break |
| 413 | fi |
| 414 | done |
| 415 | fi |
| 416 | |
| 417 | # check in a few common install locations |
| 418 | if test x"${ac_cv_c_tclconfig}" = x ; then |
| 419 | for i in \ |
| 420 | `ls -d ${libdir} 2>/dev/null` \ |
| 421 | `ls -d /usr/local/lib 2>/dev/null` \ |
| 422 | `ls -d /usr/contrib/lib 2>/dev/null` \ |
| 423 | `ls -d /usr/lib 2>/dev/null` |
| 424 | do |
| 425 | if test -f "$i/tclConfig.sh" ; then |
| 426 | ac_cv_c_tclconfig=`(cd $i; pwd)` |
| 427 | break |
| 428 | fi |
| 429 | done |
| 430 | fi |
| 431 | |
| 432 | # check in a few other private locations |
| 433 | if test x"${ac_cv_c_tclconfig}" = x ; then |
| 434 | for i in \ |
| 435 | ${srcdir}/../tcl \ |
| 436 | `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ |
| 437 | `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ |
| 438 | `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` |
| 439 | do |
| 440 | if test -f "$i/unix/tclConfig.sh" ; then |
| 441 | ac_cv_c_tclconfig=`(cd $i/unix; pwd)` |
| 442 | break |
| 443 | fi |
| 444 | done |
| 445 | fi |
| 446 | ]) |
| 447 | |
| 448 | if test x"${ac_cv_c_tclconfig}" = x ; then |
| 449 | use_tcl=no |
| 450 | AC_MSG_WARN(Can't find Tcl configuration definitions) |
| 451 | AC_MSG_WARN(*** Without Tcl the regression tests cannot be executed ***) |
| 452 | AC_MSG_WARN(*** Consider using --with-tcl=... to define location of Tcl ***) |
| 453 | else |
| 454 | TCL_BIN_DIR=${ac_cv_c_tclconfig} |
| 455 | AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh) |
| 456 | |
| 457 | AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh]) |
| 458 | if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then |
| 459 | AC_MSG_RESULT([loading]) |
| 460 | . $TCL_BIN_DIR/tclConfig.sh |
| 461 | else |
| 462 | AC_MSG_RESULT([file not found]) |
| 463 | fi |
| 464 | |
| 465 | # |
| 466 | # If the TCL_BIN_DIR is the build directory (not the install directory), |
| 467 | # then set the common variable name to the value of the build variables. |
| 468 | # For example, the variable TCL_LIB_SPEC will be set to the value |
| 469 | # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC |
| 470 | # instead of TCL_BUILD_LIB_SPEC since it will work with both an |
| 471 | # installed and uninstalled version of Tcl. |
| 472 | # |
| 473 | |
mlcreech | ab1c47b | 2008-03-09 02:51:10 +0000 | [diff] [blame] | 474 | if test -f $TCL_BIN_DIR/Makefile ; then |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 475 | TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} |
| 476 | TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} |
| 477 | TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} |
| 478 | fi |
| 479 | |
| 480 | # |
| 481 | # eval is required to do the TCL_DBGX substitution |
| 482 | # |
| 483 | |
| 484 | eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" |
| 485 | eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" |
| 486 | eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" |
| 487 | |
| 488 | eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" |
| 489 | eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" |
| 490 | eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" |
| 491 | |
| 492 | AC_SUBST(TCL_VERSION) |
| 493 | AC_SUBST(TCL_BIN_DIR) |
| 494 | AC_SUBST(TCL_SRC_DIR) |
| 495 | AC_SUBST(TCL_LIBS) |
| 496 | AC_SUBST(TCL_INCLUDE_SPEC) |
| 497 | |
| 498 | AC_SUBST(TCL_LIB_FILE) |
| 499 | AC_SUBST(TCL_LIB_FLAG) |
| 500 | AC_SUBST(TCL_LIB_SPEC) |
| 501 | |
| 502 | AC_SUBST(TCL_STUB_LIB_FILE) |
| 503 | AC_SUBST(TCL_STUB_LIB_FLAG) |
| 504 | AC_SUBST(TCL_STUB_LIB_SPEC) |
| 505 | fi |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 506 | fi |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 507 | if test "${use_tcl}" = "no" ; then |
| 508 | HAVE_TCL="" |
| 509 | else |
| 510 | HAVE_TCL=1 |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 511 | fi |
drh | 7b5717e | 2004-11-25 13:50:01 +0000 | [diff] [blame] | 512 | AC_SUBST(HAVE_TCL) |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 513 | |
| 514 | ########## |
| 515 | # Figure out what C libraries are required to compile programs |
| 516 | # that use "readline()" library. |
| 517 | # |
vapier | 4c10a8a | 2007-02-17 14:28:26 +0000 | [diff] [blame] | 518 | TARGET_READLINE_LIBS="" |
| 519 | TARGET_READLINE_INC="" |
| 520 | TARGET_HAVE_READLINE=0 |
| 521 | AC_ARG_ENABLE([readline], |
| 522 | [AC_HELP_STRING([--disable-readline],[disable readline support [default=detect]])], |
| 523 | [with_readline=$enableval], |
| 524 | [with_readline=auto]) |
| 525 | |
| 526 | if test x"$with_readline" != xno; then |
| 527 | found="yes" |
| 528 | |
| 529 | AC_ARG_WITH([readline-lib], |
| 530 | [AC_HELP_STRING([--with-readline-lib],[specify readline library])], |
| 531 | [with_readline_lib=$withval], |
| 532 | [with_readline_lib="auto"]) |
| 533 | if test "x$with_readline_lib" = xauto; then |
| 534 | save_LIBS="$LIBS" |
| 535 | LIBS="" |
| 536 | AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap], [term_LIBS="$LIBS"], [term_LIBS=""]) |
| 537 | AC_CHECK_LIB([readline], [readline], [TARGET_READLINE_LIBS="-lreadline"], [found="no"]) |
| 538 | TARGET_READLINE_LIBS="$TARGET_READLINE_LIBS $term_LIBS" |
| 539 | LIBS="$save_LIBS" |
| 540 | else |
| 541 | TARGET_READLINE_LIBS="$with_readline_lib" |
| 542 | fi |
| 543 | |
| 544 | AC_ARG_WITH([readline-inc], |
| 545 | [AC_HELP_STRING([--with-readline-inc],[specify readline include paths])], |
| 546 | [with_readline_inc=$withval], |
| 547 | [with_readline_inc="auto"]) |
| 548 | if test "x$with_readline_inc" = xauto; then |
| 549 | AC_CHECK_HEADER(readline.h, [found="yes"], [ |
| 550 | found="no" |
| 551 | if test "$cross_compiling" != yes; then |
| 552 | for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do |
| 553 | for subdir in include include/readline; do |
| 554 | AC_CHECK_FILE($dir/$subdir/readline.h, found=yes) |
| 555 | if test "$found" = "yes"; then |
| 556 | TARGET_READLINE_INC="-I$dir/$subdir" |
| 557 | break |
| 558 | fi |
| 559 | done |
| 560 | test "$found" = "yes" && break |
| 561 | done |
| 562 | fi |
| 563 | ]) |
| 564 | else |
| 565 | TARGET_READLINE_INC="$with_readline_inc" |
| 566 | fi |
| 567 | |
| 568 | if test x"$found" = xno; then |
| 569 | TARGET_READLINE_LIBS="" |
| 570 | TARGET_READLINE_INC="" |
| 571 | TARGET_HAVE_READLINE=0 |
| 572 | else |
| 573 | TARGET_HAVE_READLINE=1 |
| 574 | fi |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 575 | fi |
vapier | 4c10a8a | 2007-02-17 14:28:26 +0000 | [diff] [blame] | 576 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 577 | AC_SUBST(TARGET_READLINE_LIBS) |
vapier | 4c10a8a | 2007-02-17 14:28:26 +0000 | [diff] [blame] | 578 | AC_SUBST(TARGET_READLINE_INC) |
| 579 | AC_SUBST(TARGET_HAVE_READLINE) |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 580 | |
| 581 | ########## |
drh | f1878b4 | 2006-01-23 18:06:52 +0000 | [diff] [blame] | 582 | # Figure out what C libraries are required to compile programs |
| 583 | # that use "fdatasync()" function. |
| 584 | # |
drh | f1878b4 | 2006-01-23 18:06:52 +0000 | [diff] [blame] | 585 | AC_SEARCH_LIBS(fdatasync, [rt]) |
drh | f1878b4 | 2006-01-23 18:06:52 +0000 | [diff] [blame] | 586 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 587 | ######### |
tpoindex | 9d9f76c | 2005-01-03 21:28:56 +0000 | [diff] [blame] | 588 | # check for debug enabled |
drh | 94e4f82 | 2006-02-15 02:00:25 +0000 | [diff] [blame] | 589 | AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],[enable debugging & verbose explain]), |
tpoindex | 9d9f76c | 2005-01-03 21:28:56 +0000 | [diff] [blame] | 590 | [use_debug=$enableval],[use_debug=no]) |
| 591 | if test "${use_debug}" = "yes" ; then |
drh | eae3a0d | 2006-03-03 20:37:52 +0000 | [diff] [blame] | 592 | TARGET_DEBUG="-DSQLITE_DEBUG=1" |
tpoindex | 9d9f76c | 2005-01-03 21:28:56 +0000 | [diff] [blame] | 593 | else |
| 594 | TARGET_DEBUG="-DNDEBUG" |
| 595 | fi |
| 596 | AC_SUBST(TARGET_DEBUG) |
| 597 | |
| 598 | ######### |
mlcreech | 9498491 | 2008-03-04 19:03:08 +0000 | [diff] [blame] | 599 | # See whether we should use the amalgamation to build |
| 600 | AC_ARG_ENABLE(amalgamation, AC_HELP_STRING([--disable-amalgamation], |
mlcreech | 969b2cd | 2008-03-14 04:11:03 +0000 | [diff] [blame] | 601 | [Disable the amalgamation and instead build all files separately]), |
mlcreech | 9498491 | 2008-03-04 19:03:08 +0000 | [diff] [blame] | 602 | [use_amalgamation=$enableval],[use_amalgamation=yes]) |
mlcreech | f386811 | 2008-03-11 18:03:30 +0000 | [diff] [blame] | 603 | if test "${use_amalgamation}" != "yes" ; then |
mlcreech | 9498491 | 2008-03-04 19:03:08 +0000 | [diff] [blame] | 604 | USE_AMALGAMATION=0 |
| 605 | fi |
| 606 | AC_SUBST(USE_AMALGAMATION) |
| 607 | |
| 608 | ######### |
mlcreech | a4edab0 | 2008-03-06 04:14:17 +0000 | [diff] [blame] | 609 | # See whether we should allow loadable extensions |
| 610 | AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension], |
| 611 | [Enable loading of external extensions]), |
| 612 | [use_loadextension=$enableval],[use_loadextension=no]) |
| 613 | if test "${use_loadextension}" = "yes" ; then |
| 614 | LOADEXTENSION_FLAGS="" |
| 615 | else |
| 616 | LOADEXTENSION_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1" |
| 617 | fi |
| 618 | AC_SUBST(LOADEXTENSION_FLAGS) |
| 619 | |
mlcreech | aac7b93 | 2008-04-01 02:45:22 +0000 | [diff] [blame] | 620 | ######### |
| 621 | # See whether we should allow loadable extensions |
| 622 | AC_ARG_ENABLE(gcov, AC_HELP_STRING([--enable-gcov], |
| 623 | [Enable coverage testing using gcov]), |
| 624 | [use_gcov=$enableval],[use_gcov=no]) |
| 625 | if test "${use_gcov}" = "yes" ; then |
| 626 | USE_GCOV=1 |
| 627 | else |
| 628 | USE_GCOV=0 |
| 629 | fi |
| 630 | AC_SUBST(USE_GCOV) |
| 631 | |
drh | af6edf5 | 2005-10-04 18:38:49 +0000 | [diff] [blame] | 632 | |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 633 | ######### |
mlcreech | b87057f | 2008-03-06 07:19:20 +0000 | [diff] [blame] | 634 | # Output the config header |
mlcreech | 2379706 | 2008-03-20 02:25:35 +0000 | [diff] [blame] | 635 | AC_CONFIG_HEADERS(config.h) |
mlcreech | b87057f | 2008-03-06 07:19:20 +0000 | [diff] [blame] | 636 | |
| 637 | ######### |
drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame] | 638 | # Generate the output files. |
| 639 | # |
mlcreech | 8390bc3 | 2008-03-06 08:54:38 +0000 | [diff] [blame] | 640 | AC_SUBST(BUILD_CFLAGS) |
a.rottmann | c7e9383 | 2003-03-24 09:39:32 +0000 | [diff] [blame] | 641 | AC_OUTPUT([ |
| 642 | Makefile |
dougcurrie | 12b3444 | 2004-07-19 03:24:59 +0000 | [diff] [blame] | 643 | sqlite3.pc |
a.rottmann | c7e9383 | 2003-03-24 09:39:32 +0000 | [diff] [blame] | 644 | ]) |