X-Git-Url: https://git.jankratochvil.net/?a=blobdiff_plain;f=bin%2Ferrs1;h=287fbcf6332875cac2db533487e94a894a2f0699;hb=0b5e1205f7e5fa8b893a00713937dcfa8d182705;hp=9d8bd4a96e82dafc3681aae3be25aa87766b668e;hpb=d257143f57923f094a67674448f0f5acc40ff833;p=nethome.git diff --git a/bin/errs1 b/bin/errs1 index 9d8bd4a..287fbcf 100755 --- a/bin/errs1 +++ b/bin/errs1 @@ -2,31 +2,92 @@ # $Id$ customss="--enable-static --disable-shared" -if [ "$1" = "--origss" ];then - customss= - shift -fi - customm="-m64" -if [ "$1" = "--origm" ];then - customm= - shift -fi - +target= +targets= configure="./configure" -if [ "${1#*/configure}" != "$1" ];then - configure="$1" - shift -fi +debug="-ggdb2" +ldflags="" +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 + target=i386-unknown-linux-gnu + 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" + shift + continue + fi + + break +done ( 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 && test -f `dirname $configure`/bfd/elf64-x86-64.c -a '(' -d CVS -o -d .git ')';then + targets="--enable-targets=all" + ldflags="-lmcheck" + 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 @@ -43,5 +104,9 @@ fi export CFLAGS="$flags" export CXXFLAGS="$flags" export GCJFLAGS="$flags" - time nice "$configure" $customss --enable-debug --enable-maintainer-mode "$@" + export CFLAGS_FOR_TARGET="$flags" + export CXXFLAGS_FOR_TARGET="$flags" + export LDFLAGS="$ldflags" + + time nice "$configure" $target $targets $customss --enable-debug $maintainer $werror "$@" ) 2>&1|tee errs1