cvs: Rebuild without gnuregex library
[dragonfly.git] / gnu / lib / libregex / configure
CommitLineData
984263bc
MD
1#!/bin/sh
2# Guess values for system-dependent variables and create Makefiles.
3# Generated automatically using autoconf.
4# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
5
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
21# [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
22# Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
23# --with-PACKAGE unless this script has special code to handle it.
24
25
26for arg
27do
28 # Handle --exec-prefix with a space before the argument.
29 if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
30 # Handle --host with a space before the argument.
31 elif test x$next_host = xyes; then next_host=
32 # Handle --prefix with a space before the argument.
33 elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
34 # Handle --srcdir with a space before the argument.
35 elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
36 else
37 case $arg in
38 # For backward compatibility, also recognize exact --exec_prefix.
39 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
40 exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
41 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
42 next_exec_prefix=yes ;;
43
44 -gas | --gas | --ga | --g) ;;
45
46 -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
47 -host | --host | --hos | --ho | --h)
48 next_host=yes ;;
49
50 -nfp | --nfp | --nf) ;;
51
52 -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
53 no_create=1 ;;
54
55 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
56 prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
57 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
58 next_prefix=yes ;;
59
60 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
61 srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
62 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
63 next_srcdir=yes ;;
64
65 -with-* | --with-*)
66 package=`echo $arg|sed 's/-*with-//'`
67 # Delete all the valid chars; see if any are left.
68 if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
69 echo "configure: $package: invalid package name" >&2; exit 1
70 fi
71 eval "with_`echo $package|sed s/-/_/g`=1" ;;
72
73 *) ;;
74 esac
75 fi
76done
77
78trap 'rm -f conftest* core; exit 1' 1 3 15
79
80rm -f conftest*
81compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
82
83# A filename unique to this package, relative to the directory that
84# configure is in, which we can look for to find out if srcdir is correct.
85unique_file=regex.c
86
87# Find the source files, if location was not specified.
88if test -z "$srcdir"; then
89 srcdirdefaulted=yes
90 # Try the directory containing this script, then `..'.
91 prog=$0
92 confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
93 test "X$confdir" = "X$prog" && confdir=.
94 srcdir=$confdir
95 if test ! -r $srcdir/$unique_file; then
96 srcdir=..
97 fi
98fi
99if test ! -r $srcdir/$unique_file; then
100 if test x$srcdirdefaulted = xyes; then
101 echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
102 else
103 echo "configure: Can not find sources in \`${srcdir}'." 1>&2
104 fi
105 exit 1
106fi
107# Preserve a srcdir of `.' to avoid automounter screwups with pwd.
108# But we can't avoid them for `..', to make subdirectories work.
109case $srcdir in
110 .|/*|~*) ;;
111 *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
112esac
113
114
115if test -z "$CC"; then
116 echo checking for gcc
117 saveifs="$IFS"; IFS="${IFS}:"
118 for dir in $PATH; do
119 test -z "$dir" && dir=.
120 if test -f $dir/gcc; then
121 CC="gcc"
122 break
123 fi
124 done
125 IFS="$saveifs"
126fi
127test -z "$CC" && CC="cc"
128
129# Find out if we are using GNU C, under whatever name.
130cat > conftest.c <<EOF
131#ifdef __GNUC__
132 yes
133#endif
134EOF
135${CC-cc} -E conftest.c > conftest.out 2>&1
136if egrep yes conftest.out >/dev/null 2>&1; then
137 GCC=1 # For later tests.
138fi
139rm -f conftest*
140
141# Make sure to not get the incompatible SysV /etc/install and
142# /usr/sbin/install, which might be in PATH before a BSD-like install,
143# or the SunOS /usr/etc/install directory, or the AIX /bin/install,
144# or the AFS install, which mishandles nonexistent args. (Sigh.)
145if test -z "$INSTALL"; then
146 echo checking for install
147 saveifs="$IFS"; IFS="${IFS}:"
148 for dir in $PATH; do
149 test -z "$dir" && dir=.
150 case $dir in
151 /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
152 *)
153 if test -f $dir/install; then
154 if grep dspmsg $dir/install >/dev/null 2>&1; then
155 : # AIX
156 else
157 INSTALL="$dir/install -c"
158 INSTALL_PROGRAM='$(INSTALL)'
159 INSTALL_DATA='$(INSTALL) -m 644'
160 break
161 fi
162 fi
163 ;;
164 esac
165 done
166 IFS="$saveifs"
167fi
168INSTALL=${INSTALL-cp}
169INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
170INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
171
172
173echo checking for AIX
174echo checking how to run the C preprocessor
175if test -z "$CPP"; then
176 CPP='${CC-cc} -E'
177 cat > conftest.c <<EOF
178#include <stdio.h>
179EOF
180err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
181if test -z "$err"; then
182 :
183else
184 CPP=/lib/cpp
185fi
186rm -f conftest*
187fi
188
189cat > conftest.c <<EOF
190#ifdef _AIX
191 yes
192#endif
193
194EOF
195eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
196if egrep "yes" conftest.out >/dev/null 2>&1; then
197 DEFS="$DEFS -D_ALL_SOURCE=1"
198fi
199rm -f conftest*
200
201
202echo checking for DYNIX/ptx libseq
203cat > conftest.c <<EOF
204#if defined(_SEQUENT_)
205 yes
206#endif
207
208EOF
209eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
210if egrep "yes" conftest.out >/dev/null 2>&1; then
211 SEQUENT=1
212fi
213rm -f conftest*
214
215test -n "$SEQUENT" && test -f /usr/lib/libseq.a &&
216 LIBS="$LIBS -lseq"
217
218echo checking for POSIXized ISC
219if test -d /etc/conf/kconfig.d &&
220 grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
221then
222 ISC=1 # If later tests want to check for ISC.
223 DEFS="$DEFS -D_POSIX_SOURCE=1"
224 if test -n "$GCC"; then
225 CC="$CC -posix"
226 else
227 CC="$CC -Xp"
228 fi
229fi
230
231echo checking for minix/config.h
232cat > conftest.c <<EOF
233#include <minix/config.h>
234EOF
235err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
236if test -z "$err"; then
237 MINIX=1
238fi
239rm -f conftest*
240
241# The Minix shell can't assign to the same variable on the same line!
242if test -n "$MINIX"; then
243 DEFS="$DEFS -D_POSIX_SOURCE=1"
244 DEFS="$DEFS -D_POSIX_1_SOURCE=2"
245 DEFS="$DEFS -D_MINIX=1"
246fi
247
248
249echo checking for ANSI C header files
250cat > conftest.c <<EOF
251#include <stdlib.h>
252#include <stdarg.h>
253#include <string.h>
254#include <float.h>
255EOF
256err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
257if test -z "$err"; then
258 # SunOS string.h does not declare mem*, contrary to ANSI.
259echo '#include <string.h>' > conftest.c
260eval "$CPP $DEFS conftest.c > conftest.out 2>&1"
261if egrep "memchr" conftest.out >/dev/null 2>&1; then
262 # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
263cat > conftest.c <<EOF
264#include <ctype.h>
265#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
266#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
267#define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
268int main () { int i; for (i = 0; i < 256; i++)
269if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
270exit (0); }
271
272EOF
273eval $compile
274if test -s conftest && (./conftest; exit) 2>/dev/null; then
275 DEFS="$DEFS -DSTDC_HEADERS=1"
276fi
277rm -f conftest*
278fi
279rm -f conftest*
280
281fi
282rm -f conftest*
283
284for hdr in string.h
285do
286trhdr=HAVE_`echo $hdr | tr '[a-z]./' '[A-Z]__'`
287echo checking for ${hdr}
288cat > conftest.c <<EOF
289#include <${hdr}>
290EOF
291err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
292if test -z "$err"; then
293 DEFS="$DEFS -D${trhdr}=1"
294fi
295rm -f conftest*
296done
297
298
299# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
300# for constant arguments. Useless!
301echo checking for working alloca.h
302cat > conftest.c <<EOF
303#include <alloca.h>
304main() { exit(0); }
305t() { char *p = alloca(2 * sizeof(int)); }
306EOF
307if eval $compile; then
308 DEFS="$DEFS -DHAVE_ALLOCA_H=1"
309fi
310rm -f conftest*
311
312decl="#ifdef __GNUC__
313#define alloca __builtin_alloca
314#else
315#if HAVE_ALLOCA_H
316#include <alloca.h>
317#else
318#ifdef _AIX
319 #pragma alloca
320#else
321char *alloca ();
322#endif
323#endif
324#endif
325"
326echo checking for alloca
327cat > conftest.c <<EOF
328$decl
329main() { exit(0); }
330t() { char *p = (char *) alloca(1); }
331EOF
332if eval $compile; then
333 :
334else
335 alloca_missing=1
336fi
337rm -f conftest*
338
339if test -n "$alloca_missing"; then
340 # The SVR3 libPW and SVR4 libucb both contain incompatible functions
341 # that cause trouble. Some versions do not even contain alloca or
342 # contain a buggy version. If you still want to use their alloca,
343 # use ar to extract alloca.o from them instead of compiling alloca.c.
344 ALLOCA=alloca.o
345fi
346
347prog='/* Ultrix mips cc rejects this. */
348typedef int charset[2]; const charset x;
349/* SunOS 4.1.1 cc rejects this. */
350char const *const *p;
351char **p2;
352/* HPUX 7.0 cc rejects these. */
353++p;
354p2 = (char const* const*) p;'
355echo checking for working const
356cat > conftest.c <<EOF
357
358main() { exit(0); }
359t() { $prog }
360EOF
361if eval $compile; then
362 :
363else
364 DEFS="$DEFS -Dconst="
365fi
366rm -f conftest*
367
368
369if test -z "$prefix"
370then
371 echo checking for gcc to derive installation directory prefix
372 saveifs="$IFS"; IFS="$IFS:"
373 for dir in $PATH; do
374 test -z "$dir" && dir=.
375 if test $dir != . && test -f $dir/gcc; then
376 # Not all systems have dirname.
377 prefix=`echo $dir|sed 's%/[^/][^/]*$%%'`
378 break
379 fi
380 done
381 IFS="$saveifs"
382fi
383
384
385if test -n "$prefix"; then
386 test -z "$exec_prefix" && exec_prefix='${prefix}'
387 prsub="s%^prefix\\([ ]*\\)=\\([ ]*\\).*$%prefix\\1=\\2$prefix%"
388fi
389if test -n "$exec_prefix"; then
390 prsub="$prsub
391s%^exec_prefix\\([ ]*\\)=\\([ ]*\\).*$%\
392exec_prefix\\1=\\2$exec_prefix%"
393fi
394
395trap 'rm -f config.status; exit 1' 1 3 15
396echo creating config.status
397rm -f config.status
398cat > config.status <<EOF
399#!/bin/sh
400# Generated automatically by configure.
401# Run this file to recreate the current configuration.
402# This directory was configured as follows,
403# on host `(hostname || uname -n) 2>/dev/null`:
404#
405# $0 $*
406
407for arg
408do
409 case "\$arg" in
410 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
411 exec /bin/sh $0 $* ;;
412 *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
413 esac
414done
415
416trap 'rm -f Makefile doc/Makefile test/Makefile; exit 1' 1 3 15
417CC='$CC'
418INSTALL='$INSTALL'
419INSTALL_PROGRAM='$INSTALL_PROGRAM'
420INSTALL_DATA='$INSTALL_DATA'
421CPP='$CPP'
422ALLOCA='$ALLOCA'
423LIBS='$LIBS'
424srcdir='$srcdir'
425DEFS='$DEFS'
426prefix='$prefix'
427exec_prefix='$exec_prefix'
428prsub='$prsub'
429EOF
430cat >> config.status <<\EOF
431
432top_srcdir=$srcdir
433for file in .. Makefile doc/Makefile test/Makefile; do if [ "x$file" != "x.." ]; then
434 srcdir=$top_srcdir
435 # Remove last slash and all that follows it. Not all systems have dirname.
436 dir=`echo $file|sed 's%/[^/][^/]*$%%'`
437 if test "$dir" != "$file"; then
438 test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
439 test ! -d $dir && mkdir $dir
440 fi
441 echo creating $file
442 rm -f $file
443 echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
444 sed -e "
445$prsub
446s%@CC@%$CC%g
447s%@INSTALL@%$INSTALL%g
448s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
449s%@INSTALL_DATA@%$INSTALL_DATA%g
450s%@CPP@%$CPP%g
451s%@ALLOCA@%$ALLOCA%g
452s%@LIBS@%$LIBS%g
453s%@srcdir@%$srcdir%g
454s%@DEFS@%$DEFS%
455" $top_srcdir/${file}.in >> $file
456fi; done
457
458exit 0
459EOF
460chmod +x config.status
461test -n "$no_create" || ./config.status
462