| 1 |
# Checks whether a compiler accepts a given flag |
| 2 |
# ---------------------------------------------- |
| 3 |
|
| 4 |
# $1 = compiler name |
| 5 |
# $2 = flag |
| 6 |
# $3 = make macro containing flags for that compiler |
| 7 |
# $4 = exec is true .. |
| 8 |
# Note: changes AC_LANG() |
| 9 |
|
| 10 |
AC_DEFUN([CHECK_COMPILE_FLAG], |
| 11 |
[AC_MSG_CHECKING(whether the $1 compiler accepts $2) |
| 12 |
check_save_flags="$$3" |
| 13 |
AC_LANG_PUSH($1) |
| 14 |
$3="$$3 $2" |
| 15 |
|
| 16 |
# The program needs to contain something for the test source |
| 17 |
# file to be created by autoconf. |
| 18 |
|
| 19 |
# Some options really need to be linked (not only compiled) to |
| 20 |
# check whether they work. |
| 21 |
|
| 22 |
AC_LINK_IFELSE([ifelse($1,Fortran 77, |
| 23 |
[ program x |
| 24 |
end], |
| 25 |
[AC_LANG_PROGRAM])], |
| 26 |
check_flag_ok=yes, |
| 27 |
check_flag_ok=no) |
| 28 |
AC_MSG_RESULT($check_flag_ok) |
| 29 |
if test "$check_flag_ok" = no; |
| 30 |
then |
| 31 |
$3="$check_save_flags" |
| 32 |
fi |
| 33 |
if test -n "$4" ; |
| 34 |
then |
| 35 |
$4="$check_flag_ok" |
| 36 |
fi |
| 37 |
|
| 38 |
AC_LANG_POP($1) |
| 39 |
]) |