xref: /PHP-5.6/ext/date/lib/timelib.m4 (revision 19b6ffed)
1dnl
2dnl $Id$
3dnl
4dnl
5dnl TL_DEF_HAVE(what [, why])
6dnl
7dnl Generates 'AC_DEFINE(HAVE_WHAT, 1, [WHY])'
8dnl
9AC_DEFUN([TL_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_.-,A-Z___),1,[ $2 ])])dnl
10
11dnl
12dnl TL_CHECK_INT_TYPE(type)
13dnl
14AC_DEFUN([TL_CHECK_INT_TYPE],[
15AC_CACHE_CHECK([for $1], ac_cv_int_type_$1, [
16AC_TRY_COMPILE([
17#if HAVE_SYS_TYPES_H
18# include <sys/types.h>
19#endif
20#if HAVE_INTTYPES_H
21# include <inttypes.h>
22#elif HAVE_STDINT_H
23# include <stdint.h>
24#endif],
25[if (($1 *) 0)
26  return 0;
27if (sizeof ($1))
28  return 0;
29], [ac_cv_int_type_$1=yes], [ac_cv_int_type_$1=no])
30])
31if test "$ac_cv_int_type_$1" = "yes"; then
32  TL_DEF_HAVE($1, [Define if $1 type is present.])
33fi
34])dnl
35
36dnl
37dnl AC_TIMELIB_C_BIGENDIAN
38dnl Replacement macro for AC_C_BIGENDIAN
39dnl
40AC_DEFUN([AC_TIMELIB_C_BIGENDIAN],
41[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
42 [
43  ac_cv_c_bigendian_php=unknown
44  AC_TRY_RUN(
45  [
46int main(void)
47{
48        short one = 1;
49        char *cp = (char *)&one;
50
51        if (*cp == 0) {
52                return(0);
53        } else {
54                return(1);
55        }
56}
57  ], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
58 ])
59 if test $ac_cv_c_bigendian_php = yes; then
60   AC_DEFINE(WORDS_BIGENDIAN, [], [Define if processor uses big-endian word])
61 fi
62])dnl
63
64dnl Check for types, sizes, etc. needed by timelib
65AC_CHECK_SIZEOF(long, 8)
66AC_CHECK_SIZEOF(int, 4)
67TL_CHECK_INT_TYPE(int32_t)
68TL_CHECK_INT_TYPE(uint32_t)
69
70dnl Check for headers needed by timelib
71AC_CHECK_HEADERS([ \
72sys/types.h \
73inttypes.h \
74stdint.h \
75string.h \
76stdlib.h
77])
78
79dnl Check for strtoll, atoll
80AC_CHECK_FUNCS(strtoll atoll strftime)
81