]> andersk Git - splint.git/blob - configure
Readded configure
[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 if pre-processor defined __STDC__'
186 echo '# ifndef __STDC__' > conftest.c
187 echo '# error "No STDC"' >> conftest.c
188 echo 'int main (void) { exit (0); }' >> conftest.c
189 eval "$CPP conftest.c > conftest.out 2>&1"
190 if egrep "No STDC" conftest.out >/dev/null 2>&1; then
191   test -n "$verbose" && echo '        __STDC__ not defined'
192   DEFS="$DEFS -DNEED_STDC"
193 fi
194
195 echo 'checking for optimization levels'
196 echo 'int main (void) { exit (0); }' > conftest.c
197 eval "$CC -O -o conftest conftest.c > conftest.out 2>&1"
198 if egrep "O" conftest.out >/dev/null 2>&1; then
199   test -n "$verbose" && echo '        No optimization flags found'
200   OPT=''
201 else
202   eval "$CC -O2 -o conftest conftest.c > conftest.out 2>&1"
203   if egrep "O2" conftest.out >/dev/null 2>&1; then
204     test -n "$verbose" && echo '        Optimization: -O'
205     OPT='-O'
206   else
207     eval "$CC -O3 -o conftest conftest.c > conftest.out 2>&1"
208     if egrep "O3" conftest.out >/dev/null 2>&1; then
209       test -n "$verbose" && echo '        Optimization: -O2'
210       OPT='-O2'
211       else
212          if egrep "O4" conftest.out >/dev/null 2>&1; then
213            test -n "$verbose" && echo '        Optimization: -O3'
214            OPT='-O3'
215          else
216            test -n "$verbose" && echo '        Optimization: -O4'
217            OPT='-O4' 
218          fi
219       fi
220    fi 
221 fi
222 rm -f conftest*
223
224 # Make sure to not get the incompatible SysV /etc/install and
225 # /usr/sbin/install, which might be in PATH before a BSD-like install,
226 # or the SunOS /usr/etc/install directory, or the AIX /bin/install,
227 # or the AFS install, which mishandles nonexistent args, or
228 # /usr/ucb/install on SVR4, which tries to use the nonexistent group
229 # `staff'.  On most BSDish systems install is in /usr/bin, not /usr/ucb
230 # anyway.  Sigh.
231 if test "z${INSTALL}" = "z" ; then
232   echo checking for install
233   IFS="${IFS=   }"; saveifs="$IFS"; IFS="${IFS}:"
234   for dir in $PATH; do
235     test -z "$dir" && dir=.
236     case $dir in
237     /etc|/usr/sbin|/usr/etc|/usr/afsws/bin|/usr/ucb) ;;
238     *)
239       if test -f $dir/installbsd; then
240         INSTALL="$dir/installbsd -c" # OSF1
241         INSTALL_PROGRAM='$(INSTALL)'
242         INSTALL_DATA='$(INSTALL) -m 644'
243         break
244       fi
245       if test -f $dir/install; then
246         if grep dspmsg $dir/install >/dev/null 2>&1; then
247           : # AIX
248         else
249           INSTALL="$dir/install -c"
250           INSTALL_PROGRAM='$(INSTALL)'
251           INSTALL_DATA='$(INSTALL) -m 644'
252           break
253         fi
254       fi
255       ;;
256     esac
257   done
258   IFS="$saveifs"
259 fi
260 INSTALL=${INSTALL-cp}
261 INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
262 INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
263
264 echo checking for ANSI C header files
265 cat > conftest.c <<EOF
266 #include <stdlib.h>
267 #include <stdarg.h>
268 #include <string.h>
269 #include <float.h>
270 EOF
271 err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
272 if test -z "$err"; then
273   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
274 echo '#include <string.h>' > conftest.c
275 eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
276 if egrep "memchr" conftest.out >/dev/null 2>&1; then
277   # SGI's /bin/cc from Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
278 cat > conftest.c <<EOF
279 #include <ctype.h>
280 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
281 #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
282 #define XOR(e,f) (((e) && !(f)) || (!(e) && (f)))
283 int main () { int i; for (i = 0; i < 256; i++)
284 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
285 exit (0); }
286
287 EOF
288 eval $compile
289 if test -s conftest && (./conftest; exit) 2>/dev/null; then
290   {
291 test -n "$verbose" && \
292 echo '  defining' STDC_HEADERS
293 DEFS="$DEFS -DSTDC_HEADERS=1"
294 }
295
296 fi
297 rm -f conftest*
298 fi
299 rm -f conftest*
300
301 fi
302 rm -f conftest*
303
304 echo checking for stdarg.h
305 cat > conftest.c <<EOF
306 #include <stdarg.h>
307 EOF
308 err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
309 if test -z "$err"; then
310   USEVARARGS=0 :
311 else
312   {
313 test -n "$verbose" && \
314 echo '  defining' USEVARARGS
315 DEFS="$DEFS -DUSEVARARGS=1"
316 USEVARARGS=1
317 }
318 fi
319
320 echo checking for string.h
321 cat > conftest.c <<EOF
322 #include <string.h>
323 EOF
324 err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
325 if test -z "$err"; then
326   :
327 else
328   {
329 test -n "$verbose" && \
330 echo '  defining' NO_STRING_H
331 DEFS="$DEFS -DNO_STRING_H=1"
332 }
333
334 fi
335 rm -f conftest*
336
337 echo checking for stdlib.h
338 cat > conftest.c <<EOF
339 #include <stdlib.h>
340 EOF
341 err=`eval "($CPP \$DEFS conftest.c >/dev/null) 2>&1"`
342 if test -z "$err"; then
343   :
344 else
345   {
346 test -n "$verbose" && \
347 echo '  defining' NO_STDLIB_H
348 DEFS="$DEFS -DNO_STDLIB_H=1"
349 }
350
351 fi
352 rm -f conftest*
353
354 echo checking for size_t in sys/types.h
355 echo '#include <sys/types.h>' > conftest.c
356 eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
357 if egrep "size_t" conftest.out >/dev/null 2>&1; then
358   :
359 else
360   {
361 test -n "$verbose" && \
362 echo '  defining' size_t to be 'unsigned'
363 DEFS="$DEFS -Dsize_t=unsigned"
364 }
365
366 fi
367 rm -f conftest*
368
369 echo '#include <sys/types.h>' > conftest.c
370 eval "$CPP \$DEFS conftest.c > conftest.out 2>&1"
371 if egrep "off_t" conftest.out >/dev/null 2>&1; then
372   :
373 else
374   {
375 test -n "$verbose" && \
376 echo '  defining' NO_OFF_T
377 DEFS="$DEFS -DNO_OFF_T=1"
378 }
379 fi
380
381 echo checking for EXIT_SUCCESS
382 cat > conftest.c <<EOF
383 # include <stdlib.h>
384 int main (void) { return EXIT_SUCCESS; }
385 EOF
386 err=`eval "($CC -c \$DEFS conftest.c >/dev/null) 2>&1"`
387 if test -z "$err"; then
388   :
389 else
390   {
391 test -n "$verbose" && \
392 echo '  no EXIT_SUCCESS' 
393 DEFS="$DEFS -DEXIT_SUCCESS=0"
394 }
395 fi
396
397 echo checking for EXIT_FAILURE
398 cat > conftest.c <<EOF
399 # include <stdlib.h>
400 int main (void) { return EXIT_FAILURE; }
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_FAILURE' 
409 DEFS="$DEFS -DEXIT_FAILURE=-1"
410 }
411 fi
412
413 echo checking for -ll
414 echo 'int main (void) { exit (0); }' > conftest.c
415 err=`eval "($CC conftest.c -o conftest -ll >/dev/null) 2>&1"`
416 if test -z "$err"; then
417 LINKLEX="-ll"
418 else
419 echo '  No -ll...trying -lfl'
420 err=`eval "($CC conftest.c -o conftest -lfl >/dev/null) 2>&1"`
421 if test -z "$err"; then
422 echo 'Okay!'
423 LINKLEX="-lfl"
424 else
425 echo '*** No lex or flex library found.  Must have -ll or -lfl to build lclint.'
426 echo '*** If this is installed on your system, try editing the configure
427 script to use the correct flags to locate this file.'
428 fi
429 fi
430 rm -f conftest*
431
432 if test -z "$cwdir"
433   then
434   cwdir=`pwd`
435   echo setting current directory to $cwdir
436   fi
437
438 if test -z "$prefix"
439 then
440   prefix=$cwdir
441   echo "        chose installation directory prefix ${prefix}"
442   echo "        will install binaries in ${prefix}/bin"
443   echo "        will install libraries in ${prefix}/lib"
444   echo "        will install imports in ${prefix}/imports"
445   echo "        will install emacs files in ${prefix}/emacs"
446   echo "        edit Makefile to change installation directories"
447 fi
448
449 if test -z "$G" -a -n "$prefix" -a -f $prefix/bin/gznew; then
450   G=g
451 fi
452 if test -z "$ZCAT"; then
453   if test -n "$prefix" -a -f $prefix/bin/gzcat; then
454     ZCAT=gzcat
455   else
456     ZCAT=${G}zcat
457   fi
458 fi
459 if test -n "$prefix"; then
460   test -z "$exec_prefix" && exec_prefix='${prefix}'
461   prsub="s%^prefix\\([  ]*\\)=\\([      ]*\\).*$%prefix\\1=\\2$prefix%"
462 fi
463 if test -n "$exec_prefix"; then
464   prsub="$prsub
465 s%^exec_prefix\\([      ]*\\)=\\([      ]*\\).*$%\
466 exec_prefix\\1=\\2$exec_prefix%"
467 fi
468 cat >conftest.def <<EOF
469 $DEFS
470 EOF
471 escape_ampersand_and_backslash='s%[&\\]%\\&%g'
472 DEFS=`sed "$escape_ampersand_and_backslash" <conftest.def`
473 rm -f conftest.def
474
475 trap 'rm -f config.status; exit 1' 1 3 15
476 echo creating config.status
477 rm -f config.status
478 cat > config.status <<EOF
479 #!/bin/sh
480 # Generated automatically by configure.
481 # Run this file to recreate the current configuration.
482 # This directory was configured as follows,
483 # on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
484 #
485 # $0 $*
486
487 for arg
488 do
489   case "\$arg" in
490     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
491     exec /bin/sh $0 $* ;;
492     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
493   esac
494 done
495
496 trap 'rm -f Makefile; exit 1' 1 3 15
497 CC='$CC'
498 CPP='$CPP'
499 OPT='$OPT'
500 cwdir='$cwdir'
501 INSTALL='$INSTALL'
502 INSTALL_PROGRAM='$INSTALL_PROGRAM'
503 INSTALL_DATA='$INSTALL_DATA'
504 BISON='$BISON'
505 FLEX='$FLEX'
506 ZCAT='$ZCAT'
507 LINKLEX='$LINKLEX'
508 G='$G'
509 CFLAGS='$CFLAGS'
510 ASCPP='$ASCPP'
511 OBJA='$OBJA'
512 SEDCMD='$SEDCMD'
513 LIBS='$LIBS'
514 srcdir='$srcdir'
515 DEFS='$DEFS'
516 prefix='$prefix'
517 installdir='$prefix'
518 exec_prefix='$exec_prefix'
519 prsub='$prsub'
520 EOF
521 cat >> config.status <<\EOF
522
523 top_srcdir=$srcdir
524
525 # Allow make-time overrides of the generated file list.
526 test -n "$gen_files" || gen_files="Makefile"
527
528 for file in .. $gen_files; do if [ "x$file" != "x.." ]; then
529   srcdir=$top_srcdir
530   # Remove last slash and all that follows it.  Not all systems have dirname.
531   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
532   if test "$dir" != "$file"; then
533     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
534     test ! -d $dir && mkdir $dir
535   fi
536   echo creating $file
537   rm -f $file
538   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
539   sed -e "
540 $prsub
541 s%@CC@%$CC%g
542 s%@CPP@%$CPP%g
543 s%@OPT@%$OPT%g
544 s%@LINKLEX@%$LINKLEX%g
545 s%@BISON@%$BISON%g
546 s%@FLEX@%$FLEX%g
547 s%@cwdir@%$cwdir%g
548 s%@installdir@%$installdir%g
549 s%@INSTALL@%$INSTALL%g
550 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
551 s%@INSTALL_DATA@%$INSTALL_DATA%g
552 s%@ZCAT@%$ZCAT%g
553 s%@G@%$G%g
554 s%@CFLAGS@%$CFLAGS%g
555 s%@OBJA@%$OBJA%g
556 s%@SEDCMD@%$SEDCMD%g
557 s%@LIBS@%$LIBS%g
558 s%@srcdir@%$srcdir%g
559 s%@DEFS@%$DEFS%
560 " $top_srcdir/${file}.in >> $file
561 fi; done
562
563 exit 0
564 EOF
565 chmod +x config.status
566 test -n "$no_create" || ./config.status
567
This page took 0.243398 seconds and 5 git commands to generate.