source: other-projects/trunk/gs2build-extra/configure.in@ 16299

Last change on this file since 16299 was 16261, checked in by ak19, 16 years ago

Dr Bainbridge: Minor tweaks to bring GS3's gs2build compilation files up to date with changes in file structure. Also ran 'autoupdate' on configure.in in an attempt to update a couple of macros that now no longer seem valid (e.g. fp_WITH_DMALLOC). This had the effect of updating some parts on configure.in to newer syntax, but not the offending two macros. These still cause warning messages to be generated with ./configure is run.

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