Fix typo in previous patch.
[autoconf.git] / tests / fortran.at
blob73692d4e2a39e0d3f9800de765caaca69d359894
1 #                                                       -*- Autotest -*-
3 AT_BANNER([Fortran low level compiling/preprocessing macros.])
5 # Copyright (C) 2000, 2001, 2003, 2008, 2009, 2010 Free Software
6 # Foundation, Inc.
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 # Since the macros which compile are required by most tests, check
22 # them first.  But remember that looking for a compiler is even more
23 # primitive, so check those first.
26 ## --------------------- ##
27 ## Fortran 77 Compiler.  ##
28 ## --------------------- ##
31 AT_CHECK_MACRO([GNU Fortran 77],
32 [[AC_LANG(Fortran 77)
33 AC_LANG_COMPILER
35 if AC_TRY_COMMAND([$F77 --version | grep GNU >&2]); then
36   # Be sure to remove files which might be created by compilers that
37   # don't support --version.
38   rm -f a.exe a.out
39   # Has GNU in --version.
40   test "$G77" != yes &&
41     AC_MSG_ERROR([failed to recognize GNU Fortran 77 compiler])
42 else
43   # Be sure to remove files which might be created by compilers that
44   # don't support --version.
45   rm -f a.exe a.out
46   # Has not.
47   test "$G77" = yes &&
48     AC_MSG_ERROR([incorrectly recognized a GNU Fortran 77 compiler])
50 ]])
54 ## ------------------ ##
55 ## Fortran Compiler.  ##
56 ## ------------------ ##
59 AT_CHECK_MACRO([GNU Fortran],
60 [[AC_LANG(Fortran)
61 AC_LANG_COMPILER
63 # No Fortran compiler is known not to support "*.f".
64 AC_FC_SRCEXT([f])
66 # GNU Fortran is known to support freeform.
67 AC_FC_FREEFORM([],
68                [AC_MSG_WARN([Fortran does not accept free-form source])])
69 if test "$ac_compiler_gnu" = yes; then
70   case $FCFLAGS in
71    *-ffree-form*) ;;
72    *) AC_MSG_ERROR([failed to recognize GNU Fortran's -ffree-form option]);;
73   esac
75 ]])
78 ## ------------------------- ##
79 ## AC_OPENMP and Fortran 77. ##
80 ## ------------------------- ##
82 AT_SETUP([AC_OPENMP and Fortran 77])
84 AT_DATA([configure.ac],
85 [[AC_INIT
86 AC_PROG_F77
87 AC_LANG([Fortran 77])
88 AC_OPENMP
89 if test "X$ac_cv_prog_f77_openmp" = Xunsupported; then
90   AS_EXIT([77])
92 FFLAGS="$FFLAGS $OPENMP_FFLAGS"
93 AC_CONFIG_FILES([Makefile])
94 AC_OUTPUT
95 ]])
97 AT_DATA([Makefile.in],
98 [[foo@EXEEXT@: foo.@OBJEXT@
99         @F77@ @FFLAGS@ @LDFLAGS@ -o $@ foo.@OBJEXT@
101 foo.@OBJEXT@: foo.f
102         @F77@ @FFLAGS@ -c foo.f
105 AT_DATA([foo.f],
106 [[       program main
107       end
110 : ${MAKE=make}
111 AT_CHECK([env ACLOCAL=true autoreconf -vi], [], [ignore], [ignore])
112 AT_CHECK([./configure $configure_options], [], [ignore], [ignore])
113 AT_CHECK([$MAKE], [], [ignore], [ignore])
115 AT_CLEANUP
118 ## ---------------------- ##
119 ## AC_OPENMP and Fortran. ##
120 ## ---------------------- ##
122 AT_SETUP([AC_OPENMP and Fortran])
124 AT_DATA([configure.ac],
125 [[AC_INIT
126 AC_PROG_FC
127 AC_LANG([Fortran])
128 AC_OPENMP
129 if test "X$ac_cv_prog_fc_openmp" = Xunsupported; then
130   AS_EXIT([77])
132 FCFLAGS="$FCFLAGS $OPENMP_FCFLAGS"
133 AC_CONFIG_FILES([Makefile])
134 AC_OUTPUT
137 AT_DATA([Makefile.in],
138 [[foo@EXEEXT@: foo.@OBJEXT@
139         @FC@ @FCFLAGS@ @LDFLAGS@ -o $@ foo.@OBJEXT@
141 foo.@OBJEXT@: foo.f
142         @FC@ @FCFLAGS@ -c foo.f
145 AT_DATA([foo.f],
146 [[      program main
147       end
150 : ${MAKE=make}
151 AT_CHECK([env ACLOCAL=true autoreconf -vi], [], [ignore], [ignore])
152 AT_CHECK([./configure $configure_options], [], [ignore], [ignore])
153 AT_CHECK([$MAKE], [], [ignore], [ignore])
155 AT_CLEANUP