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