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