-
Notifications
You must be signed in to change notification settings - Fork 2
/
xiph_types.m4
59 lines (57 loc) · 1.32 KB
/
xiph_types.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
dnl xiph_types.m4
dnl macros for type checks not covered by autoconf
dnl XIPH_C99_INTTYPES
dnl Brendan Cully
dnl
# XIPH_C99_INTTYPES
# Check for C99 integer type definitions, or define if missing
AC_DEFUN([XIPH_C99_INTTYPES],
[dnl
AC_CHECK_HEADERS([inttypes.h])
AC_CHECK_TYPE([uint32_t],
[AC_DEFINE(HAVE_C99_INTTYPES, 1, [Define if you have the C99 integer types])],
[AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)])
AH_VERBATIM([X_HAVE_C99_INTTYPES],
[#ifndef HAVE_C99_INTTYPES
# if SIZEOF_SHORT == 4
typedef unsigned short uint32_t;
# elif SIZEOF_INT == 4
typedef unsigned int uint32_t;
# elif SIZEOF_LONG == 4
typedef unsigned long uint32_t;
# endif
# if SIZEOF_INT == 8
typedef unsigned int uint64_t;
# elif SIZEOF_LONG == 8
typedef unsigned long uint64_t;
# elif SIZEOF_LONG_LONG == 8
typedef unsigned long long uint64_t;
# endif
#endif
])
])
dnl XIPH_TYPE_SOCKLEN_T
dnl Brendan Cully
dnl
# XIPH_TYPE_SOCKLEN_T
# Check for socklen_t, or define as int if missing
AC_DEFUN([XIPH_TYPE_SOCKLEN_T],
[dnl
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_TYPES([socklen_t],,,
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
AH_VERBATIM([X_HAVE_SOCKLEN_T],
[#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
])
])