]> jfr.im git - irc/UndernetIRC/iauthd-c.git/blob - configure.ac
distclean: Remove unit-tests.log
[irc/UndernetIRC/iauthd-c.git] / configure.ac
1 # configure.ac - Configuration rules for iauthd-c.
2 #
3 # Copyright 2011 Michael Poole <mdpoole@troilus.org>
4 #
5 # Permission is hereby granted, free of charge, to any person
6 # obtaining a copy of this software and associated documentation files
7 # (the "Software"), to deal in the Software without restriction,
8 # including without limitation the rights to use, copy, modify, merge,
9 # publish, distribute, sublicense, and/or sell copies of the Software,
10 # and to permit persons to whom the Software is furnished to do so,
11 # subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be
14 # included in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 # SOFTWARE.
24
25 dnl General initialization.
26 AC_PREREQ([2.63])
27 AC_INIT([iauthd-c], [1.0.5], [coder-com@undernet.org])
28 AC_CONFIG_AUX_DIR([autoconf])
29 AC_CONFIG_MACRO_DIR([autoconf])
30 AC_CONFIG_HEADERS([autoconf.h])
31 AC_CONFIG_SRCDIR([src/main.c])
32 AC_REQUIRE_AUX_FILE([tap-driver.sh])
33 AC_CANONICAL_TARGET
34 AM_INIT_AUTOMAKE([silent-rules])
35 AM_SILENT_RULES([yes])
36 AC_ENABLE_STATIC([no])
37 AC_ENABLE_SHARED([yes])
38 LT_INIT
39
40 dnl Check for toolchain utilities.
41 AC_PROG_CC
42 AM_PROG_CC_C_O
43 AC_PROG_INSTALL
44 AC_PROG_MKDIR_P
45 PKG_CHECK_MODULES([EVENT], [libevent >= 2.1])
46
47 dnl Compiler/runtime feature checks.
48 AC_C_CONST
49 AC_C_INLINE
50 AC_HEADER_STDC
51 AC_HEADER_TIME
52 AC_STRUCT_TM
53
54 dnl Check whether we might be running in a git working tree.
55 AC_CHECK_PROGS(GIT, [git])
56 AM_CONDITIONAL(HAS_GIT, test z$GIT != z -a -r ${srcdir}/.git)
57
58 dnl Check libraries.
59 AC_CHECK_LIB(dl, dlopen)
60 AC_CHECK_LIB(rt, clock_gettime)
61 AC_CHECK_LIB(socket, socket)
62 AC_CHECK_TYPE(evutil_socket_t,
63 AC_DEFINE(HAVE_EVUTIL_SOCKET_T, 1, [Define if <evutil.h> defines evutil_socket_t]),, [#include <evutil.h>])
64
65 dnl More detailed system runtime feature checks.
66 AC_CHECK_HEADERS([arpa/inet.h dirent.h fcntl.h fnmatch.h inttypes.h netdb.h netinet/in.h regex.h stddef.h stdint.h strings.h sys/epoll.h sys/select.h sys/socket.h sys/stat.h sys/timeb.h sys/times.h sys/types.h sys/wait.h unistd.h])
67 AC_CHECK_FUNCS([atoi socket vsnprintf])
68 AC_CHECK_FUNCS([closedir fnmatch ftime gettimeofday gmtime gmtime_r opendir readdir regcomp regexec regfree sigaction strerror strlcpy strlcat strsignal strtok_r sysconf],,)
69 if test $ac_cv_func_gmtime_r = no -a $ac_cv_func_gmtime = no ; then
70 AC_MSG_ERROR([gmtime_r or gmtime is required])
71 fi
72 if test $ac_cv_func_gettimeofday = no -a $ac_cv_func_ftime = no ; then
73 AC_MSG_ERROR([ftime or gettimeofday is required])
74 fi
75
76 dnl How to copy one va_list to another?
77 AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy, [AC_LINK_IFELSE(
78 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
79 [ac_cv_c_va_copy="yes"],
80 [ac_cv_c_va_copy="no"]
81 )])
82 if test "$ac_cv_c_va_copy" = "yes" ; then
83 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
84 fi
85 dnl (it may also have a pre-C99 name, __va_copy())
86 AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy, [AC_LINK_IFELSE(
87 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
88 [ac_cv_c___va_copy="yes"],
89 [ac_cv_c___va_copy="no"]
90 )])
91 if test "$ac_cv_c___va_copy" = "yes" ; then
92 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
93 fi
94
95 dnl Check for structure members that only exist on some platforms.
96 AC_CHECK_MEMBER([struct sockaddr.sa_len],
97 [AC_DEFINE([HAVE_SOCKADDR_SA_LEN],,[Define if struct sockaddr has sa_len field])],
98 [],[#include <sys/types.h>
99 #include <sys/socket.h>])
100 AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],
101 [AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE],,[Define if struct sockaddr_storage declared])],
102 [],[#include <sys/types.h>
103 #include <sys/socket.h>])
104 AC_CHECK_MEMBER([struct addrinfo.ai_flags],
105 [AC_DEFINE([HAVE_STRUCT_ADDRINFO],,[Define if struct addrinfo declared])],
106 [],[#include <sys/types.h>
107 #include <sys/socket.h>
108 #include <netdb.h>])
109
110 dnl Decide what CLFAGS we can use for strict compilation.
111 case `uname` in
112 Linux) STRICT_CFLAGS="-W -Wall -Werror" ;;
113 *) STRICT_CFLAGS="-W -Wall" ;;
114 esac
115
116 AC_SUBST(STRICT_CFLAGS)
117 AC_CONFIG_FILES([Makefile])
118 AC_OUTPUT