]>
Commit | Line | Data |
---|---|---|
db137867 AC |
1 | # $Id: acinclude.m4 23020 2006-09-01 18:20:19Z androsyn $ - aclocal.m4 - Autoconf fun... |
2 | AC_DEFUN([AC_DEFINE_DIR], [ | |
3 | test "x$prefix" = xNONE && prefix="$ac_default_prefix" | |
4 | test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' | |
5 | ac_define_dir=`eval echo [$]$2` | |
6 | ac_define_dir=`eval echo [$]ac_define_dir` | |
7 | $1="$ac_define_dir" | |
8 | AC_SUBST($1) | |
9 | ifelse($3, , | |
10 | AC_DEFINE_UNQUOTED($1, "$ac_define_dir"), | |
11 | AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3)) | |
12 | ]) | |
13 | ||
14 | AC_DEFUN([AC_SUBST_DIR], [ | |
15 | ifelse($2,,,$1="[$]$2") | |
16 | $1=`( | |
17 | test "x$prefix" = xNONE && prefix="$ac_default_prefix" | |
18 | test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" | |
19 | eval echo \""[$]$1"\" | |
20 | )` | |
21 | AC_SUBST($1) | |
22 | ]) | |
23 | ||
24 | ||
25 | # RB_TYPE_INTMAX_T | |
26 | # ----------------- | |
27 | AC_DEFUN([RB_TYPE_INTMAX_T], | |
28 | [ | |
29 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | |
30 | AC_CHECK_TYPE([intmax_t], | |
31 | [AC_DEFINE([HAVE_INTMAX_T], 1, | |
32 | [Define to 1 if the system has the type `intmax_t'.]) ac_cv_c_intmax_t=yes], | |
33 | [test $ac_cv_type_long_long_int = yes \ | |
34 | && ac_type='long long int' \ | |
35 | || ac_type='long int' | |
36 | AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], | |
37 | [Define to the widest signed integer type | |
38 | if <stdint.h> and <inttypes.h> do not define.]) ac_cv_c_intmax_t="$ac_type"]) | |
39 | ]) | |
40 | ||
41 | ||
42 | # RB_TYPE_UINTMAX_T | |
43 | # ----------------- | |
44 | AC_DEFUN([RB_TYPE_UINTMAX_T], | |
45 | [ | |
46 | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | |
47 | AC_CHECK_TYPE([uintmax_t], | |
48 | [AC_DEFINE([HAVE_UINTMAX_T], 1, | |
49 | [Define to 1 if the system has the type `uintmax_t'.]) ac_cv_c_uintmax_t=yes], | |
50 | [test $ac_cv_type_unsigned_long_long_int = yes \ | |
51 | && ac_type='unsigned long long int' \ | |
52 | || ac_type='unsigned long int' | |
53 | AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type], | |
54 | [Define to the widest unsigned integer type | |
55 | if <stdint.h> and <inttypes.h> do not define.]) ac_cv_c_uintmax_t="$ac_type"]) | |
56 | ]) | |
57 | ||
58 | ||
59 | # RB_TYPE_INTPTR_T | |
60 | # ----------------- | |
61 | AC_DEFUN([RB_TYPE_INTPTR_T], | |
62 | [ | |
63 | AC_CHECK_TYPE([intptr_t], | |
64 | [AC_DEFINE([HAVE_INTPTR_T], 1, | |
65 | [Define to 1 if the system has the type `intptr_t'.]) ac_cv_c_intptr_t=yes], | |
66 | [for ac_type in 'int' 'long int' 'long long int'; do | |
67 | AC_COMPILE_IFELSE( | |
68 | [AC_LANG_BOOL_COMPILE_TRY( | |
69 | [AC_INCLUDES_DEFAULT], | |
70 | [[sizeof (void *) <= sizeof ($ac_type)]])], | |
71 | [AC_DEFINE_UNQUOTED([intptr_t], [$ac_type], | |
72 | [Define to the type of a signed integer type wide enough to | |
73 | hold a pointer, if such a type exists, and if the system | |
74 | does not define it.]) ac_cv_c_intptr_t="$ac_type" | |
75 | ac_type=]) | |
76 | test -z "$ac_type" && break | |
77 | done]) | |
78 | ]) | |
79 | ||
80 | ||
81 | # RB_TYPE_UINTPTR_T | |
82 | # ----------------- | |
83 | AC_DEFUN([RB_TYPE_UINTPTR_T], | |
84 | [ | |
85 | AC_CHECK_TYPE([uintptr_t], | |
86 | [AC_DEFINE([HAVE_UINTPTR_T], 1, | |
87 | [Define to 1 if the system has the type `uintptr_t'.]) ac_cv_c_uintptr_t=yes], | |
88 | [for ac_type in 'unsigned int' 'unsigned long int' \ | |
89 | 'unsigned long long int'; do | |
90 | AC_COMPILE_IFELSE( | |
91 | [AC_LANG_BOOL_COMPILE_TRY( | |
92 | [AC_INCLUDES_DEFAULT], | |
93 | [[sizeof (void *) <= sizeof ($ac_type)]])], | |
94 | [AC_DEFINE_UNQUOTED([uintptr_t], [$ac_type], | |
95 | [Define to the type of an unsigned integer type wide enough to | |
96 | hold a pointer, if such a type exists, and if the system | |
97 | does not define it.]) ac_cv_c_uintptr_t="$ac_type" | |
98 | ac_type=]) | |
99 | test -z "$ac_type" && break | |
100 | done]) | |
101 | ]) | |
102 | ||
103 | dnl IPv6 support macros..pretty much swiped from wget | |
104 | ||
105 | dnl RB_PROTO_INET6 | |
106 | ||
107 | AC_DEFUN([RB_PROTO_INET6],[ | |
108 | AC_CACHE_CHECK([for INET6 protocol support], [rb_cv_proto_inet6],[ | |
109 | AC_TRY_CPP([ | |
110 | #include <sys/types.h> | |
111 | #include <sys/socket.h> | |
112 | ||
113 | #ifndef PF_INET6 | |
114 | #error Missing PF_INET6 | |
115 | #endif | |
116 | #ifndef AF_INET6 | |
117 | #error Mlssing AF_INET6 | |
118 | #endif | |
119 | ],[ | |
120 | rb_cv_proto_inet6=yes | |
121 | ],[ | |
122 | rb_cv_proto_inet6=no | |
123 | ]) | |
124 | ]) | |
125 | ||
126 | if test "X$rb_cv_proto_inet6" = "Xyes"; then : | |
127 | $1 | |
128 | else : | |
129 | $2 | |
130 | fi | |
131 | ]) | |
132 | ||
133 | ||
134 | AC_DEFUN([RB_TYPE_STRUCT_SOCKADDR_IN6],[ | |
135 | rb_have_sockaddr_in6= | |
136 | AC_CHECK_TYPES([struct sockaddr_in6],[ | |
137 | rb_have_sockaddr_in6=yes | |
138 | ],[ | |
139 | rb_have_sockaddr_in6=no | |
140 | ],[ | |
141 | #include <sys/types.h> | |
142 | #include <sys/socket.h> | |
143 | #include <netinet/in.h> | |
144 | ]) | |
145 | ||
146 | if test "X$rb_have_sockaddr_in6" = "Xyes"; then : | |
147 | $1 | |
148 | else : | |
149 | $2 | |
150 | fi | |
151 | ]) | |
152 | ||
153 | ||
154 | AC_DEFUN([RB_CHECK_TIMER_CREATE], | |
155 | [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], | |
156 | [rb__cv_timer_create_works], | |
157 | [AC_TRY_RUN([ | |
158 | #ifdef HAVE_TIME_H | |
159 | #include <time.h> | |
160 | #endif | |
161 | #ifdef HAVE_SIGNAL_H | |
162 | #include <signal.h> | |
163 | #endif | |
164 | #ifdef HAVE_UNISTD_H | |
165 | #include <unistd.h> | |
166 | #endif | |
167 | int main(int argc, char *argv[]) | |
168 | { | |
169 | #if HAVE_TIMER_CREATE | |
170 | struct sigevent ev; | |
171 | timer_t timer; | |
172 | ev.sigev_notify = SIGEV_SIGNAL; | |
173 | ev.sigev_signo = SIGVTALRM; | |
174 | if (timer_create(CLOCK_REALTIME, &ev, &timer) != 0) { | |
175 | return 1; | |
176 | } | |
177 | #else | |
178 | return 1; | |
179 | #endif | |
180 | return 0; | |
181 | } | |
182 | ], | |
183 | [rb__cv_timer_create_works=yes], | |
184 | [rb__cv_timer_create_works=no]) | |
185 | ]) | |
186 | case $rb__cv_timer_create_works in | |
187 | yes) AC_DEFINE([USE_TIMER_CREATE], 1, | |
188 | [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);; | |
189 | esac | |
190 | ]) | |
191 |