From: Alexandre Duret-Lutz Date: Tue, 11 Feb 2003 18:20:55 +0000 (+0000) Subject: * m4/depend.m4: Grep depcomp's stderr for icc warnings about X-Git-Tag: Release-1-7-2b~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=faabcad8c3c11882a3de14d626abbeb1b90e8625;p=thirdparty%2Fautomake.git * m4/depend.m4: Grep depcomp's stderr for icc warnings about ignored options. * lib/depcomp (icc): New mode. * tests/depcomp5.test: New file. * tests/defs.in: Handle required=icc. * tests/Makefile.am (TESTS): Add it. --- diff --git a/ChangeLog b/ChangeLog index bfb3d828d..0f2592e37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2003-02-11 Alexandre Duret-Lutz + * m4/depend.m4: Grep depcomp's stderr for icc warnings about + ignored options. + * lib/depcomp (icc): New mode. + * tests/depcomp5.test: New file. + * tests/defs.in: Handle required=icc. + * tests/Makefile.am (TESTS): Add it. + Temporary hack for PR automake/381: * automake.in (handle_gettext): Turn missing po/ and intl/ errors into -Wsyntax warnings. diff --git a/lib/depcomp b/lib/depcomp index 46d355355..c90ff925f 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -206,6 +206,35 @@ aix) rm -f "$tmpdepfile" ;; +icc) # Must come before tru64. + + # Intel's C compiler understands `-MD -MF file'. However + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. diff --git a/m4/depend.m4 b/m4/depend.m4 index 4d6ff228e..d0b24dce1 100644 --- a/m4/depend.m4 +++ b/m4/depend.m4 @@ -92,11 +92,17 @@ AC_CACHE_CHECK([dependency style of $depcc], if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c -o conftest.o conftest.c >/dev/null 2>&1 && + $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \ + >/dev/null 2>conftest.err && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - am_cv_$1_dependencies_compiler_type=$depmode - break + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi fi done diff --git a/tests/Makefile.am b/tests/Makefile.am index ef7481388..f0f653f63 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -139,6 +139,7 @@ depcomp.test \ depcomp2.test \ depcomp3.test \ depcomp4.test \ +depcomp5.test \ depdist.test \ depend.test \ depend2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index c57331e3f..02adff9a0 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -233,6 +233,7 @@ depcomp.test \ depcomp2.test \ depcomp3.test \ depcomp4.test \ +depcomp5.test \ depdist.test \ depend.test \ depend2.test \ diff --git a/tests/defs.in b/tests/defs.in index 93bc32e14..5e6669d40 100644 --- a/tests/defs.in +++ b/tests/defs.in @@ -92,6 +92,16 @@ then echo "$me: running $CXX --version" ( $CXX --version ) || exit 77 ;; + icc) + CC=icc + export CC + # There is no way to ask *only* the compiler's version. + # This tool always want to do something (by default + # it will try link *nothing* and complain it cannot find + # main(); funny). -dryrun is a workaround. + echo "$me: running $CC -V -dryrun" + ( $CC -V -dryrun ) || exit 77 + ;; non-root) # Skip this test case if the user is root. # We try to append to a read-only file to detect this. diff --git a/tests/depcomp5.test b/tests/depcomp5.test new file mode 100755 index 000000000..02e614bc5 --- /dev/null +++ b/tests/depcomp5.test @@ -0,0 +1,64 @@ +#! /bin/sh +# Copyright (C) 2003 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Automake is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Check icc's dependency mode. + +required='icc' +. ./defs || exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AM_PROG_CC_C_O +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects +check_PROGRAMS = prg +prg_SOURCES = src/sub.c src/foo.h + +grepdeps: + grep 'src/sub.$(OBJEXT).*:' src/$(DEPDIR)/sub.Po + +END + +mkdir src + +touch src/foo.h + +cat >src/sub.c <