Autoreconf -Wall complains about obsolete macros, so replace them according to
the autoconf documentation[0].

This patch doesn't fully fix all warnings because I focused on doing simple
fixes and keeping the changes to the generated files to a minimum.

Bootstrapped and retested on x86_64-linux-gnu.

[0]: 
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html

        PR bootstrap/103459

ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
        Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.  Replace AC_TRY_LINK with
        AC_LINK_IFELSE.

c++tools/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.

config/ChangeLog:

        * acx.m4: Remove uses of AC_CHECK_TOOL_PREFIX.  Replace AC_TRY_COMPILE
        with AC_COMPILE_IFELSE.
        * asmcfi.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
        * bitfields.m4: Likewise.
        * cet.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.  Replace AC_TRY_RUN
        with AC_RUN_IFELSE.
        * codeset.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
        * enable.m4: Replace AC_HELP_STRING with AS_HELP_STRING.
        * gcc-plugin.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
        * hwcaps.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.  Replace
        AC_TRY_LINK with AC_LINK_IFELSE.
        * isl.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
        * lcmessage.m4:Replace AC_TRY_LINK with AC_LINK_IFELSE.
        * lthostflags.m4: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_HOST.
        * no-executables.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
        Replace AC_TRY_LINK with AC_LINK_IFELSE.
        * po.m4: Replace AC_OUTPUT_COMMANDS with AC_CONFIG_COMMANDS.
        * tls.m4: Add explicit 4th argument to AC_LINK_IFELSE.

fixincludes/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.

gcc/ChangeLog:

        * acinclude.m4: Replace AC_FOREACH with m4_foreach_w.  Replace
        AC_TRY_LINK with AC_LINK_IFELSE.
        * configure: Regenerate.
        * configure.ac: Replace AC_HELP_STRING with AS_HELP_STRING.  Replace
        AC_PROG_LIBTOOL with LT_INIT.

gnattools/ChangeLog:

        * configure.ac: Replace AC_HELP_STRING with AS_HELP_STRING.

gotools/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.

libada/ChangeLog:

        * configure.ac: Replace AC_HELP_STRING with AS_HELP_STRING.

libatomic/ChangeLog:

        * acinclude.m4: Replace AC_ERROR with AS_MSG_ERROR.  Replace AC_TRY_LINK
        with AC_LINK_IFELSE.  Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
        Replace AC_TRY_RUN with AC_RUN_IFELSE.
        * configure.ac: Replace AM_PROG_LIBTOOL with LT_INIT.  Replace
        AC_STDC_HEADERS with AC_HEADER_STDC.

libbacktrace/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
        Remove redundant AM_PROG_LIBTOOL.

libcc1/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
        Remove redundant AM_PROG_LIBTOOL.

libcpp/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
        Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.

libgcc/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_HELP_STRING with AS_HELP_STRING.  Replace
        AC_TRY_COMPILE with AC_COMPILE_IFELSE.

libgcobol/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Remove redundant AM_PROG_LIBTOOL.

libgfortran/ChangeLog:

        * acinclude.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
        * configure.ac: Replace AC_LANG_C with AC_LANG([C]).  Replace
        AM_PROG_LIBTOOL with LT_INIT.

libgm2/ChangeLog:

        * acinclude.m4: Replace AC_HELP_STRING with AS_HELP_STRING.  Replace
        AC_LANG_SAVE AC_LANG_CPLUSPLUS (...) AC_LANG_RESTORE with
        AC_LANG_PUSH([C++]) (...) AC_LANG_POP([C++]).  Replace AC_TRY_LINK with
        AC_LINK_IFELSE.  Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
        * configure: Regenerate.
        * configure.ac: Replace AC_HELP_STRING AS_HELP_STRING.  Remove redundant
        AM_PROG_LIBTOOL.  Replace AC_LANG_C with AC_LANG([C]).  Replace
        AC_FOREACH with m4_foreach_w.

libgomp/ChangeLog:

        * acinclude.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.  Replace
        AC_TRY_COMPILE with AC_COMPILE_IFELSE.  Replace AC_HELP_STRING with
        AS_HELP_STRING.  Replace AC_TRY_RUN with AC_RUN_IFELSE.
        * configure: Regenerate.
        * configure.ac: Replace AM_PROG_LIBTOOL with LT_INIT.  Replace
        AC_STDC_HEADERS with AC_HEADER_STDC.  Replace _AC_COMPUTE_INT with
        AC_COMPUTE_INT.

libgrust/ChangeLog:

        * configure.ac: Replace AC_FOREACH with m4_foreach_w.

libiberty/ChangeLog:

        * acinclude.m4: Replace AC_TRY_RUN with AC_RUN_IFELSE.  Replace
        AC_TRY_COMPILE with AC_COMPILE_IFELSE.
        * configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE. Replace
        AC_ISC_POSIX with AC_SEARCH_LIBS([strerror],[cposix]).

libitm/ChangeLog:

        * acinclude.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.  Replace
        AC_TRY_COMPILE with AC_COMPILE_IFELSE.  Replace AC_HELP_STRING with
        AS_HELP_STRING.  Replace AC_TRY_RUN with AC_RUN_IFELSE.
        * configure.ac: Replace AM_PROG_LIBTOOL with LT_INIT.  Replace
        AC_STDC_HEADERS with AC_HEADER_STDC.

libobjc/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
        Replace AM_PROG_LIBTOOL with LT_INIT. Remove unnecessary escape in
        double quoted string.

libphobos/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET.
        Remove redundant AM_PROG_LIBTOOL.  Replace AC_FOREACH with m4_foreach_w.
        * m4/druntime.m4: Replace AC_HELP_STRING AS_HELP_STRING.  Replace
        AC_TRY_COMPILE with AC_COMPILE_IFELSE.
        * m4/druntime/cpu.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
        * m4/druntime/os.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.

libquadmath/ChangeLog:

        * configure.ac: Replace AM_PROG_LIBTOOL with LT_INIT.  Replace
        AC_LANG_C with AC_LANG([C]).  Replace AC_TRY_COMPILE with
        AC_COMPILE_IFELSE.  Replace AC_TRY_LINK with AC_LINK_IFELSE.

libsanitizer/ChangeLog:

        * configure.ac: Replace AM_PROG_LIBTOOL with LT_INIT.  Replace
        AC_TRY_COMPILE with AC_COMPILE_IFELSE.  Replace AC_FOREACH with
        m4_foreach_w.

libssp/ChangeLog:

        * configure.ac: Replace AC_LANG_C with AC_LANG([C]).  Replace
        AC_TRY_COMPILE with AC_COMPILE_IFELSE.  Replace AC_TRY_LINK with
        AC_LINK_IFELSE.  Replace AM_PROG_LIBTOOL with LT_INIT.

libvtv/ChangeLog:

        * configure.ac: Replace AC_GNU_SOURCE with AC_USE_SYSTEM_EXTENSIONS.
        Replace AM_PROG_LIBTOOL with LT_INIT.  Replace AC_FOREACH with
        m4_foreach_w.

lto-plugin/ChangeLog:

        * configure: Regenerate.
        * configure.ac: Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_SYSTEM.
        Replace AC_TRY_LINK with AC_LINK_IFELSE. Replace AM_PROG_LIBTOOL with
        LT_INIT.

Signed-off-by: Pietro Monteiro <pie...@sociotechnical.xyz>
---
 c++tools/configure           |  1 -
 c++tools/configure.ac        |  2 +-
 config/acx.m4                | 11 ++--
 config/asmcfi.m4             |  8 +--
 config/bitfields.m4          | 10 ++--
 config/cet.m4                | 18 ++++---
 config/codeset.m4            |  8 +--
 config/enable.m4             |  2 +-
 config/gcc-plugin.m4         |  4 +-
 config/hwcaps.m4             |  6 ++-
 config/isl.m4                |  4 +-
 config/lcmessage.m4          |  3 +-
 config/lthostflags.m4        |  2 +-
 config/no-executables.m4     |  6 +--
 config/po.m4                 |  8 +--
 config/tls.m4                |  6 ++-
 configure                    |  4 --
 configure.ac                 | 32 ++++++------
 fixincludes/configure        |  1 -
 fixincludes/configure.ac     |  2 +-
 gcc/acinclude.m4             |  9 ++--
 gcc/configure                | 13 ++---
 gcc/configure.ac             | 10 ++--
 gnattools/configure.ac       |  2 +-
 gotools/configure            |  1 -
 gotools/configure.ac         |  2 +-
 libada/configure.ac          |  4 +-
 libatomic/acinclude.m4       | 39 ++++++++------
 libatomic/configure.ac       |  4 +-
 libbacktrace/configure       |  6 +--
 libbacktrace/configure.ac    |  3 +-
 libcc1/configure             |  6 +--
 libcc1/configure.ac          |  3 +-
 libcpp/configure             |  7 ++-
 libcpp/configure.ac          | 12 ++---
 libgcc/configure             |  3 +-
 libgcc/configure.ac          | 16 +++---
 libgcobol/configure          |  1 -
 libgcobol/configure.ac       |  1 -
 libgfortran/acinclude.m4     | 12 ++---
 libgfortran/configure.ac     |  4 +-
 libgm2/acinclude.m4          | 78 ++++++++++++++--------------
 libgm2/configure             |  7 +--
 libgm2/configure.ac          |  7 ++-
 libgomp/acinclude.m4         | 52 ++++++++++++-------
 libgomp/configure            | 11 ----
 libgomp/configure.ac         | 28 +++++-----
 libgrust/configure.ac        |  2 +-
 libiberty/acinclude.m4       | 35 ++++++-------
 libiberty/configure.ac       | 32 ++++++------
 libitm/acinclude.m4          | 99 +++++++++++++++++++++++-------------
 libitm/configure.ac          |  4 +-
 libobjc/configure            |  5 +-
 libobjc/configure.ac         |  8 +--
 libphobos/configure          |  6 +--
 libphobos/configure.ac       |  5 +-
 libphobos/m4/druntime.m4     |  8 +--
 libphobos/m4/druntime/cpu.m4 | 24 ++++-----
 libphobos/m4/druntime/os.m4  | 10 ++--
 libquadmath/configure.ac     | 42 ++++++++-------
 libsanitizer/configure.ac    | 14 ++---
 libssp/configure.ac          | 22 +++++---
 libvtv/configure.ac          |  8 +--
 lto-plugin/configure         |  5 +-
 lto-plugin/configure.ac      | 14 +++--
 65 files changed, 428 insertions(+), 394 deletions(-)

diff --git a/c++tools/configure b/c++tools/configure
index 1353479beca..1c210410b5c 100755
--- a/c++tools/configure
+++ b/c++tools/configure
@@ -2182,7 +2182,6 @@ test -n "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
-
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
 # incompatible versions:
diff --git a/c++tools/configure.ac b/c++tools/configure.ac
index db34ee678e0..deb1d0daec9 100644
--- a/c++tools/configure.ac
+++ b/c++tools/configure.ac
@@ -30,7 +30,7 @@ AC_CONFIG_SRCDIR([server.cc])
 # Determine the noncanonical names used for directories.
 ACX_NONCANONICAL_TARGET
 
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 AC_PROG_INSTALL
 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 AC_SUBST(INSTALL_PROGRAM)
diff --git a/config/acx.m4 b/config/acx.m4
index c45e55e7f51..d12a36cf4b2 100644
--- a/config/acx.m4
+++ b/config/acx.m4
@@ -389,8 +389,7 @@ ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR
 # Sets the shell variable have_gnat to yes or no as appropriate, and
 # substitutes GNATBIND and GNATMAKE.
 AC_DEFUN([ACX_PROG_GNAT],
-[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
-AC_REQUIRE([AC_PROG_CC])
+[AC_REQUIRE([AC_PROG_CC])
 AC_CHECK_TOOL(GNATBIND, gnatbind, no)
 AC_CHECK_TOOL(GNATMAKE, gnatmake, no)
 AC_CACHE_CHECK([whether compiler driver understands Ada and is recent enough],
@@ -436,8 +435,7 @@ fi])
 
 # Test for D.
 AC_DEFUN([ACX_PROG_GDC],
-[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
-AC_REQUIRE([AC_PROG_CC])
+[AC_REQUIRE([AC_PROG_CC])
 AC_CHECK_TOOL(GDC, gdc, no)
 AC_CACHE_CHECK([whether the D compiler works],
                 acx_cv_d_compiler_works,
@@ -494,8 +492,9 @@ dnl See whether we can include both string.h and strings.h.
 AC_DEFUN([ACX_HEADER_STRING],
 [AC_CACHE_CHECK([whether string.h and strings.h may both be included],
   gcc_cv_header_string,
-[AC_TRY_COMPILE([#include <string.h>
-#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>
+#include <strings.h>]], [[]])],
+                  [gcc_cv_header_string=yes], [gcc_cv_header_string=no])])
 if test $gcc_cv_header_string = yes; then
   AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both 
<string.h> and <strings.h>.])
 fi
diff --git a/config/asmcfi.m4 b/config/asmcfi.m4
index a725aa11de4..dc15edb2701 100644
--- a/config/asmcfi.m4
+++ b/config/asmcfi.m4
@@ -4,12 +4,14 @@ AC_DEFUN([GCC_AS_CFI_PSEUDO_OP],
 [AC_CACHE_CHECK([assembler .cfi pseudo-op support],
     gcc_cv_as_cfi_pseudo_op, [
     gcc_cv_as_cfi_pseudo_op=unknown
-    AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],,
-                  [gcc_cv_as_cfi_pseudo_op=yes],
-                  [gcc_cv_as_cfi_pseudo_op=no])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[asm 
(".cfi_startproc\n\t.cfi_endproc");]],
+                                     [[]])],
+                     [gcc_cv_as_cfi_pseudo_op=yes],
+                     [gcc_cv_as_cfi_pseudo_op=no])
  ])
  if test "x$gcc_cv_as_cfi_pseudo_op" = xyes; then
     AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1,
              [Define if your assembler supports .cfi_* directives.])
  fi
 ])
+\
diff --git a/config/bitfields.m4 b/config/bitfields.m4
index 8185cd302a9..1d6e30243c3 100644
--- a/config/bitfields.m4
+++ b/config/bitfields.m4
@@ -12,11 +12,13 @@ AC_DEFUN([gt_BITFIELD_TYPE_MATTERS],
 [
   AC_CACHE_CHECK([if the type of bitfields matters], 
gt_cv_bitfield_type_matters,
   [
-    AC_TRY_COMPILE(
-      [struct foo1 { char x; char y:1; char z; };
+    AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([[struct foo1 { char x; char y:1; char z; };
 struct foo2 { char x; long long int y:1; char z; };
-int foo1test[ sizeof (struct foo1) < sizeof (struct foo2) ? 1 : -1 ]; ],
-      [], gt_cv_bitfield_type_matters=yes, gt_cv_bitfield_type_matters=no)
+int foo1test[ sizeof (struct foo1) < sizeof (struct foo2) ? 1 : -1 ]; ]],
+                      [[]])],
+      [gt_cv_bitfield_type_matters=yes],
+      [gt_cv_bitfield_type_matters=no])
   ])
   if test $gt_cv_bitfield_type_matters = yes; then
     AC_DEFINE(HAVE_BITFIELD_TYPE_MATTERS, 1,
diff --git a/config/cet.m4 b/config/cet.m4
index 7718be1afe8..69f75fd673f 100644
--- a/config/cet.m4
+++ b/config/cet.m4
@@ -121,27 +121,28 @@ cet_save_LDFLAGS="$LDFLAGS"
 LDFLAGS="$LDFLAGS -Wl,-z,ibt,-z,shstk"
 if test x$may_have_cet = xyes; then
   # Check whether -fcf-protection=none -Wl,-z,ibt,-z,shstk work.
-  AC_TRY_LINK(
-    [],[return 0;],
+  AC_LINK_IFELSE([AC_LANG_PROGRAM(
+    [[]],[[return 0;]])],
     [may_have_cet=yes],
     [may_have_cet=no])
 fi
 
 if test x$may_have_cet = xyes; then
   if test x$cross_compiling = xno; then
-    AC_TRY_RUN([
+    AC_RUN_IFELSE([AC_LANG_SOURCE([[
 int
 main ()
 {
   asm ("endbr32");
   return 0;
 }
-    ],
+    ]])],
     [have_multi_byte_nop=yes],
-    [have_multi_byte_nop=no])
+    [have_multi_byte_nop=no],
+    [AC_MSG_FAILURE(cannot run test program while cross compiling)])
     have_cet=no
     if test x$have_multi_byte_nop = xyes; then
-      AC_TRY_RUN([
+      AC_RUN_IFELSE([AC_LANG_SOURCE([[
 static void
 foo (void)
 {
@@ -167,9 +168,10 @@ main ()
   bar ();
   return 0;
 }
-      ],
+      ]])],
       [have_cet=no],
-      [have_cet=yes])
+      [have_cet=yes],
+      [AC_MSG_FAILURE(cannot run test program while cross compiling)])
     fi
     if test x$enable_cet = xno -a x$have_cet = xyes; then
       AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host])
