|
Packit Service |
c5cf8c |
dnl/*D
|
|
Packit Service |
c5cf8c |
dnl PAC_PROG_F77_CMDARGS - Determine how to access the command line from
|
|
Packit Service |
c5cf8c |
dnl Fortran 77
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl Output Effects:
|
|
Packit Service |
c5cf8c |
dnl The following variables are set:
|
|
Packit Service |
c5cf8c |
dnl.vb
|
|
Packit Service |
c5cf8c |
dnl F77_GETARG - Statement to get an argument i into string s
|
|
Packit Service |
c5cf8c |
dnl F77_IARGC - Routine to return the number of arguments
|
|
Packit Service |
c5cf8c |
dnl FXX_MODULE - Module command when using Fortran 90 compiler
|
|
Packit Service |
c5cf8c |
dnl F77_GETARGDECL - Declaration of routine used for F77_GETARG
|
|
Packit Service |
c5cf8c |
dnl F77_GETARG_FFLAGS - Flags needed when compiling/linking
|
|
Packit Service |
c5cf8c |
dnl F77_GETARG_LDFLAGS - Flags needed when linking
|
|
Packit Service |
c5cf8c |
dnl.ve
|
|
Packit Service |
c5cf8c |
dnl If 'F77_GETARG' has a value, then that value and the values for these
|
|
Packit Service |
c5cf8c |
dnl other symbols will be used instead. If no approach is found, all of these
|
|
Packit Service |
c5cf8c |
dnl variables will have empty values.
|
|
Packit Service |
c5cf8c |
dnl If no other approach works and a file 'f77argdef' is in the directory,
|
|
Packit Service |
c5cf8c |
dnl that file will be sourced for the values of the above four variables.
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl In most cases, you should add F77_GETARG_FFLAGS to the FFLAGS variable
|
|
Packit Service |
c5cf8c |
dnl and F77_GETARG_LDFLAGS to the LDFLAGS variable, to ensure that tests are
|
|
Packit Service |
c5cf8c |
dnl performed on the compiler version that will be used.
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl 'AC_SUBST' is called for all six variables.
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl One complication is that on systems with multiple Fortran compilers,
|
|
Packit Service |
c5cf8c |
dnl some libraries used by one Fortran compiler may have been (mis)placed
|
|
Packit Service |
c5cf8c |
dnl in a common location. We have had trouble with libg2c in particular.
|
|
Packit Service |
c5cf8c |
dnl To work around this, we test whether iargc etc. work first. This
|
|
Packit Service |
c5cf8c |
dnl will catch most systems and will speed up the tests.
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl Next, the libraries are only added if they are needed to complete a
|
|
Packit Service |
c5cf8c |
dnl link; they aren''t added just because they exist.
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl f77argdef
|
|
Packit Service |
c5cf8c |
dnl D*/
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
dnl Random notes
|
|
Packit Service |
c5cf8c |
dnl You can export the command line arguments from C to the g77 compiler
|
|
Packit Service |
c5cf8c |
dnl using
|
|
Packit Service |
c5cf8c |
dnl extern char **__libc_argv;
|
|
Packit Service |
c5cf8c |
dnl extern int __libc_argc;
|
|
Packit Service |
c5cf8c |
dnl f_setarg( __libc_argc, __libc_argv );
|
|
Packit Service |
c5cf8c |
dnl
|
|
Packit Service |
c5cf8c |
AC_DEFUN([PAC_PROG_F77_CMDARGS],[
|
|
Packit Service |
c5cf8c |
found_cached="yes"
|
|
Packit Service |
c5cf8c |
AC_MSG_CHECKING([for routines to access the command line from Fortran 77])
|
|
Packit Service |
c5cf8c |
AC_CACHE_VAL(pac_cv_prog_f77_cmdarg,
|
|
Packit Service |
c5cf8c |
[
|
|
Packit Service |
c5cf8c |
AC_MSG_RESULT([searching...])
|
|
Packit Service |
c5cf8c |
found_cached="no"
|
|
Packit Service |
c5cf8c |
# First, we perform a quick check. Does iargc and getarg work?
|
|
Packit Service |
c5cf8c |
fxx_module="${FXX_MODULE:-}"
|
|
Packit Service |
c5cf8c |
f77_getargdecl="${F77_GETARGDECL:-external getarg}"
|
|
Packit Service |
c5cf8c |
f77_getarg="${F77_GETARG:-call GETARG(i,s)}"
|
|
Packit Service |
c5cf8c |
f77_iargc="${F77_IARGC:-IARGC()}"
|
|
Packit Service |
c5cf8c |
#
|
|
Packit Service |
c5cf8c |
# Grumble. The Absoft Fortran compiler computes i - i as 0 and then
|
|
Packit Service |
c5cf8c |
# 1.0 / 0 at compile time, even though the code may never be executed.
|
|
Packit Service |
c5cf8c |
# What we need is a way to generate an error, so the second usage of i
|
|
Packit Service |
c5cf8c |
# was replaced with f77_iargc.
|
|
Packit Service |
c5cf8c |
cat > conftest.f <
|
|
Packit Service |
c5cf8c |
program main
|
|
Packit Service |
c5cf8c |
$fxx_module
|
|
Packit Service |
c5cf8c |
integer i, j
|
|
Packit Service |
c5cf8c |
character*20 s
|
|
Packit Service |
c5cf8c |
$f77_getargdecl
|
|
Packit Service |
c5cf8c |
i = 0
|
|
Packit Service |
c5cf8c |
$f77_getarg
|
|
Packit Service |
c5cf8c |
i=$f77_iargc
|
|
Packit Service |
c5cf8c |
if (i .gt. 1) then
|
|
Packit Service |
c5cf8c |
j = i - $f77_iargc
|
|
Packit Service |
c5cf8c |
j = 1.0 / j
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
end
|
|
Packit Service |
c5cf8c |
EOF
|
|
Packit Service |
c5cf8c |
found_answer="no"
|
|
Packit Service |
c5cf8c |
if test -z "$ac_fcompilelink" ; then
|
|
Packit Service |
c5cf8c |
ac_fcompilelink="${F77-f77} -o conftest $FFLAGS $flags conftest.f $LDFLAGS $LIBS 1>&AC_FD_CC"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
AC_MSG_CHECKING([whether ${F77-f77} $flags $libs works with GETARG and IARGC])
|
|
Packit Service |
c5cf8c |
if AC_TRY_EVAL(ac_fcompilelink) && test -x conftest ; then
|
|
Packit Service |
c5cf8c |
# Check that cross != yes so that this works with autoconf 2.52
|
|
Packit Service |
c5cf8c |
# Check that cross_compiling != yes so that this works with
|
|
Packit Service |
c5cf8c |
# autoconf 2.6x for some (but almost certainly not all)x
|
|
Packit Service |
c5cf8c |
# Question: why do we test that this runs? It looks like we
|
|
Packit Service |
c5cf8c |
# needed this for some old Fortran compilers that produced
|
|
Packit Service |
c5cf8c |
# executable code that then did not run.
|
|
Packit Service |
c5cf8c |
if test "$ac_cv_prog_f77_cross" != "yes" -a \
|
|
Packit Service |
c5cf8c |
"$cross_compiling" != "yes" ; then
|
|
Packit Service |
c5cf8c |
if ./conftest >/dev/null 2>&1 ; then
|
|
Packit Service |
c5cf8c |
found_answer="yes"
|
|
Packit Service |
c5cf8c |
FXX_MODULE="$fxx_module"
|
|
Packit Service |
c5cf8c |
F77_GETARGDECL="$f77_getargdecl"
|
|
Packit Service |
c5cf8c |
F77_GETARG="$f77_getarg"
|
|
Packit Service |
c5cf8c |
F77_IARGC="$f77_iargc"
|
|
Packit Service |
c5cf8c |
AC_MSG_RESULT(yes)
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
if test $found_answer = "no" ; then
|
|
Packit Service |
c5cf8c |
AC_MSG_RESULT(no)
|
|
Packit Service |
c5cf8c |
# Grumph. Here are a bunch of different approaches
|
|
Packit Service |
c5cf8c |
# We have several axes the check:
|
|
Packit Service |
c5cf8c |
# Library to link with (none, -lU77 (HPUX), -lg2c (LINUX f77))
|
|
Packit Service |
c5cf8c |
# PEPCF90 (Intel ifc)
|
|
Packit Service |
c5cf8c |
# The first line is a dummy
|
|
Packit Service |
c5cf8c |
# (we experimented with using a <space>, but this caused other
|
|
Packit Service |
c5cf8c |
# problems because we need <space> in the IFS)
|
|
Packit Service |
c5cf8c |
trial_LIBS="0 -lU77 -lPEPCF90"
|
|
Packit Service |
c5cf8c |
if test "$NOG2C" != "1" ; then
|
|
Packit Service |
c5cf8c |
trial_LIBS="$trial_LIBS -lg2c"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
# Discard libs that are not availble:
|
|
Packit Service |
c5cf8c |
save_IFS="$IFS"
|
|
Packit Service |
c5cf8c |
# Make sure that IFS includes a space, or the tests that run programs
|
|
Packit Service |
c5cf8c |
# may fail
|
|
Packit Service |
c5cf8c |
IFS=" ""
|
|
Packit Service |
c5cf8c |
"
|
|
Packit Service |
c5cf8c |
save_trial_LIBS="$trial_LIBS"
|
|
Packit Service |
c5cf8c |
trial_LIBS=""
|
|
Packit Service |
c5cf8c |
cat > conftest.f <
|
|
Packit Service |
c5cf8c |
program main
|
|
Packit Service |
c5cf8c |
end
|
|
Packit Service |
c5cf8c |
EOF
|
|
Packit Service |
c5cf8c |
ac_fcompilelink_test='${F77-f77} -o conftest $FFLAGS conftest.f $LDFLAGS $libs $LIBS 1>&AC_FD_CC'
|
|
Packit Service |
c5cf8c |
for libs in $save_trial_LIBS ; do
|
|
Packit Service |
c5cf8c |
if test "$libs" = "0" ; then
|
|
Packit Service |
c5cf8c |
lib_ok="yes"
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
AC_MSG_CHECKING([whether Fortran 77 links with $libs])
|
|
Packit Service |
c5cf8c |
if AC_TRY_EVAL(ac_fcompilelink_test) && test -x conftest ; then
|
|
Packit Service |
c5cf8c |
AC_MSG_RESULT([yes])
|
|
Packit Service |
c5cf8c |
lib_ok="yes"
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
AC_MSG_RESULT([no])
|
|
Packit Service |
c5cf8c |
lib_ok="no"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
if test "$lib_ok" = "yes" ; then
|
|
Packit Service |
c5cf8c |
trial_LIBS="$trial_LIBS
|
|
Packit Service |
c5cf8c |
$libs"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
done
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
# Options to use when compiling and linking
|
|
Packit Service |
c5cf8c |
# +U77 is needed by HP Fortran to access getarg etc.
|
|
Packit Service |
c5cf8c |
# The -N109 was used for getarg before we realized that GETARG
|
|
Packit Service |
c5cf8c |
# was necessary with the (non standard conforming) Absoft compiler
|
|
Packit Service |
c5cf8c |
# (Fortran is monocase; Absoft uses mixedcase by default)
|
|
Packit Service |
c5cf8c |
# The -f is used by Absoft and is the compiler switch that folds
|
|
Packit Service |
c5cf8c |
# symbolic names to lower case. Without this option, the compiler
|
|
Packit Service |
c5cf8c |
# considers upper- and lower-case letters to be unique.
|
|
Packit Service |
c5cf8c |
# The -YEXT_NAMES=LCS will cause external names to be output as lower
|
|
Packit Service |
c5cf8c |
# case letter for Absoft F90 compilers (default is upper case)
|
|
Packit Service |
c5cf8c |
# The first line is "<space><newline>, the space is important
|
|
Packit Service |
c5cf8c |
# To make the Absoft f77 and f90 work together, we need to prefer the
|
|
Packit Service |
c5cf8c |
# upper case versions of the arguments. They also require libU77.
|
|
Packit Service |
c5cf8c |
# -YCFRL=1 causes Absoft f90 to work with g77 and similar (f2c-based)
|
|
Packit Service |
c5cf8c |
# Fortran compilers
|
|
Packit Service |
c5cf8c |
#
|
|
Packit Service |
c5cf8c |
# Problem: The Intel efc compiler hangs when presented with -N109 .
|
|
Packit Service |
c5cf8c |
# The only real fix for this is to detect this compiler and exclude
|
|
Packit Service |
c5cf8c |
# the test. We may want to reorganize these tests so that if we
|
|
Packit Service |
c5cf8c |
# can compile code without special options, we never look for them.
|
|
Packit Service |
c5cf8c |
#
|
|
Packit Service |
c5cf8c |
using_intel_efc="no"
|
|
Packit Service |
c5cf8c |
pac_test_msg=`$F77 -V 2>&1 | grep 'Intel(R) Fortran Itanium'`
|
|
Packit Service |
c5cf8c |
if test "$pac_test_msg" != "" ; then
|
|
Packit Service |
c5cf8c |
using_intel_efc="yes"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
if test "$using_intel_efc" = "yes" ; then
|
|
Packit Service |
c5cf8c |
trial_FLAGS="000"
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
trial_FLAGS="000
|
|
Packit Service |
c5cf8c |
-N109
|
|
Packit Service |
c5cf8c |
-f
|
|
Packit Service |
c5cf8c |
-YEXT_NAMES=UCS
|
|
Packit Service |
c5cf8c |
-YEXT_NAMES=LCS
|
|
Packit Service |
c5cf8c |
-YCFRL=1
|
|
Packit Service |
c5cf8c |
+U77"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
# Discard options that are not available:
|
|
Packit Service |
c5cf8c |
# (IFS already saved above)
|
|
Packit Service |
c5cf8c |
IFS=" ""
|
|
Packit Service |
c5cf8c |
"
|
|
Packit Service |
c5cf8c |
save_trial_FLAGS="$trial_FLAGS"
|
|
Packit Service |
c5cf8c |
trial_FLAGS=""
|
|
Packit Service |
c5cf8c |
for flag in $save_trial_FLAGS ; do
|
|
Packit Service |
c5cf8c |
if test "$flag" = " " -o "$flag" = "000" ; then
|
|
Packit Service |
c5cf8c |
opt_ok="yes"
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
PAC_F77_CHECK_COMPILER_OPTION($flag,opt_ok=yes,opt_ok=no)
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
if test "$opt_ok" = "yes" ; then
|
|
Packit Service |
c5cf8c |
if test "$flag" = " " -o "$flag" = "000" ; then
|
|
Packit Service |
c5cf8c |
fflag=""
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
fflag="$flag"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
# discard options that don't allow mixed-case name matching
|
|
Packit Service |
c5cf8c |
cat > conftest.f <
|
|
Packit Service |
c5cf8c |
program main
|
|
Packit Service |
c5cf8c |
call aB()
|
|
Packit Service |
c5cf8c |
end
|
|
Packit Service |
c5cf8c |
subroutine Ab()
|
|
Packit Service |
c5cf8c |
end
|
|
Packit Service |
c5cf8c |
EOF
|
|
Packit Service |
c5cf8c |
if test -n "$fflag" ; then flagval="with $fflag" ; else flagval="" ; fi
|
|
Packit Service |
c5cf8c |
AC_MSG_CHECKING([whether Fortran 77 routine names are case-insensitive $flagval])
|
|
Packit Service |
c5cf8c |
dnl we can use double quotes here because all is already
|
|
Packit Service |
c5cf8c |
dnl evaluated
|
|
Packit Service |
c5cf8c |
ac_fcompilelink_test="${F77-f77} -o conftest $fflag $FFLAGS conftest.f $LDFLAGS $LIBS 1>&AC_FD_CC"
|
|
Packit Service |
c5cf8c |
if AC_TRY_EVAL(ac_fcompilelink_test) && test -x conftest ; then
|
|
Packit Service |
c5cf8c |
AC_MSG_RESULT(yes)
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
AC_MSG_RESULT(no)
|
|
Packit Service |
c5cf8c |
opt_ok="no"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
if test "$opt_ok" = "yes" ; then
|
|
Packit Service |
c5cf8c |
trial_FLAGS="$trial_FLAGS
|
|
Packit Service |
c5cf8c |
$flag"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
done
|
|
Packit Service |
c5cf8c |
IFS="$save_IFS"
|
|
Packit Service |
c5cf8c |
# Name of routines. Since these are in groups, we use a case statement
|
|
Packit Service |
c5cf8c |
# and loop until the end (accomplished by reaching the end of the
|
|
Packit Service |
c5cf8c |
# case statement
|
|
Packit Service |
c5cf8c |
# For one version of Nag F90, the names are
|
|
Packit Service |
c5cf8c |
# call f90_unix_MP_getarg(i,s) and f90_unix_MP_iargc().
|
|
Packit Service |
c5cf8c |
trial=0
|
|
Packit Service |
c5cf8c |
while test -z "$pac_cv_prog_f77_cmdarg" ; do
|
|
Packit Service |
c5cf8c |
case $trial in
|
|
Packit Service |
c5cf8c |
0) # User-specified values, if any
|
|
Packit Service |
c5cf8c |
if test -z "$F77_GETARG" -o -z "$F77_IARGC" ; then
|
|
Packit Service |
c5cf8c |
trial=`expr $trial + 1`
|
|
Packit Service |
c5cf8c |
continue
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
MSG="Using environment values of F77_GETARG etc."
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
1) # Standard practice, uppercase (some compilers are case-sensitive)
|
|
Packit Service |
c5cf8c |
FXX_MODULE=""
|
|
Packit Service |
c5cf8c |
F77_GETARGDECL="external GETARG"
|
|
Packit Service |
c5cf8c |
F77_GETARG="call GETARG(i,s)"
|
|
Packit Service |
c5cf8c |
F77_IARGC="IARGC()"
|
|
Packit Service |
c5cf8c |
MSG="GETARG and IARGC"
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
2) # Standard practice, lowercase
|
|
Packit Service |
c5cf8c |
FXX_MODULE=""
|
|
Packit Service |
c5cf8c |
F77_GETARGDECL="external getarg"
|
|
Packit Service |
c5cf8c |
F77_GETARG="call getarg(i,s)"
|
|
Packit Service |
c5cf8c |
F77_IARGC="iargc()"
|
|
Packit Service |
c5cf8c |
MSG="getarg and iargc"
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
3) # Posix alternative
|
|
Packit Service |
c5cf8c |
FXX_MODULE=""
|
|
Packit Service |
c5cf8c |
F77_GETARGDECL="external pxfgetarg"
|
|
Packit Service |
c5cf8c |
F77_GETARG="call pxfgetarg(i,s,l,ier)"
|
|
Packit Service |
c5cf8c |
F77_IARGC="ipxfargc()"
|
|
Packit Service |
c5cf8c |
MSG="pxfgetarg and ipxfargc"
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
4) # Nag f90_unix_env module
|
|
Packit Service |
c5cf8c |
FXX_MODULE=" use f90_unix_env"
|
|
Packit Service |
c5cf8c |
F77_GETARGDECL=""
|
|
Packit Service |
c5cf8c |
F77_GETARG="call getarg(i,s)"
|
|
Packit Service |
c5cf8c |
F77_IARGC="iargc()"
|
|
Packit Service |
c5cf8c |
MSG="f90_unix_env module"
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
5) # Nag f90_unix module
|
|
Packit Service |
c5cf8c |
FXX_MODULE=" use f90_unix"
|
|
Packit Service |
c5cf8c |
F77_GETARGDECL=""
|
|
Packit Service |
c5cf8c |
F77_GETARG="call getarg(i,s)"
|
|
Packit Service |
c5cf8c |
F77_IARGC="iargc()"
|
|
Packit Service |
c5cf8c |
MSG="f90_unix module"
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
6) # user spec in a file
|
|
Packit Service |
c5cf8c |
if test -s f77argdef ; then
|
|
Packit Service |
c5cf8c |
. ./f77argdef
|
|
Packit Service |
c5cf8c |
MSG="Using definitions in the file f77argdef"
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
trial=`expr $trial + 1`
|
|
Packit Service |
c5cf8c |
continue
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
7) # gfortran won't find getarg if it is marked as external
|
|
Packit Service |
c5cf8c |
FXX_MODULE=""
|
|
Packit Service |
c5cf8c |
F77_GETARGDECL="intrinsic GETARG"
|
|
Packit Service |
c5cf8c |
F77_GETARG="call GETARG(i,s)"
|
|
Packit Service |
c5cf8c |
F77_IARGC="IARGC()"
|
|
Packit Service |
c5cf8c |
MSG="intrinsic GETARG and IARGC"
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
*) # exit from while loop
|
|
Packit Service |
c5cf8c |
FXX_MODULE=""
|
|
Packit Service |
c5cf8c |
F77_GETARGDECL=""
|
|
Packit Service |
c5cf8c |
F77_GETARG=""
|
|
Packit Service |
c5cf8c |
F77_IARGC=""
|
|
Packit Service |
c5cf8c |
break
|
|
Packit Service |
c5cf8c |
;;
|
|
Packit Service |
c5cf8c |
esac
|
|
Packit Service |
c5cf8c |
# Create the program. Make sure that we can run it.
|
|
Packit Service |
c5cf8c |
# Force a divide-by-zero if there is a problem (but only at runtime!
|
|
Packit Service |
c5cf8c |
# (the Absoft compiler does divide-by-zero at compile time)
|
|
Packit Service |
c5cf8c |
cat > conftest.f <
|
|
Packit Service |
c5cf8c |
program main
|
|
Packit Service |
c5cf8c |
$FXX_MODULE
|
|
Packit Service |
c5cf8c |
integer i, j
|
|
Packit Service |
c5cf8c |
character*20 s
|
|
Packit Service |
c5cf8c |
$F77_GETARGDECL
|
|
Packit Service |
c5cf8c |
i = 0
|
|
Packit Service |
c5cf8c |
$F77_GETARG
|
|
Packit Service |
c5cf8c |
i=$F77_IARGC
|
|
Packit Service |
c5cf8c |
if (i .gt. 1) then
|
|
Packit Service |
c5cf8c |
j = i - $F77_IARGC
|
|
Packit Service |
c5cf8c |
j = 1.0 / j
|
|
Packit Service |
c5cf8c |
endif
|
|
Packit Service |
c5cf8c |
end
|
|
Packit Service |
c5cf8c |
EOF
|
|
Packit Service |
c5cf8c |
#
|
|
Packit Service |
c5cf8c |
# Now, try to find some way to compile and link that program, looping
|
|
Packit Service |
c5cf8c |
# over the possibilities of options and libraries
|
|
Packit Service |
c5cf8c |
save_IFS="$IFS"
|
|
Packit Service |
c5cf8c |
IFS=" ""
|
|
Packit Service |
c5cf8c |
"
|
|
Packit Service |
c5cf8c |
for libs in $trial_LIBS ; do
|
|
Packit Service |
c5cf8c |
if test -n "$pac_cv_prog_f77_cmdarg" ; then break ; fi
|
|
Packit Service |
c5cf8c |
if test "$libs" = " " -o "$libs" = "0" ; then libs="" ; fi
|
|
Packit Service |
c5cf8c |
for flags in $trial_FLAGS ; do
|
|
Packit Service |
c5cf8c |
if test "$flags" = " " -o "$flags" = "000"; then flags="" ; fi
|
|
Packit Service |
c5cf8c |
AC_MSG_CHECKING([whether ${F77-f77} $flags $libs works with $MSG])
|
|
Packit Service |
c5cf8c |
IFS="$save_IFS"
|
|
Packit Service |
c5cf8c |
dnl We need this here because we've fiddled with IFS
|
|
Packit Service |
c5cf8c |
ac_fcompilelink_test="${F77-f77} -o conftest $FFLAGS $flags conftest.f $LDFLAGS $libs $LIBS 1>&AC_FD_CC"
|
|
Packit Service |
c5cf8c |
found_answer="no"
|
|
Packit Service |
c5cf8c |
if AC_TRY_EVAL(ac_fcompilelink_test) && test -x conftest ; then
|
|
Packit Service |
c5cf8c |
if test "$ac_cv_prog_f77_cross" != "yes" -a \
|
|
Packit Service |
c5cf8c |
"$cross_compiling" != "yes" ; then
|
|
Packit Service |
c5cf8c |
if ./conftest >/dev/null 2>&1 ; then
|
|
Packit Service |
c5cf8c |
found_answer="yes"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
found_answer="yes"
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
IFS=" ""
|
|
Packit Service |
c5cf8c |
"
|
|
Packit Service |
c5cf8c |
if test "$found_answer" = "yes" ; then
|
|
Packit Service |
c5cf8c |
AC_MSG_RESULT([yes])
|
|
Packit Service |
c5cf8c |
pac_cv_prog_f77_cmdarg="$MSG"
|
|
Packit Service |
c5cf8c |
pac_cv_prog_f77_cmdarg_fflags="$flags"
|
|
Packit Service |
c5cf8c |
pac_cv_prog_f77_cmdarg_ldflags="$libs"
|
|
Packit Service |
c5cf8c |
break
|
|
Packit Service |
c5cf8c |
else
|
|
Packit Service |
c5cf8c |
AC_MSG_RESULT([no])
|
|
Packit Service |
c5cf8c |
echo "configure: failed program was:" >&AC_FD_CC
|
|
Packit Service |
c5cf8c |
cat conftest.f >&AC_FD_CC
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
done
|
|
Packit Service |
c5cf8c |
done
|
|
Packit Service |
c5cf8c |
IFS="$save_IFS"
|
|
Packit Service |
c5cf8c |
rm -f conftest.*
|
|
Packit Service |
c5cf8c |
trial=`expr $trial + 1`
|
|
Packit Service |
c5cf8c |
done
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
pac_cv_F77_GETARGDECL="$F77_GETARGDECL"
|
|
Packit Service |
c5cf8c |
pac_cv_F77_IARGC="$F77_IARGC"
|
|
Packit Service |
c5cf8c |
pac_cv_F77_GETARG="$F77_GETARG"
|
|
Packit Service |
c5cf8c |
pac_cv_FXX_MODULE="$FXX_MODULE"
|
|
Packit Service |
c5cf8c |
])
|
|
Packit Service |
c5cf8c |
if test "$found_cached" = "yes" ; then
|
|
Packit Service |
c5cf8c |
AC_MSG_RESULT([$pac_cv_prog_f77_cmdarg])
|
|
Packit Service |
c5cf8c |
elif test -z "$pac_cv_F77_IARGC" ; then
|
|
Packit Service |
c5cf8c |
AC_MSG_WARN([Could not find a way to access the command line from Fortran 77])
|
|
Packit Service |
c5cf8c |
fi
|
|
Packit Service |
c5cf8c |
# Set the variable values based on pac_cv_prog_xxx
|
|
Packit Service |
c5cf8c |
F77_GETARGDECL="$pac_cv_F77_GETARGDECL"
|
|
Packit Service |
c5cf8c |
F77_IARGC="$pac_cv_F77_IARGC"
|
|
Packit Service |
c5cf8c |
F77_GETARG="$pac_cv_F77_GETARG"
|
|
Packit Service |
c5cf8c |
FXX_MODULE="$pac_cv_FXX_MODULE"
|
|
Packit Service |
c5cf8c |
F77_GETARG_FFLAGS="$pac_cv_prog_f77_cmdarg_fflags"
|
|
Packit Service |
c5cf8c |
F77_GETARG_LDFLAGS="$pac_cv_prog_f77_cmdarg_ldflags"
|
|
Packit Service |
c5cf8c |
AC_SUBST(F77_GETARGDECL)
|
|
Packit Service |
c5cf8c |
AC_SUBST(F77_IARGC)
|
|
Packit Service |
c5cf8c |
AC_SUBST(F77_GETARG)
|
|
Packit Service |
c5cf8c |
AC_SUBST(FXX_MODULE)
|
|
Packit Service |
c5cf8c |
AC_SUBST(F77_GETARG_FFLAGS)
|
|
Packit Service |
c5cf8c |
AC_SUBST(F77_GETARG_LDFLAGS)
|
|
Packit Service |
c5cf8c |
])
|