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