1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>
Autoconf Macro: acx_f77_cmain_fflags
</title>
<link rel="stylesheet" type="text/css" href="ac-archive.css">
</head>
<body>
<table summary="web navigation" style="width:100%;">
<tbody>
<tr>
<td style="width:50%;" align="center">
<a href=
"http://autoconf-archive.cryp.to/acx_f77_cmain_fflags.m4">Download M4
Source</a>
</td>
<td style="width:50%;" align="center">
<a href="macros-by-category.html">Macro Index Page</a>
</td>
</tr>
</tbody>
</table>
<hr>
<h1>
acx_f77_cmain_fflags
</h1>
<h2>
Synopsis
</h2>
<p class="indent" style="white-space:nowrap;">
<code>ACX_F77_CMAIN_FFLAGS([ACTION-IF-SUCCEED], [ACTION-IF-FAIL])</code>
</p>
<h2>
Description
</h2>
<div class="indent">
<p>
This macro figures out if extra Fortran compiler flags are required in
order to use the Fortran linker to link programs where the main() function
is defined via C (or other language). On some systems, notably the Alpha
with Compaq compilers, the Fortran libraries have their own main() function
which must be disabled.
</p>
<p>
Runs ACTION-IF-SUCCEED if successful, and ACTION-IF-FAIL if not. Defines
the output variable F77_CMAIN_FFLAGS to any discovered flags. (If
ACTION-IF-FAIL is not specified, defaults to halting with an error.)
</p>
<p>
This macro is especially useful in conjunction with automake, since by
default automake uses $F77 to link programs mixing C and Fortran, leading
to a link error on some systems. In this case, you should set the FFLAGS
for that program to include F77_CMAIN_FFLAGS.
</p>
</div>
<h2>
Author
</h2>
<p class="indent">
Steven G. Johnson <stevenj@alum.mit.edu>
</p>
<h2>
Last Modified
</h2>
<p class="indent">
2003-03-27
</p>
<h2>
M4 Source Code
</h2>
<div class="indent">
<pre class="m4source">
AC_DEFUN([ACX_F77_CMAIN_FFLAGS],
[AC_CACHE_CHECK([for f77 flags to use C main function], acx_cv_f77_cmain_fflags,
[acx_cv_f77_cmain_fflags="unknown"
AC_LANG_PUSH(C)
AC_COMPILE_IFELSE([[int main(void) { return 0; }]],
[mv conftest.$ac_objext conftest_cmain.$ac_objext],
[acx_cv_f77_cmain_fflags=error])
AC_LANG_POP(C)
if test "x$acx_cv_f77_cmain_fflags" != xerror; then
AC_LANG_PUSH(Fortran 77)
acx_save_LIBS=$LIBS
LIBS="conftest_cmain.$ac_objext $LIBS"
acx_save_FFLAGS=$FFLAGS
for acx_flag in none -nofor_main; do
case $acx_flag in
none) FFLAGS=$acx_save_FFLAGS ;;
*) FFLAGS="$acx_save_FFLAGS $acx_flag" ;;
esac
AC_LINK_IFELSE([
subroutine foobar()
return
end
], [acx_cv_f77_cmain_fflags=$acx_flag; break]);
done
FFLAGS=$acx_save_FFLAGS
LIBS=$acx_save_LIBS
AC_LANG_POP(Fortran 77)
fi])
case $acx_cv_f77_cmain_fflags in
error|unknown)
F77_CMAIN_FFLAGS=""
ifelse([$2],,[AC_MSG_ERROR([cannot link C main with Fortran])],[$2])
;;
*)
if test "x$acx_cv_f77_cmain_fflags" = xnone; then
F77_CMAIN_FFLAGS=""
else
F77_CMAIN_FFLAGS="$acx_cv_f77_cmain_fflags"
fi
$1
;;
esac
AC_SUBST(F77_CMAIN_FFLAGS)
])
</pre>
</div>
</body>
</html>
|