]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acgeneral.m4 (AC_LINK_IFELSE, AC_COMPILE_IFELSE): New macros.
authorAkim Demaille <akim@epita.fr>
Sat, 25 Mar 2000 09:00:53 +0000 (09:00 +0000)
committerAkim Demaille <akim@epita.fr>
Sat, 25 Mar 2000 09:00:53 +0000 (09:00 +0000)
(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.

ChangeLog
acgeneral.m4
acspecific.m4
lib/autoconf/general.m4
lib/autoconf/specific.m4

index fccd9c8294ea09c358f4ac68846ab358abc44252..796f26f04b65ecd6c5eae4a4fcc9d1ef77ce0b70 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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
index e9e7fb01f1ad51b11d2a8552844303e34613c2de..46c1812c99ff6d4f3f9f51bc9c3044d1bba94189 100644 (file)
@@ -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 <<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])])
 
 
 
@@ -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 <<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,
@@ -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],
index c8462ff15688afacd6c9dac30432e4c2946f6be1..54d74c25c6418d3113c400ab5aab699b312ab858 100644 (file)
@@ -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"
index e9e7fb01f1ad51b11d2a8552844303e34613c2de..46c1812c99ff6d4f3f9f51bc9c3044d1bba94189 100644 (file)
@@ -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 <<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])])
 
 
 
@@ -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 <<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,
@@ -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],
index c8462ff15688afacd6c9dac30432e4c2946f6be1..54d74c25c6418d3113c400ab5aab699b312ab858 100644 (file)
@@ -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"