source: main/trunk/gs2build/configure.in@ 32508

Last change on this file since 32508 was 28328, checked in by ak19, 11 years ago

Repeating the changes made to greenstone configure files in gs2build and build-src configure files. Updating configure for mac (leopard), which only likes if stmts that use test and not the square brackets

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