ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-8/acinclude.m4
Revision: 1115
Committed: Tue Dec 21 14:42:54 2010 UTC (13 years, 3 months ago) by michael
Original Path: ircd-hybrid-7.3/acinclude.m4
File size: 10804 byte(s)
Log Message:
- Rename bogus_host() found in several modules to check_servname() and move
  it to s_serv.c
- serverinfo::sid is now mandatory and must be specified.
  ircd won't start otherwise

File Contents

# Content
1 dnl Inspired by work Copyright (C) 2006 Luca Filipozzi
2 dnl vim: set fdm=marker sw=2 ts=2 et si:
3 dnl {{{ ax_check_lib_ipv4
4 AC_DEFUN([AX_CHECK_LIB_IPV4],[
5 AC_SEARCH_LIBS([socket],[socket],,[AC_MSG_ERROR([socket library not found])])
6 AC_SEARCH_LIBS([inet_ntoa], [nsl])
7 AC_SEARCH_LIBS([inet_aton], [resolv])
8 AC_CHECK_FUNCS([inet_aton inet_ntop inet_pton])
9 AC_CHECK_TYPES([struct sockaddr_in, struct sockaddr_storage, struct addrinfo],,,[#include <sys/types.h>
10 #include <sys/socket.h>
11 #include <netdb.h>
12 ])
13 AC_CHECK_MEMBERS([struct sockaddr_in.sin_len],,,[#include <sys/types.h>
14 <sys/socket.h>])
15 ])dnl }}}
16 dnl {{{ ax_check_lib_ipv6
17 AC_DEFUN([AX_CHECK_LIB_IPV6],[
18 AC_CHECK_TYPES([struct sockaddr_in6],,[AC_DEFINE([IPV6],[1],[Define to 1 if you have IPv6 support.])],,[#include <sys/types.h>
19 <sys/socket.h>])
20 ])dnl }}}
21 dnl {{{ ax_arg_enable_ioloop_mechanism (FIXME)
22 AC_DEFUN([AX_ARG_ENABLE_IOLOOP_MECHANISM],[
23 dnl {{{ allow the user to specify desired mechanism
24 desired_iopoll_mechanism="none"
25 dnl FIXME need to handle arguments a bit better (see ac_arg_disable_block_alloc)
26 AC_ARG_ENABLE([kqueue], [AC_HELP_STRING([--enable-kqueue], [Force kqueue usage.])], [desired_iopoll_mechanism="kqueue"])
27 AC_ARG_ENABLE([epoll], [AC_HELP_STRING([--enable-epoll], [Force epoll usage.])], [desired_iopoll_mechanism="epoll"])
28 AC_ARG_ENABLE([devpoll],[AC_HELP_STRING([--enable-devpoll],[Force devpoll usage.])],[desired_iopoll_mechanism="devpoll"])
29 AC_ARG_ENABLE([rtsigio],[AC_HELP_STRING([--enable-rtsigio],[Force rtsigio usage.])],[desired_iopoll_mechanism="rtsigio"])
30 AC_ARG_ENABLE([poll], [AC_HELP_STRING([--enable-poll], [Force poll usage.])], [desired_iopoll_mechanism="poll"])
31 AC_ARG_ENABLE([select], [AC_HELP_STRING([--enable-select], [Force select usage.])], [desired_iopoll_mechanism="select"])
32 dnl }}}
33 dnl {{{ preamble
34 AC_MSG_CHECKING([for optimal/desired iopoll mechanism])
35 iopoll_mechanism_none=0
36 AC_DEFINE_UNQUOTED([__IOPOLL_MECHANISM_NONE],[$iopoll_mechanism_none],[no iopoll mechanism])
37 dnl }}}
38 dnl {{{ check for kqueue mechanism support
39 iopoll_mechanism_kqueue=1
40 AC_DEFINE_UNQUOTED([__IOPOLL_MECHANISM_KQUEUE],[$iopoll_mechanism_kqueue],[kqueue mechanism])
41 AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([kevent])],[is_kqueue_mechanism_available="yes"],[is_kqueue_mechanism_available="no"])
42 dnl }}}
43 dnl {{{ check for epoll oechanism support
44 iopoll_mechanism_epoll=2
45 AC_DEFINE_UNQUOTED([__IOPOLL_MECHANISM_EPOLL],[$iopoll_mechanism_epoll],[epoll mechanism])
46 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
47 #include <sys/epoll.h>
48 #include <sys/syscall.h>
49 #if defined(__stub_epoll_create) || defined(__stub___epoll_create) || defined(EPOLL_NEED_BODY)
50 #if !defined(__NR_epoll_create)
51 #if defined(__ia64__)
52 #define __NR_epoll_create 1243
53 #elif defined(__x86_64__)
54 #define __NR_epoll_create 214
55 #elif defined(__sparc64__) || defined(__sparc__)
56 #define __NR_epoll_create 193
57 #elif defined(__s390__) || defined(__m68k__)
58 #define __NR_epoll_create 249
59 #elif defined(__ppc64__) || defined(__ppc__)
60 #define __NR_epoll_create 236
61 #elif defined(__parisc__) || defined(__arm26__) || defined(__arm__)
62 #define __NR_epoll_create 224
63 #elif defined(__alpha__)
64 #define __NR_epoll_create 407
65 #elif defined(__sh64__)
66 #define __NR_epoll_create 282
67 #elif defined(__i386__) || defined(__sh__) || defined(__m32r__) || defined(__h8300__) || defined(__frv__)
68 #define __NR_epoll_create 254
69 #else
70 #error No system call numbers defined for epoll family.
71 #endif
72 #endif
73 _syscall1(int, epoll_create, int, size)
74 #endif
75 ]], [[ return epoll_create(256) == -1 ? 1 : 0 ]])],
76 [is_epoll_mechanism_available="yes"],[is_epoll_mechanism_available="no"])
77 dnl }}}
78 dnl {{{ check for devpoll mechanism support
79 iopoll_mechanism_devpoll=3
80 AC_DEFINE_UNQUOTED([__IOPOLL_MECHANISM_DEVPOLL],[$iopoll_mechanism_devpoll],[devpoll mechanism])
81 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <devpoll.h>])],[is_devpoll_mechanism_available="yes"],[is_devpoll_mechanism_available="no"])
82 if test "$is_devpoll_mechanism_available" = "yes" ; then
83 AC_DEFINE([HAVE_DEVPOLL_H],[1],[Define to 1 if you have the <devpoll.h> header file.])
84 fi
85 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/devpoll.h>])],[is_devpoll_mechanism_available="yes"],[is_devpoll_mechanism_available="no"])
86 if test "$is_devpoll_mechanism_available" = "yes" ; then
87 AC_DEFINE([HAVE_SYS_DEVPOLL_H],[1],[Define to 1 if you have the <sys/devpoll.h> header file.])
88 fi
89 dnl }}}
90 dnl {{{ check for rtsigio mechanism support
91 iopoll_mechanism_rtsigio=4
92 AC_DEFINE_UNQUOTED([__IOPOLL_MECHANISM_RTSIGIO],[$iopoll_mechanism_rtsigio],[rtsigio mechanism])
93 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
94 #define _GNU_SOURCE
95 #include <fcntl.h>
96 static unsigned int have_f_setsig = 0;
97 ]], [[
98 #ifdef F_SETSIG
99 have_f_setsig = 1;
100 #endif
101 return have_f_setsig == 0;
102 ]])], [is_rtsigio_mechanism_available="yes"],[is_rtsigio_mechanism_available="no"])
103 dnl }}}
104 dnl {{{ check for poll mechanism support
105 iopoll_mechanism_poll=5
106 AC_DEFINE_UNQUOTED([__IOPOLL_MECHANISM_POLL],[$iopoll_mechanism_poll],[poll mechanism])
107 AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([poll])],[is_poll_mechanism_available="yes"],[is_poll_mechanism_available="no"])
108 dnl }}}
109 dnl {{{ check for select mechanism support
110 iopoll_mechanism_select=6
111 AC_DEFINE_UNQUOTED([__IOPOLL_MECHANISM_SELECT],[$iopoll_mechanism_select],[select mechanism])
112 AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([select])],[is_select_mechanism_available="yes"],[is_select_mechanism_available="no"])
113 dnl }}}
114 dnl {{{ determine the optimal mechanism
115 optimal_iopoll_mechanism="none"
116 for mechanism in "kqueue" "epoll" "devpoll" "rtsigio" "poll" "select" ; do # order is important
117 eval "is_optimal_iopoll_mechanism_available=\$is_${mechanism}_mechanism_available"
118 if test "$is_optimal_iopoll_mechanism_available" = "yes" ; then
119 optimal_iopoll_mechanism="$mechanism"
120 break
121 fi
122 done
123 dnl }}}
124 dnl {{{ select between optimal mechanism and desired mechanism (if specified)
125 if test "$desired_iopoll_mechanism" = "none" ; then
126 if test "$optimal_iopoll_mechanism" = "none" ; then
127 AC_MSG_RESULT([none])
128 AC_MSG_ERROR([no iopoll mechanism found!])
129 else
130 selected_iopoll_mechanism=$optimal_iopoll_mechanism
131 AC_MSG_RESULT([$selected_iopoll_mechanism])
132 fi
133 else
134 eval "is_desired_iopoll_mechanism_available=\$is_${desired_iopoll_mechanism}_mechanism_available"
135 if test "$is_desired_iopoll_mechanism_available" = "yes" ; then
136 selected_iopoll_mechanism=$desired_iopoll_mechanism
137 AC_MSG_RESULT([$selected_iopoll_mechanism])
138 else
139 AC_MSG_RESULT([none])
140 AC_MSG_ERROR([desired iopoll mechanism, $desired_iopoll_mechanism, is not available])
141 fi
142 fi
143 dnl }}}
144 dnl {{{ postamble
145 eval "use_iopoll_mechanism=\$iopoll_mechanism_${selected_iopoll_mechanism}"
146 AC_DEFINE_UNQUOTED([USE_IOPOLL_MECHANISM],[$use_iopoll_mechanism],[use this iopoll mechanism])
147 dnl }}}
148 ])dnl }}}
149 dnl {{{ ax_arg_with_topiclen
150 AC_DEFUN([AX_ARG_WITH_TOPICLEN],[
151 AC_ARG_WITH([topiclen],[AC_HELP_STRING([--with-topiclen=<value>],[Set topic length (default 160).])],[topiclen="$withval"],[topiclen="160"])
152 AC_DEFINE_UNQUOTED([TOPICLEN],[($topiclen)],[Length of topics.])
153 ])dnl }}}
154 dnl {{{ ax_arg_with_nicklen
155 AC_DEFUN([AX_ARG_WITH_NICKLEN],[
156 AC_ARG_WITH([nicklen],[AC_HELP_STRING([--with-nicklen=<value>],[Set nickname length (default 9).])],[nicklen="$withval"],[nicklen="9"])
157 AC_DEFINE_UNQUOTED([NICKLEN],[($nicklen+1)],[Length of nicknames.])
158 ])dnl }}}
159 dnl {{{ ax_arg_enable_efnet
160 AC_DEFUN([AX_ARG_ENABLE_EFNET],[
161 AC_ARG_ENABLE([efnet],[AC_HELP_STRING([--enable-efnet],[For IRCDs running on EFnet.])],[efnet="$enableval"],[efnet="no"])
162 if test "$efnet" = "yes" ; then
163 use_efnet="yes"
164 AC_DEFINE([EFNET],[1],[Define to 1 if this server will be an EFnet server.])
165 else
166 use_efnet="no"
167 fi
168 AM_CONDITIONAL([EFNET],[test "$use_efnet" = "yes"])
169 ])dnl }}}
170 dnl {{{ ax_arg_enable_halfops
171 AC_DEFUN([AX_ARG_ENABLE_HALFOPS],[
172 AC_ARG_ENABLE([halfops],[AC_HELP_STRING([--enable-halfops],[Enable halfops support.])],[halfops="$enableval"],[halfops="no"])
173 if test "$halfops" = "yes" ; then
174 AC_DEFINE([HALFOPS],[1],[Define to 1 if you want halfops support.])
175 fi
176 ])dnl }}}
177 dnl {{{ ax_arg_enable_debugging
178 AC_DEFUN([AX_ARG_ENABLE_DEBUGGING],[
179 AC_ARG_ENABLE([debugging],[AC_HELP_STRING([--enable-debugging],[Enable debugging.])],[debugging="$enableval"],[debugging="no"])
180 if test "$debugging" = "yes" ; then
181 AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging.])
182 CFLAGS="-Wall -g -O0"
183 else
184 AC_DEFINE([NDEBUG],[1],[Define to 1 to disable debugging.])
185 fi
186 ])dnl }}}
187 dnl {{{ ax_arg_enable_warnings
188 AC_DEFUN([AX_ARG_ENABLE_WARNINGS],[
189 AC_ARG_ENABLE([warnings],[AC_HELP_STRING([--enable-warnings],[Enable compiler warnings.])],[warnings="$enableval"],[warnings="no"])
190 if test "$warnings" = "yes" ; then
191 CFLAGS="-Wall -Wextra -Wno-unused -Wcast-qual -Wcast-align -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wredundant-decls -Wshadow -Wwrite-strings -Wundef"
192 fi
193 ])dnl }}}
194 dnl {{{ ax_arg_enable_syslog
195 AC_DEFUN([AX_ARG_ENABLE_SYSLOG],[
196 AC_CHECK_HEADERS([syslog.h sys/syslog.h])
197 AC_ARG_ENABLE([syslog],[AC_HELP_STRING([--enable-syslog="EVENTS"],[Enable syslog for events: users oper (space separated in quotes; default: disabled).])],[syslog="$enableval"],[syslog="no"])
198 if test "$enableval" != "no" ; then
199 for option in $enableval ; do
200 case "$option" in
201 users) AC_DEFINE([SYSLOG_USERS],[1],[Send user log stuff to syslog.]) ;;
202 oper) AC_DEFINE([SYSLOG_OPER],[1],[Send oper log stuff to syslog.]) ;;
203 yes) : ;;
204 *) AC_MSG_ERROR([invalid value for --enable-syslog: $option]) ;;
205 esac
206 done
207 AC_DEFINE([USE_SYSLOG],[1],[Define to 1 if you want to use syslog.])
208 fi
209 ])dnl }}}
210 dnl {{{ ax_arg_with_syslog_facility
211 AC_DEFUN([AX_ARG_WITH_SYSLOG],[
212 AC_ARG_WITH([syslog-facility],[AC_HELP_STRING([--with-syslog-facility=LOG],[Define the syslog facility to use (default: LOG_LOCAL4)])],[syslog_facility="$withval"],[syslog_facility="LOG_LOCAL4"])
213 AC_DEFINE_UNQUOTED([LOG_FACILITY],[$syslog_facility],[Set to syslog facility to use.])
214 ])dnl }}}
215 dnl {{{ ac_define_dir
216 dnl http://autoconf-archive.cryp.to/ac_define_dir.html
217 AC_DEFUN([AC_DEFINE_DIR], [
218 prefix_NONE=
219 exec_prefix_NONE=
220 test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
221 test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
222 eval ac_define_dir="\"[$]$2\""
223 eval ac_define_dir="\"$ac_define_dir\""
224 AC_SUBST($1, "$ac_define_dir")
225 AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
226 test "$prefix_NONE" && prefix=NONE
227 test "$exec_prefix_NONE" && exec_prefix=NONE
228 ])dnl }}}
229 ]) dnl }}}