]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* acgeneral.m4 (AC_SPECIALIZE): Avoid a useless `indir'.
authorAkim Demaille <akim@epita.fr>
Fri, 19 May 2000 12:11:47 +0000 (12:11 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 19 May 2000 12:11:47 +0000 (12:11 +0000)
(AC_CHECK_MEMBER, AC_CHECK_MEMBERS): Fix to work properly on
`struct f.g.h'.
* acspecific.m4 (AC_FUNC_GETLOADAVG): Use AC_CHECK_HEADERS and
AC_CHECK_MEMBERS instead of performing their task by hand.

ChangeLog
NEWS
acgeneral.m4
acspecific.m4
doc/autoconf.texi
lib/autoconf/general.m4
lib/autoconf/specific.m4

index f6d159feba6deb9817ae2fc20870d26f429f13e2..8e1816141cd40cd2f015edc098349b05d1871e7b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2000-05-19  Akim Demaille  <akim@epita.fr>
+
+       * acgeneral.m4 (AC_SPECIALIZE): Avoid a useless `indir'.
+       (AC_CHECK_MEMBER, AC_CHECK_MEMBERS): Fix to work properly on
+       `struct f.g.h'.
+       * acspecific.m4 (AC_FUNC_GETLOADAVG): Use AC_CHECK_HEADERS and
+       AC_CHECK_MEMBERS instead of performing their task by hand.
+
 2000-05-19  Akim Demaille  <akim@epita.fr>
 
        Synchronize AC_FUNC_GETLOADAVG with the version of the shellutils
diff --git a/NEWS b/NEWS
index f22df22e34afcd5544073f0a7b8bf8279b130494..22b1b01ffd56b563e61f42866aa2a0ad6cf6d243 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -150,6 +150,9 @@ test cases in this new frame work.
 
 
 ** Specific Macros
