+Option -c: clean
[nethome.git] / bin / errs1
1 #! /bin/sh
2 # $Id$
3
4 customss="--enable-static --disable-shared"
5 if [ "$1" = "--origss" ];then
6         customss=
7         shift
8 fi
9
10 customm="-m64"
11 if [ "$1" = "--origm" ];then
12         customm=
13         shift
14 fi
15
16 configure="./configure"
17 if [ "${1#*/configure}" != "$1" ];then
18         configure="$1"
19         shift
20 fi
21
22 (
23         set -ex
24         rm -f config.cache
25         : >errs1.c
26         for flags in                                                                                                    \
27                 "-ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4"   \
28                 "-ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions"                                               \
29                 ""                                                                                                      \
30                 ;do
31                 if [ -z "$flags" ];then
32                         rm -f errs1.c
33                         echo >&2 "flags error"
34                         exit 1
35                 fi
36                 gcc $flags -c errs1.c -o /dev/null && break
37         done
38         if test -n "$customm" && gcc $customm -c errs1.c -o /dev/null;then
39                 flags="$customm $flags"
40         fi
41         rm -f errs1.c
42         export CFLAGS="$flags"
43         export CXXFLAGS="$flags"
44         export GCJFLAGS="$flags"
45         time nice "$configure" $customss --enable-debug "$@"
46         ) 2>&1|tee errs1