Improve wording for Y2038 and largefile probes
[autoconf.git] / lib / autoconf / fortran.m4
blob5f2390df33c5068055cfacd9b2b0f50d39b83202
1 # This file is part of Autoconf.                       -*- Autoconf -*-
2 # Fortran languages support.
3 # Copyright (C) 2001, 2003-2017, 2020-2024 Free Software Foundation,
4 # Inc.
6 # This file is part of Autoconf.  This program is free
7 # software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the
9 # Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
17 # Under Section 7 of GPL version 3, you are granted additional
18 # permissions described in the Autoconf Configure Script Exception,
19 # version 3.0, as published by the Free Software Foundation.
21 # You should have received a copy of the GNU General Public License
22 # and a copy of the Autoconf Configure Script Exception along with
23 # this program; see the files COPYINGv3 and COPYING.EXCEPTION
24 # respectively.  If not, see <https://www.gnu.org/licenses/>.
26 # Written by David MacKenzie, with help from
27 # François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
28 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
31 # Table of Contents:
33 # Preamble
35 # 0. Utility macros
37 # 1. Language selection
38 #    and routines to produce programs in a given language.
40 # 2. Producing programs in a given language.
42 # 3. Looking for a compiler
43 #    And possibly the associated preprocessor.
45 # 4. Compilers' characteristics.
49 ## ---------- ##
50 ## Preamble.  ##
51 ## ---------- ##
53 # Fortran vs. Fortran 77:
54 #   This file contains macros for both "Fortran 77" and "Fortran", where
55 # the former is the "classic" autoconf Fortran interface and is intended
56 # for legacy F77 codes, while the latter is intended to support newer Fortran
57 # dialects.  Fortran 77 uses environment variables F77, FFLAGS, and FLIBS,
58 # while Fortran uses FC, FCFLAGS, and FCLIBS.  For each user-callable AC_*
59 # macro, there is generally both an F77 and an FC version, where both versions
60 # share the same _AC_*_FC_* backend.  This backend macro requires that
61 # the appropriate language be AC_LANG_PUSH'ed, and uses _AC_LANG_ABBREV and
62 # _AC_LANG_PREFIX in order to name cache and environment variables, etc.
66 ## ------------------- ##
67 ## 0. Utility macros.  ##
68 ## ------------------- ##
71 # _AC_LIST_MEMBER_IF(ELEMENT, LIST, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
72 # ---------------------------------------------------------------------------
74 # Processing the elements of a list is tedious in shell programming,
75 # as lists tend to be implemented as space delimited strings.
77 # This macro searches LIST for ELEMENT, and executes ACTION-IF-FOUND
78 # if ELEMENT is a member of LIST, otherwise it executes
79 # ACTION-IF-NOT-FOUND.
80 AC_DEFUN([_AC_LIST_MEMBER_IF],
81 dnl Do some sanity checking of the arguments.
82 [m4_if([$1], , [m4_fatal([$0: missing argument 1])],
83       [$2], , [m4_fatal([$0: missing argument 2])])]dnl
84 [  ac_exists=false
85   for ac_i in $2; do
86     if test x"$1" = x"$ac_i"; then
87       ac_exists=true
88       break
89     fi
90   done
92   AS_IF([test x"$ac_exists" = xtrue], [$3], [$4])[]dnl
93 ])# _AC_LIST_MEMBER_IF
96 # _AC_LINKER_OPTION(LINKER-OPTIONS, SHELL-VARIABLE)
97 # -------------------------------------------------
99 # Specifying options to the compiler (whether it be the C, C++ or
100 # Fortran 77 compiler) that are meant for the linker is compiler
101 # dependent.  This macro lets you give options to the compiler that
102 # are meant for the linker in a portable, compiler-independent way.
104 # This macro take two arguments, a list of linker options that the
105 # compiler should pass to the linker (LINKER-OPTIONS) and the name of
106 # a shell variable (SHELL-VARIABLE).  The list of linker options are
107 # appended to the shell variable in a compiler-dependent way.
109 # For example, if the selected language is C, then this:
111 #   _AC_LINKER_OPTION([-R /usr/local/lib/foo], foo_LDFLAGS)
113 # will expand into this if the selected C compiler is gcc:
115 #   foo_LDFLAGS="-Xlinker -R -Xlinker /usr/local/lib/foo"
117 # otherwise, it will expand into this:
119 #   foo_LDFLAGS"-R /usr/local/lib/foo"
121 # You are encouraged to add support for compilers that this macro
122 # doesn't currently support.
123 # FIXME: Get rid of this macro.
124 AC_DEFUN([_AC_LINKER_OPTION],
125 [if test "$ac_compiler_gnu" = yes; then
126   for ac_link_opt in $1; do
127     $2="[$]$2 -Xlinker $ac_link_opt"
128   done
129 else
130   $2="[$]$2 $1"
131 fi[]dnl
132 ])# _AC_LINKER_OPTION
136 ## ------------------------ ##
137 ## 1a. Language selection.  ##
138 ## ------------------------ ##
141 # AC_LANG(Fortran 77)
142 # -------------------
143 AC_LANG_DEFINE([Fortran 77], [f77], [F], [F77], [],
144 [ac_ext=f
145 ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
146 ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
147 ac_compiler_gnu=$ac_cv_f77_compiler_gnu
151 # AC_LANG_FORTRAN77
152 # -----------------
153 AU_DEFUN([AC_LANG_FORTRAN77], [AC_LANG(Fortran 77)])
156 # _AC_FORTRAN_ASSERT
157 # ------------------
158 # Current language must be Fortran or Fortran 77.
159 m4_defun([_AC_FORTRAN_ASSERT],
160 [m4_if(_AC_LANG, [Fortran], [],
161        [m4_if(_AC_LANG, [Fortran 77], [],
162               [m4_fatal([$0: current language is not Fortran: ] _AC_LANG)])])])
165 # _AC_FC
166 # ------
167 # Return F77 or FC, depending upon the language.
168 AC_DEFUN([_AC_FC],
169 [_AC_FORTRAN_ASSERT()dnl
170 AC_LANG_CASE([Fortran 77], [F77],
171              [Fortran],    [FC])])
175 ## ----------------------- ##
176 ## 2. Producing programs.  ##
177 ## ----------------------- ##
180 # AC_LANG_PROGRAM(Fortran 77)([PROLOGUE], [BODY])
181 # -----------------------------------------------
182 # Yes, we discard the PROLOGUE.
183 m4_define([AC_LANG_PROGRAM(Fortran 77)],
184 [m4_ifval([$1],
185        [m4_warn([syntax], [$0: ignoring PROLOGUE: $1])])dnl
186       program main
188       end])
191 # _AC_LANG_IO_PROGRAM(Fortran 77)
192 # -------------------------------
193 # Produce source that performs I/O.
194 m4_define([_AC_LANG_IO_PROGRAM(Fortran 77)],
195 [AC_LANG_PROGRAM([],
196 [dnl
197       open(unit=9,file='conftest.out')
198       close(unit=9)
199 ])])
202 # AC_LANG_CALL(Fortran 77)(PROLOGUE, FUNCTION)
203 # --------------------------------------------
204 # FIXME: This is a guess, help!
205 m4_define([AC_LANG_CALL(Fortran 77)],
206 [AC_LANG_PROGRAM([$1],
207 [      call $2])])
210 # AC_LANG_FUNC_LINK_TRY(Fortran 77)(FUNCTION)
211 # -------------------------------------------
212 m4_define([AC_LANG_FUNC_LINK_TRY(Fortran 77)],
213 [AC_LANG_PROGRAM([],
214 [      call $1])])
216 ## ------------------------ ##
217 ## 1b. Language selection.  ##
218 ## ------------------------ ##
221 # AC_LANG(Fortran)
222 # ----------------
223 AC_LANG_DEFINE([Fortran], [fc], [FC], [FC], [Fortran 77],
224 [ac_ext=${ac_fc_srcext-f}
225 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
226 ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
227 ac_compiler_gnu=$ac_cv_fc_compiler_gnu
231 ## -------------------------------------------- ##
232 ## 3. Looking for Compilers and Preprocessors.  ##
233 ## -------------------------------------------- ##
236 # AC_LANG_PREPROC(Fortran 77)
237 # ---------------------------
238 # Find the Fortran 77 preprocessor.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
239 AC_DEFUN([AC_LANG_PREPROC(Fortran 77)],
240 [m4_warn([syntax],
241          [$0: No preprocessor defined for ]_AC_LANG)])
243 # AC_LANG_PREPROC(Fortran)
244 # ------------------------
245 # Find the Fortran preprocessor.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
246 AC_DEFUN([AC_LANG_PREPROC(Fortran)],
247 [m4_warn([syntax],
248          [$0: No preprocessor defined for ]_AC_LANG)])
251 # AC_LANG_COMPILER(Fortran 77)
252 # ----------------------------
253 # Find the Fortran 77 compiler.  Must be AC_DEFUN'd to be
254 # AC_REQUIRE'able.
255 AC_DEFUN([AC_LANG_COMPILER(Fortran 77)],
256 [AC_REQUIRE([AC_PROG_F77])])
258 # AC_LANG_COMPILER(Fortran)
259 # -------------------------
260 # Find the Fortran compiler.  Must be AC_DEFUN'd to be
261 # AC_REQUIRE'able.
262 AC_DEFUN([AC_LANG_COMPILER(Fortran)],
263 [AC_REQUIRE([AC_PROG_FC])])
266 # ac_cv_prog_g77
267 # --------------
268 # We used to name the cache variable this way.
269 AU_DEFUN([ac_cv_prog_g77],
270 [ac_cv_f77_compiler_gnu])
273 # _AC_FC_DIALECT_YEAR([DIALECT])
274 # ------------------------------
275 # Given a Fortran DIALECT, which is Fortran [YY]YY or simply [YY]YY,
276 # convert to a 4-digit year.  The dialect must be one of Fortran 77,
277 # 90, 95, or 2000, currently.  If DIALECT is simply Fortran or the
278 # empty string, returns the empty string.
279 AC_DEFUN([_AC_FC_DIALECT_YEAR],
280 [m4_case(m4_bpatsubsts(m4_tolower([$1]), [fortran],[], [ *],[]),
281          [77],[1977], [1977],[1977],
282          [90],[1990], [1990],[1990],
283          [95],[1995], [1995],[1995],
284          [2000],[2000],
285          [],[],
286          [m4_fatal([unknown Fortran dialect])])])
289 # _AC_PROG_FC([DIALECT], [COMPILERS...])
290 # --------------------------------------
291 # DIALECT is a Fortran dialect, given by Fortran [YY]YY or simply [YY]YY,
292 # and must be one of those supported by _AC_FC_DIALECT_YEAR
294 # If DIALECT is supplied, then we search for compilers of that dialect
295 # first, and then later dialects.  Otherwise, we search for compilers
296 # of the newest dialect first, and then earlier dialects in increasing age.
297 # This search order is necessarily imperfect because the dialect cannot
298 # always be inferred from the compiler name.
300 # Known compilers:
301 #  f77/f90/f95: generic compiler names
302 #  g77: GNU Fortran 77 compiler
303 #  gfortran: GNU Fortran 95+ compiler (released in gcc 4.0)
304 #  g95: original gcc-based f95 compiler (gfortran is a fork)
305 #  ftn: native Fortran 95 compiler on Cray X1
306 #  cf77: native F77 compiler under older Crays (prefer over fort77)
307 #  fort77: native F77 compiler under HP-UX (and some older Crays)
308 #  frt: Fujitsu F77 compiler
309 #  pgf77/pgf90/pghpf/pgf95/pgfortran: Portland Group F77/F90/F95 compilers
310 #  xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers
311 #    Prefer xlf9x to the generic names because they do not reject files
312 #    with extension '.f'.
313 #  lf95: Lahey-Fujitsu F95 compiler
314 #  fl32: Microsoft Fortran 77 "PowerStation" compiler
315 #  af77: Apogee F77 compiler for Intergraph hardware running CLIX
316 #  epcf90: "Edinburgh Portable Compiler" F90
317 #  fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha
318 #  ifort, previously ifc: Intel Fortran 95 compiler for Linux/x86
319 #  efc: Intel Fortran 95 compiler for IA64
320 #  nagfor: NAGWare Fortran 77/90/95 compiler
321 m4_define([_AC_F95_FC], [gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor])
322 m4_define([_AC_F90_FC], [xlf90 f90 pgf90 pghpf epcf90])
323 m4_define([_AC_F77_FC], [g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77])
324 AC_DEFUN([_AC_PROG_FC],
325 [_AC_FORTRAN_ASSERT()dnl
326 AC_CHECK_TOOLS([]_AC_FC[],
327       m4_default([$2],
328         m4_case(_AC_FC_DIALECT_YEAR([$1]),
329                 [1995], [_AC_F95_FC],
330                 [1990], [_AC_F90_FC _AC_F95_FC],
331                 [1977], [_AC_F77_FC _AC_F90_FC _AC_F95_FC],
332                 [_AC_F95_FC _AC_F90_FC _AC_F77_FC])))
334 # Provide some information about the compiler.
335 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
336 set X $ac_compile
337 ac_compiler=$[2]
338 for ac_option in --version -v -V -qversion; do
339   _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
340 done
341 rm -f a.out
343 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
344 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
345 # If we don't use '.F' as extension, the preprocessor is not run on the
346 # input file.  (Note that this only needs to work for GNU compilers.)
347 ac_save_ext=$ac_ext
348 ac_ext=F
349 _AC_LANG_COMPILER_GNU
350 ac_ext=$ac_save_ext
351 _AC_PROG_FC_G
352 ])# _AC_PROG_FC
355 # AC_PROG_F77([COMPILERS...])
356 # ---------------------------
357 # COMPILERS is a space separated list of Fortran 77 compilers to search
358 # for.  See also _AC_PROG_FC.
359 AC_DEFUN([AC_PROG_F77],
360 [AC_LANG_PUSH(Fortran 77)dnl
361 AC_ARG_VAR([F77],    [Fortran 77 compiler command])dnl
362 AC_ARG_VAR([FFLAGS], [Fortran 77 compiler flags])dnl
363 _AC_ARG_VAR_LDFLAGS()dnl
364 _AC_ARG_VAR_LIBS()dnl
365 _AC_PROG_FC([Fortran 77], [$1])
366 if test $ac_compiler_gnu = yes; then
367   G77=yes
368 else
369   G77=
371 AC_LANG_POP(Fortran 77)dnl
372 ])# AC_PROG_F77
375 # AC_PROG_FC([COMPILERS...], [DIALECT])
376 # -------------------------------------
377 # COMPILERS is a space separated list of Fortran 77 compilers to search
378 # for, and [DIALECT] is an optional dialect.  See also _AC_PROG_FC.
379 AC_DEFUN([AC_PROG_FC],
380 [AC_LANG_PUSH(Fortran)dnl
381 AC_ARG_VAR([FC],    [Fortran compiler command])dnl
382 AC_ARG_VAR([FCFLAGS], [Fortran compiler flags])dnl
383 _AC_ARG_VAR_LDFLAGS()dnl
384 _AC_ARG_VAR_LIBS()dnl
385 _AC_PROG_FC([$2], [$1])
386 if test $ac_compiler_gnu = yes; then
387   GFC=yes
388 else
389   GFC=
391 AC_LANG_POP(Fortran)dnl
392 ])# AC_PROG_FC
395 # _AC_PROG_FC_G
396 # -------------
397 # Check whether -g works, even if F[C]FLAGS is set, in case the package
398 # plays around with F[C]FLAGS (such as to build both debugging and normal
399 # versions of a library), tasteless as that idea is.
400 m4_define([_AC_PROG_FC_G],
401 [_AC_FORTRAN_ASSERT()dnl
402 ac_test_[]_AC_LANG_PREFIX[]FLAGS=${[]_AC_LANG_PREFIX[]FLAGS+y}
403 ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
404 _AC_LANG_PREFIX[]FLAGS=
405 AC_CACHE_CHECK(whether $[]_AC_FC[] accepts -g, ac_cv_prog_[]_AC_LANG_ABBREV[]_g,
406 [_AC_LANG_PREFIX[]FLAGS=-g
407 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
408 [ac_cv_prog_[]_AC_LANG_ABBREV[]_g=yes],
409 [ac_cv_prog_[]_AC_LANG_ABBREV[]_g=no])
411 if test $ac_test_[]_AC_LANG_PREFIX[]FLAGS; then
412   _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
413 elif test $ac_cv_prog_[]_AC_LANG_ABBREV[]_g = yes; then
414   if test "x$ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu" = xyes; then
415     _AC_LANG_PREFIX[]FLAGS="-g -O2"
416   else
417     _AC_LANG_PREFIX[]FLAGS="-g"
418   fi
419 else
420   if test "x$ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu" = xyes; then
421     _AC_LANG_PREFIX[]FLAGS="-O2"
422   else
423     _AC_LANG_PREFIX[]FLAGS=
424   fi
425 fi[]dnl
426 ])# _AC_PROG_FC_G
429 # _AC_PROG_FC_C_O
430 # ---------------
431 # Test if the Fortran compiler accepts the options '-c' and '-o'
432 # simultaneously, and define '[F77/FC]_NO_MINUS_C_MINUS_O' if it does not.
434 # The usefulness of this macro is questionable, as I can't really see
435 # why anyone would use it.  The only reason I include it is for
436 # completeness, since a similar test exists for the C compiler.
438 # FIXME: it seems like we could merge the C/C++/Fortran versions of this.
439 AC_DEFUN([_AC_PROG_FC_C_O],
440 [_AC_FORTRAN_ASSERT()dnl
441 AC_CACHE_CHECK([whether $[]_AC_FC[] understands -c and -o together],
442                [ac_cv_prog_[]_AC_LANG_ABBREV[]_c_o],
443 [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
444 # We test twice because some compilers refuse to overwrite an existing
445 # '.o' file with '-o', although they will create one.
446 ac_try='$[]_AC_FC[] $[]_AC_LANG_PREFIX[]FLAGS -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
447 rm -f conftest2.*
448 if _AC_DO_VAR(ac_try) &&
449      test -f conftest2.$ac_objext &&
450      _AC_DO_VAR(ac_try); then
451   ac_cv_prog_[]_AC_LANG_ABBREV[]_c_o=yes
452 else
453   ac_cv_prog_[]_AC_LANG_ABBREV[]_c_o=no
455 rm -rf conftest*])
456 if test $ac_cv_prog_[]_AC_LANG_ABBREV[]_c_o = no; then
457   AC_DEFINE([]_AC_FC[]_NO_MINUS_C_MINUS_O, 1,
458             [Define to 1 if your Fortran compiler doesn't accept
459              -c and -o together.])
461 ])# _AC_PROG_FC_C_O
464 # AC_PROG_F77_C_O
465 # ---------------
466 AC_DEFUN([AC_PROG_F77_C_O],
467 [AC_REQUIRE([AC_PROG_F77])dnl
468 AC_LANG_PUSH(Fortran 77)dnl
469 _AC_PROG_FC_C_O
470 AC_LANG_POP(Fortran 77)dnl
471 ])# AC_PROG_F77_C_O
474 # AC_PROG_FC_C_O
475 # --------------
476 AC_DEFUN([AC_PROG_FC_C_O],
477 [AC_REQUIRE([AC_PROG_FC])dnl
478 AC_LANG_PUSH(Fortran)dnl
479 _AC_PROG_FC_C_O
480 AC_LANG_POP(Fortran)dnl
481 ])# AC_PROG_FC_C_O
485 ## ------------------------------- ##
486 ## 4. Compilers' characteristics.  ##
487 ## ------------------------------- ##
490 # _AC_PROG_FC_V_OUTPUT([FLAG = $ac_cv_prog_{f77/fc}_v])
491 # -----------------------------------------------------
492 # Link a trivial Fortran program, compiling with a verbose output FLAG
493 # (whose default value, $ac_cv_prog_{f77/fc}_v, is computed by
494 # _AC_PROG_FC_V), and return the output in $ac_{f77/fc}_v_output.  This
495 # output is processed in the way expected by _AC_FC_LIBRARY_LDFLAGS,
496 # so that any link flags that are echoed by the compiler appear as
497 # space-separated items.
498 AC_DEFUN([_AC_PROG_FC_V_OUTPUT],
499 [_AC_FORTRAN_ASSERT()dnl
500 AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
502 # Compile and link our simple test program by passing a flag (argument
503 # 1 to this macro) to the Fortran compiler in order to get
504 # "verbose" output that we can then parse for the Fortran linker
505 # flags.
506 ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
507 _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS m4_default([$1], [$ac_cv_prog_[]_AC_LANG_ABBREV[]_v])"
508 eval "set x $ac_link"
509 shift
510 _AS_ECHO_LOG([$[*]])
511 # gfortran 4.3 outputs lines setting COLLECT_GCC_OPTIONS, COMPILER_PATH,
512 # LIBRARY_PATH; skip all such settings.
513 ac_[]_AC_LANG_ABBREV[]_v_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1 |
514   sed '/^Driving:/d; /^Configured with:/d;
515       '"/^[[_$as_cr_Letters]][[_$as_cr_alnum]]*=/d"`
516 AS_ECHO(["$ac_[]_AC_LANG_ABBREV[]_v_output"]) >&AS_MESSAGE_LOG_FD
517 _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
519 rm -rf conftest*
521 # On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where
522 # /foo, /bar, and /baz are search directories for the Fortran linker.
523 # Here, we change these into -L/foo -L/bar -L/baz (and put it first):
524 ac_[]_AC_LANG_ABBREV[]_v_output="`echo $ac_[]_AC_LANG_ABBREV[]_v_output |
525         grep 'LPATH is:' |
526         sed 's|.*LPATH is\(: *[[^ ]]*\).*|\1|;s|: */| -L/|g'` $ac_[]_AC_LANG_ABBREV[]_v_output"
528 # FIXME: we keep getting bitten by quoted arguments; a more general fix
529 #        that detects unbalanced quotes in FLIBS should be implemented
530 #        and (ugh) tested at some point.
531 case $ac_[]_AC_LANG_ABBREV[]_v_output in
532   # With xlf replace commas with spaces,
533   # and remove "-link" and closing parenthesis.
534   *xlfentry*)
535     ac_[]_AC_LANG_ABBREV[]_v_output=`echo $ac_[]_AC_LANG_ABBREV[]_v_output |
536       sed '
537         s/,/ /g
538         s/ -link / /g
539         s/) *$//
540       '
541     ` ;;
543   # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted
544   # $LIBS confuse us, and the libraries appear later in the output anyway).
545   *mGLOB_options_string*)
546     ac_[]_AC_LANG_ABBREV[]_v_output=`echo $ac_[]_AC_LANG_ABBREV[]_v_output | sed 's/"-mGLOB[[^"]]*"/ /g'` ;;
548   # Portland Group compiler has singly- or doubly-quoted -cmdline argument
549   # Singly-quoted arguments were reported for versions 5.2-4 and 6.0-4.
550   # Doubly-quoted arguments were reported for "PGF90/x86 Linux/x86 5.0-2".
551   *-cmdline\ * | *-ignore\ * | *-def\ *)
552     ac_[]_AC_LANG_ABBREV[]_v_output=`echo $ac_[]_AC_LANG_ABBREV[]_v_output | sed "\
553         s/-cmdline  *'[[^']]*'/ /g; s/-cmdline  *\"[[^\"]]*\"/ /g
554         s/-ignore  *'[[^']]*'/ /g; s/-ignore  *\"[[^\"]]*\"/ /g
555         s/-def  *'[[^']]*'/ /g; s/-def  *\"[[^\"]]*\"/ /g"` ;;
557   # If we are using fort77 (the f2c wrapper) then filter output and delete quotes.
558   *fort77*f2c*gcc*)
559     ac_[]_AC_LANG_ABBREV[]_v_output=`echo "$ac_[]_AC_LANG_ABBREV[]_v_output" | sed -n '
560         /:[[     ]]\+Running[[   ]]\{1,\}"gcc"/{
561           /"-c"/d
562           /[[.]]c"*/d
563           s/^.*"gcc"/"gcc"/
564           s/"//gp
565         }'` ;;
567   # If we are using Cray Fortran then delete quotes.
568   *cft90*)
569     ac_[]_AC_LANG_ABBREV[]_v_output=`echo $ac_[]_AC_LANG_ABBREV[]_v_output | sed 's/"//g'` ;;
570 esac
572 ])# _AC_PROG_FC_V_OUTPUT
575 # _AC_PROG_FC_V
576 # -------------
578 # Determine the flag that causes the Fortran compiler to print
579 # information of library and object files (normally -v)
580 # Needed for _AC_FC_LIBRARY_FLAGS
581 # Some compilers don't accept -v (Lahey: (-)-verbose, xlf: -V, Fujitsu: -###)
582 AC_DEFUN([_AC_PROG_FC_V],
583 [_AC_FORTRAN_ASSERT()dnl
584 AC_CACHE_CHECK([how to get verbose linking output from $[]_AC_FC[]],
585                 [ac_cv_prog_[]_AC_LANG_ABBREV[]_v],
586 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
587 [ac_cv_prog_[]_AC_LANG_ABBREV[]_v=
588 # Try some options frequently used verbose output
589 for ac_verb in -v -verbose --verbose -V -\#\#\#; do
590   _AC_PROG_FC_V_OUTPUT($ac_verb)
591   # look for -l* and *.a constructs in the output
592   for ac_arg in $ac_[]_AC_LANG_ABBREV[]_v_output; do
593      case $ac_arg in
594         [[\\/]]*.a | ?:[[\\/]]*.a | -[[lLRu]]*)
595           ac_cv_prog_[]_AC_LANG_ABBREV[]_v=$ac_verb
596           break 2 ;;
597      esac
598   done
599 done
600 if test -z "$ac_cv_prog_[]_AC_LANG_ABBREV[]_v"; then
601    AC_MSG_WARN([cannot determine how to obtain linking information from $[]_AC_FC[]])
602 fi],
603                   [AC_MSG_WARN([compilation failed])])
604 ])])# _AC_PROG_FC_V
607 # _AC_FC_LIBRARY_LDFLAGS
608 # ----------------------
610 # Determine the linker flags (e.g. "-L" and "-l") for the Fortran
611 # intrinsic and runtime libraries that are required to successfully
612 # link a Fortran program or shared library.  The output variable
613 # FLIBS/FCLIBS is set to these flags.
615 # This macro is intended to be used in those situations when it is
616 # necessary to mix, e.g. C++ and Fortran, source code into a single
617 # program or shared library.
619 # For example, if object files from a C++ and Fortran compiler must
620 # be linked together, then the C++ compiler/linker must be used for
621 # linking (since special C++-ish things need to happen at link time
622 # like calling global constructors, instantiating templates, enabling
623 # exception support, etc.).
625 # However, the Fortran intrinsic and runtime libraries must be
626 # linked in as well, but the C++ compiler/linker doesn't know how to
627 # add these Fortran libraries.  Hence, the macro
628 # "AC_F77_LIBRARY_LDFLAGS" was created to determine these Fortran
629 # libraries.
631 # This macro was packaged in its current form by Matthew D. Langston.
632 # However, nearly all of this macro came from the "OCTAVE_FLIBS" macro
633 # in "octave-2.0.13/aclocal.m4", and full credit should go to John
634 # W. Eaton for writing this extremely useful macro.  Thank you John.
635 AC_DEFUN([_AC_FC_LIBRARY_LDFLAGS],
636 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
637 _AC_FORTRAN_ASSERT()dnl
638 _AC_PROG_FC_V
639 AC_CACHE_CHECK([for _AC_LANG libraries of $[]_AC_FC[]], ac_cv_[]_AC_LANG_ABBREV[]_libs,
640 [if test "x$[]_AC_LANG_PREFIX[]LIBS" != "x"; then
641   ac_cv_[]_AC_LANG_ABBREV[]_libs="$[]_AC_LANG_PREFIX[]LIBS" # Let the user override the test.
642 else
644 _AC_PROG_FC_V_OUTPUT
646 ac_cv_[]_AC_LANG_ABBREV[]_libs=
648 # Save positional arguments (if any)
649 ac_save_positional="$[@]"
651 set X $ac_[]_AC_LANG_ABBREV[]_v_output
652 while test $[@%:@] != 1; do
653   shift
654   ac_arg=$[1]
655   case $ac_arg in
656         [[\\/]]*.a | ?:[[\\/]]*.a)
657           _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_[]_AC_LANG_ABBREV[]_libs, ,
658               ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg")
659           ;;
660         -bI:*)
661           _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_[]_AC_LANG_ABBREV[]_libs, ,
662              [_AC_LINKER_OPTION([$ac_arg], ac_cv_[]_AC_LANG_ABBREV[]_libs)])
663           ;;
664           # Ignore these flags.
665         -lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -little \
666           |-LANG:=* | -LIST:* | -LNO:* | -link)
667           ;;
668         -lkernel32 | -lmingw* | -lmoldname)
669           # Ignore this library only on Windows-like systems.
670           case $host_os in
671           cygwin* | msys* | mingw* | windows*) ;;
672           *)
673           _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_[]_AC_LANG_ABBREV[]_libs, ,
674                              ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg")
675             ;;
676           esac
677           ;;
678         -[[LRuYz]])
679           # These flags, when seen by themselves, take an argument.
680           # We remove the space between option and argument and re-iterate
681           # unless we find an empty arg or a new option (starting with -)
682           case $[2] in
683              "" | -*);;
684              *)
685                 ac_arg="$ac_arg$[2]"
686                 shift; shift
687                 set X $ac_arg "$[@]"
688                 ;;
689           esac
690           ;;
691         -YP,*)
692           for ac_j in `AS_ECHO(["$ac_arg"]) | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do
693             _AC_LIST_MEMBER_IF($ac_j, $ac_cv_[]_AC_LANG_ABBREV[]_libs, ,
694                                [ac_arg="$ac_arg $ac_j"
695                                ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_j"])
696           done
697           ;;
698         -[[lLR]]*)
699           _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_[]_AC_LANG_ABBREV[]_libs, ,
700                              ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg")
701           ;;
702         -zallextract*| -zdefaultextract)
703           ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg"
704           ;;
705         -mllvm) ${2+shift};; # Defend against 'clang -mllvm -loopopt=0'.
706           # Ignore everything else.
707   esac
708 done
709 # restore positional arguments
710 set X $ac_save_positional; shift
712 # We only consider "LD_RUN_PATH" on Solaris systems.  If this is seen,
713 # then we insist that the "run path" must be an absolute path (i.e. it
714 # must begin with a "/").
715 case `(uname -sr) 2>/dev/null` in
716    "SunOS 5"*)
717       ac_ld_run_path=`AS_ECHO(["$ac_[]_AC_LANG_ABBREV[]_v_output"]) |
718                         sed -n 's,^.*LD_RUN_PATH *= *\(/[[^ ]]*\).*$,-R\1,p'`
719       test "x$ac_ld_run_path" != x &&
720         _AC_LINKER_OPTION([$ac_ld_run_path], ac_cv_[]_AC_LANG_ABBREV[]_libs)
721       ;;
722 esac
723 fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x"
725 []_AC_LANG_PREFIX[]LIBS="$ac_cv_[]_AC_LANG_ABBREV[]_libs"
726 AC_SUBST([]_AC_LANG_PREFIX[]LIBS)
727 ])# _AC_FC_LIBRARY_LDFLAGS
730 # AC_F77_LIBRARY_LDFLAGS
731 # ----------------------
732 AC_DEFUN([AC_F77_LIBRARY_LDFLAGS],
733 [AC_REQUIRE([AC_PROG_F77])dnl
734 AC_LANG_PUSH(Fortran 77)dnl
735 _AC_FC_LIBRARY_LDFLAGS
736 AC_LANG_POP(Fortran 77)dnl
737 ])# AC_F77_LIBRARY_LDFLAGS
740 # AC_FC_LIBRARY_LDFLAGS
741 # ---------------------
742 AC_DEFUN([AC_FC_LIBRARY_LDFLAGS],
743 [AC_REQUIRE([AC_PROG_FC])dnl
744 AC_LANG_PUSH(Fortran)dnl
745 _AC_FC_LIBRARY_LDFLAGS
746 AC_LANG_POP(Fortran)dnl
747 ])# AC_FC_LIBRARY_LDFLAGS
750 # _AC_FC_DUMMY_MAIN([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
751 # -----------------------------------------------------------
753 # Detect name of dummy main routine required by the Fortran libraries,
754 # (if any) and define {F77,FC}_DUMMY_MAIN to this name (which should be
755 # used for a dummy declaration, if it is defined).  On some systems,
756 # linking a C program to the Fortran library does not work unless you
757 # supply a dummy function called something like MAIN__.
759 # Execute ACTION-IF-NOT-FOUND if no way of successfully linking a C
760 # program with the {F77,FC} libs is found; default to exiting with an error
761 # message.  Execute ACTION-IF-FOUND if a dummy routine name is needed
762 # and found or if it is not needed (default to defining {F77,FC}_DUMMY_MAIN
763 # when needed).
765 # What is technically happening is that the Fortran libraries provide
766 # their own main() function, which usually initializes Fortran I/O and
767 # similar stuff, and then calls MAIN__, which is the entry point of
768 # your program.  Usually, a C program will override this with its own
769 # main() routine, but the linker sometimes complain if you don't
770 # provide a dummy (never-called) MAIN__ routine anyway.
772 # Of course, programs that want to allow Fortran subroutines to do
773 # I/O, etcetera, should call their main routine MAIN__() (or whatever)
774 # instead of main().  A separate autoconf test (_AC_FC_MAIN) checks
775 # for the routine to use in this case (since the semantics of the test
776 # are slightly different).  To link to e.g. purely numerical
777 # libraries, this is normally not necessary, however, and most C/C++
778 # programs are reluctant to turn over so much control to Fortran.  =)
780 # The name variants we check for are (in order):
781 #   MAIN__ (g77, MAIN__ required on some systems; IRIX, MAIN__ optional)
782 #   MAIN_, __main (SunOS)
783 #   MAIN _MAIN __MAIN main_ main__ _main (we follow DDD and try these too)
784 AC_DEFUN([_AC_FC_DUMMY_MAIN],
785 [_AC_FORTRAN_ASSERT()dnl
786 m4_define(_AC_LANG_PROGRAM_C_[]_AC_FC[]_HOOKS,
787 [#ifdef ]_AC_FC[_DUMMY_MAIN
788 ]AC_LANG_CASE([Fortran], [#ifndef FC_DUMMY_MAIN_EQ_F77])
789 [#  ifdef __cplusplus
790      extern "C"
791 #  endif
792    int ]_AC_FC[_DUMMY_MAIN() { return 1; }
793 ]AC_LANG_CASE([Fortran], [#endif])
794 [#endif
796 AC_CACHE_CHECK([for dummy main to link with _AC_LANG libraries],
797                ac_cv_[]_AC_LANG_ABBREV[]_dummy_main,
798 [ac_[]_AC_LANG_ABBREV[]_dm_save_LIBS=$LIBS
799  LIBS="$LIBS $[]_AC_LANG_PREFIX[]LIBS"
800  ac_fortran_dm_var=[]_AC_FC[]_DUMMY_MAIN
801  AC_LANG_PUSH(C)dnl
803  # First, try linking without a dummy main:
804  AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
805                 [ac_cv_fortran_dummy_main=none],
806                 [ac_cv_fortran_dummy_main=unknown])
808  if test $ac_cv_fortran_dummy_main = unknown; then
809    for ac_func in MAIN__ MAIN_ __main MAIN _MAIN __MAIN main_ main__ _main; do
810      AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@define $ac_fortran_dm_var $ac_func]])],
811                     [ac_cv_fortran_dummy_main=$ac_func; break])
812    done
813  fi
814  AC_LANG_POP(C)dnl
815  ac_cv_[]_AC_LANG_ABBREV[]_dummy_main=$ac_cv_fortran_dummy_main
816  rm -rf conftest*
817  LIBS=$ac_[]_AC_LANG_ABBREV[]_dm_save_LIBS
819 []_AC_FC[]_DUMMY_MAIN=$ac_cv_[]_AC_LANG_ABBREV[]_dummy_main
820 AS_IF([test "$[]_AC_FC[]_DUMMY_MAIN" != unknown],
821       [m4_default([$1],
822 [if test $[]_AC_FC[]_DUMMY_MAIN != none; then
823   AC_DEFINE_UNQUOTED([]_AC_FC[]_DUMMY_MAIN, $[]_AC_FC[]_DUMMY_MAIN,
824                      [Define to dummy 'main' function (if any) required to
825                       link to the Fortran libraries.])
826   if test "x$ac_cv_fc_dummy_main" = "x$ac_cv_f77_dummy_main"; then
827         AC_DEFINE([FC_DUMMY_MAIN_EQ_F77], 1,
828                   [Define if F77 and FC dummy 'main' functions are identical.])
829   fi
830 fi])],
831       [m4_default([$2],
832             [AC_MSG_FAILURE([linking to Fortran libraries from C fails])])])
833 ])# _AC_FC_DUMMY_MAIN
836 # AC_F77_DUMMY_MAIN
837 # -----------------
838 AC_DEFUN([AC_F77_DUMMY_MAIN],
839 [AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])dnl
840 AC_LANG_PUSH(Fortran 77)dnl
841 _AC_FC_DUMMY_MAIN($@)
842 AC_LANG_POP(Fortran 77)dnl
843 ])# AC_F77_DUMMY_MAIN
846 # AC_FC_DUMMY_MAIN
847 # ----------------
848 AC_DEFUN([AC_FC_DUMMY_MAIN],
849 [AC_REQUIRE([AC_FC_LIBRARY_LDFLAGS])dnl
850 AC_LANG_PUSH(Fortran)dnl
851 _AC_FC_DUMMY_MAIN($@)
852 AC_LANG_POP(Fortran)dnl
853 ])# AC_FC_DUMMY_MAIN
856 # _AC_FC_MAIN
857 # -----------
858 # Define {F77,FC}_MAIN to name of alternate main() function for use with
859 # the Fortran libraries.  (Typically, the libraries may define their
860 # own main() to initialize I/O, etcetera, that then call your own
861 # routine called MAIN__ or whatever.)  See _AC_FC_DUMMY_MAIN, above.
862 # If no such alternate name is found, just define {F77,FC}_MAIN to main.
864 AC_DEFUN([_AC_FC_MAIN],
865 [_AC_FORTRAN_ASSERT()dnl
866 AC_CACHE_CHECK([for alternate main to link with _AC_LANG libraries],
867                ac_cv_[]_AC_LANG_ABBREV[]_main,
868 [ac_[]_AC_LANG_ABBREV[]_m_save_LIBS=$LIBS
869  LIBS="$LIBS $[]_AC_LANG_PREFIX[]LIBS"
870  ac_fortran_dm_var=[]_AC_FC[]_DUMMY_MAIN
871  AC_LANG_PUSH(C)dnl
872  ac_cv_fortran_main="main" # default entry point name
873  for ac_func in MAIN__ MAIN_ __main MAIN _MAIN __MAIN main_ main__ _main; do
874    AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@ifdef FC_DUMMY_MAIN_EQ_F77
875 @%:@  undef F77_DUMMY_MAIN
876 @%:@  undef FC_DUMMY_MAIN
877 @%:@else
878 @%:@  undef $ac_fortran_dm_var
879 @%:@endif
880 @%:@define main $ac_func])],
881                   [ac_cv_fortran_main=$ac_func; break])
882  done
883  AC_LANG_POP(C)dnl
884  ac_cv_[]_AC_LANG_ABBREV[]_main=$ac_cv_fortran_main
885  rm -rf conftest*
886  LIBS=$ac_[]_AC_LANG_ABBREV[]_m_save_LIBS
888 AC_DEFINE_UNQUOTED([]_AC_FC[]_MAIN, $ac_cv_[]_AC_LANG_ABBREV[]_main,
889                    [Define to alternate name for 'main' routine that is
890                     called from a 'main' in the Fortran libraries.])
891 ])# _AC_FC_MAIN
894 # AC_F77_MAIN
895 # -----------
896 AC_DEFUN([AC_F77_MAIN],
897 [AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])dnl
898 AC_LANG_PUSH(Fortran 77)dnl
899 _AC_FC_MAIN
900 AC_LANG_POP(Fortran 77)dnl
901 ])# AC_F77_MAIN
904 # AC_FC_MAIN
905 # ----------
906 AC_DEFUN([AC_FC_MAIN],
907 [AC_REQUIRE([AC_FC_LIBRARY_LDFLAGS])dnl
908 AC_LANG_PUSH(Fortran)dnl
909 _AC_FC_MAIN
910 AC_LANG_POP(Fortran)dnl
911 ])# AC_FC_MAIN
914 # __AC_FC_NAME_MANGLING
915 # ---------------------
916 # Test for the name mangling scheme used by the Fortran compiler.
918 # Sets ac_cv_{f77,fc}_mangling. The value contains three fields, separated
919 # by commas:
921 # lower case / upper case:
922 #    case translation of the Fortran symbols
923 # underscore / no underscore:
924 #    whether the compiler appends "_" to symbol names
925 # extra underscore / no extra underscore:
926 #    whether the compiler appends an extra "_" to symbol names already
927 #    containing at least one underscore
929 AC_DEFUN([__AC_FC_NAME_MANGLING],
930 [_AC_FORTRAN_ASSERT()dnl
931 AC_CACHE_CHECK([for _AC_LANG name-mangling scheme],
932                ac_cv_[]_AC_LANG_ABBREV[]_mangling,
933 [AC_COMPILE_IFELSE(
934 [[      subroutine foobar()
935       return
936       end
937       subroutine foo_bar()
938       return
939       end]],
940 [mv conftest.$ac_objext cfortran_test.$ac_objext
942   ac_save_LIBS=$LIBS
943   LIBS="cfortran_test.$ac_objext $LIBS $[]_AC_LANG_PREFIX[]LIBS"
945   AC_LANG_PUSH(C)dnl
946   ac_success=no
947   for ac_foobar in foobar FOOBAR; do
948     for ac_underscore in "" "_"; do
949       ac_func="$ac_foobar$ac_underscore"
950       AC_LINK_IFELSE([AC_LANG_CALL([], [$ac_func])],
951                      [ac_success=yes; break 2])
952     done
953   done
954   AC_LANG_POP(C)dnl
956   if test "$ac_success" = "yes"; then
957      case $ac_foobar in
958         foobar)
959            ac_case=lower
960            ac_foo_bar=foo_bar
961            ;;
962         FOOBAR)
963            ac_case=upper
964            ac_foo_bar=FOO_BAR
965            ;;
966      esac
968      AC_LANG_PUSH(C)dnl
969      ac_success_extra=no
970      for ac_extra in "" "_"; do
971         ac_func="$ac_foo_bar$ac_underscore$ac_extra"
972         AC_LINK_IFELSE([AC_LANG_CALL([], [$ac_func])],
973                        [ac_success_extra=yes; break])
974      done
975      AC_LANG_POP(C)dnl
977      if test "$ac_success_extra" = "yes"; then
978         ac_cv_[]_AC_LANG_ABBREV[]_mangling="$ac_case case"
979         if test -z "$ac_underscore"; then
980            ac_cv_[]_AC_LANG_ABBREV[]_mangling="$ac_cv_[]_AC_LANG_ABBREV[]_mangling, no underscore"
981         else
982            ac_cv_[]_AC_LANG_ABBREV[]_mangling="$ac_cv_[]_AC_LANG_ABBREV[]_mangling, underscore"
983         fi
984         if test -z "$ac_extra"; then
985            ac_cv_[]_AC_LANG_ABBREV[]_mangling="$ac_cv_[]_AC_LANG_ABBREV[]_mangling, no extra underscore"
986         else
987            ac_cv_[]_AC_LANG_ABBREV[]_mangling="$ac_cv_[]_AC_LANG_ABBREV[]_mangling, extra underscore"
988         fi
989       else
990         ac_cv_[]_AC_LANG_ABBREV[]_mangling="unknown"
991       fi
992   else
993      ac_cv_[]_AC_LANG_ABBREV[]_mangling="unknown"
994   fi
996   LIBS=$ac_save_LIBS
997   rm -rf conftest*
998   rm -f cfortran_test*],
999   [AC_MSG_FAILURE([cannot compile a simple Fortran program])])
1001 ])# __AC_FC_NAME_MANGLING
1003 # The replacement is empty.
1004 AU_DEFUN([AC_F77_NAME_MANGLING], [])
1007 # _AC_F77_NAME_MANGLING
1008 # ---------------------
1009 AC_DEFUN([_AC_F77_NAME_MANGLING],
1010 [AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])dnl
1011 AC_REQUIRE([AC_F77_DUMMY_MAIN])dnl
1012 AC_LANG_PUSH(Fortran 77)dnl
1013 __AC_FC_NAME_MANGLING
1014 AC_LANG_POP(Fortran 77)dnl
1015 ])# _AC_F77_NAME_MANGLING
1018 # _AC_FC_NAME_MANGLING
1019 # --------------------
1020 AC_DEFUN([_AC_FC_NAME_MANGLING],
1021 [AC_REQUIRE([AC_FC_LIBRARY_LDFLAGS])dnl
1022 AC_REQUIRE([AC_FC_DUMMY_MAIN])dnl
1023 AC_LANG_PUSH(Fortran)dnl
1024 __AC_FC_NAME_MANGLING
1025 AC_LANG_POP(Fortran)dnl
1026 ])# _AC_FC_NAME_MANGLING
1029 # _AC_FC_WRAPPERS
1030 # ---------------
1031 # Defines C macros {F77,FC}_FUNC(name,NAME) and {F77,FC}_FUNC_(name,NAME) to
1032 # properly mangle the names of C identifiers, and C identifiers with
1033 # underscores, respectively, so that they match the name mangling
1034 # scheme used by the Fortran compiler.
1035 AC_DEFUN([_AC_FC_WRAPPERS],
1036 [_AC_FORTRAN_ASSERT()dnl
1037 AH_TEMPLATE(_AC_FC[_FUNC],
1038     [Define to a macro mangling the given C identifier (in lower and upper
1039      case), which must not contain underscores, for linking with Fortran.])dnl
1040 AH_TEMPLATE(_AC_FC[_FUNC_],
1041     [As ]_AC_FC[_FUNC, but for C identifiers containing underscores.])dnl
1042 case $ac_cv_[]_AC_LANG_ABBREV[]_mangling in
1043   "lower case, no underscore, no extra underscore")
1044           AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [name])
1045           AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name]) ;;
1046   "lower case, no underscore, extra underscore")
1047           AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [name])
1048           AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name [##] _]) ;;
1049   "lower case, underscore, no extra underscore")
1050           AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [name [##] _])
1051           AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name [##] _]) ;;
1052   "lower case, underscore, extra underscore")
1053           AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [name [##] _])
1054           AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [name [##] __]) ;;
1055   "upper case, no underscore, no extra underscore")
1056           AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [NAME])
1057           AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME]) ;;
1058   "upper case, no underscore, extra underscore")
1059           AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [NAME])
1060           AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME [##] _]) ;;
1061   "upper case, underscore, no extra underscore")
1062           AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [NAME [##] _])
1063           AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME [##] _]) ;;
1064   "upper case, underscore, extra underscore")
1065           AC_DEFINE(_AC_FC[_FUNC(name,NAME)],  [NAME [##] _])
1066           AC_DEFINE(_AC_FC[_FUNC_(name,NAME)], [NAME [##] __]) ;;
1067   *)
1068           AC_MSG_WARN([unknown Fortran name-mangling scheme])
1069           ;;
1070 esac
1071 ])# _AC_FC_WRAPPERS
1074 # AC_F77_WRAPPERS
1075 # ---------------
1076 AC_DEFUN([AC_F77_WRAPPERS],
1077 [AC_REQUIRE([_AC_F77_NAME_MANGLING])dnl
1078 AC_LANG_PUSH(Fortran 77)dnl
1079 _AC_FC_WRAPPERS
1080 AC_LANG_POP(Fortran 77)dnl
1081 ])# AC_F77_WRAPPERS
1084 # AC_FC_WRAPPERS
1085 # --------------
1086 AC_DEFUN([AC_FC_WRAPPERS],
1087 [AC_REQUIRE([_AC_FC_NAME_MANGLING])dnl
1088 AC_LANG_PUSH(Fortran)dnl
1089 _AC_FC_WRAPPERS
1090 AC_LANG_POP(Fortran)dnl
1091 ])# AC_FC_WRAPPERS
1094 # _AC_FC_FUNC(NAME, [SHELLVAR = NAME])
1095 # ------------------------------------
1096 # For a Fortran subroutine of given NAME, define a shell variable
1097 # $SHELLVAR to the Fortran-mangled name.  If the SHELLVAR
1098 # argument is not supplied, it defaults to NAME.
1099 AC_DEFUN([_AC_FC_FUNC],
1100 [_AC_FORTRAN_ASSERT()dnl
1101 case $ac_cv_[]_AC_LANG_ABBREV[]_mangling in
1102   upper*) ac_val="m4_toupper([$1])" ;;
1103   lower*) ac_val="m4_tolower([$1])" ;;
1104   *)      ac_val="unknown" ;;
1105 esac
1106 case $ac_cv_[]_AC_LANG_ABBREV[]_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac
1107 m4_if(m4_index([$1],[_]),-1,[],
1108 [case $ac_cv_[]_AC_LANG_ABBREV[]_mangling in *," extra underscore"*) ac_val="$ac_val"_ ;; esac
1110 m4_default([$2],[$1])="$ac_val"
1111 ])# _AC_FC_FUNC
1114 # AC_F77_FUNC(NAME, [SHELLVAR = NAME])
1115 # ------------------------------------
1116 AC_DEFUN([AC_F77_FUNC],
1117 [AC_REQUIRE([_AC_F77_NAME_MANGLING])dnl
1118 AC_LANG_PUSH(Fortran 77)dnl
1119 _AC_FC_FUNC([$1],[$2])
1120 AC_LANG_POP(Fortran 77)dnl
1121 ])# AC_F77_FUNC
1124 # AC_FC_FUNC(NAME, [SHELLVAR = NAME])
1125 # -----------------------------------
1126 AC_DEFUN([AC_FC_FUNC],
1127 [AC_REQUIRE([_AC_FC_NAME_MANGLING])dnl
1128 AC_LANG_PUSH(Fortran)dnl
1129 _AC_FC_FUNC([$1],[$2])
1130 AC_LANG_POP(Fortran)dnl
1131 ])# AC_FC_FUNC
1134 # AC_FC_SRCEXT(EXT, [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])
1135 # -----------------------------------------------------------
1136 # Set the source-code extension used in Fortran (FC) tests to EXT (which
1137 # defaults to f).  Also, look for any necessary additional FCFLAGS needed
1138 # to allow this extension, and store them in the output variable
1139 # FCFLAGS_<EXT> (e.g. FCFLAGS_f90 for EXT=f90).  If successful,
1140 # call ACTION-IF-SUCCESS.  If unable to compile source code with EXT,
1141 # call ACTION-IF-FAILURE, which defaults to failing with an error
1142 # message.
1144 # (The flags for the current source-code extension, if any, are stored in
1145 # $ac_fcflags_srcext and used automatically in subsequent autoconf tests.)
1147 # For ordinary extensions like f90, etcetera, the modified FCFLAGS
1148 # are currently needed for IBM's xlf* and Intel's ifc (grrr).  Unfortunately,
1149 # xlf* will only take flags to recognize one extension at a time, so if the
1150 # user wants to compile multiple extensions (.f90 and .f95, say), she
1151 # will need to use the FCFLAGS_F90 and FCFLAGS_F95 individually rather
1152 # than just adding them all to FCFLAGS, for example.
1154 # Also, for Intel's ifc compiler (which does not accept .f95 by default in
1155 # some versions), the $FCFLAGS_<EXT> variable *must* go immediately before
1156 # the source file on the command line, unlike other $FCFLAGS.  Ugh.
1158 # gfortran requires '-x f77' in order to recognize .f77 files.
1159 AC_DEFUN([AC_FC_SRCEXT],
1160 [AC_LANG_PUSH(Fortran)dnl
1161 AC_CACHE_CHECK([for Fortran flag to compile .$1 files],
1162                 ac_cv_fc_srcext_$1,
1163 [ac_ext=$1
1164 ac_fcflags_srcext_save=$ac_fcflags_srcext
1165 ac_fcflags_srcext=
1166 ac_cv_fc_srcext_$1=unknown
1167 case $ac_ext in #(
1168   [[fF]]77) ac_try=f77;; #(
1169   *) ac_try=f95;;
1170 esac
1171 for ac_flag in none -qsuffix=f=$1 -Tf "-x $ac_try"; do
1172   test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag"
1173   AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_fc_srcext_$1=$ac_flag; break])
1174 done
1175 rm -f conftest.$ac_objext conftest.$1
1176 ac_fcflags_srcext=$ac_fcflags_srcext_save
1178 if test "x$ac_cv_fc_srcext_$1" = xunknown; then
1179   m4_default([$3],[AC_MSG_ERROR([Fortran could not compile .$1 files])])
1180 else
1181   ac_fc_srcext=$1
1182   if test "x$ac_cv_fc_srcext_$1" = xnone; then
1183     ac_fcflags_srcext=""
1184     FCFLAGS_[]$1[]=""
1185   else
1186     ac_fcflags_srcext=$ac_cv_fc_srcext_$1
1187     FCFLAGS_[]$1[]=$ac_cv_fc_srcext_$1
1188   fi
1189   AC_SUBST(FCFLAGS_[]$1)
1190   $2
1192 AC_LANG_POP(Fortran)dnl
1193 ])# AC_FC_SRCEXT
1196 # AC_FC_PP_SRCEXT(EXT, [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])
1197 # --------------------------------------------------------------
1198 # Like AC_FC_SRCEXT, set the source-code extension used in Fortran (FC) tests
1199 # to EXT (which defaults to f).  Also, look for any necessary additional
1200 # FCFLAGS needed to allow this extension for preprocessed Fortran, and store
1201 # them in the output variable FCFLAGS_<EXT> (e.g. FCFLAGS_f90 for EXT=f90).
1202 # If successful, call ACTION-IF-SUCCESS.  If unable to compile preprocessed
1203 # source code with EXT, call ACTION-IF-FAILURE, which defaults to failing with
1204 # an error message.
1206 # Some compilers allow preprocessing with either a Fortran preprocessor or
1207 # with the C preprocessor (cpp).  Prefer the Fortran preprocessor, to deal
1208 # correctly with continuation lines, '//' (not a comment), and preserve white
1209 # space (for fixed form).
1211 # (The flags for the current source-code extension, if any, are stored in
1212 # $ac_fcflags_srcext and used automatically in subsequent autoconf tests.)
1214 # For ordinary extensions like f90, etcetera, the modified FCFLAGS
1215 # are needed for IBM's xlf*.  Also, for Intel's ifort compiler, the
1216 # $FCFLAGS_<EXT> variable *must* go immediately before the source file on the
1217 # command line, unlike other $FCFLAGS.  Ugh.
1219 # Known extensions that enable preprocessing by default, and flags to force it:
1220 # GNU: .F .F90 .F95 .F03 .F08, -cpp for most others,
1221 #      -x f77-cpp-input for .f77 .F77; -x f95-cpp-input for gfortran < 4.4
1222 # SGI: .F .F90, -ftpp or -cpp for .f .f90, -E write preproc to stdout
1223 #      -macro_expand enable macro expansion everywhere (with -ftpp)
1224 #      -P preproc only, save in .i, no #line's
1225 # SUN: .F .F95, -fpp for others; -xpp={fpp,cpp} for preprocessor selection
1226 #      -F preprocess only (save in lowercase extension)
1227 # IBM: .F .F77 .F90 .F95 .F03, -qsuffix=cpp=EXT for extension .EXT to invoke cpp
1228 #      -WF,-qnofpp -WF,-qfpp=comment:linecont:nocomment:nolinecont
1229 #      -WF,-qlanglvl=classic or not -qnoescape (trigraph problems)
1230 #      -d no #line in output, -qnoobject for preprocessing only (output in .f)
1231 #      -q{no,}ppsuborigarg substitute original macro args before expansion
1232 # HP:  .F, +cpp={yes|no|default} use cpp, -cpp, +cpp_keep save in .i/.i90
1233 # PGI: -Mpreprocess
1234 # Absoft: .F .FOR .F90 .F95, -cpp for others
1235 # Cray: .F .F90 .FTN, -e Z for others; -F enable macro expansion everywhere
1236 # Intel: .F .F90, -fpp for others, but except for .f and .f90, -Tf may also be
1237 #        needed right before the source file name
1238 # PathScale: .F .F90 .F95, -ftpp or -cpp for .f .f90 .f95
1239 #         -macro_expand for expansion everywhere, -P for no #line in output
1240 # Lahey: .F .FOR .F90 .F95, -Cpp
1241 # NAGWare: .F .F90 .F95, .ff .ff90 .ff95 (new), -fpp for others
1242 # Compaq/Tru64: .F .F90, -cpp, -P keep .i file, -P keep .i file
1243 # f2c: .F, -cpp
1244 # g95: .F .FOR .F90 .F95 .F03, -cpp -no-cpp, -E for stdout
1245 AC_DEFUN([AC_FC_PP_SRCEXT],
1246 [AC_LANG_PUSH(Fortran)dnl
1247 AC_CACHE_CHECK([for Fortran flag to compile preprocessed .$1 files],
1248                 ac_cv_fc_pp_srcext_$1,
1249 [ac_ext=$1
1250 ac_fcflags_pp_srcext_save=$ac_fcflags_srcext
1251 ac_fcflags_srcext=
1252 ac_cv_fc_pp_srcext_$1=unknown
1253 case $ac_ext in #(
1254   [[fF]]77) ac_try=f77-cpp-input;; #(
1255   *) ac_try=f95-cpp-input;;
1256 esac
1257 for ac_flag in none -ftpp -fpp -Tf "-fpp -Tf" -xpp=fpp -Mpreprocess "-e Z" \
1258                -cpp -xpp=cpp -qsuffix=cpp=$1 "-x $ac_try" +cpp -Cpp; do
1259   test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag"
1260   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
1261 #if 0
1262 #include <ac_nonexistent.h>
1263       choke me
1264 #endif]])],
1265     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
1266 #if 1
1267 #include <ac_nonexistent.h>
1268       choke me
1269 #endif]])],
1270        [],
1271        [ac_cv_fc_pp_srcext_$1=$ac_flag; break])])
1272 done
1273 rm -f conftest.$ac_objext conftest.$1
1274 ac_fcflags_srcext=$ac_fcflags_pp_srcext_save
1276 if test "x$ac_cv_fc_pp_srcext_$1" = xunknown; then
1277   m4_default([$3],
1278              [AC_MSG_ERROR([Fortran could not compile preprocessed .$1 files])])
1279 else
1280   ac_fc_srcext=$1
1281   if test "x$ac_cv_fc_pp_srcext_$1" = xnone; then
1282     ac_fcflags_srcext=""
1283     FCFLAGS_[]$1[]=""
1284   else
1285     ac_fcflags_srcext=$ac_cv_fc_pp_srcext_$1
1286     FCFLAGS_[]$1[]=$ac_cv_fc_pp_srcext_$1
1287   fi
1288   AC_SUBST(FCFLAGS_[]$1)
1289   $2
1291 AC_LANG_POP(Fortran)dnl
1292 ])# AC_FC_PP_SRCEXT
1295 # AC_FC_PP_DEFINE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
1296 # -------------------------------------------------------------------
1297 # Find a flag to specify defines for preprocessed Fortran.  Not all
1298 # Fortran compilers use -D.  Substitute FC_DEFINE with the result and
1299 # call ACTION-IF-SUCCESS (defaults to nothing) if successful, and
1300 # ACTION-IF-FAILURE (defaults to failing with an error message) if not.
1302 # Known flags:
1303 # IBM: -WF,-D
1304 # Lahey/Fujitsu: -Wp,-D     older versions???
1305 # f2c: -D or -Wc,-D
1306 # others: -D
1307 AC_DEFUN([AC_FC_PP_DEFINE],
1308 [AC_LANG_PUSH([Fortran])dnl
1309 ac_fc_pp_define_srcext_save=$ac_fc_srcext
1310 AC_FC_PP_SRCEXT([F])
1311 AC_CACHE_CHECK([how to define symbols for preprocessed Fortran],
1312   [ac_cv_fc_pp_define],
1313 [ac_fc_pp_define_srcext_save=$ac_fc_srcext
1314 ac_cv_fc_pp_define=unknown
1315 ac_fc_pp_define_FCFLAGS_save=$FCFLAGS
1316 for ac_flag in -D -WF,-D -Wp,-D -Wc,-D
1318   FCFLAGS="$ac_fc_pp_define_FCFLAGS_save ${ac_flag}FOOBAR ${ac_flag}ZORK=42"
1319   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
1320 #ifndef FOOBAR
1321       choke me
1322 #endif
1323 #if ZORK != 42
1324       choke me
1325 #endif]])],
1326     [ac_cv_fc_pp_define=$ac_flag])
1327   test x"$ac_cv_fc_pp_define" != xunknown && break
1328 done
1329 FCFLAGS=$ac_fc_pp_define_FCFLAGS_save
1331 ac_fc_srcext=$ac_fc_pp_define_srcext_save
1332 if test "x$ac_cv_fc_pp_define" = xunknown; then
1333   FC_DEFINE=
1334   m4_default([$2],
1335              [AC_MSG_ERROR([Fortran does not allow to define preprocessor symbols], 77)])
1336 else
1337   FC_DEFINE=$ac_cv_fc_pp_define
1338   $1
1340 AC_SUBST([FC_DEFINE])dnl
1341 AC_LANG_POP([Fortran])dnl
1345 # AC_FC_FREEFORM([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
1346 # ------------------------------------------------------------------
1347 # Look for a compiler flag to make the Fortran (FC) compiler accept
1348 # free-format source code, and adds it to FCFLAGS.  Call
1349 # ACTION-IF-SUCCESS (defaults to nothing) if successful (i.e. can
1350 # compile code using new extension) and ACTION-IF-FAILURE (defaults to
1351 # failing with an error message) if not.  (Defined via DEFUN_ONCE to
1352 # prevent flag from being added to FCFLAGS multiple times.)
1354 # The known flags are:
1355 #        -ffree-form: GNU g77, gfortran, g95
1356 #         -FR, -free: Intel compiler (icc, ecc, ifort)
1357 #              -free: Compaq compiler (fort), Sun compiler (f95)
1358 #             -qfree: IBM compiler (xlf)
1359 # -Mfree, -Mfreeform: Portland Group compiler
1360 #          -freeform: SGI compiler
1361 #        -8, -f free: Absoft Fortran
1362 #       +source=free: HP Fortran
1363 #    (-)-nfix, -Free: Lahey/Fujitsu Fortran
1364 #              -free: NAGWare
1365 #         -f, -Wf,-f: f2c (but only a weak form of "free-form" and long lines)
1366 # We try to test the "more popular" flags first, by some prejudiced
1367 # notion of popularity.
1368 AC_DEFUN_ONCE([AC_FC_FREEFORM],
1369 [AC_LANG_PUSH([Fortran])dnl
1370 AC_CACHE_CHECK([for Fortran flag needed to accept free-form source],
1371                [ac_cv_fc_freeform],
1372 [ac_cv_fc_freeform=unknown
1373 ac_fc_freeform_FCFLAGS_save=$FCFLAGS
1374 for ac_flag in none -ffree-form -FR -free -qfree -Mfree -Mfreeform \
1375                -freeform "-f free" -8 +source=free -nfix --nfix -Free
1377   test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_freeform_FCFLAGS_save $ac_flag"
1378 dnl Use @&t@ below to ensure that editors don't turn 8+ spaces into tab.
1379   AC_COMPILE_IFELSE([[
1380   program freeform
1381        ! FIXME: how to best confuse non-freeform compilers?
1382        print *, 'Hello ', &
1383      @&t@     'world.'
1384        end]],
1385                     [ac_cv_fc_freeform=$ac_flag; break])
1386 done
1387 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
1388 FCFLAGS=$ac_fc_freeform_FCFLAGS_save
1390 if test "x$ac_cv_fc_freeform" = xunknown; then
1391   m4_default([$2],
1392              [AC_MSG_ERROR([Fortran does not accept free-form source], 77)])
1393 else
1394   if test "x$ac_cv_fc_freeform" != xnone; then
1395     FCFLAGS="$FCFLAGS $ac_cv_fc_freeform"
1396   fi
1397   $1
1399 AC_LANG_POP([Fortran])dnl
1400 ])# AC_FC_FREEFORM
1403 # AC_FC_FIXEDFORM([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
1404 # ------------------------------------------------------------------
1405 # Look for a compiler flag to make the Fortran (FC) compiler accept
1406 # fixed-format source code, and adds it to FCFLAGS.  Call
1407 # ACTION-IF-SUCCESS (defaults to nothing) if successful (i.e. can
1408 # compile code using new extension) and ACTION-IF-FAILURE (defaults to
1409 # failing with an error message) if not.  (Defined via DEFUN_ONCE to
1410 # prevent flag from being added to FCFLAGS multiple times.)
1412 # The known flags are:
1413 #       -ffixed-form: GNU g77, gfortran, g95
1414 #             -fixed: Intel compiler (ifort), Sun compiler (f95)
1415 #            -qfixed: IBM compiler (xlf*)
1416 #            -Mfixed: Portland Group compiler
1417 #         -fixedform: SGI compiler
1418 #           -f fixed: Absoft Fortran
1419 #      +source=fixed: HP Fortran
1420 #    (-)-fix, -Fixed: Lahey/Fujitsu Fortran
1421 #             -fixed: NAGWare
1422 # Since compilers may accept fixed form based on file name extension,
1423 # but users may want to use it with others as well, call AC_FC_SRCEXT
1424 # with the respective source extension before calling this macro.
1425 AC_DEFUN_ONCE([AC_FC_FIXEDFORM],
1426 [AC_LANG_PUSH([Fortran])dnl
1427 AC_CACHE_CHECK([for Fortran flag needed to accept fixed-form source],
1428                [ac_cv_fc_fixedform],
1429 [ac_cv_fc_fixedform=unknown
1430 ac_fc_fixedform_FCFLAGS_save=$FCFLAGS
1431 for ac_flag in none -ffixed-form -fixed -qfixed -Mfixed -fixedform "-f fixed" \
1432                +source=fixed -fix --fix -Fixed
1434   test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_fixedform_FCFLAGS_save $ac_flag"
1435   AC_COMPILE_IFELSE([[
1436 C     This comment should confuse free-form compilers.
1437       program main
1438       end]],
1439                     [ac_cv_fc_fixedform=$ac_flag; break])
1440 done
1441 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
1442 FCFLAGS=$ac_fc_fixedform_FCFLAGS_save
1444 if test "x$ac_cv_fc_fixedform" = xunknown; then
1445   m4_default([$2],
1446              [AC_MSG_ERROR([Fortran does not accept fixed-form source], 77)])
1447 else
1448   if test "x$ac_cv_fc_fixedform" != xnone; then
1449     FCFLAGS="$FCFLAGS $ac_cv_fc_fixedform"
1450   fi
1451   $1
1453 AC_LANG_POP([Fortran])dnl
1454 ])# AC_FC_FIXEDFORM
1457 # AC_FC_LINE_LENGTH([LENGTH], [ACTION-IF-SUCCESS],
1458 #                   [ACTION-IF-FAILURE = FAILURE])
1459 # ------------------------------------------------
1460 # Look for a compiler flag to make the Fortran (FC) compiler accept long lines
1461 # in the current (free- or fixed-format) source code, and adds it to FCFLAGS.
1462 # The optional LENGTH may be 80, 132 (default), or 'unlimited' for longer
1463 # lines.  Note that line lengths above 250 columns are not portable, and some
1464 # compilers (hello ifort) do not accept more than 132 columns at least for
1465 # fixed format.  Call ACTION-IF-SUCCESS (defaults to nothing) if successful
1466 # (i.e. can compile code using new extension) and ACTION-IF-FAILURE (defaults
1467 # to failing with an error message) if not.  (Defined via DEFUN_ONCE to
1468 # prevent flag from being added to FCFLAGS multiple times.)
1469 # You should call AC_FC_FREEFORM or AC_FC_FIXEDFORM to set the desired format
1470 # prior to using this macro.
1472 # The known flags are:
1473 # -f{free,fixed}-line-length-N with N 72, 80, 132, or 0 or none for none.
1474 # -ffree-line-length-none: GNU gfortran
1475 # -ffree-line-length-huge: g95 (also -ffixed-line-length-N as above)
1476 #       -qfixed=132 80 72: IBM compiler (xlf)
1477 #                -Mextend: Cray
1478 #            -132 -80 -72: Intel compiler (ifort)
1479 #                          Needs to come before -extend_source because ifort
1480 #                          accepts that as well with an optional parameter and
1481 #                          doesn't fail but only warns about unknown arguments.
1482 #          -extend_source: SGI compiler
1483 #  -W, -WNN (132, 80, 72): Absoft Fortran
1484 #     +es, +extend_source: HP Fortran (254 in either form, default is 72 fixed,
1485 #                          132 free)
1486 #            -w, (-)-wide: Lahey/Fujitsu Fortran (255 cols in fixed form)
1487 #                      -e: Sun Fortran compiler (132 characters)
1488 #                    -132: NAGWare
1489 #         -72, -f, -Wf,-f: f2c (a weak form of "free-form" and long lines).
1490 #                  /XLine: Open Watcom
1491 AC_DEFUN_ONCE([AC_FC_LINE_LENGTH],
1492 [AC_LANG_PUSH([Fortran])dnl
1493 m4_case(m4_default([$1], [132]),
1494   [unlimited], [ac_fc_line_len_string=unlimited
1495                        ac_fc_line_len=0
1496                        ac_fc_line_length_test='
1497       subroutine longer_than_132(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,'\
1498 'arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19)'],
1499   [132],            [ac_fc_line_len=132
1500                        ac_fc_line_length_test='
1501       subroutine longer_than_80(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,'\
1502 'arg10)'],
1503   [80],             [ac_fc_line_len=80
1504                        ac_fc_line_length_test='
1505       subroutine longer_than_72(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)'],
1506   [m4_warning([Invalid length argument '$1'])])
1507 : ${ac_fc_line_len_string=$ac_fc_line_len}
1508 AC_CACHE_CHECK(
1509 [for Fortran flag needed to accept $ac_fc_line_len_string column source lines],
1510                [ac_cv_fc_line_length],
1511 [ac_cv_fc_line_length=unknown
1512 ac_fc_line_length_FCFLAGS_save=$FCFLAGS
1513 for ac_flag in none \
1514                -ffree-line-length-none -ffixed-line-length-none \
1515                -ffree-line-length-huge \
1516                -ffree-line-length-$ac_fc_line_len \
1517                -ffixed-line-length-$ac_fc_line_len \
1518                -qfixed=$ac_fc_line_len -Mextend \
1519                -$ac_fc_line_len -extend_source \
1520                -W$ac_fc_line_len -W +extend_source +es -wide --wide -w -e \
1521                -f -Wf,-f -xline
1523   test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_line_length_FCFLAGS_save $ac_flag"
1524   AC_COMPILE_IFELSE([[$ac_fc_line_length_test
1525       end subroutine]],
1526                     [ac_cv_fc_line_length=$ac_flag; break])
1527 done
1528 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
1529 FCFLAGS=$ac_fc_line_length_FCFLAGS_save
1531 if test "x$ac_cv_fc_line_length" = xunknown; then
1532   m4_default([$3],
1533              [AC_MSG_ERROR([Fortran does not accept long source lines], 77)])
1534 else
1535   if test "x$ac_cv_fc_line_length" != xnone; then
1536     FCFLAGS="$FCFLAGS $ac_cv_fc_line_length"
1537   fi
1538   $2
1540 AC_LANG_POP([Fortran])dnl
1541 ])# AC_FC_LINE_LENGTH
1544 # AC_FC_CHECK_BOUNDS([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
1545 # ----------------------------------------------------------------------
1546 # Look for a compiler flag to turn on array bounds checking for the
1547 # Fortran (FC) compiler, and adds it to FCFLAGS.  Call
1548 # ACTION-IF-SUCCESS (defaults to nothing) if successful (i.e. can
1549 # compile code using new extension) and ACTION-IF-FAILURE (defaults to
1550 # failing with an error message) if not.  (Defined via DEFUN_ONCE to
1551 # prevent flag from being added to FCFLAGS multiple times.)
1553 # The known flags are:
1554 # -fcheck=all, -fbounds-check: gfortran
1555 #     -fbounds-check: g77, g95
1556 # -CB, -check bounds: Intel compiler (icc, ecc, ifort)
1557 #                 -C: Sun/Oracle compiler (f95)
1558 #        -C, -qcheck: IBM compiler (xlf)
1559 #           -Mbounds: Portland Group compiler
1560 #       -C ,-Mbounds: Cray
1561 #  -C, -check_bounds: SGI compiler
1562 # -check_bounds, +check=all: HP Fortran
1563 #        -C, -Rb -Rc: Absoft (-Rb: array boundaries, -Rc: array conformance)
1564 # --chk e,s -chk (e,s): Lahey
1565 #          -C -C=all: NAGWare
1566 # -C, -ffortran-bounds-check: PathScale pathf90
1567 #                 -C: f2c
1568 #            -BOunds: Open Watcom
1569 AC_DEFUN_ONCE([AC_FC_CHECK_BOUNDS],
1570 [AC_LANG_PUSH([Fortran])dnl
1571 AC_CACHE_CHECK([for Fortran flag to enable array-bounds checking],
1572                [ac_cv_fc_check_bounds],
1573 [ac_cv_fc_check_bounds=unknown
1574 ac_fc_check_bounds_FCFLAGS_save=$FCFLAGS
1575 for ac_flag in -fcheck=bounds -fbounds-check -check_bounds -Mbounds -qcheck \
1576                '-check bounds' +check=all --check '-Rb -Rc' -CB -C=all -C \
1577                -ffortran-bounds-check "--chk e,s" "-chk e -chk s" -bounds
1579   FCFLAGS="$ac_fc_check_bounds_FCFLAGS_save $ac_flag"
1580   # We should be able to link a correct program.
1581   AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
1582     [AC_LINK_IFELSE([[
1583       subroutine sub(a)
1584       integer a(:)
1585       a(8) = 0
1586       end subroutine
1588       program main
1589       integer a(1:7)
1590       interface
1591          subroutine sub(a)
1592          integer a(:)
1593          end subroutine
1594       end interface
1596       call sub(a)
1597       end program]],
1598        [# If we can run the program, require failure at run time.
1599         # In cross-compiling mode, we rely on the compiler not accepting
1600         # unknown options.
1601         AS_IF([test "$cross_compiling" = yes],
1602           [ac_cv_fc_check_bounds=$ac_flag; break],
1603           [AS_IF([_AC_DO_TOKENS(./conftest$ac_exeext)],
1604              [],
1605              [ac_cv_fc_check_bounds=$ac_flag; break])])])])
1606 done
1607 rm -f conftest$ac_exeext conftest.err conftest.$ac_objext conftest.$ac_ext \
1608   core *.core core.conftest.*
1609 FCFLAGS=$ac_fc_check_bounds_FCFLAGS_save
1611 if test "x$ac_cv_fc_check_bounds" = xunknown; then
1612   m4_default([$2],
1613              [AC_MSG_ERROR([no Fortran flag for bounds checking found], 77)])
1614 else
1615   if test "x$ac_cv_fc_check_bounds" != xnone; then
1616     FCFLAGS="$FCFLAGS $ac_cv_fc_check_bounds"
1617   fi
1618   $1
1620 AC_LANG_POP([Fortran])dnl
1621 ])# AC_FC_CHECK_BOUNDS
1624 # _AC_FC_IMPLICIT_NONE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
1625 # ------------------------------------------------------------------------
1626 # Look for a flag to disallow implicit declarations, and add it to FCFLAGS.
1627 # Call ACTION-IF-SUCCESS (defaults to nothing) if successful and
1628 # ACTION-IF-FAILURE (defaults to failing with an error message) if not.
1630 # Known flags:
1631 # GNU gfortran, g95: -fimplicit-none, g77: -Wimplicit
1632 # Intel: -u, -implicitnone; might also need '-warn errors' to turn into error.
1633 # Sun/Oracle: -u
1634 # HP: +implicit_none
1635 # IBM: -u, -qundef
1636 # SGI: -u
1637 # Compaq: -u, -warn declarations
1638 # NAGWare: -u
1639 # Lahey: -in, --in, -AT
1640 # Cray: -Mdclchk -e I
1641 # PGI: -Mcdlchk
1642 # f2c: -u
1643 AC_DEFUN([_AC_FC_IMPLICIT_NONE],
1644 [_AC_FORTRAN_ASSERT()dnl
1645 AC_CACHE_CHECK([for flag to disallow _AC_LANG implicit declarations],
1646                [ac_cv_[]_AC_LANG_ABBREV[]_implicit_none],
1647 [ac_cv_[]_AC_LANG_ABBREV[]_implicit_none=unknown
1648 ac_fc_implicit_none_[]_AC_LANG_PREFIX[]FLAGS_save=$[]_AC_LANG_PREFIX[]FLAGS
1649 for ac_flag in none -fimplicit-none -u -Wimplicit -implicitnone +implicit_none \
1650                -qundef "-warn declarations" -in --in -AT "-e I" -Mdclchk \
1651                "-u -warn errors"
1653   if test "x$ac_flag" != xnone; then
1654     _AC_LANG_PREFIX[]FLAGS="$ac_fc_implicit_none_[]_AC_LANG_PREFIX[]FLAGS_save $ac_flag"
1655   fi
1656   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
1657     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
1658       i = 0
1659       print *, i]])],
1660        [],
1661        [ac_cv_[]_AC_LANG_ABBREV[]_implicit_none=$ac_flag; break])])
1662 done
1663 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
1664 _AC_LANG_PREFIX[]FLAGS=$ac_fc_implicit_none_[]_AC_LANG_PREFIX[]FLAGS_save
1666 if test "x$ac_cv_[]_AC_LANG_ABBREV[]_implicit_none" = xunknown; then
1667   m4_default([$3],
1668     [AC_MSG_ERROR([no Fortran flag to disallow implicit declarations found], 77)])
1669 else
1670   if test "x$ac_cv_[]_AC_LANG_ABBREV[]_implicit_none" != xnone; then
1671     _AC_LANG_PREFIX[]FLAGS="$_AC_LANG_PREFIX[]FLAGS $ac_cv_[]_AC_LANG_ABBREV[]_implicit_none"
1672   fi
1673   $2
1675 ])# _AC_FC_IMPLICIT_NONE
1678 # AC_F77_IMPLICIT_NONE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
1679 # ------------------------------------------------------------------------
1680 AC_DEFUN([AC_F77_IMPLICIT_NONE],
1681 [AC_LANG_PUSH([Fortran 77])dnl
1682 _AC_FC_IMPLICIT_NONE($@)
1683 AC_LANG_POP([Fortran 77])dnl
1684 ])# AC_F77_IMPLICIT_NONE
1687 # AC_FC_IMPLICIT_NONE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
1688 # -----------------------------------------------------------------------
1689 AC_DEFUN([AC_FC_IMPLICIT_NONE],
1690 [AC_LANG_PUSH([Fortran])dnl
1691 _AC_FC_IMPLICIT_NONE($@)
1692 AC_LANG_POP([Fortran])dnl
1693 ])# AC_FC_IMPLICIT_NONE
1696 # AC_FC_MODULE_EXTENSION
1697 # ----------------------
1698 # Find the Fortran 90 module file extension.  The module extension is stored
1699 # in the variable FC_MODEXT and empty if it cannot be determined.  The result
1700 # or "unknown" is cached in the cache variable ac_cv_fc_module_ext.
1701 AC_DEFUN([AC_FC_MODULE_EXTENSION],
1702 [AC_CACHE_CHECK([Fortran 90 module extension], [ac_cv_fc_module_ext],
1703 [AC_LANG_PUSH(Fortran)
1704 mkdir conftest.dir
1705 cd conftest.dir
1706 ac_cv_fc_module_ext=unknown
1707 AC_COMPILE_IFELSE([[
1708       module conftest_module
1709       contains
1710       subroutine conftest_routine
1711       write(*,'(a)') 'gotcha!'
1712       end subroutine
1713       end module]],
1714   [ac_cv_fc_module_ext=`ls | sed -n 's,conftest_module\.,,p'`
1715    if test x$ac_cv_fc_module_ext = x; then
1716 dnl Some F90 compilers use upper case characters for the module file name.
1717      ac_cv_fc_module_ext=`ls | sed -n 's,CONFTEST_MODULE\.,,p'`
1718    fi])
1719 cd ..
1720 rm -rf conftest.dir
1721 AC_LANG_POP(Fortran)
1723 FC_MODEXT=$ac_cv_fc_module_ext
1724 if test "$FC_MODEXT" = unknown; then
1725   FC_MODEXT=
1727 AC_SUBST([FC_MODEXT])dnl
1731 # AC_FC_MODULE_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
1732 # ---------------------------------------------------------------------
1733 # Find a flag to include Fortran 90 modules from another directory.
1734 # If successful, run ACTION-IF-SUCCESS (defaults to nothing), otherwise
1735 # run ACTION-IF-FAILURE (defaults to failing with an error message).
1736 # The module flag is cached in the ac_cv_fc_module_flag variable.
1737 # It may contain significant trailing whitespace.
1739 # Known flags:
1740 # gfortran: -Idir, -I dir (-M dir, -Mdir (deprecated), -Jdir for writing)
1741 # g95: -I dir (-fmod=dir for writing)
1742 # SUN: -Mdir, -M dir (-moddir=dir for writing;
1743 #                     -Idir for includes is also searched)
1744 # HP: -Idir, -I dir (+moddir=dir for writing)
1745 # IBM: -Idir (-qmoddir=dir for writing)
1746 # Intel: -Idir -I dir (-mod dir for writing)
1747 # Absoft: -pdir
1748 # Lahey: -mod dir
1749 # Cray: -module dir, -p dir (-J dir for writing)
1750 #       -e m is needed to enable writing .mod files at all
1751 # Compaq: -Idir
1752 # NAGWare: -I dir
1753 # PathScale: -I dir  (but -module dir is looked at first)
1754 # Portland: -module dir (first -module also names dir for writing)
1755 # Fujitsu: -Am -Idir (-Mdir for writing is searched first, then '.', then -I)
1756 #                    (-Am indicates how module information is saved)
1757 AC_DEFUN([AC_FC_MODULE_FLAG],[
1758 AC_CACHE_CHECK([Fortran 90 module inclusion flag], [ac_cv_fc_module_flag],
1759 [AC_LANG_PUSH([Fortran])
1760 ac_cv_fc_module_flag=unknown
1761 mkdir conftest.dir
1762 cd conftest.dir
1763 AC_COMPILE_IFELSE([[
1764       module conftest_module
1765       contains
1766       subroutine conftest_routine
1767       write(*,'(a)') 'gotcha!'
1768       end subroutine
1769       end module]],
1770   [cd ..
1771    ac_fc_module_flag_FCFLAGS_save=$FCFLAGS
1772    # Flag ordering is significant for gfortran and Sun.
1773    for ac_flag in -M -I '-I ' '-M ' -p '-mod ' '-module ' '-Am -I'; do
1774      # Add the flag twice to prevent matching an output flag.
1775      FCFLAGS="$ac_fc_module_flag_FCFLAGS_save ${ac_flag}conftest.dir ${ac_flag}conftest.dir"
1776      AC_COMPILE_IFELSE([[
1777       program main
1778       use conftest_module
1779       call conftest_routine
1780       end program]],
1781        [ac_cv_fc_module_flag="$ac_flag"])
1782      if test "$ac_cv_fc_module_flag" != unknown; then
1783        break
1784      fi
1785    done
1786    FCFLAGS=$ac_fc_module_flag_FCFLAGS_save
1788 rm -rf conftest.dir
1789 AC_LANG_POP([Fortran])
1791 if test "$ac_cv_fc_module_flag" != unknown; then
1792   FC_MODINC=$ac_cv_fc_module_flag
1793   $1
1794 else
1795   FC_MODINC=
1796   m4_default([$2],
1797     [AC_MSG_ERROR([unable to find compiler flag for module search path])])
1799 AC_SUBST([FC_MODINC])
1800 # Ensure trailing whitespace is preserved in a Makefile.
1801 AC_SUBST([ac_empty], [""])
1802 AC_CONFIG_COMMANDS_PRE([case $FC_MODINC in #(
1803   *\ ) FC_MODINC=$FC_MODINC'${ac_empty}' ;;
1804 esac])dnl
1808 # AC_FC_MODULE_OUTPUT_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
1809 # ----------------------------------------------------------------------------
1810 # Find a flag to write Fortran 90 module information to another directory.
1811 # If successful, run ACTION-IF-SUCCESS (defaults to nothing), otherwise
1812 # run ACTION-IF-FAILURE (defaults to failing with an error message).
1813 # The module flag is cached in the ac_cv_fc_module_output_flag variable.
1814 # It may contain significant trailing whitespace.
1816 # For known flags, see the documentation of AC_FC_MODULE_FLAG above.
1817 AC_DEFUN([AC_FC_MODULE_OUTPUT_FLAG],[
1818 AC_CACHE_CHECK([Fortran 90 module output flag], [ac_cv_fc_module_output_flag],
1819 [AC_LANG_PUSH([Fortran])
1820 mkdir conftest.dir conftest.dir/sub
1821 cd conftest.dir
1822 ac_cv_fc_module_output_flag=unknown
1823 ac_fc_module_output_flag_FCFLAGS_save=$FCFLAGS
1824 # Flag ordering is significant: put flags late which some compilers use
1825 # for the search path.
1826 for ac_flag in -J '-J ' -fmod= -moddir= +moddir= -qmoddir= '-mdir ' '-mod ' \
1827               '-module ' -M '-Am -M' '-e m -J '; do
1828   FCFLAGS="$ac_fc_module_output_flag_FCFLAGS_save ${ac_flag}sub"
1829   AC_COMPILE_IFELSE([[
1830       module conftest_module
1831       contains
1832       subroutine conftest_routine
1833       write(*,'(a)') 'gotcha!'
1834       end subroutine
1835       end module]],
1836     [cd sub
1837      AC_COMPILE_IFELSE([[
1838       program main
1839       use conftest_module
1840       call conftest_routine
1841       end program]],
1842        [ac_cv_fc_module_output_flag=$ac_flag])
1843      cd ..
1844      AS_IF([test x"$ac_cv_fc_module_output_flag" != xunknown],[break])])
1845 done
1846 FCFLAGS=$ac_fc_module_output_flag_FCFLAGS_save
1847 cd ..
1848 rm -rf conftest.dir
1849 AC_LANG_POP([Fortran])
1851 AS_IF([test x"$ac_cv_fc_module_output_flag" != xunknown],
1852   [FC_MODOUT=$ac_cv_fc_module_output_flag
1853    $1],
1854   [FC_MODOUT=
1855    m4_default([$2],
1856     [AC_MSG_ERROR([unable to find compiler flag to write module information to])])])
1857 AC_SUBST([FC_MODOUT])
1858 # Ensure trailing whitespace is preserved in a Makefile.
1859 AC_SUBST([ac_empty], [""])
1860 AC_CONFIG_COMMANDS_PRE([case $FC_MODOUT in #(
1861   *\ ) FC_MODOUT=$FC_MODOUT'${ac_empty}' ;;
1862 esac])dnl
1866 # _AC_FC_CRAY_POINTERS([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE])
1867 #-------------------------------------------------------------------------
1868 # Try to ensure that the Fortran compiler supports Cray pointers, a
1869 # non-standard extension that provides a C-like pointer in Fortran.
1871 # If successful, ACTION-IF-SUCCESS is called.  If no argument is provided, then
1872 # any necessary flags are added to F[C]FLAGS.  Otherwise, ACTION-IF-FAILURE is
1873 # called, which defaults to failing with an error message.
1875 # Most compilers provide an implementation of Cray pointers, and often no
1876 # additional flags are required to enable support.  A partial list of compilers
1877 # and flags which may be required are listed below.
1879 # The known flags are:
1880 #   -fcray-pointer: gfortran
1881 #   -Mcray-pointer: PGI
1882 AC_DEFUN([_AC_FC_CRAY_POINTERS], [
1883   AC_MSG_CHECKING([for $[]_AC_FC[] option to support Cray pointers])
1884   AC_CACHE_VAL([ac_cv_[]_AC_LANG_ABBREV[]_cray_ptr], [
1885     ac_cv_[]_AC_LANG_ABBREV[]_cray_ptr='unknown'
1886     ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
1887     for ac_option in none -fcray-pointer -Mcray=pointer; do
1888       test "$ac_option" != none && _AC_LANG_PREFIX[]FLAGS="$ac_save_[]_AC_LANG_PREFIX[]FLAGS $ac_option"
1889       AC_COMPILE_IFELSE(
1890         [AC_LANG_PROGRAM([], [
1891       integer aptr(2)
1892       pointer (iptr, aptr)
1893         ])],
1894         [ac_cv_[]_AC_LANG_ABBREV[]_cray_ptr=$ac_option],
1895       )
1896       _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
1897       AS_IF([test "$ac_cv_[]_AC_LANG_ABBREV[]_cray_ptr" != unknown], [break])
1898     done
1899   ])
1900   AS_CASE([ac_cv_[]_AC_LANG_ABBREV[]_cray_ptr],
1901     [none], [AC_MSG_RESULT([none_needed])],
1902     [unknown], [AC_MSG_RESULT([unsupported])],
1903     [AC_MSG_RESULT([$ac_cv_[]_AC_LANG_ABBREV[]_cray_ptr])]
1904   )
1905   AS_IF([test "$ac_cv_[]_AC_LANG_ABBREV[]_cray_ptr" != unknown], [
1906     m4_default([$1], [
1907       AS_IF([test "$ac_cv_[]_AC_LANG_ABBREV[]_cray_ptr" != none],
1908         [_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_cv_[]_AC_LANG_ABBREV[]_cray_ptr"]
1909       )
1910     ])],
1911     [m4_default([$2], [AC_MSG_ERROR(["$[]_AC_FC[] does not support Cray pointers"])])]
1912   )
1916 # AC_F77_CRAY_POINTERS
1917 #---------------------
1918 AC_DEFUN([AC_F77_CRAY_POINTERS], [
1919   AC_REQUIRE([AC_PROG_F77])
1920   AC_LANG_PUSH([Fortran 77])
1921   _AC_FC_CRAY_POINTERS($@)
1922   AC_LANG_POP([Fortran 77])
1926 # AC_FC_CRAY_POINTERS
1927 #--------------------
1928 AC_DEFUN([AC_FC_CRAY_POINTERS], [
1929   AC_REQUIRE([AC_PROG_FC])
1930   AC_LANG_PUSH([Fortran])
1931   _AC_FC_CRAY_POINTERS($@)
1932   AC_LANG_POP([Fortran])