blob: 0d9c2d40e838f66ff3950b984bbc5435038497d1 [file] [log] [blame]
drh71eb93e2001-09-28 01:34:43 +00001#
2# This file describes a "configure" script that is used to build
3# makefiles for a particular platform. Process this file using
4# Autoconf version 1.13 in order to generate that script. All
5# lines of this file up to the AC_INIT macro are ignored.
6#
7# The build process allows for using a cross-compiler. But the default
8# action is to target the same platform that we are running on. The
9# configure script needs to discover the following properties of the
10# build and target systems:
11#
12# srcdir
13#
14# The is the name of the directory that contains the
15# "configure" shell script. All source files are
16# located relative to this directory.
17#
18# bindir
19#
20# The name of the directory where executables should be
21# written by the "install" target of the makefile.
22#
23# program_prefix
24#
25# Add this prefix to the names of all executables that run
26# on the target machine. Default: ""
27#
28# ENABLE_SHARED
29#
30# True if shared libraries should be generated.
31#
32# BUILD_CC
33#
34# The name of a command that is used to convert C
35# source files into executables that run on the build
36# platform.
37#
38# BUILD_CFLAGS
39#
40# Switches that the build compiler needs in order to construct
41# command-line programs.
42#
43# BUILD_LIBS
44#
45# Libraries that the build compiler needs in order to construct
46# command-line programs.
47#
48# BUILD_EXEEXT
49#
50# The filename extension for executables on the build
51# platform. "" for Unix and ".exe" for Windows.
52#
53# TARGET_CC
54#
55# The name of a command that runs on the build platform
56# and converts C source files into *.o files for the
57# target platform. In other words, the cross-compiler.
58#
59# TARGET_CFLAGS
60#
61# Switches that the target compiler needs to turn C source files
62# into *.o files. Do not include TARGET_TCL_INC in this list.
63# Makefiles might add additional switches such as "-I.".
64#
65# TARGET_TCL_LIBS
66#
67# This is the library directives passed to the target linker
68# that cause the executable to link against Tcl. This might
69# be a switch like "-ltcl8.0" or pathnames of library file
70# like "../../src/libtcl8.0.a".
71#
72# TARGET_TCL_INC
73#
74# This variables define the directory that contain header
75# files for Tcl. If the compiler is able to find <tcl.h>
76# on its own, then this can be blank.
77#
78# TARGET_READLINE_LIBS
79#
80# This is the library directives passed to the target linker
81# that cause the executable to link against the readline library.
82# This might be a switch like "-lreadline" or pathnames of library
83# file like "../../src/libreadline.a".
84#
85# TARGET_READLINE_INC
86#
87# This variables define the directory that contain header
88# files for the readline library. If the compiler is able
89# to find <readline.h> on its own, then this can be blank.
90#
91# TARGET_LINK
92#
93# The name of the linker that combines *.o files generated
94# by TARGET_CC into executables for the target platform.
95#
96# TARGET_LIBS
97#
98# Additional libraries or other switch that the target linker needs
99# to build an executable on the target. Do not include
100# on this list any libraries in TARGET_TCL_LIBS and
101# TARGET_READLINE_LIBS, etc.
102#
103# TARGET_EXEEXT
104#
105# The filename extension for executables on the
106# target platform. "" for Unix and ".exe" for windows.
107#
108# The generated configure script will make an attempt to guess
109# at all of the above parameters. You can override any of
110# the guesses by setting the environment variable named
111# "config_AAAA" where "AAAA" is the name of the parameter
112# described above. (Exception: srcdir cannot be set this way.)
113# If you have a file that sets one or more of these environment
114# variables, you can invoke configure as follows:
115#
116# configure --with-hints=FILE
117#
118# where FILE is the name of the file that sets the environment
119# variables. FILE should be an absolute pathname.
120#
121# If you have a Tcl/Tk/BLT source distribution available, then the
122# files in that distribution will be used instead of any other
123# Tcl/Tk/BLT files the script might discover if you tell the configure
124# script about the source tree. Use commandline options:
125#
126# --with-tcl=PATH --with-tk=PATH --with-blt=PATH
127#
128# Or set environment variables config_WITH_TCL, config_WITH_TK, or
129# config_WITH_BLT.
130#
131# This configure.in file is easy to reuse on other projects. Just
132# change the argument to AC_INIT(). And disable any features that
133# you don't need (for example BLT) by erasing or commenting out
134# the corresponding code.
135#
136AC_INIT(src/sqlite.h.in)
137
138dnl Put the RCS revision string after AC_INIT so that it will also
139dnl show in in configure.
140# The following RCS revision string applies to configure.in
dougcurrie65623c72004-09-20 14:57:23 +0000141# $Revision: 1.11 $
drh71eb93e2001-09-28 01:34:43 +0000142
143#########
144# Programs needed
145#
146AC_PROG_LIBTOOL
147AC_PROG_INSTALL
148
149#########
150# Set up an appropriate program prefix
151#
152if test "$program_prefix" = "NONE"; then
153 program_prefix=""
154fi
155AC_SUBST(program_prefix)
156
a.rottmannc7e93832003-03-24 09:39:32 +0000157if test -f VERSION; then
158 VERSION=`cat VERSION`
159 echo "Version set to $VERSION"
160fi
161AC_SUBST(VERSION)
162
drh71eb93e2001-09-28 01:34:43 +0000163#########
164# Check to see if the --with-hints=FILE option is used. If there is none,
165# then check for a files named "$host.hints" and ../$hosts.hints where
166# $host is the hostname of the build system. If still no hints are
167# found, try looking in $system.hints and ../$system.hints where
168# $system is the result of uname -s.
169#
170AC_ARG_WITH(hints,
171 [ --with-hints=FILE Read configuration options from FILE],
172 hints=$withval)
173if test "$hints" = ""; then
174 host=`hostname | sed 's/\..*//'`
175 if test -r $host.hints; then
176 hints=$host.hints
177 else
178 if test -r ../$host.hints; then
179 hints=../$host.hints
180 fi
181 fi
182fi
183if test "$hints" = ""; then
184 sys=`uname -s`
185 if test -r $sys.hints; then
186 hints=$sys.hints
187 else
188 if test -r ../$sys.hints; then
189 hints=../$sys.hints
190 fi
191 fi
192fi
193if test "$hints" != ""; then
194 AC_MSG_RESULT(reading hints from $hints)
195 . $hints
196fi
197
198#########
199# Locate a compiler for the build machine. This compiler should
200# generate command-line programs that run on the build machine.
201#
202default_build_cflags="-g"
203if test "$config_BUILD_CC" = ""; then
204 AC_PROG_CC
205 if test "$cross_compiling" = "yes"; then
206 AC_MSG_ERROR([unable to find a compiler for building build tools])
207 fi
208 BUILD_CC=$CC
209 default_build_cflags=$CFLAGS
210else
211 BUILD_CC=$config_BUILD_CC
212 AC_MSG_CHECKING([host compiler])
213 CC=$BUILD_CC
214 AC_MSG_RESULT($BUILD_CC)
215fi
216AC_MSG_CHECKING([switches for the host compiler])
217if test "$config_BUILD_CFLAGS" != ""; then
218 CFLAGS=$config_BUILD_CFLAGS
219 BUILD_CFLAGS=$config_BUILD_CFLAGS
220else
221 BUILD_CFLAGS=$default_build_cflags
222fi
223AC_MSG_RESULT($BUILD_CFLAGS)
224if test "$config_BUILD_LIBS" != ""; then
225 BUILD_LIBS=$config_BUILD_LIBS
226fi
227AC_SUBST(BUILD_CC)
228AC_SUBST(BUILD_CFLAGS)
229AC_SUBST(BUILD_LIBS)
230
231##########
232# Locate a compiler that converts C code into *.o files that run on
233# the target machine.
234#
235AC_MSG_CHECKING([target compiler])
236if test "$config_TARGET_CC" != ""; then
237 TARGET_CC=$config_TARGET_CC
238else
239 TARGET_CC=$BUILD_CC
240fi
241AC_MSG_RESULT($TARGET_CC)
242AC_MSG_CHECKING([switches on the target compiler])
243if test "$config_TARGET_CFLAGS" != ""; then
244 TARGET_CFLAGS=$config_TARGET_CFLAGS
245else
246 TARGET_CFLAGS=$BUILD_CFLAGS
247fi
248AC_MSG_RESULT($TARGET_CFLAGS)
249AC_MSG_CHECKING([target linker])
250if test "$config_TARGET_LINK" = ""; then
251 TARGET_LINK=$TARGET_CC
252else
253 TARGET_LINK=$config_TARGET_LINK
254fi
255AC_MSG_RESULT($TARGET_LINK)
256AC_MSG_CHECKING([switches on the target compiler])
257if test "$config_TARGET_TFLAGS" != ""; then
258 TARGET_TFLAGS=$config_TARGET_TFLAGS
259else
260 TARGET_TFLAGS=$BUILD_CFLAGS
261fi
262if test "$config_TARGET_RANLIB" != ""; then
263 TARGET_RANLIB=$config_TARGET_RANLIB
264else
265 AC_PROG_RANLIB
266 TARGET_RANLIB=$RANLIB
267fi
268if test "$config_TARGET_AR" != ""; then
269 TARGET_AR=$config_TARGET_AR
270else
271 TARGET_AR='ar cr'
272fi
273AC_MSG_RESULT($TARGET_TFLAGS)
274AC_SUBST(TARGET_CC)
275AC_SUBST(TARGET_CFLAGS)
276AC_SUBST(TARGET_LINK)
277AC_SUBST(TARGET_LFLAGS)
278AC_SUBST(TARGET_RANLIB)
279AC_SUBST(TARGET_AR)
280
281# Set the $cross variable if we are cross-compiling. Make
282# it 0 if we are not.
283#
284AC_MSG_CHECKING([if host and target compilers are the same])
285if test "$BUILD_CC" = "$TARGET_CC"; then
286 cross=0
287 AC_MSG_RESULT(yes)
288else
289 cross=1
290 AC_MSG_RESULT(no)
291fi
292
293##########
dougcurrie0f290bf2004-06-21 18:57:29 +0000294# Do we want to support multithreaded use of sqlite
drh71eb93e2001-09-28 01:34:43 +0000295#
dougcurrie0f290bf2004-06-21 18:57:29 +0000296AC_ARG_ENABLE(threadsafe,
297[ --enable-threadsafe Support threadsafe operation],,enable_threadsafe=no)
298AC_MSG_CHECKING([whether to support threadsafe operation])
299if test "$enable_threadsafe" = "no"; then
300 THREADSAFE=0
paulb0208cc2003-04-13 18:26:49 +0000301 AC_MSG_RESULT([no])
302else
dougcurrie0f290bf2004-06-21 18:57:29 +0000303 THREADSAFE=1
paulb0208cc2003-04-13 18:26:49 +0000304 AC_MSG_RESULT([yes])
305fi
dougcurrie0f290bf2004-06-21 18:57:29 +0000306AC_SUBST(THREADSAFE)
paulb0208cc2003-04-13 18:26:49 +0000307
dougcurrie65623c72004-09-20 14:57:23 +0000308if test "$THREADSAFE" = "1"; then
309 LIBS=""
310 AC_CHECK_LIB(pthread, pthread_create)
311 TARGET_THREAD_LIB="$LIBS"
312 LIBS=""
313else
314 TARGET_THREAD_LIB=""
315fi
316AC_SUBST(TARGET_THREAD_LIB)
317
paulb0208cc2003-04-13 18:26:49 +0000318##########
xdong3b5543c2003-09-23 00:36:50 +0000319# Do we want to support release
320#
321AC_ARG_ENABLE(releasemode,
322[ --enable-releasemode Support libtool link to release mode],,enable_releasemode=no)
323AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
324if test "$enable_releasemode" = "no"; then
325 ALLOWRELEASE=""
326 AC_MSG_RESULT([no])
327else
328 ALLOWRELEASE="-release `cat VERSION`"
329 AC_MSG_RESULT([yes])
330fi
331AC_SUBST(ALLOWRELEASE)
332
333##########
paulb0208cc2003-04-13 18:26:49 +0000334# Do we want temporary databases in memory
335#
dougcurrie0f290bf2004-06-21 18:57:29 +0000336AC_ARG_ENABLE(tempstore,
337[ --enable-tempstore Use an in-ram database for temporary tables (never,no,yes,always)],,enable_tempstore=yes)
paulb0208cc2003-04-13 18:26:49 +0000338AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000339case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000340 never )
paul2dc96f92003-04-20 11:46:34 +0000341 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000342 AC_MSG_RESULT([never])
343 ;;
344 no )
paul2dc96f92003-04-20 11:46:34 +0000345 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000346 AC_MSG_RESULT([no])
347 ;;
348 always )
dougcurrie0f290bf2004-06-21 18:57:29 +0000349 TEMP_STORE=3
paulb0208cc2003-04-13 18:26:49 +0000350 AC_MSG_RESULT([always])
351 ;;
352 * )
paul2dc96f92003-04-20 11:46:34 +0000353 TEMP_STORE=2
paulb0208cc2003-04-13 18:26:49 +0000354 AC_MSG_RESULT([yes])
355 ;;
356esac
paul2dc96f92003-04-20 11:46:34 +0000357
paul2dc96f92003-04-20 11:46:34 +0000358AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000359
drh71eb93e2001-09-28 01:34:43 +0000360###########
361# Lots of things are different if we are compiling for Windows using
362# the CYGWIN environment. So check for that special case and handle
363# things accordingly.
364#
365AC_MSG_CHECKING([if executables have the .exe suffix])
366if test "$config_BUILD_EXEEXT" = ".exe"; then
367 CYGWIN=yes
368 AC_MSG_RESULT(yes)
369else
370 AC_MSG_RESULT(unknown)
371fi
372if test "$CYGWIN" != "yes"; then
373 AC_CYGWIN
374fi
375if test "$CYGWIN" = "yes"; then
376 BUILD_EXEEXT=.exe
377else
dougcurrie6194a5f2003-12-19 20:09:51 +0000378 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000379fi
380if test "$cross" = "0"; then
381 TARGET_EXEEXT=$BUILD_EXEEXT
382else
383 TARGET_EXEEXT=$config_TARGET_EXEEXT
384fi
385if test "$TARGET_EXEEXT" = ".exe"; then
386 OS_UNIX=0
387 OS_WIN=1
388 tclsubdir=win
dougcurrie0f290bf2004-06-21 18:57:29 +0000389 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_WIN=1"
drh71eb93e2001-09-28 01:34:43 +0000390else
391 OS_UNIX=1
392 OS_WIN=0
393 tclsubdir=unix
dougcurrie0f290bf2004-06-21 18:57:29 +0000394 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000395fi
drh71eb93e2001-09-28 01:34:43 +0000396
397AC_SUBST(BUILD_EXEEXT)
398AC_SUBST(OS_UNIX)
399AC_SUBST(OS_WIN)
400AC_SUBST(TARGET_EXEEXT)
401
402##########
403# Extract generic linker options from the environment.
404#
405if test "$config_TARGET_LIBS" != ""; then
406 TARGET_LIBS=$config_TARGET_LIBS
407else
408 TARGET_LIBS=""
409fi
410AC_SUBST(TARGET_LIBS)
411
412##########
413# Figure out what C libraries are required to compile Tcl programs.
414#
415if test "$config_TARGET_TCL_LIBS" != ""; then
416 TARGET_TCL_LIBS="$config_TARGET_TCL_LIBS"
417else
418 if test "$with_tcl" != ""; then
419 extra=`echo $with_tcl/$tclsubdir/libtcl8*.a`
420 fi
421 CC=$TARGET_CC
422 AC_CHECK_FUNC(sin, LIBS="", LIBS="-lm")
423 AC_CHECK_LIB(dl, dlopen)
424 otherlibs=$LIBS
425 if test "$extra" != ""; then
426 LIBS=$extra
427 else
428 LIBS=""
429 AC_SEARCH_LIBS(Tcl_Init, dnl
dougcurrie6194a5f2003-12-19 20:09:51 +0000430 tcl8.4 tcl8.3 tcl84 tcl83 tcl,,,$otherlibs)
drh71eb93e2001-09-28 01:34:43 +0000431 fi
432 TARGET_TCL_LIBS="$LIBS $otherlibs"
433fi
434AC_SUBST(TARGET_TCL_LIBS)
435
436##########
437# Figure out where to get the TCL header files.
438#
439AC_MSG_CHECKING([TCL header files])
440found=no
441if test "$config_TARGET_TCL_INC" != ""; then
442 TARGET_TCL_INC=$config_TARGET_TCL_INC
443 found=yes
444else
445 if test "$with_tcl" != ""; then
446 TARGET_TCL_INC="-I$with_tcl/generic -I$with_tcl/$tclsubdir"
447 found=yes
448 else
449 TARGET_TCL_INC=""
450 found=no
451 fi
452fi
453if test "$found" = "yes"; then
454 AC_MSG_RESULT($TARGET_TCL_INC)
455else
456 AC_MSG_RESULT(not specified: still searching...)
457 AC_CHECK_HEADER(tcl.h, [found=yes])
458fi
459if test "$found" = "no"; then
460 for dir in /usr/local /usr/X11 /usr/X11R6 /usr/pkg /usr/contrib /usr; do
461 AC_CHECK_FILE($dir/include/tcl.h, found=yes)
462 if test "$found" = "yes"; then
463 TARGET_TCL_INC="-I$dir/include"
464 break
465 fi
466 done
467fi
468if test "$found" = "no"; then
469 TARGET_TCL_INC="-DNO_TCL=1"
470fi
471AC_SUBST(TARGET_TCL_INC)
472
473##########
474# Figure out what C libraries are required to compile programs
475# that use "readline()" library.
476#
477if test "$config_TARGET_READLINE_LIBS" != ""; then
478 TARGET_READLINE_LIBS="$config_TARGET_READLINE_LIBS"
479else
480 CC=$TARGET_CC
481 LIBS=""
paul38372372003-04-22 08:04:49 +0000482 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap])
483 AC_CHECK_LIB([readline], [readline])
drh71eb93e2001-09-28 01:34:43 +0000484 TARGET_READLINE_LIBS="$LIBS"
485fi
486AC_SUBST(TARGET_READLINE_LIBS)
487
488##########
489# Figure out where to get the READLINE header files.
490#
491AC_MSG_CHECKING([readline header files])
492found=no
493if test "$config_TARGET_READLINE_INC" != ""; then
494 TARGET_READLINE_INC=$config_TARGET_READLINE_INC
495 found=yes
496fi
497if test "$found" = "yes"; then
498 AC_MSG_RESULT($TARGET_READLINE_INC)
499else
500 AC_MSG_RESULT(not specified: still searching...)
501 AC_CHECK_HEADER(readline.h, [found=yes])
502fi
503if test "$found" = "no"; then
dougcurrie6194a5f2003-12-19 20:09:51 +0000504 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
drh71eb93e2001-09-28 01:34:43 +0000505 AC_CHECK_FILE($dir/include/readline.h, found=yes)
506 if test "$found" = "yes"; then
507 TARGET_READLINE_INC="-I$dir/include"
508 break
509 fi
510 AC_CHECK_FILE($dir/include/readline/readline.h, found=yes)
511 if test "$found" = "yes"; then
512 TARGET_READLINE_INC="-I$dir/include/readline"
513 break
514 fi
515 done
516fi
517if test "$found" = "yes"; then
518 if test "$TARGET_READLINE_LIBS" = ""; then
519 TARGET_HAVE_READLINE=0
520 else
521 TARGET_HAVE_READLINE=1
522 fi
523else
524 TARGET_HAVE_READLINE=0
525fi
526AC_SUBST(TARGET_READLINE_INC)
527AC_SUBST(TARGET_HAVE_READLINE)
528
529#########
530# Figure out whether or not we have a "usleep()" function.
531#
532AC_CHECK_FUNC(usleep, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_USLEEP=1"])
533
534#########
535# Generate the output files.
536#
a.rottmannc7e93832003-03-24 09:39:32 +0000537AC_OUTPUT([
538Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000539sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000540])