]> andersk Git - splint.git/blob - configure
Initial revision
[splint.git] / configure
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
26 for arg
27 do
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      -v | -verbose | --verbose | --verbos | --verbo | --verb | --ver | --ve | --v)
74        verbose=yes ;;
75
76      *) ;;
77     esac
78   fi
79 done
80
81 trap 'rm -f conftest* core; exit 1' 1 3 15
82
83 # Needed for some versions of `tr' so that character classes in `[]' work.
84 if test "${LANG+set}" = "set" ; then
85    LANG=C
86    LC_ALL=C
87    export LANG LC_ALL
88 fi
89
90 rm -f conftest*
91 compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
92
93 # A filename unique to this package, relative to the directory that
94 # configure is in, which we can look for to find out if srcdir is correct.
95 unique_file=Makefile.in
96
97 # Find the source files, if location was not specified.
98 if test -z "$srcdir"; then
99   srcdirdefaulted=yes
100   # Try the directory containing this script, then `..'.
101   prog=$0
102   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
103   test "X$confdir" = "X$prog" && confdir=.
104   srcdir=$confdir
105   if test ! -r $srcdir/$unique_file; then
106     srcdir=..
107   fi
108 fi
109 if test ! -r $srcdir/$unique_file; then
110   if test x$srcdirdefaulted = xyes; then
111     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
112   else
113     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
114   fi
115   exit 1
116 fi
117
118 # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
119 # But we can't avoid them for `..', to make subdirectories work.
120 case $srcdir in
121   .|/*|~*) ;;
122   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
123 esac
124
125 if test -z "$CC"; then
126   # Extract the first word of `gcc', so it can be a program name with args.
127   set dummy gcc; word=$2
128   echo checking for $word
129   IFS="${IFS=   }"; saveifs="$IFS"; IFS="${IFS}:"
130   for dir in $PATH; do
131     test -z "$dir" && dir=.
132     if test -f $dir/$word; then
133       CC="gcc"
134       break
135     fi
136   done
137   IFS="$saveifs"
138 fi
139 test -z "$CC" && CC="cc"
140 test -n "$CC" -a -n "$verbose" && echo "        setting CC to $CC"
141
142 # Find out if we are using GNU C, under whatever name.
143 cat > conftest.c <<EOF
144 #ifdef __GNUC__
145   yes
146 #endif
147 EOF
148 ${CC-cc} -E conftest.c > conftest.out 2>&1
149 if egrep yes conftest.out >/dev/null 2>&1; then
150   GCC=1 # For later tests.
151   CFLAGS="${CFLAGS--O}"
152 fi
153 rm -f conftest*
154
155 if test -z "$BISON"; then
156   echo checking for bison
157   IFS="${IFS=   }"; saveifs="$IFS"; IFS="${IFS}:"
158   for dir in $PATH; do
159     test -z "$dir" && dir=.
160     if test -f $dir/bison; then
161       BISON=$dir/bison
162       break
163     fi
164   done
165   IFS="$saveifs"
166 fi
167
168 test -n "$BISON" -a -n "$verbose" && echo "     setting BISON to $BISON"
169
170 if test -z "$FLEX"; then
171   echo checking for flex
172   IFS="${IFS=   }"; saveifs="$IFS"; IFS="${IFS}:"
173   for dir in $PATH; do
174     test -z "$dir" && dir=.
175     if test -f $dir/flex; then
176       FLEX=$dir/flex
177       break
178     fi
179   done
180   IFS="$saveifs"
181 fi
182
183 test -n "$FLEX" -a -n "$verbose" && echo "      setting FLEX to $FLEX"
184
185 echo checking how to run the C preprocessor
186 if test -z "$CPP"; then
187   CPP='gcc -E'
188   cat > conftest.c <<EOF
189 #include <stdio.h>
190 EOF
191 err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
192 if test -z "$err"; then
193   :
194 else
195   CPP=/lib/cpp
196 fi
197 rm -f conftest*
198 fi
199
200 echo 'checking if pre-processor defined __STDC__'
201 echo '# ifndef __STDC__' > conftest.c
202 echo '# error "No STDC"' >> conftest.c
203 echo 'int main (void) { exit (0); }' >> conftest.c
204 eval "$CPP conftest.c > conftest.out 2>&1"
205 if egrep "No STDC" conftest.out >/dev/null 2>&1; then
206   test -n "$verbose" && echo '        __STDC__ not defined'
207   DEFS="$DEFS -DNEED_STDC"
208 fi
209
210 echo 'checking for optimization levels'
211 echo 'int main (void) { exit (0); }' > conftest.c
212 eval "$CC -O -o conftest conftest.c > conftest.out 2>&1"
213 if egrep "O" conftest.out >/dev/null 2>&1; then
214   test -n "$verbose" && echo '        No optimization flags found'
215   OPT=''
216 else
217   eval "$CC -O2 -o conftest conftest.c > conftest.out 2>&1"
218   if egrep "O2" conftest.out >/dev/null 2>&1; then
219     test -n "$verbose" && echo '        Optimization: -O'
220     OPT='-O'
221   else
222     eval "$CC -O3 -o conftest conftest.c > conftest.out 2>&1"
223     if egrep "O3" conftest.out >/dev/null 2>&1; then
224       test -n "$verbose" && echo '        Optimization: -O2'
225       OPT='-O2'
226       else
227          if egrep "O4" conftest.out >/dev/null 2>&1; then
228            test -n "$verbose" && echo '        Optimization: -O3'
229            OPT='-O2'
230          else
231            test -n "$verbose" && echo '        Optimization: -O4'
232            OPT='-O2'
233 # bug in gcc makes -O3 and -O4 bad - bug in compiling parser
234          fi
235       fi
236    fi 
237 fi
238 rm -f conftest*
239
240 # Make sure to not get the incompatible SysV /etc/install and
241 # /usr/sbin/install, which might be in PATH before a BSD-like install,
242 # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
243 # or the AFS install, which mishandles nonexistent args, or
244 # /usr/ucb/install on SVR4, which tries to use the nonexistent group
245 # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
246 # anyway.  Sigh.
247 if test "z${INSTALL}" = "z" ; then
248   echo checking for install
249   IFS="${IFS=   }"; saveifs="$IFS"; IFS="${IFS}:"
250   for dir in $PATH; do
251     test -z "$dir" && dir=.
252     case $dir in
253     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
254     *)
255       if test -f $dir/installbsd; then
256         INSTALL="$dir/installbsd -c" # OSF1
257         INSTALL_PROGRAM='$(INSTALL)'
258         INSTALL_DATA='$(INSTALL) -m 644'
259         break
260       fi
261       if test -f $dir/install; then
262         if grep dspmsg $dir/install >/dev/null 2>&1; then
263           : # AIX
264         else
265           INSTALL="$dir/install -c"
266           INSTALL_PROGRAM='$(INSTALL)'
267           INSTALL_DATA='$(INSTALL) -m 644'
268           break
269         fi
270       fi
271       ;;
272     esac
273   done
274   IFS="$saveifs"
275 fi
276 INSTALL=${INSTALL-cp}
277 INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
278 INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
279
280 echo checking for ANSI C header files
281 cat > conftest.c <<EOF
282 #include <stdlib.h>
283 #include <stdarg.h>
284 #include <string.h>
285 #include <float.h>
286 EOF
287 err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
288 if test -z "$err"; then
289   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
290 echo '#include <string.h>' > conftest.c
291 eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
292 if egrep "memchr" conftest.out >/dev/null 2>&1; then
293   # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
294 cat > conftest.c <<EOF
295 #include <ctype.h>
296 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
297 #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
298 #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
299 int main () { int i; for (i = 0; i < 256; i++)
300 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
301 exit (0); }
302
303 EOF
304 eval $compile
305 if test -s conftest && (./conftest; exit) 2>/dev/null; then
306   {
307 test -n "$verbose" && \
308 echo '  defining' STDC_HEADERS
309 DEFS="$DEFS -DSTDC_HEADERS=1"
310 }
311
312 fi
313 rm -f conftest*
314 fi
315 rm -f conftest*
316
317 fi
318 rm -f conftest*
319
320 echo checking for stdarg.h
321 cat > conftest.c <<EOF
322 #include <stdarg.h>
323 EOF
324 err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
325 if test -z "$err"; then
326   USEVARARGS=0 :
327 else
328   {
329 test -n "$verbose" && \
330 echo '  defining' USEVARARGS
331 DEFS="$DEFS -DUSEVARARGS=1"
332 USEVARARGS=1
333 }
334 fi
335
336 echo checking for string.h
337 cat > conftest.c <<EOF
338 #include <string.h>
339 EOF
340 err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
341 if test -z "$err"; then
342   :
343 else
344   {
345 test -n "$verbose" && \
346 echo '  defining' NO_STRING_H
347 DEFS="$DEFS -DNO_STRING_H=1"
348 }
349
350 fi
351 rm -f conftest*
352
353 echo checking for stdlib.h
354 cat > conftest.c <<EOF
355 #include <stdlib.h>
356 EOF
357 err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
358 if test -z "$err"; then
359   :
360 else
361   {
362 test -n "$verbose" && \
363 echo '  defining' NO_STDLIB_H
364 DEFS="$DEFS -DNO_STDLIB_H=1"
365 }
366
367 fi
368 rm -f conftest*
369
370 echo checking for size_t in sys/types.h
371 echo '#include <sys/types.h>' > conftest.c
372 eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
373 if egrep "size_t" conftest.out >/dev/null 2>&1; then
374   :
375 else
376   {
377 test -n "$verbose" && \
378 echo '  defining' size_t to be 'unsigned'
379 DEFS="$DEFS -Dsize_t=unsigned"
380 }
381
382 fi
383 rm -f conftest*
384
385 echo '#include <sys/types.h>' > conftest.c
386 eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
387 if egrep "off_t" conftest.out >/dev/null 2>&1; then
388   :
389 else
390   {
391 test -n "$verbose" && \
392 echo '  defining' NO_OFF_T
393 DEFS="$DEFS -DNO_OFF_T=1"
394 }
395 fi
396
397 echo checking for EXIT_SUCCESS
398 cat > conftest.c <<EOF
399 # include <stdlib.h>
400 int main (void) { return EXIT_SUCCESS; }
401 EOF
402 err=`eval "($CC -c \$DEFS conftest.c >/dev/null) 2>&1"`
403 if test -z "$err"; then
404   :
405 else
406   {
407 test -n "$verbose" && \
408 echo '  no EXIT_SUCCESS' 
409 DEFS="$DEFS -DEXIT_SUCCESS=0"
410 }
411 fi
412
413 echo checking for EXIT_FAILURE
414 cat > conftest.c <<EOF
415 # include <stdlib.h>
416 int main (void) { return EXIT_FAILURE; }
417 EOF
418 err=`eval "($CC -c \$DEFS conftest.c >/dev/null) 2>&1"`
419 if test -z "$err"; then
420   :
421 else
422   {
423 test -n "$verbose" && \
424 echo '  no EXIT_FAILURE' 
425 DEFS="$DEFS -DEXIT_FAILURE=-1"
426 }
427 fi
428
429 echo checking for -ll
430 echo 'int main (void) { exit (0); }' > conftest.c
431 err=`eval "($CC conftest.c -o conftest -ll >/dev/null) 2>&1"`
432 if test -z "$err"; then
433 LINKLEX="-ll"
434 else
435 echo '  No -ll...trying -lfl'
436 err=`eval "($CC conftest.c -o conftest -lfl >/dev/null) 2>&1"`
437 if test -z "$err"; then
438 echo 'Okay!'
439 LINKLEX="-lfl"
440 else
441 echo '*** No lex or flex library found.  Must have -ll or -lfl to build lclint.'
442 echo '*** If this is installed on your system, try editing the configure
443 script to use the correct flags to locate this file.'
444 fi
445 fi
446 rm -f conftest*
447
448 if test -z "$cwdir"
449   then
450   cwdir=`pwd`
451   echo setting current directory to $cwdir
452   fi
453
454 if test -z "$prefix"
455 then
456   prefix=$cwdir
457   echo "        chose installation directory prefix ${prefix}"
458   echo "        will install binaries in ${prefix}/bin"
459   echo "        will install libraries in ${prefix}/lib"
460   echo "        will install imports in ${prefix}/imports"
461   echo "        will install emacs files in ${prefix}/emacs"
462   echo "        edit Makefile to change installation directories"
463 fi
464
465 if test -z "$G" -a -n "$prefix" -a -f $prefix/bin/gznew; then
466   G=g
467 fi
468 if test -z "$ZCAT"; then
469   if test -n "$prefix" -a -f $prefix/bin/gzcat; then
470     ZCAT=gzcat
471   else
472     ZCAT=${G}zcat
473   fi
474 fi
475 if test -n "$prefix"; then
476   test -z "$exec_prefix" && exec_prefix='${prefix}'
477   prsub="s%^prefix\\([  ]*\\)=\\([      ]*\\).*$%prefix\\1=\\2$prefix%"
478 fi
479 if test -n "$exec_prefix"; then
480   prsub="$prsub
481 s%^exec_prefix\\([      ]*\\)=\\([      ]*\\).*$%\
482 exec_prefix\\1=\\2$exec_prefix%"
483 fi
484 cat >conftest.def <<EOF
485 $DEFS
486 EOF
487 escape_ampersand_and_backslash='s%[&\\]%\\&%g'
488 DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
489 rm -f conftest.def
490
491 trap 'rm -f config.status; exit 1' 1 3 15
492 echo creating config.status
493 rm -f config.status
494 cat > config.status <<EOF
495 #!/bin/sh
496 # Generated automatically by configure.
497 # Run this file to recreate the current configuration.
498 # This directory was configured as follows,
499 # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
500 #
501 # $0 $*
502
503 for arg
504 do
505   case "\$arg" in
506     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
507     exec /bin/sh $0 $* ;;
508     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
509   esac
510 done
511
512 trap 'rm -f Makefile; exit 1' 1 3 15
513 CC='$CC'
514 CPP='$CPP'
515 OPT='$OPT'
516 cwdir='$cwdir'
517 INSTALL='$INSTALL'
518 INSTALL_PROGRAM='$INSTALL_PROGRAM'
519 INSTALL_DATA='$INSTALL_DATA'
520 BISON='$BISON'
521 FLEX='$FLEX'
522 ZCAT='$ZCAT'
523 LINKLEX='$LINKLEX'
524 G='$G'
525 CFLAGS='$CFLAGS'
526 ASCPP='$ASCPP'
527 OBJA='$OBJA'
528 SEDCMD='$SEDCMD'
529 LIBS='$LIBS'
530 srcdir='$srcdir'
531 DEFS='$DEFS'
532 prefix='$prefix'
533 installdir='$prefix'
534 exec_prefix='$exec_prefix'
535 prsub='$prsub'
536 EOF
537 cat >> config.status <<\EOF
538
539 top_srcdir=$srcdir
540
541 # Allow make-time overrides of the generated file list.
542 test -n "$gen_files" || gen_files="Makefile"
543
544 for file in .. $gen_files; do if [ "x$file" != "x.." ]; then
545   srcdir=$top_srcdir
546   # Remove last slash and all that follows it.  Not all systems have dirname.
547   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
548   if test "$dir" != "$file"; then
549     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
550     test ! -d $dir && mkdir $dir
551   fi
552   echo creating $file
553   rm -f $file
554   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
555   sed -e "
556 $prsub
557 s%@CC@%$CC%g
558 s%@CPP@%$CPP%g
559 s%@OPT@%$OPT%g
560 s%@LINKLEX@%$LINKLEX%g
561 s%@BISON@%$BISON%g
562 s%@FLEX@%$FLEX%g
563 s%@cwdir@%$cwdir%g
564 s%@installdir@%$installdir%g
565 s%@INSTALL@%$INSTALL%g
566 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
567 s%@INSTALL_DATA@%$INSTALL_DATA%g
568 s%@ZCAT@%$ZCAT%g
569 s%@G@%$G%g
570 s%@CFLAGS@%$CFLAGS%g
571 s%@OBJA@%$OBJA%g
572 s%@SEDCMD@%$SEDCMD%g
573 s%@LIBS@%$LIBS%g
574 s%@srcdir@%$srcdir%g
575 s%@DEFS@%$DEFS%
576 " $top_srcdir/${file}.in >> $file
577 fi; done
578
579 exit 0
580 EOF
581 chmod +x config.status
582 test -n "$no_create" || ./config.status
583
This page took 0.222856 seconds and 5 git commands to generate.