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 (the section called “Generic Structure Checks”) or, for more complex tests, you may use AC_TRY_COMPILE (the section called “Examining Syntax”).

Particular Structure Checks

The following macros check for certain structures or structure members.

function>AC_STRUCT_ST_BLKSIZE/function> If struct stat contains an st_blksize member, define HAVE_STRUCT_STAT_ST_BLKSIZE. The former name, HAVE_ST_BLKSIZE is to be avoided, as its support will cease in the future. This macro is obsoleted, and should be replaced by

AC_CHECK_MEMBERS([struct stat.st_blksize])

function>AC_STRUCT_ST_BLOCKS/function> If struct stat contains an st_blocks member, define HAVE_STRUCT STAT_ST_BLOCKS. Otherwise, require an AC_LIBOBJ replacement of fileblocks. The former name, HAVE_ST_BLOCKS is to be avoided, as its support will cease in the future.

function>AC_STRUCT_ST_RDEV/function> If struct stat contains an st_rdev member, define HAVE_STRUCT_STAT_ST_RDEV. The former name for this macro, HAVE_ST_RDEV, is to be avoided as it will cease to be supported in the future. Actually, even the new macro is obsolete, and should be replaced by:

AC_CHECK_MEMBERS([struct stat.st_rdev])

function>AC_STRUCT_TM/function> If time.h does not define struct tm, define TM_IN_SYS_TIME, which means that including sys/time.h had better define struct tm.

function>AC_STRUCT_TIMEZONE/function> Figure out how to get the current timezone. If struct tm has a tm_zone member, define HAVE_STRUCT_TM_TM_ZONE (and the obsoleted HAVE_TM_ZONE). Otherwise, if the external array tzname is found, define HAVE_TZNAME.

Generic Structure Checks

These macros are used to find structure members not covered by the "particular" test macros.

function>AC_CHECK_MEMBER/function> (aggregate.member, [action-if-found], [action-if-not-found], [includes = default-includes]) Check whether member is a member of the aggregate aggregate. If no includes are specified, the default includes are used (the section called “Default Includes ”).

AC_CHECK_MEMBER(struct passwd.pw_gecos,,
                [AC_MSG_ERROR([We need `passwd.pw_gecos'!])],
                [#include pwd.h])

You can use this macro for sub-members:

AC_CHECK_MEMBER(struct top.middle.bot)

function>AC_CHECK_MEMBERS/function> (members, [action-if-found], [action-if-not-found], [includes = default-includes]) Check for the existence of each aggregate.member of members using the previous macro. When member belongs to aggregate, define HAVE_aggregate_member (in all capitals, with spaces and dots replaced by underscores).

This macro uses m4 lists:

AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize])