From: Akim Demaille Date: Sat, 25 Mar 2000 09:00:53 +0000 (+0000) Subject: * acgeneral.m4 (AC_LINK_IFELSE, AC_COMPILE_IFELSE): New macros. X-Git-Tag: autoconf-2.50~1003 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6e08327ec72bcd18cb590804af9da32126d15c50;p=thirdparty%2Fautoconf.git * 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. --- diff --git a/ChangeLog b/ChangeLog index fccd9c829..796f26f04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-03-25 Akim Demaille + + * 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 * acspecific.m4 (AC_F77_NAME_MANGLING): Need to use diff --git a/acgeneral.m4 b/acgeneral.m4 index e9e7fb01f..46c1812c9 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -2427,11 +2427,11 @@ AC_VAR_IF_INDIR([$1], 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], @@ -2723,7 +2723,7 @@ rm -fr conftest*]) ## ------------------------ ## -# 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 @@ -2909,22 +2909,30 @@ rm -f conftest* ## ------------------ ## -# 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 <&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])]) @@ -2933,28 +2941,36 @@ rm -f conftest*]) ## --------------------- ## +# AC_LINK_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------------------------- +# Try to link PROGRAM. +AC_DEFUN([AC_LINK_IFELSE], +[cat >conftest.$ac_ext <&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 <&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, @@ -2963,7 +2979,7 @@ rm -f conftest* 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]) ]) @@ -3091,11 +3107,11 @@ $2], 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 @@ -3306,11 +3322,11 @@ AC_DEFUN([_AC_CHECK_TYPE_NEW], [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], diff --git a/acspecific.m4 b/acspecific.m4 index c8462ff15..54d74c25c 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -709,9 +709,7 @@ AC_SUBST(LEXLIB)]) # 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, @@ -737,7 +735,7 @@ ac_cv_prog_lex_yytext_pointer=no 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" ]) @@ -3373,13 +3371,13 @@ dnl FIXME: banish uname from this macro! "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" diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index e9e7fb01f..46c1812c9 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2427,11 +2427,11 @@ AC_VAR_IF_INDIR([$1], 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], @@ -2723,7 +2723,7 @@ rm -fr conftest*]) ## ------------------------ ## -# 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 @@ -2909,22 +2909,30 @@ rm -f conftest* ## ------------------ ## -# 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 <&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])]) @@ -2933,28 +2941,36 @@ rm -f conftest*]) ## --------------------- ## +# AC_LINK_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------------------------- +# Try to link PROGRAM. +AC_DEFUN([AC_LINK_IFELSE], +[cat >conftest.$ac_ext <&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 <&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, @@ -2963,7 +2979,7 @@ rm -f conftest* 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]) ]) @@ -3091,11 +3107,11 @@ $2], 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 @@ -3306,11 +3322,11 @@ AC_DEFUN([_AC_CHECK_TYPE_NEW], [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], diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index c8462ff15..54d74c25c 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -709,9 +709,7 @@ AC_SUBST(LEXLIB)]) # 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, @@ -737,7 +735,7 @@ ac_cv_prog_lex_yytext_pointer=no 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" ]) @@ -3373,13 +3371,13 @@ dnl FIXME: banish uname from this macro! "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"