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