Selaa lähdekoodia

Use AC_*_IFELSE instead of obsolete AC_TRY_* macros

Guillem Jover 17 vuotta sitten
vanhempi
commit
31843aafa7
3 muutettua tiedostoa jossa 19 lisäystä ja 20 poistoa
  1. 8 7
      m4/compiler.m4
  2. 9 8
      m4/funcs.m4
  3. 2 5
      m4/types.m4

+ 8 - 7
m4/compiler.m4

@@ -35,9 +35,10 @@ fi])dnl
 # Check whether the C compiler supports __attribute__, defines HAVE_C_ATTRIBUTE
 AC_DEFUN([DPKG_C_ATTRIBUTE],
 [AC_CACHE_CHECK([whether compiler supports __attribute__], [dpkg_cv_attribute],
-[AC_TRY_COMPILE([],
-[extern int testfunction(int x) __attribute__((unused))
-],
+	[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+		[[]],
+		[[extern int testfunction(int x) __attribute__((unused))]]
+	)],
 	[dpkg_cv_attribute=yes],
 	[dpkg_cv_attribute=no])])
 AS_IF([test "x$dpkg_cv_attribute" = "xyes"],
@@ -50,7 +51,7 @@ AS_IF([test "x$dpkg_cv_attribute" = "xyes"],
 # ------------------------------------------------------
 # Try compiling some C99 code to see whether it works
 AC_DEFUN([DPKG_TRY_C99],
-[AC_TRY_COMPILE([
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <stdio.h>
 #include <stdbool.h>
 #include <inttypes.h>
@@ -58,8 +59,8 @@ AC_DEFUN([DPKG_TRY_C99],
 
 /* Variadic macro arguments */
 #define variadic_macro(foo, ...) printf(foo, __VA_ARGS__)
-],
-[
+]],
+[[
 	/* Compound initialisers */
 	struct { int a, b; } foo = { .a = 1, .b = 2 };
 
@@ -75,7 +76,7 @@ AC_DEFUN([DPKG_TRY_C99],
 
 	/* Magic __func__ variable */
 	printf("%s", __func__);
-], [$1], [$2])dnl
+]])], [$1], [$2])dnl
 ])# DPKG_TRY_C99
 
 # DPKG_C_C99

+ 9 - 8
m4/funcs.m4

@@ -5,26 +5,27 @@
 # Define HAVE_VA_COPY if we have va_copy, fail if they can't be assigned
 AC_DEFUN([DPKG_FUNC_VA_COPY],
 [AC_CACHE_CHECK([for va_copy], [dpkg_cv_va_copy],
-[AC_TRY_RUN(
-[#include <stdarg.h>
+	[AC_RUN_IFELSE([AC_LANG_SOURCE(
+[[#include <stdarg.h>
 main() {
 va_list v1, v2;
 va_copy (v1, v2);
 exit (0);
-}],
+}
+	]])],
 	[dpkg_cv_va_copy=yes],
+	[dpkg_cv_va_copy=no],
 	[dpkg_cv_va_copy=no])])
 AS_IF([test "x$dpkg_cv_va_copy" = "xyes"],
 	[AC_DEFINE([HAVE_VA_COPY], 1,
 		  [Define to 1 if the `va_copy' macro exists])],
 	[AC_CACHE_CHECK([for va_list assignment by copy],
 		       [dpkg_cv_va_list_copy],
-[AC_TRY_COMPILE(
-[#include <stdarg.h>
-],
-[va_list v1, v2;
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#include <stdarg.h>]],
+[[va_list v1, v2;
 v1 = v2;
-],
+]])],
 		       [dpkg_cv_va_list_copy=yes],
 		       [dpkg_cv_va_list_copy=no])])])
 ])# DPKG_FUNC_VA_COPY

+ 2 - 5
m4/types.m4

@@ -26,11 +26,8 @@ AC_CHECK_DECLS([sys_siglist],,,
 # Defines HAVE_DEFINE to 1 if declared in HEADER, 0 otherwise
 AC_DEFUN([DPKG_CHECK_DEFINE],
 [AC_CACHE_CHECK([whether $1 is defined in $2], [dpkg_cv_define_$1],
-[AC_TRY_COMPILE(
-[#include <$2>
-],
-[int i = $1;
-],
+[AC_COMPILE_IFELSE(
+	[AC_LANG_PROGRAM([[#include <$2>]], [[int i = $1;]])],
 	[dpkg_cv_define_$1=yes],
 	[dpkg_cv_define_$1=no])])
 AS_IF([test "x$dpkg_cv_define" = "xyes"],