Subject: bug#7669: option "foreign" after "-Wall" turns off and portability warnings.

From: Stefano Lattarini <[email-masked]>
Date: Fri, 17 Dec 2010 19:52:29 +0100

Hello automakers.

This is basically just a reproposal of PR/547 from the old gnats database;
I'm resubmitting it here because I'd really like to see it fixed, and
having it reported in the new, more visible debbugs-based bug database
might help in this respect.

-*-*-*-

With automake >= 1.10, foreign *after* -Wall in AM_INIT_AUTOMAKE turns
off portability warnings.

  $ cat >> configure.ac <<'END'
  AC_INIT([foo], [1.0])
  AM_INIT_AUTOMAKE([foreign -Wall])
  AC_CONFIG_FILES([Makefile])
  AC_PROG_CC
  END
  $ aclocal
  $ cat > Makefile.am <<'END'
  CFLAGS := $(wildcard *)
  bin_PROGRAMS = foo
  END
  $ automake -a # will warn as expected
  Makefile.am:1: `:='-style assignments are not portable
  Makefile.am:1: wildcard *: non-POSIX variable name
  Makefile.am:1: (probably a GNU make extension)
  Makefile.am:1: `CFLAGS' is a user variable, you should not override it;
  Makefile.am:1: use `AM_CFLAGS' instead.
  $ # now put `foreign' after `-Wall'
  $ sed -i 's/foreign -Wall/-Wall foreign/' configure.ac
  $ automake -a # gives no warnings!
  $ automake -a -Wall # but this does, luckily
  Makefile.am:1: `:='-style assignments are not portable
  Makefile.am:1: wildcard *: non-POSIX variable name
  Makefile.am:1: (probably a GNU make extension)
  Makefile.am:1: `CFLAGS' is a user variable, you should not override it;
  Makefile.am:1: use `AM_CFLAGS' instead.

While the current behaviour is due to various historical and implementation
reasons, IMHO it is counter-intuitive and somewhat "dangerous", since
programmers enabling the `foreign' option might unwittingly be prevented
from seeing portability warnings -- when they think to have enabled those
warnings!

Regards,
   Stefano