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 AC_ARG_WITH(pkgconfigdir,
52 AC_HELP_STRING([--with-pkgconfigdir], [Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
53 [pkgconfigdir="${withval}"],
54 [pkgconfigdir='${libdir}/pkgconfig'])
55 AC_SUBST([pkgconfigdir])
57 # Checks for header files.
60 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])
62 # This sucks, but what can I do..?
63 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
68 # include <sys/types.h>
71 AC_CHECK_HEADERS(netinet/in.h, [], [],
76 # include <sys/types.h>
78 #if HAVE_NETINET_IN_SYSTM_H
79 # include <netinet/in_systm.h>
82 AC_CHECK_HEADERS(netinet/ip.h, [], [],
87 # include <sys/types.h>
89 #if HAVE_NETINET_IN_SYSTM_H
90 # include <netinet/in_systm.h>
93 # include <netinet/in.h>
96 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
101 # include <sys/types.h>
103 #if HAVE_NETINET_IN_SYSTM_H
104 # include <netinet/in_systm.h>
106 #if HAVE_NETINET_IN_H
107 # include <netinet/in.h>
109 #if HAVE_NETINET_IP_H
110 # include <netinet/ip.h>
113 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
118 # include <sys/types.h>
120 #if HAVE_NETINET_IN_SYSTM_H
121 # include <netinet/in_systm.h>
123 #if HAVE_NETINET_IN_H
124 # include <netinet/in.h>
126 #if HAVE_NETINET_IP_H
127 # include <netinet/ip.h>
130 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
135 # include <sys/types.h>
138 # include <sys/types.h>
140 #if HAVE_NETINET_IN_SYSTM_H
141 # include <netinet/in_systm.h>
143 #if HAVE_NETINET_IN_H
144 # include <netinet/in.h>
147 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
152 # include <sys/types.h>
154 #if HAVE_NETINET_IN_SYSTM_H
155 # include <netinet/in_systm.h>
157 #if HAVE_NETINET_IN_H
158 # include <netinet/in.h>
160 #if HAVE_NETINET_IP6_H
161 # include <netinet/ip6.h>
165 # Checks for typedefs, structures, and compiler characteristics.
173 LIBOPING_PC_LIBS_PRIVATE=''
175 socket_needs_socket="no"
176 AC_CHECK_FUNCS(socket, [],
177 AC_CHECK_LIB(socket, socket,
178 [socket_needs_socket="yes"],
179 AC_MSG_ERROR(cannot find socket)))
180 if test "x$socket_needs_socket" = "xyes"; then
181 LIBOPING_PC_LIBS_PRIVATE="${LIBOPING_PC_LIBS_PRIVATE} -lsocket"
184 # Under Solaris, the `xnet' library provides `recvmsg' which complies with the
185 # X/Open CAE Specification.
187 AC_CHECK_LIB(xnet, __xnet_recvmsg, [with_libxnet="yes"],[])
188 if test "x$with_libxnet" = "xyes"
190 CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
192 if test "x$with_libxnet" = "xyes"; then
193 LIBOPING_PC_LIBS_PRIVATE="${LIBOPING_PC_LIBS_PRIVATE} -lxnet"
196 AC_SUBST(LIBOPING_PC_LIBS_PRIVATE)
198 nanosleep_needs_rt="no"
199 AC_CHECK_FUNCS(nanosleep, [],
200 AC_CHECK_LIB(rt, nanosleep,
201 [nanosleep_needs_rt="yes"],
202 AC_MSG_ERROR(cannot find nanosleep)))
203 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
206 AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses.h, [with_ncurses="yes"], [])
207 if test "x$with_ncurses" = "xyes"
213 AC_CHECK_LIB(ncursesw, mvwprintw, [have_ncursesw="yes"], [have_ncursesw="no"])
214 AC_CHECK_LIB(ncurses, mvwprintw, [have_ncurses="yes"], [have_ncurses="no"])
216 if test "x$have_ncursesw" = "xyes"; then
217 NCURSES_LIB="-lncursesw"
218 else if test "x$have_ncurses" = "xyes"; then
219 NCURSES_LIB="-lncurses"
223 AC_SUBST(NCURSES_LIB)
225 AM_CONDITIONAL(BUILD_WITH_LIBNCURSES, test "x$with_ncurses" = "xyes")
229 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [Enable extensive debugging output.])],
231 if test "x$enable_debug" = "xyes"
233 AC_DEFINE(WITH_DEBUG, 1, [Define to 1 if you want to get debugging output.])
236 AM_CONDITIONAL(BUILD_WITH_DEBUG, test "x$enable_debug" = "xyes")
238 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
240 if test "x$withval" != "xno" && test "x$withval" != "xyes"
242 PERL_BINDINGS_OPTIONS="$withval"
243 with_perl_bindings="yes"
245 PERL_BINDINGS_OPTIONS=""
246 with_perl_bindings="$withval"
250 PERL_BINDINGS_OPTIONS=""
251 with_perl_bindings="yes"
254 if test "x$with_perl_bindings" = "xyes"
256 BINDINGS="perl-bindings"
261 AC_SUBST(PERL_BINDINGS_OPTIONS)
265 # Checks for library functions.
268 AC_CHECK_FUNCS([gettimeofday memset modf select socket sqrt strcasecmp strdup strerror strncasecmp strtoul])
270 AC_CONFIG_FILES([Makefile src/Makefile src/liboping.pc src/mans/Makefile bindings/Makefile])