root/main/trunk/greenstone2/runtime-src/configure.in @ 21432

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