source: gsdl/trunk/build-src/configure.in@ 16571

Last change on this file since 16571 was 16571, checked in by davidb, 16 years ago

Further tailoring of directories for new build/runtime split

  • Property svn:executable set to *
File size: 11.1 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2dnl Use autoconf-2.59 or later... it might not work anymore with
3dnl the older 2.1x versions - jrm21 12/2004
4AC_INIT()
5AC_CONFIG_HEADER(config.h)
6
7
8PACKAGE=gsdl
9VERSION=2.82-svn
10AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
11AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
12AC_SUBST(PACKAGE)
13AC_SUBST(VERSION)
14
15dnl
16dnl Set use of fast cgi
17dnl
18USE_FASTCGI=0
19if test USE_FASTCGI = 1; then
20AC_DEFINE(USE_FASTCGI)
21AC_SUBST(USE_FASTCGI)
22fi
23
24dnl
25dnl Set use of langaction
26dnl
27dnl USE_LANGACTION=0
28if test USE_LANGACTION = 1; then
29AC_DEFINE(USE_LANGACTION)
30AC_SUBST(USE_LANGACTION)
31fi
32
33dnl
34dnl Set use of corba
35dnl
36AC_ARG_ENABLE(corba, [ --enable-corba Enable CORBA support], USE_CORBA=1, USE_CORBA=0)
37AC_DEFINE_UNQUOTED(USE_CORBA, $USE_CORBA)
38AC_SUBST(USE_CORBA)
39
40AC_ARG_WITH(micodir, [ --with-micodir Use installed MICO directory], MICO_DIR=$enableval, MICO_DIR="default")
41AC_DEFINE_UNQUOTED(MICO_DIR, "$MICO_DIR")
42AC_SUBST(MICO_DIR)
43
44dnl
45dnl Set use of z39.50
46dnl
47AC_ARG_ENABLE(z3950, [ --enable-z3950 Enable Z39.50 client support], USE_Z3950=1, USE_Z3950=0)
48if test USE_Z3950 = 1; then
49AC_DEFINE(USE_Z3950, $USE_Z3950)
50AC_SUBST(USE_Z3950)
51fi
52
53dnl
54dnl Set use of yaz - now compiled by default even when z3950 support not required
55dnl
56AC_ARG_ENABLE(yaz, [ --disable-yaz Disable YAZ compilation], USE_YAZ=0, USE_YAZ=1)
57dnl if test USE_YAZ = 1; then
58AC_DEFINE(USE_YAZ, $USE_YAZ)
59AC_SUBST(USE_YAZ)
60dnl fi
61
62dnl
63dnl look for libgdbm if not in standard location
64dnl
65AC_ARG_WITH(gdbm, [ --with-gdbm=dir Use local gdbm library and headers], gdbmdir=$withval)
66
67dnl
68dnl disable compilation of accent folding stuff for mgpp (and one day mg)
69dnl
70AC_ARG_ENABLE(accentfold, [ --disable-accentfold Disable Accent Folding for MGPP], ENABLE_ACCENTFOLD=0, ENABLE_ACCENTFOLD=1)
71AC_DEFINE(ENABLE_ACCENTFOLD, $ENABLE_ACCENTFOLD)
72AC_SUBST(ENABLE_ACCENTFOLD)
73
74dnl
75dnl Set use of SQLite (enabled by default)
76dnl
77AC_ARG_ENABLE(sqlite, [ --disable-sqlite Disable SQLite support], USE_SQLITE=0, USE_SQLITE=1)
78AC_DEFINE(USE_SQLITE, $USE_SQLITE)
79AC_SUBST(USE_SQLITE)
80
81dnl Checks for programs.
82LDFLAGS=$LDFLAGS
83AC_SUBST(LDFLAGS)
84dnl only set CFLAGS if not already set in environment
85if test -z "$CFLAGS"; then
86CFLAGS=-O2
87fi
88AC_SUBST(CFLAGS)
89
90
91AC_PROG_CC
92AC_PROG_CXX
93AC_PROG_AWK
94AC_PROG_YACC
95dnl get $target_cpu, $target_vendor, and $target_os
96dnl (as well as host_*)
97AC_CANONICAL_SYSTEM
98dnl do we actually want this? It adds a prefix based on host, system etc
99dnl AC_ARG_PROGRAM
100AC_PROG_INSTALL
101AC_PROG_LN_S
102AC_PROG_MAKE_SET
103AC_PROG_RANLIB
104
105AC_MSG_CHECKING(to see if architecture is 64-bit)
106arch_64bit=no
107case "$host_cpu" in
108x86_64) arch_64bit=yes ;;
109esac
110
111if test "$arch_64bit" = yes; then
112 AC_MSG_RESULT(yes)
113 if test -z "$COMPAT32BITFLAGS" ; then
114 COMPAT32BITFLAGS="-m32"
115 fi
116else
117 AC_MSG_RESULT(no)
118 if test -z "$COMPAT32BITFLAGS" ; then
119 COMPAT32BITFLAGS=
120 fi
121fi
122export COMPAT32BITFLAGS
123AC_SUBST(COMPAT32BITFLAGS)
124
125
126#moved CORBA MICO directory test to get version of MICO
127if test $USE_CORBA = 1; then
128
129if test $MICO_DIR = "default"; then
130#do something
131MICO_INC="-I packages/mico/mico/include"
132else
133#build the micotest program
134MICO_INC= ""
135if test $MICO_DIR != yes; then
136MICO_INC="-I $MICO_DIR"
137fi
138fi
139
140#get MICO_VER value
141sh -c "$CC -c micotest.cpp -o micotest.o $MICO_INC 2>&1" > /dev/null
142sh -c "$CC -o micotest micotest.o -lstdc++ 2>&1" > /dev/null
143MICO_VER=`./micotest` || MICO_VER=2.3.5
144sh -c "rm micotest"
145sh -c "rm micotest.o"
146
147#do test of MICO_VER
148if test MICO_VER != 0; then
149AC_DEFINE(MICO_VER)
150AC_SUBST(MICO_VER)
151fi
152#end USE_CORBA test
153fi
154
155dnl Checks for typedefs, structures, and compiler characteristics.
156AC_AIX
157AC_ISC_POSIX
158AC_MINIX
159fp_C_PROTOTYPES
160AC_C_CONST
161AC_TYPE_OFF_T
162AC_TYPE_SIZE_T
163AC_HEADER_TIME
164AC_STRUCT_TM
165
166dnl --- This should be in the stdc checking -----------------
167if test "$ac_cv_prog_cc_stdc" = '-Xc'; then
168dnl The Pyramids running SMP_DC.OSx on MIPS r3000 chips with
169dnl /usr/opt/cc3.11/bin/cc treat -Xc as full ANSI mode - no POSIX or
170dnl XOPEN extensions (like popen).
171dnl Unfortunately -D_{XOPEN,POSIX}_SOURCE can't provide all that mg
172dnl needs. So drop back to -Xa
173AC_TRY_COMPILE(
174[#include <stdio.h>
175], [ FILE *rubbish = popen("yes", "r"); ],,
176[CC="`echo $CC | sed 's/-Xc/-Xa/'`" ac_cv_prog_cc_stdc='-Xa'])
177fi
178dnl ----------------------
179
180
181dnl Checks for libraries.
182dnl check for -lg:
183AC_HAVE_LIBRARY(g)
184dnl check for -lm:
185AC_HAVE_LIBRARY(m)
186dnl check for -lcrypt:
187AC_HAVE_LIBRARY(crypt)
188if test $ENABLE_ACCENTFOLD = 1; then
189AC_HAVE_LIBRARY(iconv)
190fi
191
192dnl Checks for header files.
193AC_HEADER_DIRENT
194AC_HEADER_STDC
195AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h crypt.h string.h memory.h sys/procfs.h sys/stat.h)
196AC_EGREP_HEADER(fread, stdio.h, AC_DEFINE(HAVE_FREAD_DECL))
197AC_EGREP_HEADER(fgetc, stdio.h, AC_DEFINE(HAVE_FGETC_DECL))
198AC_EGREP_HEADER(pr_brksize, sys/procfs.h, AC_DEFINE(HAVE_PR_BRKSIZE))
199
200dnl Checks for library functions.
201AC_FUNC_ALLOCA
202AC_PROG_GCC_TRADITIONAL
203AC_TYPE_SIGNAL
204AC_FUNC_VPRINTF
205AC_CHECK_FUNCS(ftime select strftime strtol getrusage times mallinfo setbuffer getpagesize strerror)
206AC_REPLACE_FUNCS(ftruncate strstr strcasecmp)
207
208dnl see if gettext is in libc. (try the textdomain() function).
209AC_CHECK_FUNC(textdomain, AC_DEFINE(ENABLE_NLS ,1) )
210
211# *** Custom checking (based on GNU tar configure.in) ***
212# ---------------------------------------------------------------------------
213AC_MSG_CHECKING(for HP-UX needing gmalloc)
214if test "`(uname -s) 2> /dev/null`" = 'HP-UX'; then
215 AC_MSG_RESULT(yes)
216 AC_LIBOBJ([gmalloc])
217 AC_DEFINE(HAVE_VALLOC)
218else
219 AC_MSG_RESULT(no)
220 AC_CHECK_FUNCS(valloc)
221fi
222
223# we cannot generate static libraries under Darwin
224AC_MSG_CHECKING(for Apple MacOS X/Darwin)
225if test "`(uname -s) 2> /dev/null`" = 'Darwin'; then
226 AC_MSG_RESULT(yes)
227 STATIC=""
228else
229 AC_MSG_RESULT(no)
230 STATIC="-static "
231fi
232AC_SUBST(STATIC)
233
234fp_WITH_DMALLOC
235fp_WITH_REGEX
236
237# ---------------------------------------------------------------------------
238if test "$ac_cv_func_alloca" = 'no'; then
239dnl support functions for alloca.c
240 AC_LIBOBJ([xmalloc])
241 AC_LIBOBJ([error])
242fi
243
244
245# ---------------------------------------------------------------------------
246
247dnl
248dnl Switch into C++
249dnl
250AC_LANG_CPLUSPLUS
251
252dnl
253dnl Check that the GDBM library is available
254dnl
255dnl check libgdbm manually, in case it's not in the standard location.
256
257AC_MSG_CHECKING(that the GDBM library is available)
258if test ! -z "$gdbmdir" ; then
259 # look in given directory for header file
260 if test -r $gdbmdir/include/gdbm.h ; then
261 GDBM_INCLUDE="-I$gdbmdir/include" ;
262 elif test -r $gdbmdir/gdbm.h ; then
263 GDBM_INCLUDE="-I$gdbmdir" ;
264 fi
265
266 # look in given directory for library
267 if test -r $gdbmdir/libgdbm.a ; then
268 GDBM_LIBPATH="-L$gdbmdir" ;
269 elif test -r $gdbmdir/lib/libgdbm.a ; then
270 GDBM_LIBPATH="-L$gdbmdir/lib" ;
271 elif test -r $gdbmdir/.libs/libgdbm.a ; then
272 GDBM_LIBPATH="-L$gdbmdir/.libs" ;
273 fi
274
275 if test ! -z "$GDBM_LIBPATH" -a ! -z "$GDBM_INCLUDE" ; then
276 AC_MSG_RESULT($gdbmdir) ;
277 else
278 AC_MSG_RESULT(can't find gdbm.h and libgdbm.a in $gdbmdir);
279 AC_MSG_CHECKING( looking for GDBM library in default locations)
280 fi
281fi
282
283# look in default path and in /usr/local
284if test -z "$GDBM_INCLUDE" ; then
285 # try in system directory
286 AC_TRY_COMPILE(
287 [#include <gdbm.h>
288],
289 [],
290 success=yes,
291 success=no
292 )
293
294 if test $success = "no"; then
295# last chance - look in /usr/local (eg FreeBSD)
296 GDBM_LIBPATH=-L/usr/local/lib
297 GDBM_INCLUDE=-I/usr/local/include
298 ac_save_CXXFLAGS="$CXXFLAGS"
299 ac_save_LIBS="$LIBS"
300 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
301 LIBS="$LIBS -L/usr/local/lib -lgdbm"
302 AC_TRY_LINK(
303 [#include <gdbm.h>
304#include <stdio.h>
305 ],
306 [printf("%s",gdbm_version);],
307 success=/usr/local,
308 success=no
309 )
310 CXXFLAGS=$ac_save_CXXFLAGS
311 LIBS=$ac_save_LIBS
312 fi
313
314 AC_MSG_RESULT($success)
315 if test $success = "no"; then
316 AC_MSG_ERROR(GDBM Library not available - cannot install)
317 fi
318fi
319dnl I don't think anything actually checks this define, but...
320AC_DEFINE(HAVE_LIBGDBM , 1)
321
322AC_SUBST(GDBM_LIBPATH)
323AC_SUBST(GDBM_INCLUDE)
324
325dnl
326dnl Now check that Perl is actually around, and can be found
327dnl
328AC_MSG_CHECKING(that Perl 5 is available)
329success="no"
330pl_path="$PATH"
331IFS="${IFS= }"; pl_save_ifs="$IFS"; IFS=":"
332for pl_dir in $pl_path; do
333 test -z "$pl_dir" && pl_dir=.
334 if test -x $pl_dir/perl; then
335 success="yes"
336 break
337 fi
338done
339IFS="$pl_save_ifs"
340
341dnl
342dnl Perl actually can be run; now we see if it is version 5 by
343dnl running a sample script (which returns a "clean" version number
344dnl and then tests the result using expr. If perl errors in some
345dnl way (eg. broken Perl executable, missing script), we set a failure
346dnl value ("0") and then proceed as best we can
347dnl
348if test $success = "yes"; then
349try=`perl configtest.pl` || try="0"
350try=`expr $try \> 5.000`
351if test $try = "1"; then
352AC_MSG_RESULT("yes")
353else
354success="no"
355fi
356fi
357
358if test $success = "no"; then
359AC_MSG_RESULT("no")
360AC_MSG_ERROR("Perl 5 not available - cannot install")
361fi
362
363dnl
364dnl Check if the STL library has any known faults;
365dnl In GCC 2.7.2.x series, some STL library headers are missing
366dnl a file called "new" which is referred to by other headers
367dnl (eg. vector/vector.h); if this applies, then all use of the
368dnl STL will cause a compile fail, so we'd better let the user
369dnl know now, before things really go wrong!
370dnl
371success=no
372AC_MSG_CHECKING("whether STL library has known faults")
373
374dnl - first shot, try simple good old vector on its own
375AC_TRY_COMPILE(
376[#include <vector>
377],
378[],
379success=yes,
380)
381
382dnl - try using the .h equivalent
383if test $success = "no"; then
384AC_TRY_COMPILE(
385[#include <vector.h>
386],
387[],
388success="yes",
389)
390fi
391
392dnl - now try for the objectspace headers
393if test $success = "no"; then
394AC_TRY_COMPILE(
395[#include <ospace\\std\\vector>
396],
397[],
398success="yes",
399)
400fi
401
402if test $success = yes; then
403AC_MSG_RESULT("no")
404else
405AC_MSG_RESULT("yes")
406AC_MSG_ERROR("STL Broken - Obtain newer version of GNU C Compiler")
407fi
408
409gsdlos=`uname | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
410# check for running bash under cygwin
411 if test "`echo $gsdlos | sed 's/cygwin//'`" != "$gsdlos" ;
412 then
413 gsdlos=windows
414 fi
415AC_SUBST(gsdlos)
416
417# check for endianness
418AC_C_BIGENDIAN
419# ---------------------------------------------------------------------------
420if test "$ac_cv_func_alloca" = 'no'; then
421dnl support functions for alloca.c
422 AC_LIBOBJ([xmalloc.o])
423 AC_LIBOBJ([error])
424fi
425
426# ---------------------------------------------------------------------------
427
428dnl
429dnl Locate all children of the modules folder
430dnl
431moduleDirs=""
432MODULEDIRS=""
433if [ -d modules ] ; then
434 for x in `find modules -mindepth 1 -maxdepth 2`; do
435 if test -d "$x"; then
436 d="$x/Makefile.in"
437 if test -e "$d"; then
438 dnl echo $d
439 moduleDirs="$moduleDirs $x/Makefile"
440 MODULEDIRS="$MODULEDIRS $x"
441 fi
442 fi
443 done
444 echo "Making $moduleDirs in modules directory"
445 AC_SUBST(MODULEDIRS)
446fi
447
448
449# ---------------------------------------------------------------------------
450AC_CONFIG_SUBDIRS(packages)
451
452# the list of folders in the src folder
453srclist="src/hashfile/Makefile \
454 src/phind/generate/Makefile"
455
456AC_OUTPUT(packages/Makefile Makefile $srclist $moduleDirs)
457
458
Note: See TracBrowser for help on using the repository browser.