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