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
55 AC_ARG_WITH(pkgconfigdir,
56 AC_HELP_STRING([--with-pkgconfigdir], [Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
57 [pkgconfigdir="${withval}"],
58 [pkgconfigdir='${libdir}/pkgconfig'])
59 AC_SUBST([pkgconfigdir])
61 # Checks for header files.
64 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])
66 # This sucks, but what can I do..?
67 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
72 # include <sys/types.h>
75 AC_CHECK_HEADERS(netinet/in.h, [], [],
80 # include <sys/types.h>
82 #if HAVE_NETINET_IN_SYSTM_H
83 # include <netinet/in_systm.h>
86 AC_CHECK_HEADERS(netinet/ip.h, [], [],
91 # include <sys/types.h>
93 #if HAVE_NETINET_IN_SYSTM_H
94 # include <netinet/in_systm.h>
97 # include <netinet/in.h>
100 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
105 # include <sys/types.h>
107 #if HAVE_NETINET_IN_SYSTM_H
108 # include <netinet/in_systm.h>
110 #if HAVE_NETINET_IN_H
111 # include <netinet/in.h>
113 #if HAVE_NETINET_IP_H
114 # include <netinet/ip.h>
117 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
122 # include <sys/types.h>
124 #if HAVE_NETINET_IN_SYSTM_H
125 # include <netinet/in_systm.h>
127 #if HAVE_NETINET_IN_H
128 # include <netinet/in.h>
130 #if HAVE_NETINET_IP_H
131 # include <netinet/ip.h>
134 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
139 # include <sys/types.h>
142 # include <sys/types.h>
144 #if HAVE_NETINET_IN_SYSTM_H
145 # include <netinet/in_systm.h>
147 #if HAVE_NETINET_IN_H
148 # include <netinet/in.h>
151 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
156 # include <sys/types.h>
158 #if HAVE_NETINET_IN_SYSTM_H
159 # include <netinet/in_systm.h>
161 #if HAVE_NETINET_IN_H
162 # include <netinet/in.h>
164 #if HAVE_NETINET_IP6_H
165 # include <netinet/ip6.h>
169 # Checks for typedefs, structures, and compiler characteristics.
177 LIBOPING_PC_LIBS_PRIVATE=''
179 socket_needs_socket="no"
180 AC_CHECK_FUNCS(socket, [],
181 AC_CHECK_LIB(socket, socket,
182 [socket_needs_socket="yes"],
183 AC_MSG_ERROR(cannot find socket)))
184 if test "x$socket_needs_socket" = "xyes"; then
185 LIBOPING_PC_LIBS_PRIVATE="${LIBOPING_PC_LIBS_PRIVATE} -lsocket"
188 # Under Solaris, the `xnet' library provides `recvmsg' which complies with the
189 # X/Open CAE Specification.
191 AC_CHECK_LIB(xnet, __xnet_recvmsg, [with_libxnet="yes"],[])
192 if test "x$with_libxnet" = "xyes"
194 CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
196 if test "x$with_libxnet" = "xyes"; then
197 LIBOPING_PC_LIBS_PRIVATE="${LIBOPING_PC_LIBS_PRIVATE} -lxnet"
200 AC_SUBST(LIBOPING_PC_LIBS_PRIVATE)
202 AC_SEARCH_LIBS([nanosleep],[rt],[],
203 [AC_MSG_ERROR([cannot find nanosleep])])
205 AC_ARG_WITH(ncurses, AS_HELP_STRING([--with-ncurses], [Build oping CLI tool with ncurses support]))
206 AS_IF([test "x$with_ncurses" != "xno"], [
207 can_build_with_ncurses="no"
208 PKG_CHECK_MODULES([NCURSES], [ncursesw], [can_build_with_ncurses=yes], [
209 PKG_CHECK_MODULES([NCURSES], [ncurses], [can_build_with_ncurses=yes], [
210 AC_CHECK_LIB(ncursesw, mvwprintw, [NCURSES_LIBS="-lncursesw"; can_build_with_ncurses=yes], [
211 AC_CHECK_LIB(ncurses, mvwprintw, [NCURSES_LIBS="-lncurses"; can_build_with_ncurses=yes])
216 AS_IF([test "x$can_build_with_ncurses" = "xyes"], [
217 AC_CHECK_HEADERS([ncursesw/curses.h ncursesw.h ncurses/curses.h ncurses.h], [can_build_with_ncurses=yes; break;], [can_build_with_ncurses=no])
220 AS_IF([test "x$can_build_with_ncurses" = "xno" && test "x$with_ncurses" = "xyes"], [
221 AC_MSG_ERROR([ncurses not found but explicit enabled])
223 [test "x$can_build_with_ncurses" = "xno"], [
224 AC_MSG_WARN([Will not build oping with ncurses support -- no suiteable ncurses installation found])
228 AM_CONDITIONAL(BUILD_WITH_LIBNCURSES, test "x$with_ncurses" != "xno" && test "x$can_build_with_ncurses" = "xyes")
232 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [Enable extensive debugging output.])],
234 if test "x$enable_debug" = "xyes"
236 AC_DEFINE(WITH_DEBUG, 1, [Define to 1 if you want to get debugging output.])
239 AM_CONDITIONAL(BUILD_WITH_DEBUG, test "x$enable_debug" = "xyes")
241 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
243 if test "x$withval" != "xno" && test "x$withval" != "xyes"
245 PERL_BINDINGS_OPTIONS="$withval"
246 with_perl_bindings="yes"
248 PERL_BINDINGS_OPTIONS=""
249 with_perl_bindings="$withval"
253 PERL_BINDINGS_OPTIONS=""
254 with_perl_bindings="yes"
257 if test "x$with_perl_bindings" = "xyes"
259 BINDINGS="perl-bindings"
264 AC_SUBST(PERL_BINDINGS_OPTIONS)
268 # Checks for library functions.
271 AC_CHECK_FUNCS([gettimeofday memset modf select socket sqrt strcasecmp strdup strerror strncasecmp strtoul])
273 AC_CONFIG_FILES([Makefile src/Makefile src/liboping.pc src/mans/Makefile bindings/Makefile])