📄 types.m4
字号:
AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], [Define to the widest signed integer type if <stdint.h> and <inttypes.h> do not define.])])])# AC_TYPE_UINTMAX_T# -----------------AC_DEFUN([AC_TYPE_UINTMAX_T],[ AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) AC_CHECK_TYPE([uintmax_t], [AC_DEFINE([HAVE_UINTMAX_T], 1, [Define to 1 if the system has the type `uintmax_t'.])], [test $ac_cv_type_unsigned_long_long_int = yes \ && ac_type='unsigned long long int' \ || ac_type='unsigned long int' AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type], [Define to the widest unsigned integer type if <stdint.h> and <inttypes.h> do not define.])])])# AC_TYPE_INTPTR_T# -----------------AC_DEFUN([AC_TYPE_INTPTR_T],[ AC_CHECK_TYPE([intptr_t], [AC_DEFINE([HAVE_INTPTR_T], 1, [Define to 1 if the system has the type `intptr_t'.])], [for ac_type in 'int' 'long int' 'long long int'; do AC_COMPILE_IFELSE( [AC_LANG_BOOL_COMPILE_TRY( [AC_INCLUDES_DEFAULT], [[sizeof (void *) <= sizeof ($ac_type)]])], [AC_DEFINE_UNQUOTED([intptr_t], [$ac_type], [Define to the type of a signed integer type wide enough to hold a pointer, if such a type exists, and if the system does not define it.]) ac_type=]) test -z "$ac_type" && break done])])# AC_TYPE_UINTPTR_T# -----------------AC_DEFUN([AC_TYPE_UINTPTR_T],[ AC_CHECK_TYPE([uintptr_t], [AC_DEFINE([HAVE_UINTPTR_T], 1, [Define to 1 if the system has the type `uintptr_t'.])], [for ac_type in 'unsigned int' 'unsigned long int' \ 'unsigned long long int'; do AC_COMPILE_IFELSE( [AC_LANG_BOOL_COMPILE_TRY( [AC_INCLUDES_DEFAULT], [[sizeof (void *) <= sizeof ($ac_type)]])], [AC_DEFINE_UNQUOTED([uintptr_t], [$ac_type], [Define to the type of an unsigned integer type wide enough to hold a pointer, if such a type exists, and if the system does not define it.]) ac_type=]) test -z "$ac_type" && break done])])# AC_TYPE_LONG_DOUBLE# -------------------AC_DEFUN([AC_TYPE_LONG_DOUBLE],[ AC_CACHE_CHECK([for long double], [ac_cv_type_long_double], [if test "$GCC" = yes; then ac_cv_type_long_double=yes else AC_COMPILE_IFELSE( [AC_LANG_BOOL_COMPILE_TRY( [[/* The Stardent Vistra knows sizeof (long double), but does not support it. */ long double foo = 0.0L;]], [[/* On Ultrix 4.3 cc, long double is 4 and double is 8. */ sizeof (double) <= sizeof (long double)]])], [ac_cv_type_long_double=yes], [ac_cv_type_long_double=no]) fi]) if test $ac_cv_type_long_double = yes; then AC_DEFINE([HAVE_LONG_DOUBLE], 1, [Define to 1 if the system has the type `long double'.]) fi])# AC_TYPE_LONG_DOUBLE_WIDER# -------------------------AC_DEFUN([AC_TYPE_LONG_DOUBLE_WIDER],[ AC_CACHE_CHECK( [for long double with more range or precision than double], [ac_cv_type_long_double_wider], [AC_COMPILE_IFELSE( [AC_LANG_BOOL_COMPILE_TRY( [[#include <float.h> long double const a[] = { 0.0L, DBL_MIN, DBL_MAX, DBL_EPSILON, LDBL_MIN, LDBL_MAX, LDBL_EPSILON }; long double f (long double x) { return ((x + (unsigned long int) 10) * (-1 / x) + a[0] + (x ? f (x) : 'c')); } ]], [[(0 < ((DBL_MAX_EXP < LDBL_MAX_EXP) + (DBL_MANT_DIG < LDBL_MANT_DIG) - (LDBL_MAX_EXP < DBL_MAX_EXP) - (LDBL_MANT_DIG < DBL_MANT_DIG))) && (int) LDBL_EPSILON == 0 ]])], ac_cv_type_long_double_wider=yes, ac_cv_type_long_double_wider=no)]) if test $ac_cv_type_long_double_wider = yes; then AC_DEFINE([HAVE_LONG_DOUBLE_WIDER], 1, [Define to 1 if the type `long double' works and has more range or precision than `double'.]) fi])# AC_TYPE_LONG_DOUBLE_WIDER# AC_C_LONG_DOUBLE# ----------------AU_DEFUN([AC_C_LONG_DOUBLE], [ AC_TYPE_LONG_DOUBLE_WIDER ac_cv_c_long_double=$ac_cv_type_long_double_wider if test $ac_cv_c_long_double = yes; then AC_DEFINE([HAVE_LONG_DOUBLE], 1, [Define to 1 if the type `long double' works and has more range or precision than `double'.]) fi ], [The macro `AC_C_LONG_DOUBLE' is obsolete.You should use `AC_TYPE_LONG_DOUBLE' or `AC_TYPE_LONG_DOUBLE_WIDER' instead.])# AC_TYPE_LONG_LONG_INT# ---------------------AC_DEFUN([AC_TYPE_LONG_LONG_INT],[ AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [long long int ll = 1LL; int i = 63;], [long long int llmax = (long long int) -1; return ll << i | ll >> i | llmax / ll | llmax % ll;])], [ac_cv_type_long_long_int=yes], [ac_cv_type_long_long_int=no])]) if test $ac_cv_type_long_long_int = yes; then AC_DEFINE([HAVE_LONG_LONG_INT], 1, [Define to 1 if the system has the type `long long int'.]) fi])# AC_TYPE_UNSIGNED_LONG_LONG_INT# ------------------------------AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],[ AC_CACHE_CHECK([for unsigned long long int], [ac_cv_type_unsigned_long_long_int], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [unsigned long long int ull = 1ULL; int i = 63;], [unsigned long long int ullmax = (unsigned long long int) -1; return ull << i | ull >> i | ullmax / ull | ullmax % ull;])], [ac_cv_type_unsigned_long_long_int=yes], [ac_cv_type_unsigned_long_long_int=no])]) if test $ac_cv_type_unsigned_long_long_int = yes; then AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1, [Define to 1 if the system has the type `unsigned long long int'.]) fi])# AC_TYPE_MBSTATE_T# -----------------AC_DEFUN([AC_TYPE_MBSTATE_T], [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t, [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT# include <wchar.h>], [mbstate_t x; return sizeof x;])], [ac_cv_type_mbstate_t=yes], [ac_cv_type_mbstate_t=no])]) if test $ac_cv_type_mbstate_t = yes; then AC_DEFINE([HAVE_MBSTATE_T], 1, [Define to 1 if <wchar.h> declares mbstate_t.]) else AC_DEFINE([mbstate_t], int, [Define to a type if <wchar.h> does not define.]) fi])# AC_TYPE_UID_T# -------------# FIXME: Rewrite using AC_CHECK_TYPE.AN_IDENTIFIER([gid_t], [AC_TYPE_UID_T])AN_IDENTIFIER([uid_t], [AC_TYPE_UID_T])AC_DEFUN([AC_TYPE_UID_T],[AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t,[AC_EGREP_HEADER(uid_t, sys/types.h, ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)])if test $ac_cv_type_uid_t = no; then AC_DEFINE(uid_t, int, [Define to `int' if <sys/types.h> doesn't define.]) AC_DEFINE(gid_t, int, [Define to `int' if <sys/types.h> doesn't define.])fi])AN_IDENTIFIER([size_t], [AC_TYPE_SIZE_T])AC_DEFUN([AC_TYPE_SIZE_T], [AC_CHECK_TYPE(size_t, unsigned int)])AN_IDENTIFIER([ssize_t], [AC_TYPE_SSIZE_T])AC_DEFUN([AC_TYPE_SSIZE_T], [AC_CHECK_TYPE(ssize_t, int)])AN_IDENTIFIER([pid_t], [AC_TYPE_PID_T])AC_DEFUN([AC_TYPE_PID_T], [AC_CHECK_TYPE(pid_t, int)])AN_IDENTIFIER([off_t], [AC_TYPE_OFF_T])AC_DEFUN([AC_TYPE_OFF_T], [AC_CHECK_TYPE(off_t, long int)])AN_IDENTIFIER([mode_t], [AC_TYPE_MODE_T])AC_DEFUN([AC_TYPE_MODE_T], [AC_CHECK_TYPE(mode_t, int)])AN_IDENTIFIER([int8_t], [AC_TYPE_INT8_T])AN_IDENTIFIER([int16_t], [AC_TYPE_INT16_T])AN_IDENTIFIER([int32_t], [AC_TYPE_INT32_T])AN_IDENTIFIER([int64_t], [AC_TYPE_INT64_T])AN_IDENTIFIER([uint8_t], [AC_TYPE_UINT8_T])AN_IDENTIFIER([uint16_t], [AC_TYPE_UINT16_T])AN_IDENTIFIER([uint32_t], [AC_TYPE_UINT32_T])AN_IDENTIFIER([uint64_t], [AC_TYPE_UINT64_T])AC_DEFUN([AC_TYPE_INT8_T], [_AC_TYPE_INT(8)])AC_DEFUN([AC_TYPE_INT16_T], [_AC_TYPE_INT(16)])AC_DEFUN([AC_TYPE_INT32_T], [_AC_TYPE_INT(32)])AC_DEFUN([AC_TYPE_INT64_T], [_AC_TYPE_INT(64)])AC_DEFUN([AC_TYPE_UINT8_T], [_AC_TYPE_UNSIGNED_INT(8)])AC_DEFUN([AC_TYPE_UINT16_T], [_AC_TYPE_UNSIGNED_INT(16)])AC_DEFUN([AC_TYPE_UINT32_T], [_AC_TYPE_UNSIGNED_INT(32)])AC_DEFUN([AC_TYPE_UINT64_T], [_AC_TYPE_UNSIGNED_INT(64)])# _AC_TYPE_INT(NBITS)# -------------------AC_DEFUN([_AC_TYPE_INT],[ AC_CACHE_CHECK([for int$1_t], [ac_cv_c_int$1_t], [ac_cv_c_int$1_t=no for ac_type in 'int$1_t' 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do AC_COMPILE_IFELSE( [AC_LANG_BOOL_COMPILE_TRY( [AC_INCLUDES_DEFAULT], [[0 < ($ac_type) (((($ac_type) 1 << ($1 - 2)) - 1) * 2 + 1)]])], [AC_COMPILE_IFELSE( [AC_LANG_BOOL_COMPILE_TRY( [AC_INCLUDES_DEFAULT], [[($ac_type) (((($ac_type) 1 << ($1 - 2)) - 1) * 2 + 1) < ($ac_type) (((($ac_type) 1 << ($1 - 2)) - 1) * 2 + 2)]])], [], [AS_CASE([$ac_type], [int$1_t], [ac_cv_c_int$1_t=yes], [ac_cv_c_int$1_t=$ac_type])])]) test "$ac_cv_c_int$1_t" != no && break done]) case $ac_cv_c_int$1_t in #( no|yes) ;; #( *) AC_DEFINE_UNQUOTED([int$1_t], [$ac_cv_c_int$1_t], [Define to the type of a signed integer type of width exactly $1 bits if such a type exists and the standard includes do not define it.]);; esac])# _AC_TYPE_INT# _AC_TYPE_UNSIGNED_INT(NBITS)# ----------------------------AC_DEFUN([_AC_TYPE_UNSIGNED_INT],[ AC_CACHE_CHECK([for uint$1_t], [ac_cv_c_uint$1_t], [ac_cv_c_uint$1_t=no for ac_type in 'uint$1_t' 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do AC_COMPILE_IFELSE( [AC_LANG_BOOL_COMPILE_TRY( [AC_INCLUDES_DEFAULT], [[($ac_type) -1 >> ($1 - 1) == 1]])], [AS_CASE([$ac_type], [uint$1_t], [ac_cv_c_uint$1_t=yes], [ac_cv_c_uint$1_t=$ac_type])]) test "$ac_cv_c_uint$1_t" != no && break done]) case $ac_cv_c_uint$1_t in #( no|yes) ;; #( *) m4_bmatch([$1], [^\(8\|32\|64\)$], [AC_DEFINE([_UINT$1_T], 1, [Define for Solaris 2.5.1 so the uint$1_t typedef from <sys/synch.h>, <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the #define below would cause a syntax error.])]) AC_DEFINE_UNQUOTED([uint$1_t], [$ac_cv_c_uint$1_t], [Define to the type of an unsigned integer type of width exactly $1 bits if such a type exists and the standard includes do not define it.]);; esac])# _AC_TYPE_UNSIGNED_INT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -