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

Last change on this file since 14151 was 13731, checked in by kjdon, 17 years ago

changes to use new indexers repository and not mg/mgpp from gs2

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