[Gmp-commit] /var/hg/gmp: autoconf: AC_TRY_* -> AC_*_IFELSE

mercurial at gmplib.org mercurial at gmplib.org
Mon Aug 21 14:12:12 CEST 2023


details:   /var/hg/gmp/rev/dbd9a550c0be
changeset: 18443:dbd9a550c0be
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Mon Aug 21 14:12:09 2023 +0200
description:
autoconf: AC_TRY_* -> AC_*_IFELSE

diffstat:

 ChangeLog    |   2 ++
 acinclude.m4 |  42 +++++++++++++++++++++---------------------
 configure.ac |   4 ++--
 3 files changed, 25 insertions(+), 23 deletions(-)

diffs (166 lines):

diff -r ef2da199af18 -r dbd9a550c0be ChangeLog
--- a/ChangeLog	Mon Aug 21 13:40:17 2023 +0200
+++ b/ChangeLog	Mon Aug 21 14:12:09 2023 +0200
@@ -15,6 +15,8 @@
 	Remove redundant backslash.
 	Use AC_CONFIG_FILES.
 
+	* acinclude.m4, configure.ac: AC_TRY_* -> AC_*_IFELSE.
+
 2023-08-19  Marc Glisse  <marc.glisse at inria.fr>
 
 	* doc/gmp.texi: Rename IEEE P754. Remove @refill.
diff -r ef2da199af18 -r dbd9a550c0be acinclude.m4
--- a/acinclude.m4	Mon Aug 21 13:40:17 2023 +0200
+++ b/acinclude.m4	Mon Aug 21 14:12:09 2023 +0200
@@ -1642,7 +1642,7 @@
 dnl  "action-success".  If either action does a "break" out of a loop then
 dnl  an explicit "rm -f conftest*" will be necessary.
 dnl
-dnl  This is not unlike AC_TRY_COMPILE, but there's no default includes or
+dnl  This is not unlike AC_COMPILE_IFELSE, but there's no default includes or
 dnl  anything in "asm-code", everything wanted must be given explicitly.
 
 AC_DEFUN([GMP_TRY_ASSEMBLE],
@@ -3142,7 +3142,7 @@
 AC_DEFUN([GMP_C_ATTRIBUTE_CONST],
 [AC_CACHE_CHECK([whether gcc __attribute__ ((const)) works],
                 gmp_cv_c_attribute_const,
-[AC_TRY_COMPILE([int foo (int x) __attribute__ ((const));], ,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo (int x) __attribute__ ((const));]], [[]])],
   gmp_cv_c_attribute_const=yes, gmp_cv_c_attribute_const=no)
 ])
 if test $gmp_cv_c_attribute_const = yes; then
@@ -3191,7 +3191,7 @@
 AC_DEFUN([GMP_C_ATTRIBUTE_MODE],
 [AC_CACHE_CHECK([whether gcc __attribute__ ((mode (XX))) works],
                 gmp_cv_c_attribute_mode,
-[AC_TRY_COMPILE([typedef int SItype __attribute__ ((mode (SI)));], ,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[typedef int SItype __attribute__ ((mode (SI)));]], [[]])],
   gmp_cv_c_attribute_mode=yes, gmp_cv_c_attribute_mode=no)
 ])
 if test $gmp_cv_c_attribute_mode = yes; then
@@ -3207,7 +3207,7 @@
 AC_DEFUN([GMP_C_ATTRIBUTE_NORETURN],
 [AC_CACHE_CHECK([whether gcc __attribute__ ((noreturn)) works],
                 gmp_cv_c_attribute_noreturn,
-[AC_TRY_COMPILE([void foo (int x) __attribute__ ((noreturn));], ,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void foo (int x) __attribute__ ((noreturn));]], [[]])],
   gmp_cv_c_attribute_noreturn=yes, gmp_cv_c_attribute_noreturn=no)
 ])
 if test $gmp_cv_c_attribute_noreturn = yes; then
