root/main/trunk/greenstone2/build-src/configure.in @ 28328

Revision 28328, 12.9 KB (checked in by ak19, 7 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

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