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