According to Paolo Bonzini on 7/31/2009 1:09 AM: >> So I'm left doing what I posted earlier and setting CXXFLAGS to "" if >> the user hasn't set it at ./configure time, since there is no other >> option to say "hey, um, thanks! but I don't really want you to add -g >> -O2 to my flags" > > That's okay. Doing simply > > : ${CXXFLAGS=""} > > right after AC_INIT is fine. So is setting CXXFLAGS to "-O1 -g" if your > program doesn't like being compiled at -O2. > > I'm not a native speaker (and the only native-speaking Autoconf > developer is gone for two weeks), so suggestions on how to phrase this > in the documentation are very welcome.
2 weeks turned into 7 months. Sorry for not replying to this thread sooner. I like Paolo's suggestion of documenting that it is acceptable to change the default CXXFLAGS if the package author doesn't like autoconf's default, without penalizing the user's ability to specify better arguments than the package default. How does this wording look? -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
From 54bb4e2cce2ff3f415f2a133c9d49bd7f96e2498 Mon Sep 17 00:00:00 2001 From: Eric Blake <ebl...@redhat.com> Date: Thu, 25 Feb 2010 14:56:34 -0700 Subject: [PATCH] Document how to safely override CFLAGS default. * doc/autoconf.texi (C Compiler) <AC_PROG_CC>: Document a way to change the default CFLAGS. (C++ Compiler) <AC_PROG_CXX>: Likewise, for CXXFLAGS. Reported by Monty Taylor; wording suggested by Paolo Bonzini. Signed-off-by: Eric Blake <ebl...@redhat.com> --- ChangeLog | 6 ++++++ doc/autoconf.texi | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d27e870..f0be2df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-02-25 Eric Blake <ebl...@redhat.com> + Document how to safely override CFLAGS default. + * doc/autoconf.texi (C Compiler) <AC_PROG_CC>: Document a way to + change the default CFLAGS. + (C++ Compiler) <AC_PROG_CXX>: Likewise, for CXXFLAGS. + Reported by Monty Taylor; wording suggested by Paolo Bonzini. + Recommend latest m4 release. * README: Bump recommendation to m4 1.4.14 (minimum remains 1.4.6). diff --git a/doc/autoconf.texi b/doc/autoconf.texi index a669d06..86d434c 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -7128,7 +7128,9 @@ C Compiler @samp{yes}. If output variable @code{CFLAGS} was not already set, set it to @option{-g -O2} for the @acronym{GNU} C compiler (@option{-O2} on systems where @acronym{GCC} does not accept @option{-g}), or @option{-g} for -other compilers. +other compilers. If your package does not like this default, then it is +acceptable to insert the line @samp{: ${CFLAGS=""}} after @code{AC_INIT} +and before @code{AC_PROG_CC} to select an empty default instead. Many Autoconf macros use a compiler, and thus call @samp{AC_REQUIRE([AC_PROG_CC])} to ensure that the compiler has been @@ -7529,7 +7531,10 @@ C++ Compiler @samp{yes}. If output variable @code{CXXFLAGS} was not already set, set it to @option{-g -O2} for the @acronym{GNU} C++ compiler (@option{-O2} on systems where G++ does not accept @option{-g}), or @option{-g} for other -compilers. +compilers. If your package does not like this default, then it is +acceptable to insert the line @samp{: ${CXXFLAGS=""}} after @code{AC_INIT} +and before @code{AC_PROG_CXX} to select an empty default instead. + @end defmac @defmac AC_PROG_CXXCPP -- 1.6.6.1
signature.asc
Description: OpenPGP digital signature