On Fri, May 27, 2011 at 06:30:21AM -0700, Ian Lance Taylor wrote: > Jonathan Wakely <jwakely....@gmail.com> writes: > > It's an additional maintenance burden. > > It's not a maintenance burden on gcc, though. > > I think we should have the gcc configure script provide a way to add a > preprocessor macro.
FWIW, we decided we needed similar capabilities in our compilers and decided to add a --with-specs option, which enables additional flexibility, particularly WRT optimization capabilities. Below is the patch against our 4.5 tree, written by Nathan Sidwell. -Nathan * configure.ac (--with-specs): New option. * configure: Regenerated. * gcc.c (driver_self_specs): Include CONFIGURE_SPECS. * Makefile.in (DRIVER_DEFINES): Add -DCONFIGURE_SPECS. Index: gcc/gcc.c =================================================================== --- gcc/gcc.c (revision 271022) +++ gcc/gcc.c (revision 271023) @@ -955,7 +955,7 @@ static const char *const multilib_defaul static const char *const driver_self_specs[] = { "%{fdump-final-insns:-fdump-final-insns=.} %<fdump-final-insns", - DRIVER_SELF_SPECS, GOMP_SELF_SPECS + DRIVER_SELF_SPECS, CONFIGURE_SPECS, GOMP_SELF_SPECS }; #ifndef OPTION_DEFAULT_SPECS Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 271022) +++ gcc/configure.ac (revision 271023) @@ -785,6 +785,14 @@ AC_SUBST(TARGET_SYSTEM_ROOT) AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) AC_SUBST(CROSS_SYSTEM_HEADER_DIR) +AC_ARG_WITH(specs, + [AS_HELP_STRING([--with-specs=SPECS], + [add SPECS to driver command-line processing])], + [CONFIGURE_SPECS=$withval], + [CONFIGURE_SPECS=] +) +AC_SUBST(CONFIGURE_SPECS) + # Build with intermodule optimisations AC_ARG_ENABLE(intermodule, [ --enable-intermodule build the compiler in one step], Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 271022) +++ gcc/Makefile.in (revision 271023) @@ -2100,7 +2100,8 @@ DRIVER_DEFINES = \ -DTOOLDIR_BASE_PREFIX=\"$(libsubdir_to_prefix)$(prefix_to_exec_prefix)\" \ @TARGET_SYSTEM_ROOT_DEFINE@ \ $(VALGRIND_DRIVER_DEFINES) \ - `test "X$${SHLIB_LINK}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` + `test "X$${SHLIB_LINK}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \ + -DCONFIGURE_SPECS="\"@CONFIGURE_SPECS@\"" gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \ Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H) $(FLAGS_H) \