source: main/tags/2.51-jcdl/gsdl/configure.in@ 25200

Last change on this file since 25200 was 3705, checked in by jrm21, 21 years ago

Added a test for gettext functions to define ENABLE_NLS, even though we
hardly use them, but otherwise too many #defines get in each other's way
and create parse errors.

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