]> jfr.im git - irc/rqf/shadowircd.git/blob - libratbox/acinclude.m4
7e963d5a4ee23ce9719f72e92e1f1e4696fd0fc2
[irc/rqf/shadowircd.git] / libratbox / acinclude.m4
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 dnl IPv6 support macros..pretty much swiped from wget
26
27 dnl RB_PROTO_INET6
28
29 AC_DEFUN([RB_PROTO_INET6],[
30 AC_CACHE_CHECK([for INET6 protocol support], [rb_cv_proto_inet6],[
31 AC_TRY_CPP([
32 #include <sys/types.h>
33 #include <sys/socket.h>
34
35 #ifndef PF_INET6
36 #error Missing PF_INET6
37 #endif
38 #ifndef AF_INET6
39 #error Mlssing AF_INET6
40 #endif
41 ],[
42 rb_cv_proto_inet6=yes
43 ],[
44 rb_cv_proto_inet6=no
45 ])
46 ])
47
48 if test "X$rb_cv_proto_inet6" = "Xyes"; then :
49 $1
50 else :
51 $2
52 fi
53 ])
54
55
56 AC_DEFUN([RB_TYPE_STRUCT_SOCKADDR_IN6],[
57 rb_have_sockaddr_in6=
58 AC_CHECK_TYPES([struct sockaddr_in6],[
59 rb_have_sockaddr_in6=yes
60 ],[
61 rb_have_sockaddr_in6=no
62 ],[
63 #include <sys/types.h>
64 #include <sys/socket.h>
65 #include <netinet/in.h>
66 ])
67
68 if test "X$rb_have_sockaddr_in6" = "Xyes"; then :
69 $1
70 else :
71 $2
72 fi
73 ])
74
75
76 AC_DEFUN([RB_CHECK_TIMER_CREATE],
77 [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)],
78 [rb__cv_timer_create_works],
79 [AC_TRY_RUN([
80 #ifdef HAVE_TIME_H
81 #include <time.h>
82 #endif
83 #ifdef HAVE_SIGNAL_H
84 #include <signal.h>
85 #endif
86 #ifdef HAVE_UNISTD_H
87 #include <unistd.h>
88 #endif
89 int main(int argc, char *argv[])
90 {
91 #if HAVE_TIMER_CREATE
92 struct sigevent ev;
93 timer_t timer;
94 ev.sigev_notify = SIGEV_SIGNAL;
95 ev.sigev_signo = SIGVTALRM;
96 if (timer_create(CLOCK_REALTIME, &ev, &timer) != 0) {
97 return 1;
98 }
99 #else
100 return 1;
101 #endif
102 return 0;
103 }
104 ],
105 [rb__cv_timer_create_works=yes],
106 [rb__cv_timer_create_works=no])
107 ])
108 case $rb__cv_timer_create_works in
109 yes) AC_DEFINE([USE_TIMER_CREATE], 1,
110 [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);;
111 esac
112 ])
113