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