diff --git a/config/codeset.m4 b/config/codeset.m4
index 59535ebcff5..2469319e680 100644
--- a/config/codeset.m4
+++ b/config/codeset.m4
@@ -11,10 +11,10 @@ dnl From Bruno Haible.
 AC_DEFUN([AM_LANGINFO_CODESET],
 [
   AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
-    [AC_TRY_LINK([#include <langinfo.h>],
-      [char* cs = nl_langinfo(CODESET);],
-      am_cv_langinfo_codeset=yes,
-      am_cv_langinfo_codeset=no)
+    [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
+      [[char* cs = nl_langinfo(CODESET);]])],
+      [am_cv_langinfo_codeset=yes],
+      [am_cv_langinfo_codeset=no])
     ])
   if test $am_cv_langinfo_codeset = yes; then
     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
diff --git a/config/enable.m4 b/config/enable.m4
index 88b29b8aa7f..c63f39454fc 100644
--- a/config/enable.m4
+++ b/config/enable.m4
@@ -11,7 +11,7 @@ dnl See docs/html/17_intro/configury.html#enable for 
documentation.
 dnl
 AC_DEFUN([GCC_ENABLE],[dnl
 m4_define([_g_switch],[--enable-$1])dnl
-m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
+m4_define([_g_help],[AS_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
  AC_ARG_ENABLE($1,_g_help,
   m4_bmatch([$5],
    [^permit ],
diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
index c30cfdd8fad..b2dd41d62e8 100644
--- a/config/gcc-plugin.m4
+++ b/config/gcc-plugin.m4
@@ -107,8 +107,8 @@ AC_DEFUN([GCC_ENABLE_PLUGINS],
        ;;
      esac
      AC_MSG_CHECKING([for -fPIC -shared])
-     AC_TRY_LINK(
-       [extern int X;],[return X == 0;],
+     AC_LINK_IFELSE([AC_LANG_PROGRAM(
+       [[extern int X;]],[[return X == 0;]])],
        [AC_MSG_RESULT([yes]); have_pic_shared=yes],
        [AC_MSG_RESULT([no]); have_pic_shared=no])
      if test x"$have_pic_shared" != x"yes" -o x"$ac_cv_search_dlopen" = x"no"; 
then
diff --git a/config/hwcaps.m4 b/config/hwcaps.m4
index 33f090574cf..f3d03906447 100644
--- a/config/hwcaps.m4
+++ b/config/hwcaps.m4
@@ -17,7 +17,8 @@ AC_DEFUN([GCC_CHECK_ASSEMBLER_HWCAP], [
       CFLAGS="$CFLAGS -Wa,-nH"
 
       AC_MSG_CHECKING([for as that supports -Wa,-nH])
-      AC_TRY_COMPILE([], [return 0;], [ac_hwcap_flags=yes],[ac_hwcap_flags=no])
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],
+                       [ac_hwcap_flags=yes],[ac_hwcap_flags=no])
       if test "$ac_hwcap_flags" = "yes"; then
        HWCAP_CFLAGS="-Wa,-nH $HWCAP_CFLAGS"
       fi
@@ -47,7 +48,8 @@ AC_DEFUN([GCC_CHECK_LINKER_HWCAP], [
   LDFLAGS="$LFLAGS -mclear-hwcap"
 
   AC_MSG_CHECKING([for -mclear-hwcap])
-  AC_TRY_LINK([], [return 0;], [ac_hwcap_ldflags=yes],[ac_hwcap_ldflags=no])
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],
+                [ac_hwcap_ldflags=yes],[ac_hwcap_ldflags=no])
   if test "$ac_hwcap_ldflags" = "yes"; then
     HWCAP_LDFLAGS="-mclear-hwcap $HWCAP_LDFLAGS"
   fi
diff --git a/config/isl.m4 b/config/isl.m4
index bbb973e023b..4d943d034a4 100644
--- a/config/isl.m4
+++ b/config/isl.m4
@@ -107,8 +107,8 @@ AC_DEFUN([ISL_CHECK_VERSION],
     LIBS="${_isl_saved_LIBS} -lisl -lgmp"
 
     AC_MSG_CHECKING([for isl 0.15 or later])
-    AC_TRY_LINK([#include <isl/schedule.h>],
-                [isl_options_set_schedule_serialize_sccs (NULL, 0);],
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <isl/schedule.h>]],
+                [[isl_options_set_schedule_serialize_sccs (NULL, 0);]])],
                 [gcc_cv_isl=yes],
                 [gcc_cv_isl=no])
     AC_MSG_RESULT([$gcc_cv_isl])
diff --git a/config/lcmessage.m4 b/config/lcmessage.m4
index 62a9186af2f..0b4dfe68d15 100644
--- a/config/lcmessage.m4
+++ b/config/lcmessage.m4
@@ -23,7 +23,8 @@ dnl   Ulrich Drepper <drep...@cygnus.com>, 1995.
 AC_DEFUN([AM_LC_MESSAGES],
 [
   AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
-    [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+    [AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[#include <locale.h>]], [[return LC_MESSAGES]])],
        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
   if test $am_cv_val_LC_MESSAGES = yes; then
     AC_DEFINE(HAVE_LC_MESSAGES, 1,
diff --git a/config/lthostflags.m4 b/config/lthostflags.m4
index bc0f59ee79e..4a389a75ea8 100644
--- a/config/lthostflags.m4
+++ b/config/lthostflags.m4
@@ -10,7 +10,7 @@ dnl Defines and AC_SUBSTs lt_host_flags
 
 
 AC_DEFUN([ACX_LT_HOST_FLAGS], [
-AC_REQUIRE([AC_CANONICAL_SYSTEM])
+AC_REQUIRE([AC_CANONICAL_HOST])
 
 case $host in
   *-cygwin* | *-mingw*)
diff --git a/config/no-executables.m4 b/config/no-executables.m4
index 6842f84fba3..c40d81725ca 100644
--- a/config/no-executables.m4
+++ b/config/no-executables.m4
@@ -62,10 +62,10 @@ fi)
 m4_divert_pop()dnl
 ])# GCC_NO_EXECUTABLES
 
-# Use the strongest available test out of AC_TRY_COMPILE and AC_TRY_LINK.
+# Use the strongest available test out of AC_COMPILE_IFELSE and AC_LINK_IFELSE
 AC_DEFUN([GCC_TRY_COMPILE_OR_LINK],
 [if test x$gcc_no_link = xyes; then
-  AC_TRY_COMPILE([$1], [$2], [$3], [$4])
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])],[$3],[$4])
 else
-  AC_TRY_LINK([$1], [$2], [$3], [$4])
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])],[$3],[$4])
 fi])
diff --git a/config/po.m4 b/config/po.m4
index 6ceef420f10..7948c51a1c1 100644
--- a/config/po.m4
+++ b/config/po.m4
@@ -86,7 +86,7 @@ AC_DEFUN([AM_PO_SUBDIRS],
     rm -f messages.po
   fi
 
-  AC_OUTPUT_COMMANDS([
+  AC_CONFIG_COMMANDS([posubdirs], [[
     for ac_file in $CONFIG_FILES; do
       # Support "outfile[:infile[:infile...]]"
       case "$ac_file" in
@@ -186,12 +186,12 @@ AC_DEFUN([AM_PO_SUBDIRS],
         fi
         ;;
       esac
-    done],
-   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
+    done]],
+   [[# Capture the value of obsolete ALL_LINGUAS because we need it to compute
     # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
     # from automake.
     eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
     # Capture the value of LINGUAS because we need it to compute CATALOGS.
     LINGUAS="${LINGUAS-%UNSET%}"
-   ])
+   ]])
 ])
diff --git a/config/tls.m4 b/config/tls.m4
index 7532305b908..b2c58e06df4 100644
--- a/config/tls.m4
+++ b/config/tls.m4
@@ -12,7 +12,8 @@ AC_DEFUN([GCC_CHECK_TLS], [
       LDFLAGS="-static $LDFLAGS"
       AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
        [AC_RUN_IFELSE([AC_LANG_SOURCE([__thread int a; int b; int main() { 
return a = b; }])],
-                      [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no],[])],
+                      [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no],
+                      [AC_MSG_FAILURE(cannot run test program while cross 
compiling)])],
        [gcc_cv_have_tls=yes])
       LDFLAGS="$chktls_save_LDFLAGS"
       if test $gcc_cv_have_tls = yes; then
@@ -64,7 +65,8 @@ AC_DEFUN([GCC_CHECK_TLS], [
                if (pthread_join (thread, &thread_retval))
                  return 0;
                return (a_in_other_thread == a_in_main_thread);])],
-            [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no], [])
+               [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no],
+               [AC_MSG_FAILURE(cannot run test program while cross compiling)])
          CFLAGS="$chktls_save_CFLAGS"
        fi
       fi],
diff --git a/configure b/configure
index ebc44416b6c..6ed30f092fb 100755
--- a/configure
+++ b/configure
@@ -2536,7 +2536,6 @@ test -n "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
-
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
 # Use a double $ so make ignores it.
@@ -5558,8 +5557,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 fi
 
 
-
-
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a 
program name with args.
 set dummy ${ac_tool_prefix}gnatbind; ac_word=$2
@@ -5781,7 +5778,6 @@ else
 fi
 
 
-
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gdc", so it can be a program 
name with args.
 set dummy ${ac_tool_prefix}gdc; ac_word=$2
diff --git a/configure.ac b/configure.ac
index 730db3c1402..7b14ced34b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,7 +77,7 @@ test "$host_noncanonical" = "$target_noncanonical" &&
     NONENONEs,x,x, &&
   program_transform_name=s,y,y,
 
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 AC_ARG_PROGRAM
 
 m4_pattern_allow([^AS_FOR_TARGET$])dnl
@@ -1772,36 +1772,36 @@ if test "x$require_gmp" = xyes && test "x$have_gmp" = 
xno; then
   CFLAGS="$CFLAGS $gmpinc"
   # Check for the recommended and required versions of GMP.
   AC_MSG_CHECKING([for the correct version of gmp.h])
-  AC_TRY_COMPILE([#include "gmp.h"],[
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "gmp.h"]], [[
   #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
   #define GCC_GMP_VERSION 
GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
   #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,3)
   choke me
   #endif
-  ], [AC_TRY_COMPILE([#include <gmp.h>],[
+  ]])], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>]], [[
   #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
   #define GCC_GMP_VERSION 
GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
   #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
   choke me
   #endif
-  ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
+  ]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
    [AC_MSG_RESULT([no]); have_gmp=no])
 
   # If we have GMP, check the MPFR version.
   if test x"$have_gmp" = xyes; then
     # Check for the recommended and required versions of MPFR.
     AC_MSG_CHECKING([for the correct version of mpfr.h])
-    AC_TRY_COMPILE([#include <gmp.h>
-    #include <mpfr.h>],[
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>
+    #include <mpfr.h>]], [[
     #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0)
     choke me
     #endif
-    ], [AC_TRY_COMPILE([#include <gmp.h>
-    #include <mpfr.h>],[
+    ]])], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>
+    #include <mpfr.h>]], [[
     #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,6)
     choke me
     #endif
-    ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
+    ]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
      [AC_MSG_RESULT([no]); have_gmp=no])
   fi
 
@@ -1809,15 +1809,15 @@ if test "x$require_gmp" = xyes && test "x$have_gmp" = 
xno; then
   if test "x$require_mpc" = xyes && test x"$have_gmp" = xyes ; then
     # Check for the recommended and required versions of MPC.
     AC_MSG_CHECKING([for the correct version of mpc.h])
-    AC_TRY_COMPILE([#include <mpc.h>],[
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mpc.h>]], [[
     #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
     choke me
     #endif
-    ], [AC_TRY_COMPILE([#include <mpc.h>],[
+    ]])], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mpc.h>]], [[
     #if MPC_VERSION < MPC_VERSION_NUM(0,8,1)
     choke me
     #endif
-    ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
+    ]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
      [AC_MSG_RESULT([no]); have_gmp=no])
   fi
 
@@ -1826,7 +1826,7 @@ if test "x$require_gmp" = xyes && test "x$have_gmp" = 
xno; then
     saved_LIBS="$LIBS"
     LIBS="$LIBS $gmplibs"
     AC_MSG_CHECKING([for the correct version of the gmp/mpfr libraries])
