blob: 52409a2f05dc6648e5a9bc8d9fcb9a991e649213 [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
dougcurrie12b34442004-07-19 03:24:59 +0000141# $Revision: 1.10 $
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
308##########
xdong3b5543c2003-09-23 00:36:50 +0000309# Do we want to support release
310#
311AC_ARG_ENABLE(releasemode,
312[ --enable-releasemode Support libtool link to release mode],,enable_releasemode=no)
313AC_MSG_CHECKING([whether to support shared library linked as release mode or not])
314if test "$enable_releasemode" = "no"; then
315 ALLOWRELEASE=""
316 AC_MSG_RESULT([no])
317else
318 ALLOWRELEASE="-release `cat VERSION`"
319 AC_MSG_RESULT([yes])
320fi
321AC_SUBST(ALLOWRELEASE)
322
323##########
paulb0208cc2003-04-13 18:26:49 +0000324# Do we want temporary databases in memory
325#
dougcurrie0f290bf2004-06-21 18:57:29 +0000326AC_ARG_ENABLE(tempstore,
327[ --enable-tempstore Use an in-ram database for temporary tables (never,no,yes,always)],,enable_tempstore=yes)
paulb0208cc2003-04-13 18:26:49 +0000328AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
dougcurrie0f290bf2004-06-21 18:57:29 +0000329case "$enable_tempstore" in
paulb0208cc2003-04-13 18:26:49 +0000330 never )
paul2dc96f92003-04-20 11:46:34 +0000331 TEMP_STORE=0
paulb0208cc2003-04-13 18:26:49 +0000332 AC_MSG_RESULT([never])
333 ;;
334 no )
paul2dc96f92003-04-20 11:46:34 +0000335 TEMP_STORE=1
paulb0208cc2003-04-13 18:26:49 +0000336 AC_MSG_RESULT([no])
337 ;;
338 always )
dougcurrie0f290bf2004-06-21 18:57:29 +0000339 TEMP_STORE=3
paulb0208cc2003-04-13 18:26:49 +0000340 AC_MSG_RESULT([always])
341 ;;
342 * )
paul2dc96f92003-04-20 11:46:34 +0000343 TEMP_STORE=2
paulb0208cc2003-04-13 18:26:49 +0000344 AC_MSG_RESULT([yes])
345 ;;
346esac
paul2dc96f92003-04-20 11:46:34 +0000347
paul2dc96f92003-04-20 11:46:34 +0000348AC_SUBST(TEMP_STORE)
paulb0208cc2003-04-13 18:26:49 +0000349
drh71eb93e2001-09-28 01:34:43 +0000350###########
351# Lots of things are different if we are compiling for Windows using
352# the CYGWIN environment. So check for that special case and handle
353# things accordingly.
354#
355AC_MSG_CHECKING([if executables have the .exe suffix])
356if test "$config_BUILD_EXEEXT" = ".exe"; then
357 CYGWIN=yes
358 AC_MSG_RESULT(yes)
359else
360 AC_MSG_RESULT(unknown)
361fi
362if test "$CYGWIN" != "yes"; then
363 AC_CYGWIN
364fi
365if test "$CYGWIN" = "yes"; then
366 BUILD_EXEEXT=.exe
367else
dougcurrie6194a5f2003-12-19 20:09:51 +0000368 BUILD_EXEEXT=$EXEEXT
drh71eb93e2001-09-28 01:34:43 +0000369fi
370if test "$cross" = "0"; then
371 TARGET_EXEEXT=$BUILD_EXEEXT
372else
373 TARGET_EXEEXT=$config_TARGET_EXEEXT
374fi
375if test "$TARGET_EXEEXT" = ".exe"; then
376 OS_UNIX=0
377 OS_WIN=1
378 tclsubdir=win
dougcurrie0f290bf2004-06-21 18:57:29 +0000379 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_WIN=1"
drh71eb93e2001-09-28 01:34:43 +0000380else
381 OS_UNIX=1
382 OS_WIN=0
383 tclsubdir=unix
dougcurrie0f290bf2004-06-21 18:57:29 +0000384 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_UNIX=1"
drh71eb93e2001-09-28 01:34:43 +0000385fi
drh71eb93e2001-09-28 01:34:43 +0000386
387AC_SUBST(BUILD_EXEEXT)
388AC_SUBST(OS_UNIX)
389AC_SUBST(OS_WIN)
390AC_SUBST(TARGET_EXEEXT)
391
392##########
393# Extract generic linker options from the environment.
394#
395if test "$config_TARGET_LIBS" != ""; then
396 TARGET_LIBS=$config_TARGET_LIBS
397else
398 TARGET_LIBS=""
399fi
400AC_SUBST(TARGET_LIBS)
401
402##########
403# Figure out what C libraries are required to compile Tcl programs.
404#
405if test "$config_TARGET_TCL_LIBS" != ""; then
406 TARGET_TCL_LIBS="$config_TARGET_TCL_LIBS"
407else
408 if test "$with_tcl" != ""; then
409 extra=`echo $with_tcl/$tclsubdir/libtcl8*.a`
410 fi
411 CC=$TARGET_CC
412 AC_CHECK_FUNC(sin, LIBS="", LIBS="-lm")
413 AC_CHECK_LIB(dl, dlopen)
414 otherlibs=$LIBS
415 if test "$extra" != ""; then
416 LIBS=$extra
417 else
418 LIBS=""
419 AC_SEARCH_LIBS(Tcl_Init, dnl
dougcurrie6194a5f2003-12-19 20:09:51 +0000420 tcl8.4 tcl8.3 tcl84 tcl83 tcl,,,$otherlibs)
drh71eb93e2001-09-28 01:34:43 +0000421 fi
422 TARGET_TCL_LIBS="$LIBS $otherlibs"
423fi
424AC_SUBST(TARGET_TCL_LIBS)
425
426##########
427# Figure out where to get the TCL header files.
428#
429AC_MSG_CHECKING([TCL header files])
430found=no
431if test "$config_TARGET_TCL_INC" != ""; then
432 TARGET_TCL_INC=$config_TARGET_TCL_INC
433 found=yes
434else
435 if test "$with_tcl" != ""; then
436 TARGET_TCL_INC="-I$with_tcl/generic -I$with_tcl/$tclsubdir"
437 found=yes
438 else
439 TARGET_TCL_INC=""
440 found=no
441 fi
442fi
443if test "$found" = "yes"; then
444 AC_MSG_RESULT($TARGET_TCL_INC)
445else
446 AC_MSG_RESULT(not specified: still searching...)
447 AC_CHECK_HEADER(tcl.h, [found=yes])
448fi
449if test "$found" = "no"; then
450 for dir in /usr/local /usr/X11 /usr/X11R6 /usr/pkg /usr/contrib /usr; do
451 AC_CHECK_FILE($dir/include/tcl.h, found=yes)
452 if test "$found" = "yes"; then
453 TARGET_TCL_INC="-I$dir/include"
454 break
455 fi
456 done
457fi
458if test "$found" = "no"; then
459 TARGET_TCL_INC="-DNO_TCL=1"
460fi
461AC_SUBST(TARGET_TCL_INC)
462
463##########
464# Figure out what C libraries are required to compile programs
465# that use "readline()" library.
466#
467if test "$config_TARGET_READLINE_LIBS" != ""; then
468 TARGET_READLINE_LIBS="$config_TARGET_READLINE_LIBS"
469else
470 CC=$TARGET_CC
471 LIBS=""
paul38372372003-04-22 08:04:49 +0000472 AC_SEARCH_LIBS(tgetent, [readline ncurses curses termcap])
473 AC_CHECK_LIB([readline], [readline])
drh71eb93e2001-09-28 01:34:43 +0000474 TARGET_READLINE_LIBS="$LIBS"
475fi
476AC_SUBST(TARGET_READLINE_LIBS)
477
478##########
479# Figure out where to get the READLINE header files.
480#
481AC_MSG_CHECKING([readline header files])
482found=no
483if test "$config_TARGET_READLINE_INC" != ""; then
484 TARGET_READLINE_INC=$config_TARGET_READLINE_INC
485 found=yes
486fi
487if test "$found" = "yes"; then
488 AC_MSG_RESULT($TARGET_READLINE_INC)
489else
490 AC_MSG_RESULT(not specified: still searching...)
491 AC_CHECK_HEADER(readline.h, [found=yes])
492fi
493if test "$found" = "no"; then
dougcurrie6194a5f2003-12-19 20:09:51 +0000494 for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
drh71eb93e2001-09-28 01:34:43 +0000495 AC_CHECK_FILE($dir/include/readline.h, found=yes)
496 if test "$found" = "yes"; then
497 TARGET_READLINE_INC="-I$dir/include"
498 break
499 fi
500 AC_CHECK_FILE($dir/include/readline/readline.h, found=yes)
501 if test "$found" = "yes"; then
502 TARGET_READLINE_INC="-I$dir/include/readline"
503 break
504 fi
505 done
506fi
507if test "$found" = "yes"; then
508 if test "$TARGET_READLINE_LIBS" = ""; then
509 TARGET_HAVE_READLINE=0
510 else
511 TARGET_HAVE_READLINE=1
512 fi
513else
514 TARGET_HAVE_READLINE=0
515fi
516AC_SUBST(TARGET_READLINE_INC)
517AC_SUBST(TARGET_HAVE_READLINE)
518
519#########
520# Figure out whether or not we have a "usleep()" function.
521#
522AC_CHECK_FUNC(usleep, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_USLEEP=1"])
523
524#########
525# Generate the output files.
526#
a.rottmannc7e93832003-03-24 09:39:32 +0000527AC_OUTPUT([
528Makefile
dougcurrie12b34442004-07-19 03:24:59 +0000529sqlite3.pc
a.rottmannc7e93832003-03-24 09:39:32 +0000530])