autoconf
[Top][All Lists]
Advanced

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

Hello all autoconf users - AC_PROG_FC question


From: Sébastien Le Roux
Subject: Hello all autoconf users - AC_PROG_FC question
Date: Sat, 31 Jan 2009 17:32:36 -0500
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

Hello,
I am new to the autoconf mail list (as well as to autoconf)
Therefore I will first introduce my-self, my name is Sébastien Le Roux I am French,
and I am a post-doc in physics in Central Michigan University.
I have to confess that I subscribed to this mailing list to find an autoconf guru :) So far between me and autoconf everything's great, I have prepared my configure.ac and its working fine (file attached .. and only checks for Fortran compilers and MPI lib)

Thus I have a question concerning the behavior of the 'configuration' process, I would like to understand how does the AC_PROG_FC check for any Fortran compiler. Indeed so far I've seen that even if the first F90 compiler that appears in my $PATH (env var) is not the GNU fortran compiler (ie. ifort) the result of the AC_PROG_FC will be to put FC="gfortran" ... how can this be possible ... the gfortran / f95 command of course
appears in my $PATH but in this case after the 'ifort' command.
Anyway all compilation processes are fine using the FC="ifort" in the configure line.
I just want to have an idea on the behavior of the AC_PROG_FC.

By the way I did not find this information elsewhere which explains why I have subscribed to the autoconf mailing list ... if (for some reason) this would not be suitable, I will apologize
and as far as you will let me know I will unsubscribe to the list.

Best regards.

Sébastien

--
====================================================
Dr. Sébastien Le Roux
Department of Physics
203 Dow Science
Central Michigan University
Mt. Pleasant, MI 48859, USA
E-mail:  address@hidden
Webpage: http://www.phy.cmich.edu/people/lerou1s/
Fax:   +1 (989) 774 2697
Phone: +1 (989) 774 3180
====================================================

dnl Process this file with autoconf to produce a configure script.

AC_INIT([rings], [1.0], address@hidden)
AM_INIT_AUTOMAKE

AC_LANG_PUSH([Fortran])

dnl -------------- M4 MPI lib check thanks to: ---------------
dnl -------  Steven G. Johnson <address@hidden>  -------
dnl --- and Julian C. Cummings <address@hidden> ---
dnl ----------------------------------------------------------

AC_DEFUN([ACX_MPI], [
AC_PREREQ(2.50) dnl for AC_LANG_CASE

AC_LANG_CASE([Fortran], [
        AC_REQUIRE([AC_PROG_FC])
        AC_ARG_VAR(MPIFC,[MPI Fortran compiler command])
        AC_CHECK_PROGS(MPIFC, mpif90 mpxlf95_r mpxlf90_r mpxlf95 mpxlf90 mpf90 
cmpif90c, $FC)
        acx_mpi_save_FC="$FC"
        FC="$MPIFC"
        AC_SUBST(MPIFC)
])

if test x = x"$MPILIBS"; then
        AC_MSG_CHECKING([for MPI_Init])
        AC_LINK_IFELSE([AC_LANG_PROGRAM([],[      call MPI_Init])],[MPILIBS=" "
        AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
fi
AC_LANG_CASE([Fortran], [
        if test x = x"$MPILIBS"; then
                AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"])
        fi
        if test x = x"$MPILIBS"; then
                AC_CHECK_LIB(mpichf90, MPI_Init, [MPILIBS="-lmpichf90"])
        fi

])
if test x = x"$MPILIBS"; then
        AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"])
fi
if test x = x"$MPILIBS"; then
        AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"])
fi

AC_LANG_CASE([Fortran], [if test x != x"$MPILIBS"; then
        AC_MSG_CHECKING([for mpif.h])
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[      include 
'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS=""
        AC_MSG_RESULT(no)])
fi])

AC_LANG_CASE([Fortran], [FC="$acx_mpi_save_FC"])

AC_SUBST(MPILIBS)

# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x = x"$MPILIBS"; then
        $2
        :
else
        ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI 
library.])],[$1])
        :
fi
])dnl ACX_MPI

dnl ----------------------------------------------------------
dnl ----------------------------------------------------------
dnl ----------------------------------------------------------

AC_DEFUN([AC_RINGS_WITH_MPI],[

AC_ARG_WITH([mpi],
AC_HELP_STRING([--with-mpi],[Build the parallel version of the R.I.N.G.S. code])
AC_HELP_STRING([--without-mpi],[This is the default - Serial version of the 
R.I.N.G.S. code])
,[
        if test "$with_mpi" = "yes" ; then
                ACX_MPI([
                        use_mpi=yes
                        FC="$MPIFC"
                        fcflags_save="$FCFLAGS"
                        AC_PROG_FC([$FC], [90])
                        FCFLAGS="$fcflags_save"
                        AC_FC_SRCEXT(f90, FCFLAGS_f90="$FCFLAGS")
                        AC_FC_SRCEXT(F90, FCFLAGS_F90="-DMPI $FCFLAGS")
                ],[
                        AC_MSG_ERROR([Cannot compile MPI program])
                ])
        else
                use_mpi=no
        fi
],[
                use_mpi=no
])

])dnl end of AC_RINGS_WITH_MPI

AC_RINGS_WITH_MPI
if test "$use_mpi" = "no" ; then
        fcflags_save="$FCFLAGS"
        AC_PROG_FC([gfortran f95 f90 pgf90 epcf90 ifort ifc xlf90 g95 fort 
xlf95 efc pgf95 lf95], [90])
        FCFLAGS="$fcflags_save"
        AC_FC_SRCEXT(f90, FCFLAGS_f90="$FCFLAGS")
        AC_FC_SRCEXT(F90, FCFLAGS_F90="$FCFLAGS")
fi

AC_FC_LIBRARY_LDFLAGS
AC_FC_FREEFORM
AC_LANG_POP([Fortran])

AC_CONFIG_FILES([
 Makefile
 src/Makefile
])

AC_OUTPUT


reply via email to

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