Prechádzať zdrojové kódy

replace as/ld availability assumption with feature testing; together with [34937] this eliminates the need for the with_binutils option entirely and also removes a linux/freebsd platform assumption; sponsored by BinckBank

Thomas Lotterer 18 rokov pred
rodič
commit
9fa345313c
1 zmenil súbory, kde vykonal 12 pridanie a 18 odobranie
  1. 12 18
      gcc/gcc.spec

+ 12 - 18
gcc/gcc.spec

@@ -37,7 +37,7 @@ Class:        CORE
 Group:        Compiler
 License:      GPL
 Version:      %{V_full}
-Release:      20070214
+Release:      20070419
 
 #   package options
 %option       with_cxx       yes
@@ -46,7 +46,6 @@ Release:      20070214
 %option       with_fortran   no
 %option       with_optimize  yes
 %option       with_profile   no
-%option       with_binutils  yes
 %option       with_threads   yes
 %option       with_multilib  no
 
@@ -59,10 +58,8 @@ Prefix:       %{l_prefix}
 BuildRoot:    %{l_buildroot}
 BuildPreReq:  OpenPKG, openpkg >= 20060622, make
 PreReq:       OpenPKG, openpkg >= 20060622
-%if "%{with_binutils}" == "yes"
 BuildPreReq:  binutils >= 2.14
 PreReq:       binutils >= 2.14
-%endif
 %if "%{with_fortran}" == "yes"
 BuildPreReq:  mpfr
 PreReq:       mpfr
@@ -118,16 +115,12 @@ AutoReqProv:  no
 
     #   determine ld(1) and as(1) usage
     l_with_gnu_ld_as=""
-%if "%{with_binutils}" == "yes"
-    l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld --with-ld=%{l_prefix}/bin/ld"
-    l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-as=%{l_prefix}/bin/as"
-%else
-    case "%{l_platform -t}" in
-       *-linux* | *-freebsd* )
-           l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as --with-gnu-ld"
-           ;;
-    esac
-%endif
+    LD="%{l_tool_locate ld ld}"
+    AS="%{l_tool_locate as as}"
+    echo "$LD" | grep "^/" >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-ld=\"$LD\""
+    echo "$AS" | grep "^/" >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-as=\"$AS\""
+    "$LD" --version 2>/dev/null | grep "^GNU ld "        >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-ld"
+    "$AS" --version 2>/dev/null | grep "^GNU assembler " >/dev/null && l_with_gnu_ld_as="${l_with_gnu_ld_as} --with-gnu-as"
 
     #   determine threads usage
 %if "%{with_threads}" == "yes"
@@ -205,11 +198,12 @@ AutoReqProv:  no
     case "%{l_platform -t}" in
         alpha*-tru64* ) if [ ".$l_ccisgcc" = .no ]; then l_libcflags="$l_libcflags -ieee"; fi ;;
     esac
-%if "%{with_binutils}" == "yes"
     #   at least GNU as from GNU binutils supports -pipe always
-    l_boot_cflags="$l_boot_cflags -pipe"
-    l_libcxxflags="$l_libcxxflags -pipe"
-%endif
+    AS="%{l_tool_locate as as}"
+    "$AS" --version 2>/dev/null | grep "^GNU assembler " >/dev/null && {
+        l_boot_cflags="$l_boot_cflags -pipe";
+        l_libcxxflags="$l_libcxxflags -pipe";
+    }
 %if "%{with_optimize}" == "yes"
     #   conservatively optimize the generated program code
     #   (also _tune_ for particular CPUs, but _without_ requiring these CPUs!)