|
Re: Incorrect order of AM_CXXFLAGS and CXX_FLAGS?: msg#00172sysutils.automake.bugs
On Tue, 2004-11-23 at 12:37 +0100, Marcel Loose wrote: > Hi, > > Recently, I stumbled across the following problem. We use the > auto-tools in > our build environment and have some GNU G++ compiler flags predefined > -- they > are defined as CXXFLAGS in an m4-macro that is invoked during > configure. > Among these flags are "-Wall" and "-W". Well, it's arguable if these are CFLAGS, CXXFLAGS or CPPFLAGS. Actually, they don't belong into any of these families, because most of GCC's -W options are "overall options". > I wanted to configure/compile one sub-package in our software tree with > an > extra flag "-Wno-unused-parameter". So I added a line AM_CXXFLAGS = > -Wno-unused-parameter to my Makefile.am. The problem is, however, that > it > doesn't work. Automake adds the compiler flag before the default > CXX_FLAGS, > and as a result -Wall overrides the -Wno-unused-parameter flag. You should not hard-code any compiler specific flags into a Makefile.am ;) > Now, I don't know whether this a GCC "bug", or not, but it would make > sense, > IMHO, to *append* AM_*FLAGS, rather than to *prepend* them. Especially > because GCC usually retains the last occurrence of a switch that > appears on > the command line more than once. > > So, instead of the current definition in automake: > $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) > $(CPPFLAGS) > $(AM_CXXFLAGS) $(CXXFLAGS), > wouldn't it be better if it were defined as: > $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) > $(AM_CPPFLAGS) > $(CXXFLAGS) $(AM_CXXFLAGS) No, because this would prevent you from being able to override flags from the environment. However, the work-around to your issue is quite simple: Override CXXFLAGS from the environment to prevent the configure script from choosing the defaults. RAlf |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: bug in option parsing: 00172, Eric Blake |
|---|---|
| Next by Date: | Application is pre approved: 00172, Malcolm McIntosh |
| Previous by Thread: | Incorrect order of AM_CXXFLAGS and CXX_FLAGS?i: 00172, Marcel Loose |
| Next by Thread: | buddy told me abouut this phramacy: 00172, illa Yohe |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |