1 | # This file is part of Autoconf. -*- Autoconf -*- |
---|
2 | # Fortran languages support. |
---|
3 | # Copyright (C) 2001, 2003-2011 Free Software Foundation, Inc. |
---|
4 | |
---|
5 | # This file is part of Autoconf. This program is free |
---|
6 | # software; you can redistribute it and/or modify it under the |
---|
7 | # terms of the GNU General Public License as published by the |
---|
8 | # Free Software Foundation, either version 3 of the License, or |
---|
9 | # (at your option) any later version. |
---|
10 | # |
---|
11 | # This program is distributed in the hope that it will be useful, |
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | # GNU General Public License for more details. |
---|
15 | # |
---|
16 | # Under Section 7 of GPL version 3, you are granted additional |
---|
17 | # permissions described in the Autoconf Configure Script Exception, |
---|
18 | # version 3.0, as published by the Free Software Foundation. |
---|
19 | # |
---|
20 | # You should have received a copy of the GNU General Public License |
---|
21 | # and a copy of the Autoconf Configure Script Exception along with |
---|
22 | # this program; see the files COPYINGv3 and COPYING.EXCEPTION |
---|
23 | # respectively. If not, see <http://www.gnu.org/licenses/>. |
---|
24 | |
---|
25 | # Written by David MacKenzie, with help from |
---|
26 | # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, |
---|
27 | # Roland McGrath, Noah Friedman, david d zuhn, and many others. |
---|
28 | |
---|
29 | |
---|
30 | # Table of Contents: |
---|
31 | # |
---|
32 | # Preamble |
---|
33 | # |
---|
34 | # 0. Utility macros |
---|
35 | # |
---|
36 | # 1. Language selection |
---|
37 | # and routines to produce programs in a given language. |
---|
38 | # |
---|
39 | # 2. Producing programs in a given language. |
---|
40 | # |
---|
41 | # 3. Looking for a compiler |
---|
42 | # And possibly the associated preprocessor. |
---|
43 | # |
---|
44 | # 4. Compilers' characteristics. |
---|
45 | |
---|
46 | # AC_FC_PP_SRCEXT(EXT, [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE]) |
---|
47 | # -------------------------------------------------------------- |
---|
48 | # Like AC_FC_SRCEXT, set the source-code extension used in Fortran (FC) tests |
---|
49 | # to EXT (which defaults to f). Also, look for any necessary additional |
---|
50 | # FCFLAGS needed to allow this extension for preprocessed Fortran, and store |
---|
51 | # them in the output variable FCFLAGS_<EXT> (e.g. FCFLAGS_f90 for EXT=f90). |
---|
52 | # If successful, call ACTION-IF-SUCCESS. If unable to compile preprocessed |
---|
53 | # source code with EXT, call ACTION-IF-FAILURE, which defaults to failing with |
---|
54 | # an error message. |
---|
55 | # |
---|
56 | # Some compilers allow preprocessing with either a Fortran preprocessor or |
---|
57 | # with the C preprocessor (cpp). Prefer the Fortran preprocessor, to deal |
---|
58 | # correctly with continuation lines, `//' (not a comment), and preserve white |
---|
59 | # space (for fixed form). |
---|
60 | # |
---|
61 | # (The flags for the current source-code extension, if any, are stored in |
---|
62 | # $ac_fcflags_srcext and used automatically in subsequent autoconf tests.) |
---|
63 | # |
---|
64 | # For ordinary extensions like f90, etcetera, the modified FCFLAGS |
---|
65 | # are needed for IBM's xlf*. Also, for Intel's ifort compiler, the |
---|
66 | # $FCFLAGS_<EXT> variable *must* go immediately before the source file on the |
---|
67 | # command line, unlike other $FCFLAGS. Ugh. |
---|
68 | # |
---|
69 | # Known extensions that enable preprocessing by default, and flags to force it: |
---|
70 | # GNU: .F .F90 .F95 .F03 .F08, -cpp for most others, |
---|
71 | # -x f77-cpp-input for .f77 .F77; -x f95-cpp-input for gfortran < 4.4 |
---|
72 | # SGI: .F .F90, -ftpp or -cpp for .f .f90, -E write preproc to stdout |
---|
73 | # -macro_expand enable macro expansion everywhere (with -ftpp) |
---|
74 | # -P preproc only, save in .i, no #line's |
---|
75 | # SUN: .F .F95, -fpp for others; -xpp={fpp,cpp} for preprocessor selection |
---|
76 | # -F preprocess only (save in lowercase extension) |
---|
77 | # IBM: .F .F77 .F90 .F95 .F03, -qsuffix=cpp=EXT for extension .EXT to invoke cpp |
---|
78 | # -WF,-qnofpp -WF,-qfpp=comment:linecont:nocomment:nolinecont |
---|
79 | # -WF,-qlanglvl=classic or not -qnoescape (trigraph problems) |
---|
80 | # -d no #line in output, -qnoobject for preprocessing only (output in .f) |
---|
81 | # -q{no,}ppsuborigarg substitute original macro args before expansion |
---|
82 | # HP: .F, +cpp={yes|no|default} use cpp, -cpp, +cpp_keep save in .i/.i90 |
---|
83 | # PGI: -Mpreprocess |
---|
84 | # Absoft: .F .FOR .F90 .F95, -cpp for others |
---|
85 | # Cray: .F .F90 .FTN, -e Z for others; -F enable macro expansion everywhere |
---|
86 | # Intel: .F .F90, -fpp for others, but except for .f and .f90, -Tf may also be |
---|
87 | # needed right before the source file name |
---|
88 | # PathScale: .F .F90 .F95, -ftpp or -cpp for .f .f90 .f95 |
---|
89 | # -macro_expand for expansion everywhere, -P for no #line in output |
---|
90 | # Lahey: .F .FOR .F90 .F95, -Cpp |
---|
91 | # NAGWare: .F .F90 .F95, .ff .ff90 .ff95 (new), -fpp for others |
---|
92 | # Compaq/Tru64: .F .F90, -cpp, -P keep .i file, -P keep .i file |
---|
93 | # f2c: .F, -cpp |
---|
94 | # g95: .F .FOR .F90 .F95 .F03, -cpp -no-cpp, -E for stdout |
---|
95 | AC_DEFUN([AC_FC_PP_SRCEXT], |
---|
96 | [AC_LANG_PUSH(Fortran)dnl |
---|
97 | AC_CACHE_CHECK([for Fortran flag to compile preprocessed .$1 files], |
---|
98 | ac_cv_fc_pp_srcext_$1, |
---|
99 | [ac_ext=$1 |
---|
100 | ac_fcflags_pp_srcext_save=$ac_fcflags_srcext |
---|
101 | ac_fcflags_srcext= |
---|
102 | ac_cv_fc_pp_srcext_$1=unknown |
---|
103 | case $ac_ext in #( |
---|
104 | [[fF]]77) ac_try=f77-cpp-input;; #( |
---|
105 | *) ac_try=f95-cpp-input;; |
---|
106 | esac |
---|
107 | for ac_flag in none -ftpp -fpp -Tf "-fpp -Tf" -xpp=fpp -Mpreprocess "-e Z" \ |
---|
108 | -cpp -xpp=cpp -qsuffix=cpp=$1 "-x $ac_try" +cpp -Cpp; do |
---|
109 | test "x$ac_flag" != xnone && ac_fcflags_srcext="$ac_flag" |
---|
110 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ |
---|
111 | #if 0 |
---|
112 | #include <ac_nonexistent.h> |
---|
113 | choke me |
---|
114 | #endif]])], |
---|
115 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ |
---|
116 | #if 1 |
---|
117 | #include <ac_nonexistent.h> |
---|
118 | choke me |
---|
119 | #endif]])], |
---|
120 | [], |
---|
121 | [ac_cv_fc_pp_srcext_$1=$ac_flag; break])]) |
---|
122 | done |
---|
123 | rm -f conftest.$ac_objext conftest.$1 |
---|
124 | ac_fcflags_srcext=$ac_fcflags_pp_srcext_save |
---|
125 | ]) |
---|
126 | if test "x$ac_cv_fc_pp_srcext_$1" = xunknown; then |
---|
127 | m4_default([$3], |
---|
128 | [AC_MSG_ERROR([Fortran could not compile preprocessed .$1 files])]) |
---|
129 | else |
---|
130 | ac_fc_srcext=$1 |
---|
131 | if test "x$ac_cv_fc_pp_srcext_$1" = xnone; then |
---|
132 | ac_fcflags_srcext="" |
---|
133 | FCFLAGS_[]$1[]="" |
---|
134 | else |
---|
135 | ac_fcflags_srcext=$ac_cv_fc_pp_srcext_$1 |
---|
136 | FCFLAGS_[]$1[]=$ac_cv_fc_pp_srcext_$1 |
---|
137 | fi |
---|
138 | AC_SUBST(FCFLAGS_[]$1) |
---|
139 | $2 |
---|
140 | fi |
---|
141 | AC_LANG_POP(Fortran)dnl |
---|
142 | ])# AC_FC_PP_SRCEXT |
---|
143 | |
---|
144 | # AC_FC_PP_DEFINE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) |
---|
145 | # ------------------------------------------------------------------- |
---|
146 | # Find a flag to specify defines for preprocessed Fortran. Not all |
---|
147 | # Fortran compilers use -D. Substitute FC_DEFINE with the result and |
---|
148 | # call ACTION-IF-SUCCESS (defaults to nothing) if successful, and |
---|
149 | # ACTION-IF-FAILURE (defaults to failing with an error message) if not. |
---|
150 | # |
---|
151 | # Known flags: |
---|
152 | # IBM: -WF,-D |
---|
153 | # Lahey/Fujitsu: -Wp,-D older versions??? |
---|
154 | # f2c: -D or -Wc,-D |
---|
155 | # others: -D |
---|
156 | AC_DEFUN([AC_FC_PP_DEFINE], |
---|
157 | [AC_LANG_PUSH([Fortran])dnl |
---|
158 | ac_fc_pp_define_srcext_save=$ac_fc_srcext |
---|
159 | AC_FC_PP_SRCEXT([F]) |
---|
160 | AC_CACHE_CHECK([how to define symbols for preprocessed Fortran], |
---|
161 | [ac_cv_fc_pp_define], |
---|
162 | [ac_fc_pp_define_srcext_save=$ac_fc_srcext |
---|
163 | ac_cv_fc_pp_define=unknown |
---|
164 | ac_fc_pp_define_FCFLAGS_save=$FCFLAGS |
---|
165 | for ac_flag in -D -WF,-D -Wp,-D -Wc,-D |
---|
166 | do |
---|
167 | FCFLAGS="$ac_fc_pp_define_FCFLAGS_save ${ac_flag}FOOBAR ${ac_flag}ZORK=42" |
---|
168 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ |
---|
169 | #ifndef FOOBAR |
---|
170 | choke me |
---|
171 | #endif |
---|
172 | #if ZORK != 42 |
---|
173 | choke me |
---|
174 | #endif]])], |
---|
175 | [ac_cv_fc_pp_define=$ac_flag]) |
---|
176 | test x"$ac_cv_fc_pp_define" != xunknown && break |
---|
177 | done |
---|
178 | FCFLAGS=$ac_fc_pp_define_FCFLAGS_save |
---|
179 | ]) |
---|
180 | ac_fc_srcext=$ac_fc_pp_define_srcext_save |
---|
181 | if test "x$ac_cv_fc_pp_define" = xunknown; then |
---|
182 | FC_DEFINE= |
---|
183 | m4_default([$2], |
---|
184 | [AC_MSG_ERROR([Fortran does not allow to define preprocessor symbols], 77)]) |
---|
185 | else |
---|
186 | FC_DEFINE=$ac_cv_fc_pp_define |
---|
187 | $1 |
---|
188 | fi |
---|
189 | AC_SUBST([FC_DEFINE])dnl |
---|
190 | AC_LANG_POP([Fortran])dnl |
---|
191 | ]) |
---|
192 | |
---|
193 | |
---|
194 | # AC_FC_FREEFORM([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) |
---|
195 | # ------------------------------------------------------------------ |
---|
196 | # Look for a compiler flag to make the Fortran (FC) compiler accept |
---|
197 | # free-format source code, and adds it to FCFLAGS. Call |
---|
198 | # ACTION-IF-SUCCESS (defaults to nothing) if successful (i.e. can |
---|
199 | # compile code using new extension) and ACTION-IF-FAILURE (defaults to |
---|
200 | # failing with an error message) if not. (Defined via DEFUN_ONCE to |
---|
201 | # prevent flag from being added to FCFLAGS multiple times.) |
---|
202 | # |
---|
203 | # The known flags are: |
---|
204 | # -ffree-form: GNU g77, gfortran, g95 |
---|
205 | # -FR, -free: Intel compiler (icc, ecc, ifort) |
---|
206 | # -free: Compaq compiler (fort), Sun compiler (f95) |
---|
207 | # -qfree: IBM compiler (xlf) |
---|
208 | # -Mfree, -Mfreeform: Portland Group compiler |
---|
209 | # -freeform: SGI compiler |
---|
210 | # -8, -f free: Absoft Fortran |
---|
211 | # +source=free: HP Fortran |
---|
212 | # (-)-nfix, -Free: Lahey/Fujitsu Fortran |
---|
213 | # -free: NAGWare |
---|
214 | # -f, -Wf,-f: f2c (but only a weak form of "free-form" and long lines) |
---|
215 | # We try to test the "more popular" flags first, by some prejudiced |
---|
216 | # notion of popularity. |
---|
217 | AC_DEFUN_ONCE([AC_FC_FREEFORM], |
---|
218 | [AC_LANG_PUSH([Fortran])dnl |
---|
219 | AC_CACHE_CHECK([for Fortran flag needed to accept free-form source], |
---|
220 | [ac_cv_fc_freeform], |
---|
221 | [ac_cv_fc_freeform=unknown |
---|
222 | ac_fc_freeform_FCFLAGS_save=$FCFLAGS |
---|
223 | for ac_flag in none -ffree-form -FR -free -qfree -Mfree -Mfreeform \ |
---|
224 | -freeform "-f free" -8 +source=free -nfix --nfix -Free |
---|
225 | do |
---|
226 | test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_freeform_FCFLAGS_save $ac_flag" |
---|
227 | dnl Use @&t@ below to ensure that editors don't turn 8+ spaces into tab. |
---|
228 | AC_COMPILE_IFELSE([[ |
---|
229 | program freeform |
---|
230 | ! FIXME: how to best confuse non-freeform compilers? |
---|
231 | print *, 'Hello ', & |
---|
232 | @&t@ 'world.' |
---|
233 | end]], |
---|
234 | [ac_cv_fc_freeform=$ac_flag; break]) |
---|
235 | done |
---|
236 | rm -f conftest.err conftest.$ac_objext conftest.$ac_ext |
---|
237 | FCFLAGS=$ac_fc_freeform_FCFLAGS_save |
---|
238 | ]) |
---|
239 | if test "x$ac_cv_fc_freeform" = xunknown; then |
---|
240 | m4_default([$2], |
---|
241 | [AC_MSG_ERROR([Fortran does not accept free-form source], 77)]) |
---|
242 | else |
---|
243 | if test "x$ac_cv_fc_freeform" != xnone; then |
---|
244 | FCFLAGS="$FCFLAGS $ac_cv_fc_freeform" |
---|
245 | fi |
---|
246 | $1 |
---|
247 | fi |
---|
248 | AC_LANG_POP([Fortran])dnl |
---|
249 | ])# AC_FC_FREEFORM |
---|
250 | |
---|
251 | |
---|
252 | # AC_FC_FIXEDFORM([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) |
---|
253 | # ------------------------------------------------------------------ |
---|
254 | # Look for a compiler flag to make the Fortran (FC) compiler accept |
---|
255 | # fixed-format source code, and adds it to FCFLAGS. Call |
---|
256 | # ACTION-IF-SUCCESS (defaults to nothing) if successful (i.e. can |
---|
257 | # compile code using new extension) and ACTION-IF-FAILURE (defaults to |
---|
258 | # failing with an error message) if not. (Defined via DEFUN_ONCE to |
---|
259 | # prevent flag from being added to FCFLAGS multiple times.) |
---|
260 | # |
---|
261 | # The known flags are: |
---|
262 | # -ffixed-form: GNU g77, gfortran, g95 |
---|
263 | # -fixed: Intel compiler (ifort), Sun compiler (f95) |
---|
264 | # -qfixed: IBM compiler (xlf*) |
---|
265 | # -Mfixed: Portland Group compiler |
---|
266 | # -fixedform: SGI compiler |
---|
267 | # -f fixed: Absoft Fortran |
---|
268 | # +source=fixed: HP Fortran |
---|
269 | # (-)-fix, -Fixed: Lahey/Fujitsu Fortran |
---|
270 | # -fixed: NAGWare |
---|
271 | # Since compilers may accept fixed form based on file name extension, |
---|
272 | # but users may want to use it with others as well, call AC_FC_SRCEXT |
---|
273 | # with the respective source extension before calling this macro. |
---|
274 | AC_DEFUN_ONCE([AC_FC_FIXEDFORM], |
---|
275 | [AC_LANG_PUSH([Fortran])dnl |
---|
276 | AC_CACHE_CHECK([for Fortran flag needed to accept fixed-form source], |
---|
277 | [ac_cv_fc_fixedform], |
---|
278 | [ac_cv_fc_fixedform=unknown |
---|
279 | ac_fc_fixedform_FCFLAGS_save=$FCFLAGS |
---|
280 | for ac_flag in none -ffixed-form -fixed -qfixed -Mfixed -fixedform "-f fixed" \ |
---|
281 | +source=fixed -fix --fix -Fixed |
---|
282 | do |
---|
283 | test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_fixedform_FCFLAGS_save $ac_flag" |
---|
284 | AC_COMPILE_IFELSE([[ |
---|
285 | C This comment should confuse free-form compilers. |
---|
286 | program main |
---|
287 | end]], |
---|
288 | [ac_cv_fc_fixedform=$ac_flag; break]) |
---|
289 | done |
---|
290 | rm -f conftest.err conftest.$ac_objext conftest.$ac_ext |
---|
291 | FCFLAGS=$ac_fc_fixedform_FCFLAGS_save |
---|
292 | ]) |
---|
293 | if test "x$ac_cv_fc_fixedform" = xunknown; then |
---|
294 | m4_default([$2], |
---|
295 | [AC_MSG_ERROR([Fortran does not accept fixed-form source], 77)]) |
---|
296 | else |
---|
297 | if test "x$ac_cv_fc_fixedform" != xnone; then |
---|
298 | FCFLAGS="$FCFLAGS $ac_cv_fc_fixedform" |
---|
299 | fi |
---|
300 | $1 |
---|
301 | fi |
---|
302 | AC_LANG_POP([Fortran])dnl |
---|
303 | ])# AC_FC_FIXEDFORM |
---|
304 | |
---|
305 | |
---|
306 | # AC_FC_LINE_LENGTH([LENGTH], [ACTION-IF-SUCCESS], |
---|
307 | # [ACTION-IF-FAILURE = FAILURE]) |
---|
308 | # ------------------------------------------------ |
---|
309 | # Look for a compiler flag to make the Fortran (FC) compiler accept long lines |
---|
310 | # in the current (free- or fixed-format) source code, and adds it to FCFLAGS. |
---|
311 | # The optional LENGTH may be 80, 132 (default), or `unlimited' for longer |
---|
312 | # lines. Note that line lengths above 254 columns are not portable, and some |
---|
313 | # compilers (hello ifort) do not accept more than 132 columns at least for |
---|
314 | # fixed format. Call ACTION-IF-SUCCESS (defaults to nothing) if successful |
---|
315 | # (i.e. can compile code using new extension) and ACTION-IF-FAILURE (defaults |
---|
316 | # to failing with an error message) if not. (Defined via DEFUN_ONCE to |
---|
317 | # prevent flag from being added to FCFLAGS multiple times.) |
---|
318 | # You should call AC_FC_FREEFORM or AC_FC_FIXEDFORM to set the desired format |
---|
319 | # prior to using this macro. |
---|
320 | # |
---|
321 | # The known flags are: |
---|
322 | # -f{free,fixed}-line-length-N with N 72, 80, 132, or 0 or none for none. |
---|
323 | # -ffree-line-length-none: GNU gfortran |
---|
324 | # -ffree-line-length-huge: g95 (also -ffixed-line-length-N as above) |
---|
325 | # -qfixed=132 80 72: IBM compiler (xlf) |
---|
326 | # -Mextend: Cray |
---|
327 | # -132 -80 -72: Intel compiler (ifort) |
---|
328 | # Needs to come before -extend_source because ifort |
---|
329 | # accepts that as well with an optional parameter and |
---|
330 | # doesn't fail but only warns about unknown arguments. |
---|
331 | # -extend_source: SGI compiler |
---|
332 | # -W, -WNN (132, 80, 72): Absoft Fortran |
---|
333 | # +es, +extend_source: HP Fortran (254 in either form, default is 72 fixed, |
---|
334 | # 132 free) |
---|
335 | # -w, (-)-wide: Lahey/Fujitsu Fortran (255 cols in fixed form) |
---|
336 | # -e: Sun Fortran compiler (132 characters) |
---|
337 | # -132: NAGWare |
---|
338 | # -72, -f, -Wf,-f: f2c (a weak form of "free-form" and long lines). |
---|
339 | # /XLine: Open Watcom |
---|
340 | AC_DEFUN_ONCE([AC_FC_LINE_LENGTH], |
---|
341 | [AC_LANG_PUSH([Fortran])dnl |
---|
342 | m4_case(m4_default([$1], [132]), |
---|
343 | [unlimited], [ac_fc_line_len_string=unlimited |
---|
344 | ac_fc_line_len=0 |
---|
345 | ac_fc_line_length_test=' |
---|
346 | subroutine longer_than_132(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,'\ |
---|
347 | 'arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19)'], |
---|
348 | [132], [ac_fc_line_len=132 |
---|
349 | ac_fc_line_length_test=' |
---|
350 | subroutine longer_than_80(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,'\ |
---|
351 | 'arg10)'], |
---|
352 | [80], [ac_fc_line_len=80 |
---|
353 | ac_fc_line_length_test=' |
---|
354 | subroutine longer_than_72(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)'], |
---|
355 | [m4_warning([Invalid length argument `$1'])]) |
---|
356 | : ${ac_fc_line_len_string=$ac_fc_line_len} |
---|
357 | AC_CACHE_CHECK( |
---|
358 | [for Fortran flag needed to accept $ac_fc_line_len_string column source lines], |
---|
359 | [ac_cv_fc_line_length], |
---|
360 | [ac_cv_fc_line_length=unknown |
---|
361 | ac_fc_line_length_FCFLAGS_save=$FCFLAGS |
---|
362 | for ac_flag in none \ |
---|
363 | -ffree-line-length-none -ffixed-line-length-none \ |
---|
364 | -ffree-line-length-huge \ |
---|
365 | -ffree-line-length-$ac_fc_line_len \ |
---|
366 | -ffixed-line-length-$ac_fc_line_len \ |
---|
367 | -qfixed=$ac_fc_line_len -Mextend \ |
---|
368 | -$ac_fc_line_len -extend_source \ |
---|
369 | -W$ac_fc_line_len -W +extend_source +es -wide --wide -w -e \ |
---|
370 | -f -Wf,-f -xline |
---|
371 | do |
---|
372 | test "x$ac_flag" != xnone && FCFLAGS="$ac_fc_line_length_FCFLAGS_save $ac_flag" |
---|
373 | AC_COMPILE_IFELSE([[$ac_fc_line_length_test |
---|
374 | end subroutine]], |
---|
375 | [ac_cv_fc_line_length=$ac_flag; break]) |
---|
376 | done |
---|
377 | rm -f conftest.err conftest.$ac_objext conftest.$ac_ext |
---|
378 | FCFLAGS=$ac_fc_line_length_FCFLAGS_save |
---|
379 | ]) |
---|
380 | if test "x$ac_cv_fc_line_length" = xunknown; then |
---|
381 | m4_default([$3], |
---|
382 | [AC_MSG_ERROR([Fortran does not accept long source lines], 77)]) |
---|
383 | else |
---|
384 | if test "x$ac_cv_fc_line_length" != xnone; then |
---|
385 | FCFLAGS="$FCFLAGS $ac_cv_fc_line_length" |
---|
386 | fi |
---|
387 | $2 |
---|
388 | fi |
---|
389 | AC_LANG_POP([Fortran])dnl |
---|
390 | ])# AC_FC_LINE_LENGTH |
---|
391 | |
---|
392 | |
---|
393 | # AC_FC_CHECK_BOUNDS([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) |
---|
394 | # ---------------------------------------------------------------------- |
---|
395 | # Look for a compiler flag to turn on array bounds checking for the |
---|
396 | # Fortran (FC) compiler, and adds it to FCFLAGS. Call |
---|
397 | # ACTION-IF-SUCCESS (defaults to nothing) if successful (i.e. can |
---|
398 | # compile code using new extension) and ACTION-IF-FAILURE (defaults to |
---|
399 | # failing with an error message) if not. (Defined via DEFUN_ONCE to |
---|
400 | # prevent flag from being added to FCFLAGS multiple times.) |
---|
401 | # |
---|
402 | # The known flags are: |
---|
403 | # -fcheck=all, -fbounds-check: gfortran |
---|
404 | # -fbounds-check: g77, g95 |
---|
405 | # -CB, -check bounds: Intel compiler (icc, ecc, ifort) |
---|
406 | # -C: Sun/Oracle compiler (f95) |
---|
407 | # -C, -qcheck: IBM compiler (xlf) |
---|
408 | # -Mbounds: Portland Group compiler |
---|
409 | # -C ,-Mbounds: Cray |
---|
410 | # -C, -check_bounds: SGI compiler |
---|
411 | # -check_bounds, +check=all: HP Fortran |
---|
412 | # -C, -Rb -Rc: Absoft (-Rb: array boundaries, -Rc: array conformance) |
---|
413 | # --chk e,s -chk (e,s): Lahey |
---|
414 | # -C -C=all: NAGWare |
---|
415 | # -C, -ffortran-bounds-check: PathScale pathf90 |
---|
416 | # -C: f2c |
---|
417 | # -BOunds: Open Watcom |
---|
418 | AC_DEFUN_ONCE([AC_FC_CHECK_BOUNDS], |
---|
419 | [AC_LANG_PUSH([Fortran])dnl |
---|
420 | AC_CACHE_CHECK([for Fortran flag to enable array-bounds checking], |
---|
421 | [ac_cv_fc_check_bounds], |
---|
422 | [ac_cv_fc_check_bounds=unknown |
---|
423 | ac_fc_check_bounds_FCFLAGS_save=$FCFLAGS |
---|
424 | for ac_flag in -fcheck=bounds -fbounds-check -check_bounds -Mbounds -qcheck \ |
---|
425 | '-check bounds' +check=all --check '-Rb -Rc' -CB -C=all -C \ |
---|
426 | -ffortran-bounds-check "--chk e,s" "-chk e -chk s" -bounds |
---|
427 | do |
---|
428 | FCFLAGS="$ac_fc_check_bounds_FCFLAGS_save $ac_flag" |
---|
429 | # We should be able to link a correct program. |
---|
430 | AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
---|
431 | [AC_LINK_IFELSE([[ |
---|
432 | subroutine sub(a) |
---|
433 | integer a(:) |
---|
434 | a(8) = 0 |
---|
435 | end subroutine |
---|
436 | |
---|
437 | program main |
---|
438 | integer a(1:7) |
---|
439 | interface |
---|
440 | subroutine sub(a) |
---|
441 | integer a(:) |
---|
442 | end subroutine |
---|
443 | end interface |
---|
444 | |
---|
445 | call sub(a) |
---|
446 | end program]], |
---|
447 | [# If we can run the program, require failure at run time. |
---|
448 | # In cross-compiling mode, we rely on the compiler not accepting |
---|
449 | # unknown options. |
---|
450 | AS_IF([test "$cross_compiling" = yes], |
---|
451 | [ac_cv_fc_check_bounds=$ac_flag; break], |
---|
452 | [AS_IF([_AC_DO_TOKENS(./conftest$ac_exeext)], |
---|
453 | [], |
---|
454 | [ac_cv_fc_check_bounds=$ac_flag; break])])])]) |
---|
455 | done |
---|
456 | rm -f conftest$ac_exeext conftest.err conftest.$ac_objext conftest.$ac_ext |
---|
457 | FCFLAGS=$ac_fc_check_bounds_FCFLAGS_save |
---|
458 | ]) |
---|
459 | if test "x$ac_cv_fc_check_bounds" = xunknown; then |
---|
460 | m4_default([$2], |
---|
461 | [AC_MSG_ERROR([no Fortran flag for bounds checking found], 77)]) |
---|
462 | else |
---|
463 | if test "x$ac_cv_fc_check_bounds" != xnone; then |
---|
464 | FCFLAGS="$FCFLAGS $ac_cv_fc_check_bounds" |
---|
465 | fi |
---|
466 | $1 |
---|
467 | fi |
---|
468 | AC_LANG_POP([Fortran])dnl |
---|
469 | ])# AC_FC_CHECK_BOUNDS |
---|
470 | |
---|
471 | |
---|
472 | # _AC_FC_IMPLICIT_NONE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) |
---|
473 | # ------------------------------------------------------------------------ |
---|
474 | # Look for a flag to disallow implicit declarations, and add it to FCFLAGS. |
---|
475 | # Call ACTION-IF-SUCCESS (defaults to nothing) if successful and |
---|
476 | # ACTION-IF-FAILURE (defaults to failing with an error message) if not. |
---|
477 | # |
---|
478 | # Known flags: |
---|
479 | # GNU gfortran, g95: -fimplicit-none, g77: -Wimplicit |
---|
480 | # Intel: -u, -implicitnone; might also need '-warn errors' to turn into error. |
---|
481 | # Sun/Oracle: -u |
---|
482 | # HP: +implicit_none |
---|
483 | # IBM: -u, -qundef |
---|
484 | # SGI: -u |
---|
485 | # Compaq: -u, -warn declarations |
---|
486 | # NAGWare: -u |
---|
487 | # Lahey: -in, --in, -AT |
---|
488 | # Cray: -Mdclchk -e I |
---|
489 | # PGI: -Mcdlchk |
---|
490 | # f2c: -u |
---|
491 | AC_DEFUN([_AC_FC_IMPLICIT_NONE], |
---|
492 | [_AC_FORTRAN_ASSERT()dnl |
---|
493 | AC_CACHE_CHECK([for flag to disallow _AC_LANG implicit declarations], |
---|
494 | [ac_cv_[]_AC_LANG_ABBREV[]_implicit_none], |
---|
495 | [ac_cv_[]_AC_LANG_ABBREV[]_implicit_none=unknown |
---|
496 | ac_fc_implicit_none_[]_AC_LANG_PREFIX[]FLAGS_save=$[]_AC_LANG_PREFIX[]FLAGS |
---|
497 | for ac_flag in none -fimplicit-none -u -Wimplicit -implicitnone +implicit_none \ |
---|
498 | -qundef "-warn declarations" -in --in -AT "-e I" -Mdclchk \ |
---|
499 | "-u -warn errors" |
---|
500 | do |
---|
501 | if test "x$ac_flag" != xnone; then |
---|
502 | _AC_LANG_PREFIX[]FLAGS="$ac_fc_implicit_none_[]_AC_LANG_PREFIX[]FLAGS_save $ac_flag" |
---|
503 | fi |
---|
504 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], |
---|
505 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ |
---|
506 | i = 0 |
---|
507 | print *, i]])], |
---|
508 | [], |
---|
509 | [ac_cv_[]_AC_LANG_ABBREV[]_implicit_none=$ac_flag; break])]) |
---|
510 | done |
---|
511 | rm -f conftest.err conftest.$ac_objext conftest.$ac_ext |
---|
512 | _AC_LANG_PREFIX[]FLAGS=$ac_fc_implicit_none_[]_AC_LANG_PREFIX[]FLAGS_save |
---|
513 | ]) |
---|
514 | if test "x$ac_cv_[]_AC_LANG_ABBREV[]_implicit_none" = xunknown; then |
---|
515 | m4_default([$3], |
---|
516 | [AC_MSG_ERROR([no Fortran flag to disallow implicit declarations found], 77)]) |
---|
517 | else |
---|
518 | if test "x$ac_cv_[]_AC_LANG_ABBREV[]_implicit_none" != xnone; then |
---|
519 | _AC_LANG_PREFIX[]FLAGS="$_AC_LANG_PREFIX[]FLAGS $ac_cv_[]_AC_LANG_ABBREV[]_implicit_none" |
---|
520 | fi |
---|
521 | $2 |
---|
522 | fi |
---|
523 | ])# _AC_FC_IMPLICIT_NONE |
---|
524 | |
---|
525 | |
---|
526 | # AC_F77_IMPLICIT_NONE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) |
---|
527 | # ------------------------------------------------------------------------ |
---|
528 | AC_DEFUN([AC_F77_IMPLICIT_NONE], |
---|
529 | [AC_LANG_PUSH([Fortran 77])dnl |
---|
530 | _AC_FC_IMPLICIT_NONE($@) |
---|
531 | AC_LANG_POP([Fortran 77])dnl |
---|
532 | ])# AC_F77_IMPLICIT_NONE |
---|
533 | |
---|
534 | |
---|
535 | # AC_FC_IMPLICIT_NONE([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) |
---|
536 | # ----------------------------------------------------------------------- |
---|
537 | AC_DEFUN([AC_FC_IMPLICIT_NONE], |
---|
538 | [AC_LANG_PUSH([Fortran])dnl |
---|
539 | _AC_FC_IMPLICIT_NONE($@) |
---|
540 | AC_LANG_POP([Fortran])dnl |
---|
541 | ])# AC_FC_IMPLICIT_NONE |
---|
542 | |
---|
543 | |
---|
544 | # AC_FC_MODULE_EXTENSION |
---|
545 | # ---------------------- |
---|
546 | # Find the Fortran 90 module file extension. The module extension is stored |
---|
547 | # in the variable FC_MODEXT and empty if it cannot be determined. The result |
---|
548 | # or "unknown" is cached in the cache variable ac_cv_fc_module_ext. |
---|
549 | AC_DEFUN([AC_FC_MODULE_EXTENSION], |
---|
550 | [AC_CACHE_CHECK([Fortran 90 module extension], [ac_cv_fc_module_ext], |
---|
551 | [AC_LANG_PUSH(Fortran) |
---|
552 | mkdir conftest.dir |
---|
553 | cd conftest.dir |
---|
554 | ac_cv_fc_module_ext=unknown |
---|
555 | AC_COMPILE_IFELSE([[ |
---|
556 | module conftest_module |
---|
557 | contains |
---|
558 | subroutine conftest_routine |
---|
559 | write(*,'(a)') 'gotcha!' |
---|
560 | end subroutine |
---|
561 | end module]], |
---|
562 | [ac_cv_fc_module_ext=`ls | sed -n 's,conftest_module\.,,p'` |
---|
563 | if test x$ac_cv_fc_module_ext = x; then |
---|
564 | dnl Some F90 compilers use upper case characters for the module file name. |
---|
565 | ac_cv_fc_module_ext=`ls | sed -n 's,CONFTEST_MODULE\.,,p'` |
---|
566 | fi]) |
---|
567 | cd .. |
---|
568 | rm -rf conftest.dir |
---|
569 | AC_LANG_POP(Fortran) |
---|
570 | ]) |
---|
571 | FC_MODEXT=$ac_cv_fc_module_ext |
---|
572 | if test "$FC_MODEXT" = unknown; then |
---|
573 | FC_MODEXT= |
---|
574 | fi |
---|
575 | AC_SUBST([FC_MODEXT])dnl |
---|
576 | ]) |
---|
577 | |
---|
578 | |
---|
579 | # AC_FC_MODULE_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) |
---|
580 | # --------------------------------------------------------------------- |
---|
581 | # Find a flag to include Fortran 90 modules from another directory. |
---|
582 | # If successful, run ACTION-IF-SUCCESS (defaults to nothing), otherwise |
---|
583 | # run ACTION-IF-FAILURE (defaults to failing with an error message). |
---|
584 | # The module flag is cached in the ac_cv_fc_module_flag variable. |
---|
585 | # It may contain significant trailing whitespace. |
---|
586 | # |
---|
587 | # Known flags: |
---|
588 | # gfortran: -Idir, -I dir (-M dir, -Mdir (deprecated), -Jdir for writing) |
---|
589 | # g95: -I dir (-fmod=dir for writing) |
---|
590 | # SUN: -Mdir, -M dir (-moddir=dir for writing; |
---|
591 | # -Idir for includes is also searched) |
---|
592 | # HP: -Idir, -I dir (+moddir=dir for writing) |
---|
593 | # IBM: -Idir (-qmoddir=dir for writing) |
---|
594 | # Intel: -Idir -I dir (-mod dir for writing) |
---|
595 | # Absoft: -pdir |
---|
596 | # Lahey: -Idir (-Mdir or -mod dir for writing) |
---|
597 | # Cray: -module dir, -p dir (-J dir for writing) |
---|
598 | # -e m is needed to enable writing .mod files at all |
---|
599 | # Compaq: -Idir |
---|
600 | # NAGWare: -I dir |
---|
601 | # PathScale: -I dir (but -module dir is looked at first) |
---|
602 | # Portland: -module dir (first -module also names dir for writing) |
---|
603 | # Fujitsu: -Am -Idir (-Mdir for writing is searched first, then '.', then -I) |
---|
604 | # (-Am indicates how module information is saved) |
---|
605 | AC_DEFUN([AC_FC_MODULE_FLAG],[ |
---|
606 | AC_CACHE_CHECK([Fortran 90 module inclusion flag], [ac_cv_fc_module_flag], |
---|
607 | [AC_LANG_PUSH([Fortran]) |
---|
608 | ac_cv_fc_module_flag=unknown |
---|
609 | mkdir conftest.dir |
---|
610 | cd conftest.dir |
---|
611 | AC_COMPILE_IFELSE([[ |
---|
612 | module conftest_module |
---|
613 | contains |
---|
614 | subroutine conftest_routine |
---|
615 | write(*,'(a)') 'gotcha!' |
---|
616 | end subroutine |
---|
617 | end module]], |
---|
618 | # For Lahey -M will also write module and object files to that directory |
---|
619 | # make it read-only so that lahey fails over to -I |
---|
620 | [chmod -w . |
---|
621 | cd .. |
---|
622 | ac_fc_module_flag_FCFLAGS_save=$FCFLAGS |
---|
623 | # Flag ordering is significant for gfortran and Sun. |
---|
624 | for ac_flag in -M -I '-I ' '-M ' -p '-mod ' '-module ' '-Am -I'; do |
---|
625 | # Add the flag twice to prevent matching an output flag. |
---|
626 | FCFLAGS="$ac_fc_module_flag_FCFLAGS_save ${ac_flag}conftest.dir ${ac_flag}conftest.dir" |
---|
627 | AC_COMPILE_IFELSE([[ |
---|
628 | module conftest_main |
---|
629 | use conftest_module |
---|
630 | contains |
---|
631 | subroutine conftest |
---|
632 | call conftest_routine |
---|
633 | end subroutine |
---|
634 | end module]], |
---|
635 | [ac_cv_fc_module_flag="$ac_flag"]) |
---|
636 | if test "$ac_cv_fc_module_flag" != unknown; then |
---|
637 | break |
---|
638 | fi |
---|
639 | done |
---|
640 | FCFLAGS=$ac_fc_module_flag_FCFLAGS_save |
---|
641 | ]) |
---|
642 | chmod +w conftest.dir |
---|
643 | rm -rf conftest.dir |
---|
644 | AC_LANG_POP([Fortran]) |
---|
645 | ]) |
---|
646 | if test "$ac_cv_fc_module_flag" != unknown; then |
---|
647 | FC_MODINC=$ac_cv_fc_module_flag |
---|
648 | $1 |
---|
649 | else |
---|
650 | FC_MODINC= |
---|
651 | m4_default([$2], |
---|
652 | [AC_MSG_ERROR([unable to find compiler flag for module search path])]) |
---|
653 | fi |
---|
654 | AC_SUBST([FC_MODINC]) |
---|
655 | # Ensure trailing whitespace is preserved in a Makefile. |
---|
656 | AC_SUBST([ac_empty], [""]) |
---|
657 | AC_CONFIG_COMMANDS_PRE([case $FC_MODINC in #( |
---|
658 | *\ ) FC_MODINC=$FC_MODINC'${ac_empty}' ;; |
---|
659 | esac])dnl |
---|
660 | ]) |
---|
661 | |
---|
662 | |
---|
663 | # AC_FC_MODULE_OUTPUT_FLAG([ACTION-IF-SUCCESS], [ACTION-IF-FAILURE = FAILURE]) |
---|
664 | # ---------------------------------------------------------------------------- |
---|
665 | # Find a flag to write Fortran 90 module information to another directory. |
---|
666 | # If successful, run ACTION-IF-SUCCESS (defaults to nothing), otherwise |
---|
667 | # run ACTION-IF-FAILURE (defaults to failing with an error message). |
---|
668 | # The module flag is cached in the ac_cv_fc_module_output_flag variable. |
---|
669 | # It may contain significant trailing whitespace. |
---|
670 | # |
---|
671 | # For known flags, see the documentation of AC_FC_MODULE_FLAG above. |
---|
672 | AC_DEFUN([AC_FC_MODULE_OUTPUT_FLAG],[ |
---|
673 | AC_CACHE_CHECK([Fortran 90 module output flag], [ac_cv_fc_module_output_flag], |
---|
674 | [AC_LANG_PUSH([Fortran]) |
---|
675 | mkdir conftest.dir conftest.dir/sub |
---|
676 | cd conftest.dir |
---|
677 | ac_cv_fc_module_output_flag=unknown |
---|
678 | ac_fc_module_output_flag_FCFLAGS_save=$FCFLAGS |
---|
679 | # Flag ordering is significant: put flags late which some compilers use |
---|
680 | # for the search path. |
---|
681 | for ac_flag in -J '-J ' -fmod= -moddir= +moddir= -qmoddir= '-mod ' \ |
---|
682 | '-module ' -M '-Am -M' '-e m -J '; do |
---|
683 | FCFLAGS="$ac_fc_module_output_flag_FCFLAGS_save ${ac_flag}sub" |
---|
684 | AC_COMPILE_IFELSE([[ |
---|
685 | module conftest_module |
---|
686 | contains |
---|
687 | subroutine conftest_routine |
---|
688 | write(*,'(a)') 'gotcha!' |
---|
689 | end subroutine |
---|
690 | end module]], |
---|
691 | [cd sub |
---|
692 | AC_COMPILE_IFELSE([[ |
---|
693 | program main |
---|
694 | use conftest_module |
---|
695 | call conftest_routine |
---|
696 | end program]], |
---|
697 | [ac_cv_fc_module_output_flag="$ac_flag"]) |
---|
698 | cd .. |
---|
699 | if test "$ac_cv_fc_module_output_flag" != unknown; then |
---|
700 | break |
---|
701 | fi]) |
---|
702 | done |
---|
703 | FCFLAGS=$ac_fc_module_output_flag_FCFLAGS_save |
---|
704 | cd .. |
---|
705 | rm -rf conftest.dir |
---|
706 | AC_LANG_POP([Fortran]) |
---|
707 | ]) |
---|
708 | if test "$ac_cv_fc_module_output_flag" != unknown; then |
---|
709 | FC_MODOUT=$ac_cv_fc_module_output_flag |
---|
710 | $1 |
---|
711 | else |
---|
712 | FC_MODOUT= |
---|
713 | m4_default([$2], |
---|
714 | [AC_MSG_ERROR([unable to find compiler flag to write module information to])]) |
---|
715 | fi |
---|
716 | AC_SUBST([FC_MODOUT]) |
---|
717 | # Ensure trailing whitespace is preserved in a Makefile. |
---|
718 | AC_SUBST([ac_empty], [""]) |
---|
719 | AC_CONFIG_COMMANDS_PRE([case $FC_MODOUT in #( |
---|
720 | *\ ) FC_MODOUT=$FC_MODOUT'${ac_empty}' ;; |
---|
721 | esac])dnl |
---|
722 | ]) |
---|
723 | |
---|
724 | # _AC_FC_LIBRARY_LDFLAGS |
---|
725 | # ---------------------- |
---|
726 | # |
---|
727 | # Determine the linker flags (e.g. "-L" and "-l") for the Fortran |
---|
728 | # intrinsic and runtime libraries that are required to successfully |
---|
729 | # link a Fortran program or shared library. The output variable |
---|
730 | # FLIBS/FCLIBS is set to these flags. |
---|
731 | # |
---|
732 | # This macro is intended to be used in those situations when it is |
---|
733 | # necessary to mix, e.g. C++ and Fortran, source code into a single |
---|
734 | # program or shared library. |
---|
735 | # |
---|
736 | # For example, if object files from a C++ and Fortran compiler must |
---|
737 | # be linked together, then the C++ compiler/linker must be used for |
---|
738 | # linking (since special C++-ish things need to happen at link time |
---|
739 | # like calling global constructors, instantiating templates, enabling |
---|
740 | # exception support, etc.). |
---|
741 | # |
---|
742 | # However, the Fortran intrinsic and runtime libraries must be |
---|
743 | # linked in as well, but the C++ compiler/linker doesn't know how to |
---|
744 | # add these Fortran libraries. Hence, the macro |
---|
745 | # "AC_F77_LIBRARY_LDFLAGS" was created to determine these Fortran |
---|
746 | # libraries. |
---|
747 | # |
---|
748 | # This macro was packaged in its current form by Matthew D. Langston. |
---|
749 | # However, nearly all of this macro came from the "OCTAVE_FLIBS" macro |
---|
750 | # in "octave-2.0.13/aclocal.m4", and full credit should go to John |
---|
751 | # W. Eaton for writing this extremely useful macro. Thank you John. |
---|
752 | AC_DEFUN([_AC_FC_LIBRARY_LDFLAGS], |
---|
753 | [_AC_FORTRAN_ASSERT()dnl |
---|
754 | _AC_PROG_FC_V |
---|
755 | AC_CACHE_CHECK([for _AC_LANG libraries of $[]_AC_FC[]], ac_cv_[]_AC_LANG_ABBREV[]_libs, |
---|
756 | [if test "x$[]_AC_LANG_PREFIX[]LIBS" != "x"; then |
---|
757 | ac_cv_[]_AC_LANG_ABBREV[]_libs="$[]_AC_LANG_PREFIX[]LIBS" # Let the user override the test. |
---|
758 | else |
---|
759 | |
---|
760 | _AC_PROG_FC_V_OUTPUT |
---|
761 | |
---|
762 | ac_cv_[]_AC_LANG_ABBREV[]_libs= |
---|
763 | |
---|
764 | # Save positional arguments (if any) |
---|
765 | ac_save_positional="$[@]" |
---|
766 | |
---|
767 | set X $ac_[]_AC_LANG_ABBREV[]_v_output |
---|
768 | while test $[@%:@] != 1; do |
---|
769 | shift |
---|
770 | ac_arg=$[1] |
---|
771 | case $ac_arg in |
---|
772 | [[\\/]]*.a | ?:[[\\/]]*.a) |
---|
773 | _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_[]_AC_LANG_ABBREV[]_libs, , |
---|
774 | ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg") |
---|
775 | ;; |
---|
776 | -bI:*) |
---|
777 | _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_[]_AC_LANG_ABBREV[]_libs, , |
---|
778 | [_AC_LINKER_OPTION([$ac_arg], ac_cv_[]_AC_LANG_ABBREV[]_libs)]) |
---|
779 | ;; |
---|
780 | # Ignore these flags. |
---|
781 | -lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -little \ |
---|
782 | |-LANG:=* | -LIST:* | -LNO:* | -link | -list | -lnuma ) |
---|
783 | ;; |
---|
784 | -lkernel32) |
---|
785 | test x"$CYGWIN" != xyes && ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg" |
---|
786 | ;; |
---|
787 | -[[LRuYz]]) |
---|
788 | # These flags, when seen by themselves, take an argument. |
---|
789 | # We remove the space between option and argument and re-iterate |
---|
790 | # unless we find an empty arg or a new option (starting with -) |
---|
791 | case $[2] in |
---|
792 | "" | -*);; |
---|
793 | *) |
---|
794 | ac_arg="$ac_arg$[2]" |
---|
795 | shift; shift |
---|
796 | set X $ac_arg "$[@]" |
---|
797 | ;; |
---|
798 | esac |
---|
799 | ;; |
---|
800 | -YP,*) |
---|
801 | for ac_j in `AS_ECHO(["$ac_arg"]) | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do |
---|
802 | _AC_LIST_MEMBER_IF($ac_j, $ac_cv_[]_AC_LANG_ABBREV[]_libs, , |
---|
803 | [ac_arg="$ac_arg $ac_j" |
---|
804 | ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_j"]) |
---|
805 | done |
---|
806 | ;; |
---|
807 | -[[lLR]]*) |
---|
808 | _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_[]_AC_LANG_ABBREV[]_libs, , |
---|
809 | ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg") |
---|
810 | ;; |
---|
811 | -zallextract*| -zdefaultextract) |
---|
812 | ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg" |
---|
813 | ;; |
---|
814 | # Ignore everything else. |
---|
815 | esac |
---|
816 | done |
---|
817 | # restore positional arguments |
---|
818 | set X $ac_save_positional; shift |
---|
819 | |
---|
820 | # We only consider "LD_RUN_PATH" on Solaris systems. If this is seen, |
---|
821 | # then we insist that the "run path" must be an absolute path (i.e. it |
---|
822 | # must begin with a "/"). |
---|
823 | case `(uname -sr) 2>/dev/null` in |
---|
824 | "SunOS 5"*) |
---|
825 | ac_ld_run_path=`AS_ECHO(["$ac_[]_AC_LANG_ABBREV[]_v_output"]) | |
---|
826 | sed -n 's,^.*LD_RUN_PATH *= *\(/[[^ ]]*\).*$,-R\1,p'` |
---|
827 | test "x$ac_ld_run_path" != x && |
---|
828 | _AC_LINKER_OPTION([$ac_ld_run_path], ac_cv_[]_AC_LANG_ABBREV[]_libs) |
---|
829 | ;; |
---|
830 | esac |
---|
831 | fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x" |
---|
832 | ]) |
---|
833 | []_AC_LANG_PREFIX[]LIBS="$ac_cv_[]_AC_LANG_ABBREV[]_libs" |
---|
834 | AC_SUBST([]_AC_LANG_PREFIX[]LIBS) |
---|
835 | ])# _AC_FC_LIBRARY_LDFLAGS |
---|
836 | |
---|
837 | |
---|
838 | # AC_F77_LIBRARY_LDFLAGS |
---|
839 | # ---------------------- |
---|
840 | AC_DEFUN([AC_F77_LIBRARY_LDFLAGS], |
---|
841 | [AC_REQUIRE([AC_PROG_F77])dnl |
---|
842 | AC_LANG_PUSH(Fortran 77)dnl |
---|
843 | _AC_FC_LIBRARY_LDFLAGS |
---|
844 | AC_LANG_POP(Fortran 77)dnl |
---|
845 | ])# AC_F77_LIBRARY_LDFLAGS |
---|
846 | |
---|
847 | |
---|
848 | # AC_FC_LIBRARY_LDFLAGS |
---|
849 | # --------------------- |
---|
850 | AC_DEFUN([AC_FC_LIBRARY_LDFLAGS], |
---|
851 | [AC_REQUIRE([AC_PROG_FC])dnl |
---|
852 | AC_LANG_PUSH(Fortran)dnl |
---|
853 | _AC_FC_LIBRARY_LDFLAGS |
---|
854 | AC_LANG_POP(Fortran)dnl |
---|
855 | ])# AC_FC_LIBRARY_LDFLAGS |
---|