X-Git-Url: https://git.jankratochvil.net/?a=blobdiff_plain;f=bin%2Ferrs1;h=65903c8f3da1c0ed0f25fae8b6e59e0e8ed84c49;hb=ec43c7627b731e3b684aee00285b01122188b3a4;hp=66fe83c58db7ec065090e18b4bb196392d2a0a80;hpb=a1346c39e992d88819c5416568360f6bea69bd75;p=nethome.git diff --git a/bin/errs1 b/bin/errs1 index 66fe83c..65903c8 100755 --- a/bin/errs1 +++ b/bin/errs1 @@ -1,23 +1,104 @@ #! /bin/sh # $Id$ -configure="./configure" -if [ "${1#*/configure}" != "$1" ];then - configure="$1" - shift -fi +renice +19 -p $$; ionice -c3 -p $$ + customss="--enable-static --disable-shared" -if [ "$1" = "--origss" ];then - customss= - shift -fi +customm="-m64" +target= +targets= +configure="./configure" +debug="-ggdb2" +ldflags="-lmcheck" +fast=false + +while true +do + if [ "$1" = "--origss" ];then + customss= + shift + continue + fi + if [ "$1" = "--fast" ];then + fast=true + shift + continue + fi + if [ "$1" = "--shared" ];then + customss="--disable-static --enable-shared" + shift + continue + fi + + if [ "$1" = "-m" ];then + customm= + shift + continue + fi + if [ "$1" = "-m32" ];then + customm=-m32 + case `uname -m` in + i?86|x86_64|ia64) target=i386-unknown-linux-gnu ;; + ppc*) target=powerpc64-unknown-linux-gnu ;; + s390*) target=s390-unknown-linux-gnu ;; + esac + shift + continue + fi + + if [ "${1#*/configure}" != "$1" ];then + configure="$1" + shift + continue + fi + + if [ "$1" = "-s" ];then + # -O0 is important to override GCC -O2. + debug="-O0 -s" + ldflags="" + shift + continue + fi + + break +done + +rm -f errs1.ok ( set -ex - rm -f config.cache + find -name config.cache|xargs rm -f + + # sourceware.org? + if test -f `dirname $configure`/bfd/elf64-x86-64.c \ + -o -f `dirname $configure`/gcc/reload.c;then + maintainer="" + else + : +# maintainer="--enable-maintainer-mode" + fi + if test -f `dirname $configure`/bfd/elf64-x86-64.c;then + test -f g77 || (test -f /usr/bin/gfortran && ln -s /usr/bin/gfortran g77) + fi + if ! $fast;then + targets="$targets --enable-64-bit-bfd" + fi + if ! $fast && test -f `dirname $configure`/bfd/elf64-x86-64.c -a '(' -d CVS -o -d .git ')';then + targets="$targets --enable-targets=all" + fi + + if test -f `dirname $configure`/gcc/reload.c;then + werror="--disable-werror" + customm="" + customss="--disable-static --enable-shared" + else + werror="" + fi + + test -z "$CC" && CC=gcc : >errs1.c for flags in \ - "-ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4" \ - "-ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions" \ + "$debug -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4" \ + "$debug -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions" \ "" \ ;do if [ -z "$flags" ];then @@ -25,14 +106,23 @@ fi echo >&2 "flags error" exit 1 fi - gcc $flags -c errs1.c -o /dev/null && break + "$CC" $flags -c errs1.c -o /dev/null && break done - if gcc -m64 -c errs1.c -o /dev/null;then - flags="-m64 $flags" + if test -n "$customm" && "$CC" $customm -c errs1.c -o /dev/null;then + flags="$customm $flags" fi rm -f errs1.c export CFLAGS="$flags" export CXXFLAGS="$flags" export GCJFLAGS="$flags" - time nice "$configure" $customss --enable-debug "$@" + export CFLAGS_FOR_TARGET="$flags" + export CXXFLAGS_FOR_TARGET="$flags" + export LDFLAGS="$ldflags" + + time nice "$configure" $target $targets $customss --enable-debug $maintainer $werror "$@" + touch errs1.ok ) 2>&1|tee errs1 +test -f errs1.ok +rc=$? +rm -f errs1.ok +exit $rc