+- AC_FUNC_GETLOADAVG
+  Defines `HAVE_STRUCT_NLIST_N_UN_N_NAME' instead of `NLIST_NAME_UNION'.
+
 - AC_PROG_LEX
   Now integrates `AC_DECL_YYTEXT' which is obsoleted.
 
index b37d9a30a8efb0c5450876b2f554a2b8f85d939c..dfcc25843ddb34284074677c858c55e9568588e9 100644 (file)
@@ -273,7 +273,7 @@ define(AC_OBSOLETE,
 define(AC_SPECIALIZE,
 [ifdef([$1-$2],
        [indir([$1-$2], m4_shift(m4_shift($@)))],
-       [indir([$1], m4_shift($@))])])
+       [$1(m4_shift($@))])])
 
 
 
@@ -2399,9 +2399,9 @@ dnl Extract the aggregate name, and the member name
 AC_CACHE_CHECK([for $1], ac_Member,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
 [dnl AGGREGATE foo;
-patsubst([$1], [\.[^.]*]) foo;
+patsubst([$1], [\..*]) foo;
 dnl foo.MEMBER;
-foo.patsubst([$1], [.*\.]);])],
+foo.patsubst([$1], [^[^.]*\.]);])],
                 AC_VAR_SET(ac_Member, yes),
                 AC_VAR_SET(ac_Member, no))])
 AC_SHELL_IFELSE([test AC_VAR_GET(ac_Member) = yes],
@@ -2410,17 +2410,17 @@ AC_VAR_POPDEF([ac_Member])dnl
 ])# AC_CHECK_MEMBER
 
 
-# AC_CHECK_MEMBER([AGGREGATE.MEMBER, ...],
-#                 [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]
-#                 [INCLUDES])
-# --------------------------------------------------------
+# AC_CHECK_MEMBERS([AGGREGATE.MEMBER, ...],
+#                  [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]
+#                  [INCLUDES])
+# ---------------------------------------------------------
 # The first argument is an m4 list.
 AC_DEFUN(AC_CHECK_MEMBERS,
 [m4_foreach([AC_Member], [$1],
   [AC_SPECIALIZE([AC_CHECK_MEMBER], AC_Member,
          [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Member), 1,
-                            [Define if `]patsubst(AC_Member, [.*\.])[' is
-                             member of `]patsubst(AC_Member, [\.[^.]*])['.])
+                            [Define if `]patsubst(AC_Member, [^[^.]*\.])[' is
+                             member of `]patsubst(AC_Member, [\..*])['.])
 $2],
                  [$3],
                  [$4])])])
index 1096bc3ba3b9577b0272de3dc78b99fdd87df625..56ee54ebc0cb7ae0f0652c1a6ab224179a959c61 100644 (file)
@@ -900,7 +900,7 @@ if test $ac_cv_func_getloadavg = yes; then
             [Define if your system has its own `getloadavg' function.])
   ac_have_func=yes
 else
-  AC_DEFINE(C_GETLOADAVG, 1, [Define if using getloadavg.c.])
+  AC_DEFINE(C_GETLOADAVG, 1, [Define if using `getloadavg.c'.])
   # Figure out what our getloadavg.c needs.
   ac_have_func=no
   AC_CHECK_HEADER(sys/dg_sys_info.h,
@@ -937,18 +937,13 @@ else
     AC_CHECK_HEADERS(mach/mach.h)
   fi
 
-  AC_CHECK_HEADER(nlist.h,
-  [AC_DEFINE(NLIST_STRUCT, 1, [Define if you have <nlist.h>.])
-  AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
-  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <nlist.h>
-],
-                                      [struct nlist n; n.n_un.n_name = 0;])],
-                     [ac_cv_struct_nlist_n_un=yes],
-                     [ac_cv_struct_nlist_n_un=no])])
-  if test $ac_cv_struct_nlist_n_un = yes; then
-    AC_DEFINE(NLIST_NAME_UNION, 1,
-              [Define if your `struct nlist' has an `n_un' member.])
-  fi
+  AC_CHECK_HEADERS(nlist.h,
+  [AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
+                    [AC_DEFINE(NLIST_NAME_UNION, 1,
+                               [Define if your `struct nlist' has an
+                                `n_un' member.  Obsolete, depend on
+                                `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
+                    [@%:@include <nlist.h>])
   ])dnl
 fi # Do not have getloadavg in system libraries.
 
index da72c73767e13b9bc7dd928edfbe32368c97485f..7640ef2c3f315c799e53ed078551a8648d26b87d 100644 (file)
@@ -2893,8 +2893,9 @@ those systems.
 If @file{nlist.h} is found, define @code{NLIST_STRUCT}.
 
 @item
-If @samp{struct nlist} has an @samp{n_un} member, define
-@code{NLIST_NAME_UNION}.
+If @samp{struct nlist} has an @samp{n_un.n_name} member, define
+@code{HAVE_STRUCT_NLIST_N_UN_N_NAME}.  The obsolete symbol
+@code{NLIST_NAME_UNION} is still defined, but do not depend upon it.
 
 @item
 @c FIXME: I don't understand anything to this sentence :(
@@ -3513,10 +3514,10 @@ If @code{struct stat} contains an @code{st_blksize} member, define
 @code{HAVE_STRUCT_STAT_ST_BLKSIZE}.  The former name,
 @code{HAVE_ST_BLKSIZE} is to be avoided, as its support will cease in
 the future.  This macro is obsoleted, and should be replaced by
+
 @example
 AC_CHECK_MEMBERS((struct stat.st_blksize))
 @end example
-
 @end defmac
 
 @defmac AC_STRUCT_ST_BLOCKS
@@ -3581,6 +3582,12 @@ AC_CHECK_MEMBER(struct passwd.pw_gecos,,
                 [AC_MSG_ERROR([We need `struct passwd.pw_gecos'!])],
                 [#include <pwd.h>])
 @end example
+
+You can use this macro for sub members:
+
+@example
+AC_CHECK_MEMBER(struct top.middle.bot)
+@end example
 @end defmac
 
 @defmac AC_CHECK_MEMBERS (@var{members}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes})
index b37d9a30a8efb0c5450876b2f554a2b8f85d939c..dfcc25843ddb34284074677c858c55e9568588e9 100644 (file)
@@ -273,7 +273,7 @@ define(AC_OBSOLETE,
 define(AC_SPECIALIZE,
 [ifdef([$1-$2],
        [indir([$1-$2], m4_shift(m4_shift($@)))],
-       [indir([$1], m4_shift($@))])])
+       [$1(m4_shift($@))])])
 
 
 
@@ -2399,9 +2399,9 @@ dnl Extract the aggregate name, and the member name
 AC_CACHE_CHECK([for $1], ac_Member,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
 [dnl AGGREGATE foo;
-patsubst([$1], [\.[^.]*]) foo;
+patsubst([$1], [\..*]) foo;
 dnl foo.MEMBER;
-foo.patsubst([$1], [.*\.]);])],
+foo.patsubst([$1], [^[^.]*\.]);])],
                 AC_VAR_SET(ac_Member, yes),
                 AC_VAR_SET(ac_Member, no))])
 AC_SHELL_IFELSE([test AC_VAR_GET(ac_Member) = yes],
@@ -2410,17 +2410,17 @@ AC_VAR_POPDEF([ac_Member])dnl
 ])# AC_CHECK_MEMBER
 
 
