Commit 86ebe38e authored by unknown's avatar unknown

scripts/make_binary_distribution.sh:

Fix the code to get the "libgcc" file name so that the failure of Intel's ICC
to provide this information does not cause any problems.

This fixes  bug#33536  Option "--print-libgcc-file" does not work with ICC compiler


scripts/make_binary_distribution.sh:
  The (old) code to get the "libgcc" file name does not really work when using Intel's ICC.
  ICC accepts the "--print-libgcc-file" option but ignores it, does not produce any output.
  
  However, ICC tricks automake into taking it for a GCC ("GXX" variable is set, see
  http://www.gnu.org/software/autoconf/manual/html_node/C_002b_002b-Compiler.html#C_002b_002b-Compiler
  and its discussion of the "AC_PROG_CXX" macro).
  
  There are two possible approaches:
  a) Check "$CC" or "$CXX" to tell ICC from GCC, and do not ask ICC for the "libgcc" file name.
  b) Just ask it, but protect that code so that its failure does not cause any damage.
  
  This patch takes the second route:
  1) Put the call "@CC@ ... --print-libgcc-file" into a pipeline, followed by "|| true",
     so that (for the shell semantics) the command cannot fail.
     (ICC will exit non-zero because it is not given a source file.)
  2) Explicitly redirect any error messages.
  3) Do not use the compiler's return code but rather the (non)empty variable to check success.
  4) Ensure that the contents really is a file before taking it as a file name.
  
  Item 1) is especially important when the tool gets a "set -e" (this happens in 5.1, currently)
  which would make the failing compiler call a fatal thing.
  
  This fixes  bug#33536  Option "--print-libgcc-file" does not work with ICC compiler
parent 06122a05
......@@ -322,11 +322,13 @@ BASE=$BASE2
#
if [ x"@GXX@" = x"yes" ] ; then
gcclib=`@CC@ @CFLAGS@ --print-libgcc-file`
if [ $? -ne 0 ] ; then
echo "Warning: Couldn't find libgcc.a!"
else
gcclib=`@CC@ @CFLAGS@ --print-libgcc-file 2>/dev/null` || true
if [ -z "$gcclib" ] ; then
echo "Warning: Compiler doesn't tell libgcc.a!"
elif [ -f "$gcclib" ] ; then
$CP $gcclib $BASE/lib/libmygcc.a
else
echo "Warning: Compiler result '$gcclib' not found / no file!"
fi
fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment