1 # Process this file with autoconf to produce a configure script.
4 AC_INIT([liboping],[1.6.1])
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])
11 AC_PREFIX_DEFAULT("/opt/oping")
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)
25 AC_SUBST(LIBOPING_CURRENT)
26 AC_SUBST(LIBOPING_REVISION)
27 AC_SUBST(LIBOPING_AGE)
30 # Check for programs/utilities
37 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
39 if test "x$PERL" = "x"
43 AC_ARG_VAR(PERL, [Perl interpreter command])
48 # Checks for header files.
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])
53 # This sucks, but what can I do..?
54 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
59 # include <sys/types.h>
62 AC_CHECK_HEADERS(netinet/in.h, [], [],
67 # include <sys/types.h>
69 #if HAVE_NETINET_IN_SYSTM_H
70 # include <netinet/in_systm.h>
73 AC_CHECK_HEADERS(netinet/ip.h, [], [],
78 # include <sys/types.h>
80 #if HAVE_NETINET_IN_SYSTM_H
81 # include <netinet/in_systm.h>
84 # include <netinet/in.h>
87 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
92 # include <sys/types.h>
94 #if HAVE_NETINET_IN_SYSTM_H
95 # include <netinet/in_systm.h>
98 # include <netinet/in.h>
100 #if HAVE_NETINET_IP_H
101 # include <netinet/ip.h>
104 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
109 # include <sys/types.h>
111 #if HAVE_NETINET_IN_SYSTM_H
112 # include <netinet/in_systm.h>
114 #if HAVE_NETINET_IN_H
115 # include <netinet/in.h>
117 #if HAVE_NETINET_IP_H
118 # include <netinet/ip.h>
121 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
126 # include <sys/types.h>
129 # include <sys/types.h>
131 #if HAVE_NETINET_IN_SYSTM_H
132 # include <netinet/in_systm.h>
134 #if HAVE_NETINET_IN_H
135 # include <netinet/in.h>
138 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
143 # include <sys/types.h>
145 #if HAVE_NETINET_IN_SYSTM_H
146 # include <netinet/in_systm.h>
148 #if HAVE_NETINET_IN_H
149 # include <netinet/in.h>
151 #if HAVE_NETINET_IP6_H
152 # include <netinet/ip6.h>
156 # Checks for typedefs, structures, and compiler characteristics.
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")
171 # Under Solaris, the `xnet' library provides `recvmsg' which complies with the
172 # X/Open CAE Specification.
174 AC_CHECK_LIB(xnet, __xnet_recvmsg, [with_libxnet="yes"],[])
175 if test "x$with_libxnet" = "xyes"
177 CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
179 AM_CONDITIONAL(BUILD_WITH_LIBXNET, test "x$with_libxnet" = "xyes")
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")
189 AC_CHECK_HEADERS(ncurses.h, [with_ncurses="yes"], [with_ncurses="no"])
190 if test "x$with_ncurses" = "xyes"
192 AC_CHECK_LIB(ncurses, mvwprintw, [with_ncurses="yes"], [with_ncurses="no"])
194 AM_CONDITIONAL(BUILD_WITH_LIBNCURSES, test "x$with_ncurses" = "xyes")
198 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [Enable extensive debugging output.])],
200 if test "x$enable_debug" = "xyes"
202 AC_DEFINE(WITH_DEBUG, 1, [Define to 1 if you want to get debugging output.])
205 AM_CONDITIONAL(BUILD_WITH_DEBUG, test "x$enable_debug" = "xyes")
207 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
209 if test "x$withval" != "xno" && test "x$withval" != "xyes"
211 PERL_BINDINGS_OPTIONS="$withval"
212 with_perl_bindings="yes"
214 PERL_BINDINGS_OPTIONS=""
215 with_perl_bindings="$withval"
219 PERL_BINDINGS_OPTIONS=""
220 with_perl_bindings="yes"
223 if test "x$with_perl_bindings" = "xyes"
225 BINDINGS="perl-bindings"
230 AC_SUBST(PERL_BINDINGS_OPTIONS)
234 # Checks for library functions.
237 AC_CHECK_FUNCS([gettimeofday memset modf select socket sqrt strcasecmp strdup strerror strncasecmp strtoul])
239 AC_CONFIG_FILES([Makefile src/Makefile src/mans/Makefile bindings/Makefile])