add bug email and project url to configure.ac AC_INIT
[liboping.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 AC_PREREQ([2.65])
4 AC_INIT([liboping],[1.6.2],[ff@octo.it],,[http://github.com/octo/liboping/])
5 AC_CONFIG_SRCDIR([src/liboping.c])
6 AC_CONFIG_HEADERS([src/config.h])
7 AC_CONFIG_MACRO_DIR([m4])
8 AM_INIT_AUTOMAKE([dist-bzip2])
9 AC_LANG([C])
10
11 AC_PREFIX_DEFAULT("/opt/oping")
12
13 # API version
14 LIBOPING_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
15 LIBOPING_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
16 LIBOPING_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
17 AC_SUBST(LIBOPING_MAJOR)
18 AC_SUBST(LIBOPING_MINOR)
19 AC_SUBST(LIBOPING_PATCH)
20
21 # ABI version
22 LIBOPING_CURRENT=2
23 LIBOPING_REVISION=9
24 LIBOPING_AGE=2
25 AC_SUBST(LIBOPING_CURRENT)
26 AC_SUBST(LIBOPING_REVISION)
27 AC_SUBST(LIBOPING_AGE)
28
29 #
30 # Check for programs/utilities
31 #
32 AC_PROG_CC
33 AC_PROG_CPP
34 AC_PROG_INSTALL
35 AC_PROG_LN_S
36 AC_PROG_MAKE_SET
37 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
38
39 if test "x$PERL" = "x"
40 then
41         PERL="perl"
42 fi
43 AC_ARG_VAR(PERL, [Perl interpreter command])
44
45 # configure libtool
46 LT_INIT([dlopen])
47
48 # Checks for header files.
49 AC_HEADER_STDC
50 AC_HEADER_TIME
51 AC_CHECK_HEADERS([math.h signal.h fcntl.h inttypes.h netdb.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
52
53 # This sucks, but what can I do..?
54 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
55 [#if HAVE_STDINT_H
56 # include <stdint.h>
57 #endif
58 #if HAVE_SYS_TYPES_H
59 # include <sys/types.h>
60 #endif
61 ])
62 AC_CHECK_HEADERS(netinet/in.h, [], [],
63 [#if HAVE_STDINT_H
64 # include <stdint.h>
65 #endif
66 #if HAVE_SYS_TYPES_H
67 # include <sys/types.h>
68 #endif
69 #if HAVE_NETINET_IN_SYSTM_H
70 # include <netinet/in_systm.h>
71 #endif
72 ])
73 AC_CHECK_HEADERS(netinet/ip.h, [], [],
74 [#if HAVE_STDINT_H
75 # include <stdint.h>
76 #endif
77 #if HAVE_SYS_TYPES_H
78 # include <sys/types.h>
79 #endif
80 #if HAVE_NETINET_IN_SYSTM_H
81 # include <netinet/in_systm.h>
82 #endif
83 #if HAVE_NETINET_IN_H
84 # include <netinet/in.h>
85 #endif
86 ])
87 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
88 [#if HAVE_STDINT_H
89 # include <stdint.h>
90 #endif
91 #if HAVE_SYS_TYPES_H
92 # include <sys/types.h>
93 #endif
94 #if HAVE_NETINET_IN_SYSTM_H
95 # include <netinet/in_systm.h>
96 #endif
97 #if HAVE_NETINET_IN_H
98 # include <netinet/in.h>
99 #endif
100 #if HAVE_NETINET_IP_H
101 # include <netinet/ip.h>
102 #endif
103 ])
104 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
105 [#if HAVE_STDINT_H
106 # include <stdint.h>
107 #endif
108 #if HAVE_SYS_TYPES_H
109 # include <sys/types.h>
110 #endif
111 #if HAVE_NETINET_IN_SYSTM_H
112 # include <netinet/in_systm.h>
113 #endif
114 #if HAVE_NETINET_IN_H
115 # include <netinet/in.h>
116 #endif
117 #if HAVE_NETINET_IP_H
118 # include <netinet/ip.h>
119 #endif
120 ])
121 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
122 [#if HAVE_STDINT_H
123 # include <stdint.h>
124 #endif
125 #if HAVE_SYS_TYPES_H
126 # include <sys/types.h>
127 #endif
128 #if HAVE_SYS_TYPES_H
129 # include <sys/types.h>
130 #endif
131 #if HAVE_NETINET_IN_SYSTM_H
132 # include <netinet/in_systm.h>
133 #endif
134 #if HAVE_NETINET_IN_H
135 # include <netinet/in.h>
136 #endif
137 ])
138 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
139 [#if HAVE_STDINT_H
140 # include <stdint.h>
141 #endif
142 #if HAVE_SYS_TYPES_H
143 # include <sys/types.h>
144 #endif
145 #if HAVE_NETINET_IN_SYSTM_H
146 # include <netinet/in_systm.h>
147 #endif
148 #if HAVE_NETINET_IN_H
149 # include <netinet/in.h>
150 #endif
151 #if HAVE_NETINET_IP6_H
152 # include <netinet/ip6.h>
153 #endif
154 ])
155
156 # Checks for typedefs, structures, and compiler characteristics.
157 AC_TYPE_SIZE_T
158 AC_TYPE_SSIZE_T
159 AC_TYPE_UID_T
160 AC_TYPE_UINT16_T
161 AC_TYPE_UINT32_T
162 AC_TYPE_UINT8_T
163
164 socket_needs_socket="no"
165 AC_CHECK_FUNCS(socket, [],
166         AC_CHECK_LIB(socket, socket,
167                 [socket_needs_socket="yes"],
168                 AC_MSG_ERROR(cannot find socket)))
169 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
170
171 # Under Solaris, the `xnet' library provides `recvmsg' which complies with the
172 # X/Open CAE Specification.
173 with_libxnet="no"
174 AC_CHECK_LIB(xnet, __xnet_recvmsg, [with_libxnet="yes"],[])
175 if test "x$with_libxnet" = "xyes"
176 then
177         CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
178 fi
179 AM_CONDITIONAL(BUILD_WITH_LIBXNET, test "x$with_libxnet" = "xyes")
180
181 nanosleep_needs_rt="no"
182 AC_CHECK_FUNCS(nanosleep, [],
183         AC_CHECK_LIB(rt, nanosleep,
184                 [nanosleep_needs_rt="yes"],
185                 AC_MSG_ERROR(cannot find nanosleep)))
186 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
187
188 with_ncurses="yes"
189 AC_CHECK_HEADERS(ncurses.h, [with_ncurses="yes"], [with_ncurses="no"])
190 if test "x$with_ncurses" = "xyes"
191 then
192         AC_CHECK_LIB(ncurses, mvwprintw, [with_ncurses="yes"], [with_ncurses="no"])
193 fi
194 AM_CONDITIONAL(BUILD_WITH_LIBNCURSES, test "x$with_ncurses" = "xyes")
195
196 AC_FUNC_STRERROR_R
197
198 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [Enable extensive debugging output.])],
199 [
200         if test "x$enable_debug" = "xyes"
201         then
202                 AC_DEFINE(WITH_DEBUG, 1, [Define to 1 if you want to get debugging output.])
203         fi
204 ], [])
205 AM_CONDITIONAL(BUILD_WITH_DEBUG, test "x$enable_debug" = "xyes")
206
207 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
208 [
209         if test "x$withval" != "xno" && test "x$withval" != "xyes"
210         then
211                 PERL_BINDINGS_OPTIONS="$withval"
212                 with_perl_bindings="yes"
213         else
214                 PERL_BINDINGS_OPTIONS=""
215                 with_perl_bindings="$withval"
216         fi
217 ],
218 [
219         PERL_BINDINGS_OPTIONS=""
220         with_perl_bindings="yes"
221 ])
222
223 if test "x$with_perl_bindings" = "xyes"
224 then
225         BINDINGS="perl-bindings"
226 else
227         BINDINGS=""
228 fi
229
230 AC_SUBST(PERL_BINDINGS_OPTIONS)
231
232 AC_SUBST(BINDINGS)
233
234 # Checks for library functions.
235 AC_FUNC_MALLOC
236 AC_FUNC_STRERROR_R
237 AC_CHECK_FUNCS([gettimeofday memset modf select socket sqrt strcasecmp strdup strerror strncasecmp strtoul])
238
239 AC_CONFIG_FILES([Makefile src/Makefile src/mans/Makefile bindings/Makefile])
240 AC_OUTPUT