autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macro to give option to preprocessor depending on the compiler ?


From: Ralf Wildenhues
Subject: Re: Macro to give option to preprocessor depending on the compiler ?
Date: Tue, 3 Feb 2009 20:11:18 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Sébastien,

* Sébastien Le Roux wrote on Tue, Feb 03, 2009 at 07:59:11PM CET:
>
> I have prepared a 'configure.ac' which tests both for Fortran
> compilers  and MPI library.  If configure is done using '--with-mpi'
> option then the configure looks  for MPI libs and if succeed ad the
> option '-DMPI' for the compilation of some files  (F90) of the code.
> So far everything fines except that I have noticed that some compilers
> (IBMs: mpxlf90/mpxlf95) do not allows such command. For these
> compilers you need to tell first  to the preprocessor that you are
> defining a variable using '-WF,-DMPI' the only command  '-DMPI' won't
> work.  I wonder if there is a macro to find the good way to tell this
> to the  preprocessor, if needed, and so I guess, depending on the
> Fortran compiler ?

Do you use Automake in addition to Autoconf?  If no: you can just do
something like this in configure.ac
  if $the_compiler_is_IBMS; then
    FDEFS=`echo " $DEFS" | sed 's| -D| -WF,-D|g'`
  else
    FDEFS=$DEFS
  fi
  AC_SUBST([FDEFS])

and use $(FDEFS) in the rules in Makefile.in.

If you do use Automake: please use separate Makefile.am files for
Fortran and non-Fortran code.  Put this in the ones for Fortran:
  address@hidden@

Similarly, I guess, for CPPFLAGS and AM_CPPFLAGS.

I have this issue on the list of things to eventually fix in Automake,
but not yet a patch, nor a hurry.  ;-)

As another possible workaround (at least for DEFS), can you use a config
header?

Hope that helps.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]