drh | 71eb93e | 2001-09-28 01:34:43 +0000 | [diff] [blame^] | 1 | # |
| 2 | # This file describes a "configure" script that is used to build |
| 3 | # makefiles for a particular platform. Process this file using |
| 4 | # Autoconf version 1.13 in order to generate that script. All |
| 5 | # lines of this file up to the AC_INIT macro are ignored. |
| 6 | # |
| 7 | # The build process allows for using a cross-compiler. But the default |
| 8 | # action is to target the same platform that we are running on. The |
| 9 | # configure script needs to discover the following properties of the |
| 10 | # build and target systems: |
| 11 | # |
| 12 | # srcdir |
| 13 | # |
| 14 | # The is the name of the directory that contains the |
| 15 | # "configure" shell script. All source files are |
| 16 | # located relative to this directory. |
| 17 | # |
| 18 | # bindir |
| 19 | # |
| 20 | # The name of the directory where executables should be |
| 21 | # written by the "install" target of the makefile. |
| 22 | # |
| 23 | # program_prefix |
| 24 | # |
| 25 | # Add this prefix to the names of all executables that run |
| 26 | # on the target machine. Default: "" |
| 27 | # |
| 28 | # ENABLE_SHARED |
| 29 | # |
| 30 | # True if shared libraries should be generated. |
| 31 | # |
| 32 | # BUILD_CC |
| 33 | # |
| 34 | # The name of a command that is used to convert C |
| 35 | # source files into executables that run on the build |
| 36 | # platform. |
| 37 | # |
| 38 | # BUILD_CFLAGS |
| 39 | # |
| 40 | # Switches that the build compiler needs in order to construct |
| 41 | # command-line programs. |
| 42 | # |
| 43 | # BUILD_LIBS |
| 44 | # |
| 45 | # Libraries that the build compiler needs in order to construct |
| 46 | # command-line programs. |
| 47 | # |
| 48 | # BUILD_EXEEXT |
| 49 | # |
| 50 | # The filename extension for executables on the build |
| 51 | # platform. "" for Unix and ".exe" for Windows. |
| 52 | # |
| 53 | # TARGET_CC |
| 54 | # |
| 55 | # The name of a command that runs on the build platform |
| 56 | # and converts C source files into *.o files for the |
| 57 | # target platform. In other words, the cross-compiler. |
| 58 | # |
| 59 | # TARGET_CFLAGS |
| 60 | # |
| 61 | # Switches that the target compiler needs to turn C source files |
| 62 | # into *.o files. Do not include TARGET_TCL_INC in this list. |
| 63 | # Makefiles might add additional switches such as "-I.". |
| 64 | # |
| 65 | # TARGET_TCL_LIBS |
| 66 | # |
| 67 | # This is the library directives passed to the target linker |
| 68 | # that cause the executable to link against Tcl. This might |
| 69 | # be a switch like "-ltcl8.0" or pathnames of library file |
| 70 | # like "../../src/libtcl8.0.a". |
| 71 | # |
| 72 | # TARGET_TCL_INC |
| 73 | # |
| 74 | # This variables define the directory that contain header |
| 75 | # files for Tcl. If the compiler is able to find <tcl.h> |
| 76 | # on its own, then this can be blank. |
| 77 | # |
| 78 | # TARGET_READLINE_LIBS |
| 79 | # |
| 80 | # This is the library directives passed to the target linker |
| 81 | # that cause the executable to link against the readline library. |
| 82 | # This might be a switch like "-lreadline" or pathnames of library |
| 83 | # file like "../../src/libreadline.a". |
| 84 | # |
| 85 | # TARGET_READLINE_INC |
| 86 | # |
| 87 | # This variables define the directory that contain header |
| 88 | # files for the readline library. If the compiler is able |
| 89 | # to find <readline.h> on its own, then this can be blank. |
| 90 | # |
| 91 | # TARGET_LINK |
| 92 | # |
| 93 | # The name of the linker that combines *.o files generated |
| 94 | # by TARGET_CC into executables for the target platform. |
| 95 | # |
| 96 | # TARGET_LIBS |
| 97 | # |
| 98 | # Additional libraries or other switch that the target linker needs |
| 99 | # to build an executable on the target. Do not include |
| 100 | # on this list any libraries in TARGET_TCL_LIBS and |
| 101 | # TARGET_READLINE_LIBS, etc. |
| 102 | # |
| 103 | # TARGET_EXEEXT |
| 104 | # |
| 105 | # The filename extension for executables on the |
| 106 | # target platform. "" for Unix and ".exe" for windows. |
| 107 | # |
| 108 | # The generated configure script will make an attempt to guess |
| 109 | # at all of the above parameters. You can override any of |
| 110 | # the guesses by setting the environment variable named |
| 111 | # "config_AAAA" where "AAAA" is the name of the parameter |
| 112 | # described above. (Exception: srcdir cannot be set this way.) |
| 113 | # If you have a file that sets one or more of these environment |
| 114 | # variables, you can invoke configure as follows: |
| 115 | # |
| 116 | # configure --with-hints=FILE |
| 117 | # |
| 118 | # where FILE is the name of the file that sets the environment |
| 119 | # variables. FILE should be an absolute pathname. |
| 120 | # |
| 121 | # If you have a Tcl/Tk/BLT source distribution available, then the |
| 122 | # files in that distribution will be used instead of any other |
| 123 | # Tcl/Tk/BLT files the script might discover if you tell the configure |
| 124 | # script about the source tree. Use commandline options: |
| 125 | # |
| 126 | # --with-tcl=PATH --with-tk=PATH --with-blt=PATH |
| 127 | # |
| 128 | # Or set environment variables config_WITH_TCL, config_WITH_TK, or |
| 129 | # config_WITH_BLT. |
| 130 | # |
| 131 | # This configure.in file is easy to reuse on other projects. Just |
| 132 | # change the argument to AC_INIT(). And disable any features that |
| 133 | # you don't need (for example BLT) by erasing or commenting out |
| 134 | # the corresponding code. |
| 135 | # |
| 136 | AC_INIT(src/sqlite.h.in) |
| 137 | |
| 138 | dnl Put the RCS revision string after AC_INIT so that it will also |
| 139 | dnl show in in configure. |
| 140 | # The following RCS revision string applies to configure.in |
| 141 | # $Revision: 1.1 $ |
| 142 | |
| 143 | ######### |
| 144 | # Programs needed |
| 145 | # |
| 146 | AC_PROG_LIBTOOL |
| 147 | AC_PROG_INSTALL |
| 148 | |
| 149 | ######### |
| 150 | # Set up an appropriate program prefix |
| 151 | # |
| 152 | if test "$program_prefix" = "NONE"; then |
| 153 | program_prefix="" |
| 154 | fi |
| 155 | AC_SUBST(program_prefix) |
| 156 | |
| 157 | ######### |
| 158 | # Check to see if the --with-hints=FILE option is used. If there is none, |
| 159 | # then check for a files named "$host.hints" and ../$hosts.hints where |
| 160 | # $host is the hostname of the build system. If still no hints are |
| 161 | # found, try looking in $system.hints and ../$system.hints where |
| 162 | # $system is the result of uname -s. |
| 163 | # |
| 164 | AC_ARG_WITH(hints, |
| 165 | [ --with-hints=FILE Read configuration options from FILE], |
| 166 | hints=$withval) |
| 167 | if test "$hints" = ""; then |
| 168 | host=`hostname | sed 's/\..*//'` |
| 169 | if test -r $host.hints; then |
| 170 | hints=$host.hints |
| 171 | else |
| 172 | if test -r ../$host.hints; then |
| 173 | hints=../$host.hints |
| 174 | fi |
| 175 | fi |
| 176 | fi |
| 177 | if test "$hints" = ""; then |
| 178 | sys=`uname -s` |
| 179 | if test -r $sys.hints; then |
| 180 | hints=$sys.hints |
| 181 | else |
| 182 | if test -r ../$sys.hints; then |
| 183 | hints=../$sys.hints |
| 184 | fi |
| 185 | fi |
| 186 | fi |
| 187 | if test "$hints" != ""; then |
| 188 | AC_MSG_RESULT(reading hints from $hints) |
| 189 | . $hints |
| 190 | fi |
| 191 | |
| 192 | ######### |
| 193 | # Locate a compiler for the build machine. This compiler should |
| 194 | # generate command-line programs that run on the build machine. |
| 195 | # |
| 196 | default_build_cflags="-g" |
| 197 | if test "$config_BUILD_CC" = ""; then |
| 198 | AC_PROG_CC |
| 199 | if test "$cross_compiling" = "yes"; then |
| 200 | AC_MSG_ERROR([unable to find a compiler for building build tools]) |
| 201 | fi |
| 202 | BUILD_CC=$CC |
| 203 | default_build_cflags=$CFLAGS |
| 204 | else |
| 205 | BUILD_CC=$config_BUILD_CC |
| 206 | AC_MSG_CHECKING([host compiler]) |
| 207 | CC=$BUILD_CC |
| 208 | AC_MSG_RESULT($BUILD_CC) |
| 209 | fi |
| 210 | AC_MSG_CHECKING([switches for the host compiler]) |
| 211 | if test "$config_BUILD_CFLAGS" != ""; then |
| 212 | CFLAGS=$config_BUILD_CFLAGS |
| 213 | BUILD_CFLAGS=$config_BUILD_CFLAGS |
| 214 | else |
| 215 | BUILD_CFLAGS=$default_build_cflags |
| 216 | fi |
| 217 | AC_MSG_RESULT($BUILD_CFLAGS) |
| 218 | if test "$config_BUILD_LIBS" != ""; then |
| 219 | BUILD_LIBS=$config_BUILD_LIBS |
| 220 | fi |
| 221 | AC_SUBST(BUILD_CC) |
| 222 | AC_SUBST(BUILD_CFLAGS) |
| 223 | AC_SUBST(BUILD_LIBS) |
| 224 | |
| 225 | ########## |
| 226 | # Locate a compiler that converts C code into *.o files that run on |
| 227 | # the target machine. |
| 228 | # |
| 229 | AC_MSG_CHECKING([target compiler]) |
| 230 | if test "$config_TARGET_CC" != ""; then |
| 231 | TARGET_CC=$config_TARGET_CC |
| 232 | else |
| 233 | TARGET_CC=$BUILD_CC |
| 234 | fi |
| 235 | AC_MSG_RESULT($TARGET_CC) |
| 236 | AC_MSG_CHECKING([switches on the target compiler]) |
| 237 | if test "$config_TARGET_CFLAGS" != ""; then |
| 238 | TARGET_CFLAGS=$config_TARGET_CFLAGS |
| 239 | else |
| 240 | TARGET_CFLAGS=$BUILD_CFLAGS |
| 241 | fi |
| 242 | AC_MSG_RESULT($TARGET_CFLAGS) |
| 243 | AC_MSG_CHECKING([target linker]) |
| 244 | if test "$config_TARGET_LINK" = ""; then |
| 245 | TARGET_LINK=$TARGET_CC |
| 246 | else |
| 247 | TARGET_LINK=$config_TARGET_LINK |
| 248 | fi |
| 249 | AC_MSG_RESULT($TARGET_LINK) |
| 250 | AC_MSG_CHECKING([switches on the target compiler]) |
| 251 | if test "$config_TARGET_TFLAGS" != ""; then |
| 252 | TARGET_TFLAGS=$config_TARGET_TFLAGS |
| 253 | else |
| 254 | TARGET_TFLAGS=$BUILD_CFLAGS |
| 255 | fi |
| 256 | if test "$config_TARGET_RANLIB" != ""; then |
| 257 | TARGET_RANLIB=$config_TARGET_RANLIB |
| 258 | else |
| 259 | AC_PROG_RANLIB |
| 260 | TARGET_RANLIB=$RANLIB |
| 261 | fi |
| 262 | if test "$config_TARGET_AR" != ""; then |
| 263 | TARGET_AR=$config_TARGET_AR |
| 264 | else |
| 265 | TARGET_AR='ar cr' |
| 266 | fi |
| 267 | AC_MSG_RESULT($TARGET_TFLAGS) |
| 268 | AC_SUBST(TARGET_CC) |
| 269 | AC_SUBST(TARGET_CFLAGS) |
| 270 | AC_SUBST(TARGET_LINK) |
| 271 | AC_SUBST(TARGET_LFLAGS) |
| 272 | AC_SUBST(TARGET_RANLIB) |
| 273 | AC_SUBST(TARGET_AR) |
| 274 | |
| 275 | # Set the $cross variable if we are cross-compiling. Make |
| 276 | # it 0 if we are not. |
| 277 | # |
| 278 | AC_MSG_CHECKING([if host and target compilers are the same]) |
| 279 | if test "$BUILD_CC" = "$TARGET_CC"; then |
| 280 | cross=0 |
| 281 | AC_MSG_RESULT(yes) |
| 282 | else |
| 283 | cross=1 |
| 284 | AC_MSG_RESULT(no) |
| 285 | fi |
| 286 | |
| 287 | ########## |
| 288 | # Are we using UTF-8 or iso8859 encodings? |
| 289 | # |
| 290 | AC_ARG_ENABLE(utf8, |
| 291 | [ --enable-utf8 Use UTF-8 encodings],,enable_utf8=no) |
| 292 | AC_MSG_CHECKING([character encoding]) |
| 293 | if test "$enable_utf8" = "no"; then |
| 294 | ENCODING=ISO8859 |
| 295 | AC_MSG_RESULT([iso8859]) |
| 296 | else |
| 297 | ENCODING=UTF8 |
| 298 | AC_MSG_RESULT([UTF-8]) |
| 299 | fi |
| 300 | AC_SUBST(ENCODING) |
| 301 | |
| 302 | ########### |
| 303 | # Lots of things are different if we are compiling for Windows using |
| 304 | # the CYGWIN environment. So check for that special case and handle |
| 305 | # things accordingly. |
| 306 | # |
| 307 | AC_MSG_CHECKING([if executables have the .exe suffix]) |
| 308 | if test "$config_BUILD_EXEEXT" = ".exe"; then |
| 309 | CYGWIN=yes |
| 310 | AC_MSG_RESULT(yes) |
| 311 | else |
| 312 | AC_MSG_RESULT(unknown) |
| 313 | fi |
| 314 | if test "$CYGWIN" != "yes"; then |
| 315 | AC_CYGWIN |
| 316 | fi |
| 317 | if test "$CYGWIN" = "yes"; then |
| 318 | BUILD_EXEEXT=.exe |
| 319 | else |
| 320 | BUILD_EXEEXT="" |
| 321 | fi |
| 322 | if test "$cross" = "0"; then |
| 323 | TARGET_EXEEXT=$BUILD_EXEEXT |
| 324 | else |
| 325 | TARGET_EXEEXT=$config_TARGET_EXEEXT |
| 326 | fi |
| 327 | if test "$TARGET_EXEEXT" = ".exe"; then |
| 328 | OS_UNIX=0 |
| 329 | OS_WIN=1 |
| 330 | tclsubdir=win |
| 331 | else |
| 332 | OS_UNIX=1 |
| 333 | OS_WIN=0 |
| 334 | tclsubdir=unix |
| 335 | fi |
| 336 | TARGET_CFLAGS="$TARGET_CFLAGS -DOS_UNIX=$OS_UNIX -DOS_WIN=$OS_WIN" |
| 337 | |
| 338 | AC_SUBST(BUILD_EXEEXT) |
| 339 | AC_SUBST(OS_UNIX) |
| 340 | AC_SUBST(OS_WIN) |
| 341 | AC_SUBST(TARGET_EXEEXT) |
| 342 | |
| 343 | ########## |
| 344 | # Extract generic linker options from the environment. |
| 345 | # |
| 346 | if test "$config_TARGET_LIBS" != ""; then |
| 347 | TARGET_LIBS=$config_TARGET_LIBS |
| 348 | else |
| 349 | TARGET_LIBS="" |
| 350 | fi |
| 351 | AC_SUBST(TARGET_LIBS) |
| 352 | |
| 353 | ########## |
| 354 | # Figure out what C libraries are required to compile Tcl programs. |
| 355 | # |
| 356 | if test "$config_TARGET_TCL_LIBS" != ""; then |
| 357 | TARGET_TCL_LIBS="$config_TARGET_TCL_LIBS" |
| 358 | else |
| 359 | if test "$with_tcl" != ""; then |
| 360 | extra=`echo $with_tcl/$tclsubdir/libtcl8*.a` |
| 361 | fi |
| 362 | CC=$TARGET_CC |
| 363 | AC_CHECK_FUNC(sin, LIBS="", LIBS="-lm") |
| 364 | AC_CHECK_LIB(dl, dlopen) |
| 365 | otherlibs=$LIBS |
| 366 | if test "$extra" != ""; then |
| 367 | LIBS=$extra |
| 368 | else |
| 369 | LIBS="" |
| 370 | AC_SEARCH_LIBS(Tcl_Init, dnl |
| 371 | tcl8.4 tcl8.3 tcl8.2 tcl8.1 tcl8.0 tcl80 tcl,,,$otherlibs) |
| 372 | fi |
| 373 | TARGET_TCL_LIBS="$LIBS $otherlibs" |
| 374 | fi |
| 375 | AC_SUBST(TARGET_TCL_LIBS) |
| 376 | |
| 377 | ########## |
| 378 | # Figure out where to get the TCL header files. |
| 379 | # |
| 380 | AC_MSG_CHECKING([TCL header files]) |
| 381 | found=no |
| 382 | if test "$config_TARGET_TCL_INC" != ""; then |
| 383 | TARGET_TCL_INC=$config_TARGET_TCL_INC |
| 384 | found=yes |
| 385 | else |
| 386 | if test "$with_tcl" != ""; then |
| 387 | TARGET_TCL_INC="-I$with_tcl/generic -I$with_tcl/$tclsubdir" |
| 388 | found=yes |
| 389 | else |
| 390 | TARGET_TCL_INC="" |
| 391 | found=no |
| 392 | fi |
| 393 | fi |
| 394 | if test "$found" = "yes"; then |
| 395 | AC_MSG_RESULT($TARGET_TCL_INC) |
| 396 | else |
| 397 | AC_MSG_RESULT(not specified: still searching...) |
| 398 | AC_CHECK_HEADER(tcl.h, [found=yes]) |
| 399 | fi |
| 400 | if test "$found" = "no"; then |
| 401 | for dir in /usr/local /usr/X11 /usr/X11R6 /usr/pkg /usr/contrib /usr; do |
| 402 | AC_CHECK_FILE($dir/include/tcl.h, found=yes) |
| 403 | if test "$found" = "yes"; then |
| 404 | TARGET_TCL_INC="-I$dir/include" |
| 405 | break |
| 406 | fi |
| 407 | done |
| 408 | fi |
| 409 | if test "$found" = "no"; then |
| 410 | TARGET_TCL_INC="-DNO_TCL=1" |
| 411 | fi |
| 412 | AC_SUBST(TARGET_TCL_INC) |
| 413 | |
| 414 | ########## |
| 415 | # Figure out what C libraries are required to compile programs |
| 416 | # that use "readline()" library. |
| 417 | # |
| 418 | if test "$config_TARGET_READLINE_LIBS" != ""; then |
| 419 | TARGET_READLINE_LIBS="$config_TARGET_READLINE_LIBS" |
| 420 | else |
| 421 | CC=$TARGET_CC |
| 422 | LIBS="" |
| 423 | AC_SEARCH_LIBS(readline, readline,,,) |
| 424 | TARGET_READLINE_LIBS="$LIBS" |
| 425 | fi |
| 426 | AC_SUBST(TARGET_READLINE_LIBS) |
| 427 | |
| 428 | ########## |
| 429 | # Figure out where to get the READLINE header files. |
| 430 | # |
| 431 | AC_MSG_CHECKING([readline header files]) |
| 432 | found=no |
| 433 | if test "$config_TARGET_READLINE_INC" != ""; then |
| 434 | TARGET_READLINE_INC=$config_TARGET_READLINE_INC |
| 435 | found=yes |
| 436 | fi |
| 437 | if test "$found" = "yes"; then |
| 438 | AC_MSG_RESULT($TARGET_READLINE_INC) |
| 439 | else |
| 440 | AC_MSG_RESULT(not specified: still searching...) |
| 441 | AC_CHECK_HEADER(readline.h, [found=yes]) |
| 442 | fi |
| 443 | if test "$found" = "no"; then |
| 444 | for dir in /usr /usr/local /usr/local/readline /usr/contrib; do |
| 445 | AC_CHECK_FILE($dir/include/readline.h, found=yes) |
| 446 | if test "$found" = "yes"; then |
| 447 | TARGET_READLINE_INC="-I$dir/include" |
| 448 | break |
| 449 | fi |
| 450 | AC_CHECK_FILE($dir/include/readline/readline.h, found=yes) |
| 451 | if test "$found" = "yes"; then |
| 452 | TARGET_READLINE_INC="-I$dir/include/readline" |
| 453 | break |
| 454 | fi |
| 455 | done |
| 456 | fi |
| 457 | if test "$found" = "yes"; then |
| 458 | if test "$TARGET_READLINE_LIBS" = ""; then |
| 459 | TARGET_HAVE_READLINE=0 |
| 460 | else |
| 461 | TARGET_HAVE_READLINE=1 |
| 462 | fi |
| 463 | else |
| 464 | TARGET_HAVE_READLINE=0 |
| 465 | fi |
| 466 | AC_SUBST(TARGET_READLINE_INC) |
| 467 | AC_SUBST(TARGET_HAVE_READLINE) |
| 468 | |
| 469 | ######### |
| 470 | # Figure out whether or not we have a "usleep()" function. |
| 471 | # |
| 472 | AC_CHECK_FUNC(usleep, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_USLEEP=1"]) |
| 473 | |
| 474 | ######### |
| 475 | # Generate the output files. |
| 476 | # |
| 477 | AC_OUTPUT(Makefile) |