* 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.
This commit is contained in:
Akim Demaille 2000-05-19 12:11:47 +00:00
parent beb715a12b
commit d5c975f17b
7 changed files with 55 additions and 47 deletions

View File

@ -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

3
NEWS
View File

@ -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.

View 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])])])

View 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.

View 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})

View 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])])])

View 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.