source: gsdl/trunk/configure.in@ 15551

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

Introduction of COMPAT32BITFLAGS to confirugre and Makefile.in files to help compile Greenstone on a 64-bit machine

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