autoconf
[Top][All Lists]
Advanced

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

Re: autotools on aix


From: Jim Edwards
Subject: Re: autotools on aix
Date: Wed, 11 May 2011 21:34:34 -0600

Hi Jeff,

Thanks but this part I can do.  The difficulty comes in variables that are
generated in the automake and libtool.  This is one of the more complex
builds I've come across, it uses automake and has Makefile.am in some large
number of subdirectories, each of these Makefile.am - which is only a few
dozen lines at most - go on to create a Makefile.in which then autoconf
builds into a Makefile with more variables than a bunny has babies.      One
of them, the one used to compile, is PPFCCOMPILE - that one is defined
something like

PPFCCOMPILE="$(FC) $(FCFLAGS) $(CPPFLAGS) $(DEF) $( and more )"

There is another
LTPPFCCOMPILE  defined in much the same way.

You can't change $(CPPFLAGS) or $(DEF) without changing what is passed to
the c and cxx compilers so somehow you need to change the two above.

libtool also does it's part by defining a -DPIC and passing that to the
compiler - it may be needed for c and cxx but its an error in fortran.

Jim

On Wed, May 11, 2011 at 7:28 PM, Daily, Jeff A <address@hidden> wrote:

> > From: address@hidden
> address@hidden On Behalf Of Jim Edwards address@hidden
> > Sent: Wednesday, May 11, 2011 4:51 PM
> > To: address@hidden
> > Subject: autotools on aix
> >
> > I am trying to port a model to AIX.   The model uses cc cxx and fc
> > compilers.
> > The problem is that the IBM xlf compilers do not recognize the -D
> > preprocessor flag and I am at my wits end trying to
> > get the tools to do the right thing.
> >
> > I can handle a conditional edit of the FCFLAGS in configure.in
> >
> >  FCFLAGS=$(echo $FCFLAGS | sed 's/-D/-WF,-D/g')
> >
> > but problems hound me.
> >
> > 1.  CPPFLAGS is used in PPFCCOMPILE and LTPPFCCOMPILE  but since CPPFLAGS
> is
> > also used for c and cxx I can't substitute that.
> > 2. DEFS= -DHAVE_CONFIG_H is also defined and used in the same places
> > 3. libtool defines  pic_flag=' -DPIC'
> >
> > Anyone have a good solution?
>
> This is the solution we chose.  We are aware of the IBM xlf compilers as
> well as the Fujitsu compilers having this kind of behavior.  We test for all
> three cases, and if it's the more common -D case, we don't change anything.
>  If it's one of the unusual cases, we change FFLAGS.  YMMV.  I hope this
> helps.  Hopefully you can copy and past it into an *.m4 of your own.  This
> comes from our Global Arrays toolkit (http://www.emsl.pnl.gov/docs/global/),
> hence the GA_* or ga_* prefix on most things.
>
> # GA_F77_CPP_SYMBOL([ACTION-WHEN-FOUND])
> # --------------------------------------
> # Detect how to pass CPP symbols to preprocessed Fortran 77.
> #
> # Known:
> #  -D       the usual
> #  -WF,-D   IBM xlf
> #  -Wp,-D   Fujitsu
> #
> AC_DEFUN([GA_F77_CPP_SYMBOL],
> [AC_CACHE_CHECK([how to pass symbols to preprocessed $F77],
> [ga_cv_f77_cpp_symbol],
> [AC_LANG_PUSH([Fortran 77])
> ac_ext=F
> for symbol in -D -WF,-D -Wp,-D
> do
>    ga_save_CPPFLAGS="$CPPFLAGS"
>    ga_save_FFLAGS="$FFLAGS"
>    CPPFLAGS="$CPPFLAGS ${symbol}GABLAHBLAH"
>    FFLAGS="$CPPFLAGS $FFLAGS"
>    AC_COMPILE_IFELSE(
> [[#ifndef GABLAHBLAH
> this is an error
> #endif
>      end program]],
>        [ga_cv_f77_cpp_symbol="$symbol"])
>    CPPFLAGS="$ga_save_CPPFLAGS"
>    FFLAGS="$ga_save_FFLAGS"
>    AS_IF([test "x$ga_cv_f77_cpp_symbol" != x], [break])
> done
> AC_LANG_POP([Fortran 77])
> ])
> AS_IF([test "x$ga_cv_f77_cpp_symbol" = x],
>    [AC_MSG_ERROR([don't know how to pass symbols to preprocessed
> Fortran])])
> m4_default([$1],
>    [AS_CASE([$ga_cv_f77_cpp_symbol],
>        [-D],   [],
>        [FFLAGS="$FFLAGS ${ga_cv_f77_cpp_symbol}HAVE_CONFIG_H"])])
> ]) # GA_F77_CPP_SYMBOL
>


reply via email to

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