Types

The following macros check for C types, either builtin or typedefs. If there is no macro specifically defined to check for a type you need, and you don't need to check for any special properties of it, then you can use a general type-check macro.

Particular Type Checks

These macros check for particular C types in sys/types.h, stdlib.h and others, if they exist.

function>AC_TYPE_GETGROUPS/function> Define GETGROUPS_T to be whichever of gid_t or int is the base type of the array argument to getgroups.

function>AC_TYPE_MODE_T/function> Equivalent to AC_CHECK_TYPE(mode_t, int).

function>AC_TYPE_OFF_T/function> Equivalent to AC_CHECK_TYPE(off_t, long).

function>AC_TYPE_PID_T/function> Equivalent to AC_CHECK_TYPE(pid_t, int).

function>AC_TYPE_SIGNAL/function> If signal.h declares signal as returning a pointer to a function returning void, define RETSIGTYPE to be void; otherwise, define it to be int.

Define signal handlers as returning type RETSIGTYPE:

RETSIGTYPE
hup_handler ()
{
…
}
          

function>AC_TYPE_SIZE_T/function> Equivalent to AC_CHECK_TYPE(size_t, unsigned).

function>AC_TYPE_UID_T/function> If uid_t is not defined, define uid_t to be int and gid_t to be int.

Generic Type Checks

These macros are used to check for types not covered by the "particular" test macros.

function>AC_CHECK_TYPE/function> (type, [action-if-found], [action-if-not-found], [includes = default-includes]) Check whether type is defined. It may be a compiler builtin type or defined by the includes (the section called “Default Includes ”).

function>AC_CHECK_TYPES/function> (types, [action-if-found], [action-if-not-found], [includes = default-includes]) For each type of the types that is defined, define HAVE_type (in all capitals). If no includes are specified, the default includes are used (the section called “Default Includes ”). If action-if-found is given, it is additional shell code to execute when one of the types is found. If action-if-not-found is given, it is executed when one of the types is not found.

This macro uses m4 lists:

AC_CHECK_TYPES(ptrdiff_t)
AC_CHECK_TYPES([unsigned long long, uintmax_t])

Autoconf, up to 2.13, used to provide to another version of AC_CHECK_TYPE, broken by design. In order to keep backward compatibility, a simple heuristics, quite safe but not totally, is implemented. In case of doubt, read the documentation of the former AC_CHECK_TYPE, see the section called “Obsolete Macros ”.