configure.ac revision 363179
1290001Sglebius#!/bin/bash -norc 2290001Sglebiusdnl This file is an input file used by the GNU "autoconf" program to 3290001Sglebiusdnl generate the file "configure", which is run during Tcl installation 4290001Sglebiusdnl to configure the system for the local environment. 5290001Sglebius# 6290001Sglebius# RCS: @(#) $Id: configure.in,v 1.43 2005/07/26 19:17:05 mdejong Exp $ 7290001Sglebius 8290001Sglebius#----------------------------------------------------------------------- 9290001Sglebius# Sample configure.in for Tcl Extensions. The only places you should 10290001Sglebius# need to modify this file are marked by the string __CHANGE__ 11290001Sglebius#----------------------------------------------------------------------- 12290001Sglebius 13290001Sglebius#----------------------------------------------------------------------- 14290001Sglebius# __CHANGE__ 15290001Sglebius# Set your package name and version numbers here. 16290001Sglebius# 17290001Sglebius# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION 18290001Sglebius# set as provided. These will also be added as -D defs in your Makefile 19290001Sglebius# so you can encode the package version directly into the source files. 20290001Sglebius#----------------------------------------------------------------------- 21290001Sglebius 22290001SglebiusAC_INIT([sqlite], [3.32.3]) 23290001Sglebius 24290001Sglebius#-------------------------------------------------------------------- 25290001Sglebius# Call TEA_INIT as the first TEA_ macro to set up initial vars. 26290001Sglebius# This will define a ${TEA_PLATFORM} variable == "unix" or "windows" 27290001Sglebius# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. 28290001Sglebius#-------------------------------------------------------------------- 29290001Sglebius 30290001SglebiusTEA_INIT([3.9]) 31290001Sglebius 32290001SglebiusAC_CONFIG_AUX_DIR(tclconfig) 33290001Sglebius 34290001Sglebius#-------------------------------------------------------------------- 35290001Sglebius# Load the tclConfig.sh file 36290001Sglebius#-------------------------------------------------------------------- 37290001Sglebius 38290001SglebiusTEA_PATH_TCLCONFIG 39290001SglebiusTEA_LOAD_TCLCONFIG 40290001Sglebius 41290001Sglebius#-------------------------------------------------------------------- 42290001Sglebius# Load the tkConfig.sh file if necessary (Tk extension) 43290001Sglebius#-------------------------------------------------------------------- 44290001Sglebius 45290001Sglebius#TEA_PATH_TKCONFIG 46290001Sglebius#TEA_LOAD_TKCONFIG 47290001Sglebius 48290001Sglebius#----------------------------------------------------------------------- 49290001Sglebius# Handle the --prefix=... option by defaulting to what Tcl gave. 50290001Sglebius# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. 51290001Sglebius#----------------------------------------------------------------------- 52290001Sglebius 53290001SglebiusTEA_PREFIX 54290001Sglebius 55290001Sglebius#----------------------------------------------------------------------- 56290001Sglebius# Standard compiler checks. 57290001Sglebius# This sets up CC by using the CC env var, or looks for gcc otherwise. 58290001Sglebius# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create 59290001Sglebius# the basic setup necessary to compile executables. 60290001Sglebius#----------------------------------------------------------------------- 61290001Sglebius 62290001SglebiusTEA_SETUP_COMPILER 63290001Sglebius 64290001Sglebius#----------------------------------------------------------------------- 65290001Sglebius# __CHANGE__ 66290001Sglebius# Specify the C source files to compile in TEA_ADD_SOURCES, 67290001Sglebius# public headers that need to be installed in TEA_ADD_HEADERS, 68290001Sglebius# stub library C source files to compile in TEA_ADD_STUB_SOURCES, 69290001Sglebius# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. 70290001Sglebius# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS 71290001Sglebius# and PKG_TCL_SOURCES. 72290001Sglebius#----------------------------------------------------------------------- 73290001Sglebius 74290001SglebiusTEA_ADD_SOURCES([tclsqlite3.c]) 75290001SglebiusTEA_ADD_HEADERS([]) 76290001SglebiusTEA_ADD_INCLUDES([-I\"`\${CYGPATH} \${srcdir}/generic`\"]) 77290001SglebiusTEA_ADD_LIBS([]) 78290001SglebiusTEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS3=1]) 79290001SglebiusTEA_ADD_CFLAGS([-DSQLITE_3_SUFFIX_ONLY=1]) 80290001SglebiusTEA_ADD_CFLAGS([-DSQLITE_ENABLE_RTREE=1]) 81290001SglebiusTEA_ADD_STUB_SOURCES([]) 82290001SglebiusTEA_ADD_TCL_SOURCES([]) 83290001Sglebius 84290001Sglebius#-------------------------------------------------------------------- 85290001Sglebius# The --with-system-sqlite causes the TCL bindings to SQLite to use 86290001Sglebius# the system shared library for SQLite rather than statically linking 87290001Sglebius# against its own private copy. This is dangerous and leads to 88290001Sglebius# undersirable dependences and is not recommended. 89290001Sglebius# Patchs from rmax. 90290001Sglebius#-------------------------------------------------------------------- 91290001SglebiusAC_ARG_WITH([system-sqlite], 92290001Sglebius [AC_HELP_STRING([--with-system-sqlite], 93290001Sglebius [use a system-supplied libsqlite3 instead of the bundled one])], 94290001Sglebius [], [with_system_sqlite=no]) 95290001Sglebiusif test x$with_system_sqlite != xno; then 96290001Sglebius AC_CHECK_HEADER([sqlite3.h], 97290001Sglebius [AC_CHECK_LIB([sqlite3],[sqlite3_initialize], 98290001Sglebius [AC_DEFINE(USE_SYSTEM_SQLITE) 99290001Sglebius LIBS="$LIBS -lsqlite3"])]) 100294905Sdelphijfi 101290001Sglebius 102290001Sglebius#-------------------------------------------------------------------- 103290001Sglebius# __CHANGE__ 104290001Sglebius# Choose which headers you need. Extension authors should try very 105290001Sglebius# hard to only rely on the Tcl public header files. Internal headers 106290001Sglebius# contain private data structures and are subject to change without 107294905Sdelphij# notice. 108290001Sglebius# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG 109290001Sglebius#-------------------------------------------------------------------- 110290001Sglebius 111290001SglebiusTEA_PUBLIC_TCL_HEADERS 112290001Sglebius#TEA_PRIVATE_TCL_HEADERS 113290001Sglebius 114290001Sglebius#TEA_PUBLIC_TK_HEADERS 115290001Sglebius#TEA_PRIVATE_TK_HEADERS 116290001Sglebius#TEA_PATH_X 117290001Sglebius 118290001Sglebius#-------------------------------------------------------------------- 119290001Sglebius# Check whether --enable-threads or --disable-threads was given. 120290001Sglebius# This auto-enables if Tcl was compiled threaded. 121290001Sglebius#-------------------------------------------------------------------- 122290001Sglebius 123290001SglebiusTEA_ENABLE_THREADS 124290001Sglebiusif test "${TCL_THREADS}" = "1" ; then 125290001Sglebius AC_DEFINE(SQLITE_THREADSAFE, 1, [Trigger sqlite threadsafe build]) 126290001Sglebius # Not automatically added by Tcl because its assumed Tcl links to them, 127290001Sglebius # but it may not if it isn't really a threaded build. 128290001Sglebius TEA_ADD_LIBS([$THREADS_LIBS]) 129290001Sglebiuselse 130290001Sglebius AC_DEFINE(SQLITE_THREADSAFE, 0, [Trigger sqlite non-threadsafe build]) 131290001Sglebiusfi 132290001Sglebius 133290001Sglebius#-------------------------------------------------------------------- 134290001Sglebius# The statement below defines a collection of symbols related to 135290001Sglebius# building as a shared library instead of a static library. 136290001Sglebius#-------------------------------------------------------------------- 137290001Sglebius 138290001SglebiusTEA_ENABLE_SHARED 139290001Sglebius 140290001Sglebius#-------------------------------------------------------------------- 141290001Sglebius# This macro figures out what flags to use with the compiler/linker 142290001Sglebius# when building shared/static debug/optimized objects. This information 143290001Sglebius# can be taken from the tclConfig.sh file, but this figures it all out. 144290001Sglebius#-------------------------------------------------------------------- 145290001Sglebius 146290001SglebiusTEA_CONFIG_CFLAGS 147290001Sglebius 148290001Sglebius#-------------------------------------------------------------------- 149290001Sglebius# Set the default compiler switches based on the --enable-symbols option. 150290001Sglebius#-------------------------------------------------------------------- 151290001Sglebius 152290001SglebiusTEA_ENABLE_SYMBOLS 153290001Sglebius 154290001Sglebius#-------------------------------------------------------------------- 155290001Sglebius# Everyone should be linking against the Tcl stub library. If you 156290001Sglebius# can't for some reason, remove this definition. If you aren't using 157290001Sglebius# stubs, you also need to modify the SHLIB_LD_LIBS setting below to 158290001Sglebius# link against the non-stubbed Tcl library. Add Tk too if necessary. 159290001Sglebius#-------------------------------------------------------------------- 160290001Sglebius 161290001SglebiusAC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs]) 162290001Sglebius#AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs]) 163290001Sglebius 164290001Sglebius 165290001Sglebius#-------------------------------------------------------------------- 166290001Sglebius# Redefine fdatasync as fsync on systems that lack fdatasync 167290001Sglebius#-------------------------------------------------------------------- 168290001Sglebius# 169290001Sglebius#AC_CHECK_FUNC(fdatasync, , AC_DEFINE(fdatasync, fsync)) 170290001Sglebius# Check for library functions that SQLite can optionally use. 171290001SglebiusAC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r]) 172290001Sglebius 173290001SglebiusAC_FUNC_STRERROR_R 174290001Sglebius 175290001Sglebius 176290001Sglebius#-------------------------------------------------------------------- 177290001Sglebius# This macro generates a line to use when building a library. It 178290001Sglebius# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, 179290001Sglebius# and TEA_LOAD_TCLCONFIG macros above. 180290001Sglebius#-------------------------------------------------------------------- 181290001Sglebius 182290001SglebiusTEA_MAKE_LIB 183290001Sglebius 184290001Sglebius#-------------------------------------------------------------------- 185290001Sglebius# Determine the name of the tclsh and/or wish executables in the 186290001Sglebius# Tcl and Tk build directories or the location they were installed 187290001Sglebius# into. These paths are used to support running test cases only, 188290001Sglebius# the Makefile should not be making use of these paths to generate 189290001Sglebius# a pkgIndex.tcl file or anything else at extension build time. 190290001Sglebius#-------------------------------------------------------------------- 191290001Sglebius 192290001SglebiusTEA_PROG_TCLSH 193290001Sglebius#TEA_PROG_WISH 194290001Sglebius 195290001Sglebius#-------------------------------------------------------------------- 196290001Sglebius# Finally, substitute all of the various values into the Makefile. 197290001Sglebius# You may alternatively have a special pkgIndex.tcl.in or other files 198290001Sglebius# which require substituting th AC variables in. Include these here. 199290001Sglebius#-------------------------------------------------------------------- 200290001Sglebius 201290001SglebiusAC_OUTPUT([Makefile pkgIndex.tcl]) 202290001Sglebius