Bumped version to 0.3.4; Updated ChangeLog and debian/changelog
[liboping.git] / configure.ac
1 AC_INIT(liboping, 0.3.4)
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_LIBTOOL_DLOPEN
23 AC_PROG_LIBTOOL
24 #AC_PROG_RANLIB
25
26 #
27 # Checks for header files.
28 #
29 AC_HEADER_STDC
30 AC_CHECK_HEADERS(unistd.h)
31 AC_CHECK_HEADERS(math.h)
32 AC_CHECK_HEADERS(fcntl.h)
33 AC_CHECK_HEADERS(sys/types.h)
34 AC_CHECK_HEADERS(sys/stat.h)
35 AC_HEADER_TIME
36 AC_CHECK_HEADERS(sys/socket.h)
37 AC_CHECK_HEADERS(netdb.h)
38 AC_CHECK_HEADERS(signal.h)
39
40 # This sucks, but what can I do..?
41 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
42 [#if HAVE_STDINT_H
43 # include <stdint.h>
44 #endif
45 #if HAVE_SYS_TYPES_H
46 # include <sys/types.h>
47 #endif
48 ])
49 AC_CHECK_HEADERS(netinet/in.h, [], [],
50 [#if HAVE_STDINT_H
51 # include <stdint.h>
52 #endif
53 #if HAVE_SYS_TYPES_H
54 # include <sys/types.h>
55 #endif
56 #if HAVE_NETINET_IN_SYSTM_H
57 # include <netinet/in_systm.h>
58 #endif
59 ])
60 AC_CHECK_HEADERS(netinet/ip.h, [], [],
61 [#if HAVE_STDINT_H
62 # include <stdint.h>
63 #endif
64 #if HAVE_SYS_TYPES_H
65 # include <sys/types.h>
66 #endif
67 #if HAVE_NETINET_IN_SYSTM_H
68 # include <netinet/in_systm.h>
69 #endif
70 #if HAVE_NETINET_IN_H
71 # include <netinet/in.h>
72 #endif
73 ])
74 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
75 [#if HAVE_STDINT_H
76 # include <stdint.h>
77 #endif
78 #if HAVE_SYS_TYPES_H
79 # include <sys/types.h>
80 #endif
81 #if HAVE_NETINET_IN_SYSTM_H
82 # include <netinet/in_systm.h>
83 #endif
84 #if HAVE_NETINET_IN_H
85 # include <netinet/in.h>
86 #endif
87 #if HAVE_NETINET_IP_H
88 # include <netinet/ip.h>
89 #endif
90 ])
91 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
92 [#if HAVE_STDINT_H
93 # include <stdint.h>
94 #endif
95 #if HAVE_SYS_TYPES_H
96 # include <sys/types.h>
97 #endif
98 #if HAVE_NETINET_IN_SYSTM_H
99 # include <netinet/in_systm.h>
100 #endif
101 #if HAVE_NETINET_IN_H
102 # include <netinet/in.h>
103 #endif
104 #if HAVE_NETINET_IP_H
105 # include <netinet/ip.h>
106 #endif
107 ])
108 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
109 [#if HAVE_STDINT_H
110 # include <stdint.h>
111 #endif
112 #if HAVE_SYS_TYPES_H
113 # include <sys/types.h>
114 #endif
115 #if HAVE_SYS_TYPES_H
116 # include <sys/types.h>
117 #endif
118 #if HAVE_NETINET_IN_SYSTM_H
119 # include <netinet/in_systm.h>
120 #endif
121 #if HAVE_NETINET_IN_H
122 # include <netinet/in.h>
123 #endif
124 ])
125 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
126 [#if HAVE_STDINT_H
127 # include <stdint.h>
128 #endif
129 #if HAVE_SYS_TYPES_H
130 # include <sys/types.h>
131 #endif
132 #if HAVE_NETINET_IN_SYSTM_H
133 # include <netinet/in_systm.h>
134 #endif
135 #if HAVE_NETINET_IN_H
136 # include <netinet/in.h>
137 #endif
138 #if HAVE_NETINET_IP6_H
139 # include <netinet/ip6.h>
140 #endif
141 ])
142
143 socket_needs_socket="no"
144 AC_CHECK_FUNCS(socket, [],
145         AC_CHECK_LIB(socket, socket,
146                 [socket_needs_socket="yes"],
147                 AC_MSG_ERROR(cannot find socket)))
148 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
149
150 nanosleep_needs_rt="no"
151 AC_CHECK_FUNCS(nanosleep, [],
152         AC_CHECK_LIB(rt, nanosleep,
153                 [nanosleep_needs_rt="yes"],
154                 AC_MSG_ERROR(cannot find nanosleep)))
155 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
156
157 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [Enable extensive debugging output.])],
158 [
159         if test "x$enable_debug" = "xyes"
160         then
161                 AC_DEFINE(WITH_DEBUG, 1, [Define to 1 if you want to get debugging output.])
162         fi
163 ], [])
164 AM_CONDITIONAL(BUILD_WITH_DEBUG, test "x$enable_debug" = "xyes")
165
166 AC_OUTPUT(Makefile src/Makefile src/mans/Makefile)