xref: /freebsd/contrib/sqlite3/tea/configure.ac (revision 397e83df75e0fcd0d3fcb95ae4d794cb7600fc89)
1#!/bin/bash -norc
2dnl	This file is an input file used by the GNU "autoconf" program to
3dnl	generate the file "configure", which is run during Tcl installation
4dnl	to configure the system for the local environment.
5
6#-----------------------------------------------------------------------
7# Sample configure.ac for Tcl Extensions.  The only places you should
8# need to modify this file are marked by the string __CHANGE__
9#-----------------------------------------------------------------------
10
11#-----------------------------------------------------------------------
12# __CHANGE__
13# Set your package name and version numbers here.
14#
15# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
16# set as provided.  These will also be added as -D defs in your Makefile
17# so you can encode the package version directly into the source files.
18# This will also define a special symbol for Windows (BUILD_<PACKAGE_NAME>
19# so that we create the export library with the dll.
20#-----------------------------------------------------------------------
21
22AC_INIT([sqlite],[3.45.1])
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
30TEA_INIT()
31
32AC_CONFIG_AUX_DIR(tclconfig)
33
34#--------------------------------------------------------------------
35# Load the tclConfig.sh file
36#--------------------------------------------------------------------
37
38TEA_PATH_TCLCONFIG
39TEA_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
53TEA_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 and a few others to create the basic setup
59# necessary to compile executables.
60#-----------------------------------------------------------------------
61
62TEA_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
74TEA_ADD_SOURCES([tclsqlite3.c])
75TEA_ADD_HEADERS([])
76TEA_ADD_INCLUDES([])
77TEA_ADD_LIBS([])
78TEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS3=1])
79TEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS4=1])
80TEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS5=1])
81TEA_ADD_CFLAGS([-DSQLITE_3_SUFFIX_ONLY=1])
82TEA_ADD_CFLAGS([-DSQLITE_ENABLE_RTREE=1])
83TEA_ADD_CFLAGS([-DSQLITE_ENABLE_GEOPOLY=1])
84TEA_ADD_CFLAGS([-DSQLITE_ENABLE_MATH_FUNCTIONS=1])
85TEA_ADD_CFLAGS([-DSQLITE_ENABLE_DESERIALIZE=1])
86TEA_ADD_CFLAGS([-DSQLITE_ENABLE_DBPAGE_VTAB=1])
87TEA_ADD_CFLAGS([-DSQLITE_ENABLE_BYTECODE_VTAB=1])
88TEA_ADD_CFLAGS([-DSQLITE_ENABLE_DBSTAT_VTAB=1])
89TEA_ADD_STUB_SOURCES([])
90TEA_ADD_TCL_SOURCES([])
91
92#--------------------------------------------------------------------
93# The --with-system-sqlite causes the TCL bindings to SQLite to use
94# the system shared library for SQLite rather than statically linking
95# against its own private copy.  This is dangerous and leads to
96# undersirable dependences and is not recommended.
97# Patchs from rmax.
98#--------------------------------------------------------------------
99AC_ARG_WITH([system-sqlite],
100 [AC_HELP_STRING([--with-system-sqlite],
101   [use a system-supplied libsqlite3 instead of the bundled one])],
102 [], [with_system_sqlite=no])
103if test x$with_system_sqlite != xno; then
104 AC_CHECK_HEADER([sqlite3.h],
105   [AC_CHECK_LIB([sqlite3],[sqlite3_initialize],
106     [AC_DEFINE(USE_SYSTEM_SQLITE)
107      LIBS="$LIBS -lsqlite3"])])
108fi
109
110#--------------------------------------------------------------------
111# __CHANGE__
112#
113# You can add more files to clean if your extension creates any extra
114# files by extending CLEANFILES.
115# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure
116# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
117#
118# A few miscellaneous platform-specific items:
119# TEA_ADD_* any platform specific compiler/build info here.
120#--------------------------------------------------------------------
121
122#CLEANFILES="$CLEANFILES pkgIndex.tcl"
123if test "${TEA_PLATFORM}" = "windows" ; then
124    # Ensure no empty if clauses
125    :
126    #TEA_ADD_SOURCES([win/winFile.c])
127    #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
128else
129    # Ensure no empty else clauses
130    :
131    #TEA_ADD_SOURCES([unix/unixFile.c])
132    #TEA_ADD_LIBS([-lsuperfly])
133fi
134
135#--------------------------------------------------------------------
136# __CHANGE__
137# Choose which headers you need.  Extension authors should try very
138# hard to only rely on the Tcl public header files.  Internal headers
139# contain private data structures and are subject to change without
140# notice.
141# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
142#--------------------------------------------------------------------
143
144TEA_PUBLIC_TCL_HEADERS
145#TEA_PRIVATE_TCL_HEADERS
146
147#TEA_PUBLIC_TK_HEADERS
148#TEA_PRIVATE_TK_HEADERS
149#TEA_PATH_X
150
151#--------------------------------------------------------------------
152# Check whether --enable-threads or --disable-threads was given.
153# This auto-enables if Tcl was compiled threaded.
154#--------------------------------------------------------------------
155
156TEA_ENABLE_THREADS
157if test "${TCL_THREADS}" = "1" ; then
158    AC_DEFINE(SQLITE_THREADSAFE, 1, [Trigger sqlite threadsafe build])
159    # Not automatically added by Tcl because its assumed Tcl links to them,
160    # but it may not if it isn't really a threaded build.
161    TEA_ADD_LIBS([$THREADS_LIBS])
162else
163    AC_DEFINE(SQLITE_THREADSAFE, 0, [Trigger sqlite non-threadsafe build])
164fi
165
166#--------------------------------------------------------------------
167# The statement below defines a collection of symbols related to
168# building as a shared library instead of a static library.
169#--------------------------------------------------------------------
170
171TEA_ENABLE_SHARED
172
173#--------------------------------------------------------------------
174# This macro figures out what flags to use with the compiler/linker
175# when building shared/static debug/optimized objects.  This information
176# can be taken from the tclConfig.sh file, but this figures it all out.
177#--------------------------------------------------------------------
178
179TEA_CONFIG_CFLAGS
180
181#--------------------------------------------------------------------
182# Set the default compiler switches based on the --enable-symbols option.
183#--------------------------------------------------------------------
184
185TEA_ENABLE_SYMBOLS
186
187#--------------------------------------------------------------------
188# This macro generates a line to use when building a library.  It
189# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
190# and TEA_LOAD_TCLCONFIG macros above.
191#--------------------------------------------------------------------
192
193TEA_MAKE_LIB
194
195#--------------------------------------------------------------------
196# Determine the name of the tclsh and/or wish executables in the
197# Tcl and Tk build directories or the location they were installed
198# into. These paths are used to support running test cases only,
199# the Makefile should not be making use of these paths to generate
200# a pkgIndex.tcl file or anything else at extension build time.
201#--------------------------------------------------------------------
202
203TEA_PROG_TCLSH
204#TEA_PROG_WISH
205
206#--------------------------------------------------------------------
207# Setup a *Config.sh.in configuration file.
208#--------------------------------------------------------------------
209
210#TEA_EXPORT_CONFIG([sample])
211#AC_SUBST(SAMPLE_VAR)
212
213#--------------------------------------------------------------------
214# Specify files to substitute AC variables in. You may alternatively
215# have a special pkgIndex.tcl.in or other files which require
216# substituting the AC variables in. Include these here.
217#--------------------------------------------------------------------
218
219AC_CONFIG_FILES([Makefile pkgIndex.tcl])
220#AC_CONFIG_FILES([sampleConfig.sh])
221
222#--------------------------------------------------------------------
223# Finally, substitute all of the various values into the files
224# specified with AC_CONFIG_FILES.
225#--------------------------------------------------------------------
226
227AC_OUTPUT
228