-    AC_TRY_LINK([#include <mpfr.h>],[
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpfr.h>]], [[
     mpfr_t n;
     mpfr_t x;
     int t;
@@ -1837,7 +1837,7 @@ if test "x$require_gmp" = xyes && test "x$have_gmp" = 
xno; then
     mpfr_subnormalize (x, t, MPFR_RNDN);
     mpfr_clear(n);
     mpfr_clear(x);
-    ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
+    ]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
     LIBS="$saved_LIBS"
   fi
 
@@ -1846,7 +1846,7 @@ if test "x$require_gmp" = xyes && test "x$have_gmp" = 
xno; then
     saved_LIBS="$LIBS"
     LIBS="$LIBS $gmplibs"
     AC_MSG_CHECKING([for the correct version of the mpc libraries])
-    AC_TRY_LINK([#include <mpc.h>],[
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpc.h>]], [[
     mpc_t c;
     mpc_init2 (c, 53);
     mpc_set_ui_ui (c, 1, 1, MPC_RNDNN);
@@ -1854,7 +1854,7 @@ if test "x$require_gmp" = xyes && test "x$have_gmp" = 
xno; then
     mpc_pow (c, c, c, MPC_RNDNN);
     mpc_acosh (c, c, MPC_RNDNN);
     mpc_clear (c);
-    ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
+    ]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
     LIBS="$saved_LIBS"
   fi
 
diff --git a/fixincludes/configure b/fixincludes/configure
index 662c94dc112..3e572537c3d 100755
--- a/fixincludes/configure
+++ b/fixincludes/configure
@@ -3308,7 +3308,6 @@ test -n "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
diff --git a/fixincludes/configure.ac b/fixincludes/configure.ac
index 4e78511d20f..30bef64b5ec 100644
--- a/fixincludes/configure.ac
+++ b/fixincludes/configure.ac
@@ -3,7 +3,7 @@ AC_INIT(fixincludes, [ ])
 AC_CONFIG_SRCDIR(inclhack.def)
 AC_CONFIG_AUX_DIR(..)
 m4_sinclude(../libtool.m4)
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 AC_PROG_CC
 AC_USE_SYSTEM_EXTENSIONS
 AC_PROG_SED
diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
index ca4820221d5..10416578fad 100644
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -41,7 +41,7 @@ dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as 
appropriate.
 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
 dnl    [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
 AC_DEFUN([gcc_AC_CHECK_DECLS],
-[AC_FOREACH([gcc_AC_Func], [$1],
+[m4_foreach_w([gcc_AC_Func], [$1],
   [AH_TEMPLATE(AS_TR_CPP(HAVE_DECL_[]gcc_AC_Func),
   [Define to 1 if we found a declaration for ']gcc_AC_Func[', otherwise
    define to 0.])])dnl
@@ -447,10 +447,11 @@ AC_DEFUN([gcc_CHECK_ATTRIBUTE_ALIAS], [
   AC_CACHE_CHECK([whether the host/build supports symbol aliases],
                  gcc_cv_have_attribute_alias, [
   if test "x${build}" = "x${host}"; then
-    AC_TRY_LINK([
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 extern "C" void foo(void) { }
-extern void bar(void) __attribute__((alias("foo")));],
-    [bar();], gcc_cv_have_attribute_alias=yes, gcc_cv_have_attribute_alias=no)
+extern void bar(void) __attribute__((alias("foo")));]],
+    [[bar();]])],
+    [gcc_cv_have_attribute_alias=yes], [gcc_cv_have_attribute_alias=no])
   else
     gcc_cv_have_attribute_alias=no
   fi])
diff --git a/gcc/configure b/gcc/configure
index 776b0628c60..ff3ccb23c84 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -5126,8 +5126,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS 
$LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-
-
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a 
program name with args.
 set dummy ${ac_tool_prefix}gnatbind; ac_word=$2
@@ -5349,7 +5347,6 @@ else
 fi
 
 
-
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gdc", so it can be a program 
name with args.
 set dummy ${ac_tool_prefix}gdc; ac_word=$2
@@ -13771,7 +13768,7 @@ $as_echo "found xgettext program is not GNU xgettext; 
ignore it" >&6; }
         rm -f messages.po
   fi
 
-  ac_config_commands="$ac_config_commands default-1"
+  ac_config_commands="$ac_config_commands posubdirs"
 
 
 
@@ -21520,7 +21517,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21523 "configure"
+#line 21520 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -21626,7 +21623,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21629 "configure"
+#line 21626 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -35782,7 +35779,7 @@ do
     "auto-host.h") CONFIG_HEADERS="$CONFIG_HEADERS auto-host.h:config.in" ;;
     "depdir") CONFIG_COMMANDS="$CONFIG_COMMANDS depdir" ;;
     "gccdepdir") CONFIG_COMMANDS="$CONFIG_COMMANDS gccdepdir" ;;
-    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+    "posubdirs") CONFIG_COMMANDS="$CONFIG_COMMANDS posubdirs" ;;
     "as") CONFIG_FILES="$CONFIG_FILES as:exec-tool.in" ;;
     "collect-ld") CONFIG_FILES="$CONFIG_FILES collect-ld:exec-tool.in" ;;
     "nm") CONFIG_FILES="$CONFIG_FILES nm:exec-tool.in" ;;
@@ -36423,7 +36420,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
   do
       ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
   done ;;
