source: gsdl/trunk/configure.in@ 15907

Last change on this file since 15907 was 15907, checked in by mdewsnip, 16 years ago

Moving "lib" directory into "src", to keep all the source code together. Not tested yet.

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