James Robinson | fa68617 | 2015-02-23 18:32:32 -0800 | [diff] [blame^] | 1 | #!/bin/bash -norc |
| 2 | dnl This file is an input file used by the GNU "autoconf" program to |
| 3 | dnl generate the file "configure", which is run during Tcl installation |
| 4 | dnl to configure the system for the local environment. |
| 5 | # |
| 6 | # RCS: @(#) $Id: configure.in,v 1.43 2005/07/26 19:17:05 mdejong Exp $ |
| 7 | |
| 8 | #----------------------------------------------------------------------- |
| 9 | # Sample configure.in for Tcl Extensions. The only places you should |
| 10 | # need to modify this file are marked by the string __CHANGE__ |
| 11 | #----------------------------------------------------------------------- |
| 12 | |
| 13 | #----------------------------------------------------------------------- |
| 14 | # __CHANGE__ |
| 15 | # Set your package name and version numbers here. |
| 16 | # |
| 17 | # This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION |
| 18 | # set as provided. These will also be added as -D defs in your Makefile |
| 19 | # so you can encode the package version directly into the source files. |
| 20 | #----------------------------------------------------------------------- |
| 21 | |
| 22 | AC_INIT([sqlite], [3.7.4]) |
| 23 | |
| 24 | #-------------------------------------------------------------------- |
| 25 | # Call TEA_INIT as the first TEA_ macro to set up initial vars. |
| 26 | # This will define a ${TEA_PLATFORM} variable == "unix" or "windows" |
| 27 | # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. |
| 28 | #-------------------------------------------------------------------- |
| 29 | |
| 30 | TEA_INIT([3.9]) |
| 31 | |
| 32 | AC_CONFIG_AUX_DIR(tclconfig) |
| 33 | |
| 34 | #-------------------------------------------------------------------- |
| 35 | # Load the tclConfig.sh file |
| 36 | #-------------------------------------------------------------------- |
| 37 | |
| 38 | TEA_PATH_TCLCONFIG |
| 39 | TEA_LOAD_TCLCONFIG |
| 40 | |
| 41 | #-------------------------------------------------------------------- |
| 42 | # Load the tkConfig.sh file if necessary (Tk extension) |
| 43 | #-------------------------------------------------------------------- |
| 44 | |
| 45 | #TEA_PATH_TKCONFIG |
| 46 | #TEA_LOAD_TKCONFIG |
| 47 | |
| 48 | #----------------------------------------------------------------------- |
| 49 | # Handle the --prefix=... option by defaulting to what Tcl gave. |
| 50 | # Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. |
| 51 | #----------------------------------------------------------------------- |
| 52 | |
| 53 | TEA_PREFIX |
| 54 | |
| 55 | #----------------------------------------------------------------------- |
| 56 | # Standard compiler checks. |
| 57 | # This sets up CC by using the CC env var, or looks for gcc otherwise. |
| 58 | # This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create |
| 59 | # the basic setup necessary to compile executables. |
| 60 | #----------------------------------------------------------------------- |
| 61 | |
| 62 | TEA_SETUP_COMPILER |
| 63 | |
| 64 | #----------------------------------------------------------------------- |
| 65 | # __CHANGE__ |
| 66 | # Specify the C source files to compile in TEA_ADD_SOURCES, |
| 67 | # public headers that need to be installed in TEA_ADD_HEADERS, |
| 68 | # stub library C source files to compile in TEA_ADD_STUB_SOURCES, |
| 69 | # and runtime Tcl library files in TEA_ADD_TCL_SOURCES. |
| 70 | # This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS |
| 71 | # and PKG_TCL_SOURCES. |
| 72 | #----------------------------------------------------------------------- |
| 73 | |
| 74 | TEA_ADD_SOURCES([tclsqlite3.c]) |
| 75 | TEA_ADD_HEADERS([]) |
| 76 | TEA_ADD_INCLUDES([-I\"`\${CYGPATH} \${srcdir}/generic`\"]) |
| 77 | TEA_ADD_LIBS([]) |
| 78 | TEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS3=1]) |
| 79 | TEA_ADD_CFLAGS([-DSQLITE_3_SUFFIX_ONLY=1]) |
| 80 | TEA_ADD_CFLAGS([-DSQLITE_ENABLE_RTREE=1]) |
| 81 | TEA_ADD_CFLAGS([-DSQLITE_OMIT_DEPRECATED=1]) |
| 82 | TEA_ADD_STUB_SOURCES([]) |
| 83 | TEA_ADD_TCL_SOURCES([]) |
| 84 | |
| 85 | #-------------------------------------------------------------------- |
| 86 | # The --with-system-sqlite causes the TCL bindings to SQLite to use |
| 87 | # the system shared library for SQLite rather than statically linking |
| 88 | # against its own private copy. This is dangerous and leads to |
| 89 | # undersirable dependences and is not recommended. |
| 90 | # Patchs from rmax. |
| 91 | #-------------------------------------------------------------------- |
| 92 | AC_ARG_WITH([system-sqlite], |
| 93 | [AC_HELP_STRING([--with-system-sqlite], |
| 94 | [use a system-supplied libsqlite3 instead of the bundled one])], |
| 95 | [], [with_system_sqlite=no]) |
| 96 | if test x$with_system_sqlite != xno; then |
| 97 | AC_CHECK_HEADER([sqlite3.h], |
| 98 | [AC_CHECK_LIB([sqlite3],[sqlite3_initialize], |
| 99 | [AC_DEFINE(USE_SYSTEM_SQLITE) |
| 100 | LIBS="$LIBS -lsqlite3"])]) |
| 101 | fi |
| 102 | |
| 103 | #-------------------------------------------------------------------- |
| 104 | # __CHANGE__ |
| 105 | # Choose which headers you need. Extension authors should try very |
| 106 | # hard to only rely on the Tcl public header files. Internal headers |
| 107 | # contain private data structures and are subject to change without |
| 108 | # notice. |
| 109 | # This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG |
| 110 | #-------------------------------------------------------------------- |
| 111 | |
| 112 | TEA_PUBLIC_TCL_HEADERS |
| 113 | #TEA_PRIVATE_TCL_HEADERS |
| 114 | |
| 115 | #TEA_PUBLIC_TK_HEADERS |
| 116 | #TEA_PRIVATE_TK_HEADERS |
| 117 | #TEA_PATH_X |
| 118 | |
| 119 | #-------------------------------------------------------------------- |
| 120 | # Check whether --enable-threads or --disable-threads was given. |
| 121 | # This auto-enables if Tcl was compiled threaded. |
| 122 | #-------------------------------------------------------------------- |
| 123 | |
| 124 | TEA_ENABLE_THREADS |
| 125 | if test "${TCL_THREADS}" = "1" ; then |
| 126 | AC_DEFINE(SQLITE_THREADSAFE, 1, [Trigger sqlite threadsafe build]) |
| 127 | # Not automatically added by Tcl because its assumed Tcl links to them, |
| 128 | # but it may not if it isn't really a threaded build. |
| 129 | TEA_ADD_LIBS([$THREADS_LIBS]) |
| 130 | else |
| 131 | AC_DEFINE(SQLITE_THREADSAFE, 0, [Trigger sqlite non-threadsafe build]) |
| 132 | fi |
| 133 | |
| 134 | #-------------------------------------------------------------------- |
| 135 | # The statement below defines a collection of symbols related to |
| 136 | # building as a shared library instead of a static library. |
| 137 | #-------------------------------------------------------------------- |
| 138 | |
| 139 | TEA_ENABLE_SHARED |
| 140 | |
| 141 | #-------------------------------------------------------------------- |
| 142 | # This macro figures out what flags to use with the compiler/linker |
| 143 | # when building shared/static debug/optimized objects. This information |
| 144 | # can be taken from the tclConfig.sh file, but this figures it all out. |
| 145 | #-------------------------------------------------------------------- |
| 146 | |
| 147 | TEA_CONFIG_CFLAGS |
| 148 | |
| 149 | #-------------------------------------------------------------------- |
| 150 | # Set the default compiler switches based on the --enable-symbols option. |
| 151 | #-------------------------------------------------------------------- |
| 152 | |
| 153 | TEA_ENABLE_SYMBOLS |
| 154 | |
| 155 | #-------------------------------------------------------------------- |
| 156 | # Everyone should be linking against the Tcl stub library. If you |
| 157 | # can't for some reason, remove this definition. If you aren't using |
| 158 | # stubs, you also need to modify the SHLIB_LD_LIBS setting below to |
| 159 | # link against the non-stubbed Tcl library. Add Tk too if necessary. |
| 160 | #-------------------------------------------------------------------- |
| 161 | |
| 162 | AC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs]) |
| 163 | #AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs]) |
| 164 | |
| 165 | |
| 166 | #-------------------------------------------------------------------- |
| 167 | # Redefine fdatasync as fsync on systems that lack fdatasync |
| 168 | #-------------------------------------------------------------------- |
| 169 | # |
| 170 | #AC_CHECK_FUNC(fdatasync, , AC_DEFINE(fdatasync, fsync)) |
| 171 | # Check for library functions that SQLite can optionally use. |
| 172 | AC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r]) |
| 173 | |
| 174 | AC_FUNC_STRERROR_R |
| 175 | |
| 176 | |
| 177 | #-------------------------------------------------------------------- |
| 178 | # This macro generates a line to use when building a library. It |
| 179 | # depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, |
| 180 | # and TEA_LOAD_TCLCONFIG macros above. |
| 181 | #-------------------------------------------------------------------- |
| 182 | |
| 183 | TEA_MAKE_LIB |
| 184 | |
| 185 | #-------------------------------------------------------------------- |
| 186 | # Determine the name of the tclsh and/or wish executables in the |
| 187 | # Tcl and Tk build directories or the location they were installed |
| 188 | # into. These paths are used to support running test cases only, |
| 189 | # the Makefile should not be making use of these paths to generate |
| 190 | # a pkgIndex.tcl file or anything else at extension build time. |
| 191 | #-------------------------------------------------------------------- |
| 192 | |
| 193 | TEA_PROG_TCLSH |
| 194 | #TEA_PROG_WISH |
| 195 | |
| 196 | #-------------------------------------------------------------------- |
| 197 | # Finally, substitute all of the various values into the Makefile. |
| 198 | # You may alternatively have a special pkgIndex.tcl.in or other files |
| 199 | # which require substituting th AC variables in. Include these here. |
| 200 | #-------------------------------------------------------------------- |
| 201 | |
| 202 | AC_OUTPUT([Makefile pkgIndex.tcl]) |