This add-on macro claims to do what you need:
ax_cflags_gcc_option
Check whether GCC supports the given option.
http://autoconf-archive.cryp.to/ax_cflags_gcc_option.html
On Mon, Mar 26, 2007 at 06:32:32AM +0000, ronnie sahlberg wrote:
> Dont worry.
>
> Ill rewrite it so that it tries to compile a real file.
>
>
> On 3/26/07, ronnie sahlberg <ronniesahlberg@xxxxxxxxx> wrote:
> > [sahlberg@Derek trunk]$ echo yes | gcc -E -Wfoodeclaration-after-statement -
> > # 1 ""
> > yes
> > [sahlberg@Derek trunk]$ gcc -v
> > Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
> > gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
> > [sahlberg@Derek trunk]$
> >
> > It appears it only looks at the -W arguments when you are actually
> > compiling a real file, not when running -E
> >
> >
> >
> >
> >
> > On 3/26/07, Jeff Morriss <jeff.morriss@xxxxxxxxxxx> wrote:
> > >
> > > Hmmm, that's weird, it works for me.
> > >
> > > What version of GCC are you using?
> > >
> > > What does:
> > >
> > > echo yes | gcc -E -Wfoodeclaration-after-statement -
> > >
> > > produce for you? For me I get only:
> > >
> > > > cc1: error: unrecognized command line option
> > > "-Wfoodeclaration-after-statement"
> > > > # 1 "<stdin>"
> > >
> > > (but no "yes").
> > >
> > > Oh, OK, it looks like older versions of GCC (I just tried 3.2) don't
> > > error out when presented an invalid command line argument.
> > >
> > > Hmmm, at least it should still compile on those GCC versions, but now I
> > > have to think of a different test...
> > >
> > > ronnie sahlberg wrote:
> > > > The checks in configure.in
> > > > for this doesnt work properly for
> > > > GCC versions which do not support this -W directive.
> > > >
> > > > Eventhough it is not supported by GCC
> > > > AC_MSG_CHECKING(to see if we can add '-Wdeclaration-after-statement'...
> > > > still adds it to the compile flags.
> > > >
> > > > I will see if i can figure out why the test fails.
> > > > Me and automake/configure are not on friendly terms.
> > > >
> > > >
> > > >
> > > > On 3/26/07, morriss@xxxxxxxxxxxxx <morriss@xxxxxxxxxxxxx> wrote:
> > > >> http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=21195
> > > >>
> > > >> User: morriss
> > > >> Date: 2007/03/26 12:32 AM
> > > >>
> > > >> Log:
> > > >> If we're using gcc, try to use -Wdeclaration-after-statement to catch
> > > more
> > > >> non-portable commits. I'm not sure if this is the Right Way to test to
> > > see
> > > >> if the compiler can handle a specific option but it's simple and
> > > efficient
> > > >> enough.
> > > >>
> > > >> Directory: /trunk/
> > > >> Changes Path Action
> > > >> +8 -0 configure.in Modified
> > > >>
> > > >> _______________________________________________
> > > >> Wireshark-commits mailing list
> > > >> Wireshark-commits@xxxxxxxxxxxxx
> > > >> http://www.wireshark.org/mailman/listinfo/wireshark-commits
> > > >>
> > > > _______________________________________________
> > > > Wireshark-dev mailing list
> > > > Wireshark-dev@xxxxxxxxxxxxx
> > > > http://www.wireshark.org/mailman/listinfo/wireshark-dev
> > > >
> > > >
> > > _______________________________________________
> > > Wireshark-dev mailing list
> > > Wireshark-dev@xxxxxxxxxxxxx
> > > http://www.wireshark.org/mailman/listinfo/wireshark-dev
> > >
> >
> _______________________________________________
> Wireshark-dev mailing list
> Wireshark-dev@xxxxxxxxxxxxx
> http://www.wireshark.org/mailman/listinfo/wireshark-dev