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