]>
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}' | |
c74836dc NPB |
5 | last_ac_define_dir=`eval echo [$]$2` |
6 | ac_define_dir=`eval echo [$]last_ac_define_dir` | |
422cf3bb | 7 | ac_define_dir_counter=0 |
c74836dc NPB |
8 | while test "x[$]last_ac_define_dir" != "x[$]ac_define_dir"; do |
9 | last_ac_define_dir="[$]ac_define_dir" | |
10 | ac_define_dir=`eval echo [$]last_ac_define_dir` | |
422cf3bb NPB |
11 | AS_VAR_ARITH([ac_define_dir_counter], [$ac_define_dir_counter + 1]) |
12 | AS_VAR_IF([ac_define_dir_counter], [128], | |
13 | [AC_MSG_ERROR([detected recusive directory expansion when expanding $1=[$]$2: [$]ac_define_dir]) | |
14 | break]) | |
c74836dc | 15 | done |
db137867 AC |
16 | $1="$ac_define_dir" |
17 | AC_SUBST($1) | |
18 | ifelse($3, , | |
19 | AC_DEFINE_UNQUOTED($1, "$ac_define_dir"), | |
20 | AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3)) | |
21 | ]) | |
22 | ||
23 | AC_DEFUN([AC_SUBST_DIR], [ | |
24 | ifelse($2,,,$1="[$]$2") | |
25 | $1=`( | |
26 | test "x$prefix" = xNONE && prefix="$ac_default_prefix" | |
27 | test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" | |
28 | eval echo \""[$]$1"\" | |
29 | )` | |
30 | AC_SUBST($1) | |
31 | ]) | |
32 | ||
33 | ||
db137867 AC |
34 | dnl IPv6 support macros..pretty much swiped from wget |
35 | ||
36 | dnl RB_PROTO_INET6 | |
37 | ||
38 | AC_DEFUN([RB_PROTO_INET6],[ | |
39 | AC_CACHE_CHECK([for INET6 protocol support], [rb_cv_proto_inet6],[ | |
40 | AC_TRY_CPP([ | |
ea83b018 | 41 | #ifndef _WIN32 |
db137867 AC |
42 | #include <sys/types.h> |
43 | #include <sys/socket.h> | |
ea83b018 AC |
44 | #else |
45 | #include <winsock2.h> | |
46 | #include <ws2tcpip.h> | |
47 | #endif | |
db137867 AC |
48 | |
49 | #ifndef PF_INET6 | |
50 | #error Missing PF_INET6 | |
51 | #endif | |
52 | #ifndef AF_INET6 | |
53 | #error Mlssing AF_INET6 | |
54 | #endif | |
55 | ],[ | |
56 | rb_cv_proto_inet6=yes | |
57 | ],[ | |
58 | rb_cv_proto_inet6=no | |
59 | ]) | |
60 | ]) | |
61 | ||
62 | if test "X$rb_cv_proto_inet6" = "Xyes"; then : | |
63 | $1 | |
64 | else : | |
65 | $2 | |
66 | fi | |
67 | ]) | |
68 | ||
69 | ||
70 | AC_DEFUN([RB_TYPE_STRUCT_SOCKADDR_IN6],[ | |
71 | rb_have_sockaddr_in6= | |
72 | AC_CHECK_TYPES([struct sockaddr_in6],[ | |
73 | rb_have_sockaddr_in6=yes | |
74 | ],[ | |
75 | rb_have_sockaddr_in6=no | |
76 | ],[ | |
71b2af06 | 77 | #ifndef _WIN32 |
db137867 AC |
78 | #include <sys/types.h> |
79 | #include <sys/socket.h> | |
80 | #include <netinet/in.h> | |
71b2af06 AC |
81 | #else |
82 | #include <winsock2.h> | |
83 | #include <ws2tcpip.h> | |
84 | #endif | |
db137867 AC |
85 | ]) |
86 | ||
87 | if test "X$rb_have_sockaddr_in6" = "Xyes"; then : | |
88 | $1 | |
89 | else : | |
90 | $2 | |
91 | fi | |
92 | ]) | |
93 | ||
94 | ||
95 | AC_DEFUN([RB_CHECK_TIMER_CREATE], | |
96 | [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], | |
97 | [rb__cv_timer_create_works], | |
98 | [AC_TRY_RUN([ | |
99 | #ifdef HAVE_TIME_H | |
100 | #include <time.h> | |
101 | #endif | |
102 | #ifdef HAVE_SIGNAL_H | |
103 | #include <signal.h> | |
104 | #endif | |
105 | #ifdef HAVE_UNISTD_H | |
106 | #include <unistd.h> | |
107 | #endif | |
108 | int main(int argc, char *argv[]) | |
109 | { | |
110 | #if HAVE_TIMER_CREATE | |
111 | struct sigevent ev; | |
112 | timer_t timer; | |
113 | ev.sigev_notify = SIGEV_SIGNAL; | |
114 | ev.sigev_signo = SIGVTALRM; | |
115 | if (timer_create(CLOCK_REALTIME, &ev, &timer) != 0) { | |
116 | return 1; | |
117 | } | |
118 | #else | |
119 | return 1; | |
120 | #endif | |
121 | return 0; | |
122 | } | |
123 | ], | |
124 | [rb__cv_timer_create_works=yes], | |
498b1893 | 125 | [rb__cv_timer_create_works=no], |
db137867 AC |
126 | [rb__cv_timer_create_works=no]) |
127 | ]) | |
128 | case $rb__cv_timer_create_works in | |
129 | yes) AC_DEFINE([USE_TIMER_CREATE], 1, | |
130 | [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);; | |
131 | esac | |
132 | ]) | |
133 | ||
3202e249 VY |
134 | |
135 | ||
136 | AC_DEFUN([RB_CHECK_TIMERFD_CREATE], | |
137 | [AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)], | |
138 | [rb__cv_timerfd_create_works], | |
139 | [AC_TRY_RUN([ | |
140 | #ifdef HAVE_TIME_H | |
141 | #include <time.h> | |
142 | #endif | |
143 | #ifdef HAVE_SIGNAL_H | |
144 | #include <signal.h> | |
145 | #endif | |
146 | #ifdef HAVE_UNISTD_H | |
147 | #include <unistd.h> | |
148 | #endif | |
149 | #ifdef HAVE_SYS_TIMERFD_H | |
150 | #include <sys/timerfd.h> | |
151 | #endif | |
152 | int main(int argc, char *argv[]) | |
153 | { | |
154 | #if defined(HAVE_TIMERFD_CREATE) && defined(HAVE_SYS_TIMERFD_H) | |
155 | if (timerfd_create(CLOCK_REALTIME, 0) < 0) { | |
156 | return 1; | |
157 | } | |
158 | #else | |
159 | return 1; | |
160 | #endif | |
161 | return 0; | |
162 | } | |
163 | ], | |
164 | [rb__cv_timerfd_create_works=yes], | |
498b1893 | 165 | [rb__cv_timerfd_create_works=no], |
3202e249 VY |
166 | [rb__cv_timerfd_create_works=no]) |
167 | ]) | |
168 | case $rb__cv_timerfd_create_works in | |
169 | yes) AC_DEFINE([USE_TIMERFD_CREATE], 1, | |
170 | [Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...)]);; | |
171 | esac | |
172 | ]) | |
173 |