source: gsdl/trunk/common-src/configure.in@ 16593

Last change on this file since 16593 was 16593, checked in by oranfry, 16 years ago

In configure.in [ -d module] changed to test -d module to fix loss of [ ] in configure problem

  • Property svn:executable set to *
File size: 10.7 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(src/lib/text_t.h)
5AC_CONFIG_HEADER(config.h)
6
7
8
9
10PACKAGE=gsdl
11VERSION=2.82-svn
12AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
13AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
14AC_SUBST(PACKAGE)
15AC_SUBST(VERSION)
16
17dnl
18dnl Set use of fast cgi
19dnl
20USE_FASTCGI=0
21if test USE_FASTCGI = 1; then
22AC_DEFINE(USE_FASTCGI)
23AC_SUBST(USE_FASTCGI)
24fi
25
26dnl
27dnl Set use of langaction
28dnl
29dnl USE_LANGACTION=0
30if test USE_LANGACTION = 1; then
31AC_DEFINE(USE_LANGACTION)
32AC_SUBST(USE_LANGACTION)
33fi
34
35dnl
36dnl Set use of corba
37dnl
38AC_ARG_ENABLE(corba, [ --enable-corba Enable CORBA support], USE_CORBA=1, USE_CORBA=0)
39AC_DEFINE_UNQUOTED(USE_CORBA, $USE_CORBA)
40AC_SUBST(USE_CORBA)
41
42AC_ARG_WITH(micodir, [ --with-micodir Use installed MICO directory], MICO_DIR=$enableval, MICO_DIR="default")
43AC_DEFINE_UNQUOTED(MICO_DIR, "$MICO_DIR")
44AC_SUBST(MICO_DIR)
45
46dnl
47dnl Set use of z39.50
48dnl
49AC_ARG_ENABLE(z3950, [ --enable-z3950 Enable Z39.50 client support], USE_Z3950=1, USE_Z3950=0)
50if test USE_Z3950 = 1; then
51AC_DEFINE(USE_Z3950, $USE_Z3950)
52AC_SUBST(USE_Z3950)
53fi
54
55dnl
56dnl Set use of yaz - now compiled by default even when z3950 support not required
57dnl
58AC_ARG_ENABLE(yaz, [ --disable-yaz Disable YAZ compilation], USE_YAZ=0, USE_YAZ=1)
59dnl if test USE_YAZ = 1; then
60AC_DEFINE(USE_YAZ, $USE_YAZ)
61AC_SUBST(USE_YAZ)
62dnl fi
63
64dnl
65dnl look for libgdbm if not in standard location
66dnl
67AC_ARG_WITH(gdbm, [ --with-gdbm=dir Use local gdbm library and headers], gdbmdir=$withval)
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 MGPP], ENABLE_ACCENTFOLD=0, ENABLE_ACCENTFOLD=1)
73AC_DEFINE(ENABLE_ACCENTFOLD, $ENABLE_ACCENTFOLD)
74AC_SUBST(ENABLE_ACCENTFOLD)
75
76dnl
77dnl Set use of SQLite (enabled by default)
78dnl
79AC_ARG_ENABLE(sqlite, [ --disable-sqlite Disable SQLite support], USE_SQLITE=0, USE_SQLITE=1)
80AC_DEFINE(USE_SQLITE, $USE_SQLITE)
81AC_SUBST(USE_SQLITE)
82
83dnl Checks for programs.
84LDFLAGS=$LDFLAGS
85AC_SUBST(LDFLAGS)
86dnl only set CFLAGS if not already set in environment
87if test -z "$CFLAGS"; then
88CFLAGS=-O2
89fi
90AC_SUBST(CFLAGS)
91
92
93AC_PROG_CC
94AC_PROG_CXX
95AC_PROG_AWK
96AC_PROG_YACC
97dnl get $target_cpu, $target_vendor, and $target_os
98dnl (as well as host_*)
99AC_CANONICAL_SYSTEM
100dnl do we actually want this? It adds a prefix based on host, system etc
101dnl AC_ARG_PROGRAM
102AC_PROG_INSTALL
103AC_PROG_LN_S
104AC_PROG_MAKE_SET
105AC_PROG_RANLIB
106
107AC_MSG_CHECKING(to see if architecture is 64-bit)
108arch_64bit=no
109case "$host_cpu" in
110x86_64) arch_64bit=yes ;;
111esac
112
113if test "$arch_64bit" = yes; then
114 AC_MSG_RESULT(yes)
115 if test -z "$COMPAT32BITFLAGS" ; then
116 COMPAT32BITFLAGS="-m32"
117 fi
118else
119 AC_MSG_RESULT(no)
120 if test -z "$COMPAT32BITFLAGS" ; then
121 COMPAT32BITFLAGS=
122 fi
123fi
124export COMPAT32BITFLAGS
125AC_SUBST(COMPAT32BITFLAGS)
126
127
128#moved CORBA MICO directory test to get version of MICO
129if test $USE_CORBA = 1; then
130
131if test $MICO_DIR = "default"; then
132#do something
133MICO_INC="-I packages/mico/mico/include"
134else
135#build the micotest program
136MICO_INC= ""
137if test $MICO_DIR != yes; then
138MICO_INC="-I $MICO_DIR"
139fi
140fi
141
142#get MICO_VER value
143sh -c "$CC -c micotest.cpp -o micotest.o $MICO_INC 2>&1" > /dev/null
144sh -c "$CC -o micotest micotest.o -lstdc++ 2>&1" > /dev/null
145MICO_VER=`./micotest` || MICO_VER=2.3.5
146sh -c "rm micotest"
147sh -c "rm micotest.o"
148
149#do test of MICO_VER
150if test MICO_VER != 0; then
151AC_DEFINE(MICO_VER)
152AC_SUBST(MICO_VER)
153fi
154#end USE_CORBA test
155fi
156
157dnl Checks for typedefs, structures, and compiler characteristics.
158AC_AIX
159AC_ISC_POSIX
160AC_MINIX
161fp_C_PROTOTYPES
162AC_C_CONST
163AC_TYPE_OFF_T
164AC_TYPE_SIZE_T
165AC_HEADER_TIME
166AC_STRUCT_TM
167
168dnl --- This should be in the stdc checking -----------------
169if test "$ac_cv_prog_cc_stdc" = '-Xc'; then
170dnl The Pyramids running SMP_DC.OSx on MIPS r3000 chips with
171dnl /usr/opt/cc3.11/bin/cc treat -Xc as full ANSI mode - no POSIX or
172dnl XOPEN extensions (like popen).
173dnl Unfortunately -D_{XOPEN,POSIX}_SOURCE can't provide all that mg
174dnl needs. So drop back to -Xa
175AC_TRY_COMPILE(
176[#include <stdio.h>
177], [ FILE *rubbish = popen("yes", "r"); ],,
178[CC="`echo $CC | sed 's/-Xc/-Xa/'`" ac_cv_prog_cc_stdc='-Xa'])
179fi
180dnl ----------------------
181
182
183dnl Checks for libraries.
184dnl check for -lg:
185AC_HAVE_LIBRARY(g)
186dnl check for -lm:
187AC_HAVE_LIBRARY(m)
188dnl check for -lcrypt:
189AC_HAVE_LIBRARY(crypt)
190if test $ENABLE_ACCENTFOLD = 1; then
191AC_HAVE_LIBRARY(iconv)
192fi
193
194dnl Checks for header files.
195AC_HEADER_DIRENT
196AC_HEADER_STDC
197AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h crypt.h string.h memory.h sys/procfs.h sys/stat.h)
198AC_EGREP_HEADER(fread, stdio.h, AC_DEFINE(HAVE_FREAD_DECL))
199AC_EGREP_HEADER(fgetc, stdio.h, AC_DEFINE(HAVE_FGETC_DECL))
200AC_EGREP_HEADER(pr_brksize, sys/procfs.h, AC_DEFINE(HAVE_PR_BRKSIZE))
201
202dnl Checks for library functions.
203AC_FUNC_ALLOCA
204AC_PROG_GCC_TRADITIONAL
205AC_TYPE_SIGNAL
206AC_FUNC_VPRINTF
207AC_CHECK_FUNCS(ftime select strftime strtol getrusage times mallinfo setbuffer getpagesize strerror)
208AC_REPLACE_FUNCS(ftruncate strstr strcasecmp)
209
210dnl see if gettext is in libc. (try the textdomain() function).
211AC_CHECK_FUNC(textdomain, AC_DEFINE(ENABLE_NLS ,1) )
212
213# *** Custom checking (based on GNU tar configure.in) ***
214# ---------------------------------------------------------------------------
215AC_MSG_CHECKING(for HP-UX needing gmalloc)
216if test "`(uname -s) 2> /dev/null`" = 'HP-UX'; then
217 AC_MSG_RESULT(yes)
218 AC_LIBOBJ([gmalloc])
219 AC_DEFINE(HAVE_VALLOC)
220else
221 AC_MSG_RESULT(no)
222 AC_CHECK_FUNCS(valloc)
223fi
224
225# we cannot generate static libraries under Darwin
226AC_MSG_CHECKING(for Apple MacOS X/Darwin)
227if test "`(uname -s) 2> /dev/null`" = 'Darwin'; then
228 AC_MSG_RESULT(yes)
229 STATIC=""
230else
231 AC_MSG_RESULT(no)
232 STATIC="-static "
233fi
234AC_SUBST(STATIC)
235
236fp_WITH_DMALLOC
237fp_WITH_REGEX
238
239# ---------------------------------------------------------------------------
240if test "$ac_cv_func_alloca" = 'no'; then
241dnl support functions for alloca.c
242 AC_LIBOBJ([xmalloc])
243 AC_LIBOBJ([error])
244fi
245
246
247# ---------------------------------------------------------------------------
248
249dnl
250dnl Switch into C++
251dnl
252AC_LANG_CPLUSPLUS
253
254dnl
255dnl Check that the GDBM library is available
256dnl
257dnl check libgdbm manually, in case it's not in the standard location.
258
259AC_MSG_CHECKING(that the GDBM library is available)
260if test ! -z "$gdbmdir" ; then
261 # look in given directory for header file
262 if test -r $gdbmdir/include/gdbm.h ; then
263 GDBM_INCLUDE="-I$gdbmdir/include" ;
264 elif test -r $gdbmdir/gdbm.h ; then
265 GDBM_INCLUDE="-I$gdbmdir" ;
266 fi
267
268 # look in given directory for library
269 if test -r $gdbmdir/libgdbm.a ; then
270 GDBM_LIBPATH="-L$gdbmdir" ;
271 elif test -r $gdbmdir/lib/libgdbm.a ; then
272 GDBM_LIBPATH="-L$gdbmdir/lib" ;
273 elif test -r $gdbmdir/.libs/libgdbm.a ; then
274 GDBM_LIBPATH="-L$gdbmdir/.libs" ;
275 fi
276
277 if test ! -z "$GDBM_LIBPATH" -a ! -z "$GDBM_INCLUDE" ; then
278 AC_MSG_RESULT($gdbmdir) ;
279 else
280 AC_MSG_RESULT(can't find gdbm.h and libgdbm.a in $gdbmdir);
281 AC_MSG_CHECKING( looking for GDBM library in default locations)
282 fi
283fi
284
285# look in default path and in /usr/local
286if test -z "$GDBM_INCLUDE" ; then
287 # try in system directory
288 AC_TRY_COMPILE(
289 [#include <gdbm.h>
290],
291 [],
292 success=yes,
293 success=no
294 )
295
296 if test $success = "no"; then
297# last chance - look in /usr/local (eg FreeBSD)
298 GDBM_LIBPATH=-L/usr/local/lib
299 GDBM_INCLUDE=-I/usr/local/include
300 ac_save_CXXFLAGS="$CXXFLAGS"
301 ac_save_LIBS="$LIBS"
302 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
303 LIBS="$LIBS -L/usr/local/lib -lgdbm"
304 AC_TRY_LINK(
305 [#include <gdbm.h>
306#include <stdio.h>
307 ],
308 [printf("%s",gdbm_version);],
309 success=/usr/local,
310 success=no
311 )
312 CXXFLAGS=$ac_save_CXXFLAGS
313 LIBS=$ac_save_LIBS
314 fi
315
316 AC_MSG_RESULT($success)
317 if test $success = "no"; then
318 AC_MSG_ERROR(GDBM Library not available - cannot install)
319 fi
320fi
321dnl I don't think anything actually checks this define, but...
322AC_DEFINE(HAVE_LIBGDBM , 1)
323
324AC_SUBST(GDBM_LIBPATH)
325AC_SUBST(GDBM_INCLUDE)
326
327dnl
328dnl Now check that Perl is actually around, and can be found
329dnl
330AC_MSG_CHECKING(that Perl 5 is available)
331success="no"
332pl_path="$PATH"
333IFS="${IFS= }"; pl_save_ifs="$IFS"; IFS=":"
334for pl_dir in $pl_path; do
335 test -z "$pl_dir" && pl_dir=.
336 if test -x $pl_dir/perl; then
337 success="yes"
338 break
339 fi
340done
341IFS="$pl_save_ifs"
342
343dnl
344dnl Check if the STL library has any known faults;
345dnl In GCC 2.7.2.x series, some STL library headers are missing
346dnl a file called "new" which is referred to by other headers
347dnl (eg. vector/vector.h); if this applies, then all use of the
348dnl STL will cause a compile fail, so we'd better let the user
349dnl know now, before things really go wrong!
350dnl
351success=no
352AC_MSG_CHECKING("whether STL library has known faults")
353
354dnl - first shot, try simple good old vector on its own
355AC_TRY_COMPILE(
356[#include <vector>
357],
358[],
359success=yes,
360)
361
362dnl - try using the .h equivalent
363if test $success = "no"; then
364AC_TRY_COMPILE(
365[#include <vector.h>
366],
367[],
368success="yes",
369)
370fi
371
372dnl - now try for the objectspace headers
373if test $success = "no"; then
374AC_TRY_COMPILE(
375[#include <ospace\\std\\vector>
376],
377[],
378success="yes",
379)
380fi
381
382if test $success = yes; then
383AC_MSG_RESULT("no")
384else
385AC_MSG_RESULT("yes")
386AC_MSG_ERROR("STL Broken - Obtain newer version of GNU C Compiler")
387fi
388
389gsdlos=`uname | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
390# check for running bash under cygwin
391 if test "`echo $gsdlos | sed 's/cygwin//'`" != "$gsdlos" ;
392 then
393 gsdlos=windows
394 fi
395AC_SUBST(gsdlos)
396
397# check for endianness
398AC_C_BIGENDIAN
399# ---------------------------------------------------------------------------
400if test "$ac_cv_func_alloca" = 'no'; then
401dnl support functions for alloca.c
402 AC_LIBOBJ([xmalloc.o])
403 AC_LIBOBJ([error])
404fi
405
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# ---------------------------------------------------------------------------
431
432AC_CONFIG_SUBDIRS(packages indexers)
433
434# the list of folders in the src folder
435srclist="src/lib/Makefile \
436 src/gdbmedit/db2txt/Makefile \
437 src/gdbmedit/txt2db/Makefile \
438 src/gdbmedit/gdbmget/Makefile \
439 src/gdbmedit/gdbmset/Makefile \
440 src/getpw/Makefile"
441
442AC_OUTPUT(packages/Makefile Makefile $srclist $moduleDirs)
443
444
Note: See TracBrowser for help on using the repository browser.