autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 11/12] use a shell function for AC_CHECK_MEMBER


From: Eric Blake
Subject: Re: [PATCH 11/12] use a shell function for AC_CHECK_MEMBER
Date: Mon, 27 Oct 2008 20:54:55 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 10/27/2008 9:04 AM:
>> +     INCLUDES, setting cache variable VAR accordingly.])],
>> +    [_$0_BODY])]dnl
>> +[AS_LITERAL_IF([$1], [], [AC_FATAL([$0: requires literal arguments])])]dnl
> 
> Pre-existing, but worth fixing: AC_FATAL is an obsolete synonym for 
> m4_fatal,...
> 
>> +[m4_bmatch([$1], [\.], , [m4_fatal([$0: Did not see any dot in `$1'])])]dnl
> 
> so we might as well use m4_fatal twice for consistency.  m4_bmatch is 
> overkill 
> for finding a single literal character (m4_index is much faster).  I guess I 
> should clean this up in advance, then we can rebase this patch.

Part one of the cleanup - prefer m4_fatal over AC_FATAL.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkGfv8ACgkQ84KuGfSFAYBqogCgokdFk4L1Dua5UkNApT8dUsFk
IoQAn2gJGvSOLHgfpkeaI1LC/gpqtLG1
=FkbI
-----END PGP SIGNATURE-----
>From d783e517644aa68e36b34335340d8629114d1f97 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 27 Oct 2008 17:22:40 -0600
Subject: [PATCH] Prefer m4_fatal over AC_FATAL.

* lib/autoconf/types.m4 (AC_CHECK_SIZEOF, AC_CHECK_ALIGNOF)
(AC_CHECK_MEMBER): Use non-obsolete macro name.
* lib/autoconf/fortran.m4 (_AC_LIST_MEMBER_IF): Likewise.
* lib/autoconf/general.m4 (AC_REQUIRE_AUX_FILE, AC_SUBST):
Likewise.
* lib/autoconf/lang.m4 (_AC_LANG_DISPATCH): Likewise.
* lib/autoconf/status.m4 (_AC_CONFIG_DEPENDENCY_DEFAULT)
(_AC_CONFIG_UNIQUE, _AC_CONFIG_REGISTER_DEST): Likewise.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog               |   12 ++++++++++++
 lib/autoconf/fortran.m4 |    8 ++++----
 lib/autoconf/general.m4 |   13 ++++++-------
 lib/autoconf/lang.m4    |    4 ++--
 lib/autoconf/status.m4  |   18 ++++++++++--------
 lib/autoconf/types.m4   |   20 ++++++++++----------
 6 files changed, 44 insertions(+), 31 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e7704b2..9a6a5f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2008-10-27  Eric Blake  <address@hidden>
 
+       Prefer m4_fatal over AC_FATAL.
+       * lib/autoconf/types.m4 (AC_CHECK_SIZEOF, AC_CHECK_ALIGNOF)
+       (AC_CHECK_MEMBER): Use non-obsolete macro name.
+       * lib/autoconf/fortran.m4 (_AC_LIST_MEMBER_IF): Likewise.
+       * lib/autoconf/general.m4 (AC_REQUIRE_AUX_FILE, AC_SUBST):
+       Likewise.
+       * lib/autoconf/lang.m4 (_AC_LANG_DISPATCH): Likewise.
+       * lib/autoconf/status.m4 (_AC_CONFIG_DEPENDENCY_DEFAULT)
+       (_AC_CONFIG_UNIQUE, _AC_CONFIG_REGISTER_DEST): Likewise.
+
+2008-10-27  Eric Blake  <address@hidden>
+
        Avoid raw carriage return in scripts.
        * lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Generate CR
        via tr, rather than with literal byte.
diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index 34d9301..519f3f0 100644
--- a/lib/autoconf/fortran.m4
+++ b/lib/autoconf/fortran.m4
@@ -100,10 +100,10 @@
 # if ELEMENT is a member of LIST, otherwise it executes
 # ACTION-IF-NOT-FOUND.
 AC_DEFUN([_AC_LIST_MEMBER_IF],
-[dnl Do some sanity checking of the arguments.
-m4_if([$1], , [AC_FATAL([$0: missing argument 1])])dnl
-m4_if([$2], , [AC_FATAL([$0: missing argument 2])])dnl
-  ac_exists=false
+dnl Do some sanity checking of the arguments.
+[m4_if([$1], , [m4_fatal([$0: missing argument 1])],
+      [$2], , [m4_fatal([$0: missing argument 2])])]dnl
+[  ac_exists=false
   for ac_i in $2; do
     if test x"$1" = x"$ac_i"; then
       ac_exists=true
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index c8ab4af..922dda3 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -1722,7 +1722,7 @@ AC_DEFUN([AC_CONFIG_MACRO_DIR], [])
 # It announces FILE is required in the auxdir.
 m4_define([AC_REQUIRE_AUX_FILE],
 [AS_LITERAL_IF([$1], [],
-              [AC_FATAL([$0: requires a literal argument])])])
+              [m4_fatal([$0: requires a literal argument])])])
 
 
 
@@ -2111,12 +2111,11 @@ m4_define([AC_SUBST_TRACE])
 #
 m4_define([AC_SUBST],
 [AS_IDENTIFIER_IF([$1], [],
-  [AC_FATAL([$0: `$1' is not a valid shell variable name])])dnl
-AC_SUBST_TRACE([$1])dnl
-m4_pattern_allow([^$1$])dnl
-m4_ifvaln([$2], [$1=$2])[]dnl
-m4_set_add([_AC_SUBST_VARS], [$1])dnl
-])# AC_SUBST
+  [m4_fatal([$0: `$1' is not a valid shell variable name])])]dnl
+[AC_SUBST_TRACE([$1])]dnl
+[m4_pattern_allow([^$1$])]dnl
+[m4_ifvaln([$2], [$1=$2])[]]dnl
+[m4_set_add([_AC_SUBST_VARS], [$1])])# AC_SUBST
 
 
 # AC_SUBST_FILE(VARIABLE)
diff --git a/lib/autoconf/lang.m4 b/lib/autoconf/lang.m4
index c48f1de..9ebc7d6 100644
--- a/lib/autoconf/lang.m4
+++ b/lib/autoconf/lang.m4
@@ -86,7 +86,7 @@ m4_define([AC_LANG_CASE],
 m4_define([_AC_LANG_DISPATCH],
 [m4_ifdef([$1($2)],
        [m4_indir([$1($2)], m4_shift2($@))],
-       [AC_FATAL([$1: unknown language: $2])])])
+       [m4_fatal([$1: unknown language: $2])])])
 
 
 # _AC_LANG_SET(OLD, NEW)
@@ -495,7 +495,7 @@ do
        # certainly right.
        break;;
     *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
        then :; else
           ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']`
        fi
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index eb3ddbd..54758b1 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -207,7 +207,8 @@ m4_define([_AC_CONFIG_DEPENDENCY],
 m4_define([_AC_CONFIG_DEPENDENCY_DEFAULT],
 [m4_bmatch([$2], [:], [],
           [m4_if([$1], [LINKS],
-                 [AS_LITERAL_IF([$2], [AC_FATAL([Invalid AC_CONFIG_LINKS tag: 
`$2'])])],
+                 [AS_LITERAL_IF([$2],
+                   [m4_fatal([Invalid AC_CONFIG_LINKS tag: `$2'])])],
                  [:$2.in])])dnl
 ])
 
@@ -220,7 +221,8 @@ m4_define([_AC_CONFIG_DEPENDENCY_DEFAULT],
 #
 m4_define([_AC_CONFIG_UNIQUE],
 [m4_ifdef([_AC_SEEN_TAG($2)],
-   [AC_FATAL([`$2' is already registered with 
AC_CONFIG_]m4_defn([_AC_SEEN_TAG($2)]).)],
+   [m4_fatal([`$2' is already registered with AC_CONFIG_]m4_defn(
+     [_AC_SEEN_TAG($2)]).)],
    [m4_define([_AC_SEEN_TAG($2)], [$1])])dnl
 ])
 
@@ -270,15 +272,15 @@ _AC_CONFIG_REGISTER_DEST([$1], [$2], m4_bpatsubst([[$2]], 
[:.*\(.\)$], [\1]), [$
 # Save the name of the first config header to AH_HEADER.
 #
 m4_define([_AC_CONFIG_REGISTER_DEST],
-[_AC_CONFIG_UNIQUE([$1], [$3])dnl
-m4_if([$1 $3], [LINKS .],
-      [AC_FATAL([invalid destination of a config link: `.'])])dnl
-m4_if([$1], [HEADERS],
-      [m4_define_default([AH_HEADER], [$3])])dnl
+[_AC_CONFIG_UNIQUE([$1], [$3])]dnl
+[m4_if([$1 $3], [LINKS .],
+       [m4_fatal([invalid destination of a config link: `.'])],
+       [$1], [HEADERS],
+       [m4_define_default([AH_HEADER], [$3])])]dnl
 dnl
 dnl Recognize TAG as an argument to config.status:
 dnl
-m4_append([_AC_LIST_TAGS],
+[m4_append([_AC_LIST_TAGS],
 [    "$3") CONFIG_$1="$CONFIG_$1 $2" ;;
 ])dnl
 dnl
diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
index f310cd1..2b63331 100644
--- a/lib/autoconf/types.m4
+++ b/lib/autoconf/types.m4
@@ -150,7 +150,7 @@ m4_define([_AC_CHECK_TYPE_NEW_BODY],
   AC_COMPILE_IFELSE(
     [AC_LANG_PROGRAM([$[]4],
        [if (sizeof ($[]2))
-         return 0;])],
+        return 0;])],
     [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM([$[]4],
          [if (sizeof (($[]2)))
@@ -741,8 +741,8 @@ Remove this warning and the `AC_CACHE_CHECK' when you 
adjust the code.])
 # ---------------------------------------------------------------
 AC_DEFUN([AC_CHECK_SIZEOF],
 [AS_LITERAL_IF([$1], [],
-              [AC_FATAL([$0: requires literal arguments])])dnl
-# The cast to long int works around a bug in the HP C Compiler
+              [m4_fatal([$0: requires literal arguments])])]dnl
+[# The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
@@ -764,8 +764,8 @@ AC_DEFINE_UNQUOTED(AS_TR_CPP(sizeof_$1), 
$AS_TR_SH([ac_cv_sizeof_$1]),
 # -----------------------------------------------------
 AC_DEFUN([AC_CHECK_ALIGNOF],
 [AS_LITERAL_IF([$1], [],
-              [AC_FATAL([$0: requires literal arguments])])dnl
-# The cast to long int works around a bug in the HP C Compiler,
+              [m4_fatal([$0: requires literal arguments])])]dnl
+[# The cast to long int works around a bug in the HP C Compiler,
 # see AC_CHECK_SIZEOF for more information.
 _AC_CACHE_CHECK_INT([alignment of $1], [AS_TR_SH([ac_cv_alignof_$1])],
   [(long int) offsetof (ac__type_alignof_, y)],
@@ -829,12 +829,12 @@ you adjust the code.])
 # variables are not a valid argument.
 AC_DEFUN([AC_CHECK_MEMBER],
 [AS_LITERAL_IF([$1], [],
-              [AC_FATAL([$0: requires literal arguments])])dnl
-m4_bmatch([$1], [\.], ,
-        [m4_fatal([$0: Did not see any dot in `$1'])])dnl
-AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl
+              [AC_FATAL([$0: requires literal arguments])])]dnl
+[m4_if(m4_index([$1], [.]), [-1],
+       [m4_fatal([$0: Did not see any dot in `$1'])])]dnl
+[AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])]dnl
 dnl Extract the aggregate name, and the member name
-AC_CACHE_CHECK([for $1], [ac_Member],
+[AC_CACHE_CHECK([for $1], [ac_Member],
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
 [dnl AGGREGATE ac_aggr;
 static m4_bpatsubst([$1], [\..*]) ac_aggr;
-- 
1.6.0.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]