root/main/trunk/gs2runtime/configure.in @ 26341

Revision 21487, 10.4 KB (checked in by davidb, 10 years ago)

Adjustments to bring configure/Makefile logic in to line with main greenstone2 code

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