-    "default-1":C)
+    "posubdirs":C)
     for ac_file in $CONFIG_FILES; do
       # Support "outfile[:infile[:infile...]]"
       case "$ac_file" in
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b6db9edfc83..70130424f73 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -294,7 +294,7 @@ elif test "${with_sysroot+set}" = set; then
 fi
 
 AC_ARG_WITH(cpp_install_dir,
-[AC_HELP_STRING([--with-cpp-install-dir=DIR],
+[AS_HELP_STRING([--with-cpp-install-dir=DIR],
                 [install the user visible C preprocessor in DIR
                  (relative to PREFIX) as well as PREFIX/bin])],
 [if test x$withval = xyes; then
@@ -2662,7 +2662,7 @@ 
AC_DEFINE_UNQUOTED(LTOPLUGINSONAME,"${host_lto_plugin_soname}",
 # exec-tool will fail.
 
 m4_defun([_LT_CONFIG_COMMANDS], [])
-AC_PROG_LIBTOOL
+LT_INIT
 AC_SUBST(objdir)
 AC_SUBST(enable_fast_install)
 
@@ -7683,7 +7683,7 @@ fi
 
 # Specify what hash style to use by default.
 AC_ARG_WITH([linker-hash-style],
-[AC_HELP_STRING([--with-linker-hash-style={sysv,gnu,both}],
+[AS_HELP_STRING([--with-linker-hash-style={sysv,gnu,both}],
                 [specify the linker hash style])],
 [case x"$withval" in
    xsysv)
@@ -7707,7 +7707,7 @@ fi
 
 # Specify what should be the default of -fdiagnostics-color option.
 AC_ARG_WITH([diagnostics-color],
-[AC_HELP_STRING([--with-diagnostics-color={never,auto,auto-if-env,always}],
+[AS_HELP_STRING([--with-diagnostics-color={never,auto,auto-if-env,always}],
                 [specify the default of -fdiagnostics-color option
                  auto-if-env stands for -fdiagnostics-color=auto if
                  GCC_COLOR environment variable is present and
@@ -7735,7 +7735,7 @@ AC_DEFINE_UNQUOTED(DIAGNOSTICS_COLOR_DEFAULT, 
$DIAGNOSTICS_COLOR_DEFAULT,
 
 # Specify what should be the default of -fdiagnostics-urls option.
 AC_ARG_WITH([diagnostics-urls],
-[AC_HELP_STRING([--with-diagnostics-urls={never,auto,auto-if-env,always}],
+[AS_HELP_STRING([--with-diagnostics-urls={never,auto,auto-if-env,always}],
                 [specify the default of -fdiagnostics-urls option
                  auto-if-env stands for -fdiagnostics-urls=auto if
                  GCC_URLS or TERM_URLS environment variable is present and
diff --git a/gnattools/configure.ac b/gnattools/configure.ac
index 776530aee52..fa4abdad75c 100644
--- a/gnattools/configure.ac
+++ b/gnattools/configure.ac
@@ -25,7 +25,7 @@ AC_CONFIG_SRCDIR([Makefile.in])
 # Command-line options.
 # Very limited version of AC_MAINTAINER_MODE.
 AC_ARG_ENABLE([maintainer-mode],
-  [AC_HELP_STRING([--enable-maintainer-mode],
+  [AS_HELP_STRING([--enable-maintainer-mode],
                  [enable make rules and dependencies not useful (and
                   sometimes confusing) to the casual installer])],
   [case ${enable_maintainer_mode} in
diff --git a/gotools/configure b/gotools/configure
index ff71d2ae880..156ea0d0ec2 100755
--- a/gotools/configure
+++ b/gotools/configure
@@ -2104,7 +2104,6 @@ test -n "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
-
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
 # Use a double $ so make ignores it.
diff --git a/gotools/configure.ac b/gotools/configure.ac
index f0a73eca782..da5347541e5 100644
--- a/gotools/configure.ac
+++ b/gotools/configure.ac
@@ -32,7 +32,7 @@ test "$host_noncanonical" = "$target_noncanonical" &&
     NONENONEs,x,x, &&
   program_transform_name=s,y,y,
 
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 AC_ARG_PROGRAM
 
 AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dist -Wall -Wno-portability])
diff --git a/libada/configure.ac b/libada/configure.ac
index 54b9986c106..c910c6d0c60 100644
--- a/libada/configure.ac
+++ b/libada/configure.ac
@@ -56,7 +56,7 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
 
 # Very limited version of AC_MAINTAINER_MODE.
 AC_ARG_ENABLE([maintainer-mode],
-  [AC_HELP_STRING([--enable-maintainer-mode],
+  [AS_HELP_STRING([--enable-maintainer-mode],
                  [enable make rules and dependencies not useful (and
                   sometimes confusing) to the casual installer])],
   [case ${enable_maintainer_mode} in
@@ -122,7 +122,7 @@ m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
 AC_SUBST(CFLAGS)
 
 AC_ARG_ENABLE([shared],
-[AC_HELP_STRING([--disable-shared],
+[AS_HELP_STRING([--disable-shared],
                 [don't provide a shared libgnat])],
 [
 case $enable_shared in
diff --git a/libatomic/acinclude.m4 b/libatomic/acinclude.m4
index f35ab5b60a5..ce1b63769bc 100644
--- a/libatomic/acinclude.m4
+++ b/libatomic/acinclude.m4
@@ -180,7 +180,7 @@ AC_DEFUN([LIBAT_WORDSIZE],[
   AC_CACHE_CHECK([for the word size],[libat_cv_wordsize],
     [AC_COMPUTE_INT(libat_cv_wordsize,
       [sizeof(word)], [typedef int word __attribute__((mode(word)));],
-      AC_ERROR([Could not determine word size.]))])
+      AC_MSG_ERROR([Could not determine word size.]))])
   AC_DEFINE_UNQUOTED(WORDSIZE, $libat_cv_wordsize,
     [The word size in bytes of the machine.])
 ])
@@ -193,12 +193,12 @@ AC_DEFUN([LIBAT_CHECK_IFUNC], [
                 libat_cv_have_ifunc, [
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Werror"
-  AC_TRY_LINK([
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
     int foo_alt(void) { return 0; }
     typedef int F (void);
     F *foo_sel(void) { return foo_alt; }
-    int foo(void) __attribute__((ifunc("foo_sel")));],
-    [return foo();], libat_cv_have_ifunc=yes, libat_cv_have_ifunc=no)])
+    int foo(void) __attribute__((ifunc("foo_sel")));]],
+    [[return foo();]])], libat_cv_have_ifunc=yes, libat_cv_have_ifunc=no)])
   LIBAT_DEFINE_YESNO([HAVE_IFUNC], [$libat_cv_have_ifunc],
       [Define to 1 if the target supports __attribute__((ifunc(...))).])
 ])
@@ -212,8 +212,10 @@ AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_VISIBILITY], [
                 libat_cv_have_attribute_visibility, [
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Werror"
-  AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
-                [], libat_cv_have_attribute_visibility=yes,
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+                [[void __attribute__((visibility("hidden"))) foo(void) { }]],
+                [[]])],
+                libat_cv_have_attribute_visibility=yes,
                 libat_cv_have_attribute_visibility=no)
   CFLAGS="$save_CFLAGS"])
   if test $libat_cv_have_attribute_visibility = yes; then
@@ -227,8 +229,10 @@ AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_DLLEXPORT], [
                 libat_cv_have_attribute_dllexport, [
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Werror"
-  AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
-                [], libat_cv_have_attribute_dllexport=yes,
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+                [[void __attribute__((dllexport)) foo(void) { }]],
+                [[]])],
+                libat_cv_have_attribute_dllexport=yes,
                 libat_cv_have_attribute_dllexport=no)
   CFLAGS="$save_CFLAGS"])
   if test $libat_cv_have_attribute_dllexport = yes; then
@@ -240,10 +244,11 @@ dnl Check whether the target supports symbol aliases.
 AC_DEFUN([LIBAT_CHECK_ATTRIBUTE_ALIAS], [
   AC_CACHE_CHECK([whether the target supports symbol aliases],
                 libat_cv_have_attribute_alias, [
-  AC_TRY_LINK([
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 void foo(void) { }
-extern void bar(void) __attribute__((alias("foo")));],
-    [bar();], libat_cv_have_attribute_alias=yes, 
libat_cv_have_attribute_alias=no)])
+extern void bar(void) __attribute__((alias("foo")));]],
+    [[bar();]])],
+    libat_cv_have_attribute_alias=yes, libat_cv_have_attribute_alias=no)])
   if test $libat_cv_have_attribute_alias = yes; then
     AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
       [Define to 1 if the target supports __attribute__((alias(...))).])
@@ -262,7 +267,7 @@ dnl See docs/html/17_intro/configury.html#enable for 
documentation.
 dnl
 m4_define([LIBAT_ENABLE],[dnl
 m4_define([_g_switch],[--enable-$1])dnl
-m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
+m4_define([_g_help],[AS_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
  AC_ARG_ENABLE($1,_g_help,
   m4_bmatch([$5],
    [^permit ],
@@ -363,14 +368,14 @@ AC_DEFUN([LIBAT_CHECK_LINKER_FEATURES], [
     # .eh_frame and now some of the glibc sections for iconv).
     # Bzzzzt.  Thanks for playing, maybe next time.
     AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
-    AC_TRY_RUN([
+    AC_RUN_IFELSE([AC_LANG_SOURCE([[
      int main(void)
      {
        try { throw 1; }
        catch (...) { };
        return 0;
      }
-    ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
+    ]])], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], 
[ac_sectionLDflags=yes])
     if test "$ac_test_CFLAGS" = set; then
       CFLAGS="$ac_save_CFLAGS"
     else
@@ -457,7 +462,8 @@ if test $enable_symvers != no; then
   AC_MSG_CHECKING([for shared libgcc])
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=' -lgcc_s'
-  AC_TRY_LINK(, [return 0;], libat_shared_libgcc=yes, libat_shared_libgcc=no)
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],
+                [libat_shared_libgcc=yes], [libat_shared_libgcc=no])
   CFLAGS="$ac_save_CFLAGS"
   if test $libat_shared_libgcc = no; then
     cat > conftest.c <<EOF
@@ -472,7 +478,8 @@ changequote([,])dnl
     rm -f conftest.c conftest.so
     if test x${libat_libgcc_s_suffix+set} = xset; then
       CFLAGS=" -lgcc_s$libat_libgcc_s_suffix"
-      AC_TRY_LINK(, [return 0;], libat_shared_libgcc=yes)
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],
+                    [libat_shared_libgcc=yes],[])
       CFLAGS="$ac_save_CFLAGS"
     fi
   fi
diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index aafae71028d..7cdd1a8624a 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -149,7 +149,7 @@ AC_CHECK_TOOL(RANLIB, ranlib, 
ranlib-not-found-in-path-error)
 AC_PROG_INSTALL
 
 # Configure libtool
-AM_PROG_LIBTOOL
+LT_INIT
 ACX_LT_HOST_FLAGS
 AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
@@ -189,7 +189,7 @@ AC_DEFINE_UNQUOTED(IFUNC_RESOLVER_ARGS, 
$IFUNC_RESOLVER_ARGS,
 CFLAGS="$save_CFLAGS -fno-sync-libcalls $XCFLAGS"
 
 # Check header files.
-AC_STDC_HEADERS
+AC_HEADER_STDC
 ACX_HEADER_STRING
 GCC_HEADER_STDINT(gstdint.h)
 AC_CHECK_HEADERS([fenv.h])
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 85be043009a..de7416db9d2 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -2739,7 +2739,6 @@ test -n "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
-
 target_alias=${target_alias-$host_alias}
 
 # Expand $ac_aux_dir to an absolute path.
@@ -11636,7 +11635,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11639 "configure"
+#line 11638 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11742,7 +11741,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11745 "configure"
+#line 11744 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11980,7 +11979,6 @@ CC="$lt_save_CC"
 
 
 
-
  if test x$enable_darwin_at_rpath = xyes; then
   ENABLE_DARWIN_AT_RPATH_TRUE=
   ENABLE_DARWIN_AT_RPATH_FALSE='#'
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 6549cdeacf4..3edc3efb7c2 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -37,7 +37,7 @@ if test -n "${with_target_subdir}"; then
   AM_ENABLE_MULTILIB(, ..)
 fi
 
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 target_alias=${target_alias-$host_alias}
 
 AC_USE_SYSTEM_EXTENSIONS
@@ -82,7 +82,6 @@ AC_CHECK_PROG(DWZ, dwz, dwz)
 AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
 
 LT_INIT
-AM_PROG_LIBTOOL
 
 AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = 
xyes])
 
diff --git a/libcc1/configure b/libcc1/configure
index ea689a353c8..6d449806b9c 100755
--- a/libcc1/configure
+++ b/libcc1/configure
@@ -2563,7 +2563,6 @@ test -n "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
-
 # Expand $ac_aux_dir to an absolute path.
 am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
@@ -10890,7 +10889,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10893 "configure"
+#line 10892 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10996,7 +10995,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10999 "configure"
+#line 10998 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11233,7 +11232,6 @@ CC="$lt_save_CC"
 # Only expand once:
 
 
-
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
diff --git a/libcc1/configure.ac b/libcc1/configure.ac
index 87f157568e8..89e461f62f1 100644
--- a/libcc1/configure.ac
+++ b/libcc1/configure.ac
@@ -20,7 +20,7 @@ AC_INIT([libcc1], [version-unused])
 AC_CONFIG_SRCDIR([libcc1.cc])
 AC_CONFIG_HEADER(cc1plugin-config.h)
 
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 AC_USE_SYSTEM_EXTENSIONS
 # Determine the noncanonical target name, for directory use.
 ACX_NONCANONICAL_TARGET
@@ -36,7 +36,6 @@ AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define -Wall 
-Wno-portability])
 AM_MAINTAINER_MODE
 
 LT_INIT([disable-static])
-AM_PROG_LIBTOOL
 AC_PROG_CXX
 
 visibility=
diff --git a/libcpp/configure b/libcpp/configure
index e3c39f4d7bd..595139c019e 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -2813,7 +2813,6 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
-
 # Checks for programs.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets 
\$(MAKE)" >&5
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
@@ -6908,7 +6907,7 @@ $as_echo "found xgettext program is not GNU xgettext; 
ignore it" >&6; }
         rm -f messages.po
   fi
 
-  ac_config_commands="$ac_config_commands default-1"
+  ac_config_commands="$ac_config_commands posubdirs"
 
 
 
@@ -10130,7 +10129,7 @@ for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
     "depdir") CONFIG_COMMANDS="$CONFIG_COMMANDS depdir" ;;
-    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+    "posubdirs") CONFIG_COMMANDS="$CONFIG_COMMANDS posubdirs" ;;
     "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
 
@@ -10689,7 +10688,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 
   case $ac_file$ac_mode in
     "depdir":C) $SHELL $ac_aux_dir/mkinstalldirs $DEPDIR ;;
-    "default-1":C)
+    "posubdirs":C)
     for ac_file in $CONFIG_FILES; do
       # Support "outfile[:infile[:infile...]]"
       case "$ac_file" in
diff --git a/libcpp/configure.ac b/libcpp/configure.ac
index 845dd644948..6b106bbb2de 100644
--- a/libcpp/configure.ac
+++ b/libcpp/configure.ac
@@ -4,7 +4,7 @@
 AC_INIT(cpplib, [ ], gcc-b...@gcc.gnu.org, cpplib)
 AC_CONFIG_SRCDIR(ucnid.h)
 AC_CONFIG_MACRO_DIR(../config)
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 
 # Checks for programs.
 AC_PROG_MAKE_SET
@@ -92,11 +92,11 @@ AM_LANGINFO_CODESET
 ZW_GNU_GETTEXT_SISTER_DIR
 
 AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
-[AC_TRY_COMPILE([
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
-],
-[if ((uchar *)0) return 0;
- if (sizeof(uchar)) return 0;],
+]],
+[[if ((uchar *)0) return 0;
+ if (sizeof(uchar)) return 0;]])],
 ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
 if test $ac_cv_type_uchar = yes; then
   AC_DEFINE(HAVE_UCHAR, 1,
@@ -197,7 +197,7 @@ fi
 
 case $target in
   i?86-* | x86_64-*)
-    AC_TRY_COMPILE([], [asm ("pshufb %xmm0, %xmm1")],
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[asm ("pshufb %xmm0, %xmm1")]])],
       [AC_DEFINE([HAVE_SSSE3], [1],
                 [Define to 1 if you can assemble SSSE3 insns.])])
 esac
diff --git a/libgcc/configure b/libgcc/configure
index 18418336c9b..1a8b09d1ef9 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5565,8 +5565,7 @@ else
 int
 main ()
 {
-                       asm(".arch armv8-a+lse\n\tcas w0, w1, [x2]");
-
+asm(".arch armv8-a+lse\n\tcas w0, w1, [x2]");
   ;
   return 0;
 }
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 85e4f1bc48b..fbc3ae16b43 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -133,7 +133,7 @@ AC_SUBST(slibdir)
 # Command-line options.
 # Very limited version of AC_MAINTAINER_MODE.
 AC_ARG_ENABLE([maintainer-mode],
-  [AC_HELP_STRING([--enable-maintainer-mode],
+  [AS_HELP_STRING([--enable-maintainer-mode],
                  [enable make rules and dependencies not useful (and
                   sometimes confusing) to the casual installer])],
   [case ${enable_maintainer_mode} in
@@ -270,7 +270,7 @@ GCC_CET_FLAGS(CET_FLAGS)
 AC_SUBST(CET_FLAGS)
 
 AC_ARG_ENABLE([explicit-exception-frame-registration],
-  [AC_HELP_STRING([--enable-explicit-exception-frame-registration],
+  [AS_HELP_STRING([--enable-explicit-exception-frame-registration],
      [register exception tables explicitly at module start, for use
       e.g. for compatibility with installations without PT_GNU_EH_FRAME 
support])],
 [
@@ -595,7 +595,7 @@ AC_DEFUN([LIBGCC_CHECK_AS_AVX], [
 case "${target}" in
 i[[34567]]86-*-* | x86_64-*-*)
   AC_CACHE_CHECK([if the assembler supports AVX], libgcc_cv_as_avx, [
-    AC_TRY_COMPILE([], [asm("vzeroupper");],
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[asm("vzeroupper");]])],
                   [libgcc_cv_as_avx=yes], [libgcc_cv_as_avx=no])
   ])
   if test x$libgcc_cv_as_avx = xyes; then
@@ -610,12 +610,10 @@ AC_DEFUN([LIBGCC_CHECK_AS_LSE], [
 case "${target}" in
 aarch64*-*-*)
   AC_CACHE_CHECK([if the assembler supports LSE], libgcc_cv_as_lse, [
-    AC_TRY_COMPILE([],
-changequote(,)dnl
-                       asm(".arch armv8-a+lse\n\tcas w0, w1, [x2]");
-changequote([,])dnl
-                      ,
-                  [libgcc_cv_as_lse=yes], [libgcc_cv_as_lse=no])
+    AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([[]],
+                      [[asm(".arch armv8-a+lse\n\tcas w0, w1, [x2]");]])],
+      [libgcc_cv_as_lse=yes], [libgcc_cv_as_lse=no])
   ])
   if test x$libgcc_cv_as_lse = xyes; then
     AC_DEFINE(HAVE_AS_LSE, 1, [Define to 1 if the assembler supports LSE.])
diff --git a/libgcobol/configure b/libgcobol/configure
index 5f319eedf53..fc20d709156 100755
--- a/libgcobol/configure
+++ b/libgcobol/configure
@@ -12154,7 +12154,6 @@ CC="$lt_save_CC"
 
 
 
-
 enable_dlopen=yes
 
 
diff --git a/libgcobol/configure.ac b/libgcobol/configure.ac
index 13326960515..1255eb55698 100644
--- a/libgcobol/configure.ac
+++ b/libgcobol/configure.ac
@@ -74,7 +74,6 @@ AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
 
-AM_PROG_LIBTOOL
 LT_INIT
 
 AC_LIBTOOL_DLOPEN
diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
index 23fd621e518..480ba43ab83 100644
--- a/libgfortran/acinclude.m4
+++ b/libgfortran/acinclude.m4
@@ -422,10 +422,10 @@ AC_DEFUN([LIBGFOR_CHECK_STRERROR_R], [
   dnl Check for three-argument POSIX version of strerror_r
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS="-Wimplicit-function-declaration -Werror"
-  AC_TRY_COMPILE([#define _GNU_SOURCE 1
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE 1
                  #include <string.h>
-                 #include <locale.h>],
-                 [char s[128]; strerror_r(5, s, 128);],
+                 #include <locale.h>]],
+                 [[char s[128]; strerror_r(5, s, 128);]])],
                  AC_DEFINE(HAVE_STRERROR_R, 1,
                  [Define if strerror_r is available in <string.h>.]),)
   CFLAGS="$ac_save_CFLAGS"
@@ -433,10 +433,10 @@ AC_DEFUN([LIBGFOR_CHECK_STRERROR_R], [
   dnl Check for two-argument version of strerror_r (e.g. for VxWorks)
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS="-Wimplicit-function-declaration -Werror"
-  AC_TRY_COMPILE([#define _GNU_SOURCE 1
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _GNU_SOURCE 1
                  #include <string.h>
-                 #include <locale.h>],
-                 [char s[128]; strerror_r(5, s);],
+                 #include <locale.h>]],
+                 [[char s[128]; strerror_r(5, s);]])],
                  AC_DEFINE(HAVE_STRERROR_R_2ARGS, 1,
                  [Define if strerror_r takes two arguments and is available in 
<string.h>.]),)
   CFLAGS="$ac_save_CFLAGS"
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index cca1ea0ea97..ecebb0615b4 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -115,7 +115,7 @@ AC_SUBST(toolexeclibdir)
 # Create a spec file, so that compile/link tests don't fail
 test -f libgfortran.spec || touch libgfortran.spec
 
-AC_LANG_C
+AC_LANG([C])
 # Check the compiler.
 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
 # We must force CC to /not/ be precious variables; otherwise
@@ -259,7 +259,7 @@ AC_PROG_INSTALL
 # Configure libtool
 #AC_MSG_NOTICE([====== Starting libtool configuration])
 AC_LIBTOOL_DLOPEN
-AM_PROG_LIBTOOL
+LT_INIT
 LT_LIB_M
 ACX_LT_HOST_FLAGS
 AC_SUBST(enable_shared)
diff --git a/libgm2/acinclude.m4 b/libgm2/acinclude.m4
index e4d0bf4a18e..d46d474e52a 100644
--- a/libgm2/acinclude.m4
+++ b/libgm2/acinclude.m4
@@ -76,15 +76,15 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
   # We use these options to decide which functions to include.  They are
   # set from the top level.
   AC_ARG_WITH([target-subdir],
-    AC_HELP_STRING([--with-target-subdir=SUBDIR],
+    AS_HELP_STRING([--with-target-subdir=SUBDIR],
                   [configuring in a subdirectory]))
 
   AC_ARG_WITH([cross-host],
-    AC_HELP_STRING([--with-cross-host=HOST],
+    AS_HELP_STRING([--with-cross-host=HOST],
                   [configuring with a cross compiler]))
 
   AC_ARG_WITH([newlib],
-    AC_HELP_STRING([--with-newlib],
+    AS_HELP_STRING([--with-newlib],
                   [assume newlib as a system C library]))
 
   # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
@@ -136,7 +136,7 @@ dnl documentation.
 dnl
 m4_define([GLIBCXX_ENABLE],[dnl
 m4_define([_g_switch],[--enable-$1])dnl
-m4_define([_g_help],[AC_HELP_STRING([_g_switch$3],[$4 @<:@default=$2@:>@])])dnl
+m4_define([_g_help],[AS_HELP_STRING([_g_switch$3],[$4 @<:@default=$2@:>@])])dnl
  AC_ARG_ENABLE([$1],m4_dquote(_g_help),
   m4_bmatch([$5],
    [^permit ],
@@ -193,8 +193,7 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
     [use KIND for check type],
     [permit yes|no|rt])
 
-  AC_LANG_SAVE
-  AC_LANG_CPLUSPLUS
+  AC_LANG_PUSH([C++])
   ac_save_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS="$CXXFLAGS -fno-exceptions"
   ac_save_LIBS="$LIBS"
@@ -295,41 +294,41 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
 
     if test x"$ac_has_unistd_h" = x"yes"; then
       AC_MSG_CHECKING([for monotonic clock])
-      AC_TRY_LINK(
-       [#include <unistd.h>
+      AC_LINK_IFELSE([AC_LANG_PROGRAM(
+       [[#include <unistd.h>
         #include <time.h>
-       ],
-       [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
+       ]],
+       [[#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
          timespec tp;
         #endif
          clock_gettime(CLOCK_MONOTONIC, &tp);
-       ], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no])
+       ]])], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no])
 
       AC_MSG_RESULT($ac_has_clock_monotonic)
 
       AC_MSG_CHECKING([for realtime clock])
-      AC_TRY_LINK(
-       [#include <unistd.h>
+      AC_LINK_IFELSE([AC_LANG_PROGRAM(
+       [[#include <unistd.h>
         #include <time.h>
-       ],
-       [#if _POSIX_TIMERS > 0
+       ]],
+       [[#if _POSIX_TIMERS > 0
          timespec tp;
         #endif
          clock_gettime(CLOCK_REALTIME, &tp);
-       ], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
+       ]])], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
 
       AC_MSG_RESULT($ac_has_clock_realtime)
 
       AC_MSG_CHECKING([for nanosleep])
-      AC_TRY_LINK(
-       [#include <unistd.h>
+      AC_LINK_IFELSE([AC_LANG_PROGRAM(
+       [[#include <unistd.h>
         #include <time.h>
-       ],
-       [#if _POSIX_TIMERS > 0
+       ]],
+       [[#if _POSIX_TIMERS > 0
          timespec tp;
         #endif
          nanosleep(&tp, 0);
-       ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no])
+       ]])], [ac_has_nanosleep=yes], [ac_has_nanosleep=no])
 
       AC_MSG_RESULT($ac_has_nanosleep)
     fi
@@ -339,17 +338,17 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
     case ${target_os} in
       linux* | uclinux*)
        AC_MSG_CHECKING([for clock_gettime syscall])
-       AC_TRY_COMPILE(
-         [#include <unistd.h>
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+         [[#include <unistd.h>
           #include <time.h>
           #include <sys/syscall.h>
-         ],
-         [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
+         ]],
+         [[#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
            timespec tp;
           #endif
           syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &tp);
           syscall(SYS_clock_gettime, CLOCK_REALTIME, &tp);
-         ], [ac_has_clock_gettime_syscall=yes], 
[ac_has_clock_gettime_syscall=no])
+         ]])], [ac_has_clock_gettime_syscall=yes], 
[ac_has_clock_gettime_syscall=no])
        AC_MSG_RESULT($ac_has_clock_gettime_syscall)
        if test x"$ac_has_clock_gettime_syscall" = x"yes"; then
          AC_DEFINE(_GLIBCXX_USE_CLOCK_GETTIME_SYSCALL, 1,
@@ -357,11 +356,11 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
          ac_has_clock_monotonic=yes
          ac_has_clock_realtime=yes
          AC_MSG_CHECKING([for struct timespec that matches syscall])
-         AC_TRY_COMPILE(
-           [#include <time.h>
+         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+           [[#include <time.h>
             #include <sys/syscall.h>
-           ],
-           [#ifdef SYS_clock_gettime64
+           ]],
+           [[#ifdef SYS_clock_gettime64
             #if SYS_clock_gettime64 != SYS_clock_gettime
             // We need to use SYS_clock_gettime and libc appears to
             // also know about the SYS_clock_gettime64 syscall.
@@ -370,7 +369,7 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
               "struct timespec must be compatible with SYS_clock_gettime");
             #endif
             #endif
-           ],
+           ]])],
            [ac_timespec_matches_syscall=yes],
            [ac_timespec_matches_syscall=no])
          AC_MSG_RESULT($ac_timespec_matches_syscall)
@@ -404,17 +403,17 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
       [Defined if Sleep exists.])
   else
       AC_MSG_CHECKING([for sleep])
-      AC_TRY_COMPILE([#include <unistd.h>],
-                     [sleep(1)],
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
+                     [[sleep(1)]])],
                      [ac_has_sleep=yes],[ac_has_sleep=no])
       if test x"$ac_has_sleep" = x"yes"; then
         AC_DEFINE(HAVE_SLEEP,1, [Defined if sleep exists.])
       fi
       AC_MSG_RESULT($ac_has_sleep)
       AC_MSG_CHECKING([for usleep])
-      AC_TRY_COMPILE([#include <unistd.h>],
-                     [sleep(1);
-                      usleep(100);],
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
+                     [[sleep(1);
+                      usleep(100);]])],
                      [ac_has_usleep=yes],[ac_has_usleep=no])
       if test x"$ac_has_usleep" = x"yes"; then
         AC_DEFINE(HAVE_USLEEP,1, [Defined if usleep exists.])
@@ -430,7 +429,7 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
 
   CXXFLAGS="$ac_save_CXXFLAGS"
   LIBS="$ac_save_LIBS"
-  AC_LANG_RESTORE
+  AC_LANG_POP([C++])
 ])
 
 dnl
@@ -442,8 +441,7 @@ AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
 
   AC_MSG_CHECKING([for gettimeofday])
 
-  AC_LANG_SAVE
-  AC_LANG_CPLUSPLUS
+  AC_LANG_PUSH([C++])
   ac_save_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS="$CXXFLAGS -fno-exceptions"
 
@@ -464,7 +462,7 @@ AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
   fi
 
   CXXFLAGS="$ac_save_CXXFLAGS"
-  AC_LANG_RESTORE
+  AC_LANG_POP([C++])
 ])
 
 dnl
