]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
1999-04-11 Ben Elliston <bje@cygnus.com>
authorBen Elliston <bje+keyword+gnu.7caf74@air.net.au>
Sat, 10 Apr 1999 19:54:57 +0000 (19:54 +0000)
committerBen Elliston <bje+keyword+gnu.7caf74@air.net.au>
Sat, 10 Apr 1999 19:54:57 +0000 (19:54 +0000)
* acgeneral.m4 (AC_C_STRUCT_MEMBER): New macro.
* acspecific.m4 (AC_STRUCT_TIMEZONE): Rewrite in terms of
AC_C_STRUCT_MEMBER.
(AC_STRUCT_ST_BLOCKS): Likewise.
(AC_STRUCT_ST_BLKSIZE): Likewise.
(AC_STRUCT_ST_RDEV): Likewise.
* autoconf.texi (Structures): Update. Add menu for subnodes.
(Particular Structures): New node.
(Generic Structures): New node.
(AC_C_STRUCT_MEMBER): Document.

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

index 7a85eba0f58858714f61ca8482d2a6c1d4d00d3d..8a124bb76f92635d8e96e84338c46fb71e36e35b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+1999-04-11  Ben Elliston  <bje@cygnus.com>
+
+       * acgeneral.m4 (AC_C_STRUCT_MEMBER): New macro.
+       * acspecific.m4 (AC_STRUCT_TIMEZONE): Rewrite in terms of
+       AC_C_STRUCT_MEMBER.
+       (AC_STRUCT_ST_BLOCKS): Likewise.
+       (AC_STRUCT_ST_BLKSIZE): Likewise.
+       (AC_STRUCT_ST_RDEV): Likewise.
+       * autoconf.texi (Structures): Update. Add menu for subnodes.
+       (Particular Structures): New node.
+       (Generic Structures): New node.
+       (AC_C_STRUCT_MEMBER): Document.
+
 1999-04-10  Ben Elliston  <bje@cygnus.com>
 
        * mkinstalldirs: Add `-m' flag to specify the mode of a newly
index 5bfaaacc8ad1c936033143f4bda8afc8d271c2ca..7eccd9a2db0b57051a55b4d9a1e113bbfaca1960 100644 (file)
@@ -1277,6 +1277,17 @@ define(AC_OBSOLETE,
 )])
 
 
+dnl ### Generic structure checks
+
+dnl Check if a particular structure member exists.
+dnl AC_C_STRUCT_MEMBER(VARIABLE, INCLUDES, TYPE, MEMBER)
+AC_DEFUN(AC_C_STRUCT_MEMBER,
+[AC_CACHE_CHECK([for member $4 in aggregate type $3],ac_cv_c_struct_member_$1,
+  [AC_TRY_COMPILE([$2], [$3 foo; foo.$4;],
+   ac_cv_c_struct_member_$1=yes,ac_cv_c_struct_member_$1=no)])
+$1="$ac_cv_c_struct_member_$1"])
+
+
 dnl ### Checking for programs
 
 
index 21b1fa5ecf0a181c0ec6c7ec7461377b494e5a22..da9ba74eaa4fd7763f0a331c8459657d2a9497c5 100644 (file)
@@ -1733,11 +1733,9 @@ fi
 
 AC_DEFUN(AC_STRUCT_TIMEZONE,
 [AC_REQUIRE([AC_STRUCT_TM])dnl
-AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
-  ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
-if test "$ac_cv_struct_tm_zone" = yes; then
+AC_C_STRUCT_MEMBER(tm_zone, [#include <sys/types.h>
+#include <$ac_cv_struct_tm>], [struct tm], tm_zone)
+if test "$ac_cv_c_struct_member_tm_zone" = yes; then
   AC_DEFINE(HAVE_TM_ZONE)
 else
   AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
@@ -1756,11 +1754,9 @@ fi
 ])
 
 AC_DEFUN(AC_STRUCT_ST_BLOCKS,
-[AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/stat.h>], [struct stat s; s.st_blocks;],
-ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
-if test $ac_cv_struct_st_blocks = yes; then
+[AC_C_STRUCT_MEMBER(st_blocks, [#include <sys/types.h>
+#include <sys/stat.h>], [struct stat], st_blocks)
+if test $ac_cv_c_struct_member_st_blocks = yes; then
   AC_DEFINE(HAVE_ST_BLOCKS)
 else
   LIBOBJS="$LIBOBJS fileblocks.${ac_objext}"
@@ -1769,21 +1765,17 @@ AC_SUBST(LIBOBJS)dnl
 ])
 
 AC_DEFUN(AC_STRUCT_ST_BLKSIZE,
-[AC_CACHE_CHECK([for st_blksize in struct stat], ac_cv_struct_st_blksize,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/stat.h>], [struct stat s; s.st_blksize;],
-ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)])
-if test $ac_cv_struct_st_blksize = yes; then
+[AC_C_STRUCT_MEMBER(st_blksize, [#include <sys/types.h>
+#include <sys/stat.h>], [struct stat], st_blksize)
+if test $ac_cv_c_struct_member_st_blksize = yes; then
   AC_DEFINE(HAVE_ST_BLKSIZE)
 fi
 ])
 
 AC_DEFUN(AC_STRUCT_ST_RDEV,
-[AC_CACHE_CHECK([for st_rdev in struct stat], ac_cv_struct_st_rdev,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/stat.h>], [struct stat s; s.st_rdev;],
-ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)])
-if test $ac_cv_struct_st_rdev = yes; then
+[AC_C_STRUCT_MEMBER(st_rdev, [#include <sys/types.h>
+#include <sys/stat.h>], [struct stat], st_rdev)
+if test $ac_cv_c_struct_member_st_rdev = yes; then
   AC_DEFINE(HAVE_ST_RDEV)
 fi
 ])
index 00476f524571d73b8ca957d4ed09aade7274d7c2..d94e59e1324035d183e4c12a8f172b3ef18e965f 100644 (file)
@@ -2479,10 +2479,21 @@ is executed when one of the header files is not found.
 @node Structures, Typedefs, Header Files, Existing Tests
 @section Structures
 
+The following macros check for the presence of certain members in C
+structures.  If there is no macro specifically defined to check for a
+member you need, then you can use the general structure member macro
+(@pxref{Generic Structures}) or, for more complex tests, you may use
+@code{AC_TRY_COMPILE} (@pxref{Examining Syntax}).
+
+@menu
+* Particular Structures::       Macros to check for certain stucture members.
+* Generic Structures::          How to find other structure members.
+@end menu
+
+@node Particular Structures, Generic Structures, Structures, Structures
+@subsection Particular Structure Checks
+
 The following macros check for certain structures or structure members.
-To check structures not listed here, use @code{AC_EGREP_CPP}
-(@pxref{Examining Declarations}) or @code{AC_TRY_COMPILE}
-(@pxref{Examining Syntax}).
 
 @defmac AC_HEADER_STAT
 @maindex HEADER_STAT
@@ -2562,6 +2573,26 @@ Figure out how to get the current timezone.  If @code{struct tm} has a
 external array @code{tzname} is found, define @code{HAVE_TZNAME}.
 @end defmac
 
+@node Generic Structures, , Particular Structures, Structures
+@subsection Generic Structure Checks
+
+These macros are used to find structure members not covered by the
+particular test macros.
+
+@defmac AC_C_STRUCT_MEMBER (@var{variable}, @var{includes}, @var{type}, @var{member})
+@maindex C_STRUCT_MEMBER
+Check whether @var{member} is a member of the C aggregate @var{type}.
+The value of @var{type} may be the name of any legitimate C data type
+including the keywords @code{struct} and @code{union}. @var{includes} is
+any @code{#include} statements needed to obtain the definition of the
+aggregate type. If @var{member} is present, set @var{variable} to @samp{yes},
+otherwise @samp{no}.  An example:
+@example
+AC_C_STRUCT_MEMBER(gecos,
+  [#include <pwd.h>], [struct passwd], gecos)
+@end example
+@end defmac
+
 @node Typedefs, C Compiler Characteristics, Structures, Existing Tests
 @section Typedefs
 
index 00476f524571d73b8ca957d4ed09aade7274d7c2..d94e59e1324035d183e4c12a8f172b3ef18e965f 100644 (file)
@@ -2479,10 +2479,21 @@ is executed when one of the header files is not found.
 @node Structures, Typedefs, Header Files, Existing Tests
 @section Structures
 
+The following macros check for the presence of certain members in C
+structures.  If there is no macro specifically defined to check for a
+member you need, then you can use the general structure member macro
+(@pxref{Generic Structures}) or, for more complex tests, you may use
+@code{AC_TRY_COMPILE} (@pxref{Examining Syntax}).
+
+@menu
+* Particular Structures::       Macros to check for certain stucture members.
+* Generic Structures::          How to find other structure members.
+@end menu
+
+@node Particular Structures, Generic Structures, Structures, Structures
+@subsection Particular Structure Checks
+
 The following macros check for certain structures or structure members.
-To check structures not listed here, use @code{AC_EGREP_CPP}
-(@pxref{Examining Declarations}) or @code{AC_TRY_COMPILE}
-(@pxref{Examining Syntax}).
 
 @defmac AC_HEADER_STAT
 @maindex HEADER_STAT
@@ -2562,6 +2573,26 @@ Figure out how to get the current timezone.  If @code{struct tm} has a
 external array @code{tzname} is found, define @code{HAVE_TZNAME}.
 @end defmac
 
+@node Generic Structures, , Particular Structures, Structures
+@subsection Generic Structure Checks
+
+These macros are used to find structure members not covered by the
+particular test macros.
+
+@defmac AC_C_STRUCT_MEMBER (@var{variable}, @var{includes}, @var{type}, @var{member})
+@maindex C_STRUCT_MEMBER
+Check whether @var{member} is a member of the C aggregate @var{type}.
+The value of @var{type} may be the name of any legitimate C data type
+including the keywords @code{struct} and @code{union}. @var{includes} is
+any @code{#include} statements needed to obtain the definition of the
+aggregate type. If @var{member} is present, set @var{variable} to @samp{yes},
+otherwise @samp{no}.  An example:
+@example
+AC_C_STRUCT_MEMBER(gecos,
+  [#include <pwd.h>], [struct passwd], gecos)
+@end example
+@end defmac
+
 @node Typedefs, C Compiler Characteristics, Structures, Existing Tests
 @section Typedefs
 
index 5bfaaacc8ad1c936033143f4bda8afc8d271c2ca..7eccd9a2db0b57051a55b4d9a1e113bbfaca1960 100644 (file)
@@ -1277,6 +1277,17 @@ define(AC_OBSOLETE,
 )])
 
 
+dnl ### Generic structure checks
+
+dnl Check if a particular structure member exists.
+dnl AC_C_STRUCT_MEMBER(VARIABLE, INCLUDES, TYPE, MEMBER)
+AC_DEFUN(AC_C_STRUCT_MEMBER,
+[AC_CACHE_CHECK([for member $4 in aggregate type $3],ac_cv_c_struct_member_$1,
+  [AC_TRY_COMPILE([$2], [$3 foo; foo.$4;],
+   ac_cv_c_struct_member_$1=yes,ac_cv_c_struct_member_$1=no)])
+$1="$ac_cv_c_struct_member_$1"])
+
+
 dnl ### Checking for programs
 
 
index 21b1fa5ecf0a181c0ec6c7ec7461377b494e5a22..da9ba74eaa4fd7763f0a331c8459657d2a9497c5 100644 (file)
@@ -1733,11 +1733,9 @@ fi
 
 AC_DEFUN(AC_STRUCT_TIMEZONE,
 [AC_REQUIRE([AC_STRUCT_TM])dnl
-AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;],
-  ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)])
-if test "$ac_cv_struct_tm_zone" = yes; then
+AC_C_STRUCT_MEMBER(tm_zone, [#include <sys/types.h>
+#include <$ac_cv_struct_tm>], [struct tm], tm_zone)
+if test "$ac_cv_c_struct_member_tm_zone" = yes; then
   AC_DEFINE(HAVE_TM_ZONE)
 else
   AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
@@ -1756,11 +1754,9 @@ fi
 ])
 
 AC_DEFUN(AC_STRUCT_ST_BLOCKS,
-[AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/stat.h>], [struct stat s; s.st_blocks;],
-ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)])
-if test $ac_cv_struct_st_blocks = yes; then
+[AC_C_STRUCT_MEMBER(st_blocks, [#include <sys/types.h>
+#include <sys/stat.h>], [struct stat], st_blocks)
+if test $ac_cv_c_struct_member_st_blocks = yes; then
   AC_DEFINE(HAVE_ST_BLOCKS)
 else
   LIBOBJS="$LIBOBJS fileblocks.${ac_objext}"
@@ -1769,21 +1765,17 @@ AC_SUBST(LIBOBJS)dnl
 ])
 
 AC_DEFUN(AC_STRUCT_ST_BLKSIZE,
-[AC_CACHE_CHECK([for st_blksize in struct stat], ac_cv_struct_st_blksize,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/stat.h>], [struct stat s; s.st_blksize;],
-ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)])
-if test $ac_cv_struct_st_blksize = yes; then
+[AC_C_STRUCT_MEMBER(st_blksize, [#include <sys/types.h>
+#include <sys/stat.h>], [struct stat], st_blksize)
+if test $ac_cv_c_struct_member_st_blksize = yes; then
   AC_DEFINE(HAVE_ST_BLKSIZE)
 fi
 ])
 
 AC_DEFUN(AC_STRUCT_ST_RDEV,
-[AC_CACHE_CHECK([for st_rdev in struct stat], ac_cv_struct_st_rdev,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/stat.h>], [struct stat s; s.st_rdev;],
-ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)])
-if test $ac_cv_struct_st_rdev = yes; then
+[AC_C_STRUCT_MEMBER(st_rdev, [#include <sys/types.h>
+#include <sys/stat.h>], [struct stat], st_rdev)
+if test $ac_cv_c_struct_member_st_rdev = yes; then
   AC_DEFINE(HAVE_ST_RDEV)
 fi
 ])