@@ -3222,11 +3222,11 @@
 AC_DEFUN([GMP_C_HIDDEN_ALIAS],
 [AC_CACHE_CHECK([whether gcc hidden aliases work],
                 gmp_cv_c_hidden_alias,
-[AC_TRY_COMPILE(
-[void hid() __attribute__ ((visibility("hidden")));
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[void hid() __attribute__ ((visibility("hidden")));
 void hid() {}
-void pub() __attribute__ ((alias("hid")));],
-, gmp_cv_c_hidden_alias=yes, gmp_cv_c_hidden_alias=no)
+void pub() __attribute__ ((alias("hid")));]], [[]])],
+  gmp_cv_c_hidden_alias=yes, gmp_cv_c_hidden_alias=no)
 ])
 if test $gmp_cv_c_hidden_alias = yes; then
   AC_DEFINE(HAVE_HIDDEN_ALIAS, 1,
@@ -3533,11 +3533,11 @@
 [AC_REQUIRE([GMP_HEADER_ALLOCA])
 AC_CACHE_CHECK([for alloca (via gmp-impl.h)],
                gmp_cv_func_alloca,
-[AC_TRY_LINK(
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([
 GMP_INCLUDE_GMP_H
 [#include "$srcdir/gmp-impl.h"
-],
-  [char *p = (char *) alloca (1);],
+]],
+  [[char *p = (char *) alloca (1);]])],
   gmp_cv_func_alloca=yes,
   gmp_cv_func_alloca=no)])
 if test $gmp_cv_func_alloca = yes; then
@@ -3550,8 +3550,8 @@
 # for constant arguments.  Useless!
 AC_CACHE_CHECK([for working alloca.h],
                gmp_cv_header_alloca,
-[AC_TRY_LINK([#include <alloca.h>],
-  [char *p = (char *) alloca (2 * sizeof (int));],
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <alloca.h>]],
+  [[char *p = (char *) alloca (2 * sizeof (int));]])],
   gmp_cv_header_alloca=yes,
   gmp_cv_header_alloca=no)])
 if test $gmp_cv_header_alloca = yes; then
@@ -3683,7 +3683,7 @@
                  gmp_cv_func_vsnprintf,
   [gmp_cv_func_vsnprintf=yes
    for i in 'return check ("hello world");' 'int n; return check ("%nhello world", &n);'; do
-     AC_TRY_RUN([
+     AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <string.h>  /* for strcmp */
 #include <stdio.h>   /* for vsnprintf */
 
@@ -3715,7 +3715,7 @@
 {
 $i
 }
-],
+]])],
       [:],
       [gmp_cv_func_vsnprintf=no; break],
       [gmp_cv_func_vsnprintf=probably; break])
@@ -3742,13 +3742,13 @@
 case $ac_cv_c_inline in
 no) ;;
 *)
-  AC_TRY_COMPILE(
-[#define __GMP_WITHIN_CONFIGURE_INLINE 1
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#define __GMP_WITHIN_CONFIGURE_INLINE 1
 ]GMP_INCLUDE_GMP_H[
 #ifndef __GMP_EXTERN_INLINE
 die die die
 #endif
-],,,
+]],[[]])],,
   [case $ac_cv_c_inline in
   yes) tmp_inline=inline ;;
   *)   tmp_inline=$ac_cv_c_inline ;;
@@ -3765,13 +3765,13 @@
 dnl  included to get FILE.
 
 AC_DEFUN([GMP_H_HAVE_FILE],
-[AC_TRY_COMPILE(
-[#include <stdio.h>]
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[#include <stdio.h>]
 GMP_INCLUDE_GMP_H
 [#if ! _GMP_H_HAVE_FILE
 die die die
 #endif
-],,,
+]],[[]])],,
   [AC_MSG_WARN([gmp.h doesnt recognise <stdio.h>, FILE prototypes will be unavailable])])
 ])
 
diff -r ef2da199af18 -r dbd9a550c0be configure.ac
--- a/configure.ac	Mon Aug 21 13:40:17 2023 +0200
+++ b/configure.ac	Mon Aug 21 14:12:09 2023 +0200
@@ -37,7 +37,7 @@
 
 AC_REVISION($Revision$)
 AC_PREREQ([2.69])
-AC_INIT([GNU MP], [GMP_VERSION], [gmp-bugs at gmplib.org (see https://gmplib.org/manual/Reporting-Bugs.html)], [gmp])
+AC_INIT([GNU MP],[GMP_VERSION],[gmp-bugs at gmplib.org (see https://gmplib.org/manual/Reporting-Bugs.html)],[gmp])
 AC_CONFIG_SRCDIR(gmp-impl.h)
 m4_pattern_forbid([^[ \t]*GMP_])
 m4_pattern_allow(GMP_LDFLAGS)
@@ -368,7 +368,7 @@
 # After GMP specific searches and tests, the standard autoconf AC_PROG_CC is
 # called.  User selections of CC etc are respected.
 #
-# Care is taken not to use macros like AC_TRY_COMPILE during the GMP
+# Care is taken not to use macros like AC_COMPILE_IFELSE during the GMP
 # pre-testing, since they of course depend on AC_PROG_CC, and also some of
 # them cache their results, which is not wanted.
 #


More information about the gmp-commit mailing list