source: main/trunk/greenstone2/configure.in@ 23356

Last change on this file since 23356 was 23356, checked in by sjm84, 13 years ago

Updated several configure scripts and Makefiles to make use of the JAVA, JAVAC and JAVACFLAGS environment variables, also added a --disable-java option to several of the configure scripts

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