-# AC_CHECK_MEMBER([AGGREGATE.MEMBER, ...],
-#                 [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]
-#                 [INCLUDES])
-# --------------------------------------------------------
+# AC_CHECK_MEMBERS([AGGREGATE.MEMBER, ...],
+#                  [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]
+#                  [INCLUDES])
+# ---------------------------------------------------------
 # The first argument is an m4 list.
 AC_DEFUN(AC_CHECK_MEMBERS,
 [m4_foreach([AC_Member], [$1],
   [AC_SPECIALIZE([AC_CHECK_MEMBER], AC_Member,
          [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Member), 1,
-                            [Define if `]patsubst(AC_Member, [.*\.])[' is
-                             member of `]patsubst(AC_Member, [\.[^.]*])['.])
+                            [Define if `]patsubst(AC_Member, [^[^.]*\.])[' is
+                             member of `]patsubst(AC_Member, [\..*])['.])
 $2],
                  [$3],
                  [$4])])])
index 1096bc3ba3b9577b0272de3dc78b99fdd87df625..56ee54ebc0cb7ae0f0652c1a6ab224179a959c61 100644 (file)
@@ -900,7 +900,7 @@ if test $ac_cv_func_getloadavg = yes; then
             [Define if your system has its own `getloadavg' function.])
   ac_have_func=yes
 else
-  AC_DEFINE(C_GETLOADAVG, 1, [Define if using getloadavg.c.])
+  AC_DEFINE(C_GETLOADAVG, 1, [Define if using `getloadavg.c'.])
   # Figure out what our getloadavg.c needs.
   ac_have_func=no
   AC_CHECK_HEADER(sys/dg_sys_info.h,
@@ -937,18 +937,13 @@ else
     AC_CHECK_HEADERS(mach/mach.h)
   fi
 
-  AC_CHECK_HEADER(nlist.h,
-  [AC_DEFINE(NLIST_STRUCT, 1, [Define if you have <nlist.h>.])
-  AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un,
-  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <nlist.h>
-],
-                                      [struct nlist n; n.n_un.n_name = 0;])],
-                     [ac_cv_struct_nlist_n_un=yes],
-                     [ac_cv_struct_nlist_n_un=no])])
-  if test $ac_cv_struct_nlist_n_un = yes; then
-    AC_DEFINE(NLIST_NAME_UNION, 1,
-              [Define if your `struct nlist' has an `n_un' member.])
-  fi
+  AC_CHECK_HEADERS(nlist.h,
+  [AC_CHECK_MEMBERS([struct nlist.n_un.n_name],
+                    [AC_DEFINE(NLIST_NAME_UNION, 1,
+                               [Define if your `struct nlist' has an
+                                `n_un' member.  Obsolete, depend on
+                                `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [],
+                    [@%:@include <nlist.h>])
   ])dnl
 fi # Do not have getloadavg in system libraries.