From 6f26637e83727b05f865389937bb07c761c13c12 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 25 Jan 2021 16:07:55 -0500 Subject: [PATCH] m4macros: replace obsolete macros AC_TRY_RUN and AC_TRY_LINK in glib-2.0.m4 Running autoconf 2.70 with -Wall,error on a configure.ac that uses AM_PATH_GLIB_2_0 gives: configure.ac:261: warning: The macro `AC_TRY_RUN' is obsolete. configure.ac:261: You should run autoupdate. ./lib/autoconf/general.m4:2996: AC_TRY_RUN is expanded from... /usr/share/aclocal/glib-2.0.m4:11: AM_PATH_GLIB_2_0 is expanded from... configure.ac:261: the top level configure.ac:261: warning: The macro `AC_TRY_LINK' is obsolete. configure.ac:261: You should run autoupdate. ./lib/autoconf/general.m4:2919: AC_TRY_LINK is expanded from... /usr/share/aclocal/glib-2.0.m4:11: AM_PATH_GLIB_2_0 is expanded from... configure.ac:261: the top level Run autoupdate on glib-2.0.m4 to change AC_TRY_RUN and AC_TRY_LINK into the suggested alternative, and adjust the formatting a little bit. The macros used in the alternative existed for long enough that there shouldn't be a problem with backwards compatibility. Signed-off-by: Simon Marchi --- m4macros/glib-2.0.m4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/m4macros/glib-2.0.m4 b/m4macros/glib-2.0.m4 index d36a0cea4..5c73f3bcb 100644 --- a/m4macros/glib-2.0.m4 +++ b/m4macros/glib-2.0.m4 @@ -94,7 +94,7 @@ dnl Now check if the installed GLib is sufficiently new. (Also sanity dnl checks the results of pkg-config to some extent) dnl rm -f conf.glibtest - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include #include @@ -162,7 +162,7 @@ main (void) } return 1; } -],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) +]])],[],[no_glib=yes],[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi @@ -184,10 +184,10 @@ main (void) ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS" - AC_TRY_LINK([ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #include -], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], +]], [[ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ]])], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GLib or finding the wrong" echo "*** version of GLib. If it is not finding GLib, you'll need to set your"