diff --git a/libgm2/configure b/libgm2/configure
index 8ffdb311625..aaafcd2c857 100755
--- a/libgm2/configure
+++ b/libgm2/configure
@@ -5100,7 +5100,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettimeofday" >&5
 $as_echo_n "checking for gettimeofday... " >&6; }
 
-
   ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5206,7 +5205,6 @@ fi
 
 
 
-
   ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -14854,7 +14852,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 14857 "configure"
+#line 14855 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14960,7 +14958,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 14963 "configure"
+#line 14961 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18288,7 +18286,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 # Only expand once:
 
 
-
 enable_dlopen=yes
 
 
diff --git a/libgm2/configure.ac b/libgm2/configure.ac
index 437485fcf0f..7cd49e628d2 100644
--- a/libgm2/configure.ac
+++ b/libgm2/configure.ac
@@ -177,7 +177,7 @@ AC_SUBST(slibdir)
 # Command-line options.
 # Very limited version of AC_MAINTAINER_MODE.
 AC_ARG_ENABLE([maintainer-mode],
-  [AC_HELP_STRING([--enable-maintainer-mode],
+  [AS_HELP_STRING([--enable-maintainer-mode],
                  [enable make rules and dependencies not useful (and
                   sometimes confusing) to the casual installer])],
   [case ${enable_maintainer_mode} in
@@ -255,7 +255,6 @@ AC_CHECK_TOOL(RANLIB, ranlib, 
ranlib-not-found-in-path-error)
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
 
-AM_PROG_LIBTOOL
 LT_INIT
 AC_LIBTOOL_DLOPEN
 
@@ -290,7 +289,7 @@ if (test "$ac_cv_struct_tm_gmtoff" = "yes"); then
   AC_DEFINE(HAVE_TM_TM_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field.])
 fi
 
-AC_LANG_C
+AC_LANG([C])
 # Check the compiler.
 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
 # We must force CC to /not/ be precious variables; otherwise
@@ -505,7 +504,7 @@ GCC_BASE_VER
 AC_CONFIG_SRCDIR([Makefile.am])
 AC_CONFIG_FILES([Makefile])
 
-AC_CONFIG_FILES(AC_FOREACH([DIR], [libm2min libm2pim libm2iso libm2cor 
libm2log], [DIR/Makefile ]),
+AC_CONFIG_FILES(m4_foreach_w([DIR], [libm2min libm2pim libm2iso libm2cor 
libm2log], [DIR/Makefile ]),
  [ cat > vpsed$$ << \_EOF
 s!`test -f '$<' || echo '$(srcdir)/'`!!
 _EOF
diff --git a/libgomp/acinclude.m4 b/libgomp/acinclude.m4
index 12fbb20066c..5ad88dcd6d8 100644
--- a/libgomp/acinclude.m4
+++ b/libgomp/acinclude.m4
@@ -5,8 +5,11 @@ dnl Check whether the target supports 
__sync_*_compare_and_swap.
 AC_DEFUN([LIBGOMP_CHECK_SYNC_BUILTINS], [
   AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
                 libgomp_cv_have_sync_builtins, [
-  AC_TRY_LINK([], [int foo; __sync_val_compare_and_swap(&foo, 0, 1);],
-             libgomp_cv_have_sync_builtins=yes, 
libgomp_cv_have_sync_builtins=no)])
+  AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[]],
+                    [[int foo; __sync_val_compare_and_swap(&foo, 0, 1);]])],
+    [libgomp_cv_have_sync_builtins=yes],
+    [libgomp_cv_have_sync_builtins=no])])
   if test $libgomp_cv_have_sync_builtins = yes; then
     AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
              [Define to 1 if the target supports __sync_*_compare_and_swap])
@@ -18,9 +21,11 @@ AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY], [
                 libgomp_cv_have_attribute_visibility, [
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Werror"
-  AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
-                [], libgomp_cv_have_attribute_visibility=yes,
-                libgomp_cv_have_attribute_visibility=no)
+  AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([[void __attribute__((visibility("hidden"))) foo(void) { 
}]],
+                    [[]])],
+    [libgomp_cv_have_attribute_visibility=yes],
+    [libgomp_cv_have_attribute_visibility=no])
   CFLAGS="$save_CFLAGS"])
   if test $libgomp_cv_have_attribute_visibility = yes; then
     AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
@@ -33,9 +38,11 @@ AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT], [
                 libgomp_cv_have_attribute_dllexport, [
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Werror"
-  AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
-                [], libgomp_cv_have_attribute_dllexport=yes,
-                libgomp_cv_have_attribute_dllexport=no)
+  AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([[void __attribute__((dllexport)) foo(void) { }]],
+                    [[]])],
+    [libgomp_cv_have_attribute_dllexport=yes],
+    [libgomp_cv_have_attribute_dllexport=no])
   CFLAGS="$save_CFLAGS"])
   if test $libgomp_cv_have_attribute_dllexport = yes; then
     AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
@@ -46,10 +53,13 @@ dnl Check whether the target supports symbol aliases.
 AC_DEFUN([LIBGOMP_CHECK_ATTRIBUTE_ALIAS], [
   AC_CACHE_CHECK([whether the target supports symbol aliases],
                 libgomp_cv_have_attribute_alias, [
-  AC_TRY_LINK([
+  AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[
 void foo(void) { }
-extern void bar(void) __attribute__((alias("foo")));],
-    [bar();], libgomp_cv_have_attribute_alias=yes, 
libgomp_cv_have_attribute_alias=no)])
+extern void bar(void) __attribute__((alias("foo")));]],
+                    [[bar();]])],
+    [libgomp_cv_have_attribute_alias=yes],
+    [libgomp_cv_have_attribute_alias=no])])
   if test $libgomp_cv_have_attribute_alias = yes; then
     AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
       [Define to 1 if the target supports __attribute__((alias(...))).])
@@ -79,7 +89,7 @@ dnl See docs/html/17_intro/configury.html#enable for 
documentation.
 dnl
 m4_define([LIBGOMP_ENABLE],[dnl
 m4_define([_g_switch],[--enable-$1])dnl
-m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
+m4_define([_g_help],[AS_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
  AC_ARG_ENABLE($1,_g_help,
   m4_bmatch([$5],
    [^permit ],
@@ -181,14 +191,14 @@ AC_DEFUN([LIBGOMP_CHECK_LINKER_FEATURES], [
     # .eh_frame and now some of the glibc sections for iconv).
     # Bzzzzt.  Thanks for playing, maybe next time.
     AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
-    AC_TRY_RUN([
+    AC_RUN_IFELSE([AC_LANG_SOURCE([[
      int main(void)
      {
        try { throw 1; }
        catch (...) { };
        return 0;
      }
-    ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
+    ]])], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], 
[ac_sectionLDflags=yes])
     if test "$ac_test_CFLAGS" = set; then
       CFLAGS="$ac_save_CFLAGS"
     else
@@ -275,7 +285,8 @@ if test $enable_symvers != no; then
   AC_MSG_CHECKING([for shared libgcc])
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=' -lgcc_s'
-  AC_TRY_LINK(, [return 0;], libgomp_shared_libgcc=yes, 
libgomp_shared_libgcc=no)
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],
+                [libgomp_shared_libgcc=yes], [libgomp_shared_libgcc=no])
   CFLAGS="$ac_save_CFLAGS"
   if test $libgomp_shared_libgcc = no; then
     cat > conftest.c <<EOF
@@ -290,7 +301,8 @@ changequote([,])dnl
     rm -f conftest.c conftest.so
     if test x${libgomp_libgcc_s_suffix+set} = xset; then
       CFLAGS=" -lgcc_s$libgomp_libgcc_s_suffix"
-      AC_TRY_LINK(, [return 0;], libgomp_shared_libgcc=yes)
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],
+                    [libgomp_shared_libgcc=yes])
       CFLAGS="$ac_save_CFLAGS"
     fi
   fi
@@ -344,9 +356,11 @@ fi
 
 AC_CACHE_CHECK([whether the target supports .symver directive],
               libgomp_cv_have_as_symver_directive, [
-  AC_TRY_COMPILE([void foo (void); __asm (".symver foo, bar@SYMVER");],
-                [], libgomp_cv_have_as_symver_directive=yes,
-                libgomp_cv_have_as_symver_directive=no)])
+  AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([[void foo (void); __asm (".symver foo, bar@SYMVER");]],
+                    [[]])],
+    [libgomp_cv_have_as_symver_directive=yes],
+    [libgomp_cv_have_as_symver_directive=no])])
 if test $libgomp_cv_have_as_symver_directive = yes; then
   AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1,
     [Define to 1 if the target assembler supports .symver directive.])
diff --git a/libgomp/configure b/libgomp/configure
index df1fc8df30e..60c2168aa6b 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -16963,66 +16963,55 @@ if ac_fn_c_compute_int "$LINENO" "sizeof 
(__INTPTR_TYPE__)" "INTPTR_T_KIND"
 
 fi
 
-
 if ac_fn_c_compute_int "$LINENO" "sizeof (__int128)" "OMP_INT128_SIZE"        
""; then :
 
 else
   OMP_INT128_SIZE=0
 fi
 
-
 if ac_fn_c_compute_int "$LINENO" "2*sizeof (__INTPTR_TYPE__)" 
"OMP_DEPEND_KIND"        ""; then :
 
 else
   OMP_DEPEND_KIND=0
 fi
 
-
 if ac_fn_c_compute_int "$LINENO" "sizeof (omp_lock_t)" "OMP_LOCK_SIZE"        
""; then :
 
 else
   as_fn_error $? "unsupported system, cannot find sizeof (omp_lock_t)" 
"$LINENO" 5
 fi
 
-
 if ac_fn_c_compute_int "$LINENO" "__alignof (omp_lock_t)" "OMP_LOCK_ALIGN"     
   ""; then :
 
 fi
 
-
 if ac_fn_c_compute_int "$LINENO" "sizeof (omp_nest_lock_t)" 
"OMP_NEST_LOCK_SIZE"        ""; then :
 
 fi
 
-
 if ac_fn_c_compute_int "$LINENO" "__alignof (omp_nest_lock_t)" 
"OMP_NEST_LOCK_ALIGN"        ""; then :
 
 fi
 
-
 if ac_fn_c_compute_int "$LINENO" "sizeof (omp_lock_25_t)" "OMP_LOCK_25_SIZE"   
     ""; then :
 
 else
   as_fn_error $? "unsupported system, cannot find sizeof (omp_lock_25_t)" 
"$LINENO" 5
 fi
 
-
 if ac_fn_c_compute_int "$LINENO" "__alignof (omp_lock_25_t)" 
"OMP_LOCK_25_ALIGN"        ""; then :
 
 fi
 
-
 if ac_fn_c_compute_int "$LINENO" "sizeof (omp_nest_lock_25_t)" 
"OMP_NEST_LOCK_25_SIZE"        ""; then :
 
 fi
 
-
 if ac_fn_c_compute_int "$LINENO" "__alignof (omp_nest_lock_25_t)" 
"OMP_NEST_LOCK_25_ALIGN"        ""; then :
 
 fi
 
 
-
 # If the lock fits in an integer, then arrange for Fortran to use that
 # integer.  If it doesn't, then arrange for Fortran to use a pointer.
 # Except that we don't have a way at present to multi-lib the installed
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 1730c62c74c..fd1d4ea634d 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -144,7 +144,7 @@ AM_CONDITIONAL(BUILD_INFO, test 
$gcc_cv_prog_makeinfo_modern = "yes")
 
 
 # Configure libtool
-AM_PROG_LIBTOOL
+LT_INIT
 ACX_LT_HOST_FLAGS
 AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
@@ -178,7 +178,7 @@ libtool_VERSION=1:0:0
 AC_SUBST(libtool_VERSION)
 
 # Check header files.
-AC_STDC_HEADERS
+AC_HEADER_STDC
 AC_HEADER_TIME
 ACX_HEADER_STRING
 AC_CHECK_HEADERS(pthread.h unistd.h semaphore.h sys/loadavg.h sys/sysctl.h 
sys/time.h)
@@ -423,20 +423,20 @@ for i in $config_path; do
   fi
 done
 
