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

Revision 21446, 12.1 KB (checked in by ak19, 10 years ago)

Configure files updated to correctly set all the variables that can be ENABLED/DISABLED.

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