Hello, * Dr Magnus Hagdorn wrote on Thu, Apr 20, 2006 at 10:34:48AM CEST: > On Wed, 2006-04-19 at 09:07 -0700, Noah Misch wrote: > > On Wed, Apr 19, 2006 at 09:27:12AM +0100, Dr Magnus Hagdorn wrote: > > > I define symbols using AC_DEFINE which should be passed to the > > > preprocessor to optionally compile certain parts. This all works fine > > > except for when the IBM XL f90 compiler is used. This compiler does not > > > have the -D switch to pass options to the preprocessor and instead > > > expects -WF,-D. > > If portability to a wide variety of Make programs is not a priority, > > the above solution is fine. Otherwise, try this: > > > > if AIX_XL > > DEFS = `echo @DEFS@ | sed 's/-D[^ ]*/-WF,&/g'` > > endif > > > > It does incur a regrettable performance hit. This approach has several flaws: - The `echo @DEFS@ | ..` isn't right, as it messes up escaping for the shell (try `-DPACKAGE_STRING=\"foo\ 1\"'). - Automake doesn't allow to override its DEFS definition. It will output it anyways currently; so it doesn't help either to if AIX_XL DEFS = .. else DEFS = .. endif - Same thing with $(PPF77COMPILE), by the way. But in my test the Automake definition gets output before the user one, so you could use this hack: if AIX_XL PPF77COMPILE = $(F77) $(DEFS:-D%=-WF,-D%) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS) else PPF77COMPILE = $(F77) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS) endif This uses Automake internals, though, and may happily break with the next Automake version (or even with the same, under different conditions than the one I tested), so consider yourself warned. (Erm, there should be better $(FC) support here, I guess..) > unfortunately, I get in both cases this error message: > src/Makefile.am:51: DEFS was already defined in condition TRUE, which > includes condition FC_XL ... > configure.in:10: ... `DEFS' previously defined here > which is AM_INIT_AUTOMAKE Yes, but Automake still completes and outputs a Makefile.in, just that the order isn't right in that case. > > Ideally, Autoconf should test -D and -WF,-D and use the one that works. Since > > the C compiler will probably still need -D, we would create a DEFS variable for > > each preprocessed language: CDEFS, CXXDEFS, F77DEFS, FCDEFS. Automake would > > need changes to take advantage of the new variables, but Autoconf could > > substitute DEFS = ${CDEFS} for backward-compatibility. > > > yes. grrr, the IBM Fortran XL compiler is just a total pain to support. > Everything is odd. The simplest solution would probably be to write a wrapper for this compiler, and put it early in the user's PATH. Below is a suggestion. (Note that `-D' is a legitimate flag for xlf90, so it should not be escaped.) Cheers, Ralf #! /bin/sh # xlf90-wrapper for arg do case $arg in -D) set x "$@" "$arg";; -D*) set x "$@" "-WF,$arg";; *) set x "$@" "$arg";; esac shift # x shift # $arg done exec /usr/bin/xlf90 "$@" _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf