1076b9443SCy Schubert#!/bin/bash -norc 2076b9443SCy Schubertdnl This file is an input file used by the GNU "autoconf" program to 3076b9443SCy Schubertdnl generate the file "configure", which is run during Tcl installation 4076b9443SCy Schubertdnl to configure the system for the local environment. 5076b9443SCy Schubert 6076b9443SCy Schubert#----------------------------------------------------------------------- 700787218SCy Schubert# Sample configure.ac for Tcl Extensions. The only places you should 8076b9443SCy Schubert# need to modify this file are marked by the string __CHANGE__ 9076b9443SCy Schubert#----------------------------------------------------------------------- 10076b9443SCy Schubert 11076b9443SCy Schubert#----------------------------------------------------------------------- 12076b9443SCy Schubert# __CHANGE__ 13076b9443SCy Schubert# Set your package name and version numbers here. 14076b9443SCy Schubert# 15076b9443SCy Schubert# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION 16076b9443SCy Schubert# set as provided. These will also be added as -D defs in your Makefile 17076b9443SCy Schubert# so you can encode the package version directly into the source files. 1800787218SCy Schubert# This will also define a special symbol for Windows (BUILD_<PACKAGE_NAME> 1900787218SCy Schubert# so that we create the export library with the dll. 20076b9443SCy Schubert#----------------------------------------------------------------------- 21076b9443SCy Schubert 22*de946883SCy SchubertAC_INIT([sqlite],[3.46.1]) 23076b9443SCy Schubert 24076b9443SCy Schubert#-------------------------------------------------------------------- 25076b9443SCy Schubert# Call TEA_INIT as the first TEA_ macro to set up initial vars. 26076b9443SCy Schubert# This will define a ${TEA_PLATFORM} variable == "unix" or "windows" 27076b9443SCy Schubert# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. 28076b9443SCy Schubert#-------------------------------------------------------------------- 29076b9443SCy Schubert 3000787218SCy SchubertTEA_INIT() 31076b9443SCy Schubert 32076b9443SCy SchubertAC_CONFIG_AUX_DIR(tclconfig) 33076b9443SCy Schubert 34076b9443SCy Schubert#-------------------------------------------------------------------- 35076b9443SCy Schubert# Load the tclConfig.sh file 36076b9443SCy Schubert#-------------------------------------------------------------------- 37076b9443SCy Schubert 38076b9443SCy SchubertTEA_PATH_TCLCONFIG 39076b9443SCy SchubertTEA_LOAD_TCLCONFIG 40076b9443SCy Schubert 41076b9443SCy Schubert#-------------------------------------------------------------------- 42076b9443SCy Schubert# Load the tkConfig.sh file if necessary (Tk extension) 43076b9443SCy Schubert#-------------------------------------------------------------------- 44076b9443SCy Schubert 45076b9443SCy Schubert#TEA_PATH_TKCONFIG 46076b9443SCy Schubert#TEA_LOAD_TKCONFIG 47076b9443SCy Schubert 48076b9443SCy Schubert#----------------------------------------------------------------------- 49076b9443SCy Schubert# Handle the --prefix=... option by defaulting to what Tcl gave. 50076b9443SCy Schubert# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. 51076b9443SCy Schubert#----------------------------------------------------------------------- 52076b9443SCy Schubert 53076b9443SCy SchubertTEA_PREFIX 54076b9443SCy Schubert 55076b9443SCy Schubert#----------------------------------------------------------------------- 56076b9443SCy Schubert# Standard compiler checks. 57076b9443SCy Schubert# This sets up CC by using the CC env var, or looks for gcc otherwise. 5800787218SCy Schubert# This also calls AC_PROG_CC and a few others to create the basic setup 5900787218SCy Schubert# necessary to compile executables. 60076b9443SCy Schubert#----------------------------------------------------------------------- 61076b9443SCy Schubert 62076b9443SCy SchubertTEA_SETUP_COMPILER 63076b9443SCy Schubert 64076b9443SCy Schubert#----------------------------------------------------------------------- 65076b9443SCy Schubert# __CHANGE__ 66076b9443SCy Schubert# Specify the C source files to compile in TEA_ADD_SOURCES, 67076b9443SCy Schubert# public headers that need to be installed in TEA_ADD_HEADERS, 68076b9443SCy Schubert# stub library C source files to compile in TEA_ADD_STUB_SOURCES, 69076b9443SCy Schubert# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. 70076b9443SCy Schubert# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS 71076b9443SCy Schubert# and PKG_TCL_SOURCES. 72076b9443SCy Schubert#----------------------------------------------------------------------- 73076b9443SCy Schubert 74076b9443SCy SchubertTEA_ADD_SOURCES([tclsqlite3.c]) 75076b9443SCy SchubertTEA_ADD_HEADERS([]) 7600787218SCy SchubertTEA_ADD_INCLUDES([]) 77076b9443SCy SchubertTEA_ADD_LIBS([]) 78076b9443SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS3=1]) 7900787218SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS4=1]) 8000787218SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS5=1]) 81076b9443SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_3_SUFFIX_ONLY=1]) 82076b9443SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_ENABLE_RTREE=1]) 8300787218SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_ENABLE_GEOPOLY=1]) 8400787218SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_ENABLE_MATH_FUNCTIONS=1]) 8500787218SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_ENABLE_DESERIALIZE=1]) 8600787218SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_ENABLE_DBPAGE_VTAB=1]) 8700787218SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_ENABLE_BYTECODE_VTAB=1]) 8800787218SCy SchubertTEA_ADD_CFLAGS([-DSQLITE_ENABLE_DBSTAT_VTAB=1]) 89076b9443SCy SchubertTEA_ADD_STUB_SOURCES([]) 90076b9443SCy SchubertTEA_ADD_TCL_SOURCES([]) 91076b9443SCy Schubert 92076b9443SCy Schubert#-------------------------------------------------------------------- 93076b9443SCy Schubert# The --with-system-sqlite causes the TCL bindings to SQLite to use 94076b9443SCy Schubert# the system shared library for SQLite rather than statically linking 95076b9443SCy Schubert# against its own private copy. This is dangerous and leads to 96076b9443SCy Schubert# undersirable dependences and is not recommended. 97076b9443SCy Schubert# Patchs from rmax. 98076b9443SCy Schubert#-------------------------------------------------------------------- 99076b9443SCy SchubertAC_ARG_WITH([system-sqlite], 100076b9443SCy Schubert [AC_HELP_STRING([--with-system-sqlite], 101076b9443SCy Schubert [use a system-supplied libsqlite3 instead of the bundled one])], 102076b9443SCy Schubert [], [with_system_sqlite=no]) 103076b9443SCy Schubertif test x$with_system_sqlite != xno; then 104076b9443SCy Schubert AC_CHECK_HEADER([sqlite3.h], 105076b9443SCy Schubert [AC_CHECK_LIB([sqlite3],[sqlite3_initialize], 106076b9443SCy Schubert [AC_DEFINE(USE_SYSTEM_SQLITE) 107076b9443SCy Schubert LIBS="$LIBS -lsqlite3"])]) 108076b9443SCy Schubertfi 109076b9443SCy Schubert 110076b9443SCy Schubert#-------------------------------------------------------------------- 111076b9443SCy Schubert# __CHANGE__ 11200787218SCy Schubert# 11300787218SCy Schubert# You can add more files to clean if your extension creates any extra 11400787218SCy Schubert# files by extending CLEANFILES. 11500787218SCy Schubert# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure 11600787218SCy Schubert# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var. 11700787218SCy Schubert# 11800787218SCy Schubert# A few miscellaneous platform-specific items: 11900787218SCy Schubert# TEA_ADD_* any platform specific compiler/build info here. 12000787218SCy Schubert#-------------------------------------------------------------------- 12100787218SCy Schubert 12200787218SCy Schubert#CLEANFILES="$CLEANFILES pkgIndex.tcl" 12300787218SCy Schubertif test "${TEA_PLATFORM}" = "windows" ; then 12400787218SCy Schubert # Ensure no empty if clauses 12500787218SCy Schubert : 12600787218SCy Schubert #TEA_ADD_SOURCES([win/winFile.c]) 12700787218SCy Schubert #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) 12800787218SCy Schubertelse 12900787218SCy Schubert # Ensure no empty else clauses 13000787218SCy Schubert : 13100787218SCy Schubert #TEA_ADD_SOURCES([unix/unixFile.c]) 13200787218SCy Schubert #TEA_ADD_LIBS([-lsuperfly]) 13300787218SCy Schubertfi 13400787218SCy Schubert 13500787218SCy Schubert#-------------------------------------------------------------------- 13600787218SCy Schubert# __CHANGE__ 137076b9443SCy Schubert# Choose which headers you need. Extension authors should try very 138076b9443SCy Schubert# hard to only rely on the Tcl public header files. Internal headers 139076b9443SCy Schubert# contain private data structures and are subject to change without 140076b9443SCy Schubert# notice. 141076b9443SCy Schubert# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG 142076b9443SCy Schubert#-------------------------------------------------------------------- 143076b9443SCy Schubert 144076b9443SCy SchubertTEA_PUBLIC_TCL_HEADERS 145076b9443SCy Schubert#TEA_PRIVATE_TCL_HEADERS 146076b9443SCy Schubert 147076b9443SCy Schubert#TEA_PUBLIC_TK_HEADERS 148076b9443SCy Schubert#TEA_PRIVATE_TK_HEADERS 149076b9443SCy Schubert#TEA_PATH_X 150076b9443SCy Schubert 151076b9443SCy Schubert#-------------------------------------------------------------------- 152076b9443SCy Schubert# Check whether --enable-threads or --disable-threads was given. 153076b9443SCy Schubert# This auto-enables if Tcl was compiled threaded. 154076b9443SCy Schubert#-------------------------------------------------------------------- 155076b9443SCy Schubert 156076b9443SCy SchubertTEA_ENABLE_THREADS 157076b9443SCy Schubertif test "${TCL_THREADS}" = "1" ; then 158076b9443SCy Schubert AC_DEFINE(SQLITE_THREADSAFE, 1, [Trigger sqlite threadsafe build]) 159076b9443SCy Schubert # Not automatically added by Tcl because its assumed Tcl links to them, 160076b9443SCy Schubert # but it may not if it isn't really a threaded build. 161076b9443SCy Schubert TEA_ADD_LIBS([$THREADS_LIBS]) 162076b9443SCy Schubertelse 163076b9443SCy Schubert AC_DEFINE(SQLITE_THREADSAFE, 0, [Trigger sqlite non-threadsafe build]) 164076b9443SCy Schubertfi 165076b9443SCy Schubert 166076b9443SCy Schubert#-------------------------------------------------------------------- 167076b9443SCy Schubert# The statement below defines a collection of symbols related to 168076b9443SCy Schubert# building as a shared library instead of a static library. 169076b9443SCy Schubert#-------------------------------------------------------------------- 170076b9443SCy Schubert 171076b9443SCy SchubertTEA_ENABLE_SHARED 172076b9443SCy Schubert 173076b9443SCy Schubert#-------------------------------------------------------------------- 174076b9443SCy Schubert# This macro figures out what flags to use with the compiler/linker 175076b9443SCy Schubert# when building shared/static debug/optimized objects. This information 176076b9443SCy Schubert# can be taken from the tclConfig.sh file, but this figures it all out. 177076b9443SCy Schubert#-------------------------------------------------------------------- 178076b9443SCy Schubert 179076b9443SCy SchubertTEA_CONFIG_CFLAGS 180076b9443SCy Schubert 181076b9443SCy Schubert#-------------------------------------------------------------------- 182076b9443SCy Schubert# Set the default compiler switches based on the --enable-symbols option. 183076b9443SCy Schubert#-------------------------------------------------------------------- 184076b9443SCy Schubert 185076b9443SCy SchubertTEA_ENABLE_SYMBOLS 186076b9443SCy Schubert 187076b9443SCy Schubert#-------------------------------------------------------------------- 188076b9443SCy Schubert# This macro generates a line to use when building a library. It 189076b9443SCy Schubert# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, 190076b9443SCy Schubert# and TEA_LOAD_TCLCONFIG macros above. 191076b9443SCy Schubert#-------------------------------------------------------------------- 192076b9443SCy Schubert 193076b9443SCy SchubertTEA_MAKE_LIB 194076b9443SCy Schubert 195076b9443SCy Schubert#-------------------------------------------------------------------- 196076b9443SCy Schubert# Determine the name of the tclsh and/or wish executables in the 197076b9443SCy Schubert# Tcl and Tk build directories or the location they were installed 198076b9443SCy Schubert# into. These paths are used to support running test cases only, 199076b9443SCy Schubert# the Makefile should not be making use of these paths to generate 200076b9443SCy Schubert# a pkgIndex.tcl file or anything else at extension build time. 201076b9443SCy Schubert#-------------------------------------------------------------------- 202076b9443SCy Schubert 203076b9443SCy SchubertTEA_PROG_TCLSH 204076b9443SCy Schubert#TEA_PROG_WISH 205076b9443SCy Schubert 206076b9443SCy Schubert#-------------------------------------------------------------------- 20700787218SCy Schubert# Setup a *Config.sh.in configuration file. 208076b9443SCy Schubert#-------------------------------------------------------------------- 209076b9443SCy Schubert 21000787218SCy Schubert#TEA_EXPORT_CONFIG([sample]) 21100787218SCy Schubert#AC_SUBST(SAMPLE_VAR) 21200787218SCy Schubert 21300787218SCy Schubert#-------------------------------------------------------------------- 21400787218SCy Schubert# Specify files to substitute AC variables in. You may alternatively 21500787218SCy Schubert# have a special pkgIndex.tcl.in or other files which require 21600787218SCy Schubert# substituting the AC variables in. Include these here. 21700787218SCy Schubert#-------------------------------------------------------------------- 21800787218SCy Schubert 21900787218SCy SchubertAC_CONFIG_FILES([Makefile pkgIndex.tcl]) 22000787218SCy Schubert#AC_CONFIG_FILES([sampleConfig.sh]) 22100787218SCy Schubert 22200787218SCy Schubert#-------------------------------------------------------------------- 22300787218SCy Schubert# Finally, substitute all of the various values into the files 22400787218SCy Schubert# specified with AC_CONFIG_FILES. 22500787218SCy Schubert#-------------------------------------------------------------------- 22600787218SCy Schubert 22700787218SCy SchubertAC_OUTPUT 228