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

Revision 21377, 11.1 KB (checked in by ak19, 10 years ago)

Now the configure, configure.in, Makefile.in and config.h.in of gs2build and greenstone2 are the same, so that they can just be obtained from one source in future.

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