source: trunk/gsdl/configure.in@ 3130

Last change on this file since 3130 was 3062, checked in by cs025, 22 years ago

Changed configure.in to auto-configure the subdirectories of the
modules folder.

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