1304732Scy#!/bin/bash -norc
2304732Scydnl	This file is an input file used by the GNU "autoconf" program to
3304732Scydnl	generate the file "configure", which is run during Tcl installation
4304732Scydnl	to configure the system for the local environment.
5304732Scy#
6304732Scy# RCS: @(#) $Id: configure.in,v 1.43 2005/07/26 19:17:05 mdejong Exp $
7304732Scy
8304732Scy#-----------------------------------------------------------------------
9304732Scy# Sample configure.in for Tcl Extensions.  The only places you should
10304732Scy# need to modify this file are marked by the string __CHANGE__
11304732Scy#-----------------------------------------------------------------------
12304732Scy
13304732Scy#-----------------------------------------------------------------------
14304732Scy# __CHANGE__
15304732Scy# Set your package name and version numbers here.
16304732Scy#
17304732Scy# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
18304732Scy# set as provided.  These will also be added as -D defs in your Makefile
19304732Scy# so you can encode the package version directly into the source files.
20304732Scy#-----------------------------------------------------------------------
21304732Scy
22304732ScyAC_INIT([sqlite], [3.14.1])
23304732Scy
24304732Scy#--------------------------------------------------------------------
25304732Scy# Call TEA_INIT as the first TEA_ macro to set up initial vars.
26304732Scy# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
27304732Scy# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
28304732Scy#--------------------------------------------------------------------
29304732Scy
30304732ScyTEA_INIT([3.9])
31304732Scy
32304732ScyAC_CONFIG_AUX_DIR(tclconfig)
33304732Scy
34304732Scy#--------------------------------------------------------------------
35304732Scy# Load the tclConfig.sh file
36304732Scy#--------------------------------------------------------------------
37304732Scy
38304732ScyTEA_PATH_TCLCONFIG
39304732ScyTEA_LOAD_TCLCONFIG
40304732Scy
41304732Scy#--------------------------------------------------------------------
42304732Scy# Load the tkConfig.sh file if necessary (Tk extension)
43304732Scy#--------------------------------------------------------------------
44304732Scy
45304732Scy#TEA_PATH_TKCONFIG
46304732Scy#TEA_LOAD_TKCONFIG
47304732Scy
48304732Scy#-----------------------------------------------------------------------
49304732Scy# Handle the --prefix=... option by defaulting to what Tcl gave.
50304732Scy# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
51304732Scy#-----------------------------------------------------------------------
52304732Scy
53304732ScyTEA_PREFIX
54304732Scy
55304732Scy#-----------------------------------------------------------------------
56304732Scy# Standard compiler checks.
57304732Scy# This sets up CC by using the CC env var, or looks for gcc otherwise.
58304732Scy# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create
59304732Scy# the basic setup necessary to compile executables.
60304732Scy#-----------------------------------------------------------------------
61304732Scy
62304732ScyTEA_SETUP_COMPILER
63304732Scy
64304732Scy#-----------------------------------------------------------------------
65304732Scy# __CHANGE__
66304732Scy# Specify the C source files to compile in TEA_ADD_SOURCES,
67304732Scy# public headers that need to be installed in TEA_ADD_HEADERS,
68304732Scy# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
69304732Scy# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
70304732Scy# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
71304732Scy# and PKG_TCL_SOURCES.
72304732Scy#-----------------------------------------------------------------------
73304732Scy
74304732ScyTEA_ADD_SOURCES([tclsqlite3.c])
75304732ScyTEA_ADD_HEADERS([])
76304732ScyTEA_ADD_INCLUDES([-I\"`\${CYGPATH} \${srcdir}/generic`\"])
77304732ScyTEA_ADD_LIBS([])
78304732ScyTEA_ADD_CFLAGS([-DSQLITE_ENABLE_FTS3=1])
79304732ScyTEA_ADD_CFLAGS([-DSQLITE_3_SUFFIX_ONLY=1])
80304732ScyTEA_ADD_CFLAGS([-DSQLITE_ENABLE_RTREE=1])
81304732ScyTEA_ADD_STUB_SOURCES([])
82304732ScyTEA_ADD_TCL_SOURCES([])
83304732Scy
84304732Scy#--------------------------------------------------------------------
85304732Scy# The --with-system-sqlite causes the TCL bindings to SQLite to use
86304732Scy# the system shared library for SQLite rather than statically linking
87304732Scy# against its own private copy.  This is dangerous and leads to
88304732Scy# undersirable dependences and is not recommended.
89304732Scy# Patchs from rmax.
90304732Scy#--------------------------------------------------------------------
91304732ScyAC_ARG_WITH([system-sqlite],
92304732Scy [AC_HELP_STRING([--with-system-sqlite],
93304732Scy   [use a system-supplied libsqlite3 instead of the bundled one])],
94304732Scy [], [with_system_sqlite=no])
95304732Scyif test x$with_system_sqlite != xno; then
96304732Scy AC_CHECK_HEADER([sqlite3.h],
97304732Scy   [AC_CHECK_LIB([sqlite3],[sqlite3_initialize],
98304732Scy     [AC_DEFINE(USE_SYSTEM_SQLITE)
99304732Scy      LIBS="$LIBS -lsqlite3"])])
100304732Scyfi
101304732Scy
102304732Scy#--------------------------------------------------------------------
103304732Scy# __CHANGE__
104304732Scy# Choose which headers you need.  Extension authors should try very
105304732Scy# hard to only rely on the Tcl public header files.  Internal headers
106304732Scy# contain private data structures and are subject to change without
107304732Scy# notice.
108304732Scy# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG
109304732Scy#--------------------------------------------------------------------
110304732Scy
111304732ScyTEA_PUBLIC_TCL_HEADERS
112304732Scy#TEA_PRIVATE_TCL_HEADERS
113304732Scy
114304732Scy#TEA_PUBLIC_TK_HEADERS
115304732Scy#TEA_PRIVATE_TK_HEADERS
116304732Scy#TEA_PATH_X
117304732Scy
118304732Scy#--------------------------------------------------------------------
119304732Scy# Check whether --enable-threads or --disable-threads was given.
120304732Scy# This auto-enables if Tcl was compiled threaded.
121304732Scy#--------------------------------------------------------------------
122304732Scy
123304732ScyTEA_ENABLE_THREADS
124304732Scyif test "${TCL_THREADS}" = "1" ; then
125304732Scy    AC_DEFINE(SQLITE_THREADSAFE, 1, [Trigger sqlite threadsafe build])
126304732Scy    # Not automatically added by Tcl because its assumed Tcl links to them,
127304732Scy    # but it may not if it isn't really a threaded build.
128304732Scy    TEA_ADD_LIBS([$THREADS_LIBS])
129304732Scyelse
130304732Scy    AC_DEFINE(SQLITE_THREADSAFE, 0, [Trigger sqlite non-threadsafe build])
131304732Scyfi
132304732Scy
133304732Scy#--------------------------------------------------------------------
134304732Scy# The statement below defines a collection of symbols related to
135304732Scy# building as a shared library instead of a static library.
136304732Scy#--------------------------------------------------------------------
137304732Scy
138304732ScyTEA_ENABLE_SHARED
139304732Scy
140304732Scy#--------------------------------------------------------------------
141304732Scy# This macro figures out what flags to use with the compiler/linker
142304732Scy# when building shared/static debug/optimized objects.  This information
143304732Scy# can be taken from the tclConfig.sh file, but this figures it all out.
144304732Scy#--------------------------------------------------------------------
145304732Scy
146304732ScyTEA_CONFIG_CFLAGS
147304732Scy
148304732Scy#--------------------------------------------------------------------
149304732Scy# Set the default compiler switches based on the --enable-symbols option.
150304732Scy#--------------------------------------------------------------------
151304732Scy
152304732ScyTEA_ENABLE_SYMBOLS
153304732Scy
154304732Scy#--------------------------------------------------------------------
155304732Scy# Everyone should be linking against the Tcl stub library.  If you
156304732Scy# can't for some reason, remove this definition.  If you aren't using
157304732Scy# stubs, you also need to modify the SHLIB_LD_LIBS setting below to
158304732Scy# link against the non-stubbed Tcl library.  Add Tk too if necessary.
159304732Scy#--------------------------------------------------------------------
160304732Scy
161304732ScyAC_DEFINE(USE_TCL_STUBS, 1, [Use Tcl stubs])
162304732Scy#AC_DEFINE(USE_TK_STUBS, 1, [Use Tk stubs])
163304732Scy
164304732Scy
165304732Scy#--------------------------------------------------------------------
166304732Scy# Redefine fdatasync as fsync on systems that lack fdatasync
167304732Scy#--------------------------------------------------------------------
168304732Scy#
169304732Scy#AC_CHECK_FUNC(fdatasync, , AC_DEFINE(fdatasync, fsync))
170304732Scy# Check for library functions that SQLite can optionally use.
171304732ScyAC_CHECK_FUNCS([fdatasync usleep fullfsync localtime_r gmtime_r])
172304732Scy
173304732ScyAC_FUNC_STRERROR_R
174304732Scy
175304732Scy
176304732Scy#--------------------------------------------------------------------
177304732Scy# This macro generates a line to use when building a library.  It
178304732Scy# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
179304732Scy# and TEA_LOAD_TCLCONFIG macros above.
180304732Scy#--------------------------------------------------------------------
181304732Scy
182304732ScyTEA_MAKE_LIB
183304732Scy
184304732Scy#--------------------------------------------------------------------
185304732Scy# Determine the name of the tclsh and/or wish executables in the
186304732Scy# Tcl and Tk build directories or the location they were installed
187304732Scy# into. These paths are used to support running test cases only,
188304732Scy# the Makefile should not be making use of these paths to generate
189304732Scy# a pkgIndex.tcl file or anything else at extension build time.
190304732Scy#--------------------------------------------------------------------
191304732Scy
192304732ScyTEA_PROG_TCLSH
193304732Scy#TEA_PROG_WISH
194304732Scy
195304732Scy#--------------------------------------------------------------------
196304732Scy# Finally, substitute all of the various values into the Makefile.
197304732Scy# You may alternatively have a special pkgIndex.tcl.in or other files
198304732Scy# which require substituting th AC variables in.  Include these here.
199304732Scy#--------------------------------------------------------------------
200304732Scy
201304732ScyAC_OUTPUT([Makefile pkgIndex.tcl])
202