-_AC_COMPUTE_INT([sizeof (__INTPTR_TYPE__)], [INTPTR_T_KIND])
-_AC_COMPUTE_INT([sizeof (__int128)], [OMP_INT128_SIZE],,[OMP_INT128_SIZE=0])
-_AC_COMPUTE_INT([2*sizeof (__INTPTR_TYPE__)], [OMP_DEPEND_KIND],,
-               [OMP_DEPEND_KIND=0])
-_AC_COMPUTE_INT([sizeof (omp_lock_t)], [OMP_LOCK_SIZE],,
+AC_COMPUTE_INT([INTPTR_T_KIND], [sizeof (__INTPTR_TYPE__)])
+AC_COMPUTE_INT([OMP_INT128_SIZE], [sizeof (__int128)],,[OMP_INT128_SIZE=0])
+AC_COMPUTE_INT([OMP_DEPEND_KIND], [2*sizeof (__INTPTR_TYPE__)],,
+              [OMP_DEPEND_KIND=0])
+AC_COMPUTE_INT([OMP_LOCK_SIZE], [sizeof (omp_lock_t)],,
   [AC_MSG_ERROR([unsupported system, cannot find sizeof (omp_lock_t)])])
-_AC_COMPUTE_INT([__alignof (omp_lock_t)], [OMP_LOCK_ALIGN])
-_AC_COMPUTE_INT([sizeof (omp_nest_lock_t)], [OMP_NEST_LOCK_SIZE])
-_AC_COMPUTE_INT([__alignof (omp_nest_lock_t)], [OMP_NEST_LOCK_ALIGN])
-_AC_COMPUTE_INT([sizeof (omp_lock_25_t)], [OMP_LOCK_25_SIZE],,
+AC_COMPUTE_INT([OMP_LOCK_ALIGN], [__alignof (omp_lock_t)])
+AC_COMPUTE_INT([OMP_NEST_LOCK_SIZE], [sizeof (omp_nest_lock_t)])
+AC_COMPUTE_INT([OMP_NEST_LOCK_ALIGN], [__alignof (omp_nest_lock_t)])
+AC_COMPUTE_INT([OMP_LOCK_25_SIZE], [sizeof (omp_lock_25_t)],,
   [AC_MSG_ERROR([unsupported system, cannot find sizeof (omp_lock_25_t)])])
-_AC_COMPUTE_INT([__alignof (omp_lock_25_t)], [OMP_LOCK_25_ALIGN])
-_AC_COMPUTE_INT([sizeof (omp_nest_lock_25_t)], [OMP_NEST_LOCK_25_SIZE])
-_AC_COMPUTE_INT([__alignof (omp_nest_lock_25_t)], [OMP_NEST_LOCK_25_ALIGN])
+AC_COMPUTE_INT([OMP_LOCK_25_ALIGN], [__alignof (omp_lock_25_t)])
+AC_COMPUTE_INT([OMP_NEST_LOCK_25_SIZE], [sizeof (omp_nest_lock_25_t)])
+AC_COMPUTE_INT([OMP_NEST_LOCK_25_ALIGN], [__alignof (omp_nest_lock_25_t)])
 
 # If the lock fits in an integer, then arrange for Fortran to use that
 # integer.  If it doesn't, then arrange for Fortran to use a pointer.
diff --git a/libgrust/configure.ac b/libgrust/configure.ac
index f9e59a5fc24..5856ae8eebd 100644
--- a/libgrust/configure.ac
+++ b/libgrust/configure.ac
@@ -107,7 +107,7 @@ AM_CONDITIONAL(TARGET_LIBRARY, test -n 
"$with_target_subdir")
 
 AC_CONFIG_FILES([libformat_parser/Makefile])
 
-AC_CONFIG_FILES(AC_FOREACH([DIR], [libproc_macro_internal], [DIR/Makefile ]),
+AC_CONFIG_FILES(m4_foreach_w([DIR], [libproc_macro_internal], [DIR/Makefile ]),
  [ cat > vpsed$$ << \_EOF
 s!`test -f '$<' || echo '$(srcdir)/'`!!
 _EOF
diff --git a/libiberty/acinclude.m4 b/libiberty/acinclude.m4
index 1e98d555841..4d773ab4f5f 100644
--- a/libiberty/acinclude.m4
+++ b/libiberty/acinclude.m4
@@ -21,7 +21,7 @@ dnl a SEGV in some cases.
 AC_DEFUN([libiberty_AC_FUNC_STRNCMP],
 [AC_REQUIRE([AC_FUNC_MMAP])
 AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
-[AC_TRY_RUN([
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[
 /* Test by Jim Wilson and Kaveh Ghazi.
    Check whether strncmp reads past the end of its string parameters. */
 #include <stdlib.h>
@@ -84,8 +84,8 @@ main (void)
 #endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */
   exit (0);
 }
-], ac_cv_func_strncmp_works=yes, ac_cv_func_strncmp_works=no,
-  ac_cv_func_strncmp_works=yes)
+]])], [ac_cv_func_strncmp_works=yes], [ac_cv_func_strncmp_works=no],
+  [ac_cv_func_strncmp_works=yes])
 rm -f core core.* *.core])
 if test $ac_cv_func_strncmp_works = no ; then
   AC_LIBOBJ([strncmp])
@@ -95,11 +95,11 @@ fi
 dnl See if errno must be declared even when <errno.h> is included.
 AC_DEFUN([libiberty_AC_DECLARE_ERRNO],
 [AC_CACHE_CHECK(whether errno must be declared, libiberty_cv_declare_errno,
-[AC_TRY_COMPILE(
-[#include <errno.h>],
-[int x = errno;],
-libiberty_cv_declare_errno=no,
-libiberty_cv_declare_errno=yes)])
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#include <errno.h>]],
+[[int x = errno;]])],
+[libiberty_cv_declare_errno=no],
+[libiberty_cv_declare_errno=yes])])
 if test $libiberty_cv_declare_errno = yes
 then AC_DEFINE(NEED_DECLARATION_ERRNO, 1,
   [Define if errno must be declared even when <errno.h> is included.])
@@ -110,7 +110,7 @@ dnl See whether we need a declaration for a function.
 AC_DEFUN([libiberty_NEED_DECLARATION],
 [AC_MSG_CHECKING([whether $1 must be declared])
 AC_CACHE_VAL(libiberty_cv_decl_needed_$1,
-[AC_TRY_COMPILE([
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include "confdefs.h"
 #include <stdio.h>
 #ifdef HAVE_STRING_H
@@ -125,9 +125,10 @@ AC_CACHE_VAL(libiberty_cv_decl_needed_$1,
 #endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif],
-[char *(*pfn) = (char *(*)) $1],
-libiberty_cv_decl_needed_$1=no, libiberty_cv_decl_needed_$1=yes)])
+#endif]],
+[[char *(*pfn) = (char *(*)) $1]])],
+[libiberty_cv_decl_needed_$1=no],
+[libiberty_cv_decl_needed_$1=yes])])
 AC_MSG_RESULT($libiberty_cv_decl_needed_$1)
 if test $libiberty_cv_decl_needed_$1 = yes; then
   AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
@@ -160,7 +161,7 @@ if test $ac_cv_os_cray = yes; then
 fi
 
 AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
-[AC_TRY_RUN([#include <stdlib.h>
+[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
 
 int
 find_stack_direction (void)
@@ -180,10 +181,10 @@ int
 main (void)
 {
   exit (find_stack_direction() < 0);
-}],
-  ac_cv_c_stack_direction=1,
-  ac_cv_c_stack_direction=-1,
-  ac_cv_c_stack_direction=0)])
+}]])],
+  [ac_cv_c_stack_direction=1],
+  [ac_cv_c_stack_direction=-1],
+  [ac_cv_c_stack_direction=0])])
 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction,
   [Define if you know the direction of stack growth for your system;
    otherwise it will be automatically deduced at run-time.
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index 3de5eca0df2..7cfb96ccd5e 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -310,30 +310,30 @@ AC_CHECK_TYPE([long long],
 # Look for a 64-bit type.
 AC_MSG_CHECKING([for a 64-bit type])
 AC_CACHE_VAL(liberty_cv_uint64,
-[AC_TRY_COMPILE(
-[#ifdef HAVE_STDINT_H
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#ifdef HAVE_STDINT_H
 #include <stdint.h>
-#endif],
-[extern uint64_t foo;],
-liberty_cv_uint64=uint64_t,
-[AC_TRY_COMPILE(
-[#ifdef HAVE_LIMITS_H
+#endif]],
+[[extern uint64_t foo;]])],
+[liberty_cv_uint64=uint64_t],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#ifdef HAVE_LIMITS_H
 #include <limits.h>
 #endif
 #ifndef CHAR_BIT
 #define CHAR_BIT 8
-#endif],
-[extern char foo[sizeof(long) * CHAR_BIT >= 64 ? 1 : -1];],
-liberty_cv_uint64="unsigned long",
-[AC_TRY_COMPILE(
-[#ifdef HAVE_LIMITS_H
+#endif]],
+[[extern char foo[sizeof(long) * CHAR_BIT >= 64 ? 1 : -1];]])],
+[liberty_cv_uint64="unsigned long"],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#ifdef HAVE_LIMITS_H
 #include <limits.h>
 #endif
 #ifndef CHAR_BIT
 #define CHAR_BIT 8
-#endif],
-[extern char foo[sizeof(long long) * CHAR_BIT >= 64 ? 1 : -1];],
-liberty_cv_uint64="unsigned long long", liberty_cv_uint64=none)])])])
+#endif]],
+[[extern char foo[sizeof(long long) * CHAR_BIT >= 64 ? 1 : -1];]])],
+[liberty_cv_uint64="unsigned long long"], [liberty_cv_uint64=none])])])])
 AC_MSG_RESULT($liberty_cv_uint64)
 if test "$liberty_cv_uint64" != none; then
   AC_DEFINE_UNQUOTED(UNSIGNED_64BIT_TYPE, $liberty_cv_uint64,
@@ -682,7 +682,7 @@ if test -z "${setobjs}"; then
 
   # We haven't set the list of objects yet.  Use the standard autoconf
   # tests.  This will only work if the compiler works.
-  AC_ISC_POSIX
+  AC_SEARCH_LIBS([strerror],[cposix])
   AC_REPLACE_FUNCS($funcs)
   libiberty_AC_FUNC_C_ALLOCA
   AC_FUNC_FORK
diff --git a/libitm/acinclude.m4 b/libitm/acinclude.m4
index 9fd12e6ee7d..d1617d71e02 100644
--- a/libitm/acinclude.m4
+++ b/libitm/acinclude.m4
@@ -5,8 +5,11 @@ dnl Check whether the target supports 
__sync_*_compare_and_swap.
 AC_DEFUN([LIBITM_CHECK_SYNC_BUILTINS], [
   AC_CACHE_CHECK([whether the target supports __sync_*_compare_and_swap],
                 libitm_cv_have_sync_builtins, [
-  AC_TRY_LINK([], [int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 
1);],
-             libitm_cv_have_sync_builtins=yes, 
libitm_cv_have_sync_builtins=no)])
+  AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[]],
+                    [[int foo, bar; bar = __sync_val_compare_and_swap(&foo, 0, 
1);]])],
+    [libitm_cv_have_sync_builtins=yes],
+    [libitm_cv_have_sync_builtins=no])])
   if test $libitm_cv_have_sync_builtins = yes; then
     AC_DEFINE(HAVE_SYNC_BUILTINS, 1,
              [Define to 1 if the target supports __sync_*_compare_and_swap])
@@ -16,11 +19,12 @@ dnl Check whether the target supports 64-bit 
__sync_*_compare_and_swap.
 AC_DEFUN([LIBITM_CHECK_64BIT_SYNC_BUILTINS], [
   AC_CACHE_CHECK([whether the target supports 64-bit 
__sync_*_compare_and_swap],
                 libitm_cv_have_64bit_sync_builtins, [
-  AC_TRY_LINK([#include <stdint.h>],
-    [uint64_t foo, bar;
-     bar = __sync_val_compare_and_swap(&foo, 0, 1);],
-    libitm_cv_have_64bit_sync_builtins=yes,
-    libitm_cv_have_64bit_sync_builtins=no)])
+  AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[#include <stdint.h>]],
+                    [[uint64_t foo, bar;
+     bar = __sync_val_compare_and_swap(&foo, 0, 1);]])],
+    [libitm_cv_have_64bit_sync_builtins=yes],
+    [libitm_cv_have_64bit_sync_builtins=no])])
     if test $libitm_cv_have_64bit_sync_builtins = yes; then
       AC_DEFINE(HAVE_64BIT_SYNC_BUILTINS, 1,
                [Define to 1 if the target supports 64-bit 
__sync_*_compare_and_swap])
@@ -32,9 +36,11 @@ AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_VISIBILITY], [
                 libitm_cv_have_attribute_visibility, [
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Werror"
-  AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
-                [], libitm_cv_have_attribute_visibility=yes,
-                libitm_cv_have_attribute_visibility=no)
+  AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([[void __attribute__((visibility("hidden"))) foo(void) { 
}]],
+                    [[]])],
+                    [libitm_cv_have_attribute_visibility=yes],
+                    [libitm_cv_have_attribute_visibility=no])
   CFLAGS="$save_CFLAGS"])
   if test $libitm_cv_have_attribute_visibility = yes; then
     AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
@@ -47,9 +53,11 @@ AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_DLLEXPORT], [
                 libitm_cv_have_attribute_dllexport, [
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -Werror"
-  AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
-                [], libitm_cv_have_attribute_dllexport=yes,
-                libitm_cv_have_attribute_dllexport=no)
+  AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM([[void __attribute__((dllexport)) foo(void) { }]],
+                  [[]])],
+                  [libitm_cv_have_attribute_dllexport=yes],
+                  [libitm_cv_have_attribute_dllexport=no])
   CFLAGS="$save_CFLAGS"])
   if test $libitm_cv_have_attribute_dllexport = yes; then
     AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
@@ -60,10 +68,13 @@ dnl Check whether the target supports symbol aliases.
 AC_DEFUN([LIBITM_CHECK_ATTRIBUTE_ALIAS], [
   AC_CACHE_CHECK([whether the target supports symbol aliases],
                 libitm_cv_have_attribute_alias, [
-  AC_TRY_LINK([
+  AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[
 void foo(void) { }
-extern void bar(void) __attribute__((alias("foo")));],
-    [bar();], libitm_cv_have_attribute_alias=yes, 
libitm_cv_have_attribute_alias=no)])
+extern void bar(void) __attribute__((alias("foo")));]],
+                    [[bar();]])],
+    [libitm_cv_have_attribute_alias=yes],
+    [libitm_cv_have_attribute_alias=no])])
   if test $libitm_cv_have_attribute_alias = yes; then
     AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
       [Define to 1 if the target supports __attribute__((alias(...))).])
