Bumped version to 0.2.1
[liboping.git] / configure.ac
1 AC_INIT(liboping, 0.2.1)
2 AC_CONFIG_SRCDIR(src/liboping.c)
3 AC_CONFIG_HEADERS(src/config.h)
4 AM_INIT_AUTOMAKE(dist-bzip2)
5 AC_LANG(C)
6
7 AC_PREFIX_DEFAULT("/opt/oping")
8
9 #
10 # Check for programs/utilities
11 #
12 AC_PROG_CC
13 AC_PROG_CPP
14 AC_PROG_INSTALL
15 AC_PROG_LN_S
16 AC_PROG_MAKE_SET
17 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
18
19 #
20 # configure libtool
21 #
22 AC_LIBLTDL_CONVENIENCE
23 AC_SUBST(LTDLINCL)
24 AC_SUBST(LIBLTDL)
25 AC_LIBTOOL_DLOPEN
26 AC_PROG_LIBTOOL
27 #AC_PROG_RANLIB
28 AC_CONFIG_SUBDIRS(libltdl src)
29
30 #
31 # Checks for header files.
32 #
33 AC_HEADER_STDC
34 AC_CHECK_HEADERS(unistd.h)
35 AC_CHECK_HEADERS(math.h)
36 AC_CHECK_HEADERS(fcntl.h)
37 AC_CHECK_HEADERS(sys/types.h)
38 AC_CHECK_HEADERS(sys/stat.h)
39 AC_HEADER_TIME
40 AC_CHECK_HEADERS(sys/socket.h)
41 AC_CHECK_HEADERS(netdb.h)
42 AC_CHECK_HEADERS(signal.h)
43
44 # This sucks, but what can I do..?
45 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
46 [#if HAVE_STDINT_H
47 # include <stdint.h>
48 #endif
49 #if HAVE_SYS_TYPES_H
50 # include <sys/types.h>
51 #endif
52 ])
53 AC_CHECK_HEADERS(netinet/in.h, [], [],
54 [#if HAVE_STDINT_H
55 # include <stdint.h>
56 #endif
57 #if HAVE_SYS_TYPES_H
58 # include <sys/types.h>
59 #endif
60 #if HAVE_NETINET_IN_SYSTM_H
61 # include <netinet/in_systm.h>
62 #endif
63 ])
64 AC_CHECK_HEADERS(netinet/ip.h, [], [],
65 [#if HAVE_STDINT_H
66 # include <stdint.h>
67 #endif
68 #if HAVE_SYS_TYPES_H
69 # include <sys/types.h>
70 #endif
71 #if HAVE_NETINET_IN_SYSTM_H
72 # include <netinet/in_systm.h>
73 #endif
74 #if HAVE_NETINET_IN_H
75 # include <netinet/in.h>
76 #endif
77 ])
78 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
79 [#if HAVE_STDINT_H
80 # include <stdint.h>
81 #endif
82 #if HAVE_SYS_TYPES_H
83 # include <sys/types.h>
84 #endif
85 #if HAVE_NETINET_IN_SYSTM_H
86 # include <netinet/in_systm.h>
87 #endif
88 #if HAVE_NETINET_IN_H
89 # include <netinet/in.h>
90 #endif
91 #if HAVE_NETINET_IP_H
92 # include <netinet/ip.h>
93 #endif
94 ])
95 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
96 [#if HAVE_STDINT_H
97 # include <stdint.h>
98 #endif
99 #if HAVE_SYS_TYPES_H
100 # include <sys/types.h>
101 #endif
102 #if HAVE_NETINET_IN_SYSTM_H
103 # include <netinet/in_systm.h>
104 #endif
105 #if HAVE_NETINET_IN_H
106 # include <netinet/in.h>
107 #endif
108 #if HAVE_NETINET_IP_H
109 # include <netinet/ip.h>
110 #endif
111 ])
112 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
113 [#if HAVE_STDINT_H
114 # include <stdint.h>
115 #endif
116 #if HAVE_SYS_TYPES_H
117 # include <sys/types.h>
118 #endif
119 #if HAVE_SYS_TYPES_H
120 # include <sys/types.h>
121 #endif
122 #if HAVE_NETINET_IN_SYSTM_H
123 # include <netinet/in_systm.h>
124 #endif
125 #if HAVE_NETINET_IN_H
126 # include <netinet/in.h>
127 #endif
128 ])
129 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
130 [#if HAVE_STDINT_H
131 # include <stdint.h>
132 #endif
133 #if HAVE_SYS_TYPES_H
134 # include <sys/types.h>
135 #endif
136 #if HAVE_NETINET_IN_SYSTM_H
137 # include <netinet/in_systm.h>
138 #endif
139 #if HAVE_NETINET_IN_H
140 # include <netinet/in.h>
141 #endif
142 #if HAVE_NETINET_IP6_H
143 # include <netinet/ip6.h>
144 #endif
145 ])
146
147 socket_needs_socket="no"
148 AC_CHECK_FUNCS(socket, [],
149         AC_CHECK_LIB(socket, socket,
150                 [socket_needs_socket="yes"],
151                 AC_MSG_ERROR(cannot find socket)))
152 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
153
154 nanosleep_needs_rt="no"
155 AC_CHECK_FUNCS(nanosleep, [],
156         AC_CHECK_LIB(rt, nanosleep,
157                 [nanosleep_needs_rt="yes"],
158                 AC_MSG_ERROR(cannot find nanosleep)))
159 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
160
161 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [Enable extensive debugging output.])],
162 [
163         if test "x$enable_debug" = "xyes"
164         then
165                 AC_DEFINE(WITH_DEBUG, 1, [Define to 1 if you want to get debugging output.])
166         fi
167 ], [])
168 AM_CONDITIONAL(BUILD_WITH_DEBUG, test "x$enable_debug" = "xyes")
169
170 AC_OUTPUT(Makefile src/Makefile src/mans/Makefile)