source: main/tags/3.01-src/gs2build-extra/configure.in@ 33217

Last change on this file since 33217 was 10854, checked in by kjdon, 18 years ago

removed soem commented out pieces, and added a check for endianness

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