source: gsdl/trunk/gs2runtime/configure.in@ 16568

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

Extra Makefile, configure and supporting files for shared runtime code

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