[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fortran 90/95 support (autoconf)
From: |
marq |
Subject: |
Fortran 90/95 support (autoconf) |
Date: |
Thu, 7 Jun 2001 22:46:14 +0200 (CEST) |
Hello!
Over the last months, I have used autoconf and automake for various
libraries and programs, and they both have made my life so much
simpler. Working in a more meteorological / scientific environment,
the only thing I found missing was the support for the fortran 90 and
95 languages.
There was some earlier (about a year ago or so) attempt to provide a
solution by Martin Wilck for autoconf; but his macros ceased to work
as the autoconf development is *so* rapid. Thus, I've put together
my own stuff to use both autoconf and automake for my mixed
C/f77/f90/f95 projects. I have used this for several month now in
about ten different packages, and they seem to work well - at least for
me...
I have just send the patches for automake to the automake list;
here's a patch for autoconf's aclang.m4. In contrast to Martin's
approach I have only tried to provide a minimalistic support for
fortran 90 and 95. There is no solution for automatically finding
dependencies; no tests to find out how fortran 90 modules are handled
(i.e., if special command line switches need to be given in order to
activate module support, or how to specify paths to external modules
etc.); and there are probably many other missing features.
On the other hand - what I missed most was the automatic generation of
different compilation rules for fortran 77, fortran 90 and fortran 95
source files, along with targets for the linking. Once these feautures
are available, the other, more advanced features can be probably be
added by additional macros. But the basic functionality has to be
there first, of course.
Thus, I would like to request to include the attached patch to
autoconf (and the corresponding patch to automake). If the maintainers
of these packages agree to include them, I would try to write some
description for the manuals and / or provide some working examples.
The patch defines the following new macros (which have similar
meanings like their Fortran 77 counterparts):
AC_LANG(Fortran 90)
AC_LANG_FORTRAN90
AC_LANG_SOURCE(Fortran 90)(BODY)
AC_LANG_CALL(Fortran 90)(PROLOGUE, FUNCTION) *not* discarding the prologue
AC_LANG_PREPROC(Fortran 90) doing nothing, actually...
AC_LANG_COMPILER(Fortran 90)
AC_PROG_F90([COMPILERS])
AC_PROG_F90_C_O
AC_F90_LIBRARY_LDFLAGS
AC_F90_WRAPPERS
AC_F90_FUNC(NAME, [SHELLVAR = NAME])
plus the corresponding fortran 95 macros (s/90/95/ in the above
list). Also, the following shell variables are defined (and later on
substituted):
F90
F90FLAGS
F90LIBS
while the shell variable
LD90FLAGS
is honoured if set (the idea is that a user might want to link specific
libraries when linking a fortran 90 program). The corresponding *95*
versions also exist. Essentially, all macros are plain copies of the
fortran 77 versions, edited manually to avoid unwanted interactions
between them, and to adjust default settings.
I'm somewhat ambivalent about the AC_F90_WRAPPER and related macros
since I have actually never used the autoconf mechanism for mangling C
and fortran code. Based on my limited understanding on how compilers
work, I would expect that the name mangling will only work for plain
fortran 77 style subroutine and function calls, but certainly not for
the more advanced generic and array features of the fortran 90
language which are available through explicit interfaces. But then,
corresponding macros are available for F77, so there are people using
them... Again, these macros have not been tested.
Thanks,
Chris.
Here's the patch:
--------------------------
Index: aclang.m4
2001-06-07 Christian Marquardt <address@hidden>
* aclang.m4: (AC_LANG(Fortran 90), AC_LANG_FORTRAN90,
AC_LANG_SOURCE(Fortran 90), AC_LANG_CALL(Fortran 90),
AC_LANG_PREPROC(Fortran 90), AC_LANG_COMPILER(Fortran 90),
AC_PROG_F90, AC_PROG_F90_C_O, AC_F90_LIBRARY_LDFLAGS,
AC_F90_WRAPPERS, AC_F90_FUNC, *F95*): Added various macros
for a basic Fortran 90 and Fortran 95 support.
Index: aclang.m4
===================================================================
RCS file: /cvs/autoconf/aclang.m4,v
retrieving revision 1.131
diff -u -r1.131 aclang.m4
--- aclang.m4 2001/06/02 15:01:13 1.131
+++ aclang.m4 2001/06/07 19:47:27
@@ -58,12 +58,16 @@
# b. C
# c. C++
# d. Fortran 77
+# e. Fortran 90
+# f. Fortran 95
#
# 2. Producing programs in a given language.
# a. generic routines
# b. C
# c. C++
# d. Fortran 77
+# e. Fortran 90
+# f. Fortran 95
#
# 3. Looking for a compiler
# And possibly the associated preprocessor.
@@ -71,12 +75,16 @@
# b. C
# c. C++
# d. Fortran 77
+# e. Fortran 90
+# f. Fortran 95
#
# 4. Compilers' characteristics.
# a. Generic routines.
# b. C
# c. C++
# d. Fortran 77
+# e. Fortran 90
+# f. Fortran 95
@@ -269,7 +277,56 @@
m4_define([_AC_LANG_ABBREV(Fortran 77)], [f77])
+# ----------------------------- #
+# 1e. The Fortran 90 language. #
+# ----------------------------- #
+
+
+# AC_LANG(Fortran 90)
+# -------------------
+m4_define([AC_LANG(Fortran 90)],
+[ac_ext=f90
+ac_compile='$F90 -c $F90FLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
+ac_link='$F90 -o conftest$ac_exeext $F90FLAGS $LD90FLAGS $LDFLAGS
conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
+ac_compiler_gnu=$ac_cv_f90_compiler_gnu
+])
+
+
+# AC_LANG_FORTRAN90
+# -----------------
+AU_DEFUN([AC_LANG_FORTRAN90], [AC_LANG(Fortran 90)])
+
+
+# _AC_LANG_ABBREV(Fortran 90)
+# ---------------------------
+m4_define([_AC_LANG_ABBREV(Fortran 90)], [f90])
+
+
+# ----------------------------- #
+# 1f. The Fortran 95 language. #
+# ----------------------------- #
+
+# AC_LANG(Fortran 95)
+# -------------------
+m4_define([AC_LANG(Fortran 95)],
+[ac_ext=f95
+ac_compile='$F95 -c $F95FLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
+ac_link='$F95 -o conftest$ac_exeext $F95FLAGS $LD95FLAGS $LDFLAGS
conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
+ac_compiler_gnu=$ac_cv_f95_compiler_gnu
+])
+
+
+# AC_LANG_FORTRAN95
+# -----------------
+AU_DEFUN([AC_LANG_FORTRAN95], [AC_LANG(Fortran 95)])
+
+
+# _AC_LANG_ABBREV(Fortran 95)
+# ---------------------------
+m4_define([_AC_LANG_ABBREV(Fortran 95)], [f95])
+
+
## ---------------------- ##
## 2.Producing programs. ##
## ---------------------- ##
@@ -498,6 +555,46 @@
[ call $2])])
+# ------------------------ #
+# 2e. Fortran 90 sources. #
+# ------------------------ #
+
+# AC_LANG_SOURCE(Fortran 90)(BODY)
+# --------------------------------
+m4_copy([AC_LANG_SOURCE(Fortran 77)], [AC_LANG_SOURCE(Fortran 90)])
+
+
+# AC_LANG_PROGRAM(Fortran 90)([PROLOGUE], [BODY])
+# -----------------------------------------------
+m4_define([AC_LANG_PROGRAM(Fortran 90)], [
+program main
+$1
+$2
+end program main
+])
+
+# AC_LANG_CALL(Fortran 90)(PROLOGUE, FUNCTION)
+# --------------------------------------------
+m4_define([AC_LANG_CALL(Fortran 90)],
+[AC_LANG_PROGRAM([$1],
+[call $2])])
+
+
+# ------------------------ #
+# 2f. Fortran 95 sources. #
+# ------------------------ #
+
+# AC_LANG_SOURCE(Fortran 95)(BODY)
+# --------------------------------
+m4_copy([AC_LANG_SOURCE(Fortran 90)], [AC_LANG_SOURCE(Fortran 95)])
+
+# AC_LANG_PROGRAM(Fortran 95)([PROLOGUE], [BODY])
+# -----------------------------------------------
+m4_copy([AC_LANG_PROGRAM(Fortran 90)], [AC_LANG_PROGRAM(Fortran 95)])
+
+# AC_LANG_CALL(Fortran 95)(PROLOGUE, FUNCTION)
+# --------------------------------------------
+m4_copy([AC_LANG_CALL(Fortran 90)], [AC_LANG_CALL(Fortran 90)])
## -------------------------------------------- ##
@@ -810,7 +907,7 @@
# _AC_ARG_VAR_LDFLAGS
# -------------------
# Document and register LDFLAGS, which is used by
-# AC_PROG_{CC, CXX, F77}.
+# AC_PROG_{CC, CXX, F77, F90, F95}.
AC_DEFUN([_AC_ARG_VAR_LDFLAGS],
[AC_ARG_VAR([LDFLAGS],
[linker flags, e.g. -L<lib dir> if you have libraries in a
@@ -1349,7 +1446,261 @@
])# AC_PROG_F77_C_O
+# ----------------------------- #
+# 3e. The Fortran 90 compiler. #
+# ----------------------------- #
+
+
+# AC_LANG_PREPROC(Fortran 90)
+# ---------------------------
+# Find the Fortran 90 preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(Fortran 90)],
+[m4_warn([syntax],
+ [$0: No preprocessor defined for ]_AC_LANG)])
+
+
+# AC_LANG_COMPILER(Fortran 90)
+# ----------------------------
+# Find the Fortran 90 compiler. Must be AC_DEFUN'd to be
+# AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(Fortran 90)],
+[AC_REQUIRE([AC_PROG_F90])])
+
+
+# ac_cv_prog_g90
+# --------------
+# We used to name the cache variable this way.
+AU_DEFUN([ac_cv_prog_g90],
+[ac_cv_f90_compiler_gnu])
+
+
+# AC_PROG_F90([COMPILERS...])
+# ---------------------------
+# COMPILERS is a space separated list of Fortran 90 compilers to search
+# for.
+#
+# Compilers are ordered by
+# 1. F90, F95
+# 2. Good/tested native compilers, bad/untested native compilers
+#
+# pgf90 is the Portland Group F90 compilers.
+# xlf90/xlf95 are IBM (AIX) F90/F95 compilers.
+# lf95 is the Lahey-Fujitsu compiler.
+# fl32 is the Microsoft Fortran "PowerStation" compiler.
+# epcf90 is the "Edinburgh Portable Compiler" F90.
+# fort is the Compaq Fortran 90 (now 95) compiler for Tru64 and Linux/Alpha.
+AC_DEFUN([AC_PROG_F90],
+[AC_LANG_PUSH(Fortran 90)dnl
+AC_ARG_VAR([F90], [Fortran 90 compiler command])dnl
+AC_ARG_VAR([F90FLAGS], [Fortran 90 compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOLS(F90,
+ [m4_default([$1],
+ [f90 xlf90 pgf90 epcf90 f95 xlf95 lf95 fort g95])])
+
+m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
+m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
+# If we don't use `.F90' as extension, the preprocessor is not run on the
+# input file.
+ac_save_ext=$ac_ext
+ac_ext=F90
+_AC_LANG_COMPILER_GNU
+ac_ext=$ac_save_ext
+G95=`test $ac_compiler_gnu = yes && echo yes`
+_AC_PROG_F90_G
+AC_LANG_POP(Fortran 90)dnl
+])# AC_PROG_F90
+
+
+# _AC_PROG_F90_G
+# --------------
+# Check whether -g works, even if F90FLAGS is set, in case the package
+# plays around with F90FLAGS (such as to build both debugging and normal
+# versions of a library), tasteless as that idea is.
+m4_define([_AC_PROG_F90_G],
+[ac_test_F90FLAGS=${F90FLAGS+set}
+ac_save_F90FLAGS=$F90FLAGS
+F90FLAGS=
+AC_CACHE_CHECK(whether $F90 accepts -g, ac_cv_prog_f90_g,
+[F90FLAGS=-g
+_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+[ac_cv_prog_f90_g=yes],
+[ac_cv_prog_f90_g=no])
+])
+if test "$ac_test_F90FLAGS" = set; then
+ F90FLAGS=$ac_save_F90FLAGS
+elif test $ac_cv_prog_f90_g = yes; then
+ if test "$G95" = yes; then
+ F90FLAGS="-g -O2"
+ else
+ F90FLAGS="-g"
+ fi
+else
+ if test "$G95" = yes; then
+ F90FLAGS="-O2"
+ else
+ F90FLAGS=
+ fi
+fi[]dnl
+])# _AC_PROG_F90_G
+
+
+# AC_PROG_F90_C_O
+# ---------------
+# Test if the Fortran 90 compiler accepts the options `-c' and `-o'
+# simultaneously, and define `F90_NO_MINUS_C_MINUS_O' if it does not.
+#
+# The usefulness of this macro is questionable, as I can't really see
+# why anyone would use it. The only reason I include it is for
+# completeness, since a similar test exists for the C compiler.
+AC_DEFUN([AC_PROG_F90_C_O],
+[AC_REQUIRE([AC_PROG_F90])dnl
+AC_CACHE_CHECK([whether $F90 understand -c and -o together],
+ [ac_cv_prog_f90_c_o],
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+# We test twice because some compilers refuse to overwrite an existing
+# `.o' file with `-o', although they will create one.
+ac_try='$F90 $FFLAGS -c conftest.$ac_ext -o conftest.$ac_objext
>&AS_MESSAGE_LOG_FD'
+if AC_TRY_EVAL(ac_try) &&
+ test -f conftest.$ac_objext &&
+ AC_TRY_EVAL(ac_try); then
+ ac_cv_prog_f90_c_o=yes
+else
+ ac_cv_prog_f90_c_o=no
+fi
+rm -f conftest*])
+if test $ac_cv_prog_f90_c_o = no; then
+ AC_DEFINE(F90_NO_MINUS_C_MINUS_O, 1,
+ [Define if your Fortran 90 compiler doesn't accept -c and -o
together.])
+fi
+])# AC_PROG_F90_C_O
+
+
+# ----------------------------- #
+# 3f. The Fortran 95 compiler. #
+# ----------------------------- #
+
+
+# AC_LANG_PREPROC(Fortran 95)
+# ---------------------------
+# Find the Fortran 95 preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_PREPROC(Fortran 95)],
+[m4_warn([syntax],
+ [$0: No preprocessor defined for ]_AC_LANG)])
+
+
+# AC_LANG_COMPILER(Fortran 95)
+# ----------------------------
+# Find the Fortran 95 compiler. Must be AC_DEFUN'd to be
+# AC_REQUIRE'able.
+AC_DEFUN([AC_LANG_COMPILER(Fortran 95)],
+[AC_REQUIRE([AC_PROG_F95])])
+
+
+# ac_cv_prog_g95
+# --------------
+# We used to name the cache variable this way.
+AU_DEFUN([ac_cv_prog_g95],
+[ac_cv_f95_compiler_gnu])
+
+
+# AC_PROG_F95([COMPILERS...])
+# ---------------------------
+# COMPILERS is a space separated list of Fortran 95 compilers to search
+# for.
+#
+# Compilers are ordered by
+# 1. Good/tested native compilers, bad/untested native compilers
+#
+# xlf95 is the IBM (AIX) F95 compiler.
+# lf95 is the Lahey-Fujitsu compiler.
+# fl32 is the Microsoft Fortran "PowerStation" compiler.
+# fort is the Compaq Fortran 90 (now 95) compiler for Tru64 and Linux/Alpha.
+AC_DEFUN([AC_PROG_F95],
+[AC_LANG_PUSH(Fortran 95)dnl
+AC_ARG_VAR([F95], [Fortran 95 compiler command])dnl
+AC_ARG_VAR([F95FLAGS], [Fortran 95 compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOLS(F95,
+ [m4_default([$1],
+ [f95 xlf95 lf95 fort g95])])
+
+m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
+m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
+# If we don't use `.F95' as extension, the preprocessor is not run on the
+# input file.
+ac_save_ext=$ac_ext
+ac_ext=F95
+_AC_LANG_COMPILER_GNU
+ac_ext=$ac_save_ext
+G95=`test $ac_compiler_gnu = yes && echo yes`
+_AC_PROG_F95_G
+AC_LANG_POP(Fortran 95)dnl
+])# AC_PROG_F95
+
+
+# _AC_PROG_F95_G
+# --------------
+# Check whether -g works, even if F90FLAGS is set, in case the package
+# plays around with F95FLAGS (such as to build both debugging and normal
+# versions of a library), tasteless as that idea is.
+m4_define([_AC_PROG_F95_G],
+[ac_test_F95FLAGS=${F95FLAGS+set}
+ac_save_F95FLAGS=$F95FLAGS
+F95FLAGS=
+AC_CACHE_CHECK(whether $F95 accepts -g, ac_cv_prog_f95_g,
+[FFLAGS=-g
+_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+[ac_cv_prog_f95_g=yes],
+[ac_cv_prog_f95_g=no])
+])
+if test "$ac_test_F95FLAGS" = set; then
+ F95FLAGS=$ac_save_F95FLAGS
+elif test $ac_cv_prog_f95_g = yes; then
+ if test "$G95" = yes; then
+ F95FLAGS="-g -O2"
+ else
+ F95FLAGS="-g"
+ fi
+else
+ if test "$G95" = yes; then
+ F95FLAGS="-O2"
+ else
+ F95FLAGS=
+ fi
+fi[]dnl
+])# _AC_PROG_F95_G
+
+# AC_PROG_F95_C_O
+# ---------------
+# Test if the Fortran 95 compiler accepts the options `-c' and `-o'
+# simultaneously, and define `F95_NO_MINUS_C_MINUS_O' if it does not.
+#
+# The usefulness of this macro is questionable, as I can't really see
+# why anyone would use it. The only reason I include it is for
+# completeness, since a similar test exists for the C compiler.
+AC_DEFUN([AC_PROG_F95_C_O],
+[AC_REQUIRE([AC_PROG_F95])dnl
+AC_CACHE_CHECK([whether $F95 understand -c and -o together],
+ [ac_cv_prog_f95_c_o],
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+# We test twice because some compilers refuse to overwrite an existing
+# `.o' file with `-o', although they will create one.
+ac_try='$F95 $FFLAGS -c conftest.$ac_ext -o conftest.$ac_objext
>&AS_MESSAGE_LOG_FD'
+if AC_TRY_EVAL(ac_try) &&
+ test -f conftest.$ac_objext &&
+ AC_TRY_EVAL(ac_try); then
+ ac_cv_prog_f95_c_o=yes
+else
+ ac_cv_prog_f95_c_o=no
+fi
+rm -f conftest*])
+if test $ac_cv_prog_f95_c_o = no; then
+ AC_DEFINE(F95_NO_MINUS_C_MINUS_O, 1,
+ [Define if your Fortran 95 compiler doesn't accept -c and -o
together.])
+fi
+])# AC_PROG_F95_C_O
## ------------------------------- ##
@@ -1686,8 +2037,6 @@
])# AC_C_PROTOTYPES
-
-
# ---------------------------------------- #
# 4d. Fortan 77 compiler characteristics. #
# ---------------------------------------- #
@@ -2033,3 +2382,697 @@
])
m4_default([$2],[$1])="$ac_val"
])# AC_F77_FUNC
+
+
+# ---------------------------------------- #
+# 4e. Fortan 90 compiler characteristics. #
+# ---------------------------------------- #
+
+
+# _AC_PROG_F90_V_OUTPUT([FLAG = $ac_cv_prog_f90_v])
+# -------------------------------------------------
+# Link a trivial Fortran program, compiling with a verbose output FLAG
+# (which default value, $ac_cv_prog_f90_v, is computed by
+# _AC_PROG_F90_V), and return the output in $ac_f90_v_output. This
+# output is processed in the way expected by AC_F90_LIBRARY_LDFLAGS,
+# so that any link flags that are echoed by the compiler appear as
+# space-separated items.
+AC_DEFUN([_AC_PROG_F90_V_OUTPUT],
+[AC_REQUIRE([AC_PROG_F90])dnl
+AC_LANG_PUSH(Fortran 90)dnl
+
+AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+
+# Compile and link our simple test program by passing a flag (argument
+# 1 to this macro) to the Fortran 90 compiler in order to get
+# "verbose" output that we can then parse for the Fortran 90 linker
+# flags.
+ac_save_F90FLAGS=$F90FLAGS
+F90FLAGS="$F90FLAGS m4_default([$1], [$ac_cv_prog_f90_v])"
+(eval echo $as_me:__oline__: \"$ac_link\") >&AS_MESSAGE_LOG_FD
+ac_f90_v_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1 | grep -v 'Driving:'`
+echo "$ac_f90_v_output" >&AS_MESSAGE_LOG_FD
+F90FLAGS=$ac_save_F90FLAGS
+
+rm -f conftest.*
+AC_LANG_POP(Fortran 90)dnl
+
+# If we are using xlf then replace all the commas with spaces.
+if echo $ac_f90_v_output | grep xlfentry >/dev/null 2>&1; then
+ ac_f90_v_output=`echo $ac_f90_v_output | sed 's/,/ /g'`
+fi
+
+# If we are using Cray Fortran then delete quotes.
+# Use "\"" instead of '"' for font-lock-mode.
+# FIXME: a more general fix for quoted arguments with spaces?
+if echo $ac_f90_v_output | grep cft90 >/dev/null 2>&1; then
+ ac_f90_v_output=`echo $ac_f90_v_output | sed "s/\"//g"`
+fi[]dnl
+])# _AC_PROG_F90_V_OUTPUT
+
+
+# _AC_PROG_F90_V
+# --------------
+#
+# Determine the flag that causes the Fortran 90 compiler to print
+# information of library and object files (normally -v)
+# Needed for AC_F90_LIBRARY_FLAGS
+# Some compilers don't accept -v (Lahey: -verbose, xlf: -V, Fujitsu: -###)
+AC_DEFUN([_AC_PROG_F90_V],
+[AC_CACHE_CHECK([how to get verbose linking output from $F90],
+ [ac_cv_prog_f90_v],
+[AC_LANG_ASSERT(Fortran 90)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+[ac_cv_prog_f90_v=
+# Try some options frequently used verbose output
+for ac_verb in -v -verbose --verbose -V -\#\#\#; do
+ _AC_PROG_F90_V_OUTPUT($ac_verb)
+ # look for -l* and *.a constructs in the output
+ for ac_arg in $ac_f90_v_output; do
+ case $ac_arg in
+ [[\\/]]*.a | ?:[[\\/]]*.a | -[[lLRu]]*)
+ ac_cv_prog_f90_v=$ac_verb
+ break 2 ;;
+ esac
+ done
+done
+if test -z "$ac_cv_prog_f90_v"; then
+ AC_MSG_WARN([cannot determine how to obtain linking information from $F90])
+fi],
+ [AC_MSG_WARN([compilation failed])])
+])])# _AC_PROG_F90_V
+
+
+# AC_F90_LIBRARY_LDFLAGS
+# ----------------------
+#
+# Determine the linker flags (e.g. "-L" and "-l") for the Fortran 90
+# intrinsic and run-time libraries that are required to successfully
+# link a Fortran 90 program or shared library. The output variable
+# F90LIBS is set to these flags.
+#
+# This macro is intended to be used in those situations when it is
+# necessary to mix, e.g. C++ and Fortran 90, source code into a single
+# program or shared library.
+#
+# For example, if object files from a C++ and Fortran 90 compiler must
+# be linked together, then the C++ compiler/linker must be used for
+# linking (since special C++-ish things need to happen at link time
+# like calling global constructors, instantiating templates, enabling
+# exception support, etc.).
+#
+# However, the Fortran 90 intrinsic and run-time libraries must be
+# linked in as well, but the C++ compiler/linker doesn't know how to
+# add these Fortran 90 libraries. Hence, the macro
+# "AC_F90_LIBRARY_LDFLAGS" was created to determine these Fortran 90
+# libraries.
+#
+# This macro was packaged in its current form by Matthew D. Langston.
+# However, nearly all of this macro came from the "OCTAVE_FLIBS" macro
+# in "octave-2.0.13/aclocal.m4", and full credit should go to John
+# W. Eaton for writing this extremely useful macro. Thank you John.
+AC_DEFUN([AC_F90_LIBRARY_LDFLAGS],
+[AC_LANG_PUSH(Fortran 90)dnl
+_AC_PROG_F90_V
+AC_CACHE_CHECK([for Fortran 90 libraries], ac_cv_flibs,
+[if test "x$F90LIBS" != "x"; then
+ ac_cv_f90libs="$F90LIBS" # Let the user override the test.
+else
+
+_AC_PROG_F90_V_OUTPUT
+
+ac_cv_f90libs=
+
+# Save positional arguments (if any)
+ac_save_positional="address@hidden"
+
+set X $ac_f90_v_output
+while test address@hidden:@] != 1; do
+ shift
+ ac_arg=$[1]
+ case $ac_arg in
+ [[\\/]]*.a | ?:[[\\/]]*.a)
+ AC_LIST_MEMBER_OF($ac_arg, $ac_cv_f90libs, ,
+ ac_cv_f90libs="$ac_cv_f90libs $ac_arg")
+ ;;
+ -bI:*)
+ AC_LIST_MEMBER_OF($ac_arg, $ac_cv_f90libs, ,
+ [AC_LINKER_OPTION([$ac_arg], ac_cv_f90libs)])
+ ;;
+ # Ignore these flags.
+ -lang* | -lcrt0.o | -lc | -lgcc | -LANG:=*)
+ ;;
+ -lkernel32)
+ test x"$CYGWIN" != xyes && ac_cv_f90libs="$ac_cv_f90libs $ac_arg"
+ ;;
+ -[[LRuY]])
+ # These flags, when seen by themselves, take an argument.
+ # We remove the space between option and argument and re-iterate
+ # unless we find an empty arg or a new option (starting with -)
+ case $[2] in
+ "" | -*);;
+ *)
+ ac_arg="$ac_arg$[2]"
+ shift; shift
+ set X $ac_arg "address@hidden"
+ ;;
+ esac
+ ;;
+ -YP,*)
+ for ac_j in `echo $ac_arg | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do
+ AC_LIST_MEMBER_OF($ac_j, $ac_cv_f90libs, ,
+ [ac_arg="$ac_arg $ac_j"
+ ac_cv_f90libs="$ac_cv_f90libs $ac_j"])
+ done
+ ;;
+ -[[lLR]]*)
+ AC_LIST_MEMBER_OF($ac_arg, $ac_cv_f90libs, ,
+ ac_cv_f90libs="$ac_cv_f90libs $ac_arg")
+ ;;
+ # Ignore everything else.
+ esac
+done
+# restore positional arguments
+set X $ac_save_positional; shift
+
+# We only consider "LD_RUN_PATH" on Solaris systems. If this is seen,
+# then we insist that the "run path" must be an absolute path (i.e. it
+# must begin with a "/").
+case `(uname -sr) 2>/dev/null` in
+ "SunOS 5"*)
+ ac_ld_run_path=`echo $ac_f90_v_output |
+ sed -n 's,^.*LD_RUN_PATH *= *\(/[[^ ]]*\).*$,-R\1,p'`
+ test "x$ac_ld_run_path" != x &&
+ AC_LINKER_OPTION([$ac_ld_run_path], ac_cv_f90libs)
+ ;;
+esac
+fi # test "x$F90LIBS" = "x"
+])
+F90LIBS="$ac_cv_f90libs"
+AC_SUBST(F90LIBS)
+AC_LANG_POP(Fortran 90)dnl
+])# AC_F90_LIBRARY_LDFLAGS
+
+
+# _AC_F90_NAME_MANGLING
+# ---------------------
+# Test for the name mangling scheme used by the Fortran 90 compiler.
+#
+# Sets ac_cv_f90_mangling. The value contains three fields, separated
+# by commas:
+#
+# lower case / upper case:
+# case translation of the Fortan 90 symbols
+# underscore / no underscore:
+# whether the compiler appends "_" to symbol names
+# extra underscore / no extra underscore:
+# whether the compiler appends an extra "_" to symbol names already
+# containing at least one underscore
+#
+AC_DEFUN([_AC_F90_NAME_MANGLING],
+[AC_REQUIRE([AC_F90_LIBRARY_LDFLAGS])dnl
+AC_CACHE_CHECK([for Fortran 90 name-mangling scheme],
+ ac_cv_f90_mangling,
+[AC_LANG_PUSH(Fortran 90)dnl
+AC_COMPILE_IFELSE(
+[subroutine foobar()
+return
+end
+subroutine foo_bar()
+return
+end],
+[mv conftest.$ac_objext cf90_test.$ac_objext
+
+ AC_LANG_PUSH(C)dnl
+
+ ac_save_LIBS=$LIBS
+ LIBS="cf90_test.$ac_objext $F90LIBS $LIBS"
+
+ ac_success=no
+ for ac_foobar in foobar FOOBAR; do
+ for ac_underscore in "" "_"; do
+ ac_func="$ac_foobar$ac_underscore"
+ AC_TRY_LINK_FUNC($ac_func,
+ [ac_success=yes; break 2])
+ done
+ done
+
+ if test "$ac_success" = "yes"; then
+ case $ac_foobar in
+ foobar)
+ ac_case=lower
+ ac_foo_bar=foo_bar
+ ;;
+ FOOBAR)
+ ac_case=upper
+ ac_foo_bar=FOO_BAR
+ ;;
+ esac
+
+ ac_success_extra=no
+ for ac_extra in "" "_"; do
+ ac_func="$ac_foo_bar$ac_underscore$ac_extra"
+ AC_TRY_LINK_FUNC($ac_func,
+ [ac_success_extra=yes; break])
+ done
+
+ if test "$ac_success_extra" = "yes"; then
+ ac_cv_f90_mangling="$ac_case case"
+ if test -z "$ac_underscore"; then
+ ac_cv_f90_mangling="$ac_cv_f90_mangling, no underscore"
+ else
+ ac_cv_f90_mangling="$ac_cv_f90_mangling, underscore"
+ fi
+ if test -z "$ac_extra"; then
+ ac_cv_f90_mangling="$ac_cv_f90_mangling, no extra underscore"
+ else
+ ac_cv_f90_mangling="$ac_cv_f90_mangling, extra underscore"
+ fi
+ else
+ ac_cv_f90_mangling="unknown"
+ fi
+ else
+ ac_cv_f90_mangling="unknown"
+ fi
+
+ LIBS=$ac_save_LIBS
+ AC_LANG_POP(C)dnl
+ rm -f cf90_test* conftest*])
+AC_LANG_POP(Fortran 90)dnl
+])
+])# _AC_F90_NAME_MANGLING
+
+# The replacement is empty.
+AU_DEFUN([AC_F90_NAME_MANGLING], [])
+
+
+# AC_F90_WRAPPERS
+# ---------------
+# Defines C macros F90_FUNC(name,NAME) and F90_FUNC_(name,NAME) to
+# properly mangle the names of C identifiers, and C identifiers with
+# underscores, respectively, so that they match the name mangling
+# scheme used by the Fortran 90 compiler.
+AC_DEFUN([AC_F90_WRAPPERS],
+[AC_REQUIRE([_AC_F90_NAME_MANGLING])dnl
+AH_TEMPLATE([F90_FUNC],
+ [Define to a macro mangling the given C identifier (in lower and upper
+ case), which must not contain underscores, for linking with Fortran
90.])dnl
+AH_TEMPLATE([F90_FUNC_],
+ [As F90_FUNC, but for C identifiers containing underscores.])dnl
+case $ac_cv_f90_mangling in
+ "lower case, no underscore, no extra underscore")
+ AC_DEFINE([F90_FUNC(name,NAME)], [name])
+ AC_DEFINE([F90_FUNC_(name,NAME)], [name]) ;;
+ "lower case, no underscore, extra underscore")
+ AC_DEFINE([F90_FUNC(name,NAME)], [name])
+ AC_DEFINE([F90_FUNC_(name,NAME)], [name ## _]) ;;
+ "lower case, underscore, no extra underscore")
+ AC_DEFINE([F90_FUNC(name,NAME)], [name ## _])
+ AC_DEFINE([F90_FUNC_(name,NAME)], [name ## _]) ;;
+ "lower case, underscore, extra underscore")
+ AC_DEFINE([F90_FUNC(name,NAME)], [name ## _])
+ AC_DEFINE([F90_FUNC_(name,NAME)], [name ## __]) ;;
+ "upper case, no underscore, no extra underscore")
+ AC_DEFINE([F90_FUNC(name,NAME)], [NAME])
+ AC_DEFINE([F90_FUNC_(name,NAME)], [NAME]) ;;
+ "upper case, no underscore, extra underscore")
+ AC_DEFINE([F90_FUNC(name,NAME)], [NAME])
+ AC_DEFINE([F90_FUNC_(name,NAME)], [NAME ## _]) ;;
+ "upper case, underscore, no extra underscore")
+ AC_DEFINE([F90_FUNC(name,NAME)], [NAME ## _])
+ AC_DEFINE([F90_FUNC_(name,NAME)], [NAME ## _]) ;;
+ "upper case, underscore, extra underscore")
+ AC_DEFINE([F90_FUNC(name,NAME)], [NAME ## _])
+ AC_DEFINE([F90_FUNC_(name,NAME)], [NAME ## __]) ;;
+ *)
+ AC_MSG_WARN([unknown Fortran 90 name-mangling scheme])
+ ;;
+esac
+])# AC_F90_WRAPPERS
+
+
+# AC_F90_FUNC(NAME, [SHELLVAR = NAME])
+# ------------------------------------
+# For a Fortran subroutine of given NAME, define a shell variable
+# $SHELLVAR to the Fortran 90 mangled name. If the SHELLVAR
+# argument is not supplied, it defaults to NAME.
+AC_DEFUN([AC_F90_FUNC],
+[AC_REQUIRE([_AC_F90_NAME_MANGLING])dnl
+case $ac_cv_f90_mangling in
+ upper*) ac_val="m4_toupper([$1])" ;;
+ lower*) ac_val="m4_tolower([$1])" ;;
+ *) ac_val="unknown" ;;
+esac
+case $ac_cv_f90_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac
+m4_if(m4_index([$1],[_]),-1,[],
+[case $ac_cv_f90_mangling in *," extra underscore"*) ac_val="$ac_val"_ ;; esac
+])
+m4_default([$2],[$1])="$ac_val"
+])# AC_F90_FUNC
+
+
+# ---------------------------------------- #
+# 4f. Fortan 95 compiler characteristics. #
+# ---------------------------------------- #
+
+
+# _AC_PROG_F95_V_OUTPUT([FLAG = $ac_cv_prog_f95_v])
+# -------------------------------------------------
+# Link a trivial Fortran program, compiling with a verbose output FLAG
+# (which default value, $ac_cv_prog_f95_v, is computed by
+# _AC_PROG_F95_V), and return the output in $ac_f95_v_output. This
+# output is processed in the way expected by AC_F95_LIBRARY_LDFLAGS,
+# so that any link flags that are echoed by the compiler appear as
+# space-separated items.
+AC_DEFUN([_AC_PROG_F95_V_OUTPUT],
+[AC_REQUIRE([AC_PROG_F95])dnl
+AC_LANG_PUSH(Fortran 95)dnl
+
+AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+
+# Compile and link our simple test program by passing a flag (argument
+# 1 to this macro) to the Fortran 95 compiler in order to get
+# "verbose" output that we can then parse for the Fortran 95 linker
+# flags.
+ac_save_F95FLAGS=$F95FLAGS
+F95FLAGS="$F95FLAGS m4_default([$1], [$ac_cv_prog_f95_v])"
+(eval echo $as_me:__oline__: \"$ac_link\") >&AS_MESSAGE_LOG_FD
+ac_f95_v_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1 | grep -v 'Driving:'`
+echo "$ac_f95_v_output" >&AS_MESSAGE_LOG_FD
+F95FLAGS=$ac_save_F95FLAGS
+
+rm -f conftest.*
+AC_LANG_POP(Fortran 95)dnl
+
+# If we are using xlf then replace all the commas with spaces.
+if echo $ac_f95_v_output | grep xlfentry >/dev/null 2>&1; then
+ ac_f95_v_output=`echo $ac_f95_v_output | sed 's/,/ /g'`
+fi
+
+# If we are using Cray Fortran then delete quotes.
+# Use "\"" instead of '"' for font-lock-mode.
+# FIXME: a more general fix for quoted arguments with spaces?
+if echo $ac_f95_v_output | grep cft95 >/dev/null 2>&1; then
+ ac_f95_v_output=`echo $ac_f95_v_output | sed "s/\"//g"`
+fi[]dnl
+])# _AC_PROG_F95_V_OUTPUT
+
+
+# _AC_PROG_F95_V
+# --------------
+#
+# Determine the flag that causes the Fortran 95 compiler to print
+# information of library and object files (normally -v)
+# Needed for AC_F95_LIBRARY_FLAGS
+# Some compilers don't accept -v (Lahey: -verbose, xlf: -V, Fujitsu: -###)
+AC_DEFUN([_AC_PROG_F95_V],
+[AC_CACHE_CHECK([how to get verbose linking output from $F95],
+ [ac_cv_prog_f95_v],
+[AC_LANG_ASSERT(Fortran 95)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+[ac_cv_prog_f95_v=
+# Try some options frequently used verbose output
+for ac_verb in -v -verbose --verbose -V -\#\#\#; do
+ _AC_PROG_F95_V_OUTPUT($ac_verb)
+ # look for -l* and *.a constructs in the output
+ for ac_arg in $ac_f95_v_output; do
+ case $ac_arg in
+ [[\\/]]*.a | ?:[[\\/]]*.a | -[[lLRu]]*)
+ ac_cv_prog_f95_v=$ac_verb
+ break 2 ;;
+ esac
+ done
+done
+if test -z "$ac_cv_prog_f95_v"; then
+ AC_MSG_WARN([cannot determine how to obtain linking information from $F95])
+fi],
+ [AC_MSG_WARN([compilation failed])])
+])])# _AC_PROG_F95_V
+
+
+# AC_F95_LIBRARY_LDFLAGS
+# ----------------------
+#
+# Determine the linker flags (e.g. "-L" and "-l") for the Fortran 95
+# intrinsic and run-time libraries that are required to successfully
+# link a Fortran 95 program or shared library. The output variable
+# F95LIBS is set to these flags.
+#
+# This macro is intended to be used in those situations when it is
+# necessary to mix, e.g. C++ and Fortran 95, source code into a single
+# program or shared library.
+#
+# For example, if object files from a C++ and Fortran 95 compiler must
+# be linked together, then the C++ compiler/linker must be used for
+# linking (since special C++-ish things need to happen at link time
+# like calling global constructors, instantiating templates, enabling
+# exception support, etc.).
+#
+# However, the Fortran 95 intrinsic and run-time libraries must be
+# linked in as well, but the C++ compiler/linker doesn't know how to
+# add these Fortran 95 libraries. Hence, the macro
+# "AC_F95_LIBRARY_LDFLAGS" was created to determine these Fortran 95
+# libraries.
+#
+# This macro was packaged in its current form by Matthew D. Langston.
+# However, nearly all of this macro came from the "OCTAVE_FLIBS" macro
+# in "octave-2.0.13/aclocal.m4", and full credit should go to John
+# W. Eaton for writing this extremely useful macro. Thank you John.
+AC_DEFUN([AC_F95_LIBRARY_LDFLAGS],
+[AC_LANG_PUSH(Fortran 95)dnl
+_AC_PROG_F95_V
+AC_CACHE_CHECK([for Fortran 95 libraries], ac_cv_flibs,
+[if test "x$F95LIBS" != "x"; then
+ ac_cv_f95libs="$F95LIBS" # Let the user override the test.
+else
+
+_AC_PROG_F95_V_OUTPUT
+
+ac_cv_f95libs=
+
+# Save positional arguments (if any)
+ac_save_positional="address@hidden"
+
+set X $ac_f95_v_output
+while test address@hidden:@] != 1; do
+ shift
+ ac_arg=$[1]
+ case $ac_arg in
+ [[\\/]]*.a | ?:[[\\/]]*.a)
+ AC_LIST_MEMBER_OF($ac_arg, $ac_cv_f95libs, ,
+ ac_cv_f95libs="$ac_cv_f95libs $ac_arg")
+ ;;
+ -bI:*)
+ AC_LIST_MEMBER_OF($ac_arg, $ac_cv_f95libs, ,
+ [AC_LINKER_OPTION([$ac_arg], ac_cv_f95libs)])
+ ;;
+ # Ignore these flags.
+ -lang* | -lcrt0.o | -lc | -lgcc | -LANG:=*)
+ ;;
+ -lkernel32)
+ test x"$CYGWIN" != xyes && ac_cv_f95libs="$ac_cv_f95libs $ac_arg"
+ ;;
+ -[[LRuY]])
+ # These flags, when seen by themselves, take an argument.
+ # We remove the space between option and argument and re-iterate
+ # unless we find an empty arg or a new option (starting with -)
+ case $[2] in
+ "" | -*);;
+ *)
+ ac_arg="$ac_arg$[2]"
+ shift; shift
+ set X $ac_arg "address@hidden"
+ ;;
+ esac
+ ;;
+ -YP,*)
+ for ac_j in `echo $ac_arg | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do
+ AC_LIST_MEMBER_OF($ac_j, $ac_cv_f95libs, ,
+ [ac_arg="$ac_arg $ac_j"
+ ac_cv_f95libs="$ac_cv_f95libs $ac_j"])
+ done
+ ;;
+ -[[lLR]]*)
+ AC_LIST_MEMBER_OF($ac_arg, $ac_cv_f95libs, ,
+ ac_cv_f95libs="$ac_cv_f95libs $ac_arg")
+ ;;
+ # Ignore everything else.
+ esac
+done
+# restore positional arguments
+set X $ac_save_positional; shift
+
+# We only consider "LD_RUN_PATH" on Solaris systems. If this is seen,
+# then we insist that the "run path" must be an absolute path (i.e. it
+# must begin with a "/").
+case `(uname -sr) 2>/dev/null` in
+ "SunOS 5"*)
+ ac_ld_run_path=`echo $ac_f95_v_output |
+ sed -n 's,^.*LD_RUN_PATH *= *\(/[[^ ]]*\).*$,-R\1,p'`
+ test "x$ac_ld_run_path" != x &&
+ AC_LINKER_OPTION([$ac_ld_run_path], ac_cv_f95libs)
+ ;;
+esac
+fi # test "x$F95LIBS" = "x"
+])
+F95LIBS="$ac_cv_f95libs"
+AC_SUBST(F95LIBS)
+AC_LANG_POP(Fortran 95)dnl
+])# AC_F95_LIBRARY_LDFLAGS
+
+
+# _AC_F95_NAME_MANGLING
+# ---------------------
+# Test for the name mangling scheme used by the Fortran 95 compiler.
+#
+# Sets ac_cv_f95_mangling. The value contains three fields, separated
+# by commas:
+#
+# lower case / upper case:
+# case translation of the Fortan 95 symbols
+# underscore / no underscore:
+# whether the compiler appends "_" to symbol names
+# extra underscore / no extra underscore:
+# whether the compiler appends an extra "_" to symbol names already
+# containing at least one underscore
+#
+AC_DEFUN([_AC_F95_NAME_MANGLING],
+[AC_REQUIRE([AC_F95_LIBRARY_LDFLAGS])dnl
+AC_CACHE_CHECK([for Fortran 95 name-mangling scheme],
+ ac_cv_f95_mangling,
+[AC_LANG_PUSH(Fortran 95)dnl
+AC_COMPILE_IFELSE(
+[subroutine foobar()
+return
+end
+subroutine foo_bar()
+return
+end],
+[mv conftest.$ac_objext cf95_test.$ac_objext
+
+ AC_LANG_PUSH(C)dnl
+
+ ac_save_LIBS=$LIBS
+ LIBS="cf95_test.$ac_objext $F95LIBS $LIBS"
+
+ ac_success=no
+ for ac_foobar in foobar FOOBAR; do
+ for ac_underscore in "" "_"; do
+ ac_func="$ac_foobar$ac_underscore"
+ AC_TRY_LINK_FUNC($ac_func,
+ [ac_success=yes; break 2])
+ done
+ done
+
+ if test "$ac_success" = "yes"; then
+ case $ac_foobar in
+ foobar)
+ ac_case=lower
+ ac_foo_bar=foo_bar
+ ;;
+ FOOBAR)
+ ac_case=upper
+ ac_foo_bar=FOO_BAR
+ ;;
+ esac
+
+ ac_success_extra=no
+ for ac_extra in "" "_"; do
+ ac_func="$ac_foo_bar$ac_underscore$ac_extra"
+ AC_TRY_LINK_FUNC($ac_func,
+ [ac_success_extra=yes; break])
+ done
+
+ if test "$ac_success_extra" = "yes"; then
+ ac_cv_f95_mangling="$ac_case case"
+ if test -z "$ac_underscore"; then
+ ac_cv_f95_mangling="$ac_cv_f95_mangling, no underscore"
+ else
+ ac_cv_f95_mangling="$ac_cv_f95_mangling, underscore"
+ fi
+ if test -z "$ac_extra"; then
+ ac_cv_f95_mangling="$ac_cv_f95_mangling, no extra underscore"
+ else
+ ac_cv_f95_mangling="$ac_cv_f95_mangling, extra underscore"
+ fi
+ else
+ ac_cv_f95_mangling="unknown"
+ fi
+ else
+ ac_cv_f95_mangling="unknown"
+ fi
+
+ LIBS=$ac_save_LIBS
+ AC_LANG_POP(C)dnl
+ rm -f cf95_test* conftest*])
+AC_LANG_POP(Fortran 95)dnl
+])
+])# _AC_F95_NAME_MANGLING
+
+# The replacement is empty.
+AU_DEFUN([AC_F95_NAME_MANGLING], [])
+
+
+# AC_F95_WRAPPERS
+# ---------------
+# Defines C macros F95_FUNC(name,NAME) and F95_FUNC_(name,NAME) to
+# properly mangle the names of C identifiers, and C identifiers with
+# underscores, respectively, so that they match the name mangling
+# scheme used by the Fortran 95 compiler.
+AC_DEFUN([AC_F95_WRAPPERS],
+[AC_REQUIRE([_AC_F95_NAME_MANGLING])dnl
+AH_TEMPLATE([F95_FUNC],
+ [Define to a macro mangling the given C identifier (in lower and upper
+ case), which must not contain underscores, for linking with Fortran
95.])dnl
+AH_TEMPLATE([F95_FUNC_],
+ [As F95_FUNC, but for C identifiers containing underscores.])dnl
+case $ac_cv_f95_mangling in
+ "lower case, no underscore, no extra underscore")
+ AC_DEFINE([F95_FUNC(name,NAME)], [name])
+ AC_DEFINE([F95_FUNC_(name,NAME)], [name]) ;;
+ "lower case, no underscore, extra underscore")
+ AC_DEFINE([F95_FUNC(name,NAME)], [name])
+ AC_DEFINE([F95_FUNC_(name,NAME)], [name ## _]) ;;
+ "lower case, underscore, no extra underscore")
+ AC_DEFINE([F95_FUNC(name,NAME)], [name ## _])
+ AC_DEFINE([F95_FUNC_(name,NAME)], [name ## _]) ;;
+ "lower case, underscore, extra underscore")
+ AC_DEFINE([F95_FUNC(name,NAME)], [name ## _])
+ AC_DEFINE([F95_FUNC_(name,NAME)], [name ## __]) ;;
+ "upper case, no underscore, no extra underscore")
+ AC_DEFINE([F95_FUNC(name,NAME)], [NAME])
+ AC_DEFINE([F95_FUNC_(name,NAME)], [NAME]) ;;
+ "upper case, no underscore, extra underscore")
+ AC_DEFINE([F95_FUNC(name,NAME)], [NAME])
+ AC_DEFINE([F95_FUNC_(name,NAME)], [NAME ## _]) ;;
+ "upper case, underscore, no extra underscore")
+ AC_DEFINE([F95_FUNC(name,NAME)], [NAME ## _])
+ AC_DEFINE([F95_FUNC_(name,NAME)], [NAME ## _]) ;;
+ "upper case, underscore, extra underscore")
+ AC_DEFINE([F95_FUNC(name,NAME)], [NAME ## _])
+ AC_DEFINE([F95_FUNC_(name,NAME)], [NAME ## __]) ;;
+ *)
+ AC_MSG_WARN([unknown Fortran 95 name-mangling scheme])
+ ;;
+esac
+])# AC_F95_WRAPPERS
+
+
+# AC_F95_FUNC(NAME, [SHELLVAR = NAME])
+# ------------------------------------
+# For a Fortran subroutine of given NAME, define a shell variable
+# $SHELLVAR to the Fortran 95 mangled name. If the SHELLVAR
+# argument is not supplied, it defaults to NAME.
+AC_DEFUN([AC_F95_FUNC],
+[AC_REQUIRE([_AC_F95_NAME_MANGLING])dnl
+case $ac_cv_f95_mangling in
+ upper*) ac_val="m4_toupper([$1])" ;;
+ lower*) ac_val="m4_tolower([$1])" ;;
+ *) ac_val="unknown" ;;
+esac
+case $ac_cv_f95_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac
+m4_if(m4_index([$1],[_]),-1,[],
+[case $ac_cv_f95_mangling in *," extra underscore"*) ac_val="$ac_val"_ ;; esac
+])
+m4_default([$2],[$1])="$ac_val"
+])# AC_F95_FUNC
--
Christian Marquardt
GFZ Potsdam, Div. 1 | Tel.: (+49) 331-288-1168
Am Telegrafenberg | Fax: (+49) 331-288-1732
D-14473 Potsdam | Email: address@hidden
- Fortran 90/95 support (autoconf),
marq <=