1 # Process this file with autoconf to produce a configure script.
6 [liboping@verplant.org],
9 AC_CONFIG_SRCDIR([src/liboping.c])
10 AC_CONFIG_HEADERS([src/config.h])
11 AC_CONFIG_MACRO_DIR([m4])
12 AM_INIT_AUTOMAKE([dist-bzip2])
15 AC_PREFIX_DEFAULT("/opt/oping")
18 LIBOPING_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
19 LIBOPING_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
20 LIBOPING_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
21 AC_SUBST(LIBOPING_MAJOR)
22 AC_SUBST(LIBOPING_MINOR)
23 AC_SUBST(LIBOPING_PATCH)
29 AC_SUBST(LIBOPING_CURRENT)
30 AC_SUBST(LIBOPING_REVISION)
31 AC_SUBST(LIBOPING_AGE)
34 # Check for programs/utilities
41 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
43 if test "x$PERL" = "x"
47 AC_ARG_VAR(PERL, [Perl interpreter command])
52 # pkg-config interface
53 # PKG_INSTALLDIR is only available for pkg-config >= 0.27
54 m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [])
56 AC_ARG_WITH(pkgconfigdir,
57 AC_HELP_STRING([--with-pkgconfigdir], [Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
58 [pkgconfigdir="${withval}"],
59 [pkgconfigdir='${libdir}/pkgconfig'])
60 AC_SUBST([pkgconfigdir])
62 # Checks for header files.
65 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])
67 # This sucks, but what can I do..?
68 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
73 # include <sys/types.h>
76 AC_CHECK_HEADERS(netinet/in.h, [], [],
81 # include <sys/types.h>
83 #if HAVE_NETINET_IN_SYSTM_H
84 # include <netinet/in_systm.h>
87 AC_CHECK_HEADERS(netinet/ip.h, [], [],
92 # include <sys/types.h>
94 #if HAVE_NETINET_IN_SYSTM_H
95 # include <netinet/in_systm.h>
98 # include <netinet/in.h>
101 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
106 # include <sys/types.h>
108 #if HAVE_NETINET_IN_SYSTM_H
109 # include <netinet/in_systm.h>
111 #if HAVE_NETINET_IN_H
112 # include <netinet/in.h>
114 #if HAVE_NETINET_IP_H
115 # include <netinet/ip.h>
118 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
123 # include <sys/types.h>
125 #if HAVE_NETINET_IN_SYSTM_H
126 # include <netinet/in_systm.h>
128 #if HAVE_NETINET_IN_H
129 # include <netinet/in.h>
131 #if HAVE_NETINET_IP_H
132 # include <netinet/ip.h>
135 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
140 # include <sys/types.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>
152 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
157 # include <sys/types.h>
159 #if HAVE_NETINET_IN_SYSTM_H
160 # include <netinet/in_systm.h>
162 #if HAVE_NETINET_IN_H
163 # include <netinet/in.h>
165 #if HAVE_NETINET_IP6_H
166 # include <netinet/ip6.h>
170 # Checks for typedefs, structures, and compiler characteristics.
178 LIBOPING_PC_LIBS_PRIVATE=''
180 socket_needs_socket="no"
181 AC_CHECK_FUNCS(socket, [],
182 AC_CHECK_LIB(socket, socket,
183 [socket_needs_socket="yes"],
184 AC_MSG_ERROR(cannot find socket)))
185 if test "x$socket_needs_socket" = "xyes"; then
186 LIBOPING_PC_LIBS_PRIVATE="${LIBOPING_PC_LIBS_PRIVATE} -lsocket"
189 # Under Solaris, the `xnet' library provides `recvmsg' which complies with the
190 # X/Open CAE Specification.
192 AC_CHECK_LIB(xnet, __xnet_recvmsg, [with_libxnet="yes"],[])
193 if test "x$with_libxnet" = "xyes"
195 CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
197 if test "x$with_libxnet" = "xyes"; then
198 LIBOPING_PC_LIBS_PRIVATE="${LIBOPING_PC_LIBS_PRIVATE} -lxnet"
201 AC_SUBST(LIBOPING_PC_LIBS_PRIVATE)
203 AC_SEARCH_LIBS([nanosleep],[rt],[],
204 [AC_MSG_ERROR([cannot find nanosleep])])
206 AC_ARG_WITH(ncurses, AS_HELP_STRING([--with-ncurses], [Build oping CLI tool with ncurses support]))
207 AS_IF([test "x$with_ncurses" != "xno"], [
208 can_build_with_ncurses="no"
209 PKG_CHECK_MODULES([NCURSES], [ncursesw], [can_build_with_ncurses=yes], [
210 PKG_CHECK_MODULES([NCURSES], [ncurses], [can_build_with_ncurses=yes], [
211 AC_CHECK_LIB(ncursesw, mvwprintw, [NCURSES_LIBS="-lncursesw"; can_build_with_ncurses=yes], [
212 AC_CHECK_LIB(ncurses, mvwprintw, [NCURSES_LIBS="-lncurses"; can_build_with_ncurses=yes])
217 AS_IF([test "x$can_build_with_ncurses" = "xyes"], [
218 AC_CHECK_HEADERS([ncursesw/curses.h ncursesw.h ncurses/curses.h ncurses.h], [can_build_with_ncurses=yes; break;], [can_build_with_ncurses=no])
221 AS_IF([test "x$can_build_with_ncurses" = "xno" && test "x$with_ncurses" = "xyes"], [
222 AC_MSG_ERROR([ncurses not found but explicit enabled])
224 [test "x$can_build_with_ncurses" = "xno"], [
225 AC_MSG_WARN([Will not build oping with ncurses support -- no suiteable ncurses installation found])
229 AM_CONDITIONAL(BUILD_WITH_LIBNCURSES, test "x$with_ncurses" != "xno" && test "x$can_build_with_ncurses" = "xyes")
233 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [Enable extensive debugging output.])],
235 if test "x$enable_debug" = "xyes"
237 AC_DEFINE(WITH_DEBUG, 1, [Define to 1 if you want to get debugging output.])
240 AM_CONDITIONAL(BUILD_WITH_DEBUG, test "x$enable_debug" = "xyes")
242 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
244 if test "x$withval" != "xno" && test "x$withval" != "xyes"
246 PERL_BINDINGS_OPTIONS="$withval"
247 with_perl_bindings="yes"
249 PERL_BINDINGS_OPTIONS=""
250 with_perl_bindings="$withval"
254 PERL_BINDINGS_OPTIONS=""
255 with_perl_bindings="yes"
258 if test "x$with_perl_bindings" = "xyes"
260 BINDINGS="perl-bindings"
265 AC_SUBST(PERL_BINDINGS_OPTIONS)
269 # Checks for library functions.
272 AC_CHECK_FUNCS([gettimeofday memset modf select socket sqrt strcasecmp strdup strerror strncasecmp strtoul])
274 AC_CONFIG_FILES([Makefile src/Makefile src/liboping.pc src/mans/Makefile bindings/Makefile])