@@ -73,15 +84,21 @@ dnl Check how size_t is mangled.
 AC_DEFUN([LIBITM_CHECK_SIZE_T_MANGLING], [
   AC_CACHE_CHECK([how size_t is mangled],
                  libitm_cv_size_t_mangling, [
-    AC_TRY_COMPILE([], [extern __SIZE_TYPE__ x; extern unsigned long x;],
-                  [libitm_cv_size_t_mangling=m], [
-      AC_TRY_COMPILE([], [extern __SIZE_TYPE__ x; extern unsigned int x;],
+    AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([[]],
+                      [[extern __SIZE_TYPE__ x; extern unsigned long x;]])],
+      [libitm_cv_size_t_mangling=m], [
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[]],
+       [[extern __SIZE_TYPE__ x; extern unsigned int x;]])],
                     [libitm_cv_size_t_mangling=j], [
-        AC_TRY_COMPILE([],
-                      [extern __SIZE_TYPE__ x; extern unsigned long long x;],
+        AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM([[]],
+                          [[extern __SIZE_TYPE__ x; extern unsigned long long 
x;]])],
                       [libitm_cv_size_t_mangling=y], [
-          AC_TRY_COMPILE([],
-                        [extern __SIZE_TYPE__ x; extern unsigned short x;],
+          AC_COMPILE_IFELSE(
+            [AC_LANG_PROGRAM([[]],
+                            [[extern __SIZE_TYPE__ x; extern unsigned short 
x;]])],
                         [libitm_cv_size_t_mangling=t],
                         [libitm_cv_size_t_mangling=x])
        ])
@@ -100,8 +117,10 @@ AC_DEFUN([LIBITM_CHECK_AS_AVX], [
 case "${target_cpu}" in
 i[[34567]]86 | x86_64)
   AC_CACHE_CHECK([if the assembler supports AVX], libitm_cv_as_avx, [
-    AC_TRY_COMPILE([], [asm("vzeroupper");],
-                  [libitm_cv_as_avx=yes], [libitm_cv_as_avx=no])
+    AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([[]], [[asm("vzeroupper");]])],
+      [libitm_cv_as_avx=yes],
+      [libitm_cv_as_avx=no])
   ])
   if test x$libitm_cv_as_avx = xyes; then
     AC_DEFINE(HAVE_AS_AVX, 1, [Define to 1 if the assembler supports AVX.])
@@ -114,8 +133,10 @@ AC_DEFUN([LIBITM_CHECK_AS_RTM], [
 case "${target_cpu}" in
 i[[34567]]86 | x86_64)
   AC_CACHE_CHECK([if the assembler supports RTM], libitm_cv_as_rtm, [
-    AC_TRY_COMPILE([], [asm("1: xbegin 1b; xend");],
-                  [libitm_cv_as_rtm=yes], [libitm_cv_as_rtm=no])
+    AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([[]], [[asm("1: xbegin 1b; xend");]])],
+      [libitm_cv_as_rtm=yes],
+      [libitm_cv_as_rtm=no])
   ])
   if test x$libitm_cv_as_rtm = xyes; then
     AC_DEFINE(HAVE_AS_RTM, 1, [Define to 1 if the assembler supports RTM.])
@@ -128,8 +149,10 @@ AC_DEFUN([LIBITM_CHECK_AS_HTM], [
 case "${target_cpu}" in
 powerpc*)
   AC_CACHE_CHECK([if the assembler supports HTM], libitm_cv_as_htm, [
-    AC_TRY_COMPILE([], [asm("tbegin. 0; tend. 0");],
-                  [libitm_cv_as_htm=yes], [libitm_cv_as_htm=no])
+    AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([[]], [[asm("tbegin. 0; tend. 0");]])],
+      [libitm_cv_as_htm=yes],
+      [libitm_cv_as_htm=no])
   ])
   if test x$libitm_cv_as_htm = xyes; then
     AC_DEFINE(HAVE_AS_HTM, 1, [Define to 1 if the assembler supports HTM.])
@@ -139,8 +162,10 @@ s390*)
   AC_CACHE_CHECK([if the assembler supports HTM], libitm_cv_as_htm, [
     save_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS -march=zEC12"
-    AC_TRY_COMPILE([], [asm("tbegin 0,0; tend");],
-                  [libitm_cv_as_htm=yes], [libitm_cv_as_htm=no])
+    AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([[]], [[asm("tbegin 0,0; tend");]])],
+      [libitm_cv_as_htm=yes],
+      [libitm_cv_as_htm=no])
     CFLAGS="$save_CFLAGS"])
   if test x$libitm_cv_as_htm = xyes; then
     AC_DEFINE(HAVE_AS_HTM, 1, [Define to 1 if the assembler supports HTM.])
@@ -172,7 +197,7 @@ dnl See docs/html/17_intro/configury.html#enable for 
documentation.
 dnl
 m4_define([LIBITM_ENABLE],[dnl
 m4_define([_g_switch],[--enable-$1])dnl
-m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
+m4_define([_g_help],[AS_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
  AC_ARG_ENABLE($1,_g_help,
   m4_bmatch([$5],
    [^permit ],
@@ -274,14 +299,14 @@ AC_DEFUN([LIBITM_CHECK_LINKER_FEATURES], [
     # .eh_frame and now some of the glibc sections for iconv).
     # Bzzzzt.  Thanks for playing, maybe next time.
     AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
-    AC_TRY_RUN([
+    AC_RUN_IFELSE([AC_LANG_SOURCE([[
      int main(void)
      {
        try { throw 1; }
        catch (...) { };
        return 0;
      }
-    ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
+    ]])], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], 
[ac_sectionLDflags=yes])
     if test "$ac_test_CFLAGS" = set; then
       CFLAGS="$ac_save_CFLAGS"
     else
@@ -368,7 +393,8 @@ if test $enable_symvers != no; then
   AC_MSG_CHECKING([for shared libgcc])
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=' -lgcc_s'
-  AC_TRY_LINK(, [return 0;], libitm_shared_libgcc=yes, libitm_shared_libgcc=no)
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],
+                [libitm_shared_libgcc=yes], [libitm_shared_libgcc=no])
   CFLAGS="$ac_save_CFLAGS"
   if test $libitm_shared_libgcc = no; then
     cat > conftest.c <<EOF
@@ -383,7 +409,8 @@ changequote([,])dnl
     rm -f conftest.c conftest.so
     if test x${libitm_libgcc_s_suffix+set} = xset; then
       CFLAGS=" -lgcc_s$libitm_libgcc_s_suffix"
-      AC_TRY_LINK(, [return 0;], libitm_shared_libgcc=yes)
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],
+                    [libitm_shared_libgcc=yes])
       CFLAGS="$ac_save_CFLAGS"
     fi
   fi
diff --git a/libitm/configure.ac b/libitm/configure.ac
index 6d637278b24..31c5221fa73 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -153,7 +153,7 @@ AM_CONDITIONAL(BUILD_INFO, test 
$gcc_cv_prog_makeinfo_modern = "yes")
 
 
 # Configure libtool
-AM_PROG_LIBTOOL
+LT_INIT
 AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
 AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = 
xyes])
@@ -165,7 +165,7 @@ libtool_VERSION=1:0:0
 AC_SUBST(libtool_VERSION)
 
 # Check header files.
-AC_STDC_HEADERS
+AC_HEADER_STDC
 AC_HEADER_TIME
 ACX_HEADER_STRING
 AC_CHECK_HEADERS(unistd.h semaphore.h sys/time.h sys/auxv.h malloc.h)
diff --git a/libobjc/configure b/libobjc/configure
index 68172549137..2f1b68f1e45 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -2502,7 +2502,6 @@ test -n "$target_alias" &&
 
 
 
-
 # Export source directory.
 # These need to be absolute paths, yet at the same time need to
 # canonicalize only relative paths, because then amd will not unmount
@@ -10876,7 +10875,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10879 "configure"
+#line 10878 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10982,7 +10981,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10985 "configure"
+#line 10984 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index 073b84f7d97..d5f4da9c073 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -64,7 +64,7 @@ AC_MSG_RESULT($version_specific_libs)
 # Find the rest of the source tree framework.
 AM_ENABLE_MULTILIB(, ..)
 
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 ACX_NONCANONICAL_TARGET
 
 # Export source directory.
@@ -166,7 +166,7 @@ AM_MAINTAINER_MODE
 # Enable Win32 DLL on MS Windows - FIXME
 AC_LIBTOOL_WIN32_DLL
 
-AC_PROG_LIBTOOL
+LT_INIT
 
 AM_PROG_CC_C_O
 
@@ -206,8 +206,8 @@ AC_CHECK_HEADER(stdio.h,:,
   [AC_MSG_ERROR([Can't find stdio.h.
 You must have a usable C system for the target already installed, at least
 including headers and, preferably, the library, before you can configure
-the Objective C runtime system.  If necessary, install gcc now with 
-\`LANGUAGES=c', then the target library, then build with \`LANGUAGES=objc'.])])
+the Objective C runtime system.  If necessary, install gcc now with
+`LANGUAGES=c', then the target library, then build with `LANGUAGES=objc'.])])
 
 AC_HEADER_STDC
 
diff --git a/libphobos/configure b/libphobos/configure
index 4f5be7d4ff4..6938aac0068 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -2646,7 +2646,6 @@ test -n "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
-
 # Expand $ac_aux_dir to an absolute path.
 am_aux_dir=`cd "$ac_aux_dir" && pwd`
 
@@ -11864,7 +11863,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11867 "configure"
+#line 11866 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11970,7 +11969,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11973 "configure"
+#line 11972 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12209,7 +12208,6 @@ CC="$lt_save_CC"
 
 
 
-
   gdc_save_DFLAGS=$GDCFLAGS
   GDCFLAGS="-fno-druntime -nostdinc -I $phobos_cv_abs_srcdir/libdruntime  
$GDCFLAGS"
 
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index 406373be059..e215a24c232 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -31,7 +31,7 @@ AC_CONFIG_SRCDIR(libdruntime/gcc/attribute.d)
 AC_CONFIG_HEADERS(config.h)
 
 AM_ENABLE_MULTILIB(, ..)
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 AC_USE_SYSTEM_EXTENSIONS
 
 target_alias=${target_alias-$target}
@@ -86,7 +86,6 @@ AC_SUBST(CFLAGS_FOR_BUILD)
 
 # Enable libtool
 LT_INIT(dlopen)
-AM_PROG_LIBTOOL
 WITH_LOCAL_DRUNTIME([LT_LANG([D])], [])
 AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
@@ -288,7 +287,7 @@ AC_CONFIG_FILES([testsuite/testsuite_flags],[chmod +x 
testsuite/testsuite_flags]
 # append it here.  Only modify Makefiles that have just been created.
 #
 # Also, get rid of this simulated-VPATH thing that automake does.
-AC_CONFIG_FILES(AC_FOREACH([DIR], [libdruntime src testsuite], [DIR/Makefile 
]),
+AC_CONFIG_FILES(m4_foreach_w([DIR], [libdruntime src testsuite], [DIR/Makefile 
]),
   [cat > vpsed$$ << \_EOF
 s!`test -f '$<' || echo '$(srcdir)/'`!!
 _EOF
diff --git a/libphobos/m4/druntime.m4 b/libphobos/m4/druntime.m4
index 2a7a689dd18..d25da15c464 100644
--- a/libphobos/m4/druntime.m4
+++ b/libphobos/m4/druntime.m4
@@ -62,7 +62,7 @@ AC_DEFUN([DRUNTIME_INSTALL_DIRECTORIES],
   AC_SUBST(gcc_version)
 
   AC_ARG_WITH([cross-host],
-    AC_HELP_STRING([--with-cross-host=HOST],
+    AS_HELP_STRING([--with-cross-host=HOST],
                    [configuring with a cross compiler]))
 
   libphobos_toolexecdir=no
@@ -70,7 +70,7 @@ AC_DEFUN([DRUNTIME_INSTALL_DIRECTORIES],
 
   AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
   AC_ARG_ENABLE([version-specific-runtime-libs],
-    AC_HELP_STRING([--enable-version-specific-runtime-libs],
+    AS_HELP_STRING([--enable-version-specific-runtime-libs],
                   [Specify that runtime libraries should be installed in a 
compiler-specific directory]),
     [case "$enableval" in
       yes) version_specific_libs=yes ;;
@@ -125,8 +125,8 @@ AC_DEFUN([DRUNTIME_SECTION_FLAGS],
   WITH_LOCAL_DRUNTIME([
     AC_LANG_PUSH([D])
     GDCFLAGS="$GDCFLAGS -g -Werror -ffunction-sections -fdata-sections"
-    AC_TRY_COMPILE([int foo; void bar() { }],[return 0;],
-                  [ac_fdsections=yes], [ac_fdsections=no])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo; void bar() { }]], [[return 
0;]])],
+                     [ac_fdsections=yes], [ac_fdsections=no])
     if test "x$ac_fdsections" = "xyes"; then
       SECTION_FLAGS='-ffunction-sections -fdata-sections'
     fi
diff --git a/libphobos/m4/druntime/cpu.m4 b/libphobos/m4/druntime/cpu.m4
index 3461b2d3c51..4eec96b898f 100644
--- a/libphobos/m4/druntime/cpu.m4
+++ b/libphobos/m4/druntime/cpu.m4
@@ -63,15 +63,15 @@ AC_DEFUN([DRUNTIME_ENABLE_ATOMIC_BUILTINS],
   # used should be checked.
   AC_MSG_CHECKING([for atomic builtins for byte])
   AC_CACHE_VAL(druntime_cv_atomic_byte, [
-    AC_TRY_LINK(
-      [import gcc.builtins;], [
+    AC_LINK_IFELSE([AC_LANG_PROGRAM(
+      [[import gcc.builtins;]], [[
       shared(byte) c1;
        byte c2, c3;
        __atomic_compare_exchange_1(&c1, &c2, c3, false, 5, 5);
        __atomic_load_1(&c1, 5);
        __atomic_store_1(&c1, c2, 5);
        return 0;
-      ],
+      ]])],
       [druntime_cv_atomic_byte=yes],
       [druntime_cv_atomic_byte=no])
   ])
@@ -79,15 +79,15 @@ AC_DEFUN([DRUNTIME_ENABLE_ATOMIC_BUILTINS],
 
   AC_MSG_CHECKING([for atomic builtins for short])
   AC_CACHE_VAL(druntime_cv_atomic_short, [
-    AC_TRY_LINK(
-      [import gcc.builtins;], [
+    AC_LINK_IFELSE([AC_LANG_PROGRAM(
+      [[import gcc.builtins;]], [[
       shared(short) c1;
        short c2, c3;
        __atomic_compare_exchange_2(&c1, &c2, c3, false, 5, 5);
        __atomic_load_2(&c1, 5);
        __atomic_store_2(&c1, c2, 5);
        return 0;
-      ],
+      ]])],
       [druntime_cv_atomic_short=yes],
       [druntime_cv_atomic_short=no])
   ])
@@ -95,15 +95,15 @@ AC_DEFUN([DRUNTIME_ENABLE_ATOMIC_BUILTINS],
 
   AC_MSG_CHECKING([for atomic builtins for int])
   AC_CACHE_VAL(druntime_cv_atomic_int, [
-    AC_TRY_LINK(
-      [import gcc.builtins;], [
+    AC_LINK_IFELSE([AC_LANG_PROGRAM(
+      [[import gcc.builtins;]], [[
       shared(int) c1;
        int c2, c3;
        __atomic_compare_exchange_4(&c1, &c2, c3, false, 5, 5);
        __atomic_load_4(&c1, 5);
        __atomic_store_4(&c1, c2, 5);
        return 0;
-      ],
+      ]])],
       [druntime_cv_atomic_int=yes],
       [druntime_cv_atomic_int=no])
   ])
@@ -111,15 +111,15 @@ AC_DEFUN([DRUNTIME_ENABLE_ATOMIC_BUILTINS],
 
   AC_MSG_CHECKING([for atomic builtins for long])
   AC_CACHE_VAL(druntime_cv_atomic_long, [
-    AC_TRY_LINK(
-      [import gcc.builtins;], [
+    AC_LINK_IFELSE([AC_LANG_PROGRAM(
+      [[import gcc.builtins;]], [[
        shared(long) c1;
        long c2, c3;
        __atomic_compare_exchange_8(&c1, &c2, c3, false, 5, 5);
        __atomic_load_8(&c1, 5);
        __atomic_store_8(&c1, c2, 5);
        return 0;
-      ],
+      ]])],
       [druntime_cv_atomic_long=yes],
       [druntime_cv_atomic_long=no])
   ])
diff --git a/libphobos/m4/druntime/os.m4 b/libphobos/m4/druntime/os.m4
index ef8ca434407..977bc2e4290 100644
--- a/libphobos/m4/druntime/os.m4
+++ b/libphobos/m4/druntime/os.m4
@@ -133,10 +133,10 @@ AC_DEFUN([DRUNTIME_OS_FEATURES],
     linux*)  druntime_target_os_parsed="linux"
       AC_MSG_CHECKING([for getrandom])
       AC_LANG_PUSH([C])
-      AC_TRY_COMPILE([#include <sys/syscall.h>
-#include <unistd.h>],[
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/syscall.h>
+#include <unistd.h>]], [[
         syscall (__NR_getrandom);
-      ],
+      ]])],
         [AC_MSG_RESULT([yes])],
         [AC_MSG_RESULT([no])
          OS_DFLAGS=-fversion=linux_legacy_emulate_getrandom])
@@ -156,11 +156,11 @@ AC_DEFUN([DRUNTIME_OS_ARM_EABI_UNWINDER],
 [
   AC_LANG_PUSH([C])
   AC_MSG_CHECKING([for ARM unwinder])
-  AC_TRY_COMPILE([#include <unwind.h>],[
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unwind.h>]],[[
   #if __ARM_EABI_UNWINDER__
   #error Yes, it is.
   #endif
-  ],
+  ]])],
     [AC_MSG_RESULT([no])
      DCFG_ARM_EABI_UNWINDER=false],
     [AC_MSG_RESULT([yes])
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index c64a8489219..159aa108e73 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -55,7 +55,7 @@ AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern 
= "yes")
 ACX_BUGURL([https://gcc.gnu.org/bugs/])
 
 # Configure libtool
-AM_PROG_LIBTOOL
+LT_INIT
 ACX_LT_HOST_FLAGS
 AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
@@ -63,7 +63,7 @@ AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test 
x$enable_darwin_at_rpath = xyes])
 
 AM_MAINTAINER_MODE
 
-AC_LANG_C
+AC_LANG([C])
 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
 # We must force CC to /not/ be precious variables; otherwise
 # the wrong, non-multilib-adjusted value will be used in multilibs.
@@ -178,8 +178,8 @@ fi
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Werror"
 AC_MSG_CHECKING([whether hidden visibility is supported])
-AC_TRY_COMPILE([
-void __attribute__((visibility ("hidden"))) bar (void) {}],,
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+void __attribute__((visibility ("hidden"))) bar (void) {}]] [[]])],
 [quadmath_hidden=yes],[quadmath_hidden=no])
 AC_MSG_RESULT($quadmath_hidden)
 if test x$quadmath_hidden = xyes; then
@@ -207,7 +207,10 @@ FOO_1.0 {
   global: *foo*; bar; local: *;
 };
 EOF
-    AC_TRY_LINK([int 
foo;],[],[quadmath_use_symver=gnu],[quadmath_use_symver=no])
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[int foo;]], [[]])],
+      [quadmath_use_symver=gnu],
+      [quadmath_use_symver=no])
     if test x$quadmath_use_symver = xno; then
       case "$target_os" in
         solaris2*)
@@ -219,7 +222,10 @@ FOO_1.0 {
   global: foo; local: *;
 };
 EOF
-          AC_TRY_LINK([int 
foo;],[],[quadmath_use_symver=sun],[quadmath_use_symver=no])
+          AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM([[int foo;]], [[]])],
+            [quadmath_use_symver=sun],
+            [quadmath_use_symver=no])
           ;;
       esac
     fi
@@ -271,19 +277,19 @@ AM_CONDITIONAL(BUILD_LIBQUADMATH, [test 
"x$libquad_cv_have_float128" = xyes])
 
 # Check for printf hook support.
 AC_MSG_CHECKING([whether printf hooks are supported])
-AC_TRY_COMPILE([
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <printf.h>
 #include <stdarg.h>
 #include <stdlib.h>
 extern void flt128_va (void *, va_list *);
 extern int flt128_ais (const struct printf_info *, size_t, int *, int *);
 extern int flt128_printf_fp (FILE *, const struct printf_info *, const void 
*const *);
-],[
+]], [[
 int pa_flt128 = register_printf_type (flt128_va);
 int mod_Q = register_printf_modifier (L"Q");
 int res = register_printf_specifier ('f', flt128_printf_fp, flt128_ais);
 struct printf_info info = { .user = -1 };
-],
+]])],
 [quadmath_printf_hooks=yes],[quadmath_printf_hooks=no])
 AC_MSG_RESULT($quadmath_printf_hooks)
 if test x$quadmath_printf_hooks = xyes; then
