blob: 15a4b1b1e0574672dbeb0cbfc6bd22d8fd381574 [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
paulb0208cc2003-04-13 18:26:49 +0000141# $Revision: 1.3 $
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##########
294# Are we using UTF-8 or iso8859 encodings?
295#
296AC_ARG_ENABLE(utf8,
297[ --enable-utf8 Use UTF-8 encodings],,enable_utf8=no)
298AC_MSG_CHECKING([character encoding])
299if test "$enable_utf8" = "no"; then
300 ENCODING=ISO8859
301 AC_MSG_RESULT([iso8859])
302else
303 ENCODING=UTF8
304 AC_MSG_RESULT([UTF-8])
305fi
306AC_SUBST(ENCODING)
307
paulb0208cc2003-04-13 18:26:49 +0000308##########
309# Do we want to support in-ram databases for ATTACH DATABASE and sqlite_open
310#
311AC_ARG_ENABLE(incore-db,
312[ --enable-incore-db Support incore database],,enable_incore-db=yes)
313AC_MSG_CHECKING([whether to support incore databases for attach and open])
314if test "$enable_incore-db" = "no"; then
315 INCOREDB=0
316 ALLOWATTACHMEM=0
317 AC_MSG_RESULT([no])
318else
319 INCOREDB=1
320 ALLOWATTACHMEM=1
321 AC_MSG_RESULT([yes])
322fi
323AC_SUBST(ALLOWATTACHMEM)
324
325##########
326# Do we want temporary databases in memory
327#
328AC_ARG_ENABLE(tempdb-in-ram,
329[ --enable-tempdb-in-ram Use an in-ram database for temporary tables],,enable_tempdb-in-ram=no)
330AC_MSG_CHECKING([whether to use an in-ram database for temporary tables])
331case "$enable_tempdb-in-ram" in
332 never )
333 TEMPDBINCORE=0
334 AC_MSG_RESULT([never])
335 ;;
336 no )
337 INCOREDB=1
338 TEMPDBINCORE=1
339 AC_MSG_RESULT([no])
340 ;;
341 always )
342 INCOREDB=1
343 TEMPDBINCORE=3
344 AC_MSG_RESULT([always])
345 ;;
346 * )
347 INCOREDB=1
348 TEMPDBINCORE=2
349 AC_MSG_RESULT([yes])
350 ;;
351esac
352AC_SUBST(INCOREDB)
353AC_SUBST(TEMPDBINCORE)
354
drh71eb93e2001-09-28 01:34:43 +0000355###########
356# Lots of things are different if we are compiling for Windows using
357# the CYGWIN environment. So check for that special case and handle
358# things accordingly.
359#
360AC_MSG_CHECKING([if executables have the .exe suffix])
361if test "$config_BUILD_EXEEXT" = ".exe"; then
362 CYGWIN=yes
363 AC_MSG_RESULT(yes)
364else
365 AC_MSG_RESULT(unknown)
366fi
367if test "$CYGWIN" != "yes"; then
368 AC_CYGWIN
369fi
370if test "$CYGWIN" = "yes"; then
371 BUILD_EXEEXT=.exe
372else
373 BUILD_EXEEXT=""
374fi
375if test "$cross" = "0"; then
376 TARGET_EXEEXT=$BUILD_EXEEXT
377else
378 TARGET_EXEEXT=$config_TARGET_EXEEXT
379fi
380if test "$TARGET_EXEEXT" = ".exe"; then
381 OS_UNIX=0
382 OS_WIN=1
383 tclsubdir=win
384else
385 OS_UNIX=1
386 OS_WIN=0
387 tclsubdir=unix
388fi
389TARGET_CFLAGS="$TARGET_CFLAGS -DOS_UNIX=$OS_UNIX -DOS_WIN=$OS_WIN"
390
391AC_SUBST(BUILD_EXEEXT)
392AC_SUBST(OS_UNIX)
393AC_SUBST(OS_WIN)
394AC_SUBST(TARGET_EXEEXT)
395
396##########
397# Extract generic linker options from the environment.
398#
399if test "$config_TARGET_LIBS" != ""; then
400 TARGET_LIBS=$config_TARGET_LIBS
401else
402 TARGET_LIBS=""
403fi
404AC_SUBST(TARGET_LIBS)
405
406##########
407# Figure out what C libraries are required to compile Tcl programs.
408#
409if test "$config_TARGET_TCL_LIBS" != ""; then
410 TARGET_TCL_LIBS="$config_TARGET_TCL_LIBS"
411else
412 if test "$with_tcl" != ""; then
413 extra=`echo $with_tcl/$tclsubdir/libtcl8*.a`
414 fi
415 CC=$TARGET_CC
416 AC_CHECK_FUNC(sin, LIBS="", LIBS="-lm")
417 AC_CHECK_LIB(dl, dlopen)
418 otherlibs=$LIBS
419 if test "$extra" != ""; then
420 LIBS=$extra
421 else
422 LIBS=""
423 AC_SEARCH_LIBS(Tcl_Init, dnl
424 tcl8.4 tcl8.3 tcl8.2 tcl8.1 tcl8.0 tcl80 tcl,,,$otherlibs)
425 fi
426 TARGET_TCL_LIBS="$LIBS $otherlibs"
427fi
428AC_SUBST(TARGET_TCL_LIBS)
429
430##########
431# Figure out where to get the TCL header files.
432#
433AC_MSG_CHECKING([TCL header files])
434found=no
435if test "$config_TARGET_TCL_INC" != ""; then
436 TARGET_TCL_INC=$config_TARGET_TCL_INC
437 found=yes
438else
439 if test "$with_tcl" != ""; then
440 TARGET_TCL_INC="-I$with_tcl/generic -I$with_tcl/$tclsubdir"
441 found=yes
442 else
443 TARGET_TCL_INC=""
444 found=no
445 fi
446fi
447if test "$found" = "yes"; then
448 AC_MSG_RESULT($TARGET_TCL_INC)
449else
450 AC_MSG_RESULT(not specified: still searching...)
451 AC_CHECK_HEADER(tcl.h, [found=yes])
452fi
453if test "$found" = "no"; then
454 for dir in /usr/local /usr/X11 /usr/X11R6 /usr/pkg /usr/contrib /usr; do
455 AC_CHECK_FILE($dir/include/tcl.h, found=yes)
456 if test "$found" = "yes"; then
457 TARGET_TCL_INC="-I$dir/include"
458 break
459 fi
460 done
461fi
462if test "$found" = "no"; then
463 TARGET_TCL_INC="-DNO_TCL=1"
464fi
465AC_SUBST(TARGET_TCL_INC)
466
467##########
468# Figure out what C libraries are required to compile programs
469# that use "readline()" library.
470#
471if test "$config_TARGET_READLINE_LIBS" != ""; then
472 TARGET_READLINE_LIBS="$config_TARGET_READLINE_LIBS"
473else
474 CC=$TARGET_CC
475 LIBS=""
476 AC_SEARCH_LIBS(readline, readline,,,)
477 TARGET_READLINE_LIBS="$LIBS"
478fi
479AC_SUBST(TARGET_READLINE_LIBS)
480
481##########
482# Figure out where to get the READLINE header files.
483#
484AC_MSG_CHECKING([readline header files])
485found=no
486if test "$config_TARGET_READLINE_INC" != ""; then
487 TARGET_READLINE_INC=$config_TARGET_READLINE_INC
488 found=yes
489fi
490if test "$found" = "yes"; then
491 AC_MSG_RESULT($TARGET_READLINE_INC)
492else
493 AC_MSG_RESULT(not specified: still searching...)
494 AC_CHECK_HEADER(readline.h, [found=yes])
495fi
496if test "$found" = "no"; then
497 for dir in /usr /usr/local /usr/local/readline /usr/contrib; do
498 AC_CHECK_FILE($dir/include/readline.h, found=yes)
499 if test "$found" = "yes"; then
500 TARGET_READLINE_INC="-I$dir/include"
501 break
502 fi
503 AC_CHECK_FILE($dir/include/readline/readline.h, found=yes)
504 if test "$found" = "yes"; then
505 TARGET_READLINE_INC="-I$dir/include/readline"
506 break
507 fi
508 done
509fi
510if test "$found" = "yes"; then
511 if test "$TARGET_READLINE_LIBS" = ""; then
512 TARGET_HAVE_READLINE=0
513 else
514 TARGET_HAVE_READLINE=1
515 fi
516else
517 TARGET_HAVE_READLINE=0
518fi
519AC_SUBST(TARGET_READLINE_INC)
520AC_SUBST(TARGET_HAVE_READLINE)
521
522#########
523# Figure out whether or not we have a "usleep()" function.
524#
525AC_CHECK_FUNC(usleep, [TARGET_CFLAGS="$TARGET_CFLAGS -DHAVE_USLEEP=1"])
526
527#########
528# Generate the output files.
529#
a.rottmannc7e93832003-03-24 09:39:32 +0000530AC_OUTPUT([
531Makefile
532sqlite.pc
533])