(AC_TRY_LINK, AC_TRY_COMPILE): Use them.
(AC_CHECK_MEMBER, AC_COMPILE_CHECK, AC_CHECK_DECL,
_AC_CHECK_TYPE_NEW): Adjust.
* acspecific.m4 (AC_DECL_YYTEXT, AC_PATH_XTRA): Adjust.
+2000-03-25 Akim Demaille <akim@epita.fr>
+
+ * acgeneral.m4 (AC_LINK_IFELSE, AC_COMPILE_IFELSE): New macros.
+ (AC_TRY_LINK, AC_TRY_COMPILE): Use them.
+ (AC_CHECK_MEMBER, AC_COMPILE_CHECK, AC_CHECK_DECL,
+ _AC_CHECK_TYPE_NEW): Adjust.
+ * acspecific.m4 (AC_DECL_YYTEXT, AC_PATH_XTRA): Adjust.
+
2000-03-23 Steven G. Johnson <stevenj@alum.mit.edu>
* acspecific.m4 (AC_F77_NAME_MANGLING): Need to use
ifelse(regexp([$1], [\.]), -1,
[AC_FATAL([$0: Did not see any dot in `$1'])])dnl
AC_CACHE_CHECK([for $1], ac_Member,
-[AC_TRY_COMPILE(AC_INCLUDES_DEFAULT([$4]),
-dnl AGGREGATE foo;
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
+[dnl AGGREGATE foo;
patsubst([$1], [\.[^.]*]) foo;
dnl foo.MEMBER;
-foo.patsubst([$1], [.*\.]);,
+foo.patsubst([$1], [.*\.]);])],
AC_VAR_SET(ac_Member, yes),
AC_VAR_SET(ac_Member, no))])
AC_SHELL_IFELSE([test AC_VAR_GET(ac_Member) = yes],
## ------------------------ ##
-# AC_TRY_LINK_FUNC(func, action-if-found, action-if-not-found)
+# AC_TRY_LINK_FUNC(FUNC, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
# ------------------------------------------------------------
# Try to link a program that calls FUNC, handling GCC builtins. If
# the link succeeds, execute ACTION-IF-FOUND; otherwise, execute
## ------------------ ##
-# AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY,
-# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-# --------------------------------------------------------
-# FIXME: Should INCLUDES be defaulted here?
-AC_DEFUN(AC_TRY_COMPILE,
+# AC_COMPILE_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# --------------------------------------------------------------------
+# Try to compile PROGRAM.
+AC_DEFUN([AC_COMPILE_IFELSE],
[cat >conftest.$ac_ext <<EOF
-AC_LANG_PROGRAM([[$1]], [[$2]])
+$1
EOF
if AC_TRY_EVAL(ac_compile); then
- m4_default([$3], :)
+ m4_default([$2], :)
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
- $4
+ $3
fi
-rm -f conftest*])
+rm -f conftest*[]dnl
+])# AC_COMPILE_IFELSE
+
+
+# AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# --------------------------------------------------------
+# FIXME: Should INCLUDES be defaulted here?
+AC_DEFUN([AC_TRY_COMPILE],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])])
## --------------------- ##
+# AC_LINK_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -----------------------------------------------------------------
+# Try to link PROGRAM.
+AC_DEFUN([AC_LINK_IFELSE],
+[cat >conftest.$ac_ext <<EOF
+$1
+EOF
+if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ m4_default([$2], :)
+else
+ echo "configure: failed program was:" >&AC_FD_CC
+ cat conftest.$ac_ext >&AC_FD_CC
+ $3
+fi
+rm -f conftest*[]dnl
+])# AC_LINK_IFELSE
+
+
# AC_TRY_LINK(INCLUDES, FUNCTION-BODY,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -----------------------------------------------------
# Should the INCLUDES be defaulted here?
+# Contrarily to AC_LINK_IF, this macro double quote its first two args.
# FIXME: WARNING: The code to compile was different in the case of
# Fortran between AC_TRY_COMPILE and AC_TRY_LINK, though they should
# equivalent as far as I can tell from the semantics and the docs. In
# the former, $[2] is used as is, in the latter, it is `call' ed.
# Remove these FIXME: once truth established.
-AC_DEFUN(AC_TRY_LINK,
-[cat >conftest.$ac_ext <<EOF
-AC_LANG_PROGRAM([[$1]], [[$2]])
-EOF
-if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
- m4_default([$3], :)
-else
- echo "configure: failed program was:" >&AC_FD_CC
- cat conftest.$ac_ext >&AC_FD_CC
- $4
-fi
-rm -f conftest*
-])# AC_TRY_LINK
+AC_DEFUN([AC_TRY_LINK],
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])])
# AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY,
AU_DEFUN(AC_COMPILE_CHECK,
[ifval([$1], [AC_CHECKING([for $1])
])dnl
-AC_TRY_LINK([$2], [$3], [$4], [$5])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])
])
AC_DEFUN([AC_CHECK_DECL],
[AC_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])dnl
AC_CACHE_CHECK([whether $1 is declared], ac_Symbol,
-[AC_TRY_COMPILE(AC_INCLUDES_DEFAULT([$4]),
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
[#ifndef $1
char *p = (char *) $1;
#endif
-],
+])],
AC_VAR_SET(ac_Symbol, yes), AC_VAR_SET(ac_Symbol, no))])
AC_SHELL_IFELSE([test AC_VAR_GET(ac_Symbol) = yes],
[$2], [$3])dnl
[AC_REQUIRE([AC_HEADER_STDC])dnl
AC_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
AC_CACHE_CHECK([for $1], ac_Type,
-[AC_TRY_COMPILE(AC_INCLUDES_DEFAULT([$4]),
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
[if (($1 *) 0)
return 0;
if (sizeof ($1))
- return 0;],
+ return 0;])],
AC_VAR_SET(ac_Type, yes),
AC_VAR_SET(ac_Type, no))])
AC_SHELL_IFELSE([test AC_VAR_GET(ac_Type) = yes],
# AC_DECL_YYTEXT
# --------------
# Check if lex declares yytext as a char * by default, not a char[].
-# FIXME: Why the heck is there the following line?
-undefine([AC_DECL_YYTEXT])
-AC_DEFUN(AC_DECL_YYTEXT,
+AC_DEFUN([AC_DECL_YYTEXT],
[AC_REQUIRE_CPP()dnl
AC_REQUIRE([AC_PROG_LEX])dnl
AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LEXLIB"
-AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, , ac_cv_prog_lex_yytext_pointer=yes)
+AC_LINK_IFELSE([`cat $LEX_OUTPUT_ROOT.c`], ac_cv_prog_lex_yytext_pointer=yes)
LIBS="$ac_save_LIBS"
rm -f "${LEX_OUTPUT_ROOT}.c"
])
"SunOS 5"*)
AC_MSG_CHECKING(whether -R must be followed by a space)
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
- AC_TRY_LINK(, , ac_R_nospace=yes, ac_R_nospace=no)
+ AC_LINK_IFELSE([], ac_R_nospace=yes, ac_R_nospace=no)
if test $ac_R_nospace = yes; then
AC_MSG_RESULT(no)
X_LIBS="$X_LIBS -R$x_libraries"
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
- AC_TRY_LINK(, , ac_R_space=yes, ac_R_space=no)
+ AC_LINK_IFELSE([], ac_R_space=yes, ac_R_space=no)
if test $ac_R_space = yes; then
AC_MSG_RESULT(yes)
X_LIBS="$X_LIBS -R $x_libraries"
ifelse(regexp([$1], [\.]), -1,
[AC_FATAL([$0: Did not see any dot in `$1'])])dnl
AC_CACHE_CHECK([for $1], ac_Member,
-[AC_TRY_COMPILE(AC_INCLUDES_DEFAULT([$4]),
-dnl AGGREGATE foo;
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
+[dnl AGGREGATE foo;
patsubst([$1], [\.[^.]*]) foo;
dnl foo.MEMBER;
-foo.patsubst([$1], [.*\.]);,
+foo.patsubst([$1], [.*\.]);])],
AC_VAR_SET(ac_Member, yes),
AC_VAR_SET(ac_Member, no))])
AC_SHELL_IFELSE([test AC_VAR_GET(ac_Member) = yes],
## ------------------------ ##
-# AC_TRY_LINK_FUNC(func, action-if-found, action-if-not-found)
+# AC_TRY_LINK_FUNC(FUNC, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
# ------------------------------------------------------------
# Try to link a program that calls FUNC, handling GCC builtins. If
# the link succeeds, execute ACTION-IF-FOUND; otherwise, execute
## ------------------ ##
-# AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY,
-# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-# --------------------------------------------------------
-# FIXME: Should INCLUDES be defaulted here?
-AC_DEFUN(AC_TRY_COMPILE,
+# AC_COMPILE_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# --------------------------------------------------------------------
+# Try to compile PROGRAM.
+AC_DEFUN([AC_COMPILE_IFELSE],
[cat >conftest.$ac_ext <<EOF
-AC_LANG_PROGRAM([[$1]], [[$2]])
+$1
EOF
if AC_TRY_EVAL(ac_compile); then
- m4_default([$3], :)
+ m4_default([$2], :)
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
- $4
+ $3
fi
-rm -f conftest*])
+rm -f conftest*[]dnl
+])# AC_COMPILE_IFELSE
+
+
+# AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# --------------------------------------------------------
+# FIXME: Should INCLUDES be defaulted here?
+AC_DEFUN([AC_TRY_COMPILE],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])])
## --------------------- ##
+# AC_LINK_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -----------------------------------------------------------------
+# Try to link PROGRAM.
+AC_DEFUN([AC_LINK_IFELSE],
+[cat >conftest.$ac_ext <<EOF
+$1
+EOF
+if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ m4_default([$2], :)
+else
+ echo "configure: failed program was:" >&AC_FD_CC
+ cat conftest.$ac_ext >&AC_FD_CC
+ $3
+fi
+rm -f conftest*[]dnl
+])# AC_LINK_IFELSE
+
+
# AC_TRY_LINK(INCLUDES, FUNCTION-BODY,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -----------------------------------------------------
# Should the INCLUDES be defaulted here?
+# Contrarily to AC_LINK_IF, this macro double quote its first two args.
# FIXME: WARNING: The code to compile was different in the case of
# Fortran between AC_TRY_COMPILE and AC_TRY_LINK, though they should
# equivalent as far as I can tell from the semantics and the docs. In
# the former, $[2] is used as is, in the latter, it is `call' ed.
# Remove these FIXME: once truth established.
-AC_DEFUN(AC_TRY_LINK,
-[cat >conftest.$ac_ext <<EOF
-AC_LANG_PROGRAM([[$1]], [[$2]])
-EOF
-if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
- m4_default([$3], :)
-else
- echo "configure: failed program was:" >&AC_FD_CC
- cat conftest.$ac_ext >&AC_FD_CC
- $4
-fi
-rm -f conftest*
-])# AC_TRY_LINK
+AC_DEFUN([AC_TRY_LINK],
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])])
# AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY,
AU_DEFUN(AC_COMPILE_CHECK,
[ifval([$1], [AC_CHECKING([for $1])
])dnl
-AC_TRY_LINK([$2], [$3], [$4], [$5])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5])
])
AC_DEFUN([AC_CHECK_DECL],
[AC_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])dnl
AC_CACHE_CHECK([whether $1 is declared], ac_Symbol,
-[AC_TRY_COMPILE(AC_INCLUDES_DEFAULT([$4]),
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
[#ifndef $1
char *p = (char *) $1;
#endif
-],
+])],
AC_VAR_SET(ac_Symbol, yes), AC_VAR_SET(ac_Symbol, no))])
AC_SHELL_IFELSE([test AC_VAR_GET(ac_Symbol) = yes],
[$2], [$3])dnl
[AC_REQUIRE([AC_HEADER_STDC])dnl
AC_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
AC_CACHE_CHECK([for $1], ac_Type,
-[AC_TRY_COMPILE(AC_INCLUDES_DEFAULT([$4]),
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
[if (($1 *) 0)
return 0;
if (sizeof ($1))
- return 0;],
+ return 0;])],
AC_VAR_SET(ac_Type, yes),
AC_VAR_SET(ac_Type, no))])
AC_SHELL_IFELSE([test AC_VAR_GET(ac_Type) = yes],
# AC_DECL_YYTEXT
# --------------
# Check if lex declares yytext as a char * by default, not a char[].
-# FIXME: Why the heck is there the following line?
-undefine([AC_DECL_YYTEXT])
-AC_DEFUN(AC_DECL_YYTEXT,
+AC_DEFUN([AC_DECL_YYTEXT],
[AC_REQUIRE_CPP()dnl
AC_REQUIRE([AC_PROG_LEX])dnl
AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
ac_save_LIBS="$LIBS"
LIBS="$LIBS $LEXLIB"
-AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, , ac_cv_prog_lex_yytext_pointer=yes)
+AC_LINK_IFELSE([`cat $LEX_OUTPUT_ROOT.c`], ac_cv_prog_lex_yytext_pointer=yes)
LIBS="$ac_save_LIBS"
rm -f "${LEX_OUTPUT_ROOT}.c"
])
"SunOS 5"*)
AC_MSG_CHECKING(whether -R must be followed by a space)
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
- AC_TRY_LINK(, , ac_R_nospace=yes, ac_R_nospace=no)
+ AC_LINK_IFELSE([], ac_R_nospace=yes, ac_R_nospace=no)
if test $ac_R_nospace = yes; then
AC_MSG_RESULT(no)
X_LIBS="$X_LIBS -R$x_libraries"
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
- AC_TRY_LINK(, , ac_R_space=yes, ac_R_space=no)
+ AC_LINK_IFELSE([], ac_R_space=yes, ac_R_space=no)
if test $ac_R_space = yes; then
AC_MSG_RESULT(yes)
X_LIBS="$X_LIBS -R $x_libraries"