1 # Process this file with autoconf to produce a configure script.
4 AC_INIT([liboping],[1.7.0],[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])
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 # pkg-config interface
51 # Checks for header files.
54 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 locale.h langinfo.h])
56 # This sucks, but what can I do..?
57 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
62 # include <sys/types.h>
65 AC_CHECK_HEADERS(netinet/in.h, [], [],
70 # include <sys/types.h>
72 #if HAVE_NETINET_IN_SYSTM_H
73 # include <netinet/in_systm.h>
76 AC_CHECK_HEADERS(netinet/ip.h, [], [],
81 # include <sys/types.h>
83 #if HAVE_NETINET_IN_SYSTM_H
84 # include <netinet/in_systm.h>
87 # include <netinet/in.h>
90 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
95 # include <sys/types.h>
97 #if HAVE_NETINET_IN_SYSTM_H
98 # include <netinet/in_systm.h>
100 #if HAVE_NETINET_IN_H
101 # include <netinet/in.h>
103 #if HAVE_NETINET_IP_H
104 # include <netinet/ip.h>
107 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
112 # include <sys/types.h>
114 #if HAVE_NETINET_IN_SYSTM_H
115 # include <netinet/in_systm.h>
117 #if HAVE_NETINET_IN_H
118 # include <netinet/in.h>
120 #if HAVE_NETINET_IP_H
121 # include <netinet/ip.h>
124 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
129 # include <sys/types.h>
132 # include <sys/types.h>
134 #if HAVE_NETINET_IN_SYSTM_H
135 # include <netinet/in_systm.h>
137 #if HAVE_NETINET_IN_H
138 # include <netinet/in.h>
141 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
146 # include <sys/types.h>
148 #if HAVE_NETINET_IN_SYSTM_H
149 # include <netinet/in_systm.h>
151 #if HAVE_NETINET_IN_H
152 # include <netinet/in.h>
154 #if HAVE_NETINET_IP6_H
155 # include <netinet/ip6.h>
159 # Checks for typedefs, structures, and compiler characteristics.
167 socket_needs_socket="no"
168 AC_CHECK_FUNCS(socket, [],
169 AC_CHECK_LIB(socket, socket,
170 [socket_needs_socket="yes"],
171 AC_MSG_ERROR(cannot find socket)))
172 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
174 # Under Solaris, the `xnet' library provides `recvmsg' which complies with the
175 # X/Open CAE Specification.
177 AC_CHECK_LIB(xnet, __xnet_recvmsg, [with_libxnet="yes"],[])
178 if test "x$with_libxnet" = "xyes"
180 CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
182 AM_CONDITIONAL(BUILD_WITH_LIBXNET, test "x$with_libxnet" = "xyes")
184 nanosleep_needs_rt="no"
185 AC_CHECK_FUNCS(nanosleep, [],
186 AC_CHECK_LIB(rt, nanosleep,
187 [nanosleep_needs_rt="yes"],
188 AC_MSG_ERROR(cannot find nanosleep)))
189 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
192 AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses.h, [with_ncurses="yes"], [])
193 if test "x$with_ncurses" = "xyes"
199 AC_CHECK_LIB(ncursesw, mvwprintw, [have_ncursesw="yes"], [have_ncursesw="no"])
200 AC_CHECK_LIB(ncurses, mvwprintw, [have_ncurses="yes"], [have_ncurses="no"])
202 if test "x$have_ncursesw" = "xyes"; then
203 NCURSES_LIB="-lncursesw"
204 else if test "x$have_ncurses" = "xyes"; then
205 NCURSES_LIB="-lncurses"
209 AC_SUBST(NCURSES_LIB)
211 AM_CONDITIONAL(BUILD_WITH_LIBNCURSES, test "x$with_ncurses" = "xyes")
215 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [Enable extensive debugging output.])],
217 if test "x$enable_debug" = "xyes"
219 AC_DEFINE(WITH_DEBUG, 1, [Define to 1 if you want to get debugging output.])
222 AM_CONDITIONAL(BUILD_WITH_DEBUG, test "x$enable_debug" = "xyes")
224 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
226 if test "x$withval" != "xno" && test "x$withval" != "xyes"
228 PERL_BINDINGS_OPTIONS="$withval"
229 with_perl_bindings="yes"
231 PERL_BINDINGS_OPTIONS=""
232 with_perl_bindings="$withval"
236 PERL_BINDINGS_OPTIONS=""
237 with_perl_bindings="yes"
240 if test "x$with_perl_bindings" = "xyes"
242 BINDINGS="perl-bindings"
247 AC_SUBST(PERL_BINDINGS_OPTIONS)
251 # Checks for library functions.
254 AC_CHECK_FUNCS([gettimeofday memset modf select socket sqrt strcasecmp strdup strerror strncasecmp strtoul])
256 AC_CONFIG_FILES([Makefile src/Makefile src/mans/Makefile bindings/Makefile])