some new ignores
[nethome.git] / bin / errs1
1 #! /bin/sh
2 # $Id$
3
4 renice +19 -p $$; ionice -c3 -p $$
5
6 customss="--enable-static --disable-shared"
7 customm="-m64"
8 target=
9 targets=
10 configure="./configure"
11 debug="-ggdb2"
12 ldflags="-lmcheck"
13 fast=false
14
15 while true
16 do
17         if [ "$1" = "--origss" ];then
18                 customss=
19                 shift
20                 continue
21         fi
22         if [ "$1" = "--fast" ];then
23                 fast=true
24                 shift
25                 continue
26         fi
27         if [ "$1" = "--shared" ];then
28                 customss="--disable-static --enable-shared"
29                 shift
30                 continue
31         fi
32
33         if [ "$1" = "-m" ];then
34                 customm=
35                 shift
36                 continue
37         fi
38         if [ "$1" = "-m32" ];then
39                 customm=-m32
40                 case `uname -m` in
41                   i?86|x86_64|ia64) target=i386-unknown-linux-gnu ;;
42                   ppc*)             target=powerpc64-unknown-linux-gnu ;;
43                   s390*)            target=s390-unknown-linux-gnu ;;
44                 esac
45                 shift
46                 continue
47         fi
48
49         if [ "${1#*/configure}" != "$1" ];then
50                 configure="$1"
51                 shift
52                 continue
53         fi
54
55         if [ "$1" = "-s" ];then
56                 # -O0 is important to override GCC -O2.
57                 debug="-O0 -s"
58                 ldflags=""
59                 shift
60                 continue
61         fi
62
63         break
64 done
65
66 rm -f errs1.ok
67 (
68         set -ex
69         find -name config.cache|xargs rm -f
70
71         # sourceware.org?
72         if test -f `dirname $configure`/bfd/elf64-x86-64.c \
73              -o -f `dirname $configure`/gcc/reload.c;then
74                 maintainer=""
75         else
76                 :
77 #               maintainer="--enable-maintainer-mode"
78         fi
79         if test -f `dirname $configure`/bfd/elf64-x86-64.c;then
80                 test -f g77 || (test -f /usr/bin/gfortran && ln -s /usr/bin/gfortran g77)
81         fi
82         if ! $fast;then
83                 targets="$targets --enable-64-bit-bfd"
84         fi
85         if ! $fast && test -f `dirname $configure`/bfd/elf64-x86-64.c -a '(' -d CVS -o -d .git ')';then
86                 targets="$targets --enable-targets=all"
87         fi
88
89         if test -f `dirname $configure`/gcc/reload.c;then
90                 werror="--disable-werror"
91                 customm=""
92                 customss="--disable-static --enable-shared"
93         else
94                 werror=""
95         fi
96
97         test -z "$CC" && CC=gcc
98         : >errs1.c
99         for flags in                                                                                                    \
100                 "$debug -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4"   \
101                 "$debug -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions"                                               \
102                 ""                                                                                                      \
103                 ;do
104                 if [ -z "$flags" ];then
105                         rm -f errs1.c
106                         echo >&2 "flags error"
107                         exit 1
108                 fi
109                 "$CC" $flags -c errs1.c -o /dev/null && break
110         done
111         if test -n "$customm" && "$CC" $customm -c errs1.c -o /dev/null;then
112                 flags="$customm $flags"
113         fi
114         rm -f errs1.c
115         export CFLAGS="$flags"
116         export CXXFLAGS="$flags"
117         export GCJFLAGS="$flags"
118         export CFLAGS_FOR_TARGET="$flags"
119         export CXXFLAGS_FOR_TARGET="$flags"
120         export LDFLAGS="$ldflags"
121
122         time nice "$configure" $target $targets $customss --enable-debug --disable-sim $maintainer $werror --with-separate-debug-dir=/usr/lib/debug "$@"
123         touch errs1.ok
124         ) 2>&1|tee errs1
125 test -f errs1.ok
126 rc=$?
127 rm -f errs1.ok
128 exit $rc