+sync
[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         test -z "$CC" && CC=gcc
26         : >errs1.c
27         for flags in                                                                                                    \
28                 "-ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4"   \
29                 "-ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions"                                               \
30                 ""                                                                                                      \
31                 ;do
32                 if [ -z "$flags" ];then
33                         rm -f errs1.c
34                         echo >&2 "flags error"
35                         exit 1
36                 fi
37                 "$CC" $flags -c errs1.c -o /dev/null && break
38         done
39         if test -n "$customm" && "$CC" $customm -c errs1.c -o /dev/null;then
40                 flags="$customm $flags"
41         fi
42         rm -f errs1.c
43         export CFLAGS="$flags"
44         export CXXFLAGS="$flags"
45         export GCJFLAGS="$flags"
46
47         # sourceware.org?
48         if test -f `dirname $configure`/bfd/elf64-x86-64.c;then
49                 maintainer=""
50         else
51                 maintainer="--enable-maintainer-mode"
52         fi
53
54         time nice "$configure" $customss --enable-debug $maintainer "$@"
55         ) 2>&1|tee errs1