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