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

Revision 22378, 12.3 KB (checked in by sjm84, 10 years ago)

Greenstone 2 now compiles and installs on 64-bit linux machines

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