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