Page MenuHomeHEPForge

No OneTemporary

Index: trunk/src/vamp/m4/fortran.m4
===================================================================
--- trunk/src/vamp/m4/fortran.m4 (revision 5198)
+++ trunk/src/vamp/m4/fortran.m4 (revision 5199)
@@ -1,928 +1,934 @@
dnl fortran.m4 -- Fortran compiler checks beyond Autoconf built-ins
dnl
dnl The standard Fortran compiler test is AC_PROG_FC.
dnl At the end FC, FCFLAGS and FCFLAGS_f90 are set, if successful.
### Determine vendor and version string.
AC_DEFUN([WO_FC_GET_VENDOR_AND_VERSION],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_CACHE_CHECK([the compiler ID string],
[wo_cv_fc_id_string],
[dnl
$FC -V >conftest.log 2>&1
$FC -version >>conftest.log 2>&1
$FC --version >>conftest.log 2>&1
wo_fc_grep_GFORTRAN=`$GREP -i 'GNU Fortran' conftest.log | head -1`
wo_fc_grep_G95=`$GREP -i 'g95' conftest.log | $GREP -i 'gcc' | head -1`
wo_fc_grep_NAG=`$GREP 'NAG' conftest.log | head -1`
wo_fc_grep_Intel=`$GREP 'IFORT' conftest.log | head -1`
wo_fc_grep_Sun=`$GREP 'Sun' conftest.log | head -1`
wo_fc_grep_Lahey=`$GREP 'Lahey' conftest.log | head -1`
wo_fc_grep_PGF90=`$GREP 'pgf90' conftest.log | head -1`
wo_fc_grep_PGF95=`$GREP 'pgf95' conftest.log | head -1`
wo_fc_grep_PGHPF=`$GREP 'pghpf' conftest.log | head -1`
wo_fc_grep_default=`cat conftest.log | head -1`
if test -n "$wo_fc_grep_GFORTRAN"; then
wo_cv_fc_id_string=$wo_fc_grep_GFORTRAN
elif test -n "$wo_fc_grep_G95"; then
wo_cv_fc_id_string=$wo_fc_grep_G95
elif test -n "$wo_fc_grep_NAG"; then
wo_cv_fc_id_string=$wo_fc_grep_NAG
elif test -n "$wo_fc_grep_Intel"; then
wo_cv_fc_id_string=$wo_fc_grep_Intel
elif test -n "$wo_fc_grep_Sun"; then
wo_cv_fc_id_string=$wo_fc_grep_Sun
elif test -n "$wo_fc_grep_Lahey"; then
wo_cv_fc_id_string=$wo_fc_grep_Lahey
elif test -n "$wo_fc_grep_PGF90"; then
wo_cv_fc_id_string=$wo_fc_grep_PGF90
elif test -n "$wo_fc_grep_PGF95"; then
wo_cv_fc_id_string=$wo_fc_grep_PGF95
elif test -n "$wo_fc_grep_PGHPF"; then
wo_cv_fc_id_string=$wo_fc_grep_PGHPF
else
wo_cv_fc_id_string=$wo_fc_grep_default
fi
rm -f conftest.log
])
FC_ID_STRING="$wo_cv_fc_id_string"
AC_SUBST([FC_ID_STRING])
AC_CACHE_CHECK([the compiler vendor],
[wo_cv_fc_vendor],
[dnl
if test -n "$wo_fc_grep_GFORTRAN"; then
wo_cv_fc_vendor="gfortran"
elif test -n "$wo_fc_grep_G95"; then
wo_cv_fc_vendor="g95"
elif test -n "$wo_fc_grep_NAG"; then
wo_cv_fc_vendor="NAG"
elif test -n "$wo_fc_grep_Intel"; then
wo_cv_fc_vendor="Intel"
elif test -n "$wo_fc_grep_Sun"; then
wo_cv_fc_vendor="Sun"
elif test -n "$wo_fc_grep_Lahey"; then
wo_cv_fc_vendor="Lahey"
elif test -n "$wo_fc_grep_PGF90"; then
wo_cv_fc_vendor="PGI"
elif test -n "$wo_fc_grep_PGF95"; then
wo_cv_fc_vendor="PGI"
elif test -n "$wo_fc_grep_PGHPF"; then
wo_cv_fc_vendor="PGI"
else
wo_cv_fc_vendor="unknown"
fi
])
FC_VENDOR="$wo_cv_fc_vendor"
AC_SUBST([FC_VENDOR])
AM_CONDITIONAL([FC_IS_GFORTRAN],
[test "$FC_VENDOR" = gfortran])
AM_CONDITIONAL([FC_IS_NAG],
[test "$FC_VENDOR" = NAG])
AC_CACHE_CHECK([the compiler version],
[wo_cv_fc_version],
[dnl
case $FC_VENDOR in
gfortran)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`]
;;
g95)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.*g95 \([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`]
;;
NAG)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.* Release \([0-9][0-9]*\.[0-9][0-9]*.*$\)/\1/'`]
;;
Intel)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/[a-zA-Z\(\)]//g;s/[0-9]\{8\}$//g'`]
;;
Sun)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.* Fortran 95 \([0-9][0-9]*\.[0-9][0-9]*\) .*/\1/'`]
;;
PGI)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/[a-zA-Z\(\)]//g;s/^[0-9]\{2\}//g;s/32.*\|64.*//g'`]
;;
*)
wo_cv_fc_version="unknown"
;;
esac
])
FC_VERSION="$wo_cv_fc_version"
AC_SUBST([FC_VERSION])
### Catch insufficient object-orientation in gfortran 4.5/4.6
if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.3" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.4" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.3" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.4"; then
FC_IS_GFORTRAN_456="yes"
else
FC_IS_GFORTRAN_456="no"
fi
AC_SUBST([FC_IS_GFORTRAN_456])
-### Catch memory corruption in gfortran 4.7
-if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.3"; then
-FC_IS_GFORTRAN_47="yes"
+### Catch compiler bug for static builds in gfortran 4.7
+if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.0"; then
+FC_IS_GFORTRAN_470="yes"
else
-FC_IS_GFORTRAN_47="no"
+FC_IS_GFORTRAN_470="no"
fi
-AC_SUBST([FC_IS_GFORTRAN_47])
-
-AM_CONDITIONAL([FC_GFORTRAN_47],
- [test "$FC_IS_GFORTRAN_47" = "yes"])
+AC_SUBST([FC_IS_GFORTRAN_470])
AC_CACHE_CHECK([the major version],
[wo_cv_fc_major_version],
[wo_cv_fc_major_version=[`echo $wo_cv_fc_version | $SED -e 's/\([0-9][0-9]*\)\..*/\1/'`]
])
FC_MAJOR_VERSION="$wo_cv_fc_major_version"
AC_SUBST([FC_MAJOR_VERSION])
])
### end WO_FC_GET_VENDOR_AND_VERSION
AC_DEFUN([WO_FC_VETO_GFORTRAN_456],
[dnl
if test "$FC_IS_GFORTRAN_456" = "yes"; then
AC_MSG_NOTICE([error: ***************************************************************])
AC_MSG_NOTICE([error: gfortran 4.5/4.6 object orientation support insufficient.])
AC_MSG_ERROR([***************************************************************])
fi
])
+AC_DEFUN([WO_FC_VETO_GFORTRAN_470],
+[dnl
+if test "$FC_IS_GFORTRAN_470" = "yes"; then
+AC_MSG_NOTICE([error: ***************************************************************])
+AC_MSG_NOTICE([error: gfortran 4.7.0 due to a major bug for static builds disabled .])
+AC_MSG_ERROR([***************************************************************])
+fi
+])
+
### This actually obsolete, but we keep the code, in case there
### are further issues with gfortran 4.7
AC_DEFUN([WO_FC_WARN_GFORTRAN_47],
[dnl
if test "$FC_IS_GFORTRAN_47" = "yes" -a "$FC_PRECISION" = "quadruple"; then
AC_MSG_NOTICE([WARNING: ***************************************************************])
AC_MSG_NOTICE([WARNING: gfortran 4.7 scanning with quadruple precision might fail.])
AC_MSG_WARN([***************************************************************])
fi
])
### Determine Fortran flags and file extensions
AC_DEFUN([WO_FC_PARAMETERS],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_REQUIRE([_LT_COMPILER_PIC])
AC_LANG([Fortran])
AC_MSG_CHECKING([for $FC flags])
AC_MSG_RESULT([$FCFLAGS])
AC_MSG_CHECKING([for $FC flag to produce position-independent code])
AC_MSG_RESULT([$lt_prog_compiler_pic_FC])
FCFLAGS_PIC=$lt_prog_compiler_pic_FC
AC_SUBST([FCFLAGS_PIC])
AC_MSG_CHECKING([for $FC source extension])
AC_MSG_RESULT([$ac_fc_srcext])
FC_SRC_EXT=$ac_fc_srcext
AC_SUBST([FC_SRC_EXT])
AC_MSG_CHECKING([for object file extension])
AC_MSG_RESULT([$ac_objext])
OBJ_EXT=$ac_objext
AC_SUBST([OBJ_EXT])
])
### end WO_FC_PARAMETERS
### Determine runtime libraries
### The standard check is insufficient for some compilers
AC_DEFUN([WO_FC_LIBRARY_LDFLAGS],
[dnl
AC_REQUIRE([AC_PROG_FC])
case "$FC" in
nagfor*)
WO_NAGFOR_LIBRARY_LDFLAGS()
;;
*)
AC_FC_LIBRARY_LDFLAGS
;;
esac
])
### Check the NAG Fortran compiler
### Use the '-dryrun' feature and extract the libraries from the link command
### Note that the linker is gcc, not ld
AC_DEFUN([WO_NAGFOR_LIBRARY_LDFLAGS],
[dnl
AC_CACHE_CHECK([Fortran libraries of $FC],
[wo_cv_fc_libs],
[dnl
if test -z "$FCLIBS"; then
AC_LANG([Fortran])
AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
wo_save_fcflags=$FCFLAGS
FCFLAGS="-dryrun"
eval "set x $ac_link"
echo "set x $ac_link"
shift
_AS_ECHO_LOG([$[*]])
wo_nagfor_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1`
echo "$wo_nagfor_output" >&AS_MESSAGE_LOG_FD
FCFLAGS=$wo_save_fcflags
wo_cv_fc_libs=`echo $wo_nagfor_output | $SED -e 's/.* -o conftest \(.*\)$/\1/' | $SED -e "s/conftest.$ac_objext //"`
else
wo_cv_fc_libs=$FCLIBS
fi
])
FCLIBS=$wo_cv_fc_libs
AC_SUBST([FCLIBS])
])
### Check for basic F95 features
AC_DEFUN([WO_FC_CHECK_F95],
[dnl
AC_CACHE_CHECK([whether $FC supports Fortran 95 features],
[wo_cv_fc_supports_f95],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
integer, dimension(2) :: ii
integer :: i
type :: foo
integer, pointer :: bar => null ()
end type foo
forall (i = 1:2) ii(i) = i
contains
elemental function f(x)
real, intent(in) :: x
real :: f
f = x
end function f
pure function g (x) result (gx)
real, intent(in) :: x
real :: gx
gx = x
end function g
end program conftest
],
[wo_cv_fc_supports_f95="yes"],
[wo_cv_fc_supports_f95="no"])
])
FC_SUPPORTS_F95="$wo_cv_fc_supports_f95"
AC_SUBST([FC_SUPPORTS_F95])
if test "$FC_SUPPORTS_F95" = "no"; then
AC_MSG_NOTICE([error: ******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler is not a genuine F95 compiler, configure aborted.])
AC_MSG_ERROR([******************************************************************])
fi])
### end WO_FC_CHECK_F95
### Check for the TR15581 extensions (allocatable subobjects)
AC_DEFUN([WO_FC_CHECK_TR15581],
[AC_CACHE_CHECK([whether $FC supports allocatable subobjects],
[wo_cv_fc_allocatable],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
integer, dimension(:), allocatable :: bar
end type foo
end program conftest
],
[wo_cv_fc_allocatable="yes"],
[wo_cv_fc_allocatable="no"])
])
FC_SUPPORTS_ALLOCATABLE="$wo_cv_fc_allocatable"
AC_SUBST([FC_SUPPORTS_ALLOCATABLE])
if test "$FC_SUPPORTS_ALLOCATABLE" = "no"; then
AC_MSG_NOTICE([error: ****************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support allocatable structures, configure aborted.])
AC_MSG_ERROR([****************************************************************************])
fi])
### end WO_FC_CHECK_TR15581
### Check for allocatable scalars
AC_DEFUN([WO_FC_CHECK_ALLOCATABLE_SCALARS],
[AC_CACHE_CHECK([whether $FC supports allocatable scalars],
[wo_cv_fc_allocatable_scalars],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
integer, allocatable :: bar
end type foo
end program conftest
],
[wo_cv_fc_allocatable_scalars="yes"],
[wo_cv_fc_allocatable_scalars="no"])
])
FC_SUPPORTS_ALLOCATABLE_SCALARS="$wo_cv_fc_allocatable"
AC_SUBST([FC_SUPPORTS_ALLOCATABLE_SCALARS])
])
### end WO_FC_CHECK_ALLOCATABLE_SCALARS
### Check for the C bindings extensions of Fortran 2003
AC_DEFUN([WO_FC_CHECK_C_BINDING],
[AC_CACHE_CHECK([whether $FC supports ISO C binding and standard numeric types],
[wo_cv_fc_c_binding],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
use iso_c_binding
type, bind(c) :: t
integer(c_int) :: i
real(c_float) :: x1
real(c_double) :: x2
complex(c_float_complex) :: z1
complex(c_double_complex) :: z2
end type t
end program conftest
],
[wo_cv_fc_c_binding="yes"],
[wo_cv_fc_c_binding="no"])
])
FC_SUPPORTS_C_BINDING="$wo_cv_fc_c_binding"
AC_SUBST([FC_SUPPORTS_C_BINDING])
if test "$FC_SUPPORTS_C_BINDING" = "no"; then
AC_MSG_NOTICE([error: *******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support ISO C binding, configure aborted.])
AC_MSG_ERROR([********************************************************************])
fi
])
### end WO_FC_CHECK_C_BINDING
### Check for procedure pointers
AC_DEFUN([WO_FC_CHECK_PROCEDURE_POINTERS],
[AC_CACHE_CHECK([whether $FC supports procedure pointers (F2003)],
[wo_cv_prog_f03_procedure_pointers],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
procedure (proc_template), nopass, pointer :: proc => null ()
end type foo
abstract interface
subroutine proc_template ()
end subroutine proc_template
end interface
end program conftest
],
[wo_cv_prog_f03_procedure_pointers="yes"],
[wo_cv_prog_f03_procedure_pointers="no"])
])
FC_SUPPORTS_PROCEDURE_POINTERS="$wo_cv_prog_f03_procedure_pointers"
AC_SUBST([FC_SUPPORTS_PROCEDURE_POINTERS])
if test "$FC_SUPPORTS_PROCEDURE_POINTERS" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not understand procedure pointers, configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_PROCEDURE_POINTERS
### Check for the OO extensions of Fortran 2003
AC_DEFUN([WO_FC_CHECK_OO_FEATURES],
[AC_CACHE_CHECK([whether $FC supports OO features (F2003)],
[wo_cv_prog_f03_oo_features],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
module conftest
type, abstract :: foo
contains
procedure (proc_template), deferred :: proc
end type foo
type, extends (foo) :: foobar
contains
procedure :: proc
end type foobar
abstract interface
subroutine proc_template (f)
import foo
class(foo), intent(inout) :: f
end subroutine proc_template
end interface
contains
subroutine proc (f)
class(foobar), intent(inout) :: f
end subroutine proc
end module conftest
program main
use conftest
end program main
],
[wo_cv_prog_f03_oo_features="yes"],
[wo_cv_prog_f03_oo_features="no"])
])
FC_SUPPORTS_OO_FEATURES="$wo_cv_prog_f03_oo_features"
AC_SUBST([FC_SUPPORTS_OO_FEATURES])
])
### end WO_FC_CHECK_OO_FEATURES
### Check for the command line interface of Fortran 2003
### We actually have to link in order to check availability
AC_DEFUN([WO_FC_CHECK_CMDLINE],
[AC_CACHE_CHECK([whether $FC interfaces the command line (F2003)],
[wo_cv_fc_cmdline],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_LINK_IFELSE([dnl
program conftest
call get_command_argument (command_argument_count ())
end program conftest
],
[wo_cv_fc_cmdline="yes"],
[wo_cv_fc_cmdline="no"])
])
FC_SUPPORTS_CMDLINE="$wo_cv_fc_cmdline"
AC_SUBST([FC_SUPPORTS_CMDLINE])
if test "$FC_SUPPORTS_CMDLINE" = "no"; then
AC_MSG_NOTICE([error: ******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support get_command_argument; configure aborted.])
AC_MSG_ERROR([******************************************************************])
fi
])
### end WO_FC_CHECK_CMDLINE
### Check whether we can access environment variables (2003 standard)
### We actually have to link in order to check availability
AC_DEFUN([WO_FC_CHECK_ENVVAR],
[AC_CACHE_CHECK([whether $FC provides access to environment variables (F2003)],
[wo_cv_fc_envvar],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_LINK_IFELSE([dnl
program conftest
character(len=256) :: home
call get_environment_variable ("HOME", home)
end program conftest
],
[wo_cv_fc_envvar="yes"],
[wo_cv_fc_envvar="no"])
])
FC_SUPPORTS_ENVVAR="$wo_cv_fc_envvar"
AC_SUBST([FC_SUPPORTS_ENVVAR])
if test "$FC_SUPPORTS_ENVVAR" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support get_environment_variable; configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_ENVVAR
### Check whether the flush statement is supported
AC_DEFUN([WO_FC_CHECK_FLUSH],
[AC_CACHE_CHECK([whether $FC supports the flush statement (F2003)],
[wo_cv_fc_flush],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
implicit none
integer, parameter :: u=50
open (u, action="readwrite", status="scratch")
write (u, *) "test"
flush (u)
close (u)
end program conftest
],
[wo_cv_fc_flush="yes"],
[wo_cv_fc_flush="no"])
])
FC_SUPPORTS_FLUSH="$wo_cv_fc_flush"
AC_SUBST([FC_SUPPORTS_FLUSH])
if test "$FC_SUPPORTS_FLUSH" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support the flush statement; configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_FLUSH
### Check for iso_fortran_env
AC_DEFUN([WO_FC_CHECK_ISO_FORTRAN_ENV],
[AC_ARG_ENABLE([iso_fortran_env],
[AC_HELP_STRING([--disable-iso_fortran_env],
[disable use of iso_fortran_env, even if the compiler supports it]
)],
[], [enable_iso_fortran_env=yes]
)
if test "$enable_iso_fortran_env" = yes; then
AC_CACHE_CHECK([whether $FC supports iso_fortran_env (F2003)],
[wo_cv_fc_iso_fortran_env],
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
[AC_LINK_IFELSE(
[dnl
program conftest
use iso_fortran_env
implicit none
integer :: i
i = input_unit
i = output_unit
i = error_unit
i = iostat_end
i = iostat_eor
end program conftest
], [wo_cv_fc_iso_fortran_env=yes], [wo_cv_fc_iso_fortran_env=no]
)]
)
test "$wo_cv_fc_iso_fortran_env" = no && iso_fortran_env_stub=yes
else
AC_CHECKING([whether $FC supports iso_fortran_env (F2003)... disabled])
iso_fortran_env_stub=yes
fi
AM_CONDITIONAL([ISO_FORTRAN_ENV_STUB], [test -n "$iso_fortran_env_stub"])
]
)
### Check for wrapping of linker flags
### (nagfor 'feature': must be wrapped twice)
AC_DEFUN([WO_FC_CHECK_LDFLAGS_WRAPPING],
[AC_CACHE_CHECK([for wrapping of linker flags via -Wl],
[wo_cv_fc_ldflags_wrapping],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
ldflags_tmp=$LDFLAGS
LDFLAGS=-Wl,-rpath,/usr/lib
AC_LINK_IFELSE(AC_LANG_PROGRAM(),
[wo_cv_fc_ldflags_wrapping="once"],
[wo_cv_fc_ldflags_wrapping="unknown"])
if test "$wo_cv_fc_ldflags_wrapping" = "unknown"; then
LDFLAGS=-Wl,-Wl,,-rpath,,/usr/lib
AC_LINK_IFELSE(AC_LANG_PROGRAM(),
[wo_cv_fc_ldflags_wrapping="twice"])
fi
LDFLAGS=$ldflags_tmp
])
FC_LDFLAGS_WRAPPING="$wo_cv_fc_ldflags_wrapping"
AC_SUBST([FC_LDFLAGS_WRAPPING])
])
### end WO_FC_CHECK_LDFLAGS_WRAPPING
### Check for OpenMP support
AC_DEFUN([WO_FC_CHECK_OPENMP],
[AC_CACHE_CHECK([whether $FC supports OpenMP],
[wo_cv_fc_openmp],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
case $FC_VENDOR in
gfortran)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-fopenmp"
wo_cv_fc_openmp_header="use omp_lib"
;;
NAG)
wo_cv_fc_openmp="no"
;;
Intel)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-openmp"
wo_cv_fc_openmp_header="use omp_lib"
;;
PGI)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-mp"
wo_cv_fc_openmp_header=""
;;
*)
wo_cv_fc_openmp="no"
;;
esac
if test "$wo_cv_fc_openmp"="yes"; then
fcflags_tmp=$FCFLAGS
FCFLAGS="$wo_cv_fcflags_openmp $FCFLAGS"
unset OMP_NUM_THREADS
AC_RUN_IFELSE([dnl
program conftest
$wo_cv_fc_openmp_header
open (11, file="conftest.out", action="write", status="replace")
write (11, "(I0)") omp_get_max_threads ()
close (11)
end program conftest
],
[dnl
wo_cv_fc_openmp="yes"
wo_cv_fc_openmp_thread_limit=`cat conftest.out`],
[wo_cv_fc_openmp="no"],
[wo_cv_fc_openmp="maybe [cross-compiling]"])
FCFLAGS=$fcflags_tmp
fi
])
if test "$wo_cv_fc_openmp" = "yes"; then
AC_CACHE_CHECK([the default number of threads used by OpenMP],
[wo_cv_fc_openmp_thread_limit])
fi
FC_SUPPORTS_OPENMP="$wo_cv_fc_openmp"
AC_SUBST([FC_SUPPORTS_OPENMP])
])
### end WO_FC_CHECK_OPENMP
### Enable/disable OpenMP support
AC_DEFUN([WO_FC_SET_OPENMP],
[dnl
AC_REQUIRE([WO_FC_CHECK_OPENMP])
AC_ARG_ENABLE([fc_openmp],
[AS_HELP_STRING([--enable-fc-openmp],
[use OpenMP for the Fortran code [[no]]])])
AC_CACHE_CHECK([whether OpenMP is activated], [wo_cv_fc_use_openmp],
[dnl
if test "$FC_SUPPORTS_OPENMP" = "yes" -a "$enable_fc_openmp" = "yes"; then
wo_cv_fc_use_openmp="yes"
else
wo_cv_fc_use_openmp="no"
fi])
AM_CONDITIONAL([FC_USE_OPENMP],
[test "$wo_cv_fc_use_openmp" = "yes"])
AM_COND_IF([FC_USE_OPENMP],
[FC_OPENMP_ON=""
FC_OPENMP_OFF="!"
FCFLAGS_OPENMP="$wo_cv_fcflags_openmp"
FC_OPENMP_HEADER="$wo_cv_fc_openmp_header"
FC_OPENMP_DEFAULT_MAX_THREADS="$wo_cv_fc_openmp_thread_limit"
],
[FC_OPENMP_ON="!"
FC_OPENMP_OFF=""
FC_OPENMP_DEFAULT_MAX_THREADS="1"
])
AC_SUBST([FC_OPENMP_ON])
AC_SUBST([FC_OPENMP_OFF])
AC_SUBST([FCFLAGS_OPENMP])
AC_SUBST([FC_OPENMP_HEADER])
AC_SUBST([FC_OPENMP_DEFAULT_MAX_THREADS])
])
### end WO_FC_SET_OPENMP
### Check for profiling support
AC_DEFUN([WO_FC_CHECK_PROFILING],
[AC_CACHE_CHECK([whether $FC supports profiling via -pg],
[wo_cv_fc_profiling],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
fcflags_tmp=$FCFLAGS
FCFLAGS="-pg $FCFLAGS"
rm -f gmon.out
AC_RUN_IFELSE([dnl
program conftest
end program conftest
],
[dnl
if test -f gmon.out; then
wo_cv_fc_profiling="yes"
else
wo_cv_fc_profiling="no"
fi],
[wo_cv_fc_profiling="no"],
[wo_cv_fc_profiling="maybe [cross-compiling]"])
rm -f gmon.out
FCFLAGS=$fcflags_tmp
])
FC_SUPPORTS_PROFILING="$wo_cv_fc_profiling"
AC_SUBST([FC_SUPPORTS_PROFILING])
])
### end WO_FC_CHECK_PROFILING
### Enable/disable profiling support
AC_DEFUN([WO_FC_SET_PROFILING],
[dnl
AC_REQUIRE([WO_FC_CHECK_PROFILING])
AC_ARG_ENABLE([fc_profiling],
[AS_HELP_STRING([--enable-fc-profiling],
[use profiling for the Fortran code [[no]]])])
AC_CACHE_CHECK([whether profiling is activated], [wo_cv_fc_prof],
[dnl
if test "$FC_SUPPORTS_PROFILING" = "yes" -a "$enable_fc_profiling" = "yes"; then
wo_cv_fc_prof="yes"
FCFLAGS_PROFILING="-pg"
else
wo_cv_fc_prof="no"
FCFLAGS_PROFILING=""
fi])
AC_SUBST(FCFLAGS_PROFILING)
AM_CONDITIONAL([FC_USE_PROFILING],
[test -n "$FCFLAGS_PROFILING"])
])
### end WO_FC_SET_PROFILING
### Enable/disable impure Omega compilation
AC_DEFUN([WO_FC_SET_OMEGA_IMPURE],
[dnl
AC_REQUIRE([WO_FC_CHECK_F95])
AC_ARG_ENABLE([impure_omega],
[AS_HELP_STRING([--enable-fc-impure],
[compile Omega libraries impure [[no]]])])
AC_CACHE_CHECK([the default setting for impure omegalib], [wo_cv_fc_impure],
[dnl
if test "$impure_omega" = "yes" -o "$FC_SUPPORTS_F95" = "no"; then
wo_cv_fc_impure="yes"
else
wo_cv_fc_impure="no"
fi])
AM_CONDITIONAL([FC_IMPURE],
[test "$wo_cv_fc_impure" = "yes"])
])
### end WO_FC_OMEGA_IMPURE
### Check for quadruple precision support (real and complex!)
AC_DEFUN([WO_FC_CHECK_QUADRUPLE],
[dnl
AC_CACHE_CHECK([whether $FC permits quadruple real and complex],
[wo_cv_fc_quadruple],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
integer, parameter :: d=selected_real_kind(precision(1.)+1, range(1.)+1)
integer, parameter :: q=selected_real_kind(precision(1._d)+1, range(1._d))
real(kind=q) :: x
complex(kind=q) :: z
end program conftest
],
[wo_cv_fc_quadruple="yes"],
[wo_cv_fc_quadruple="no"])
])
FC_SUPPORTS_QUADRUPLE="$wo_cv_fc_quadruple"
AC_SUBST([FC_SUPPORTS_QUADRUPLE])
])
### end WO_FC_CHECK_QUADRUPLE
### Check for C quadruple precision support (real and complex!)
AC_DEFUN([WO_FC_CHECK_QUADRUPLE_C],
[dnl
AC_CACHE_CHECK([whether $FC permits quadruple-precision C types],
[wo_cv_fc_quadruple_c],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
use iso_c_binding
real(c_long_double) :: x
complex(c_long_double_complex) :: z
end program conftest
],
[wo_cv_fc_quadruple_c="yes"],
[wo_cv_fc_quadruple_c="no"])
])
FC_SUPPORTS_QUADRUPLE_C="$wo_cv_fc_quadruple_c"
AC_SUBST([FC_SUPPORTS_QUADRUPLE_C])
])
### end WO_FC_CHECK_QUADRUPLE_C
### Enable/disable quadruple precision and set default precision
AC_DEFUN([WO_FC_SET_PRECISION],
[dnl
AC_REQUIRE([WO_FC_CHECK_QUADRUPLE])
AC_ARG_ENABLE([fc_quadruple],
[AS_HELP_STRING([--enable-fc-quadruple],
[use quadruple precision in Fortran code [[no]]])])
if test "$enable_fc_quadruple" = "yes"; then
FC_QUAD_OR_SINGLE="quadruple"
else
FC_QUAD_OR_SINGLE="single"
fi
AC_SUBST([FC_QUAD_OR_SINGLE])
AC_CACHE_CHECK([the default numeric precision], [wo_cv_fc_precision],
[dnl
if test "$FC_SUPPORTS_QUADRUPLE" = "yes" \
-a "$FC_SUPPORTS_QUADRUPLE_C" = "yes" \
-a "$enable_fc_quadruple" = "yes"; then
wo_cv_fc_precision="quadruple"
wo_cv_fc_precision_c="c_long_double"
else
wo_cv_fc_precision="double"
wo_cv_fc_precision_c="c_double"
fi
])
FC_PRECISION="$wo_cv_fc_precision"
FC_PRECISION_C="$wo_cv_fc_precision_c"
AC_SUBST(FC_PRECISION)
AC_SUBST(FC_PRECISION_C)
AM_CONDITIONAL([FC_QUAD],
[test "$FC_PRECISION" = "quadruple"])
])
### end WO_FC_SET_PRECISION
### filename_case_conversion, define two variables LOWERCASE and
### UPPERCASE for /bin/sh filters that convert strings to lower
### and upper case, respectively
AC_DEFUN([WO_FC_FILENAME_CASE_CONVERSION],
[dnl
AC_SUBST([LOWERCASE])
AC_SUBST([UPPERCASE])
AC_PATH_PROGS(TR,tr)
AC_MSG_CHECKING([for case conversion])
if test -n "$TR"; then
LOWERCASE="$TR A-Z a-z"
UPPERCASE="$TR a-z A-Z"
WO_FC_FILENAME_CASE_CONVERSION_TEST
fi
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$TR works])
else
LOWERCASE="$SED y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
UPPERCASE="$SED y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/"
WO_FC_FILENAME_CASE_CONVERSION_TEST
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$SED works])
fi
fi])
### end WO_FC_FILE_CASE_CONVERSION
dnl
AC_DEFUN([WO_FC_FILENAME_CASE_CONVERSION_TEST],
[dnl
if test "`echo fOo | $LOWERCASE`" != "foo"; then
LOWERCASE=""
fi
if test "`echo fOo | $UPPERCASE`" != "FOO"; then
UPPERCASE=""
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl COMPILE_FC(VARIABLE, COMPILER, EXTENSION, MODULE,
dnl VALUE_SUCCESS, VALUE_FAILURE, KEEP)
dnl
AC_DEFUN([COMPILE_FC],
[cat >conftest.$3 <<__END__
$4
program conftest
print *, 42
end program conftest
__END__
$2 -o conftest conftest.$3 >/dev/null 2>&1
./conftest >conftest.out 2>/dev/null
if test 42 = "`$SED 's/ //g' conftest.out`"; then
$1="$5"
else
$1="$6"
fi
if test -z "$7"; then
rm -rf conftest* CONFTEST*
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl WO_FC_MODULE_FILE(NAME, EXTENSION, FORTRAN_COMPILER, SOURCE_EXTENSION)
dnl
AC_DEFUN([WO_FC_MODULE_FILE],
[AC_SUBST([$1])
AC_SUBST([$2])
AC_MSG_CHECKING([for Fortran90 module file naming convention])
COMPILE_FC([wo_result], [$3], [$4],
[module module_NAME
implicit none
integer, parameter, public :: forty_two = 42
end module module_NAME], [ok], [], [KEEP])
if test -n "[$]wo_result"; then
$1=unknown
$2=unknown
for name in module_name module_NAME MODULE_NAME conftest; do
for ext in m mod M MOD d D; do
if test -f "[$]name.[$]ext"; then
$1="$name"
$2="$ext"
break 2
fi
done
done
if test X"[$]$1" = X"module_name"; then
AC_MSG_RESULT([name: [$]$1, extension: .[$]$2 ])
else
AC_MSG_ERROR([unusual unsupported module file name convention: [$]$1.[$]$2])
fi
else
$1=""
$2=""
AC_MSG_RESULT([compiler failed])
AC_MSG_NOTICE([error: **************************************************************])
AC_MSG_NOTICE([error: Fortran compiler cannot create proper module files. This])
AC_MSG_NOTICE([error: might be caused by linking against a wrong gcc library.])
AC_MSG_ERROR([**************************************************************])
fi
rm -rf conftest* CONFTEST* module_name* module_NAME* MODULE_NAME*])
Index: trunk/src/circe1/m4/fortran.m4
===================================================================
--- trunk/src/circe1/m4/fortran.m4 (revision 5198)
+++ trunk/src/circe1/m4/fortran.m4 (revision 5199)
@@ -1,928 +1,934 @@
dnl fortran.m4 -- Fortran compiler checks beyond Autoconf built-ins
dnl
dnl The standard Fortran compiler test is AC_PROG_FC.
dnl At the end FC, FCFLAGS and FCFLAGS_f90 are set, if successful.
### Determine vendor and version string.
AC_DEFUN([WO_FC_GET_VENDOR_AND_VERSION],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_CACHE_CHECK([the compiler ID string],
[wo_cv_fc_id_string],
[dnl
$FC -V >conftest.log 2>&1
$FC -version >>conftest.log 2>&1
$FC --version >>conftest.log 2>&1
wo_fc_grep_GFORTRAN=`$GREP -i 'GNU Fortran' conftest.log | head -1`
wo_fc_grep_G95=`$GREP -i 'g95' conftest.log | $GREP -i 'gcc' | head -1`
wo_fc_grep_NAG=`$GREP 'NAG' conftest.log | head -1`
wo_fc_grep_Intel=`$GREP 'IFORT' conftest.log | head -1`
wo_fc_grep_Sun=`$GREP 'Sun' conftest.log | head -1`
wo_fc_grep_Lahey=`$GREP 'Lahey' conftest.log | head -1`
wo_fc_grep_PGF90=`$GREP 'pgf90' conftest.log | head -1`
wo_fc_grep_PGF95=`$GREP 'pgf95' conftest.log | head -1`
wo_fc_grep_PGHPF=`$GREP 'pghpf' conftest.log | head -1`
wo_fc_grep_default=`cat conftest.log | head -1`
if test -n "$wo_fc_grep_GFORTRAN"; then
wo_cv_fc_id_string=$wo_fc_grep_GFORTRAN
elif test -n "$wo_fc_grep_G95"; then
wo_cv_fc_id_string=$wo_fc_grep_G95
elif test -n "$wo_fc_grep_NAG"; then
wo_cv_fc_id_string=$wo_fc_grep_NAG
elif test -n "$wo_fc_grep_Intel"; then
wo_cv_fc_id_string=$wo_fc_grep_Intel
elif test -n "$wo_fc_grep_Sun"; then
wo_cv_fc_id_string=$wo_fc_grep_Sun
elif test -n "$wo_fc_grep_Lahey"; then
wo_cv_fc_id_string=$wo_fc_grep_Lahey
elif test -n "$wo_fc_grep_PGF90"; then
wo_cv_fc_id_string=$wo_fc_grep_PGF90
elif test -n "$wo_fc_grep_PGF95"; then
wo_cv_fc_id_string=$wo_fc_grep_PGF95
elif test -n "$wo_fc_grep_PGHPF"; then
wo_cv_fc_id_string=$wo_fc_grep_PGHPF
else
wo_cv_fc_id_string=$wo_fc_grep_default
fi
rm -f conftest.log
])
FC_ID_STRING="$wo_cv_fc_id_string"
AC_SUBST([FC_ID_STRING])
AC_CACHE_CHECK([the compiler vendor],
[wo_cv_fc_vendor],
[dnl
if test -n "$wo_fc_grep_GFORTRAN"; then
wo_cv_fc_vendor="gfortran"
elif test -n "$wo_fc_grep_G95"; then
wo_cv_fc_vendor="g95"
elif test -n "$wo_fc_grep_NAG"; then
wo_cv_fc_vendor="NAG"
elif test -n "$wo_fc_grep_Intel"; then
wo_cv_fc_vendor="Intel"
elif test -n "$wo_fc_grep_Sun"; then
wo_cv_fc_vendor="Sun"
elif test -n "$wo_fc_grep_Lahey"; then
wo_cv_fc_vendor="Lahey"
elif test -n "$wo_fc_grep_PGF90"; then
wo_cv_fc_vendor="PGI"
elif test -n "$wo_fc_grep_PGF95"; then
wo_cv_fc_vendor="PGI"
elif test -n "$wo_fc_grep_PGHPF"; then
wo_cv_fc_vendor="PGI"
else
wo_cv_fc_vendor="unknown"
fi
])
FC_VENDOR="$wo_cv_fc_vendor"
AC_SUBST([FC_VENDOR])
AM_CONDITIONAL([FC_IS_GFORTRAN],
[test "$FC_VENDOR" = gfortran])
AM_CONDITIONAL([FC_IS_NAG],
[test "$FC_VENDOR" = NAG])
AC_CACHE_CHECK([the compiler version],
[wo_cv_fc_version],
[dnl
case $FC_VENDOR in
gfortran)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`]
;;
g95)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.*g95 \([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`]
;;
NAG)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.* Release \([0-9][0-9]*\.[0-9][0-9]*.*$\)/\1/'`]
;;
Intel)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/[a-zA-Z\(\)]//g;s/[0-9]\{8\}$//g'`]
;;
Sun)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.* Fortran 95 \([0-9][0-9]*\.[0-9][0-9]*\) .*/\1/'`]
;;
PGI)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/[a-zA-Z\(\)]//g;s/^[0-9]\{2\}//g;s/32.*\|64.*//g'`]
;;
*)
wo_cv_fc_version="unknown"
;;
esac
])
FC_VERSION="$wo_cv_fc_version"
AC_SUBST([FC_VERSION])
### Catch insufficient object-orientation in gfortran 4.5/4.6
if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.3" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.4" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.3" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.4"; then
FC_IS_GFORTRAN_456="yes"
else
FC_IS_GFORTRAN_456="no"
fi
AC_SUBST([FC_IS_GFORTRAN_456])
-### Catch memory corruption in gfortran 4.7
-if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.3"; then
-FC_IS_GFORTRAN_47="yes"
+### Catch compiler bug for static builds in gfortran 4.7
+if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.0"; then
+FC_IS_GFORTRAN_470="yes"
else
-FC_IS_GFORTRAN_47="no"
+FC_IS_GFORTRAN_470="no"
fi
-AC_SUBST([FC_IS_GFORTRAN_47])
-
-AM_CONDITIONAL([FC_GFORTRAN_47],
- [test "$FC_IS_GFORTRAN_47" = "yes"])
+AC_SUBST([FC_IS_GFORTRAN_470])
AC_CACHE_CHECK([the major version],
[wo_cv_fc_major_version],
[wo_cv_fc_major_version=[`echo $wo_cv_fc_version | $SED -e 's/\([0-9][0-9]*\)\..*/\1/'`]
])
FC_MAJOR_VERSION="$wo_cv_fc_major_version"
AC_SUBST([FC_MAJOR_VERSION])
])
### end WO_FC_GET_VENDOR_AND_VERSION
AC_DEFUN([WO_FC_VETO_GFORTRAN_456],
[dnl
if test "$FC_IS_GFORTRAN_456" = "yes"; then
AC_MSG_NOTICE([error: ***************************************************************])
AC_MSG_NOTICE([error: gfortran 4.5/4.6 object orientation support insufficient.])
AC_MSG_ERROR([***************************************************************])
fi
])
+AC_DEFUN([WO_FC_VETO_GFORTRAN_470],
+[dnl
+if test "$FC_IS_GFORTRAN_470" = "yes"; then
+AC_MSG_NOTICE([error: ***************************************************************])
+AC_MSG_NOTICE([error: gfortran 4.7.0 due to a major bug for static builds disabled .])
+AC_MSG_ERROR([***************************************************************])
+fi
+])
+
### This actually obsolete, but we keep the code, in case there
### are further issues with gfortran 4.7
AC_DEFUN([WO_FC_WARN_GFORTRAN_47],
[dnl
if test "$FC_IS_GFORTRAN_47" = "yes" -a "$FC_PRECISION" = "quadruple"; then
AC_MSG_NOTICE([WARNING: ***************************************************************])
AC_MSG_NOTICE([WARNING: gfortran 4.7 scanning with quadruple precision might fail.])
AC_MSG_WARN([***************************************************************])
fi
])
### Determine Fortran flags and file extensions
AC_DEFUN([WO_FC_PARAMETERS],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_REQUIRE([_LT_COMPILER_PIC])
AC_LANG([Fortran])
AC_MSG_CHECKING([for $FC flags])
AC_MSG_RESULT([$FCFLAGS])
AC_MSG_CHECKING([for $FC flag to produce position-independent code])
AC_MSG_RESULT([$lt_prog_compiler_pic_FC])
FCFLAGS_PIC=$lt_prog_compiler_pic_FC
AC_SUBST([FCFLAGS_PIC])
AC_MSG_CHECKING([for $FC source extension])
AC_MSG_RESULT([$ac_fc_srcext])
FC_SRC_EXT=$ac_fc_srcext
AC_SUBST([FC_SRC_EXT])
AC_MSG_CHECKING([for object file extension])
AC_MSG_RESULT([$ac_objext])
OBJ_EXT=$ac_objext
AC_SUBST([OBJ_EXT])
])
### end WO_FC_PARAMETERS
### Determine runtime libraries
### The standard check is insufficient for some compilers
AC_DEFUN([WO_FC_LIBRARY_LDFLAGS],
[dnl
AC_REQUIRE([AC_PROG_FC])
case "$FC" in
nagfor*)
WO_NAGFOR_LIBRARY_LDFLAGS()
;;
*)
AC_FC_LIBRARY_LDFLAGS
;;
esac
])
### Check the NAG Fortran compiler
### Use the '-dryrun' feature and extract the libraries from the link command
### Note that the linker is gcc, not ld
AC_DEFUN([WO_NAGFOR_LIBRARY_LDFLAGS],
[dnl
AC_CACHE_CHECK([Fortran libraries of $FC],
[wo_cv_fc_libs],
[dnl
if test -z "$FCLIBS"; then
AC_LANG([Fortran])
AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
wo_save_fcflags=$FCFLAGS
FCFLAGS="-dryrun"
eval "set x $ac_link"
echo "set x $ac_link"
shift
_AS_ECHO_LOG([$[*]])
wo_nagfor_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1`
echo "$wo_nagfor_output" >&AS_MESSAGE_LOG_FD
FCFLAGS=$wo_save_fcflags
wo_cv_fc_libs=`echo $wo_nagfor_output | $SED -e 's/.* -o conftest \(.*\)$/\1/' | $SED -e "s/conftest.$ac_objext //"`
else
wo_cv_fc_libs=$FCLIBS
fi
])
FCLIBS=$wo_cv_fc_libs
AC_SUBST([FCLIBS])
])
### Check for basic F95 features
AC_DEFUN([WO_FC_CHECK_F95],
[dnl
AC_CACHE_CHECK([whether $FC supports Fortran 95 features],
[wo_cv_fc_supports_f95],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
integer, dimension(2) :: ii
integer :: i
type :: foo
integer, pointer :: bar => null ()
end type foo
forall (i = 1:2) ii(i) = i
contains
elemental function f(x)
real, intent(in) :: x
real :: f
f = x
end function f
pure function g (x) result (gx)
real, intent(in) :: x
real :: gx
gx = x
end function g
end program conftest
],
[wo_cv_fc_supports_f95="yes"],
[wo_cv_fc_supports_f95="no"])
])
FC_SUPPORTS_F95="$wo_cv_fc_supports_f95"
AC_SUBST([FC_SUPPORTS_F95])
if test "$FC_SUPPORTS_F95" = "no"; then
AC_MSG_NOTICE([error: ******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler is not a genuine F95 compiler, configure aborted.])
AC_MSG_ERROR([******************************************************************])
fi])
### end WO_FC_CHECK_F95
### Check for the TR15581 extensions (allocatable subobjects)
AC_DEFUN([WO_FC_CHECK_TR15581],
[AC_CACHE_CHECK([whether $FC supports allocatable subobjects],
[wo_cv_fc_allocatable],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
integer, dimension(:), allocatable :: bar
end type foo
end program conftest
],
[wo_cv_fc_allocatable="yes"],
[wo_cv_fc_allocatable="no"])
])
FC_SUPPORTS_ALLOCATABLE="$wo_cv_fc_allocatable"
AC_SUBST([FC_SUPPORTS_ALLOCATABLE])
if test "$FC_SUPPORTS_ALLOCATABLE" = "no"; then
AC_MSG_NOTICE([error: ****************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support allocatable structures, configure aborted.])
AC_MSG_ERROR([****************************************************************************])
fi])
### end WO_FC_CHECK_TR15581
### Check for allocatable scalars
AC_DEFUN([WO_FC_CHECK_ALLOCATABLE_SCALARS],
[AC_CACHE_CHECK([whether $FC supports allocatable scalars],
[wo_cv_fc_allocatable_scalars],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
integer, allocatable :: bar
end type foo
end program conftest
],
[wo_cv_fc_allocatable_scalars="yes"],
[wo_cv_fc_allocatable_scalars="no"])
])
FC_SUPPORTS_ALLOCATABLE_SCALARS="$wo_cv_fc_allocatable"
AC_SUBST([FC_SUPPORTS_ALLOCATABLE_SCALARS])
])
### end WO_FC_CHECK_ALLOCATABLE_SCALARS
### Check for the C bindings extensions of Fortran 2003
AC_DEFUN([WO_FC_CHECK_C_BINDING],
[AC_CACHE_CHECK([whether $FC supports ISO C binding and standard numeric types],
[wo_cv_fc_c_binding],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
use iso_c_binding
type, bind(c) :: t
integer(c_int) :: i
real(c_float) :: x1
real(c_double) :: x2
complex(c_float_complex) :: z1
complex(c_double_complex) :: z2
end type t
end program conftest
],
[wo_cv_fc_c_binding="yes"],
[wo_cv_fc_c_binding="no"])
])
FC_SUPPORTS_C_BINDING="$wo_cv_fc_c_binding"
AC_SUBST([FC_SUPPORTS_C_BINDING])
if test "$FC_SUPPORTS_C_BINDING" = "no"; then
AC_MSG_NOTICE([error: *******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support ISO C binding, configure aborted.])
AC_MSG_ERROR([********************************************************************])
fi
])
### end WO_FC_CHECK_C_BINDING
### Check for procedure pointers
AC_DEFUN([WO_FC_CHECK_PROCEDURE_POINTERS],
[AC_CACHE_CHECK([whether $FC supports procedure pointers (F2003)],
[wo_cv_prog_f03_procedure_pointers],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
procedure (proc_template), nopass, pointer :: proc => null ()
end type foo
abstract interface
subroutine proc_template ()
end subroutine proc_template
end interface
end program conftest
],
[wo_cv_prog_f03_procedure_pointers="yes"],
[wo_cv_prog_f03_procedure_pointers="no"])
])
FC_SUPPORTS_PROCEDURE_POINTERS="$wo_cv_prog_f03_procedure_pointers"
AC_SUBST([FC_SUPPORTS_PROCEDURE_POINTERS])
if test "$FC_SUPPORTS_PROCEDURE_POINTERS" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not understand procedure pointers, configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_PROCEDURE_POINTERS
### Check for the OO extensions of Fortran 2003
AC_DEFUN([WO_FC_CHECK_OO_FEATURES],
[AC_CACHE_CHECK([whether $FC supports OO features (F2003)],
[wo_cv_prog_f03_oo_features],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
module conftest
type, abstract :: foo
contains
procedure (proc_template), deferred :: proc
end type foo
type, extends (foo) :: foobar
contains
procedure :: proc
end type foobar
abstract interface
subroutine proc_template (f)
import foo
class(foo), intent(inout) :: f
end subroutine proc_template
end interface
contains
subroutine proc (f)
class(foobar), intent(inout) :: f
end subroutine proc
end module conftest
program main
use conftest
end program main
],
[wo_cv_prog_f03_oo_features="yes"],
[wo_cv_prog_f03_oo_features="no"])
])
FC_SUPPORTS_OO_FEATURES="$wo_cv_prog_f03_oo_features"
AC_SUBST([FC_SUPPORTS_OO_FEATURES])
])
### end WO_FC_CHECK_OO_FEATURES
### Check for the command line interface of Fortran 2003
### We actually have to link in order to check availability
AC_DEFUN([WO_FC_CHECK_CMDLINE],
[AC_CACHE_CHECK([whether $FC interfaces the command line (F2003)],
[wo_cv_fc_cmdline],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_LINK_IFELSE([dnl
program conftest
call get_command_argument (command_argument_count ())
end program conftest
],
[wo_cv_fc_cmdline="yes"],
[wo_cv_fc_cmdline="no"])
])
FC_SUPPORTS_CMDLINE="$wo_cv_fc_cmdline"
AC_SUBST([FC_SUPPORTS_CMDLINE])
if test "$FC_SUPPORTS_CMDLINE" = "no"; then
AC_MSG_NOTICE([error: ******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support get_command_argument; configure aborted.])
AC_MSG_ERROR([******************************************************************])
fi
])
### end WO_FC_CHECK_CMDLINE
### Check whether we can access environment variables (2003 standard)
### We actually have to link in order to check availability
AC_DEFUN([WO_FC_CHECK_ENVVAR],
[AC_CACHE_CHECK([whether $FC provides access to environment variables (F2003)],
[wo_cv_fc_envvar],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_LINK_IFELSE([dnl
program conftest
character(len=256) :: home
call get_environment_variable ("HOME", home)
end program conftest
],
[wo_cv_fc_envvar="yes"],
[wo_cv_fc_envvar="no"])
])
FC_SUPPORTS_ENVVAR="$wo_cv_fc_envvar"
AC_SUBST([FC_SUPPORTS_ENVVAR])
if test "$FC_SUPPORTS_ENVVAR" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support get_environment_variable; configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_ENVVAR
### Check whether the flush statement is supported
AC_DEFUN([WO_FC_CHECK_FLUSH],
[AC_CACHE_CHECK([whether $FC supports the flush statement (F2003)],
[wo_cv_fc_flush],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
implicit none
integer, parameter :: u=50
open (u, action="readwrite", status="scratch")
write (u, *) "test"
flush (u)
close (u)
end program conftest
],
[wo_cv_fc_flush="yes"],
[wo_cv_fc_flush="no"])
])
FC_SUPPORTS_FLUSH="$wo_cv_fc_flush"
AC_SUBST([FC_SUPPORTS_FLUSH])
if test "$FC_SUPPORTS_FLUSH" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support the flush statement; configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_FLUSH
### Check for iso_fortran_env
AC_DEFUN([WO_FC_CHECK_ISO_FORTRAN_ENV],
[AC_ARG_ENABLE([iso_fortran_env],
[AC_HELP_STRING([--disable-iso_fortran_env],
[disable use of iso_fortran_env, even if the compiler supports it]
)],
[], [enable_iso_fortran_env=yes]
)
if test "$enable_iso_fortran_env" = yes; then
AC_CACHE_CHECK([whether $FC supports iso_fortran_env (F2003)],
[wo_cv_fc_iso_fortran_env],
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
[AC_LINK_IFELSE(
[dnl
program conftest
use iso_fortran_env
implicit none
integer :: i
i = input_unit
i = output_unit
i = error_unit
i = iostat_end
i = iostat_eor
end program conftest
], [wo_cv_fc_iso_fortran_env=yes], [wo_cv_fc_iso_fortran_env=no]
)]
)
test "$wo_cv_fc_iso_fortran_env" = no && iso_fortran_env_stub=yes
else
AC_CHECKING([whether $FC supports iso_fortran_env (F2003)... disabled])
iso_fortran_env_stub=yes
fi
AM_CONDITIONAL([ISO_FORTRAN_ENV_STUB], [test -n "$iso_fortran_env_stub"])
]
)
### Check for wrapping of linker flags
### (nagfor 'feature': must be wrapped twice)
AC_DEFUN([WO_FC_CHECK_LDFLAGS_WRAPPING],
[AC_CACHE_CHECK([for wrapping of linker flags via -Wl],
[wo_cv_fc_ldflags_wrapping],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
ldflags_tmp=$LDFLAGS
LDFLAGS=-Wl,-rpath,/usr/lib
AC_LINK_IFELSE(AC_LANG_PROGRAM(),
[wo_cv_fc_ldflags_wrapping="once"],
[wo_cv_fc_ldflags_wrapping="unknown"])
if test "$wo_cv_fc_ldflags_wrapping" = "unknown"; then
LDFLAGS=-Wl,-Wl,,-rpath,,/usr/lib
AC_LINK_IFELSE(AC_LANG_PROGRAM(),
[wo_cv_fc_ldflags_wrapping="twice"])
fi
LDFLAGS=$ldflags_tmp
])
FC_LDFLAGS_WRAPPING="$wo_cv_fc_ldflags_wrapping"
AC_SUBST([FC_LDFLAGS_WRAPPING])
])
### end WO_FC_CHECK_LDFLAGS_WRAPPING
### Check for OpenMP support
AC_DEFUN([WO_FC_CHECK_OPENMP],
[AC_CACHE_CHECK([whether $FC supports OpenMP],
[wo_cv_fc_openmp],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
case $FC_VENDOR in
gfortran)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-fopenmp"
wo_cv_fc_openmp_header="use omp_lib"
;;
NAG)
wo_cv_fc_openmp="no"
;;
Intel)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-openmp"
wo_cv_fc_openmp_header="use omp_lib"
;;
PGI)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-mp"
wo_cv_fc_openmp_header=""
;;
*)
wo_cv_fc_openmp="no"
;;
esac
if test "$wo_cv_fc_openmp"="yes"; then
fcflags_tmp=$FCFLAGS
FCFLAGS="$wo_cv_fcflags_openmp $FCFLAGS"
unset OMP_NUM_THREADS
AC_RUN_IFELSE([dnl
program conftest
$wo_cv_fc_openmp_header
open (11, file="conftest.out", action="write", status="replace")
write (11, "(I0)") omp_get_max_threads ()
close (11)
end program conftest
],
[dnl
wo_cv_fc_openmp="yes"
wo_cv_fc_openmp_thread_limit=`cat conftest.out`],
[wo_cv_fc_openmp="no"],
[wo_cv_fc_openmp="maybe [cross-compiling]"])
FCFLAGS=$fcflags_tmp
fi
])
if test "$wo_cv_fc_openmp" = "yes"; then
AC_CACHE_CHECK([the default number of threads used by OpenMP],
[wo_cv_fc_openmp_thread_limit])
fi
FC_SUPPORTS_OPENMP="$wo_cv_fc_openmp"
AC_SUBST([FC_SUPPORTS_OPENMP])
])
### end WO_FC_CHECK_OPENMP
### Enable/disable OpenMP support
AC_DEFUN([WO_FC_SET_OPENMP],
[dnl
AC_REQUIRE([WO_FC_CHECK_OPENMP])
AC_ARG_ENABLE([fc_openmp],
[AS_HELP_STRING([--enable-fc-openmp],
[use OpenMP for the Fortran code [[no]]])])
AC_CACHE_CHECK([whether OpenMP is activated], [wo_cv_fc_use_openmp],
[dnl
if test "$FC_SUPPORTS_OPENMP" = "yes" -a "$enable_fc_openmp" = "yes"; then
wo_cv_fc_use_openmp="yes"
else
wo_cv_fc_use_openmp="no"
fi])
AM_CONDITIONAL([FC_USE_OPENMP],
[test "$wo_cv_fc_use_openmp" = "yes"])
AM_COND_IF([FC_USE_OPENMP],
[FC_OPENMP_ON=""
FC_OPENMP_OFF="!"
FCFLAGS_OPENMP="$wo_cv_fcflags_openmp"
FC_OPENMP_HEADER="$wo_cv_fc_openmp_header"
FC_OPENMP_DEFAULT_MAX_THREADS="$wo_cv_fc_openmp_thread_limit"
],
[FC_OPENMP_ON="!"
FC_OPENMP_OFF=""
FC_OPENMP_DEFAULT_MAX_THREADS="1"
])
AC_SUBST([FC_OPENMP_ON])
AC_SUBST([FC_OPENMP_OFF])
AC_SUBST([FCFLAGS_OPENMP])
AC_SUBST([FC_OPENMP_HEADER])
AC_SUBST([FC_OPENMP_DEFAULT_MAX_THREADS])
])
### end WO_FC_SET_OPENMP
### Check for profiling support
AC_DEFUN([WO_FC_CHECK_PROFILING],
[AC_CACHE_CHECK([whether $FC supports profiling via -pg],
[wo_cv_fc_profiling],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
fcflags_tmp=$FCFLAGS
FCFLAGS="-pg $FCFLAGS"
rm -f gmon.out
AC_RUN_IFELSE([dnl
program conftest
end program conftest
],
[dnl
if test -f gmon.out; then
wo_cv_fc_profiling="yes"
else
wo_cv_fc_profiling="no"
fi],
[wo_cv_fc_profiling="no"],
[wo_cv_fc_profiling="maybe [cross-compiling]"])
rm -f gmon.out
FCFLAGS=$fcflags_tmp
])
FC_SUPPORTS_PROFILING="$wo_cv_fc_profiling"
AC_SUBST([FC_SUPPORTS_PROFILING])
])
### end WO_FC_CHECK_PROFILING
### Enable/disable profiling support
AC_DEFUN([WO_FC_SET_PROFILING],
[dnl
AC_REQUIRE([WO_FC_CHECK_PROFILING])
AC_ARG_ENABLE([fc_profiling],
[AS_HELP_STRING([--enable-fc-profiling],
[use profiling for the Fortran code [[no]]])])
AC_CACHE_CHECK([whether profiling is activated], [wo_cv_fc_prof],
[dnl
if test "$FC_SUPPORTS_PROFILING" = "yes" -a "$enable_fc_profiling" = "yes"; then
wo_cv_fc_prof="yes"
FCFLAGS_PROFILING="-pg"
else
wo_cv_fc_prof="no"
FCFLAGS_PROFILING=""
fi])
AC_SUBST(FCFLAGS_PROFILING)
AM_CONDITIONAL([FC_USE_PROFILING],
[test -n "$FCFLAGS_PROFILING"])
])
### end WO_FC_SET_PROFILING
### Enable/disable impure Omega compilation
AC_DEFUN([WO_FC_SET_OMEGA_IMPURE],
[dnl
AC_REQUIRE([WO_FC_CHECK_F95])
AC_ARG_ENABLE([impure_omega],
[AS_HELP_STRING([--enable-fc-impure],
[compile Omega libraries impure [[no]]])])
AC_CACHE_CHECK([the default setting for impure omegalib], [wo_cv_fc_impure],
[dnl
if test "$impure_omega" = "yes" -o "$FC_SUPPORTS_F95" = "no"; then
wo_cv_fc_impure="yes"
else
wo_cv_fc_impure="no"
fi])
AM_CONDITIONAL([FC_IMPURE],
[test "$wo_cv_fc_impure" = "yes"])
])
### end WO_FC_OMEGA_IMPURE
### Check for quadruple precision support (real and complex!)
AC_DEFUN([WO_FC_CHECK_QUADRUPLE],
[dnl
AC_CACHE_CHECK([whether $FC permits quadruple real and complex],
[wo_cv_fc_quadruple],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
integer, parameter :: d=selected_real_kind(precision(1.)+1, range(1.)+1)
integer, parameter :: q=selected_real_kind(precision(1._d)+1, range(1._d))
real(kind=q) :: x
complex(kind=q) :: z
end program conftest
],
[wo_cv_fc_quadruple="yes"],
[wo_cv_fc_quadruple="no"])
])
FC_SUPPORTS_QUADRUPLE="$wo_cv_fc_quadruple"
AC_SUBST([FC_SUPPORTS_QUADRUPLE])
])
### end WO_FC_CHECK_QUADRUPLE
### Check for C quadruple precision support (real and complex!)
AC_DEFUN([WO_FC_CHECK_QUADRUPLE_C],
[dnl
AC_CACHE_CHECK([whether $FC permits quadruple-precision C types],
[wo_cv_fc_quadruple_c],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
use iso_c_binding
real(c_long_double) :: x
complex(c_long_double_complex) :: z
end program conftest
],
[wo_cv_fc_quadruple_c="yes"],
[wo_cv_fc_quadruple_c="no"])
])
FC_SUPPORTS_QUADRUPLE_C="$wo_cv_fc_quadruple_c"
AC_SUBST([FC_SUPPORTS_QUADRUPLE_C])
])
### end WO_FC_CHECK_QUADRUPLE_C
### Enable/disable quadruple precision and set default precision
AC_DEFUN([WO_FC_SET_PRECISION],
[dnl
AC_REQUIRE([WO_FC_CHECK_QUADRUPLE])
AC_ARG_ENABLE([fc_quadruple],
[AS_HELP_STRING([--enable-fc-quadruple],
[use quadruple precision in Fortran code [[no]]])])
if test "$enable_fc_quadruple" = "yes"; then
FC_QUAD_OR_SINGLE="quadruple"
else
FC_QUAD_OR_SINGLE="single"
fi
AC_SUBST([FC_QUAD_OR_SINGLE])
AC_CACHE_CHECK([the default numeric precision], [wo_cv_fc_precision],
[dnl
if test "$FC_SUPPORTS_QUADRUPLE" = "yes" \
-a "$FC_SUPPORTS_QUADRUPLE_C" = "yes" \
-a "$enable_fc_quadruple" = "yes"; then
wo_cv_fc_precision="quadruple"
wo_cv_fc_precision_c="c_long_double"
else
wo_cv_fc_precision="double"
wo_cv_fc_precision_c="c_double"
fi
])
FC_PRECISION="$wo_cv_fc_precision"
FC_PRECISION_C="$wo_cv_fc_precision_c"
AC_SUBST(FC_PRECISION)
AC_SUBST(FC_PRECISION_C)
AM_CONDITIONAL([FC_QUAD],
[test "$FC_PRECISION" = "quadruple"])
])
### end WO_FC_SET_PRECISION
### filename_case_conversion, define two variables LOWERCASE and
### UPPERCASE for /bin/sh filters that convert strings to lower
### and upper case, respectively
AC_DEFUN([WO_FC_FILENAME_CASE_CONVERSION],
[dnl
AC_SUBST([LOWERCASE])
AC_SUBST([UPPERCASE])
AC_PATH_PROGS(TR,tr)
AC_MSG_CHECKING([for case conversion])
if test -n "$TR"; then
LOWERCASE="$TR A-Z a-z"
UPPERCASE="$TR a-z A-Z"
WO_FC_FILENAME_CASE_CONVERSION_TEST
fi
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$TR works])
else
LOWERCASE="$SED y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
UPPERCASE="$SED y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/"
WO_FC_FILENAME_CASE_CONVERSION_TEST
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$SED works])
fi
fi])
### end WO_FC_FILE_CASE_CONVERSION
dnl
AC_DEFUN([WO_FC_FILENAME_CASE_CONVERSION_TEST],
[dnl
if test "`echo fOo | $LOWERCASE`" != "foo"; then
LOWERCASE=""
fi
if test "`echo fOo | $UPPERCASE`" != "FOO"; then
UPPERCASE=""
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl COMPILE_FC(VARIABLE, COMPILER, EXTENSION, MODULE,
dnl VALUE_SUCCESS, VALUE_FAILURE, KEEP)
dnl
AC_DEFUN([COMPILE_FC],
[cat >conftest.$3 <<__END__
$4
program conftest
print *, 42
end program conftest
__END__
$2 -o conftest conftest.$3 >/dev/null 2>&1
./conftest >conftest.out 2>/dev/null
if test 42 = "`$SED 's/ //g' conftest.out`"; then
$1="$5"
else
$1="$6"
fi
if test -z "$7"; then
rm -rf conftest* CONFTEST*
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl WO_FC_MODULE_FILE(NAME, EXTENSION, FORTRAN_COMPILER, SOURCE_EXTENSION)
dnl
AC_DEFUN([WO_FC_MODULE_FILE],
[AC_SUBST([$1])
AC_SUBST([$2])
AC_MSG_CHECKING([for Fortran90 module file naming convention])
COMPILE_FC([wo_result], [$3], [$4],
[module module_NAME
implicit none
integer, parameter, public :: forty_two = 42
end module module_NAME], [ok], [], [KEEP])
if test -n "[$]wo_result"; then
$1=unknown
$2=unknown
for name in module_name module_NAME MODULE_NAME conftest; do
for ext in m mod M MOD d D; do
if test -f "[$]name.[$]ext"; then
$1="$name"
$2="$ext"
break 2
fi
done
done
if test X"[$]$1" = X"module_name"; then
AC_MSG_RESULT([name: [$]$1, extension: .[$]$2 ])
else
AC_MSG_ERROR([unusual unsupported module file name convention: [$]$1.[$]$2])
fi
else
$1=""
$2=""
AC_MSG_RESULT([compiler failed])
AC_MSG_NOTICE([error: **************************************************************])
AC_MSG_NOTICE([error: Fortran compiler cannot create proper module files. This])
AC_MSG_NOTICE([error: might be caused by linking against a wrong gcc library.])
AC_MSG_ERROR([**************************************************************])
fi
rm -rf conftest* CONFTEST* module_name* module_NAME* MODULE_NAME*])
Index: trunk/src/circe2/m4/fortran.m4
===================================================================
--- trunk/src/circe2/m4/fortran.m4 (revision 5198)
+++ trunk/src/circe2/m4/fortran.m4 (revision 5199)
@@ -1,928 +1,934 @@
dnl fortran.m4 -- Fortran compiler checks beyond Autoconf built-ins
dnl
dnl The standard Fortran compiler test is AC_PROG_FC.
dnl At the end FC, FCFLAGS and FCFLAGS_f90 are set, if successful.
### Determine vendor and version string.
AC_DEFUN([WO_FC_GET_VENDOR_AND_VERSION],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_CACHE_CHECK([the compiler ID string],
[wo_cv_fc_id_string],
[dnl
$FC -V >conftest.log 2>&1
$FC -version >>conftest.log 2>&1
$FC --version >>conftest.log 2>&1
wo_fc_grep_GFORTRAN=`$GREP -i 'GNU Fortran' conftest.log | head -1`
wo_fc_grep_G95=`$GREP -i 'g95' conftest.log | $GREP -i 'gcc' | head -1`
wo_fc_grep_NAG=`$GREP 'NAG' conftest.log | head -1`
wo_fc_grep_Intel=`$GREP 'IFORT' conftest.log | head -1`
wo_fc_grep_Sun=`$GREP 'Sun' conftest.log | head -1`
wo_fc_grep_Lahey=`$GREP 'Lahey' conftest.log | head -1`
wo_fc_grep_PGF90=`$GREP 'pgf90' conftest.log | head -1`
wo_fc_grep_PGF95=`$GREP 'pgf95' conftest.log | head -1`
wo_fc_grep_PGHPF=`$GREP 'pghpf' conftest.log | head -1`
wo_fc_grep_default=`cat conftest.log | head -1`
if test -n "$wo_fc_grep_GFORTRAN"; then
wo_cv_fc_id_string=$wo_fc_grep_GFORTRAN
elif test -n "$wo_fc_grep_G95"; then
wo_cv_fc_id_string=$wo_fc_grep_G95
elif test -n "$wo_fc_grep_NAG"; then
wo_cv_fc_id_string=$wo_fc_grep_NAG
elif test -n "$wo_fc_grep_Intel"; then
wo_cv_fc_id_string=$wo_fc_grep_Intel
elif test -n "$wo_fc_grep_Sun"; then
wo_cv_fc_id_string=$wo_fc_grep_Sun
elif test -n "$wo_fc_grep_Lahey"; then
wo_cv_fc_id_string=$wo_fc_grep_Lahey
elif test -n "$wo_fc_grep_PGF90"; then
wo_cv_fc_id_string=$wo_fc_grep_PGF90
elif test -n "$wo_fc_grep_PGF95"; then
wo_cv_fc_id_string=$wo_fc_grep_PGF95
elif test -n "$wo_fc_grep_PGHPF"; then
wo_cv_fc_id_string=$wo_fc_grep_PGHPF
else
wo_cv_fc_id_string=$wo_fc_grep_default
fi
rm -f conftest.log
])
FC_ID_STRING="$wo_cv_fc_id_string"
AC_SUBST([FC_ID_STRING])
AC_CACHE_CHECK([the compiler vendor],
[wo_cv_fc_vendor],
[dnl
if test -n "$wo_fc_grep_GFORTRAN"; then
wo_cv_fc_vendor="gfortran"
elif test -n "$wo_fc_grep_G95"; then
wo_cv_fc_vendor="g95"
elif test -n "$wo_fc_grep_NAG"; then
wo_cv_fc_vendor="NAG"
elif test -n "$wo_fc_grep_Intel"; then
wo_cv_fc_vendor="Intel"
elif test -n "$wo_fc_grep_Sun"; then
wo_cv_fc_vendor="Sun"
elif test -n "$wo_fc_grep_Lahey"; then
wo_cv_fc_vendor="Lahey"
elif test -n "$wo_fc_grep_PGF90"; then
wo_cv_fc_vendor="PGI"
elif test -n "$wo_fc_grep_PGF95"; then
wo_cv_fc_vendor="PGI"
elif test -n "$wo_fc_grep_PGHPF"; then
wo_cv_fc_vendor="PGI"
else
wo_cv_fc_vendor="unknown"
fi
])
FC_VENDOR="$wo_cv_fc_vendor"
AC_SUBST([FC_VENDOR])
AM_CONDITIONAL([FC_IS_GFORTRAN],
[test "$FC_VENDOR" = gfortran])
AM_CONDITIONAL([FC_IS_NAG],
[test "$FC_VENDOR" = NAG])
AC_CACHE_CHECK([the compiler version],
[wo_cv_fc_version],
[dnl
case $FC_VENDOR in
gfortran)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`]
;;
g95)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.*g95 \([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`]
;;
NAG)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.* Release \([0-9][0-9]*\.[0-9][0-9]*.*$\)/\1/'`]
;;
Intel)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/[a-zA-Z\(\)]//g;s/[0-9]\{8\}$//g'`]
;;
Sun)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.* Fortran 95 \([0-9][0-9]*\.[0-9][0-9]*\) .*/\1/'`]
;;
PGI)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/[a-zA-Z\(\)]//g;s/^[0-9]\{2\}//g;s/32.*\|64.*//g'`]
;;
*)
wo_cv_fc_version="unknown"
;;
esac
])
FC_VERSION="$wo_cv_fc_version"
AC_SUBST([FC_VERSION])
### Catch insufficient object-orientation in gfortran 4.5/4.6
if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.3" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.4" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.3" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.4"; then
FC_IS_GFORTRAN_456="yes"
else
FC_IS_GFORTRAN_456="no"
fi
AC_SUBST([FC_IS_GFORTRAN_456])
-### Catch memory corruption in gfortran 4.7
-if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.3"; then
-FC_IS_GFORTRAN_47="yes"
+### Catch compiler bug for static builds in gfortran 4.7
+if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.0"; then
+FC_IS_GFORTRAN_470="yes"
else
-FC_IS_GFORTRAN_47="no"
+FC_IS_GFORTRAN_470="no"
fi
-AC_SUBST([FC_IS_GFORTRAN_47])
-
-AM_CONDITIONAL([FC_GFORTRAN_47],
- [test "$FC_IS_GFORTRAN_47" = "yes"])
+AC_SUBST([FC_IS_GFORTRAN_470])
AC_CACHE_CHECK([the major version],
[wo_cv_fc_major_version],
[wo_cv_fc_major_version=[`echo $wo_cv_fc_version | $SED -e 's/\([0-9][0-9]*\)\..*/\1/'`]
])
FC_MAJOR_VERSION="$wo_cv_fc_major_version"
AC_SUBST([FC_MAJOR_VERSION])
])
### end WO_FC_GET_VENDOR_AND_VERSION
AC_DEFUN([WO_FC_VETO_GFORTRAN_456],
[dnl
if test "$FC_IS_GFORTRAN_456" = "yes"; then
AC_MSG_NOTICE([error: ***************************************************************])
AC_MSG_NOTICE([error: gfortran 4.5/4.6 object orientation support insufficient.])
AC_MSG_ERROR([***************************************************************])
fi
])
+AC_DEFUN([WO_FC_VETO_GFORTRAN_470],
+[dnl
+if test "$FC_IS_GFORTRAN_470" = "yes"; then
+AC_MSG_NOTICE([error: ***************************************************************])
+AC_MSG_NOTICE([error: gfortran 4.7.0 due to a major bug for static builds disabled .])
+AC_MSG_ERROR([***************************************************************])
+fi
+])
+
### This actually obsolete, but we keep the code, in case there
### are further issues with gfortran 4.7
AC_DEFUN([WO_FC_WARN_GFORTRAN_47],
[dnl
if test "$FC_IS_GFORTRAN_47" = "yes" -a "$FC_PRECISION" = "quadruple"; then
AC_MSG_NOTICE([WARNING: ***************************************************************])
AC_MSG_NOTICE([WARNING: gfortran 4.7 scanning with quadruple precision might fail.])
AC_MSG_WARN([***************************************************************])
fi
])
### Determine Fortran flags and file extensions
AC_DEFUN([WO_FC_PARAMETERS],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_REQUIRE([_LT_COMPILER_PIC])
AC_LANG([Fortran])
AC_MSG_CHECKING([for $FC flags])
AC_MSG_RESULT([$FCFLAGS])
AC_MSG_CHECKING([for $FC flag to produce position-independent code])
AC_MSG_RESULT([$lt_prog_compiler_pic_FC])
FCFLAGS_PIC=$lt_prog_compiler_pic_FC
AC_SUBST([FCFLAGS_PIC])
AC_MSG_CHECKING([for $FC source extension])
AC_MSG_RESULT([$ac_fc_srcext])
FC_SRC_EXT=$ac_fc_srcext
AC_SUBST([FC_SRC_EXT])
AC_MSG_CHECKING([for object file extension])
AC_MSG_RESULT([$ac_objext])
OBJ_EXT=$ac_objext
AC_SUBST([OBJ_EXT])
])
### end WO_FC_PARAMETERS
### Determine runtime libraries
### The standard check is insufficient for some compilers
AC_DEFUN([WO_FC_LIBRARY_LDFLAGS],
[dnl
AC_REQUIRE([AC_PROG_FC])
case "$FC" in
nagfor*)
WO_NAGFOR_LIBRARY_LDFLAGS()
;;
*)
AC_FC_LIBRARY_LDFLAGS
;;
esac
])
### Check the NAG Fortran compiler
### Use the '-dryrun' feature and extract the libraries from the link command
### Note that the linker is gcc, not ld
AC_DEFUN([WO_NAGFOR_LIBRARY_LDFLAGS],
[dnl
AC_CACHE_CHECK([Fortran libraries of $FC],
[wo_cv_fc_libs],
[dnl
if test -z "$FCLIBS"; then
AC_LANG([Fortran])
AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
wo_save_fcflags=$FCFLAGS
FCFLAGS="-dryrun"
eval "set x $ac_link"
echo "set x $ac_link"
shift
_AS_ECHO_LOG([$[*]])
wo_nagfor_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1`
echo "$wo_nagfor_output" >&AS_MESSAGE_LOG_FD
FCFLAGS=$wo_save_fcflags
wo_cv_fc_libs=`echo $wo_nagfor_output | $SED -e 's/.* -o conftest \(.*\)$/\1/' | $SED -e "s/conftest.$ac_objext //"`
else
wo_cv_fc_libs=$FCLIBS
fi
])
FCLIBS=$wo_cv_fc_libs
AC_SUBST([FCLIBS])
])
### Check for basic F95 features
AC_DEFUN([WO_FC_CHECK_F95],
[dnl
AC_CACHE_CHECK([whether $FC supports Fortran 95 features],
[wo_cv_fc_supports_f95],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
integer, dimension(2) :: ii
integer :: i
type :: foo
integer, pointer :: bar => null ()
end type foo
forall (i = 1:2) ii(i) = i
contains
elemental function f(x)
real, intent(in) :: x
real :: f
f = x
end function f
pure function g (x) result (gx)
real, intent(in) :: x
real :: gx
gx = x
end function g
end program conftest
],
[wo_cv_fc_supports_f95="yes"],
[wo_cv_fc_supports_f95="no"])
])
FC_SUPPORTS_F95="$wo_cv_fc_supports_f95"
AC_SUBST([FC_SUPPORTS_F95])
if test "$FC_SUPPORTS_F95" = "no"; then
AC_MSG_NOTICE([error: ******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler is not a genuine F95 compiler, configure aborted.])
AC_MSG_ERROR([******************************************************************])
fi])
### end WO_FC_CHECK_F95
### Check for the TR15581 extensions (allocatable subobjects)
AC_DEFUN([WO_FC_CHECK_TR15581],
[AC_CACHE_CHECK([whether $FC supports allocatable subobjects],
[wo_cv_fc_allocatable],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
integer, dimension(:), allocatable :: bar
end type foo
end program conftest
],
[wo_cv_fc_allocatable="yes"],
[wo_cv_fc_allocatable="no"])
])
FC_SUPPORTS_ALLOCATABLE="$wo_cv_fc_allocatable"
AC_SUBST([FC_SUPPORTS_ALLOCATABLE])
if test "$FC_SUPPORTS_ALLOCATABLE" = "no"; then
AC_MSG_NOTICE([error: ****************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support allocatable structures, configure aborted.])
AC_MSG_ERROR([****************************************************************************])
fi])
### end WO_FC_CHECK_TR15581
### Check for allocatable scalars
AC_DEFUN([WO_FC_CHECK_ALLOCATABLE_SCALARS],
[AC_CACHE_CHECK([whether $FC supports allocatable scalars],
[wo_cv_fc_allocatable_scalars],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
integer, allocatable :: bar
end type foo
end program conftest
],
[wo_cv_fc_allocatable_scalars="yes"],
[wo_cv_fc_allocatable_scalars="no"])
])
FC_SUPPORTS_ALLOCATABLE_SCALARS="$wo_cv_fc_allocatable"
AC_SUBST([FC_SUPPORTS_ALLOCATABLE_SCALARS])
])
### end WO_FC_CHECK_ALLOCATABLE_SCALARS
### Check for the C bindings extensions of Fortran 2003
AC_DEFUN([WO_FC_CHECK_C_BINDING],
[AC_CACHE_CHECK([whether $FC supports ISO C binding and standard numeric types],
[wo_cv_fc_c_binding],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
use iso_c_binding
type, bind(c) :: t
integer(c_int) :: i
real(c_float) :: x1
real(c_double) :: x2
complex(c_float_complex) :: z1
complex(c_double_complex) :: z2
end type t
end program conftest
],
[wo_cv_fc_c_binding="yes"],
[wo_cv_fc_c_binding="no"])
])
FC_SUPPORTS_C_BINDING="$wo_cv_fc_c_binding"
AC_SUBST([FC_SUPPORTS_C_BINDING])
if test "$FC_SUPPORTS_C_BINDING" = "no"; then
AC_MSG_NOTICE([error: *******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support ISO C binding, configure aborted.])
AC_MSG_ERROR([********************************************************************])
fi
])
### end WO_FC_CHECK_C_BINDING
### Check for procedure pointers
AC_DEFUN([WO_FC_CHECK_PROCEDURE_POINTERS],
[AC_CACHE_CHECK([whether $FC supports procedure pointers (F2003)],
[wo_cv_prog_f03_procedure_pointers],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
procedure (proc_template), nopass, pointer :: proc => null ()
end type foo
abstract interface
subroutine proc_template ()
end subroutine proc_template
end interface
end program conftest
],
[wo_cv_prog_f03_procedure_pointers="yes"],
[wo_cv_prog_f03_procedure_pointers="no"])
])
FC_SUPPORTS_PROCEDURE_POINTERS="$wo_cv_prog_f03_procedure_pointers"
AC_SUBST([FC_SUPPORTS_PROCEDURE_POINTERS])
if test "$FC_SUPPORTS_PROCEDURE_POINTERS" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not understand procedure pointers, configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_PROCEDURE_POINTERS
### Check for the OO extensions of Fortran 2003
AC_DEFUN([WO_FC_CHECK_OO_FEATURES],
[AC_CACHE_CHECK([whether $FC supports OO features (F2003)],
[wo_cv_prog_f03_oo_features],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
module conftest
type, abstract :: foo
contains
procedure (proc_template), deferred :: proc
end type foo
type, extends (foo) :: foobar
contains
procedure :: proc
end type foobar
abstract interface
subroutine proc_template (f)
import foo
class(foo), intent(inout) :: f
end subroutine proc_template
end interface
contains
subroutine proc (f)
class(foobar), intent(inout) :: f
end subroutine proc
end module conftest
program main
use conftest
end program main
],
[wo_cv_prog_f03_oo_features="yes"],
[wo_cv_prog_f03_oo_features="no"])
])
FC_SUPPORTS_OO_FEATURES="$wo_cv_prog_f03_oo_features"
AC_SUBST([FC_SUPPORTS_OO_FEATURES])
])
### end WO_FC_CHECK_OO_FEATURES
### Check for the command line interface of Fortran 2003
### We actually have to link in order to check availability
AC_DEFUN([WO_FC_CHECK_CMDLINE],
[AC_CACHE_CHECK([whether $FC interfaces the command line (F2003)],
[wo_cv_fc_cmdline],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_LINK_IFELSE([dnl
program conftest
call get_command_argument (command_argument_count ())
end program conftest
],
[wo_cv_fc_cmdline="yes"],
[wo_cv_fc_cmdline="no"])
])
FC_SUPPORTS_CMDLINE="$wo_cv_fc_cmdline"
AC_SUBST([FC_SUPPORTS_CMDLINE])
if test "$FC_SUPPORTS_CMDLINE" = "no"; then
AC_MSG_NOTICE([error: ******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support get_command_argument; configure aborted.])
AC_MSG_ERROR([******************************************************************])
fi
])
### end WO_FC_CHECK_CMDLINE
### Check whether we can access environment variables (2003 standard)
### We actually have to link in order to check availability
AC_DEFUN([WO_FC_CHECK_ENVVAR],
[AC_CACHE_CHECK([whether $FC provides access to environment variables (F2003)],
[wo_cv_fc_envvar],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_LINK_IFELSE([dnl
program conftest
character(len=256) :: home
call get_environment_variable ("HOME", home)
end program conftest
],
[wo_cv_fc_envvar="yes"],
[wo_cv_fc_envvar="no"])
])
FC_SUPPORTS_ENVVAR="$wo_cv_fc_envvar"
AC_SUBST([FC_SUPPORTS_ENVVAR])
if test "$FC_SUPPORTS_ENVVAR" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support get_environment_variable; configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_ENVVAR
### Check whether the flush statement is supported
AC_DEFUN([WO_FC_CHECK_FLUSH],
[AC_CACHE_CHECK([whether $FC supports the flush statement (F2003)],
[wo_cv_fc_flush],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
implicit none
integer, parameter :: u=50
open (u, action="readwrite", status="scratch")
write (u, *) "test"
flush (u)
close (u)
end program conftest
],
[wo_cv_fc_flush="yes"],
[wo_cv_fc_flush="no"])
])
FC_SUPPORTS_FLUSH="$wo_cv_fc_flush"
AC_SUBST([FC_SUPPORTS_FLUSH])
if test "$FC_SUPPORTS_FLUSH" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support the flush statement; configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_FLUSH
### Check for iso_fortran_env
AC_DEFUN([WO_FC_CHECK_ISO_FORTRAN_ENV],
[AC_ARG_ENABLE([iso_fortran_env],
[AC_HELP_STRING([--disable-iso_fortran_env],
[disable use of iso_fortran_env, even if the compiler supports it]
)],
[], [enable_iso_fortran_env=yes]
)
if test "$enable_iso_fortran_env" = yes; then
AC_CACHE_CHECK([whether $FC supports iso_fortran_env (F2003)],
[wo_cv_fc_iso_fortran_env],
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
[AC_LINK_IFELSE(
[dnl
program conftest
use iso_fortran_env
implicit none
integer :: i
i = input_unit
i = output_unit
i = error_unit
i = iostat_end
i = iostat_eor
end program conftest
], [wo_cv_fc_iso_fortran_env=yes], [wo_cv_fc_iso_fortran_env=no]
)]
)
test "$wo_cv_fc_iso_fortran_env" = no && iso_fortran_env_stub=yes
else
AC_CHECKING([whether $FC supports iso_fortran_env (F2003)... disabled])
iso_fortran_env_stub=yes
fi
AM_CONDITIONAL([ISO_FORTRAN_ENV_STUB], [test -n "$iso_fortran_env_stub"])
]
)
### Check for wrapping of linker flags
### (nagfor 'feature': must be wrapped twice)
AC_DEFUN([WO_FC_CHECK_LDFLAGS_WRAPPING],
[AC_CACHE_CHECK([for wrapping of linker flags via -Wl],
[wo_cv_fc_ldflags_wrapping],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
ldflags_tmp=$LDFLAGS
LDFLAGS=-Wl,-rpath,/usr/lib
AC_LINK_IFELSE(AC_LANG_PROGRAM(),
[wo_cv_fc_ldflags_wrapping="once"],
[wo_cv_fc_ldflags_wrapping="unknown"])
if test "$wo_cv_fc_ldflags_wrapping" = "unknown"; then
LDFLAGS=-Wl,-Wl,,-rpath,,/usr/lib
AC_LINK_IFELSE(AC_LANG_PROGRAM(),
[wo_cv_fc_ldflags_wrapping="twice"])
fi
LDFLAGS=$ldflags_tmp
])
FC_LDFLAGS_WRAPPING="$wo_cv_fc_ldflags_wrapping"
AC_SUBST([FC_LDFLAGS_WRAPPING])
])
### end WO_FC_CHECK_LDFLAGS_WRAPPING
### Check for OpenMP support
AC_DEFUN([WO_FC_CHECK_OPENMP],
[AC_CACHE_CHECK([whether $FC supports OpenMP],
[wo_cv_fc_openmp],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
case $FC_VENDOR in
gfortran)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-fopenmp"
wo_cv_fc_openmp_header="use omp_lib"
;;
NAG)
wo_cv_fc_openmp="no"
;;
Intel)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-openmp"
wo_cv_fc_openmp_header="use omp_lib"
;;
PGI)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-mp"
wo_cv_fc_openmp_header=""
;;
*)
wo_cv_fc_openmp="no"
;;
esac
if test "$wo_cv_fc_openmp"="yes"; then
fcflags_tmp=$FCFLAGS
FCFLAGS="$wo_cv_fcflags_openmp $FCFLAGS"
unset OMP_NUM_THREADS
AC_RUN_IFELSE([dnl
program conftest
$wo_cv_fc_openmp_header
open (11, file="conftest.out", action="write", status="replace")
write (11, "(I0)") omp_get_max_threads ()
close (11)
end program conftest
],
[dnl
wo_cv_fc_openmp="yes"
wo_cv_fc_openmp_thread_limit=`cat conftest.out`],
[wo_cv_fc_openmp="no"],
[wo_cv_fc_openmp="maybe [cross-compiling]"])
FCFLAGS=$fcflags_tmp
fi
])
if test "$wo_cv_fc_openmp" = "yes"; then
AC_CACHE_CHECK([the default number of threads used by OpenMP],
[wo_cv_fc_openmp_thread_limit])
fi
FC_SUPPORTS_OPENMP="$wo_cv_fc_openmp"
AC_SUBST([FC_SUPPORTS_OPENMP])
])
### end WO_FC_CHECK_OPENMP
### Enable/disable OpenMP support
AC_DEFUN([WO_FC_SET_OPENMP],
[dnl
AC_REQUIRE([WO_FC_CHECK_OPENMP])
AC_ARG_ENABLE([fc_openmp],
[AS_HELP_STRING([--enable-fc-openmp],
[use OpenMP for the Fortran code [[no]]])])
AC_CACHE_CHECK([whether OpenMP is activated], [wo_cv_fc_use_openmp],
[dnl
if test "$FC_SUPPORTS_OPENMP" = "yes" -a "$enable_fc_openmp" = "yes"; then
wo_cv_fc_use_openmp="yes"
else
wo_cv_fc_use_openmp="no"
fi])
AM_CONDITIONAL([FC_USE_OPENMP],
[test "$wo_cv_fc_use_openmp" = "yes"])
AM_COND_IF([FC_USE_OPENMP],
[FC_OPENMP_ON=""
FC_OPENMP_OFF="!"
FCFLAGS_OPENMP="$wo_cv_fcflags_openmp"
FC_OPENMP_HEADER="$wo_cv_fc_openmp_header"
FC_OPENMP_DEFAULT_MAX_THREADS="$wo_cv_fc_openmp_thread_limit"
],
[FC_OPENMP_ON="!"
FC_OPENMP_OFF=""
FC_OPENMP_DEFAULT_MAX_THREADS="1"
])
AC_SUBST([FC_OPENMP_ON])
AC_SUBST([FC_OPENMP_OFF])
AC_SUBST([FCFLAGS_OPENMP])
AC_SUBST([FC_OPENMP_HEADER])
AC_SUBST([FC_OPENMP_DEFAULT_MAX_THREADS])
])
### end WO_FC_SET_OPENMP
### Check for profiling support
AC_DEFUN([WO_FC_CHECK_PROFILING],
[AC_CACHE_CHECK([whether $FC supports profiling via -pg],
[wo_cv_fc_profiling],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
fcflags_tmp=$FCFLAGS
FCFLAGS="-pg $FCFLAGS"
rm -f gmon.out
AC_RUN_IFELSE([dnl
program conftest
end program conftest
],
[dnl
if test -f gmon.out; then
wo_cv_fc_profiling="yes"
else
wo_cv_fc_profiling="no"
fi],
[wo_cv_fc_profiling="no"],
[wo_cv_fc_profiling="maybe [cross-compiling]"])
rm -f gmon.out
FCFLAGS=$fcflags_tmp
])
FC_SUPPORTS_PROFILING="$wo_cv_fc_profiling"
AC_SUBST([FC_SUPPORTS_PROFILING])
])
### end WO_FC_CHECK_PROFILING
### Enable/disable profiling support
AC_DEFUN([WO_FC_SET_PROFILING],
[dnl
AC_REQUIRE([WO_FC_CHECK_PROFILING])
AC_ARG_ENABLE([fc_profiling],
[AS_HELP_STRING([--enable-fc-profiling],
[use profiling for the Fortran code [[no]]])])
AC_CACHE_CHECK([whether profiling is activated], [wo_cv_fc_prof],
[dnl
if test "$FC_SUPPORTS_PROFILING" = "yes" -a "$enable_fc_profiling" = "yes"; then
wo_cv_fc_prof="yes"
FCFLAGS_PROFILING="-pg"
else
wo_cv_fc_prof="no"
FCFLAGS_PROFILING=""
fi])
AC_SUBST(FCFLAGS_PROFILING)
AM_CONDITIONAL([FC_USE_PROFILING],
[test -n "$FCFLAGS_PROFILING"])
])
### end WO_FC_SET_PROFILING
### Enable/disable impure Omega compilation
AC_DEFUN([WO_FC_SET_OMEGA_IMPURE],
[dnl
AC_REQUIRE([WO_FC_CHECK_F95])
AC_ARG_ENABLE([impure_omega],
[AS_HELP_STRING([--enable-fc-impure],
[compile Omega libraries impure [[no]]])])
AC_CACHE_CHECK([the default setting for impure omegalib], [wo_cv_fc_impure],
[dnl
if test "$impure_omega" = "yes" -o "$FC_SUPPORTS_F95" = "no"; then
wo_cv_fc_impure="yes"
else
wo_cv_fc_impure="no"
fi])
AM_CONDITIONAL([FC_IMPURE],
[test "$wo_cv_fc_impure" = "yes"])
])
### end WO_FC_OMEGA_IMPURE
### Check for quadruple precision support (real and complex!)
AC_DEFUN([WO_FC_CHECK_QUADRUPLE],
[dnl
AC_CACHE_CHECK([whether $FC permits quadruple real and complex],
[wo_cv_fc_quadruple],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
integer, parameter :: d=selected_real_kind(precision(1.)+1, range(1.)+1)
integer, parameter :: q=selected_real_kind(precision(1._d)+1, range(1._d))
real(kind=q) :: x
complex(kind=q) :: z
end program conftest
],
[wo_cv_fc_quadruple="yes"],
[wo_cv_fc_quadruple="no"])
])
FC_SUPPORTS_QUADRUPLE="$wo_cv_fc_quadruple"
AC_SUBST([FC_SUPPORTS_QUADRUPLE])
])
### end WO_FC_CHECK_QUADRUPLE
### Check for C quadruple precision support (real and complex!)
AC_DEFUN([WO_FC_CHECK_QUADRUPLE_C],
[dnl
AC_CACHE_CHECK([whether $FC permits quadruple-precision C types],
[wo_cv_fc_quadruple_c],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
use iso_c_binding
real(c_long_double) :: x
complex(c_long_double_complex) :: z
end program conftest
],
[wo_cv_fc_quadruple_c="yes"],
[wo_cv_fc_quadruple_c="no"])
])
FC_SUPPORTS_QUADRUPLE_C="$wo_cv_fc_quadruple_c"
AC_SUBST([FC_SUPPORTS_QUADRUPLE_C])
])
### end WO_FC_CHECK_QUADRUPLE_C
### Enable/disable quadruple precision and set default precision
AC_DEFUN([WO_FC_SET_PRECISION],
[dnl
AC_REQUIRE([WO_FC_CHECK_QUADRUPLE])
AC_ARG_ENABLE([fc_quadruple],
[AS_HELP_STRING([--enable-fc-quadruple],
[use quadruple precision in Fortran code [[no]]])])
if test "$enable_fc_quadruple" = "yes"; then
FC_QUAD_OR_SINGLE="quadruple"
else
FC_QUAD_OR_SINGLE="single"
fi
AC_SUBST([FC_QUAD_OR_SINGLE])
AC_CACHE_CHECK([the default numeric precision], [wo_cv_fc_precision],
[dnl
if test "$FC_SUPPORTS_QUADRUPLE" = "yes" \
-a "$FC_SUPPORTS_QUADRUPLE_C" = "yes" \
-a "$enable_fc_quadruple" = "yes"; then
wo_cv_fc_precision="quadruple"
wo_cv_fc_precision_c="c_long_double"
else
wo_cv_fc_precision="double"
wo_cv_fc_precision_c="c_double"
fi
])
FC_PRECISION="$wo_cv_fc_precision"
FC_PRECISION_C="$wo_cv_fc_precision_c"
AC_SUBST(FC_PRECISION)
AC_SUBST(FC_PRECISION_C)
AM_CONDITIONAL([FC_QUAD],
[test "$FC_PRECISION" = "quadruple"])
])
### end WO_FC_SET_PRECISION
### filename_case_conversion, define two variables LOWERCASE and
### UPPERCASE for /bin/sh filters that convert strings to lower
### and upper case, respectively
AC_DEFUN([WO_FC_FILENAME_CASE_CONVERSION],
[dnl
AC_SUBST([LOWERCASE])
AC_SUBST([UPPERCASE])
AC_PATH_PROGS(TR,tr)
AC_MSG_CHECKING([for case conversion])
if test -n "$TR"; then
LOWERCASE="$TR A-Z a-z"
UPPERCASE="$TR a-z A-Z"
WO_FC_FILENAME_CASE_CONVERSION_TEST
fi
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$TR works])
else
LOWERCASE="$SED y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
UPPERCASE="$SED y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/"
WO_FC_FILENAME_CASE_CONVERSION_TEST
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$SED works])
fi
fi])
### end WO_FC_FILE_CASE_CONVERSION
dnl
AC_DEFUN([WO_FC_FILENAME_CASE_CONVERSION_TEST],
[dnl
if test "`echo fOo | $LOWERCASE`" != "foo"; then
LOWERCASE=""
fi
if test "`echo fOo | $UPPERCASE`" != "FOO"; then
UPPERCASE=""
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl COMPILE_FC(VARIABLE, COMPILER, EXTENSION, MODULE,
dnl VALUE_SUCCESS, VALUE_FAILURE, KEEP)
dnl
AC_DEFUN([COMPILE_FC],
[cat >conftest.$3 <<__END__
$4
program conftest
print *, 42
end program conftest
__END__
$2 -o conftest conftest.$3 >/dev/null 2>&1
./conftest >conftest.out 2>/dev/null
if test 42 = "`$SED 's/ //g' conftest.out`"; then
$1="$5"
else
$1="$6"
fi
if test -z "$7"; then
rm -rf conftest* CONFTEST*
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl WO_FC_MODULE_FILE(NAME, EXTENSION, FORTRAN_COMPILER, SOURCE_EXTENSION)
dnl
AC_DEFUN([WO_FC_MODULE_FILE],
[AC_SUBST([$1])
AC_SUBST([$2])
AC_MSG_CHECKING([for Fortran90 module file naming convention])
COMPILE_FC([wo_result], [$3], [$4],
[module module_NAME
implicit none
integer, parameter, public :: forty_two = 42
end module module_NAME], [ok], [], [KEEP])
if test -n "[$]wo_result"; then
$1=unknown
$2=unknown
for name in module_name module_NAME MODULE_NAME conftest; do
for ext in m mod M MOD d D; do
if test -f "[$]name.[$]ext"; then
$1="$name"
$2="$ext"
break 2
fi
done
done
if test X"[$]$1" = X"module_name"; then
AC_MSG_RESULT([name: [$]$1, extension: .[$]$2 ])
else
AC_MSG_ERROR([unusual unsupported module file name convention: [$]$1.[$]$2])
fi
else
$1=""
$2=""
AC_MSG_RESULT([compiler failed])
AC_MSG_NOTICE([error: **************************************************************])
AC_MSG_NOTICE([error: Fortran compiler cannot create proper module files. This])
AC_MSG_NOTICE([error: might be caused by linking against a wrong gcc library.])
AC_MSG_ERROR([**************************************************************])
fi
rm -rf conftest* CONFTEST* module_name* module_NAME* MODULE_NAME*])
Index: trunk/src/omega/m4/fortran.m4
===================================================================
--- trunk/src/omega/m4/fortran.m4 (revision 5198)
+++ trunk/src/omega/m4/fortran.m4 (revision 5199)
@@ -1,928 +1,934 @@
dnl fortran.m4 -- Fortran compiler checks beyond Autoconf built-ins
dnl
dnl The standard Fortran compiler test is AC_PROG_FC.
dnl At the end FC, FCFLAGS and FCFLAGS_f90 are set, if successful.
### Determine vendor and version string.
AC_DEFUN([WO_FC_GET_VENDOR_AND_VERSION],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_CACHE_CHECK([the compiler ID string],
[wo_cv_fc_id_string],
[dnl
$FC -V >conftest.log 2>&1
$FC -version >>conftest.log 2>&1
$FC --version >>conftest.log 2>&1
wo_fc_grep_GFORTRAN=`$GREP -i 'GNU Fortran' conftest.log | head -1`
wo_fc_grep_G95=`$GREP -i 'g95' conftest.log | $GREP -i 'gcc' | head -1`
wo_fc_grep_NAG=`$GREP 'NAG' conftest.log | head -1`
wo_fc_grep_Intel=`$GREP 'IFORT' conftest.log | head -1`
wo_fc_grep_Sun=`$GREP 'Sun' conftest.log | head -1`
wo_fc_grep_Lahey=`$GREP 'Lahey' conftest.log | head -1`
wo_fc_grep_PGF90=`$GREP 'pgf90' conftest.log | head -1`
wo_fc_grep_PGF95=`$GREP 'pgf95' conftest.log | head -1`
wo_fc_grep_PGHPF=`$GREP 'pghpf' conftest.log | head -1`
wo_fc_grep_default=`cat conftest.log | head -1`
if test -n "$wo_fc_grep_GFORTRAN"; then
wo_cv_fc_id_string=$wo_fc_grep_GFORTRAN
elif test -n "$wo_fc_grep_G95"; then
wo_cv_fc_id_string=$wo_fc_grep_G95
elif test -n "$wo_fc_grep_NAG"; then
wo_cv_fc_id_string=$wo_fc_grep_NAG
elif test -n "$wo_fc_grep_Intel"; then
wo_cv_fc_id_string=$wo_fc_grep_Intel
elif test -n "$wo_fc_grep_Sun"; then
wo_cv_fc_id_string=$wo_fc_grep_Sun
elif test -n "$wo_fc_grep_Lahey"; then
wo_cv_fc_id_string=$wo_fc_grep_Lahey
elif test -n "$wo_fc_grep_PGF90"; then
wo_cv_fc_id_string=$wo_fc_grep_PGF90
elif test -n "$wo_fc_grep_PGF95"; then
wo_cv_fc_id_string=$wo_fc_grep_PGF95
elif test -n "$wo_fc_grep_PGHPF"; then
wo_cv_fc_id_string=$wo_fc_grep_PGHPF
else
wo_cv_fc_id_string=$wo_fc_grep_default
fi
rm -f conftest.log
])
FC_ID_STRING="$wo_cv_fc_id_string"
AC_SUBST([FC_ID_STRING])
AC_CACHE_CHECK([the compiler vendor],
[wo_cv_fc_vendor],
[dnl
if test -n "$wo_fc_grep_GFORTRAN"; then
wo_cv_fc_vendor="gfortran"
elif test -n "$wo_fc_grep_G95"; then
wo_cv_fc_vendor="g95"
elif test -n "$wo_fc_grep_NAG"; then
wo_cv_fc_vendor="NAG"
elif test -n "$wo_fc_grep_Intel"; then
wo_cv_fc_vendor="Intel"
elif test -n "$wo_fc_grep_Sun"; then
wo_cv_fc_vendor="Sun"
elif test -n "$wo_fc_grep_Lahey"; then
wo_cv_fc_vendor="Lahey"
elif test -n "$wo_fc_grep_PGF90"; then
wo_cv_fc_vendor="PGI"
elif test -n "$wo_fc_grep_PGF95"; then
wo_cv_fc_vendor="PGI"
elif test -n "$wo_fc_grep_PGHPF"; then
wo_cv_fc_vendor="PGI"
else
wo_cv_fc_vendor="unknown"
fi
])
FC_VENDOR="$wo_cv_fc_vendor"
AC_SUBST([FC_VENDOR])
AM_CONDITIONAL([FC_IS_GFORTRAN],
[test "$FC_VENDOR" = gfortran])
AM_CONDITIONAL([FC_IS_NAG],
[test "$FC_VENDOR" = NAG])
AC_CACHE_CHECK([the compiler version],
[wo_cv_fc_version],
[dnl
case $FC_VENDOR in
gfortran)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`]
;;
g95)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.*g95 \([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`]
;;
NAG)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.* Release \([0-9][0-9]*\.[0-9][0-9]*.*$\)/\1/'`]
;;
Intel)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/[a-zA-Z\(\)]//g;s/[0-9]\{8\}$//g'`]
;;
Sun)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.* Fortran 95 \([0-9][0-9]*\.[0-9][0-9]*\) .*/\1/'`]
;;
PGI)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/[a-zA-Z\(\)]//g;s/^[0-9]\{2\}//g;s/32.*\|64.*//g'`]
;;
*)
wo_cv_fc_version="unknown"
;;
esac
])
FC_VERSION="$wo_cv_fc_version"
AC_SUBST([FC_VERSION])
### Catch insufficient object-orientation in gfortran 4.5/4.6
if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.3" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.4" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.3" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.4"; then
FC_IS_GFORTRAN_456="yes"
else
FC_IS_GFORTRAN_456="no"
fi
AC_SUBST([FC_IS_GFORTRAN_456])
-### Catch memory corruption in gfortran 4.7
-if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.3"; then
-FC_IS_GFORTRAN_47="yes"
+### Catch compiler bug for static builds in gfortran 4.7
+if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.0"; then
+FC_IS_GFORTRAN_470="yes"
else
-FC_IS_GFORTRAN_47="no"
+FC_IS_GFORTRAN_470="no"
fi
-AC_SUBST([FC_IS_GFORTRAN_47])
-
-AM_CONDITIONAL([FC_GFORTRAN_47],
- [test "$FC_IS_GFORTRAN_47" = "yes"])
+AC_SUBST([FC_IS_GFORTRAN_470])
AC_CACHE_CHECK([the major version],
[wo_cv_fc_major_version],
[wo_cv_fc_major_version=[`echo $wo_cv_fc_version | $SED -e 's/\([0-9][0-9]*\)\..*/\1/'`]
])
FC_MAJOR_VERSION="$wo_cv_fc_major_version"
AC_SUBST([FC_MAJOR_VERSION])
])
### end WO_FC_GET_VENDOR_AND_VERSION
AC_DEFUN([WO_FC_VETO_GFORTRAN_456],
[dnl
if test "$FC_IS_GFORTRAN_456" = "yes"; then
AC_MSG_NOTICE([error: ***************************************************************])
AC_MSG_NOTICE([error: gfortran 4.5/4.6 object orientation support insufficient.])
AC_MSG_ERROR([***************************************************************])
fi
])
+AC_DEFUN([WO_FC_VETO_GFORTRAN_470],
+[dnl
+if test "$FC_IS_GFORTRAN_470" = "yes"; then
+AC_MSG_NOTICE([error: ***************************************************************])
+AC_MSG_NOTICE([error: gfortran 4.7.0 due to a major bug for static builds disabled .])
+AC_MSG_ERROR([***************************************************************])
+fi
+])
+
### This actually obsolete, but we keep the code, in case there
### are further issues with gfortran 4.7
AC_DEFUN([WO_FC_WARN_GFORTRAN_47],
[dnl
if test "$FC_IS_GFORTRAN_47" = "yes" -a "$FC_PRECISION" = "quadruple"; then
AC_MSG_NOTICE([WARNING: ***************************************************************])
AC_MSG_NOTICE([WARNING: gfortran 4.7 scanning with quadruple precision might fail.])
AC_MSG_WARN([***************************************************************])
fi
])
### Determine Fortran flags and file extensions
AC_DEFUN([WO_FC_PARAMETERS],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_REQUIRE([_LT_COMPILER_PIC])
AC_LANG([Fortran])
AC_MSG_CHECKING([for $FC flags])
AC_MSG_RESULT([$FCFLAGS])
AC_MSG_CHECKING([for $FC flag to produce position-independent code])
AC_MSG_RESULT([$lt_prog_compiler_pic_FC])
FCFLAGS_PIC=$lt_prog_compiler_pic_FC
AC_SUBST([FCFLAGS_PIC])
AC_MSG_CHECKING([for $FC source extension])
AC_MSG_RESULT([$ac_fc_srcext])
FC_SRC_EXT=$ac_fc_srcext
AC_SUBST([FC_SRC_EXT])
AC_MSG_CHECKING([for object file extension])
AC_MSG_RESULT([$ac_objext])
OBJ_EXT=$ac_objext
AC_SUBST([OBJ_EXT])
])
### end WO_FC_PARAMETERS
### Determine runtime libraries
### The standard check is insufficient for some compilers
AC_DEFUN([WO_FC_LIBRARY_LDFLAGS],
[dnl
AC_REQUIRE([AC_PROG_FC])
case "$FC" in
nagfor*)
WO_NAGFOR_LIBRARY_LDFLAGS()
;;
*)
AC_FC_LIBRARY_LDFLAGS
;;
esac
])
### Check the NAG Fortran compiler
### Use the '-dryrun' feature and extract the libraries from the link command
### Note that the linker is gcc, not ld
AC_DEFUN([WO_NAGFOR_LIBRARY_LDFLAGS],
[dnl
AC_CACHE_CHECK([Fortran libraries of $FC],
[wo_cv_fc_libs],
[dnl
if test -z "$FCLIBS"; then
AC_LANG([Fortran])
AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
wo_save_fcflags=$FCFLAGS
FCFLAGS="-dryrun"
eval "set x $ac_link"
echo "set x $ac_link"
shift
_AS_ECHO_LOG([$[*]])
wo_nagfor_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1`
echo "$wo_nagfor_output" >&AS_MESSAGE_LOG_FD
FCFLAGS=$wo_save_fcflags
wo_cv_fc_libs=`echo $wo_nagfor_output | $SED -e 's/.* -o conftest \(.*\)$/\1/' | $SED -e "s/conftest.$ac_objext //"`
else
wo_cv_fc_libs=$FCLIBS
fi
])
FCLIBS=$wo_cv_fc_libs
AC_SUBST([FCLIBS])
])
### Check for basic F95 features
AC_DEFUN([WO_FC_CHECK_F95],
[dnl
AC_CACHE_CHECK([whether $FC supports Fortran 95 features],
[wo_cv_fc_supports_f95],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
integer, dimension(2) :: ii
integer :: i
type :: foo
integer, pointer :: bar => null ()
end type foo
forall (i = 1:2) ii(i) = i
contains
elemental function f(x)
real, intent(in) :: x
real :: f
f = x
end function f
pure function g (x) result (gx)
real, intent(in) :: x
real :: gx
gx = x
end function g
end program conftest
],
[wo_cv_fc_supports_f95="yes"],
[wo_cv_fc_supports_f95="no"])
])
FC_SUPPORTS_F95="$wo_cv_fc_supports_f95"
AC_SUBST([FC_SUPPORTS_F95])
if test "$FC_SUPPORTS_F95" = "no"; then
AC_MSG_NOTICE([error: ******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler is not a genuine F95 compiler, configure aborted.])
AC_MSG_ERROR([******************************************************************])
fi])
### end WO_FC_CHECK_F95
### Check for the TR15581 extensions (allocatable subobjects)
AC_DEFUN([WO_FC_CHECK_TR15581],
[AC_CACHE_CHECK([whether $FC supports allocatable subobjects],
[wo_cv_fc_allocatable],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
integer, dimension(:), allocatable :: bar
end type foo
end program conftest
],
[wo_cv_fc_allocatable="yes"],
[wo_cv_fc_allocatable="no"])
])
FC_SUPPORTS_ALLOCATABLE="$wo_cv_fc_allocatable"
AC_SUBST([FC_SUPPORTS_ALLOCATABLE])
if test "$FC_SUPPORTS_ALLOCATABLE" = "no"; then
AC_MSG_NOTICE([error: ****************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support allocatable structures, configure aborted.])
AC_MSG_ERROR([****************************************************************************])
fi])
### end WO_FC_CHECK_TR15581
### Check for allocatable scalars
AC_DEFUN([WO_FC_CHECK_ALLOCATABLE_SCALARS],
[AC_CACHE_CHECK([whether $FC supports allocatable scalars],
[wo_cv_fc_allocatable_scalars],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
integer, allocatable :: bar
end type foo
end program conftest
],
[wo_cv_fc_allocatable_scalars="yes"],
[wo_cv_fc_allocatable_scalars="no"])
])
FC_SUPPORTS_ALLOCATABLE_SCALARS="$wo_cv_fc_allocatable"
AC_SUBST([FC_SUPPORTS_ALLOCATABLE_SCALARS])
])
### end WO_FC_CHECK_ALLOCATABLE_SCALARS
### Check for the C bindings extensions of Fortran 2003
AC_DEFUN([WO_FC_CHECK_C_BINDING],
[AC_CACHE_CHECK([whether $FC supports ISO C binding and standard numeric types],
[wo_cv_fc_c_binding],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
use iso_c_binding
type, bind(c) :: t
integer(c_int) :: i
real(c_float) :: x1
real(c_double) :: x2
complex(c_float_complex) :: z1
complex(c_double_complex) :: z2
end type t
end program conftest
],
[wo_cv_fc_c_binding="yes"],
[wo_cv_fc_c_binding="no"])
])
FC_SUPPORTS_C_BINDING="$wo_cv_fc_c_binding"
AC_SUBST([FC_SUPPORTS_C_BINDING])
if test "$FC_SUPPORTS_C_BINDING" = "no"; then
AC_MSG_NOTICE([error: *******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support ISO C binding, configure aborted.])
AC_MSG_ERROR([********************************************************************])
fi
])
### end WO_FC_CHECK_C_BINDING
### Check for procedure pointers
AC_DEFUN([WO_FC_CHECK_PROCEDURE_POINTERS],
[AC_CACHE_CHECK([whether $FC supports procedure pointers (F2003)],
[wo_cv_prog_f03_procedure_pointers],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
procedure (proc_template), nopass, pointer :: proc => null ()
end type foo
abstract interface
subroutine proc_template ()
end subroutine proc_template
end interface
end program conftest
],
[wo_cv_prog_f03_procedure_pointers="yes"],
[wo_cv_prog_f03_procedure_pointers="no"])
])
FC_SUPPORTS_PROCEDURE_POINTERS="$wo_cv_prog_f03_procedure_pointers"
AC_SUBST([FC_SUPPORTS_PROCEDURE_POINTERS])
if test "$FC_SUPPORTS_PROCEDURE_POINTERS" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not understand procedure pointers, configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_PROCEDURE_POINTERS
### Check for the OO extensions of Fortran 2003
AC_DEFUN([WO_FC_CHECK_OO_FEATURES],
[AC_CACHE_CHECK([whether $FC supports OO features (F2003)],
[wo_cv_prog_f03_oo_features],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
module conftest
type, abstract :: foo
contains
procedure (proc_template), deferred :: proc
end type foo
type, extends (foo) :: foobar
contains
procedure :: proc
end type foobar
abstract interface
subroutine proc_template (f)
import foo
class(foo), intent(inout) :: f
end subroutine proc_template
end interface
contains
subroutine proc (f)
class(foobar), intent(inout) :: f
end subroutine proc
end module conftest
program main
use conftest
end program main
],
[wo_cv_prog_f03_oo_features="yes"],
[wo_cv_prog_f03_oo_features="no"])
])
FC_SUPPORTS_OO_FEATURES="$wo_cv_prog_f03_oo_features"
AC_SUBST([FC_SUPPORTS_OO_FEATURES])
])
### end WO_FC_CHECK_OO_FEATURES
### Check for the command line interface of Fortran 2003
### We actually have to link in order to check availability
AC_DEFUN([WO_FC_CHECK_CMDLINE],
[AC_CACHE_CHECK([whether $FC interfaces the command line (F2003)],
[wo_cv_fc_cmdline],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_LINK_IFELSE([dnl
program conftest
call get_command_argument (command_argument_count ())
end program conftest
],
[wo_cv_fc_cmdline="yes"],
[wo_cv_fc_cmdline="no"])
])
FC_SUPPORTS_CMDLINE="$wo_cv_fc_cmdline"
AC_SUBST([FC_SUPPORTS_CMDLINE])
if test "$FC_SUPPORTS_CMDLINE" = "no"; then
AC_MSG_NOTICE([error: ******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support get_command_argument; configure aborted.])
AC_MSG_ERROR([******************************************************************])
fi
])
### end WO_FC_CHECK_CMDLINE
### Check whether we can access environment variables (2003 standard)
### We actually have to link in order to check availability
AC_DEFUN([WO_FC_CHECK_ENVVAR],
[AC_CACHE_CHECK([whether $FC provides access to environment variables (F2003)],
[wo_cv_fc_envvar],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_LINK_IFELSE([dnl
program conftest
character(len=256) :: home
call get_environment_variable ("HOME", home)
end program conftest
],
[wo_cv_fc_envvar="yes"],
[wo_cv_fc_envvar="no"])
])
FC_SUPPORTS_ENVVAR="$wo_cv_fc_envvar"
AC_SUBST([FC_SUPPORTS_ENVVAR])
if test "$FC_SUPPORTS_ENVVAR" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support get_environment_variable; configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_ENVVAR
### Check whether the flush statement is supported
AC_DEFUN([WO_FC_CHECK_FLUSH],
[AC_CACHE_CHECK([whether $FC supports the flush statement (F2003)],
[wo_cv_fc_flush],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
implicit none
integer, parameter :: u=50
open (u, action="readwrite", status="scratch")
write (u, *) "test"
flush (u)
close (u)
end program conftest
],
[wo_cv_fc_flush="yes"],
[wo_cv_fc_flush="no"])
])
FC_SUPPORTS_FLUSH="$wo_cv_fc_flush"
AC_SUBST([FC_SUPPORTS_FLUSH])
if test "$FC_SUPPORTS_FLUSH" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support the flush statement; configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_FLUSH
### Check for iso_fortran_env
AC_DEFUN([WO_FC_CHECK_ISO_FORTRAN_ENV],
[AC_ARG_ENABLE([iso_fortran_env],
[AC_HELP_STRING([--disable-iso_fortran_env],
[disable use of iso_fortran_env, even if the compiler supports it]
)],
[], [enable_iso_fortran_env=yes]
)
if test "$enable_iso_fortran_env" = yes; then
AC_CACHE_CHECK([whether $FC supports iso_fortran_env (F2003)],
[wo_cv_fc_iso_fortran_env],
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
[AC_LINK_IFELSE(
[dnl
program conftest
use iso_fortran_env
implicit none
integer :: i
i = input_unit
i = output_unit
i = error_unit
i = iostat_end
i = iostat_eor
end program conftest
], [wo_cv_fc_iso_fortran_env=yes], [wo_cv_fc_iso_fortran_env=no]
)]
)
test "$wo_cv_fc_iso_fortran_env" = no && iso_fortran_env_stub=yes
else
AC_CHECKING([whether $FC supports iso_fortran_env (F2003)... disabled])
iso_fortran_env_stub=yes
fi
AM_CONDITIONAL([ISO_FORTRAN_ENV_STUB], [test -n "$iso_fortran_env_stub"])
]
)
### Check for wrapping of linker flags
### (nagfor 'feature': must be wrapped twice)
AC_DEFUN([WO_FC_CHECK_LDFLAGS_WRAPPING],
[AC_CACHE_CHECK([for wrapping of linker flags via -Wl],
[wo_cv_fc_ldflags_wrapping],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
ldflags_tmp=$LDFLAGS
LDFLAGS=-Wl,-rpath,/usr/lib
AC_LINK_IFELSE(AC_LANG_PROGRAM(),
[wo_cv_fc_ldflags_wrapping="once"],
[wo_cv_fc_ldflags_wrapping="unknown"])
if test "$wo_cv_fc_ldflags_wrapping" = "unknown"; then
LDFLAGS=-Wl,-Wl,,-rpath,,/usr/lib
AC_LINK_IFELSE(AC_LANG_PROGRAM(),
[wo_cv_fc_ldflags_wrapping="twice"])
fi
LDFLAGS=$ldflags_tmp
])
FC_LDFLAGS_WRAPPING="$wo_cv_fc_ldflags_wrapping"
AC_SUBST([FC_LDFLAGS_WRAPPING])
])
### end WO_FC_CHECK_LDFLAGS_WRAPPING
### Check for OpenMP support
AC_DEFUN([WO_FC_CHECK_OPENMP],
[AC_CACHE_CHECK([whether $FC supports OpenMP],
[wo_cv_fc_openmp],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
case $FC_VENDOR in
gfortran)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-fopenmp"
wo_cv_fc_openmp_header="use omp_lib"
;;
NAG)
wo_cv_fc_openmp="no"
;;
Intel)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-openmp"
wo_cv_fc_openmp_header="use omp_lib"
;;
PGI)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-mp"
wo_cv_fc_openmp_header=""
;;
*)
wo_cv_fc_openmp="no"
;;
esac
if test "$wo_cv_fc_openmp"="yes"; then
fcflags_tmp=$FCFLAGS
FCFLAGS="$wo_cv_fcflags_openmp $FCFLAGS"
unset OMP_NUM_THREADS
AC_RUN_IFELSE([dnl
program conftest
$wo_cv_fc_openmp_header
open (11, file="conftest.out", action="write", status="replace")
write (11, "(I0)") omp_get_max_threads ()
close (11)
end program conftest
],
[dnl
wo_cv_fc_openmp="yes"
wo_cv_fc_openmp_thread_limit=`cat conftest.out`],
[wo_cv_fc_openmp="no"],
[wo_cv_fc_openmp="maybe [cross-compiling]"])
FCFLAGS=$fcflags_tmp
fi
])
if test "$wo_cv_fc_openmp" = "yes"; then
AC_CACHE_CHECK([the default number of threads used by OpenMP],
[wo_cv_fc_openmp_thread_limit])
fi
FC_SUPPORTS_OPENMP="$wo_cv_fc_openmp"
AC_SUBST([FC_SUPPORTS_OPENMP])
])
### end WO_FC_CHECK_OPENMP
### Enable/disable OpenMP support
AC_DEFUN([WO_FC_SET_OPENMP],
[dnl
AC_REQUIRE([WO_FC_CHECK_OPENMP])
AC_ARG_ENABLE([fc_openmp],
[AS_HELP_STRING([--enable-fc-openmp],
[use OpenMP for the Fortran code [[no]]])])
AC_CACHE_CHECK([whether OpenMP is activated], [wo_cv_fc_use_openmp],
[dnl
if test "$FC_SUPPORTS_OPENMP" = "yes" -a "$enable_fc_openmp" = "yes"; then
wo_cv_fc_use_openmp="yes"
else
wo_cv_fc_use_openmp="no"
fi])
AM_CONDITIONAL([FC_USE_OPENMP],
[test "$wo_cv_fc_use_openmp" = "yes"])
AM_COND_IF([FC_USE_OPENMP],
[FC_OPENMP_ON=""
FC_OPENMP_OFF="!"
FCFLAGS_OPENMP="$wo_cv_fcflags_openmp"
FC_OPENMP_HEADER="$wo_cv_fc_openmp_header"
FC_OPENMP_DEFAULT_MAX_THREADS="$wo_cv_fc_openmp_thread_limit"
],
[FC_OPENMP_ON="!"
FC_OPENMP_OFF=""
FC_OPENMP_DEFAULT_MAX_THREADS="1"
])
AC_SUBST([FC_OPENMP_ON])
AC_SUBST([FC_OPENMP_OFF])
AC_SUBST([FCFLAGS_OPENMP])
AC_SUBST([FC_OPENMP_HEADER])
AC_SUBST([FC_OPENMP_DEFAULT_MAX_THREADS])
])
### end WO_FC_SET_OPENMP
### Check for profiling support
AC_DEFUN([WO_FC_CHECK_PROFILING],
[AC_CACHE_CHECK([whether $FC supports profiling via -pg],
[wo_cv_fc_profiling],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
fcflags_tmp=$FCFLAGS
FCFLAGS="-pg $FCFLAGS"
rm -f gmon.out
AC_RUN_IFELSE([dnl
program conftest
end program conftest
],
[dnl
if test -f gmon.out; then
wo_cv_fc_profiling="yes"
else
wo_cv_fc_profiling="no"
fi],
[wo_cv_fc_profiling="no"],
[wo_cv_fc_profiling="maybe [cross-compiling]"])
rm -f gmon.out
FCFLAGS=$fcflags_tmp
])
FC_SUPPORTS_PROFILING="$wo_cv_fc_profiling"
AC_SUBST([FC_SUPPORTS_PROFILING])
])
### end WO_FC_CHECK_PROFILING
### Enable/disable profiling support
AC_DEFUN([WO_FC_SET_PROFILING],
[dnl
AC_REQUIRE([WO_FC_CHECK_PROFILING])
AC_ARG_ENABLE([fc_profiling],
[AS_HELP_STRING([--enable-fc-profiling],
[use profiling for the Fortran code [[no]]])])
AC_CACHE_CHECK([whether profiling is activated], [wo_cv_fc_prof],
[dnl
if test "$FC_SUPPORTS_PROFILING" = "yes" -a "$enable_fc_profiling" = "yes"; then
wo_cv_fc_prof="yes"
FCFLAGS_PROFILING="-pg"
else
wo_cv_fc_prof="no"
FCFLAGS_PROFILING=""
fi])
AC_SUBST(FCFLAGS_PROFILING)
AM_CONDITIONAL([FC_USE_PROFILING],
[test -n "$FCFLAGS_PROFILING"])
])
### end WO_FC_SET_PROFILING
### Enable/disable impure Omega compilation
AC_DEFUN([WO_FC_SET_OMEGA_IMPURE],
[dnl
AC_REQUIRE([WO_FC_CHECK_F95])
AC_ARG_ENABLE([impure_omega],
[AS_HELP_STRING([--enable-fc-impure],
[compile Omega libraries impure [[no]]])])
AC_CACHE_CHECK([the default setting for impure omegalib], [wo_cv_fc_impure],
[dnl
if test "$impure_omega" = "yes" -o "$FC_SUPPORTS_F95" = "no"; then
wo_cv_fc_impure="yes"
else
wo_cv_fc_impure="no"
fi])
AM_CONDITIONAL([FC_IMPURE],
[test "$wo_cv_fc_impure" = "yes"])
])
### end WO_FC_OMEGA_IMPURE
### Check for quadruple precision support (real and complex!)
AC_DEFUN([WO_FC_CHECK_QUADRUPLE],
[dnl
AC_CACHE_CHECK([whether $FC permits quadruple real and complex],
[wo_cv_fc_quadruple],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
integer, parameter :: d=selected_real_kind(precision(1.)+1, range(1.)+1)
integer, parameter :: q=selected_real_kind(precision(1._d)+1, range(1._d))
real(kind=q) :: x
complex(kind=q) :: z
end program conftest
],
[wo_cv_fc_quadruple="yes"],
[wo_cv_fc_quadruple="no"])
])
FC_SUPPORTS_QUADRUPLE="$wo_cv_fc_quadruple"
AC_SUBST([FC_SUPPORTS_QUADRUPLE])
])
### end WO_FC_CHECK_QUADRUPLE
### Check for C quadruple precision support (real and complex!)
AC_DEFUN([WO_FC_CHECK_QUADRUPLE_C],
[dnl
AC_CACHE_CHECK([whether $FC permits quadruple-precision C types],
[wo_cv_fc_quadruple_c],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
use iso_c_binding
real(c_long_double) :: x
complex(c_long_double_complex) :: z
end program conftest
],
[wo_cv_fc_quadruple_c="yes"],
[wo_cv_fc_quadruple_c="no"])
])
FC_SUPPORTS_QUADRUPLE_C="$wo_cv_fc_quadruple_c"
AC_SUBST([FC_SUPPORTS_QUADRUPLE_C])
])
### end WO_FC_CHECK_QUADRUPLE_C
### Enable/disable quadruple precision and set default precision
AC_DEFUN([WO_FC_SET_PRECISION],
[dnl
AC_REQUIRE([WO_FC_CHECK_QUADRUPLE])
AC_ARG_ENABLE([fc_quadruple],
[AS_HELP_STRING([--enable-fc-quadruple],
[use quadruple precision in Fortran code [[no]]])])
if test "$enable_fc_quadruple" = "yes"; then
FC_QUAD_OR_SINGLE="quadruple"
else
FC_QUAD_OR_SINGLE="single"
fi
AC_SUBST([FC_QUAD_OR_SINGLE])
AC_CACHE_CHECK([the default numeric precision], [wo_cv_fc_precision],
[dnl
if test "$FC_SUPPORTS_QUADRUPLE" = "yes" \
-a "$FC_SUPPORTS_QUADRUPLE_C" = "yes" \
-a "$enable_fc_quadruple" = "yes"; then
wo_cv_fc_precision="quadruple"
wo_cv_fc_precision_c="c_long_double"
else
wo_cv_fc_precision="double"
wo_cv_fc_precision_c="c_double"
fi
])
FC_PRECISION="$wo_cv_fc_precision"
FC_PRECISION_C="$wo_cv_fc_precision_c"
AC_SUBST(FC_PRECISION)
AC_SUBST(FC_PRECISION_C)
AM_CONDITIONAL([FC_QUAD],
[test "$FC_PRECISION" = "quadruple"])
])
### end WO_FC_SET_PRECISION
### filename_case_conversion, define two variables LOWERCASE and
### UPPERCASE for /bin/sh filters that convert strings to lower
### and upper case, respectively
AC_DEFUN([WO_FC_FILENAME_CASE_CONVERSION],
[dnl
AC_SUBST([LOWERCASE])
AC_SUBST([UPPERCASE])
AC_PATH_PROGS(TR,tr)
AC_MSG_CHECKING([for case conversion])
if test -n "$TR"; then
LOWERCASE="$TR A-Z a-z"
UPPERCASE="$TR a-z A-Z"
WO_FC_FILENAME_CASE_CONVERSION_TEST
fi
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$TR works])
else
LOWERCASE="$SED y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
UPPERCASE="$SED y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/"
WO_FC_FILENAME_CASE_CONVERSION_TEST
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$SED works])
fi
fi])
### end WO_FC_FILE_CASE_CONVERSION
dnl
AC_DEFUN([WO_FC_FILENAME_CASE_CONVERSION_TEST],
[dnl
if test "`echo fOo | $LOWERCASE`" != "foo"; then
LOWERCASE=""
fi
if test "`echo fOo | $UPPERCASE`" != "FOO"; then
UPPERCASE=""
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl COMPILE_FC(VARIABLE, COMPILER, EXTENSION, MODULE,
dnl VALUE_SUCCESS, VALUE_FAILURE, KEEP)
dnl
AC_DEFUN([COMPILE_FC],
[cat >conftest.$3 <<__END__
$4
program conftest
print *, 42
end program conftest
__END__
$2 -o conftest conftest.$3 >/dev/null 2>&1
./conftest >conftest.out 2>/dev/null
if test 42 = "`$SED 's/ //g' conftest.out`"; then
$1="$5"
else
$1="$6"
fi
if test -z "$7"; then
rm -rf conftest* CONFTEST*
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl WO_FC_MODULE_FILE(NAME, EXTENSION, FORTRAN_COMPILER, SOURCE_EXTENSION)
dnl
AC_DEFUN([WO_FC_MODULE_FILE],
[AC_SUBST([$1])
AC_SUBST([$2])
AC_MSG_CHECKING([for Fortran90 module file naming convention])
COMPILE_FC([wo_result], [$3], [$4],
[module module_NAME
implicit none
integer, parameter, public :: forty_two = 42
end module module_NAME], [ok], [], [KEEP])
if test -n "[$]wo_result"; then
$1=unknown
$2=unknown
for name in module_name module_NAME MODULE_NAME conftest; do
for ext in m mod M MOD d D; do
if test -f "[$]name.[$]ext"; then
$1="$name"
$2="$ext"
break 2
fi
done
done
if test X"[$]$1" = X"module_name"; then
AC_MSG_RESULT([name: [$]$1, extension: .[$]$2 ])
else
AC_MSG_ERROR([unusual unsupported module file name convention: [$]$1.[$]$2])
fi
else
$1=""
$2=""
AC_MSG_RESULT([compiler failed])
AC_MSG_NOTICE([error: **************************************************************])
AC_MSG_NOTICE([error: Fortran compiler cannot create proper module files. This])
AC_MSG_NOTICE([error: might be caused by linking against a wrong gcc library.])
AC_MSG_ERROR([**************************************************************])
fi
rm -rf conftest* CONFTEST* module_name* module_NAME* MODULE_NAME*])
Index: trunk/configure.ac
===================================================================
--- trunk/configure.ac (revision 5198)
+++ trunk/configure.ac (revision 5199)
@@ -1,685 +1,686 @@
dnl configure.ac -- Main configuration script for WHIZARD
dnl
dnl Process this file with autoconf to produce a configure script.
dnl ************************************************************************
dnl configure -- Main configuration script for WHIZARD
dnl configure.ac -- WHIZARD configuration
dnl
dnl Copyright (C) 1999-2014 by
dnl Wolfgang Kilian <kilian@physik.uni-siegen.de>
dnl Thorsten Ohl <ohl@physik.uni-wuerzburg.de>
dnl Juergen Reuter <juergen.reuter@desy.de>
dnl with contributions from
dnl Christian Speckner <cnspeckn@googlemail.com>
dnl and others
dnl
dnl WHIZARD is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl WHIZARD is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl ***********************************************************************
dnl Environment variables that can be set by the user:
dnl FC Fortran compiler
dnl FCFLAGS Fortran compiler flags
dnl
dnl ***********************************************************************
dnl Start configuration
AC_INIT([WHIZARD],[2.2.0_beta])
AM_INIT_AUTOMAKE([1.11 color-tests parallel-tests])
AC_PREREQ([2.65])
dnl Caveat: automake internal macro
AM_MAKE_INCLUDE
########################################################################
### Package-specific initialization
AC_MSG_NOTICE([**************************************************************])
WO_CONFIGURE_SECTION([Start of package configuration])
### Further version information
PACKAGE_DATE="Feb 03 2014"
PACKAGE_STATUS="beta"
AC_SUBST(PACKAGE_DATE)
AC_SUBST(PACKAGE_STATUS)
AC_MSG_NOTICE([**************************************************************])
AC_MSG_NOTICE([Package name: AC_PACKAGE_NAME()])
AC_MSG_NOTICE([Version: AC_PACKAGE_VERSION()])
AC_MSG_NOTICE([Date: $PACKAGE_DATE])
AC_MSG_NOTICE([Status: $PACKAGE_STATUS])
AC_MSG_NOTICE([**************************************************************])
### Dump Package version and date to file 'VERSION'
echo "$PACKAGE_STRING ($PACKAGE_STATUS) $PACKAGE_DATE" \
> VERSION
### Source directory, for testing purposes
SRCDIR=`cd $srcdir && pwd`
AC_SUBST([SRCDIR])
### Build directory, for testing purposes
BUILDDIR=`pwd`
AC_SUBST([BUILDDIR])
### Location of installed libraries and such
eval BINDIR=$bindir
case $BINDIR in
NONE*) eval BINDIR=$prefix/bin ;;
esac
case $BINDIR in
NONE*) BINDIR="\${prefix}/bin" ;;
esac
AC_SUBST([BINDIR])
eval INCLUDEDIR=$includedir
case $INCLUDEDIR in
NONE*) eval INCLUDEDIR=$prefix/include ;;
esac
case $INCLUDEDIR in
NONE*) INCLUDEDIR="\${prefix}/include" ;;
esac
AC_SUBST([INCLUDEDIR])
### Location of installed libraries and such
eval PKGLIBDIR=$libdir/$PACKAGE
case $PKGLIBDIR in
NONE*) eval PKGLIBDIR=$prefix/lib/$PACKAGE ;;
esac
case $PKGLIBDIR in
NONE*) PKGLIBDIR="\${prefix}/lib/$PACKAGE" ;;
esac
AC_SUBST([PKGLIBDIR])
### Location of installed system-independent data
eval PKGDATADIR=$datarootdir/$PACKAGE
case $PKGDATADIR in
NONE*) eval PKGDATADIR=$prefix/share/$PACKAGE ;;
esac
case $PKGDATADIR in
NONE*) PKGDATADIR="\${prefix}/share/$PACKAGE" ;;
esac
AC_SUBST([PKGDATADIR])
### Location of installed TeX files and such
eval PKGTEXDIR=$datarootdir/texmf/$PACKAGE
case $PKGTEXDIR in
NONE*) eval PKGTEXDIR=$prefix/share/texmf/$PACKAGE ;;
esac
case $PKGTEXDIR in
NONE*) PKGTEXDIR="\${prefix}/share/texmf/$PACKAGE" ;;
esac
AC_SUBST([PKGTEXDIR])
########################################################################
### Required programs and checks
###---------------------------------------------------------------------
### GNU Tools
WO_CONFIGURE_SECTION([Generic tools])
### Initialize LIBTOOL
LT_INIT(dlopen)
LT_PREREQ([2.2.6b])
AX_CHECK_GNU_MAKE()
########################################################################
### Host system MAC OS X check for XCode
case $host in
*-darwin*)
WO_HLINE
AC_MSG_NOTICE([Host is $host, checking for XCode])
AC_PATH_PROG(XCODE_SELECT, xcode-select)
# locate currently selected Xcode path
if test "x$XCODE_SELECT" != "x"; then
AC_MSG_CHECKING(Xcode location)
DEVELOPER_DIR=`$XCODE_SELECT -print-path`
AC_MSG_RESULT([$DEVELOPER_DIR])
else
DEVELOPER_DIR=/Developer
fi
AC_SUBST(DEVELOPER_DIR)
XCODEPLIST=$DEVELOPER_DIR/Applications/Xcode.app/Contents/version.plist
if test -r "$XCODEPLIST"; then
AC_MSG_CHECKING(Xcode version)
if test "x$DEFAULTS" != "x"; then
XCODE_VERSION=`$DEFAULTS read $DEVELOPER_DIR/Applications/Xcode.app/Contents/version CFBundleShortVersionString`
else
XCODE_VERSION=`tr -d '\r\n' < $XCODEPLIST | sed -e 's/.*<key>CFBundleShortVersionString<\/key>.<string>\([[0-9.]]*\)<\/string>.*/\1/'`
fi
AC_MSG_RESULT([$XCODE_VERSION])
AC_SUBST(XCODE_VERSION)
fi
WO_HLINE
;;
*)
;;
esac
########################################################################
### Enable the distribution tools
### (default: disabled, to speed up compilation)
AC_ARG_ENABLE([distribution],
[AS_HELP_STRING([--enable-distribution],
[build the distribution incl. all docu (developers only) [[no]]])])
AC_CACHE_CHECK([whether we want to build the distribution],
[wo_cv_distribution],
[dnl
if test "$enable_distribution" = "yes"; then
wo_cv_distribution=yes
else
wo_cv_distribution=no
fi])
AM_CONDITIONAL([DISTRIBUTION],
[test "$enable_distribution" = "yes"])
########################################################################
if test "$enable_shared" = no; then
AC_MSG_ERROR([you've used --disable-shared which will not produce a working Whizard.])
fi
########################################################################
### We include the m4 macro tool here
AC_PATH_PROG(M4,m4,false)
if test "$M4" = false; then
AM_CONDITIONAL([M4_AVAILABLE],[false])
else
AM_CONDITIONAL([M4_AVAILABLE],[true])
fi
###---------------------------------------------------------------------
### Dynamic runtime linking
WO_CONFIGURE_SECTION([Dynamic runtime linking])
### Look for libdl (should provide 'dlopen' and friends)
AC_PROG_CC()
WO_PROG_DL()
### Define the conditional for static builds
if test "$enable_static" = yes; then
AM_CONDITIONAL([STATIC_AVAILABLE],[true])
else
AM_CONDITIONAL([STATIC_AVAILABLE],[false])
fi
###---------------------------------------------------------------------
### Noweb
WO_CONFIGURE_SECTION([Checks for 'noweb' system])
### Enable/disable noweb and determine locations of notangle, cpif, noweave
WO_PROG_NOWEB()
###---------------------------------------------------------------------
### LaTeX
WO_CONFIGURE_SECTION([Checks for 'LaTeX' system])
### Determine whether LaTeX is present
AC_PROG_LATEX()
AC_PROG_DVIPS()
AC_PROG_PDFLATEX()
AC_PROG_PS2PDF()
AC_PROG_EPSPDF()
AC_PROG_EPSTOPDF()
AC_PROG_SUPP_PDF()
AC_PROG_GZIP()
AC_PATH_PROG(ACROREAD,acroread,false)
AC_PATH_PROG(GHOSTVIEW,gv ghostview,false)
AC_PATH_PROG(DOT,dot,false)
### Determine whether Metapost is present and whether event display is possible
AC_PROG_MPOST()
WO_CHECK_EVENT_ANALYSIS_METHODS()
### We put here the check for HEVEA components as well
WO_PROG_HEVEA()
###---------------------------------------------------------------------
### Fortran compiler
WO_CONFIGURE_SECTION([Fortran compiler checks])
### Determine default compiler to use
user_FCFLAGS="${FCFLAGS}"
AC_PROG_FC()
### Choose FC standard for PYTHIA F77 files
AC_PROG_F77([$FC])
### Determine compiler vendor and version
WO_FC_GET_VENDOR_AND_VERSION()
-### Veto against gfortran 4.5/4.6
+### Veto against gfortran 4.5/4.6/4.7.0
WO_FC_VETO_GFORTRAN_456()
+WO_FC_VETO_GFORTRAN_470()
### Work around the `-g' vs. `-g90' confusion at NAG:
### (NB: apparently `echo -n' is not portable (OSX).
### Let's hope that tr is ...)
if test X"${user_FCFLAGS}" = X; then
if test X"${FC_VENDOR}" = X"NAG"; then
FCFLAGS="`for f in ${FCFLAGS}; do case $f in "-g") echo "-g90";; *) echo $f;; esac; done | tr '\n\r' ' '`"
fi
fi
### Require extension '.f90' for all compiler checks
AC_FC_SRCEXT([f90])
### Determine flags and extensions
WO_FC_PARAMETERS()
### Determine flags for linking the Fortran runtime library
WO_FC_LIBRARY_LDFLAGS()
### Check for Fortran 95 features
WO_FC_CHECK_F95()
### Check for allocatable subobjects (TR15581)
WO_FC_CHECK_TR15581()
### Check for allocatable scalars
WO_FC_CHECK_ALLOCATABLE_SCALARS()
### Check for ISO C binding support
WO_FC_CHECK_C_BINDING()
### Check for procedures pointers and abstract interfaces
WO_FC_CHECK_PROCEDURE_POINTERS()
### Check for type extension and further OO features
WO_FC_CHECK_OO_FEATURES()
### Check for F2003 command-line interface
WO_FC_CHECK_CMDLINE()
### Check for F2003-style access to environment variables
WO_FC_CHECK_ENVVAR()
### Check for the flush statement
WO_FC_CHECK_FLUSH()
### Check for iso_fortran_env
WO_FC_CHECK_ISO_FORTRAN_ENV()
### Check for quadruple precision support
WO_FC_CHECK_QUADRUPLE()
### Check for quadruple precision support in the C interface
WO_FC_CHECK_QUADRUPLE_C()
### Quadruple precision enforced upon request
WO_FC_SET_PRECISION()
### Warn about gfortran 4.7 (currently not necessary)
# WO_FC_WARN_GFORTRAN_47()
### OpenMP threading activated upon request
WO_FC_SET_OPENMP()
### Profiling compilation enforced upon request
WO_FC_SET_PROFILING()
### Impure subroutines enforced upon request
WO_FC_SET_OMEGA_IMPURE()
### Find the extension of Fortran module files
WO_FC_MODULE_FILE([FC_MODULE_NAME], [FC_MODULE_EXT], [$FC], [f90])
###---------------------------------------------------------------------
### O'Caml
WO_CONFIGURE_SECTION([Objective Caml checks])
### Check for ocamlc and its relatives
AC_PROG_OCAML()
if test "$enable_ocaml" != "no"; then
AC_OCAML_VERSION_CHECK(310000)
AC_PROG_OCAMLLEX()
AC_PROG_OCAMLYACC()
AC_PROG_OCAMLCP()
### Ocamlweb is required to be newer than v0.9
AC_PROG_OCAMLWEB(009000)
AC_PROG_OCAML_LABLGTK()
AC_PATH_PROGS(OCAMLDOT,ocamldot)
AC_PATH_PROGS(OCAMLDEFUN,ocamldefun)
else
AC_MSG_NOTICE([WARNING: O'Caml and O'Mega matrix elements disabled by request!])
AM_CONDITIONAL([OCAMLWEB_AVAILABLE],[false])
fi
########################################################################
### Libraries
###---------------------------------------------------------------------
### LHAPDF
WO_CONFIGURE_SECTION([LHAPDF])
WO_PROG_LHAPDF()
###---------------------------------------------------------------------
### HepMC
WO_CONFIGURE_SECTION([HepMC])
AC_PROG_CXX()
WO_PROG_HEPMC()
###---------------------------------------------------------------------
### STDHEP
AC_PROG_FC()
WO_CONFIGURE_SECTION([STDHEP])
WO_PROG_STDHEP()
###---------------------------------------------------------------------
### PYTHIA
WO_CONFIGURE_SECTION([SHOWERS PYTHIA MPI])
WO_PROG_QCD()
###---------------------------------------------------------------------
### HOPPET
AC_PROG_FC()
WO_CONFIGURE_SECTION([HOPPET])
WO_PROG_HOPPET()
###---------------------------------------------------------------------
### Extra flags for helping the linker finding libraries
LDFLAGS_STATIC="$wo_ldflags_stdcpp"
AC_SUBST([LDFLAGS_STATIC])
########################################################################
### Miscellaneous
WO_CONFIGURE_SECTION([Numerical checks])
###---------------------------------------------------------------------
### Disable irrelevant optimization for parameter files
### (default: disabled, to speed up compilation)
AC_ARG_ENABLE([optimization-for-parameter-files],
[AS_HELP_STRING([--enable-optimization-for-parameter-files],
[enable (useless) optimization for parameter files [[no]]])])
AC_CACHE_CHECK([whether we want optimization for parameter files],
[wo_cv_optimization_for_parfiles],
[dnl
if test "$enable_optimization_for_parameter_files" = "yes"; then
wo_cv_optimization_for_parfiles=yes
else
wo_cv_optimization_for_parfiles=no
fi])
AM_CONDITIONAL([OPTIMIZATION_FOR_PARFILES],
[test "$enable_optimization_for_parameter_files" = "yes"])
###---------------------------------------------------------------------
### Disable default checks upon request
AC_ARG_ENABLE([default_checks],
[AS_HELP_STRING([--disable-default-checks],
[disable the default self-checks [[no]]])])
AC_CACHE_CHECK([whether we want the default self-checks],
[wo_cv_default_checks],
[dnl
if test "$enable_default_checks" != "no"; then
wo_cv_default_checks=yes
else
wo_cv_default_checks=no
fi])
AM_CONDITIONAL([DEFAULT_CHECKS],
[test "$enable_default_checks" != "no"])
###---------------------------------------------------------------------
### Enable numerical checks upon request
AC_ARG_ENABLE([extnum_checks],
[AS_HELP_STRING([--enable-extnum-checks],
[enable time-consuming extensive SM, SUSY and models checks [[no]]])])
AC_CACHE_CHECK([whether we want extra extensive checks],
[wo_cv_extnum_checks],
[dnl
if test "$enable_extnum_checks" = "yes"; then
wo_cv_extnum_checks=yes
else
wo_cv_extnum_checks=no
fi])
AM_CONDITIONAL([EXT_NUM_CHECKS],
[test "$enable_extnum_checks" = "yes"])
########################################################################
### Wrapup
WO_CONFIGURE_SECTION([Finalize configuration])
###--------------------------------------------------------------------
### Main directory
AC_CONFIG_FILES([Makefile])
###---------------------------------------------------------------------
### Subdirectory src
AC_CONFIG_FILES([src/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/hepmc
AC_CONFIG_FILES([src/hepmc/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/pythia: WHIZARD's PYTHIA version
AC_CONFIG_FILES([src/pythia/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/muli: multiple interactions
AC_CONFIG_FILES([src/muli/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/lhapdf: dummy library as LHAPDF replacement
AC_CONFIG_FILES([src/lhapdf/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/pdf_builtin: Builtin PDFs
AC_CONFIG_FILES([src/pdf_builtin/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/stdhep: dummy library as STDHEP replacement
AC_CONFIG_FILES([src/stdhep/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/hoppet
AC_CONFIG_FILES([src/hoppet/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/shower: shower and all that
AC_CONFIG_FILES([src/shower/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/misc: numeric kinds, strings
AC_CONFIG_FILES([src/misc/Makefile] [src/misc/kinds.f90])
AC_CONFIG_FILES([src/misc/system_dependencies.f90], [
maxlen=70
i=1
pat=""
while test ${i} -lt ${maxlen}; do pat="${pat}."; i=`expr ${i} + 1`; done
pat=${pat}[[^\"]]
pat="/^ \"${pat}/ s/${pat}/&\&\\
\&/g"
$SED "${pat}" < src/misc/system_dependencies.f90 > \
src/misc/system_dependencies.tmp
mv -f src/misc/system_dependencies.tmp src/misc/system_dependencies.f90
])
###---------------------------------------------------------------------
### Subdirectory src/models
AC_CONFIG_FILES([src/models/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/models/threeshl_bundle
AC_CONFIG_FILES([src/models/threeshl_bundle/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/vamp
AC_CONFIG_SUBDIRS([src/vamp])
###---------------------------------------------------------------------
### Subdirectory src/whizard-core
AC_CONFIG_FILES([src/whizard-core/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/prebuilt
AC_CONFIG_FILES([src/prebuilt/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/omega
AC_CONFIG_SUBDIRS([src/omega])
###---------------------------------------------------------------------
### Subdirectory src/feynmf
AC_CONFIG_FILES([src/feynmf/Makefile])
###---------------------------------------------------------------------
### Subdirectory src/circe1
AC_CONFIG_SUBDIRS([src/circe1])
###---------------------------------------------------------------------
### Subdirectory src/circe2
AC_CONFIG_SUBDIRS([src/circe2])
###---------------------------------------------------------------------
### Subdirectory src/gamelan: WHIZARD graphics package
AC_CONFIG_FILES([src/gamelan/Makefile])
AC_CONFIG_FILES([src/gamelan/gml], [chmod u+x src/gamelan/gml])
###---------------------------------------------------------------------
### Subdirectory share
AC_CONFIG_FILES([share/Makefile])
###---------------------------------------------------------------------
### Subdirectory share/doc
AC_CONFIG_FILES([share/doc/Makefile])
###---------------------------------------------------------------------
### Subdirectory share/models
AC_CONFIG_FILES([share/models/Makefile])
###---------------------------------------------------------------------
### Subdirectory share/cuts
AC_CONFIG_FILES([share/cuts/Makefile])
###---------------------------------------------------------------------
### Subdirectory share/beam-sim
AC_CONFIG_FILES([share/beam-sim/Makefile])
###---------------------------------------------------------------------
### Subdirectory share/susy
AC_CONFIG_FILES([share/susy/Makefile])
###---------------------------------------------------------------------
### Subdirectory share/examples
AC_CONFIG_FILES([share/examples/Makefile])
###---------------------------------------------------------------------
### Subdirectory share/tests
AC_CONFIG_FILES([share/tests/Makefile])
###---------------------------------------------------------------------
### Subdirectory share/muli
AC_CONFIG_FILES([share/muli/Makefile])
###---------------------------------------------------------------------
### Subdirectory tests
AC_CONFIG_FILES([tests/Makefile])
AC_CONFIG_FILES([tests/run_whizard.sh], [chmod u+x tests/run_whizard.sh])
###---------------------------------------------------------------------
### Subdirectory libtool-config
AC_CONFIG_SUBDIRS([libtool-config])
###--------------------------------------------------------------------
### Subdirectory scripts
AC_CONFIG_FILES([scripts/Makefile])
AC_CONFIG_FILES([scripts/whizard-config], [chmod u+x scripts/whizard-config])
AC_CONFIG_FILES([scripts/whizard-setup.sh], [chmod u+x scripts/whizard-setup.sh])
AC_CONFIG_FILES([scripts/whizard-setup.csh], [chmod u+x scripts/whizard-setup.csh])
AC_CONFIG_FILES([scripts/libtool-config.sh], [chmod u+x scripts/libtool-config.sh])
AC_CONFIG_FILES([scripts/libtool-relocate.sh], [chmod u+x scripts/libtool-relocate.sh])
AC_CONFIG_FILES([scripts/whizard-relocate.sh], [chmod u+x scripts/whizard-relocate.sh])
###--------------------------------------------------------------------
AC_OUTPUT()
########################################################################
Index: trunk/m4/fortran.m4
===================================================================
--- trunk/m4/fortran.m4 (revision 5198)
+++ trunk/m4/fortran.m4 (revision 5199)
@@ -1,928 +1,934 @@
dnl fortran.m4 -- Fortran compiler checks beyond Autoconf built-ins
dnl
dnl The standard Fortran compiler test is AC_PROG_FC.
dnl At the end FC, FCFLAGS and FCFLAGS_f90 are set, if successful.
### Determine vendor and version string.
AC_DEFUN([WO_FC_GET_VENDOR_AND_VERSION],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_CACHE_CHECK([the compiler ID string],
[wo_cv_fc_id_string],
[dnl
$FC -V >conftest.log 2>&1
$FC -version >>conftest.log 2>&1
$FC --version >>conftest.log 2>&1
wo_fc_grep_GFORTRAN=`$GREP -i 'GNU Fortran' conftest.log | head -1`
wo_fc_grep_G95=`$GREP -i 'g95' conftest.log | $GREP -i 'gcc' | head -1`
wo_fc_grep_NAG=`$GREP 'NAG' conftest.log | head -1`
wo_fc_grep_Intel=`$GREP 'IFORT' conftest.log | head -1`
wo_fc_grep_Sun=`$GREP 'Sun' conftest.log | head -1`
wo_fc_grep_Lahey=`$GREP 'Lahey' conftest.log | head -1`
wo_fc_grep_PGF90=`$GREP 'pgf90' conftest.log | head -1`
wo_fc_grep_PGF95=`$GREP 'pgf95' conftest.log | head -1`
wo_fc_grep_PGHPF=`$GREP 'pghpf' conftest.log | head -1`
wo_fc_grep_default=`cat conftest.log | head -1`
if test -n "$wo_fc_grep_GFORTRAN"; then
wo_cv_fc_id_string=$wo_fc_grep_GFORTRAN
elif test -n "$wo_fc_grep_G95"; then
wo_cv_fc_id_string=$wo_fc_grep_G95
elif test -n "$wo_fc_grep_NAG"; then
wo_cv_fc_id_string=$wo_fc_grep_NAG
elif test -n "$wo_fc_grep_Intel"; then
wo_cv_fc_id_string=$wo_fc_grep_Intel
elif test -n "$wo_fc_grep_Sun"; then
wo_cv_fc_id_string=$wo_fc_grep_Sun
elif test -n "$wo_fc_grep_Lahey"; then
wo_cv_fc_id_string=$wo_fc_grep_Lahey
elif test -n "$wo_fc_grep_PGF90"; then
wo_cv_fc_id_string=$wo_fc_grep_PGF90
elif test -n "$wo_fc_grep_PGF95"; then
wo_cv_fc_id_string=$wo_fc_grep_PGF95
elif test -n "$wo_fc_grep_PGHPF"; then
wo_cv_fc_id_string=$wo_fc_grep_PGHPF
else
wo_cv_fc_id_string=$wo_fc_grep_default
fi
rm -f conftest.log
])
FC_ID_STRING="$wo_cv_fc_id_string"
AC_SUBST([FC_ID_STRING])
AC_CACHE_CHECK([the compiler vendor],
[wo_cv_fc_vendor],
[dnl
if test -n "$wo_fc_grep_GFORTRAN"; then
wo_cv_fc_vendor="gfortran"
elif test -n "$wo_fc_grep_G95"; then
wo_cv_fc_vendor="g95"
elif test -n "$wo_fc_grep_NAG"; then
wo_cv_fc_vendor="NAG"
elif test -n "$wo_fc_grep_Intel"; then
wo_cv_fc_vendor="Intel"
elif test -n "$wo_fc_grep_Sun"; then
wo_cv_fc_vendor="Sun"
elif test -n "$wo_fc_grep_Lahey"; then
wo_cv_fc_vendor="Lahey"
elif test -n "$wo_fc_grep_PGF90"; then
wo_cv_fc_vendor="PGI"
elif test -n "$wo_fc_grep_PGF95"; then
wo_cv_fc_vendor="PGI"
elif test -n "$wo_fc_grep_PGHPF"; then
wo_cv_fc_vendor="PGI"
else
wo_cv_fc_vendor="unknown"
fi
])
FC_VENDOR="$wo_cv_fc_vendor"
AC_SUBST([FC_VENDOR])
AM_CONDITIONAL([FC_IS_GFORTRAN],
[test "$FC_VENDOR" = gfortran])
AM_CONDITIONAL([FC_IS_NAG],
[test "$FC_VENDOR" = NAG])
AC_CACHE_CHECK([the compiler version],
[wo_cv_fc_version],
[dnl
case $FC_VENDOR in
gfortran)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`]
;;
g95)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.*g95 \([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'`]
;;
NAG)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.* Release \([0-9][0-9]*\.[0-9][0-9]*.*$\)/\1/'`]
;;
Intel)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/[a-zA-Z\(\)]//g;s/[0-9]\{8\}$//g'`]
;;
Sun)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/.* Fortran 95 \([0-9][0-9]*\.[0-9][0-9]*\) .*/\1/'`]
;;
PGI)
wo_cv_fc_version=[`echo $FC_ID_STRING | $SED -e 's/[a-zA-Z\(\)]//g;s/^[0-9]\{2\}//g;s/32.*\|64.*//g'`]
;;
*)
wo_cv_fc_version="unknown"
;;
esac
])
FC_VERSION="$wo_cv_fc_version"
AC_SUBST([FC_VERSION])
### Catch insufficient object-orientation in gfortran 4.5/4.6
if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.3" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.5.4" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.3" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.6.4"; then
FC_IS_GFORTRAN_456="yes"
else
FC_IS_GFORTRAN_456="no"
fi
AC_SUBST([FC_IS_GFORTRAN_456])
-### Catch memory corruption in gfortran 4.7
-if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.0" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.1" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.2" || test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.3"; then
-FC_IS_GFORTRAN_47="yes"
+### Catch compiler bug for static builds in gfortran 4.7
+if test "$wo_cv_fc_vendor" = "gfortran" -a "$wo_cv_fc_version" = "4.7.0"; then
+FC_IS_GFORTRAN_470="yes"
else
-FC_IS_GFORTRAN_47="no"
+FC_IS_GFORTRAN_470="no"
fi
-AC_SUBST([FC_IS_GFORTRAN_47])
-
-AM_CONDITIONAL([FC_GFORTRAN_47],
- [test "$FC_IS_GFORTRAN_47" = "yes"])
+AC_SUBST([FC_IS_GFORTRAN_470])
AC_CACHE_CHECK([the major version],
[wo_cv_fc_major_version],
[wo_cv_fc_major_version=[`echo $wo_cv_fc_version | $SED -e 's/\([0-9][0-9]*\)\..*/\1/'`]
])
FC_MAJOR_VERSION="$wo_cv_fc_major_version"
AC_SUBST([FC_MAJOR_VERSION])
])
### end WO_FC_GET_VENDOR_AND_VERSION
AC_DEFUN([WO_FC_VETO_GFORTRAN_456],
[dnl
if test "$FC_IS_GFORTRAN_456" = "yes"; then
AC_MSG_NOTICE([error: ***************************************************************])
AC_MSG_NOTICE([error: gfortran 4.5/4.6 object orientation support insufficient.])
AC_MSG_ERROR([***************************************************************])
fi
])
+AC_DEFUN([WO_FC_VETO_GFORTRAN_470],
+[dnl
+if test "$FC_IS_GFORTRAN_470" = "yes"; then
+AC_MSG_NOTICE([error: ***************************************************************])
+AC_MSG_NOTICE([error: gfortran 4.7.0 due to a major bug for static builds disabled .])
+AC_MSG_ERROR([***************************************************************])
+fi
+])
+
### This actually obsolete, but we keep the code, in case there
### are further issues with gfortran 4.7
AC_DEFUN([WO_FC_WARN_GFORTRAN_47],
[dnl
if test "$FC_IS_GFORTRAN_47" = "yes" -a "$FC_PRECISION" = "quadruple"; then
AC_MSG_NOTICE([WARNING: ***************************************************************])
AC_MSG_NOTICE([WARNING: gfortran 4.7 scanning with quadruple precision might fail.])
AC_MSG_WARN([***************************************************************])
fi
])
### Determine Fortran flags and file extensions
AC_DEFUN([WO_FC_PARAMETERS],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_REQUIRE([_LT_COMPILER_PIC])
AC_LANG([Fortran])
AC_MSG_CHECKING([for $FC flags])
AC_MSG_RESULT([$FCFLAGS])
AC_MSG_CHECKING([for $FC flag to produce position-independent code])
AC_MSG_RESULT([$lt_prog_compiler_pic_FC])
FCFLAGS_PIC=$lt_prog_compiler_pic_FC
AC_SUBST([FCFLAGS_PIC])
AC_MSG_CHECKING([for $FC source extension])
AC_MSG_RESULT([$ac_fc_srcext])
FC_SRC_EXT=$ac_fc_srcext
AC_SUBST([FC_SRC_EXT])
AC_MSG_CHECKING([for object file extension])
AC_MSG_RESULT([$ac_objext])
OBJ_EXT=$ac_objext
AC_SUBST([OBJ_EXT])
])
### end WO_FC_PARAMETERS
### Determine runtime libraries
### The standard check is insufficient for some compilers
AC_DEFUN([WO_FC_LIBRARY_LDFLAGS],
[dnl
AC_REQUIRE([AC_PROG_FC])
case "$FC" in
nagfor*)
WO_NAGFOR_LIBRARY_LDFLAGS()
;;
*)
AC_FC_LIBRARY_LDFLAGS
;;
esac
])
### Check the NAG Fortran compiler
### Use the '-dryrun' feature and extract the libraries from the link command
### Note that the linker is gcc, not ld
AC_DEFUN([WO_NAGFOR_LIBRARY_LDFLAGS],
[dnl
AC_CACHE_CHECK([Fortran libraries of $FC],
[wo_cv_fc_libs],
[dnl
if test -z "$FCLIBS"; then
AC_LANG([Fortran])
AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
wo_save_fcflags=$FCFLAGS
FCFLAGS="-dryrun"
eval "set x $ac_link"
echo "set x $ac_link"
shift
_AS_ECHO_LOG([$[*]])
wo_nagfor_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1`
echo "$wo_nagfor_output" >&AS_MESSAGE_LOG_FD
FCFLAGS=$wo_save_fcflags
wo_cv_fc_libs=`echo $wo_nagfor_output | $SED -e 's/.* -o conftest \(.*\)$/\1/' | $SED -e "s/conftest.$ac_objext //"`
else
wo_cv_fc_libs=$FCLIBS
fi
])
FCLIBS=$wo_cv_fc_libs
AC_SUBST([FCLIBS])
])
### Check for basic F95 features
AC_DEFUN([WO_FC_CHECK_F95],
[dnl
AC_CACHE_CHECK([whether $FC supports Fortran 95 features],
[wo_cv_fc_supports_f95],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
integer, dimension(2) :: ii
integer :: i
type :: foo
integer, pointer :: bar => null ()
end type foo
forall (i = 1:2) ii(i) = i
contains
elemental function f(x)
real, intent(in) :: x
real :: f
f = x
end function f
pure function g (x) result (gx)
real, intent(in) :: x
real :: gx
gx = x
end function g
end program conftest
],
[wo_cv_fc_supports_f95="yes"],
[wo_cv_fc_supports_f95="no"])
])
FC_SUPPORTS_F95="$wo_cv_fc_supports_f95"
AC_SUBST([FC_SUPPORTS_F95])
if test "$FC_SUPPORTS_F95" = "no"; then
AC_MSG_NOTICE([error: ******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler is not a genuine F95 compiler, configure aborted.])
AC_MSG_ERROR([******************************************************************])
fi])
### end WO_FC_CHECK_F95
### Check for the TR15581 extensions (allocatable subobjects)
AC_DEFUN([WO_FC_CHECK_TR15581],
[AC_CACHE_CHECK([whether $FC supports allocatable subobjects],
[wo_cv_fc_allocatable],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
integer, dimension(:), allocatable :: bar
end type foo
end program conftest
],
[wo_cv_fc_allocatable="yes"],
[wo_cv_fc_allocatable="no"])
])
FC_SUPPORTS_ALLOCATABLE="$wo_cv_fc_allocatable"
AC_SUBST([FC_SUPPORTS_ALLOCATABLE])
if test "$FC_SUPPORTS_ALLOCATABLE" = "no"; then
AC_MSG_NOTICE([error: ****************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support allocatable structures, configure aborted.])
AC_MSG_ERROR([****************************************************************************])
fi])
### end WO_FC_CHECK_TR15581
### Check for allocatable scalars
AC_DEFUN([WO_FC_CHECK_ALLOCATABLE_SCALARS],
[AC_CACHE_CHECK([whether $FC supports allocatable scalars],
[wo_cv_fc_allocatable_scalars],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
integer, allocatable :: bar
end type foo
end program conftest
],
[wo_cv_fc_allocatable_scalars="yes"],
[wo_cv_fc_allocatable_scalars="no"])
])
FC_SUPPORTS_ALLOCATABLE_SCALARS="$wo_cv_fc_allocatable"
AC_SUBST([FC_SUPPORTS_ALLOCATABLE_SCALARS])
])
### end WO_FC_CHECK_ALLOCATABLE_SCALARS
### Check for the C bindings extensions of Fortran 2003
AC_DEFUN([WO_FC_CHECK_C_BINDING],
[AC_CACHE_CHECK([whether $FC supports ISO C binding and standard numeric types],
[wo_cv_fc_c_binding],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
use iso_c_binding
type, bind(c) :: t
integer(c_int) :: i
real(c_float) :: x1
real(c_double) :: x2
complex(c_float_complex) :: z1
complex(c_double_complex) :: z2
end type t
end program conftest
],
[wo_cv_fc_c_binding="yes"],
[wo_cv_fc_c_binding="no"])
])
FC_SUPPORTS_C_BINDING="$wo_cv_fc_c_binding"
AC_SUBST([FC_SUPPORTS_C_BINDING])
if test "$FC_SUPPORTS_C_BINDING" = "no"; then
AC_MSG_NOTICE([error: *******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support ISO C binding, configure aborted.])
AC_MSG_ERROR([********************************************************************])
fi
])
### end WO_FC_CHECK_C_BINDING
### Check for procedure pointers
AC_DEFUN([WO_FC_CHECK_PROCEDURE_POINTERS],
[AC_CACHE_CHECK([whether $FC supports procedure pointers (F2003)],
[wo_cv_prog_f03_procedure_pointers],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
type :: foo
procedure (proc_template), nopass, pointer :: proc => null ()
end type foo
abstract interface
subroutine proc_template ()
end subroutine proc_template
end interface
end program conftest
],
[wo_cv_prog_f03_procedure_pointers="yes"],
[wo_cv_prog_f03_procedure_pointers="no"])
])
FC_SUPPORTS_PROCEDURE_POINTERS="$wo_cv_prog_f03_procedure_pointers"
AC_SUBST([FC_SUPPORTS_PROCEDURE_POINTERS])
if test "$FC_SUPPORTS_PROCEDURE_POINTERS" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not understand procedure pointers, configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_PROCEDURE_POINTERS
### Check for the OO extensions of Fortran 2003
AC_DEFUN([WO_FC_CHECK_OO_FEATURES],
[AC_CACHE_CHECK([whether $FC supports OO features (F2003)],
[wo_cv_prog_f03_oo_features],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
module conftest
type, abstract :: foo
contains
procedure (proc_template), deferred :: proc
end type foo
type, extends (foo) :: foobar
contains
procedure :: proc
end type foobar
abstract interface
subroutine proc_template (f)
import foo
class(foo), intent(inout) :: f
end subroutine proc_template
end interface
contains
subroutine proc (f)
class(foobar), intent(inout) :: f
end subroutine proc
end module conftest
program main
use conftest
end program main
],
[wo_cv_prog_f03_oo_features="yes"],
[wo_cv_prog_f03_oo_features="no"])
])
FC_SUPPORTS_OO_FEATURES="$wo_cv_prog_f03_oo_features"
AC_SUBST([FC_SUPPORTS_OO_FEATURES])
])
### end WO_FC_CHECK_OO_FEATURES
### Check for the command line interface of Fortran 2003
### We actually have to link in order to check availability
AC_DEFUN([WO_FC_CHECK_CMDLINE],
[AC_CACHE_CHECK([whether $FC interfaces the command line (F2003)],
[wo_cv_fc_cmdline],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_LINK_IFELSE([dnl
program conftest
call get_command_argument (command_argument_count ())
end program conftest
],
[wo_cv_fc_cmdline="yes"],
[wo_cv_fc_cmdline="no"])
])
FC_SUPPORTS_CMDLINE="$wo_cv_fc_cmdline"
AC_SUBST([FC_SUPPORTS_CMDLINE])
if test "$FC_SUPPORTS_CMDLINE" = "no"; then
AC_MSG_NOTICE([error: ******************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support get_command_argument; configure aborted.])
AC_MSG_ERROR([******************************************************************])
fi
])
### end WO_FC_CHECK_CMDLINE
### Check whether we can access environment variables (2003 standard)
### We actually have to link in order to check availability
AC_DEFUN([WO_FC_CHECK_ENVVAR],
[AC_CACHE_CHECK([whether $FC provides access to environment variables (F2003)],
[wo_cv_fc_envvar],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_LINK_IFELSE([dnl
program conftest
character(len=256) :: home
call get_environment_variable ("HOME", home)
end program conftest
],
[wo_cv_fc_envvar="yes"],
[wo_cv_fc_envvar="no"])
])
FC_SUPPORTS_ENVVAR="$wo_cv_fc_envvar"
AC_SUBST([FC_SUPPORTS_ENVVAR])
if test "$FC_SUPPORTS_ENVVAR" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support get_environment_variable; configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_ENVVAR
### Check whether the flush statement is supported
AC_DEFUN([WO_FC_CHECK_FLUSH],
[AC_CACHE_CHECK([whether $FC supports the flush statement (F2003)],
[wo_cv_fc_flush],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
implicit none
integer, parameter :: u=50
open (u, action="readwrite", status="scratch")
write (u, *) "test"
flush (u)
close (u)
end program conftest
],
[wo_cv_fc_flush="yes"],
[wo_cv_fc_flush="no"])
])
FC_SUPPORTS_FLUSH="$wo_cv_fc_flush"
AC_SUBST([FC_SUPPORTS_FLUSH])
if test "$FC_SUPPORTS_FLUSH" = "no"; then
AC_MSG_NOTICE([error: ***************************************************************************])
AC_MSG_NOTICE([error: Fortran compiler does not support the flush statement; configure aborted.])
AC_MSG_ERROR([***************************************************************************])
fi])
### end WO_FC_CHECK_FLUSH
### Check for iso_fortran_env
AC_DEFUN([WO_FC_CHECK_ISO_FORTRAN_ENV],
[AC_ARG_ENABLE([iso_fortran_env],
[AC_HELP_STRING([--disable-iso_fortran_env],
[disable use of iso_fortran_env, even if the compiler supports it]
)],
[], [enable_iso_fortran_env=yes]
)
if test "$enable_iso_fortran_env" = yes; then
AC_CACHE_CHECK([whether $FC supports iso_fortran_env (F2003)],
[wo_cv_fc_iso_fortran_env],
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
[AC_LINK_IFELSE(
[dnl
program conftest
use iso_fortran_env
implicit none
integer :: i
i = input_unit
i = output_unit
i = error_unit
i = iostat_end
i = iostat_eor
end program conftest
], [wo_cv_fc_iso_fortran_env=yes], [wo_cv_fc_iso_fortran_env=no]
)]
)
test "$wo_cv_fc_iso_fortran_env" = no && iso_fortran_env_stub=yes
else
AC_CHECKING([whether $FC supports iso_fortran_env (F2003)... disabled])
iso_fortran_env_stub=yes
fi
AM_CONDITIONAL([ISO_FORTRAN_ENV_STUB], [test -n "$iso_fortran_env_stub"])
]
)
### Check for wrapping of linker flags
### (nagfor 'feature': must be wrapped twice)
AC_DEFUN([WO_FC_CHECK_LDFLAGS_WRAPPING],
[AC_CACHE_CHECK([for wrapping of linker flags via -Wl],
[wo_cv_fc_ldflags_wrapping],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
ldflags_tmp=$LDFLAGS
LDFLAGS=-Wl,-rpath,/usr/lib
AC_LINK_IFELSE(AC_LANG_PROGRAM(),
[wo_cv_fc_ldflags_wrapping="once"],
[wo_cv_fc_ldflags_wrapping="unknown"])
if test "$wo_cv_fc_ldflags_wrapping" = "unknown"; then
LDFLAGS=-Wl,-Wl,,-rpath,,/usr/lib
AC_LINK_IFELSE(AC_LANG_PROGRAM(),
[wo_cv_fc_ldflags_wrapping="twice"])
fi
LDFLAGS=$ldflags_tmp
])
FC_LDFLAGS_WRAPPING="$wo_cv_fc_ldflags_wrapping"
AC_SUBST([FC_LDFLAGS_WRAPPING])
])
### end WO_FC_CHECK_LDFLAGS_WRAPPING
### Check for OpenMP support
AC_DEFUN([WO_FC_CHECK_OPENMP],
[AC_CACHE_CHECK([whether $FC supports OpenMP],
[wo_cv_fc_openmp],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
case $FC_VENDOR in
gfortran)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-fopenmp"
wo_cv_fc_openmp_header="use omp_lib"
;;
NAG)
wo_cv_fc_openmp="no"
;;
Intel)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-openmp"
wo_cv_fc_openmp_header="use omp_lib"
;;
PGI)
wo_cv_fc_openmp="yes"
wo_cv_fcflags_openmp="-mp"
wo_cv_fc_openmp_header=""
;;
*)
wo_cv_fc_openmp="no"
;;
esac
if test "$wo_cv_fc_openmp"="yes"; then
fcflags_tmp=$FCFLAGS
FCFLAGS="$wo_cv_fcflags_openmp $FCFLAGS"
unset OMP_NUM_THREADS
AC_RUN_IFELSE([dnl
program conftest
$wo_cv_fc_openmp_header
open (11, file="conftest.out", action="write", status="replace")
write (11, "(I0)") omp_get_max_threads ()
close (11)
end program conftest
],
[dnl
wo_cv_fc_openmp="yes"
wo_cv_fc_openmp_thread_limit=`cat conftest.out`],
[wo_cv_fc_openmp="no"],
[wo_cv_fc_openmp="maybe [cross-compiling]"])
FCFLAGS=$fcflags_tmp
fi
])
if test "$wo_cv_fc_openmp" = "yes"; then
AC_CACHE_CHECK([the default number of threads used by OpenMP],
[wo_cv_fc_openmp_thread_limit])
fi
FC_SUPPORTS_OPENMP="$wo_cv_fc_openmp"
AC_SUBST([FC_SUPPORTS_OPENMP])
])
### end WO_FC_CHECK_OPENMP
### Enable/disable OpenMP support
AC_DEFUN([WO_FC_SET_OPENMP],
[dnl
AC_REQUIRE([WO_FC_CHECK_OPENMP])
AC_ARG_ENABLE([fc_openmp],
[AS_HELP_STRING([--enable-fc-openmp],
[use OpenMP for the Fortran code [[no]]])])
AC_CACHE_CHECK([whether OpenMP is activated], [wo_cv_fc_use_openmp],
[dnl
if test "$FC_SUPPORTS_OPENMP" = "yes" -a "$enable_fc_openmp" = "yes"; then
wo_cv_fc_use_openmp="yes"
else
wo_cv_fc_use_openmp="no"
fi])
AM_CONDITIONAL([FC_USE_OPENMP],
[test "$wo_cv_fc_use_openmp" = "yes"])
AM_COND_IF([FC_USE_OPENMP],
[FC_OPENMP_ON=""
FC_OPENMP_OFF="!"
FCFLAGS_OPENMP="$wo_cv_fcflags_openmp"
FC_OPENMP_HEADER="$wo_cv_fc_openmp_header"
FC_OPENMP_DEFAULT_MAX_THREADS="$wo_cv_fc_openmp_thread_limit"
],
[FC_OPENMP_ON="!"
FC_OPENMP_OFF=""
FC_OPENMP_DEFAULT_MAX_THREADS="1"
])
AC_SUBST([FC_OPENMP_ON])
AC_SUBST([FC_OPENMP_OFF])
AC_SUBST([FCFLAGS_OPENMP])
AC_SUBST([FC_OPENMP_HEADER])
AC_SUBST([FC_OPENMP_DEFAULT_MAX_THREADS])
])
### end WO_FC_SET_OPENMP
### Check for profiling support
AC_DEFUN([WO_FC_CHECK_PROFILING],
[AC_CACHE_CHECK([whether $FC supports profiling via -pg],
[wo_cv_fc_profiling],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
fcflags_tmp=$FCFLAGS
FCFLAGS="-pg $FCFLAGS"
rm -f gmon.out
AC_RUN_IFELSE([dnl
program conftest
end program conftest
],
[dnl
if test -f gmon.out; then
wo_cv_fc_profiling="yes"
else
wo_cv_fc_profiling="no"
fi],
[wo_cv_fc_profiling="no"],
[wo_cv_fc_profiling="maybe [cross-compiling]"])
rm -f gmon.out
FCFLAGS=$fcflags_tmp
])
FC_SUPPORTS_PROFILING="$wo_cv_fc_profiling"
AC_SUBST([FC_SUPPORTS_PROFILING])
])
### end WO_FC_CHECK_PROFILING
### Enable/disable profiling support
AC_DEFUN([WO_FC_SET_PROFILING],
[dnl
AC_REQUIRE([WO_FC_CHECK_PROFILING])
AC_ARG_ENABLE([fc_profiling],
[AS_HELP_STRING([--enable-fc-profiling],
[use profiling for the Fortran code [[no]]])])
AC_CACHE_CHECK([whether profiling is activated], [wo_cv_fc_prof],
[dnl
if test "$FC_SUPPORTS_PROFILING" = "yes" -a "$enable_fc_profiling" = "yes"; then
wo_cv_fc_prof="yes"
FCFLAGS_PROFILING="-pg"
else
wo_cv_fc_prof="no"
FCFLAGS_PROFILING=""
fi])
AC_SUBST(FCFLAGS_PROFILING)
AM_CONDITIONAL([FC_USE_PROFILING],
[test -n "$FCFLAGS_PROFILING"])
])
### end WO_FC_SET_PROFILING
### Enable/disable impure Omega compilation
AC_DEFUN([WO_FC_SET_OMEGA_IMPURE],
[dnl
AC_REQUIRE([WO_FC_CHECK_F95])
AC_ARG_ENABLE([impure_omega],
[AS_HELP_STRING([--enable-fc-impure],
[compile Omega libraries impure [[no]]])])
AC_CACHE_CHECK([the default setting for impure omegalib], [wo_cv_fc_impure],
[dnl
if test "$impure_omega" = "yes" -o "$FC_SUPPORTS_F95" = "no"; then
wo_cv_fc_impure="yes"
else
wo_cv_fc_impure="no"
fi])
AM_CONDITIONAL([FC_IMPURE],
[test "$wo_cv_fc_impure" = "yes"])
])
### end WO_FC_OMEGA_IMPURE
### Check for quadruple precision support (real and complex!)
AC_DEFUN([WO_FC_CHECK_QUADRUPLE],
[dnl
AC_CACHE_CHECK([whether $FC permits quadruple real and complex],
[wo_cv_fc_quadruple],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
integer, parameter :: d=selected_real_kind(precision(1.)+1, range(1.)+1)
integer, parameter :: q=selected_real_kind(precision(1._d)+1, range(1._d))
real(kind=q) :: x
complex(kind=q) :: z
end program conftest
],
[wo_cv_fc_quadruple="yes"],
[wo_cv_fc_quadruple="no"])
])
FC_SUPPORTS_QUADRUPLE="$wo_cv_fc_quadruple"
AC_SUBST([FC_SUPPORTS_QUADRUPLE])
])
### end WO_FC_CHECK_QUADRUPLE
### Check for C quadruple precision support (real and complex!)
AC_DEFUN([WO_FC_CHECK_QUADRUPLE_C],
[dnl
AC_CACHE_CHECK([whether $FC permits quadruple-precision C types],
[wo_cv_fc_quadruple_c],
[dnl
AC_REQUIRE([AC_PROG_FC])
AC_LANG([Fortran])
AC_COMPILE_IFELSE([dnl
program conftest
use iso_c_binding
real(c_long_double) :: x
complex(c_long_double_complex) :: z
end program conftest
],
[wo_cv_fc_quadruple_c="yes"],
[wo_cv_fc_quadruple_c="no"])
])
FC_SUPPORTS_QUADRUPLE_C="$wo_cv_fc_quadruple_c"
AC_SUBST([FC_SUPPORTS_QUADRUPLE_C])
])
### end WO_FC_CHECK_QUADRUPLE_C
### Enable/disable quadruple precision and set default precision
AC_DEFUN([WO_FC_SET_PRECISION],
[dnl
AC_REQUIRE([WO_FC_CHECK_QUADRUPLE])
AC_ARG_ENABLE([fc_quadruple],
[AS_HELP_STRING([--enable-fc-quadruple],
[use quadruple precision in Fortran code [[no]]])])
if test "$enable_fc_quadruple" = "yes"; then
FC_QUAD_OR_SINGLE="quadruple"
else
FC_QUAD_OR_SINGLE="single"
fi
AC_SUBST([FC_QUAD_OR_SINGLE])
AC_CACHE_CHECK([the default numeric precision], [wo_cv_fc_precision],
[dnl
if test "$FC_SUPPORTS_QUADRUPLE" = "yes" \
-a "$FC_SUPPORTS_QUADRUPLE_C" = "yes" \
-a "$enable_fc_quadruple" = "yes"; then
wo_cv_fc_precision="quadruple"
wo_cv_fc_precision_c="c_long_double"
else
wo_cv_fc_precision="double"
wo_cv_fc_precision_c="c_double"
fi
])
FC_PRECISION="$wo_cv_fc_precision"
FC_PRECISION_C="$wo_cv_fc_precision_c"
AC_SUBST(FC_PRECISION)
AC_SUBST(FC_PRECISION_C)
AM_CONDITIONAL([FC_QUAD],
[test "$FC_PRECISION" = "quadruple"])
])
### end WO_FC_SET_PRECISION
### filename_case_conversion, define two variables LOWERCASE and
### UPPERCASE for /bin/sh filters that convert strings to lower
### and upper case, respectively
AC_DEFUN([WO_FC_FILENAME_CASE_CONVERSION],
[dnl
AC_SUBST([LOWERCASE])
AC_SUBST([UPPERCASE])
AC_PATH_PROGS(TR,tr)
AC_MSG_CHECKING([for case conversion])
if test -n "$TR"; then
LOWERCASE="$TR A-Z a-z"
UPPERCASE="$TR a-z A-Z"
WO_FC_FILENAME_CASE_CONVERSION_TEST
fi
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$TR works])
else
LOWERCASE="$SED y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
UPPERCASE="$SED y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/"
WO_FC_FILENAME_CASE_CONVERSION_TEST
if test -n "$UPPERCASE" && test -n "$LOWERCASE"; then
AC_MSG_RESULT([$SED works])
fi
fi])
### end WO_FC_FILE_CASE_CONVERSION
dnl
AC_DEFUN([WO_FC_FILENAME_CASE_CONVERSION_TEST],
[dnl
if test "`echo fOo | $LOWERCASE`" != "foo"; then
LOWERCASE=""
fi
if test "`echo fOo | $UPPERCASE`" != "FOO"; then
UPPERCASE=""
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl COMPILE_FC(VARIABLE, COMPILER, EXTENSION, MODULE,
dnl VALUE_SUCCESS, VALUE_FAILURE, KEEP)
dnl
AC_DEFUN([COMPILE_FC],
[cat >conftest.$3 <<__END__
$4
program conftest
print *, 42
end program conftest
__END__
$2 -o conftest conftest.$3 >/dev/null 2>&1
./conftest >conftest.out 2>/dev/null
if test 42 = "`$SED 's/ //g' conftest.out`"; then
$1="$5"
else
$1="$6"
fi
if test -z "$7"; then
rm -rf conftest* CONFTEST*
fi])
dnl
dnl --------------------------------------------------------------------
dnl
dnl WO_FC_MODULE_FILE(NAME, EXTENSION, FORTRAN_COMPILER, SOURCE_EXTENSION)
dnl
AC_DEFUN([WO_FC_MODULE_FILE],
[AC_SUBST([$1])
AC_SUBST([$2])
AC_MSG_CHECKING([for Fortran90 module file naming convention])
COMPILE_FC([wo_result], [$3], [$4],
[module module_NAME
implicit none
integer, parameter, public :: forty_two = 42
end module module_NAME], [ok], [], [KEEP])
if test -n "[$]wo_result"; then
$1=unknown
$2=unknown
for name in module_name module_NAME MODULE_NAME conftest; do
for ext in m mod M MOD d D; do
if test -f "[$]name.[$]ext"; then
$1="$name"
$2="$ext"
break 2
fi
done
done
if test X"[$]$1" = X"module_name"; then
AC_MSG_RESULT([name: [$]$1, extension: .[$]$2 ])
else
AC_MSG_ERROR([unusual unsupported module file name convention: [$]$1.[$]$2])
fi
else
$1=""
$2=""
AC_MSG_RESULT([compiler failed])
AC_MSG_NOTICE([error: **************************************************************])
AC_MSG_NOTICE([error: Fortran compiler cannot create proper module files. This])
AC_MSG_NOTICE([error: might be caused by linking against a wrong gcc library.])
AC_MSG_ERROR([**************************************************************])
fi
rm -rf conftest* CONFTEST* module_name* module_NAME* MODULE_NAME*])

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 6:56 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3805704
Default Alt Text
(163 KB)

Event Timeline