root/main/trunk/greenstone2/configure.in @ 21432

Revision 21432, 11.7 KB (checked in by davidb, 10 years ago)

Update to use of -m32, which is activated when compiling on a 64-bit machine. The requirement for needing to using -m32 is mg and mg++ (which currently only work with 32-bit sized data-types). If both --disable-mg and --disable-mgpp are specified this means that we don't need to use -m32. Configure files updated to detect this and 'cancel' the -m32 flag.

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