+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
** 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.
define(AC_SPECIALIZE,
[ifdef([$1-$2],
[indir([$1-$2], m4_shift(m4_shift($@)))],
- [indir([$1], m4_shift($@))])])
+ [$1(m4_shift($@))])])
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],
])# 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])])])
[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,
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.
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 :(
@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
[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})
define(AC_SPECIALIZE,
[ifdef([$1-$2],
[indir([$1-$2], m4_shift(m4_shift($@)))],
- [indir([$1], m4_shift($@))])])
+ [$1(m4_shift($@))])])
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],
])# 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])])])
[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,
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.