📄 types.m4
字号:
# AC_TYPE_SIGNAL# --------------# Note that identifiers starting with SIG are reserved by ANSI C.AN_FUNCTION([signal], [AC_TYPE_SIGNAL])AC_DEFUN([AC_TYPE_SIGNAL],[AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>#include <signal.h>], [return *(signal (0, 0)) (0) == 1;])], [ac_cv_type_signal=int], [ac_cv_type_signal=void])])AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal, [Define as the return type of signal handlers (`int' or `void').])])## ------------------------ #### Checking size of types. #### ------------------------ ### ---------------- ## Generic checks. ## ---------------- ## AC_CHECK_SIZEOF(TYPE, [IGNORED], [INCLUDES = DEFAULT-INCLUDES])# ---------------------------------------------------------------AC_DEFUN([AC_CHECK_SIZEOF],[AS_LITERAL_IF([$1], [], [AC_FATAL([$0: requires literal arguments])])dnlAC_CHECK_TYPE([$1], [], [], [$3])AC_CACHE_CHECK([size of $1], AS_TR_SH([ac_cv_sizeof_$1]),[if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. _AC_COMPUTE_INT([(long int) (sizeof (ac__type_sizeof_))], [AS_TR_SH([ac_cv_sizeof_$1])], [AC_INCLUDES_DEFAULT([$3]) typedef $1 ac__type_sizeof_;], [AC_MSG_FAILURE([cannot compute sizeof ($1)], 77)])else AS_TR_SH([ac_cv_sizeof_$1])=0fi])dnlAC_DEFINE_UNQUOTED(AS_TR_CPP(sizeof_$1), $AS_TR_SH([ac_cv_sizeof_$1]), [The size of `$1', as computed by sizeof.])])# AC_CHECK_SIZEOF# AC_CHECK_ALIGNOF(TYPE, [INCLUDES = DEFAULT-INCLUDES])# -----------------------------------------------------AC_DEFUN([AC_CHECK_ALIGNOF],[AS_LITERAL_IF([$1], [], [AC_FATAL([$0: requires literal arguments])])dnlAC_CHECK_TYPE([$1], [], [], [$2])AC_CACHE_CHECK([alignment of $1], AS_TR_SH([ac_cv_alignof_$1]),[if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then # The cast to long int works around a bug in the HP C Compiler, # see AC_CHECK_SIZEOF for more information. _AC_COMPUTE_INT([(long int) offsetof (ac__type_alignof_, y)], [AS_TR_SH([ac_cv_alignof_$1])], [AC_INCLUDES_DEFAULT([$2])#ifndef offsetof# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)#endiftypedef struct { char x; $1 y; } ac__type_alignof_;], [AC_MSG_FAILURE([cannot compute alignment of ($1)], 77)])else AS_TR_SH([ac_cv_alignof_$1])=0fi])dnlAC_DEFINE_UNQUOTED(AS_TR_CPP(alignof_$1), $AS_TR_SH([ac_cv_alignof_$1]), [The normal alignment of `$1', in bytes.])])# AC_CHECK_ALIGNOF# AU::AC_INT_16_BITS# ------------------# What a great name :)AU_DEFUN([AC_INT_16_BITS],[AC_CHECK_SIZEOF([int])test $ac_cv_sizeof_int = 2 && AC_DEFINE(INT_16_BITS, 1, [Define to 1 if `sizeof (int)' = 2. Obsolete, use `SIZEOF_INT'.])], [your code should no longer depend upon `INT_16_BITS', but upon`SIZEOF_INT == 2'. Remove this warning and the `AC_DEFINE' when youadjust the code.])# AU::AC_LONG_64_BITS# -------------------AU_DEFUN([AC_LONG_64_BITS],[AC_CHECK_SIZEOF([long int])test $ac_cv_sizeof_long_int = 8 && AC_DEFINE(LONG_64_BITS, 1, [Define to 1 if `sizeof (long int)' = 8. Obsolete, use `SIZEOF_LONG_INT'.])], [your code should no longer depend upon `LONG_64_BITS', but upon`SIZEOF_LONG_INT == 8'. Remove this warning and the `AC_DEFINE' whenyou adjust the code.])## -------------------------- #### Generic structure checks. #### -------------------------- ### ---------------- ## Generic checks. ## ---------------- ## AC_CHECK_MEMBER(AGGREGATE.MEMBER,# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],# [INCLUDES = DEFAULT-INCLUDES])# ---------------------------------------------------------# AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell# variables are not a valid argument.AC_DEFUN([AC_CHECK_MEMBER],[AS_LITERAL_IF([$1], [], [AC_FATAL([$0: requires literal arguments])])dnlm4_bmatch([$1], [\.], , [m4_fatal([$0: Did not see any dot in `$1'])])dnlAS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnldnl Extract the aggregate name, and the member nameAC_CACHE_CHECK([for $1], ac_Member,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],[dnl AGGREGATE ac_aggr;static m4_bpatsubst([$1], [\..*]) ac_aggr;dnl ac_aggr.MEMBER;if (ac_aggr.m4_bpatsubst([$1], [^[^.]*\.]))return 0;])], [AS_VAR_SET(ac_Member, yes)],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],[dnl AGGREGATE ac_aggr;static m4_bpatsubst([$1], [\..*]) ac_aggr;dnl sizeof ac_aggr.MEMBER;if (sizeof ac_aggr.m4_bpatsubst([$1], [^[^.]*\.]))return 0;])], [AS_VAR_SET(ac_Member, yes)], [AS_VAR_SET(ac_Member, no)])])])AS_IF([test AS_VAR_GET(ac_Member) = yes], [$2], [$3])dnlAS_VAR_POPDEF([ac_Member])dnl])# AC_CHECK_MEMBER# AC_CHECK_MEMBERS([AGGREGATE.MEMBER, ...],# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]# [INCLUDES = DEFAULT-INCLUDES])# ---------------------------------------------------------# The first argument is an m4 list.AC_DEFUN([AC_CHECK_MEMBERS],[m4_foreach([AC_Member], [$1], [AC_CHECK_MEMBER(AC_Member, [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_Member), 1, [Define to 1 if `]m4_bpatsubst(AC_Member, [^[^.]*\.])[' is member of `]m4_bpatsubst(AC_Member, [\..*])['.])$2], [$3], [$4])])])# ------------------------------------------------------- ## Members that ought to be tested with AC_CHECK_MEMBERS. ## ------------------------------------------------------- #AN_IDENTIFIER([st_blksize], [AC_CHECK_MEMBERS([struct stat.st_blksize])])AN_IDENTIFIER([st_rdev], [AC_CHECK_MEMBERS([struct stat.st_rdev])])# Alphabetic order, please.# _AC_STRUCT_DIRENT(MEMBER)# -------------------------AC_DEFUN([_AC_STRUCT_DIRENT],[ AC_REQUIRE([AC_HEADER_DIRENT]) AC_CHECK_MEMBERS([struct dirent.$1], [], [], [[#include <sys/types.h>#ifdef HAVE_DIRENT_H# include <dirent.h>#else# define dirent direct# ifdef HAVE_SYS_NDIR_H# include <sys/ndir.h># endif# ifdef HAVE_SYS_DIR_H# include <sys/dir.h># endif# ifdef HAVE_NDIR_H# include <ndir.h># endif#endif ]])])# AC_STRUCT_DIRENT_D_INO# -----------------------------------AC_DEFUN([AC_STRUCT_DIRENT_D_INO], [_AC_STRUCT_DIRENT([d_ino])])# AC_STRUCT_DIRENT_D_TYPE# ------------------------------------AC_DEFUN([AC_STRUCT_DIRENT_D_TYPE], [_AC_STRUCT_DIRENT([d_type])])# AC_STRUCT_ST_BLKSIZE# --------------------AU_DEFUN([AC_STRUCT_ST_BLKSIZE],[AC_CHECK_MEMBERS([struct stat.st_blksize], [AC_DEFINE(HAVE_ST_BLKSIZE, 1, [Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use `HAVE_STRUCT_STAT_ST_BLKSIZE' instead.])])], [your code should no longer depend upon `HAVE_ST_BLKSIZE', but`HAVE_STRUCT_STAT_ST_BLKSIZE'. Remove this warning andthe `AC_DEFINE' when you adjust the code.])# AC_STRUCT_ST_BLKSIZE# AC_STRUCT_ST_BLOCKS# -------------------# If `struct stat' contains an `st_blocks' member, define# HAVE_STRUCT_STAT_ST_BLOCKS. Otherwise, add `fileblocks.o' to the# output variable LIBOBJS. We still define HAVE_ST_BLOCKS for backward# compatibility. In the future, we will activate specializations for# this macro, so don't obsolete it right now.## AC_OBSOLETE([$0], [; replace it with# AC_CHECK_MEMBERS([struct stat.st_blocks],# [AC_LIBOBJ([fileblocks])])# Please note that it will define `HAVE_STRUCT_STAT_ST_BLOCKS',# and not `HAVE_ST_BLOCKS'.])dnl#AN_IDENTIFIER([st_blocks], [AC_STRUCT_ST_BLOCKS])AC_DEFUN([AC_STRUCT_ST_BLOCKS],[AC_CHECK_MEMBERS([struct stat.st_blocks], [AC_DEFINE(HAVE_ST_BLOCKS, 1, [Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use `HAVE_STRUCT_STAT_ST_BLOCKS' instead.])], [AC_LIBOBJ([fileblocks])])])# AC_STRUCT_ST_BLOCKS# AC_STRUCT_ST_RDEV# -----------------AU_DEFUN([AC_STRUCT_ST_RDEV],[AC_CHECK_MEMBERS([struct stat.st_rdev], [AC_DEFINE(HAVE_ST_RDEV, 1, [Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use `HAVE_STRUCT_STAT_ST_RDEV' instead.])])], [your code should no longer depend upon `HAVE_ST_RDEV', but`HAVE_STRUCT_STAT_ST_RDEV'. Remove this warning andthe `AC_DEFINE' when you adjust the code.])# AC_STRUCT_ST_RDEV# AC_STRUCT_TM# ------------# FIXME: This macro is badly named, it should be AC_CHECK_TYPE_STRUCT_TM.# Or something else, but what? AC_CHECK_TYPE_STRUCT_TM_IN_SYS_TIME?AN_IDENTIFIER([tm], [AC_STRUCT_TM])AC_DEFUN([AC_STRUCT_TM],[AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h], ac_cv_struct_tm,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>#include <time.h>], [struct tm *tp; tp->tm_sec;])], [ac_cv_struct_tm=time.h], [ac_cv_struct_tm=sys/time.h])])if test $ac_cv_struct_tm = sys/time.h; then AC_DEFINE(TM_IN_SYS_TIME, 1, [Define to 1 if your <sys/time.h> declares `struct tm'.])fi])# AC_STRUCT_TM# AC_STRUCT_TIMEZONE# ------------------# Figure out how to get the current timezone. If `struct tm' has a# `tm_zone' member, define `HAVE_TM_ZONE'. Otherwise, if the# external array `tzname' is found, define `HAVE_TZNAME'.AN_IDENTIFIER([tm_zone], [AC_STRUCT_TIMEZONE])AC_DEFUN([AC_STRUCT_TIMEZONE],[AC_REQUIRE([AC_STRUCT_TM])dnlAC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include <sys/types.h>#include <$ac_cv_struct_tm>])if test "$ac_cv_member_struct_tm_tm_zone" = yes; then AC_DEFINE(HAVE_TM_ZONE, 1, [Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use `HAVE_STRUCT_TM_TM_ZONE' instead.])else AC_CHECK_DECLS([tzname], , , [#include <time.h>]) AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <time.h>#if !HAVE_DECL_TZNAMEextern char *tzname[];#endif]],[[return tzname[0][0];]])], [ac_cv_var_tzname=yes], [ac_cv_var_tzname=no])]) if test $ac_cv_var_tzname = yes; then AC_DEFINE(HAVE_TZNAME, 1, [Define to 1 if you don't have `tm_zone' but do have the external array `tzname'.]) fifi])# AC_STRUCT_TIMEZONE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -