1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
dnl -------------------------------------------------------------------------
dnl -------------------------------------------------------------------------
dnl
dnl Copyright by The HDF Group.
dnl Copyright by the Board of Trustees of the University of Illinois.
dnl All rights reserved.
dnl
dnl This file is part of HDF5. The full HDF5 copyright notice, including
dnl terms governing use, modification, and redistribution, is contained in
dnl the COPYING file, which can be found at the root of the source code
dnl dnl distribution tree, or in https://www.hdfgroup.org/licenses.
dnl dnl If you do not have access to either file, you may request a copy from
dnl dnl help@hdfgroup.org.
dnl
dnl Macros for HDF5 Fortran
dnl
dnl -------------------------------------------------------------------------
dnl -------------------------------------------------------------------------
dnl -------------------------------------------------------------------------
dnl _AC_SYS_LARGEFILE_MACRO_VALUE
dnl
dnl The following macro overrides the autoconf macro of the same name
dnl with this custom definition. This macro performs the same checks as
dnl autoconf's native _AC_SYS_LARGEFILE_MACRO_VALUE, but will also set
dnl AM_CPPFLAGS with the appropriate -D defines so additional configure
dnl sizeof checks do not fail.
dnl
# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
# CACHE-VAR,
# DESCRIPTION,
# PROLOGUE, [FUNCTION-BODY])
# ----------------------------------------------------------
m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
[AC_CACHE_CHECK([for $1 value needed for large files], [$3],
[while :; do
m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
[AC_LANG_PROGRAM([$5], [$6])],
[$3=no; break])
m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
[AC_LANG_PROGRAM([@%:@define $1 $2
$5], [$6])],
[$3=$2; break])
$3=unknown
break
done])
case $$3 in #(
no | unknown) ;;
*) AC_DEFINE_UNQUOTED([$1], [$$3], [$4])
AM_CPPFLAGS="-D$1=$$3 $AM_CPPFLAGS";;
esac
rm -rf conftest*[]dnl
])# _AC_SYS_LARGEFILE_MACRO_VALUE
dnl -------------------------------------------------------------------------
dnl AC_F9X_MODS()
dnl
dnl Check how F9X handles modules. This macro also checks which
dnl command-line option to use to include the module once it's built.
dnl
AC_DEFUN(AC_F9X_MODS,
[AC_MSG_CHECKING(what $FC does with modules)
AC_LANG_PUSH(Fortran)
test -d conftestdir || mkdir conftestdir
cd conftestdir
rm -rf *
cat >conftest.$ac_ext <<EOF
module module
integer foo
end module module
EOF
eval $ac_compile
modfiles=""
F9XMODEXT=""
for f in conftest.o module.mod MODULE.mod module.M MODULE.M; do
if test -f "$f" ; then
modfiles="$f"
case "$f" in
*.o) F9XMODEXT="o" ;;
*.mod) F9XMODEXT="mod" ;;
*.M) F9XMODEXT="M" ;;
esac
fi
done
echo $modfiles 6>&1
if test "$modfiles" = file.o; then
echo $ac_n "checking whether $FC -em is saner""... $ac_c" 1>&6
OLD_FCFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS -em"
eval $ac_compile
modfiles=""
for f in file.o module.mod MODULE.mod module.M MODULE.M; do
test -f $f && modfiles="$f"
done
if test "$modfiles" = "file.o"; then
FCFLAGS=$OLD_FCFLAGS
echo no 6>&1
else
echo yes 6>&1
fi
fi
cd ..
AC_MSG_CHECKING(how $FC finds modules)
for flag in "-I" "-M" "-p"; do
cat >conftest.$ac_ext <<EOF
program conftest
use module
end program conftest
EOF
ac_compile='${FC-f90} $FCFLAGS ${flag}conftestdir -c conftest.$ac_ext 1>&AS_MESSAGE_LOG_FD'
if AC_TRY_EVAL(ac_compile); then
F9XMODFLAG=$flag
break
fi
done
if test -n "$F9XMODFLAG"; then
echo $F9XMODFLAG 1>&6
FCFLAGS="$F9XMODFLAG. $FCFLAGS"
else
echo unknown 1>&6
fi
AC_SUBST(F9XMODFLAG)
AC_SUBST(F9XMODEXT)
rm -rf conftest*
AC_LANG_POP(Fortran)
])
|