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