root/gsdl/trunk/configure.in @ 15551

Revision 15551, 11.4 KB (checked in by davidb, 12 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
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 Checks for programs.
74LDFLAGS=$LDFLAGS
75AC_SUBST(LDFLAGS)
76dnl only set CFLAGS if not already set in environment
77if test -z "$CFLAGS"; then
78CFLAGS=-O2
79fi
80AC_SUBST(CFLAGS)
81
82
83AC_PROG_CC
84AC_PROG_CXX
85AC_PROG_AWK
86AC_PROG_YACC
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
92AC_PROG_INSTALL
93AC_PROG_LN_S
94AC_PROG_MAKE_SET
95AC_PROG_RANLIB
96
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
118#moved CORBA MICO directory test to get version of MICO
119if test $USE_CORBA = 1; then
120
121if test $MICO_DIR = "default"; then
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
135MICO_VER=`./micotest` || MICO_VER=2.3.5
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
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
173dnl Checks for libraries.
174dnl check for -lg:
175AC_HAVE_LIBRARY(g)
176dnl check for -lm:
177AC_HAVE_LIBRARY(m)
178dnl check for -lcrypt:
179AC_HAVE_LIBRARY(crypt)
180if test $ENABLE_ACCENTFOLD = 1; then
181AC_HAVE_LIBRARY(iconv)
182fi
183
184dnl Checks for header files.
185AC_HEADER_DIRENT
186AC_HEADER_STDC
187AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h crypt.h string.h memory.h sys/procfs.h sys/stat.h)
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))
191
192dnl Checks for library functions.
193AC_FUNC_ALLOCA
194AC_PROG_GCC_TRADITIONAL
195AC_TYPE_SIGNAL
196AC_FUNC_VPRINTF
197AC_CHECK_FUNCS(ftime select strftime strtol getrusage times mallinfo setbuffer getpagesize strerror)
198AC_REPLACE_FUNCS(ftruncate strstr strcasecmp)
199
200dnl see if gettext is in libc. (try the textdomain() function).
201AC_CHECK_FUNC(textdomain, AC_DEFINE(ENABLE_NLS ,1) )
202
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)
208  AC_LIBOBJ([gmalloc])
209  AC_DEFINE(HAVE_VALLOC)
210else
211  AC_MSG_RESULT(no)
212  AC_CHECK_FUNCS(valloc)
213fi
214
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)
219  STATIC=""
220else
221  AC_MSG_RESULT(no)
222  STATIC="-static "
223fi
224AC_SUBST(STATIC)
225
226fp_WITH_DMALLOC
227fp_WITH_REGEX
228
229# ---------------------------------------------------------------------------
230if test "$ac_cv_func_alloca" = 'no'; then
231dnl    support functions for alloca.c
232  AC_LIBOBJ([xmalloc])
233  AC_LIBOBJ([error])
234fi
235
236
237# ---------------------------------------------------------------------------
238
239dnl
240dnl Switch into C++
241dnl
242AC_LANG_CPLUSPLUS
243
244dnl
245dnl Check that the GDBM library is available
246dnl
247dnl check libgdbm manually, in case it's not in the standard location.
248
249AC_MSG_CHECKING(that the GDBM library is available)
250if test ! -z "$gdbmdir" ; then
251  # look in given directory for header file
252  if test -r $gdbmdir/include/gdbm.h ; then
253    GDBM_INCLUDE="-I$gdbmdir/include" ;
254  elif test -r $gdbmdir/gdbm.h ; then
255    GDBM_INCLUDE="-I$gdbmdir" ;
256  fi
257
258  # look in given directory for library
259  if test -r $gdbmdir/libgdbm.a ; then
260    GDBM_LIBPATH="-L$gdbmdir" ;
261  elif test -r $gdbmdir/lib/libgdbm.a ; then
262    GDBM_LIBPATH="-L$gdbmdir/lib" ;
263  elif test -r $gdbmdir/.libs/libgdbm.a ; then
264    GDBM_LIBPATH="-L$gdbmdir/.libs" ;
265  fi
266
267  if test ! -z "$GDBM_LIBPATH" -a ! -z "$GDBM_INCLUDE" ; then
268    AC_MSG_RESULT($gdbmdir) ;
269  else
270    AC_MSG_RESULT(can't find gdbm.h and libgdbm.a in $gdbmdir);
271    AC_MSG_CHECKING(   looking for GDBM library in default locations)
272  fi
273fi
274
275# look in default path and in /usr/local
276if test -z "$GDBM_INCLUDE" ; then
277  # try in system directory
278  AC_TRY_COMPILE(
279  [#include <gdbm.h>
280],
281  [],
282  success=yes,
283  success=no
284  )
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
306  AC_MSG_RESULT($success)
307  if test $success = "no"; then
308  AC_MSG_ERROR(GDBM Library not available - cannot install)
309  fi
310fi
311dnl I don't think anything actually checks this define, but...
312AC_DEFINE(HAVE_LIBGDBM , 1)
313
314AC_SUBST(GDBM_LIBPATH)
315AC_SUBST(GDBM_INCLUDE)
316
317dnl
318dnl Now check that Perl is actually around, and can be found
319dnl
320AC_MSG_CHECKING(that Perl 5 is available)
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
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")
398AC_MSG_ERROR("STL Broken - Obtain newer version of GNU C Compiler")
399fi
400
401gsdlos=`uname | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
402# check for running bash under cygwin
403 if test "`echo $gsdlos | sed 's/cygwin//'`" != "$gsdlos" ;
404 then
405  gsdlos=windows
406 fi
407AC_SUBST(gsdlos)
408
409# check for endianness
410AC_C_BIGENDIAN
411# ---------------------------------------------------------------------------
412if test "$ac_cv_func_alloca" = 'no'; then
413dnl    support functions for alloca.c
414  AC_LIBOBJ([xmalloc.o])
415  AC_LIBOBJ([error])
416fi
417
418# ---------------------------------------------------------------------------
419
420dnl
421dnl Locate all children of the modules folder
422dnl
423moduleDirs=""
424MODULEDIRS=""
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
434    fi
435  done
436  echo "Making $moduleDirs in modules directory"
437  AC_SUBST(MODULEDIRS)
438fi
439
440
441# ---------------------------------------------------------------------------
442dnl for Darwin, as our packages don't (yet) correctly guess our system type.
443dnl not needed any more?
444dnl ac_configure_args="$ac_configure_args --build=$build --target=$target"
445
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
451# the list of folders in the src folder
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"
454
455AC_OUTPUT(packages/Makefile lib/Makefile Makefile $srclist $moduleDirs)
456
457
Note: See TracBrowser for help on using the browser.