@@ -293,7 +299,7 @@ fi
 # Check for whether locale support for quadmath_snprintf or Q printf hooks
 # should be provided.
 AC_MSG_CHECKING([whether nl_langinfo should be used])
-AC_TRY_COMPILE([#include <langinfo.h>],[
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[
 const char *s;
 s = nl_langinfo (DECIMAL_POINT);
 s = nl_langinfo (MON_DECIMAL_POINT);
@@ -302,7 +308,7 @@ s = nl_langinfo (MON_GROUPING);
 s = nl_langinfo (THOUSANDS_SEP);
 s = nl_langinfo (MON_THOUSANDS_SEP);
 (void) s;
-],
+]])],
 [quadmath_use_nl_langinfo=yes],[quadmath_use_nl_langinfo=no])
 AC_MSG_RESULT($quadmath_use_nl_langinfo)
 if test x$quadmath_use_nl_langinfo = xyes; then
@@ -310,14 +316,14 @@ if test x$quadmath_use_nl_langinfo = xyes; then
 fi
 
 AC_MSG_CHECKING([whether nl_langinfo should be used for wide char locale info])
-AC_TRY_COMPILE([#include <langinfo.h>],[
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[
 const char *s;
 s = nl_langinfo (_NL_NUMERIC_DECIMAL_POINT_WC);
 s = nl_langinfo (_NL_MONETARY_DECIMAL_POINT_WC);
 s = nl_langinfo (_NL_NUMERIC_THOUSANDS_SEP_WC);
 s = nl_langinfo (_NL_MONETARY_THOUSANDS_SEP_WC);
 (void) s;
-],
+]])],
 [quadmath_use_nl_langinfo_wc=yes],[quadmath_use_nl_langinfo_wc=no])
 AC_MSG_RESULT($quadmath_use_nl_langinfo_wc)
 if test x$quadmath_use_nl_langinfo_wc = xyes; then
@@ -325,7 +331,7 @@ if test x$quadmath_use_nl_langinfo_wc = xyes; then
 fi
 
 AC_MSG_CHECKING([whether localeconv should be used])
-AC_TRY_COMPILE([#include <locale.h>],[
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <locale.h>]], [[
 const struct lconv *l = localeconv ();
 const char *s;
 s = l->decimal_point;
@@ -335,7 +341,7 @@ s = l->mon_grouping;
 s = l->thousands_sep;
 s = l->mon_thousands_sep;
 (void) s;
-],
+]])],
 [quadmath_use_localeconv=yes],[quadmath_use_localeconv=no])
 AC_MSG_RESULT($quadmath_use_localeconv)
 if test x$quadmath_use_localeconv = xyes; then
@@ -345,11 +351,11 @@ fi
 # Check for whether i18n number rewriting support for quadmath_snprintf
 # or Q printf hooks should be provided.
 AC_MSG_CHECKING([whether i18n number rewriting support for quadmath_snprintf 
should be added])
-AC_TRY_COMPILE([#include <langinfo.h>
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>
 #include <limits.h>
 #include <string.h>
 #include <wchar.h>
-#include <wctype.h>],[
+#include <wctype.h>]], [[
 const char *s;
 char decimal[MB_LEN_MAX];
 wctrans_t map = wctrans ("to_outpunct");
@@ -361,7 +367,7 @@ s = nl_langinfo (_NL_CTYPE_OUTDIGIT0_MB);
 s = nl_langinfo (_NL_CTYPE_OUTDIGIT0_WC);
 s = nl_langinfo (_NL_CTYPE_MB_CUR_MAX);
 (void) s;
-],
+]])],
 [quadmath_use_i18n_number_h=yes],[quadmath_use_i18n_number_h=no])
 AC_MSG_RESULT($quadmath_use_i18n_number_h)
 if test x$quadmath_use_i18n_number_h = xyes; then
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 8037c941774..6bcee19363a 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -75,7 +75,7 @@ AM_PROG_AS
 AC_PROG_RANLIB
 
 AC_LIBTOOL_DLOPEN
-AM_PROG_LIBTOOL
+LT_INIT
 
 AC_PROG_AWK
 case "$AWK" in
@@ -163,12 +163,12 @@ case "$target" in
   *-*-linux*)
     # Some old Linux distributions miss required syscalls.
     sanitizer_supported=no
-    AC_TRY_COMPILE([#include <sys/syscall.h>
-#include <unistd.h>],[
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/syscall.h>
+#include <unistd.h>]], [[
       syscall (__NR_gettid);
       syscall (__NR_futex);
       syscall (__NR_exit_group);
-    ], [sanitizer_supported=yes])
+    ]])], [sanitizer_supported=yes])
     ;;
   *)
     sanitizer_supported=yes
@@ -370,7 +370,7 @@ AH_BOTTOM([#include "libbacktrace/backtrace-rename.h"])
 AC_CONFIG_FILES([Makefile libsanitizer.spec 
libbacktrace/backtrace-supported.h])
 AC_CONFIG_HEADER(config.h)
 
-AC_CONFIG_FILES(AC_FOREACH([DIR], [interception sanitizer_common libbacktrace 
lsan asan ubsan], [DIR/Makefile ]),
+AC_CONFIG_FILES(m4_foreach_w([DIR], [interception sanitizer_common 
libbacktrace lsan asan ubsan], [DIR/Makefile ]),
   [cat > vpsed$$ << \_EOF
 s!`test -f '$<' || echo '$(srcdir)/'`!!
 _EOF
@@ -384,7 +384,7 @@ _EOF
 ])
 
 if test "x$TSAN_SUPPORTED" = "xyes"; then
-  AC_CONFIG_FILES(AC_FOREACH([DIR], [tsan], [DIR/Makefile ]), 
+  AC_CONFIG_FILES(m4_foreach_w([DIR], [tsan], [DIR/Makefile ]),
     [cat > vpsed$$ << \_EOF
 s!`test -f '$<' || echo '$(srcdir)/'`!!
 _EOF
@@ -399,7 +399,7 @@ _EOF
 fi
 
 if test "x$HWASAN_SUPPORTED" = "xyes"; then
-  AC_CONFIG_FILES(AC_FOREACH([DIR], [hwasan], [DIR/Makefile ]), 
+  AC_CONFIG_FILES(m4_foreach_w([DIR], [hwasan], [DIR/Makefile ]),
     [cat > vpsed$$ << \_EOF
 s!`test -f '$<' || echo '$(srcdir)/'`!!
 _EOF
diff --git a/libssp/configure.ac b/libssp/configure.ac
index 5c5698fa3a2..ba45339d4c5 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -31,7 +31,7 @@ AC_SUBST(target_alias)
 
 AC_CONFIG_HEADERS(config.h)
 
-AC_LANG_C
+AC_LANG([C])
 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
 # We must force CC to /not/ be precious variables; otherwise
 # the wrong, non-multilib-adjusted value will be used in multilibs.
@@ -52,11 +52,11 @@ AC_PROG_CPP
 AC_MSG_CHECKING([whether -fstack-protector works])
 save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -fstack-protector -Werror"
-AC_TRY_COMPILE([
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 void __attribute__((noinline)) bar (char *x)
 {
   __builtin_memset (x, 0, 64);
-}],[char buf[64]; bar (buf);],
+}]], [[char buf[64]; bar (buf);]])],
 [AC_MSG_RESULT(yes)],
 [AC_MSG_RESULT(no)])
 CFLAGS="$save_CFLAGS"
@@ -67,8 +67,8 @@ XCFLAGS="$XCFLAGS $CET_FLAGS"
 AC_SUBST(XCFLAGS)
 
 AC_MSG_CHECKING([whether hidden visibility is supported])
-AC_TRY_COMPILE([
-void __attribute__((visibility ("hidden"))) bar (void) {}],,
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+void __attribute__((visibility ("hidden"))) bar (void) {}]], [[]])],
 [ssp_hidden=yes],[ssp_hidden=no])
 AC_MSG_RESULT($ssp_hidden)
 if test x$ssp_hidden = xyes; then
@@ -94,7 +94,10 @@ FOO_1.0 {
   global: *foo*; bar; local: *;
 };
 EOF
-    AC_TRY_LINK([int foo;],[],[ssp_use_symver=gnu],[ssp_use_symver=no])
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[int foo;]], [[]])],
+      [ssp_use_symver=gnu],
+      [ssp_use_symver=no])
     if test x$ssp_use_symver = xno; then
       case "$target_os" in
         solaris2*)
@@ -106,7 +109,10 @@ FOO_1.0 {
   global: foo; local: *;
 };
 EOF
-          AC_TRY_LINK([int foo;],[],[ssp_use_symver=sun],[ssp_use_symver=no])
+          AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM([[int foo;]], [[]])],
+            [ssp_use_symver=sun],
+            [ssp_use_symver=no])
          ;;
       esac
     fi
@@ -159,7 +165,7 @@ else
 fi
 AC_SUBST(ssp_have_usable_vsnprintf)
 
-AM_PROG_LIBTOOL
+LT_INIT
 ACX_LT_HOST_FLAGS
 AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index 50aaadbb3a3..62cbd37f28a 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -117,10 +117,10 @@ esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexeclibdir)
 
-AC_GNU_SOURCE
+AC_USE_SYSTEM_EXTENSIONS
 AC_CHECK_FUNCS([__secure_getenv])
 
-AC_GNU_SOURCE
+AC_USE_SYSTEM_EXTENSIONS
 AC_CHECK_FUNCS([secure_getenv])
 
 AC_CHECK_FUNCS([getexecname __fortify_fail])
@@ -149,7 +149,7 @@ AC_CHECK_TOOL(RANLIB, ranlib, :)
 
 # Configure libtool
 AC_LIBTOOL_DLOPEN
-AM_PROG_LIBTOOL
+LT_INIT
 ACX_LT_HOST_FLAGS
 AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
@@ -176,7 +176,7 @@ fi
 AC_CONFIG_FILES([Makefile])
 
 if test "x$VTV_SUPPORTED" = "xyes"; then
-  AC_CONFIG_FILES(AC_FOREACH([DIR], [testsuite], [DIR/Makefile ]), 
+  AC_CONFIG_FILES(m4_foreach_w([DIR], [testsuite], [DIR/Makefile ]),
     [cat > vpsed$$ << \_EOF
 s!`test -f '$<' || echo '$(srcdir)/'`!!
 _EOF
diff --git a/lto-plugin/configure b/lto-plugin/configure
index 28f5dd79cd7..f260fdc8be9 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -2514,7 +2514,6 @@ test -n "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
-
  case ${build_alias} in
   "") build_noncanonical=${build} ;;
   *) build_noncanonical=${build_alias} ;;
@@ -12241,7 +12240,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12244 "configure"
+#line 12243 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12347,7 +12346,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12350 "configure"
+#line 12349 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/lto-plugin/configure.ac b/lto-plugin/configure.ac
index c051b8c6283..22953058c45 100644
--- a/lto-plugin/configure.ac
+++ b/lto-plugin/configure.ac
@@ -1,5 +1,5 @@
 AC_INIT([LTO plugin for ld], 0.1,,[lto-plugin])
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 GCC_TOPLEV_SUBDIRS
 AM_INIT_AUTOMAKE([foreign no-dist])
 AM_MAINTAINER_MODE
@@ -75,7 +75,10 @@ else
   global: *foo*; bar; local: *;
 };
 EOF
-  AC_TRY_LINK([int 
foo;],[],[lto_plugin_use_symver=gnu],[lto_plugin_use_symver=no])
+  AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[int foo;]], [[]])],
+    [lto_plugin_use_symver=gnu],
+    [lto_plugin_use_symver=no])
   if test x$lto_plugin_use_symver = xno; then
     case "$target_os" in
       solaris2*)
@@ -87,7 +90,10 @@ EOF
   global: foo; local: *;
 };
 EOF
-       AC_TRY_LINK([int 
foo;],[],[lto_plugin_use_symver=sun],[lto_plugin_use_symver=no])
+       AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM([[int foo;]], [[]])],
+         [lto_plugin_use_symver=sun],
+          [lto_plugin_use_symver=no])
          ;;
     esac
   fi
@@ -120,7 +126,7 @@ fi
 
 AC_SUBST(ac_lto_plugin_extra_ldflags)
 
-AM_PROG_LIBTOOL
+LT_INIT
 AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = 
xyes])
 ACX_LT_HOST_FLAGS
 AC_SUBST(target_noncanonical)
-- 
2.43.0

Reply via email to