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])])
204 AC_SEARCH_LIBS([clock_gettime],[rt],[],
205 [AC_MSG_ERROR([cannot find clock_gettime])])
208 AC_CHECK_HEADERS(ncursesw/ncurses.h ncurses.h, [with_ncurses="yes"], [])
209 if test "x$with_ncurses" = "xyes"
215 AC_CHECK_LIB(ncursesw, mvwprintw, [have_ncursesw="yes"], [have_ncursesw="no"])
216 AC_CHECK_LIB(ncurses, mvwprintw, [have_ncurses="yes"], [have_ncurses="no"])
218 if test "x$have_ncursesw" = "xyes"; then
219 NCURSES_LIB="-lncursesw"
220 else if test "x$have_ncurses" = "xyes"; then
221 NCURSES_LIB="-lncurses"
225 AC_SUBST(NCURSES_LIB)
227 AM_CONDITIONAL(BUILD_WITH_LIBNCURSES, test "x$with_ncurses" = "xyes")
231 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [Enable extensive debugging output.])],
233 if test "x$enable_debug" = "xyes"
235 AC_DEFINE(WITH_DEBUG, 1, [Define to 1 if you want to get debugging output.])
238 AM_CONDITIONAL(BUILD_WITH_DEBUG, test "x$enable_debug" = "xyes")
240 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
242 if test "x$withval" != "xno" && test "x$withval" != "xyes"
244 PERL_BINDINGS_OPTIONS="$withval"
245 with_perl_bindings="yes"
247 PERL_BINDINGS_OPTIONS=""
248 with_perl_bindings="$withval"
252 PERL_BINDINGS_OPTIONS=""
253 with_perl_bindings="yes"
256 if test "x$with_perl_bindings" = "xyes"
258 BINDINGS="perl-bindings"
263 AC_SUBST(PERL_BINDINGS_OPTIONS)
267 # Checks for library functions.
270 AC_CHECK_FUNCS([gettimeofday memset modf select socket sqrt strcasecmp strdup strerror strncasecmp strtoul])
272 AC_CONFIG_FILES([Makefile src/Makefile src/liboping.pc src/mans/Makefile bindings/Makefile])