On 07/27/2011 04:13 PM, Xochitl Lunde wrote:
Is there a nice way to conditionally add -fno-exceptions to CXXFLAGS for the "Source Dir" from configure.ac or elsewhere? I am sure I can go to each library under "Source Dir" and put -fno-exceptions in AM_CXXFLAGS, but is there a correct way to do it in configure.ac?
The nicest way to to this is to not change CXXFLAGS, but to instead AC_SUBST two different variables for the difference in which compiler options you want (you _did_ test that $CXX supports -fno-exceptions before blindly adding it to CXXFLAGS, right? Not all the world is g++). Then, in the appropriate Makefile.am files, modify AM_CXXFLAGS to include the appropriate substituted variables.
See how coreutils does things: in the top level configure.ac, it does an AC_SUBST of WERROR_CFLAGS, WARN_CFLAGS, and GNULIB_WARN_CFLAGS - three distinct subsets of flags that were all tested on whether they were supported by the current compiler, and where WERROR_CFLAGS is conditional on whether you requested configure --enable-gcc-warnings. Then, src/Makefile.am sets AM_CFLAGS to $(WARN_CFLAGS) $(WERROR_CFLAGS), while lib/Makefile.am uses the less-strict AM_CFLAGS += $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS).
-- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf