]>
Commit | Line | Data |
---|---|---|
86ca149a | 1 | dnl Process this file with autoconf to produce a configure script. |
1b739da9 | 2 | AC_INIT(collectd, m4_esyscmd(./version-gen.sh)) |
6e765a02 FF |
3 | AC_CONFIG_SRCDIR(src/collectd.c) |
4 | AC_CONFIG_HEADERS(src/config.h) | |
5 | AM_INIT_AUTOMAKE(dist-bzip2) | |
86ca149a FF |
6 | AC_LANG(C) |
7 | ||
8 | AC_PREFIX_DEFAULT("/opt/collectd") | |
9 | ||
9e7918de SH |
10 | AC_SYS_LARGEFILE |
11 | ||
15996f86 FF |
12 | # |
13 | # Checks for programs. | |
14 | # | |
86ca149a FF |
15 | AC_PROG_CC |
16 | AC_PROG_CPP | |
17 | AC_PROG_INSTALL | |
18 | AC_PROG_LN_S | |
19 | AC_PROG_MAKE_SET | |
30f3e7b8 | 20 | AM_PROG_CC_C_O |
586eed68 | 21 | AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes") |
86ca149a FF |
22 | |
23 | dnl configure libtool | |
24 | AC_DISABLE_STATIC | |
6e765a02 FF |
25 | AC_LIBLTDL_CONVENIENCE |
26 | AC_SUBST(LTDLINCL) | |
27 | AC_SUBST(LIBLTDL) | |
86ca149a FF |
28 | AC_LIBTOOL_DLOPEN |
29 | AC_PROG_LIBTOOL | |
108c20b2 FF |
30 | AC_PROG_LEX |
31 | AC_PROG_YACC | |
249d5776 | 32 | PKG_PROG_PKG_CONFIG |
bcd78ed9 | 33 | AC_CONFIG_SUBDIRS(libltdl) |
86ca149a | 34 | |
af18c7e0 FF |
35 | AC_MSG_CHECKING([for kernel type ($host_os)]) |
36 | case $host_os in | |
37 | *linux*) | |
38 | AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel]) | |
39 | ac_system="Linux" | |
40 | ;; | |
41 | *solaris*) | |
42 | AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel]) | |
43 | ac_system="Solaris" | |
44 | ;; | |
29f72849 FF |
45 | *darwin*) |
46 | ac_system="Darwin" | |
af18c7e0 FF |
47 | ;; |
48 | *) | |
49 | ac_system="unknown" | |
50 | esac | |
51 | AC_MSG_RESULT([$ac_system]) | |
52 | ||
15996f86 FF |
53 | # |
54 | # Checks for header files. | |
55 | # | |
e708ae9b | 56 | AC_HEADER_STDC |
86ca149a | 57 | AC_HEADER_SYS_WAIT |
6e765a02 | 58 | AC_HEADER_DIRENT |
a905d397 | 59 | |
fbf19197 | 60 | AC_CHECK_HEADERS(stdio.h stdint.h stdbool.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h) |
15996f86 | 61 | |
c9a5b034 | 62 | # For ping library |
6934b3d0 FF |
63 | AC_CHECK_HEADERS(netinet/in_systm.h, [], [], |
64 | [#if HAVE_STDINT_H | |
65 | # include <stdint.h> | |
66 | #endif | |
ac491e03 FF |
67 | #if HAVE_SYS_TYPES_H |
68 | # include <sys/types.h> | |
69 | #endif | |
6934b3d0 | 70 | ]) |
c9a5b034 | 71 | AC_CHECK_HEADERS(netinet/in.h, [], [], |
6934b3d0 FF |
72 | [#if HAVE_STDINT_H |
73 | # include <stdint.h> | |
74 | #endif | |
ac491e03 FF |
75 | #if HAVE_SYS_TYPES_H |
76 | # include <sys/types.h> | |
77 | #endif | |
6934b3d0 | 78 | #if HAVE_NETINET_IN_SYSTM_H |
c9a5b034 FF |
79 | # include <netinet/in_systm.h> |
80 | #endif | |
81 | ]) | |
82 | AC_CHECK_HEADERS(netinet/ip.h, [], [], | |
6934b3d0 FF |
83 | [#if HAVE_STDINT_H |
84 | # include <stdint.h> | |
85 | #endif | |
ac491e03 FF |
86 | #if HAVE_SYS_TYPES_H |
87 | # include <sys/types.h> | |
88 | #endif | |
6934b3d0 | 89 | #if HAVE_NETINET_IN_SYSTM_H |
c9a5b034 FF |
90 | # include <netinet/in_systm.h> |
91 | #endif | |
92 | #if HAVE_NETINET_IN_H | |
93 | # include <netinet/in.h> | |
94 | #endif | |
95 | ]) | |
96 | AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [], | |
6934b3d0 FF |
97 | [#if HAVE_STDINT_H |
98 | # include <stdint.h> | |
99 | #endif | |
ac491e03 FF |
100 | #if HAVE_SYS_TYPES_H |
101 | # include <sys/types.h> | |
102 | #endif | |
6934b3d0 | 103 | #if HAVE_NETINET_IN_SYSTM_H |
c9a5b034 FF |
104 | # include <netinet/in_systm.h> |
105 | #endif | |
106 | #if HAVE_NETINET_IN_H | |
107 | # include <netinet/in.h> | |
108 | #endif | |
109 | #if HAVE_NETINET_IP_H | |
110 | # include <netinet/ip.h> | |
111 | #endif | |
112 | ]) | |
113 | AC_CHECK_HEADERS(netinet/ip_var.h, [], [], | |
6934b3d0 FF |
114 | [#if HAVE_STDINT_H |
115 | # include <stdint.h> | |
116 | #endif | |
ac491e03 FF |
117 | #if HAVE_SYS_TYPES_H |
118 | # include <sys/types.h> | |
119 | #endif | |
6934b3d0 | 120 | #if HAVE_NETINET_IN_SYSTM_H |
c9a5b034 FF |
121 | # include <netinet/in_systm.h> |
122 | #endif | |
123 | #if HAVE_NETINET_IN_H | |
124 | # include <netinet/in.h> | |
125 | #endif | |
126 | #if HAVE_NETINET_IP_H | |
127 | # include <netinet/ip.h> | |
128 | #endif | |
129 | ]) | |
130 | AC_CHECK_HEADERS(netinet/ip6.h, [], [], | |
6934b3d0 FF |
131 | [#if HAVE_STDINT_H |
132 | # include <stdint.h> | |
133 | #endif | |
6fe07031 FF |
134 | #if HAVE_SYS_TYPES_H |
135 | # include <sys/types.h> | |
136 | #endif | |
6934b3d0 | 137 | #if HAVE_NETINET_IN_SYSTM_H |
c9a5b034 FF |
138 | # include <netinet/in_systm.h> |
139 | #endif | |
140 | #if HAVE_NETINET_IN_H | |
141 | # include <netinet/in.h> | |
142 | #endif | |
143 | ]) | |
144 | AC_CHECK_HEADERS(netinet/icmp6.h, [], [], | |
6934b3d0 FF |
145 | [#if HAVE_STDINT_H |
146 | # include <stdint.h> | |
147 | #endif | |
6fe07031 FF |
148 | #if HAVE_SYS_TYPES_H |
149 | # include <sys/types.h> | |
150 | #endif | |
6934b3d0 | 151 | #if HAVE_NETINET_IN_SYSTM_H |
c9a5b034 FF |
152 | # include <netinet/in_systm.h> |
153 | #endif | |
154 | #if HAVE_NETINET_IN_H | |
155 | # include <netinet/in.h> | |
156 | #endif | |
157 | #if HAVE_NETINET_IP6_H | |
158 | # include <netinet/ip6.h> | |
159 | #endif | |
160 | ]) | |
79d36d9e FF |
161 | AC_CHECK_HEADERS(netinet/tcp.h, [], [], |
162 | [#if HAVE_STDINT_H | |
163 | # include <stdint.h> | |
164 | #endif | |
165 | #if HAVE_SYS_TYPES_H | |
166 | # include <sys/types.h> | |
167 | #endif | |
168 | #if HAVE_NETINET_IN_SYSTM_H | |
169 | # include <netinet/in_systm.h> | |
170 | #endif | |
171 | #if HAVE_NETINET_IN_H | |
172 | # include <netinet/in.h> | |
173 | #endif | |
174 | #if HAVE_NETINET_IP_H | |
175 | # include <netinet/ip.h> | |
176 | #endif | |
177 | ]) | |
5b9d0a2b FF |
178 | AC_CHECK_HEADERS(netinet/udp.h, [], [], |
179 | [#if HAVE_STDINT_H | |
180 | # include <stdint.h> | |
181 | #endif | |
182 | #if HAVE_SYS_TYPES_H | |
183 | # include <sys/types.h> | |
184 | #endif | |
185 | #if HAVE_NETINET_IN_SYSTM_H | |
186 | # include <netinet/in_systm.h> | |
187 | #endif | |
188 | #if HAVE_NETINET_IN_H | |
189 | # include <netinet/in.h> | |
190 | #endif | |
191 | #if HAVE_NETINET_IP_H | |
192 | # include <netinet/ip.h> | |
193 | #endif | |
194 | ]) | |
c9a5b034 | 195 | |
e1d497b7 | 196 | # For cpu modules |
af18c7e0 | 197 | AC_CHECK_HEADERS(sys/dkstat.h) |
29f72849 | 198 | if test "x$ac_system" = "xDarwin" |
af18c7e0 FF |
199 | then |
200 | AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h) | |
201 | AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h) | |
202 | fi | |
d4b36462 FF |
203 | AC_CHECK_HEADERS(sys/sysctl.h, [], [], |
204 | [ | |
205 | #if HAVE_SYS_TYPES_H | |
206 | # include <sys/types.h> | |
207 | #endif | |
208 | #if HAVE_SYS_PARAM_H | |
209 | # include <sys/param.h> | |
210 | #endif | |
211 | ]) | |
e1d497b7 | 212 | |
46ed2804 | 213 | # For hddtemp module |
a905d397 | 214 | AC_CHECK_HEADERS(linux/major.h libgen.h) |
46ed2804 | 215 | |
11265296 FF |
216 | # For the battery plugin |
217 | AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [], | |
218 | [ | |
219 | #if HAVE_IOKIT_IOKITLIB_H | |
220 | # include <IOKit/IOKitLib.h> | |
221 | #endif | |
222 | #if HAVE_IOKIT_IOTYPES_H | |
223 | # include <IOKit/IOTypes.h> | |
224 | #endif | |
225 | ]) | |
ce5ce8ad | 226 | |
daedf582 | 227 | # For the swap module |
d4b36462 FF |
228 | AC_CHECK_HEADERS(sys/swap.h, [], [], |
229 | [ | |
230 | #if HAVE_SYS_TYPES_H | |
231 | # include <sys/types.h> | |
232 | #endif | |
233 | #if HAVE_SYS_PARAM_H | |
234 | # include <sys/param.h> | |
235 | #endif | |
236 | ]) | |
daedf582 | 237 | |
15996f86 | 238 | # For load module |
44a3f33a | 239 | # For the processes plugin |
15996f86 | 240 | # For users module |
e4080f7a | 241 | AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h) |
86ca149a | 242 | |
3268a333 | 243 | # For interface plugin |
a05e34a0 | 244 | AC_CHECK_HEADERS(ifaddrs.h) |
cd377858 FF |
245 | AC_CHECK_HEADERS(net/if.h, [], [], |
246 | [ | |
247 | #if HAVE_SYS_TYPES_H | |
248 | # include <sys/types.h> | |
249 | #endif | |
250 | #if HAVE_SYS_SOCKET_H | |
251 | # include <sys/socket.h> | |
252 | #endif | |
253 | ]) | |
a05e34a0 FF |
254 | AC_CHECK_HEADERS(linux/if.h, [], [], |
255 | [ | |
256 | #if HAVE_SYS_TYPES_H | |
257 | # include <sys/types.h> | |
258 | #endif | |
259 | #if HAVE_SYS_SOCKET_H | |
260 | # include <sys/socket.h> | |
261 | #endif | |
262 | ]) | |
263 | AC_CHECK_HEADERS(linux/netdevice.h, [], [], | |
264 | [ | |
265 | #if HAVE_SYS_TYPES_H | |
266 | # include <sys/types.h> | |
267 | #endif | |
268 | #if HAVE_SYS_SOCKET_H | |
269 | # include <sys/socket.h> | |
270 | #endif | |
271 | #if HAVE_LINUX_IF_H | |
272 | # include <linux/if.h> | |
273 | #endif | |
274 | ]) | |
275 | ||
fb3a07dc SH |
276 | # For ipvs module |
277 | have_net_ip_vs_h="no" | |
278 | have_ip_vs_h="no" | |
279 | if test "x$ac_system" = "xLinux" | |
280 | then | |
281 | AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"]) | |
282 | AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"]) | |
283 | fi | |
284 | ||
6e765a02 | 285 | # For quota module |
d4b36462 FF |
286 | AC_CHECK_HEADERS(sys/ucred.h, [], [], |
287 | [ | |
288 | #if HAVE_SYS_TYPES_H | |
289 | # include <sys/types.h> | |
290 | #endif | |
291 | #if HAVE_SYS_PARAM_H | |
292 | # include <sys/param.h> | |
293 | #endif | |
294 | ]) | |
6e765a02 FF |
295 | |
296 | # For mount interface | |
d4b36462 FF |
297 | AC_CHECK_HEADERS(sys/mount.h, [], [], |
298 | [ | |
299 | #if HAVE_SYS_TYPES_H | |
300 | # include <sys/types.h> | |
301 | #endif | |
302 | #if HAVE_SYS_PARAM_H | |
303 | # include <sys/param.h> | |
304 | #endif | |
305 | ]) | |
28c5e282 | 306 | |
fc257d86 SH |
307 | # For the email plugin |
308 | AC_CHECK_HEADERS(linux/un.h, [], [], | |
309 | [ | |
310 | #if HAVE_SYS_SOCKET_H | |
311 | # include <sys/socket.h> | |
312 | #endif | |
313 | ]) | |
fc257d86 | 314 | |
23f2ac08 | 315 | AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h sys/quota.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h wordexp.h) |
ec88fb0e | 316 | |
fdfbf887 | 317 | # For the dns plugin |
e0a11961 FF |
318 | AC_CHECK_HEADERS(arpa/nameser.h) |
319 | AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [], | |
320 | [ | |
321 | #if HAVE_ARPA_NAMESER_H | |
322 | # include <arpa/nameser.h> | |
323 | #endif | |
324 | ]) | |
c4377c1e | 325 | |
e94efcbe FF |
326 | AC_CHECK_HEADERS(net/if_arp.h, [], [], |
327 | [#if HAVE_SYS_SOCKET_H | |
328 | # include <sys/socket.h> | |
329 | #endif | |
330 | ]) | |
e40574f3 FF |
331 | AC_CHECK_HEADERS(net/ppp_defs.h) |
332 | AC_CHECK_HEADERS(net/if_ppp.h, [], [], | |
333 | [#if HAVE_NET_PPP_DEFS_H | |
334 | # include <net/ppp_defs.h> | |
335 | #endif | |
336 | ]) | |
e94efcbe FF |
337 | AC_CHECK_HEADERS(netinet/if_ether.h, [], [], |
338 | [#if HAVE_STDINT_H | |
339 | # include <stdint.h> | |
340 | #endif | |
341 | #if HAVE_SYS_TYPES_H | |
342 | # include <sys/types.h> | |
343 | #endif | |
344 | #if HAVE_SYS_SOCKET_H | |
345 | # include <sys/socket.h> | |
346 | #endif | |
347 | #if HAVE_NET_IF_H | |
348 | # include <net/if.h> | |
349 | #endif | |
350 | #if HAVE_NETINET_IN_H | |
351 | # include <netinet/in.h> | |
352 | #endif | |
353 | ]) | |
dd7a9bc9 | 354 | |
51e70a99 | 355 | # For the multimeter plugin |
3fc0feb6 FF |
356 | have_termios_h="no" |
357 | AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"]) | |
51e70a99 | 358 | |
15996f86 FF |
359 | # |
360 | # Checks for typedefs, structures, and compiler characteristics. | |
361 | # | |
86ca149a FF |
362 | AC_C_CONST |
363 | AC_TYPE_PID_T | |
364 | AC_TYPE_SIZE_T | |
7df03651 | 365 | AC_TYPE_UID_T |
86ca149a FF |
366 | AC_HEADER_TIME |
367 | ||
15996f86 FF |
368 | # |
369 | # Checks for library functions. | |
370 | # | |
86ca149a | 371 | AC_PROG_GCC_TRADITIONAL |
a905d397 | 372 | AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog) |
15996f86 | 373 | |
fa7db5e9 SH |
374 | AC_FUNC_STRERROR_R |
375 | ||
0c06f2fa FF |
376 | AC_CACHE_CHECK([for strtok_r], |
377 | [have_strtok_r_default], | |
378 | AC_LINK_IFELSE( | |
379 | AC_LANG_PROGRAM( | |
380 | [[[[ | |
381 | #include <stdlib.h> | |
382 | #include <stdio.h> | |
383 | #include <string.h> | |
384 | ]]]], | |
385 | [[[[ | |
386 | char buffer[] = "foo,bar,baz"; | |
387 | char *token; | |
388 | char *dummy; | |
389 | char *saveptr; | |
390 | ||
391 | dummy = buffer; | |
392 | saveptr = NULL; | |
393 | while ((token = strtok_r (dummy, ",", &saveptr)) != NULL) | |
394 | { | |
395 | dummy = NULL; | |
396 | printf ("token = %s;\n", token); | |
397 | } | |
398 | ]]]]), | |
399 | [have_strtok_r_default="yes"], | |
400 | [have_strtok_r_default="no"] | |
401 | ) | |
402 | ) | |
403 | ||
404 | if test "x$have_strtok_r_default" = "xno" | |
405 | then | |
406 | SAVE_CFLAGS="$CFLAGS" | |
407 | CFLAGS="$CFLAGS -D_REENTRANT=1" | |
408 | ||
409 | AC_CACHE_CHECK([if strtok_r needs _REENTRANT], | |
410 | [have_strtok_r_reentrant], | |
411 | AC_LINK_IFELSE( | |
412 | AC_LANG_PROGRAM( | |
413 | [[[[ | |
414 | #include <stdlib.h> | |
415 | #include <stdio.h> | |
416 | #include <string.h> | |
417 | ]]]], | |
418 | [[[[ | |
419 | char buffer[] = "foo,bar,baz"; | |
420 | char *token; | |
421 | char *dummy; | |
422 | char *saveptr; | |
423 | ||
424 | dummy = buffer; | |
425 | saveptr = NULL; | |
426 | while ((token = strtok_r (dummy, ",", &saveptr)) != NULL) | |
427 | { | |
428 | dummy = NULL; | |
429 | printf ("token = %s;\n", token); | |
430 | } | |
431 | ]]]]), | |
432 | [have_strtok_r_reentrant="yes"], | |
433 | [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])] | |
434 | ) | |
435 | ) | |
436 | fi | |
437 | ||
b5c58909 | 438 | AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree) |
d6bb65ee | 439 | |
d89f6dc3 FF |
440 | socket_needs_socket="no" |
441 | AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket))) | |
442 | AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes") | |
443 | ||
4ca5457f FF |
444 | nanosleep_needs_rt="no" |
445 | AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep))) | |
446 | AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes") | |
447 | ||
e1d497b7 | 448 | AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"]) |
a905d397 FF |
449 | AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"]) |
450 | AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"]) | |
451 | AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"]) | |
452 | AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"]) | |
453 | AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"]) | |
454 | AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"]) | |
455 | AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"]) | |
456 | AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"]) | |
457 | AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"]) | |
2d03e4e3 | 458 | |
15996f86 FF |
459 | # For load module |
460 | AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"]) | |
461 | ||
e91c40b8 | 462 | # Check for NAN |
18fdfeca FF |
463 | AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])], |
464 | [ | |
465 | if test "x$withval" = "xno"; then | |
466 | nan_type="none" | |
467 | else if test "x$withval" = "xyes"; then | |
468 | nan_type="zero" | |
469 | else | |
470 | nan_type="$withval" | |
471 | fi; fi | |
472 | ], | |
473 | [nan_type="none"]) | |
e91c40b8 FF |
474 | if test "x$nan_type" = "xnone"; then |
475 | AC_CACHE_CHECK([whether NAN is defined by default], | |
476 | [have_nan_default], | |
477 | AC_COMPILE_IFELSE( | |
478 | AC_LANG_PROGRAM( | |
479 | [[ | |
480 | #include <stdlib.h> | |
481 | #include <math.h> | |
482 | static float foo = NAN; | |
483 | ]], | |
484 | [[ | |
485 | if (isnan (foo)) | |
486 | return 0; | |
487 | else | |
488 | return 1; | |
489 | ]]), | |
490 | [have_nan_default="yes"], | |
491 | [have_nan_default="no"] | |
492 | ) | |
493 | ) | |
494 | if test "x$have_nan_default" = "xyes" | |
495 | then | |
18fdfeca | 496 | nan_type="default" |
e91c40b8 FF |
497 | fi |
498 | fi | |
499 | if test "x$nan_type" = "xnone"; then | |
500 | AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99], | |
501 | [have_nan_isoc], | |
502 | AC_COMPILE_IFELSE( | |
503 | AC_LANG_PROGRAM( | |
504 | [[ | |
505 | #include <stdlib.h> | |
506 | #define __USE_ISOC99 1 | |
507 | #include <math.h> | |
508 | static float foo = NAN; | |
509 | ]], | |
510 | [[ | |
511 | if (isnan (foo)) | |
512 | return 0; | |
513 | else | |
514 | return 1; | |
515 | ]]), | |
516 | [have_nan_isoc="yes"], | |
517 | [have_nan_isoc="no"] | |
518 | ) | |
519 | ) | |
520 | if test "x$have_nan_isoc" = "xyes" | |
521 | then | |
18fdfeca | 522 | nan_type="isoc99" |
e91c40b8 FF |
523 | fi |
524 | fi | |
525 | if test "x$nan_type" = "xnone"; then | |
526 | AC_CACHE_CHECK([whether NAN can be defined by 0/0], | |
527 | [have_nan_zero], | |
528 | AC_RUN_IFELSE( | |
529 | AC_LANG_PROGRAM( | |
530 | [[ | |
531 | #include <stdlib.h> | |
532 | #include <math.h> | |
dcc46cbc FF |
533 | #ifdef NAN |
534 | # undef NAN | |
535 | #endif | |
e91c40b8 FF |
536 | #define NAN (0.0 / 0.0) |
537 | #ifndef isnan | |
538 | # define isnan(f) ((f) != (f)) | |
539 | #endif | |
540 | static float foo = NAN; | |
541 | ]], | |
542 | [[ | |
543 | if (isnan (foo)) | |
544 | return 0; | |
545 | else | |
546 | return 1; | |
547 | ]]), | |
548 | [have_nan_zero="yes"], | |
549 | [have_nan_zero="no"] | |
550 | ) | |
551 | ) | |
552 | if test "x$have_nan_zero" = "xyes" | |
553 | then | |
18fdfeca | 554 | nan_type="zero" |
e91c40b8 FF |
555 | fi |
556 | fi | |
18fdfeca FF |
557 | |
558 | if test "x$nan_type" = "xdefault"; then | |
559 | AC_DEFINE(NAN_STATIC_DEFAULT, 1, | |
560 | [Define if NAN is defined by default and can initialize static variables.]) | |
561 | else if test "x$nan_type" = "xisoc99"; then | |
562 | AC_DEFINE(NAN_STATIC_ISOC, 1, | |
563 | [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.]) | |
564 | else if test "x$nan_type" = "xzero"; then | |
565 | AC_DEFINE(NAN_ZERO_ZERO, 1, | |
566 | [Define if NAN can be defined as (0.0 / 0.0)]) | |
567 | else | |
e91c40b8 | 568 | AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.]) |
18fdfeca | 569 | fi; fi; fi |
e91c40b8 | 570 | |
b365f4e3 FF |
571 | AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])], |
572 | [ | |
573 | if test "x$withval" = "xnothing"; then | |
574 | fp_layout_type="nothing" | |
575 | else if test "x$withval" = "xendianflip"; then | |
576 | fp_layout_type="endianflip" | |
577 | else if test "x$withval" = "xintswap"; then | |
578 | fp_layout_type="intswap" | |
579 | else | |
580 | AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]); | |
581 | fi; fi; fi | |
582 | ], | |
583 | [fp_layout_type="unknown"]) | |
584 | ||
585 | if test "x$fp_layout_type" = "xunknown"; then | |
586 | AC_CACHE_CHECK([if doubles are stored in x86 representation], | |
587 | [fp_layout_need_nothing], | |
588 | AC_RUN_IFELSE( | |
589 | AC_LANG_PROGRAM( | |
590 | [[[[ | |
591 | #include <stdlib.h> | |
592 | #include <stdio.h> | |
593 | #include <stdint.h> | |
594 | #include <string.h> | |
595 | ]]]], | |
596 | [[[[ | |
597 | uint64_t i0; | |
598 | uint64_t i1; | |
599 | uint8_t c[8]; | |
600 | double d; | |
601 | ||
602 | d = 8.642135e130; | |
603 | memcpy ((void *) &i0, (void *) &d, 8); | |
604 | ||
605 | i1 = i0; | |
606 | memcpy ((void *) c, (void *) &i1, 8); | |
607 | ||
608 | if ((c[0] == 0x2f) && (c[1] == 0x25) | |
609 | && (c[2] == 0xc0) && (c[3] == 0xc7) | |
610 | && (c[4] == 0x43) && (c[5] == 0x2b) | |
611 | && (c[6] == 0x1f) && (c[7] == 0x5b)) | |
612 | return (0); | |
613 | else | |
614 | return (1); | |
615 | ]]]]), | |
616 | [fp_layout_need_nothing="yes"], | |
617 | [fp_layout_need_nothing="no"] | |
618 | ) | |
619 | ) | |
620 | if test "x$fp_layout_need_nothing" = "xyes"; then | |
621 | fp_layout_type="nothing" | |
622 | fi | |
623 | fi | |
624 | if test "x$fp_layout_type" = "xunknown"; then | |
625 | AC_CACHE_CHECK([if endianflip converts to x86 representation], | |
626 | [fp_layout_need_endianflip], | |
627 | AC_RUN_IFELSE( | |
628 | AC_LANG_PROGRAM( | |
629 | [[[[ | |
630 | #include <stdlib.h> | |
631 | #include <stdio.h> | |
632 | #include <stdint.h> | |
633 | #include <string.h> | |
634 | #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \ | |
635 | (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \ | |
636 | (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \ | |
637 | (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \ | |
638 | (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \ | |
639 | (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \ | |
640 | (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \ | |
641 | (((uint64_t)(A) & 0x00000000000000ffLL) << 56)) | |
642 | ]]]], | |
643 | [[[[ | |
644 | uint64_t i0; | |
645 | uint64_t i1; | |
646 | uint8_t c[8]; | |
647 | double d; | |
648 | ||
649 | d = 8.642135e130; | |
650 | memcpy ((void *) &i0, (void *) &d, 8); | |
651 | ||
652 | i1 = endianflip (i0); | |
653 | memcpy ((void *) c, (void *) &i1, 8); | |
654 | ||
655 | if ((c[0] == 0x2f) && (c[1] == 0x25) | |
656 | && (c[2] == 0xc0) && (c[3] == 0xc7) | |
657 | && (c[4] == 0x43) && (c[5] == 0x2b) | |
658 | && (c[6] == 0x1f) && (c[7] == 0x5b)) | |
659 | return (0); | |
660 | else | |
661 | return (1); | |
662 | ]]]]), | |
663 | [fp_layout_need_endianflip="yes"], | |
664 | [fp_layout_need_endianflip="no"] | |
665 | ) | |
666 | ) | |
667 | if test "x$fp_layout_need_endianflip" = "xyes"; then | |
668 | fp_layout_type="endianflip" | |
669 | fi | |
670 | fi | |
671 | if test "x$fp_layout_type" = "xunknown"; then | |
672 | AC_CACHE_CHECK([if intswap converts to x86 representation], | |
673 | [fp_layout_need_intswap], | |
674 | AC_RUN_IFELSE( | |
675 | AC_LANG_PROGRAM( | |
676 | [[[[ | |
677 | #include <stdlib.h> | |
678 | #include <stdio.h> | |
679 | #include <stdint.h> | |
680 | #include <string.h> | |
681 | #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \ | |
682 | (((uint64_t)(A) & 0x00000000ffffffffLL) << 32)) | |
683 | ]]]], | |
684 | [[[[ | |
685 | uint64_t i0; | |
686 | uint64_t i1; | |
687 | uint8_t c[8]; | |
688 | double d; | |
689 | ||
690 | d = 8.642135e130; | |
691 | memcpy ((void *) &i0, (void *) &d, 8); | |
692 | ||
693 | i1 = intswap (i0); | |
694 | memcpy ((void *) c, (void *) &i1, 8); | |
695 | ||
696 | if ((c[0] == 0x2f) && (c[1] == 0x25) | |
697 | && (c[2] == 0xc0) && (c[3] == 0xc7) | |
698 | && (c[4] == 0x43) && (c[5] == 0x2b) | |
699 | && (c[6] == 0x1f) && (c[7] == 0x5b)) | |
700 | return (0); | |
701 | else | |
702 | return (1); | |
703 | ]]]]), | |
704 | [fp_layout_need_intswap="yes"], | |
705 | [fp_layout_need_intswap="no"] | |
706 | ) | |
707 | ) | |
708 | if test "x$fp_layout_need_intswap" = "xyes"; then | |
709 | fp_layout_type="intswap" | |
710 | fi | |
711 | fi | |
712 | ||
713 | if test "x$fp_layout_type" = "xnothing"; then | |
714 | AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1, | |
715 | [Define if doubles are stored in x86 representation.]) | |
716 | else if test "x$fp_layout_type" = "xendianflip"; then | |
717 | AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1, | |
718 | [Define if endianflip is needed to convert to x86 representation.]) | |
719 | else if test "x$fp_layout_type" = "xintswap"; then | |
720 | AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1, | |
721 | [Define if intswap is needed to convert to x86 representation.]) | |
722 | else | |
723 | AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.]) | |
724 | fi; fi; fi | |
2dc3f07b FF |
725 | |
726 | have_getfsstat="no" | |
727 | AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"]) | |
728 | have_getvfsstat="no" | |
729 | AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"]) | |
730 | have_listmntent="no" | |
731 | AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"]) | |
732 | ||
733 | have_getmntent="no" | |
734 | AC_CHECK_FUNCS(getmntent, [have_getmntent="c"]) | |
735 | if test "x$have_getmntent" = "xno"; then | |
736 | AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"]) | |
c9a5b034 | 737 | fi |
2dc3f07b FF |
738 | if test "x$have_getmntent" = "xno"; then |
739 | AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"]) | |
c9a5b034 | 740 | fi |
2dc3f07b FF |
741 | if test "x$have_getmntent" = "xno"; then |
742 | AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"]) | |
c9a5b034 FF |
743 | fi |
744 | ||
2dc3f07b | 745 | if test "x$have_getmntent" = "xc"; then |
6e765a02 | 746 | AC_CACHE_CHECK([whether getmntent takes one argument], |
2dc3f07b | 747 | [have_one_getmntent], |
6e765a02 FF |
748 | AC_COMPILE_IFELSE( |
749 | AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT | |
2dc3f07b | 750 | #include <mntent.h> |
6e765a02 | 751 | #include "$srcdir/src/utils_mount.h"]], |
2dc3f07b FF |
752 | [[ |
753 | FILE *fh; | |
754 | struct mntent *me; | |
755 | fh = setmntent ("/etc/mtab", "r"); | |
756 | me = getmntent (fh); | |
757 | ]] | |
6e765a02 | 758 | ), |
2dc3f07b FF |
759 | [have_one_getmntent="yes"], |
760 | [have_one_getmntent="no"] | |
6e765a02 FF |
761 | ) |
762 | ) | |
2dc3f07b FF |
763 | AC_CACHE_CHECK([whether getmntent takes two arguments], |
764 | [have_two_getmntent], | |
765 | AC_COMPILE_IFELSE( | |
766 | AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT | |
767 | #include <sys/mnttab.h> | |
6e765a02 | 768 | #include "$srcdir/src/utils_mount.h"]], |
2dc3f07b FF |
769 | [[ |
770 | FILE *fh; | |
771 | struct mnttab mt; | |
772 | int status; | |
773 | fh = fopen ("/etc/mnttab", "r"); | |
774 | status = getmntent (fh, &mt); | |
775 | ]] | |
776 | ), | |
777 | [have_two_getmntent="yes"], | |
778 | [have_two_getmntent="no"] | |
6e765a02 | 779 | ) |
2dc3f07b FF |
780 | ) |
781 | fi | |
782 | ||
783 | # Check for different versions of `getmntent' here.. | |
784 | ||
785 | if test "x$have_getmntent" = "xc"; then | |
786 | if test "x$have_one_getmntent" = "xyes"; then | |
787 | AC_DEFINE(HAVE_ONE_GETMNTENT, 1, | |
788 | [Define if the function getmntent exists and takes one argument.]) | |
789 | fi | |
790 | if test "x$have_two_getmntent" = "xyes"; then | |
791 | AC_DEFINE(HAVE_TWO_GETMNTENT, 1, | |
792 | [Define if the function getmntent exists and takes two arguments.]) | |
6e765a02 | 793 | fi |
6e765a02 | 794 | fi |
2dc3f07b FF |
795 | if test "x$have_getmntent" = "xsun"; then |
796 | AC_DEFINE(HAVE_SUN_GETMNTENT, 1, | |
797 | [Define if the function getmntent exists. It's the version from libsun.]) | |
6e765a02 | 798 | fi |
2dc3f07b FF |
799 | if test "x$have_getmntent" = "xseq"; then |
800 | AC_DEFINE(HAVE_SEQ_GETMNTENT, 1, | |
801 | [Define if the function getmntent exists. It's the version from libseq.]) | |
802 | fi | |
803 | if test "x$have_getmntent" = "xgen"; then | |
804 | AC_DEFINE(HAVE_GEN_GETMNTENT, 1, | |
805 | [Define if the function getmntent exists. It's the version from libgen.]) | |
6e765a02 FF |
806 | fi |
807 | ||
a05e34a0 | 808 | # Check for structures |
906bea76 | 809 | AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors], |
a05e34a0 FF |
810 | [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])], |
811 | [], | |
cd377858 FF |
812 | [ |
813 | #include <sys/types.h> | |
814 | #include <sys/socket.h> | |
815 | #include <net/if.h> | |
816 | ]) | |
906bea76 | 817 | AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors], |
a05e34a0 FF |
818 | [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])], |
819 | [], | |
820 | [ | |
821 | #include <sys/types.h> | |
822 | #include <sys/socket.h> | |
823 | #include <linux/if.h> | |
824 | #include <linux/netdevice.h> | |
825 | ]) | |
826 | ||
5b9d0a2b FF |
827 | AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [], |
828 | [#if HAVE_STDINT_H | |
829 | # include <stdint.h> | |
830 | #endif | |
831 | #if HAVE_SYS_TYPES_H | |
832 | # include <sys/types.h> | |
833 | #endif | |
834 | #if HAVE_NETINET_IN_SYSTM_H | |
835 | # include <netinet/in_systm.h> | |
836 | #endif | |
837 | #if HAVE_NETINET_IN_H | |
838 | # include <netinet/in.h> | |
839 | #endif | |
840 | #if HAVE_NETINET_IP_H | |
841 | # include <netinet/ip.h> | |
842 | #endif | |
843 | #if HAVE_NETINET_UDP_H | |
844 | # include <netinet/udp.h> | |
845 | #endif | |
846 | ]) | |
847 | AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [], | |
848 | [#if HAVE_STDINT_H | |
849 | # include <stdint.h> | |
850 | #endif | |
851 | #if HAVE_SYS_TYPES_H | |
852 | # include <sys/types.h> | |
853 | #endif | |
854 | #if HAVE_NETINET_IN_SYSTM_H | |
855 | # include <netinet/in_systm.h> | |
856 | #endif | |
857 | #if HAVE_NETINET_IN_H | |
858 | # include <netinet/in.h> | |
859 | #endif | |
860 | #if HAVE_NETINET_IP_H | |
861 | # include <netinet/ip.h> | |
862 | #endif | |
863 | #if HAVE_NETINET_UDP_H | |
864 | # include <netinet/udp.h> | |
865 | #endif | |
866 | ]) | |
2aff261d | 867 | |
e94efcbe FF |
868 | AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime], |
869 | [], | |
870 | [], | |
871 | [ | |
872 | #if HAVE_KSTAT_H | |
873 | # include <kstat.h> | |
874 | #endif | |
875 | ]) | |
876 | ||
4aed4a7a FF |
877 | # |
878 | # Checks for libraries begin here | |
879 | # | |
a58af051 FF |
880 | with_libresolv="yes" |
881 | AC_CHECK_LIB(resolv, res_search, | |
882 | [ | |
883 | AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).]) | |
884 | ], | |
885 | [with_libresolv="no"]) | |
886 | AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes") | |
86ca149a | 887 | |
30f3e7b8 RJ |
888 | dnl Check for HAL (hardware abstraction library) |
889 | with_libhal="yes" | |
890 | AC_CHECK_LIB(hal,libhal_device_property_exists, | |
891 | [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])], | |
892 | [with_libhal="no"]) | |
893 | if test "x$with_libhal" = "xyes"; then | |
894 | PKG_PROG_PKG_CONFIG | |
895 | if test "x$PKG_CONFIG" != "x"; then | |
896 | BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`" | |
897 | BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`" | |
898 | AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS) | |
899 | AC_SUBST(BUILD_WITH_LIBHAL_LIBS) | |
900 | fi | |
901 | fi | |
125bdc00 | 902 | |
c27cdba8 NW |
903 | m4_divert_once([HELP_WITH], [ |
904 | collectd additional packages:]) | |
905 | ||
86ca149a | 906 | # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given]) |
ac9cdb55 FF |
907 | librrd_cflags="" |
908 | librrd_ldflags="" | |
909 | librrd_threadsafe="yes" | |
3c12e8a6 | 910 | AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])], |
42e281c5 | 911 | [ if test "x$withval" != "xno" && test "x$withval" != "xyes" |
86ca149a | 912 | then |
ac9cdb55 FF |
913 | librrd_cflags="-I$withval/include" |
914 | librrd_ldflags="-L$withval/lib" | |
86ca149a | 915 | with_rrdtool="yes" |
fb713675 SH |
916 | else |
917 | with_rrdtool="$withval" | |
86ca149a FF |
918 | fi |
919 | ], [with_rrdtool="yes"]) | |
920 | if test "x$with_rrdtool" = "xyes" | |
921 | then | |
4c67453e | 922 | SAVE_CPPFLAGS="$CPPFLAGS" |
ac9cdb55 FF |
923 | SAVE_LDFLAGS="$LDFLAGS" |
924 | ||
4c67453e | 925 | CPPFLAGS="$CPPFLAGS $librrd_cflags" |
ac9cdb55 FF |
926 | LDFLAGS="$LDFLAGS $librrd_ldflags" |
927 | ||
928 | AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"]) | |
929 | ||
4c67453e | 930 | CPPFLAGS="$SAVE_CPPFLAGS" |
ac9cdb55 | 931 | LDFLAGS="$SAVE_LDFLAGS" |
86ca149a FF |
932 | fi |
933 | if test "x$with_rrdtool" = "xyes" | |
934 | then | |
4c67453e FF |
935 | SAVE_CPPFLAGS="$CPPFLAGS" |
936 | SAVE_LDFLAGS="$LDFLAGS" | |
937 | ||
938 | CPPFLAGS="$CPPFLAGS $librrd_cflags" | |
939 | LDFLAGS="$LDFLAGS $librrd_ldflags" | |
940 | ||
ac9cdb55 FF |
941 | AC_CHECK_LIB(rrd_th, rrd_update_r, |
942 | [with_rrdtool="yes" | |
943 | librrd_ldflags="$librrd_ldflags -lrrd_th -lm" | |
944 | ], | |
945 | [librrd_threadsafe="no" | |
946 | AC_CHECK_LIB(rrd, rrd_update, | |
947 | [with_rrdtool="yes" | |
948 | librrd_ldflags="$librrd_ldflags -lrrd -lm" | |
949 | ], | |
950 | [with_rrdtool="no (symbol 'rrd_update' not found)"], | |
951 | [-lm]) | |
2b63c8ca | 952 | ], |
ac9cdb55 | 953 | [-lm]) |
4c67453e FF |
954 | |
955 | CPPFLAGS="$SAVE_CPPFLAGS" | |
956 | LDFLAGS="$SAVE_LDFLAGS" | |
86ca149a | 957 | fi |
b898eac6 NW |
958 | if test "x$with_rrdtool" = "xyes" |
959 | then | |
ac9cdb55 FF |
960 | BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags" |
961 | BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags" | |
962 | AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS) | |
963 | AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS) | |
964 | fi | |
965 | if test "x$librrd_threadsafe" = "xyes" | |
966 | then | |
967 | AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).]) | |
b898eac6 | 968 | fi |
86ca149a | 969 | |
c4377c1e | 970 | AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])], |
d45c77ca FF |
971 | [ if test "x$withval" != "xno" \ |
972 | && test "x$withval" != "xyes" | |
9e137cdb FF |
973 | then |
974 | LDFLAGS="$LDFLAGS -L$withval/lib" | |
975 | CPPFLAGS="$CPPFLAGS -I$withval/include" | |
c4377c1e FF |
976 | with_libpthread="yes" |
977 | else | |
978 | if test "x$withval" = "xno" | |
979 | then | |
980 | with_libpthread="no (disabled)" | |
981 | fi | |
9e137cdb | 982 | fi |
06bafec5 | 983 | ], [with_libpthread="yes"]) |
c4377c1e | 984 | if test "x$with_libpthread" = "xyes" |
9e137cdb | 985 | then |
c4377c1e | 986 | AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], []) |
9e137cdb | 987 | fi |
c4377c1e | 988 | if test "x$with_libpthread" = "xyes" |
9e137cdb | 989 | then |
c4377c1e | 990 | AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"]) |
9e137cdb | 991 | fi |
c4377c1e | 992 | if test "x$with_libpthread" = "xyes" |
9e137cdb FF |
993 | then |
994 | collect_pthread=1 | |
995 | else | |
996 | collect_pthread=0 | |
997 | fi | |
998 | AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread], | |
999 | [Wether or not to use pthread (POSIX threads) library]) | |
c4377c1e | 1000 | AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes") |
6e765a02 | 1001 | |
29f72849 | 1002 | if test "x$ac_system" = "xSolaris" |
86ca149a FF |
1003 | then |
1004 | with_kstat="yes" | |
d89f6dc3 | 1005 | with_devinfo="yes" |
3c12e8a6 NW |
1006 | else |
1007 | with_kstat="no (Solaris only)" | |
d89f6dc3 | 1008 | with_devinfo="no (Solaris only)" |
3c12e8a6 | 1009 | fi |
d89f6dc3 | 1010 | |
3c12e8a6 NW |
1011 | if test "x$with_kstat" = "xyes" |
1012 | then | |
080df026 | 1013 | AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], []) |
3c12e8a6 NW |
1014 | fi |
1015 | if test "x$with_kstat" = "xyes" | |
1016 | then | |
080df026 | 1017 | AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], []) |
86ca149a | 1018 | AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"]) |
86ca149a | 1019 | fi |
b898eac6 NW |
1020 | if test "x$with_kstat" = "xyes" |
1021 | then | |
27adc320 FF |
1022 | AC_DEFINE(HAVE_LIBKSTAT, 1, |
1023 | [Define to 1 if you have the 'kstat' library (-lkstat)]) | |
b898eac6 | 1024 | fi |
d89f6dc3 FF |
1025 | AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes") |
1026 | AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes") | |
86ca149a | 1027 | |
1842a7a7 FF |
1028 | ### BEGIN of check for libcurl ### |
1029 | with_curl_config="curl-config" | |
8f6c03d5 | 1030 | with_curl_cflags="" |
1842a7a7 FF |
1031 | with_curl_libs="" |
1032 | AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])], | |
1033 | [ | |
1842a7a7 FF |
1034 | if test "x$withval" = "xno" |
1035 | then | |
1036 | with_libcurl="no" | |
8f6c03d5 FF |
1037 | else if test "x$withval" = "xyes" |
1038 | then | |
1842a7a7 | 1039 | with_libcurl="yes" |
8f6c03d5 | 1040 | else |
a3cd4630 | 1041 | if test -f "$withval" && test -x "$withval" |
8f6c03d5 FF |
1042 | then |
1043 | with_curl_config="$withval" | |
c39428ae | 1044 | with_libcurl="yes" |
8f6c03d5 FF |
1045 | else if test -x "$withval/bin/curl-config" |
1046 | then | |
1047 | with_curl_config="$withval/bin/curl-config" | |
c39428ae | 1048 | with_libcurl="yes" |
8f6c03d5 | 1049 | fi; fi |
a3cd4630 | 1050 | with_libcurl="yes" |
8f6c03d5 | 1051 | fi; fi |
1842a7a7 FF |
1052 | ], |
1053 | [ | |
1054 | with_libcurl="yes" | |
1055 | ]) | |
1056 | if test "x$with_libcurl" = "xyes" | |
1057 | then | |
8f6c03d5 | 1058 | with_curl_cflags=`$with_curl_config --cflags 2>/dev/null` |
1842a7a7 FF |
1059 | curl_config_status=$? |
1060 | ||
1061 | if test $curl_config_status -ne 0 | |
1062 | then | |
48bc4be8 | 1063 | with_libcurl="no ($with_curl_config failed)" |
1842a7a7 | 1064 | else |
06c09fee FF |
1065 | SAVE_CPPFLAGS="$CPPFLAGS" |
1066 | CPPFLAGS="$CPPFLAGS $with_curl_cflags" | |
8f6c03d5 FF |
1067 | |
1068 | AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], []) | |
1069 | ||
06c09fee | 1070 | CPPFLAGS="$SAVE_CPPFLAGS" |
1842a7a7 FF |
1071 | fi |
1072 | fi | |
8f6c03d5 | 1073 | if test "x$with_libcurl" = "xyes" |
1842a7a7 | 1074 | then |
8f6c03d5 | 1075 | with_curl_libs=`$with_curl_config --libs 2>/dev/null` |
1842a7a7 FF |
1076 | curl_config_status=$? |
1077 | ||
1078 | if test $curl_config_status -ne 0 | |
1079 | then | |
48bc4be8 | 1080 | with_libcurl="no ($with_curl_config failed)" |
1842a7a7 | 1081 | else |
8f6c03d5 | 1082 | AC_CHECK_LIB(curl, curl_easy_init, |
48bc4be8 | 1083 | [with_libcurl="yes"], |
8f6c03d5 FF |
1084 | [with_libcurl="no (symbol 'curl_easy_init' not found)"], |
1085 | [$with_curl_libs]) | |
1842a7a7 FF |
1086 | fi |
1087 | fi | |
1842a7a7 FF |
1088 | if test "x$with_libcurl" = "xyes" |
1089 | then | |
8f6c03d5 FF |
1090 | BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags" |
1091 | BUILD_WITH_LIBCURL_LIBS="$with_curl_libs" | |
1092 | AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS) | |
1093 | AC_SUBST(BUILD_WITH_LIBCURL_LIBS) | |
1842a7a7 | 1094 | fi |
1842a7a7 FF |
1095 | AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes") |
1096 | ### END of check for libcurl ### | |
1097 | ||
adaf6ca0 | 1098 | with_libiokit="no" |
adaf6ca0 FF |
1099 | AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices, |
1100 | [ | |
1101 | with_libiokit="yes" | |
adaf6ca0 FF |
1102 | ], |
1103 | [ | |
1104 | with_libiokit="no" | |
adaf6ca0 | 1105 | ]) |
adaf6ca0 FF |
1106 | AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes") |
1107 | ||
4aed4a7a FF |
1108 | with_libstatgrab_cflags="" |
1109 | with_libstatgrab_ldflags="" | |
3c12e8a6 | 1110 | AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])], |
86ca149a | 1111 | [ |
d977ecae FF |
1112 | if test "x$withval" != "xno" \ |
1113 | && test "x$withval" != "xyes" | |
86ca149a | 1114 | then |
4aed4a7a FF |
1115 | with_libstatgrab_cflags="-I$withval/include" |
1116 | with_libstatgrab_ldflags="-L$withval/lib" | |
42e281c5 | 1117 | with_libstatgrab="yes" |
fb713675 SH |
1118 | else |
1119 | with_libstatgrab="$withval" | |
86ca149a FF |
1120 | fi |
1121 | ], | |
1122 | [ | |
d977ecae | 1123 | if test "x$ac_system" = "xunknown" |
86ca149a | 1124 | then |
86ca149a | 1125 | with_libstatgrab="yes" |
f830bd02 NW |
1126 | else |
1127 | with_libstatgrab="no" | |
86ca149a FF |
1128 | fi |
1129 | ]) | |
4aed4a7a FF |
1130 | with_libstatgrab_pkg_config="yes" |
1131 | if test "x$with_libstatgrab" = "xyes" \ | |
1132 | && test "x$PKG_CONFIG" != "x" | |
86ca149a | 1133 | then |
4aed4a7a FF |
1134 | AC_MSG_CHECKING([pkg-config for libstatgrab]) |
1135 | temp_result="found" | |
1136 | $PKG_CONFIG --exists libstatgrab 2>/dev/null | |
1137 | if test "$?" != "0" | |
1138 | then | |
1139 | with_libstatgrab_pkg_config="no" | |
1140 | temp_result="not found" | |
1141 | fi | |
1142 | AC_MSG_RESULT([$temp_result]) | |
1143 | else | |
1144 | AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.]) | |
1145 | with_libstatgrab_pkg_config="no" | |
1146 | with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab" | |
3c12e8a6 | 1147 | fi |
4aed4a7a FF |
1148 | |
1149 | if test "x$with_libstatgrab" = "xyes" \ | |
1150 | && test "x$with_libstatgrab_pkg_config" = "xyes" \ | |
1151 | && test "x$with_libstatgrab_cflags" = "x" | |
86ca149a | 1152 | then |
4aed4a7a FF |
1153 | AC_MSG_CHECKING([for libstatgrab CFLAGS]) |
1154 | temp_result="`$PKG_CONFIG --cflags libstatgrab`" | |
1155 | if test "$?" = "0" | |
1156 | then | |
1157 | with_libstatgrab_cflags="$temp_result" | |
1158 | else | |
1159 | with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)" | |
1160 | temp_result="$PKG_CONFIG --cflags libstatgrab failed" | |
1161 | fi | |
1162 | AC_MSG_RESULT([$temp_result]) | |
3c12e8a6 | 1163 | fi |
4aed4a7a FF |
1164 | |
1165 | if test "x$with_libstatgrab" = "xyes" \ | |
1166 | && test "x$with_libstatgrab_pkg_config" = "xyes" \ | |
1167 | && test "x$with_libstatgrab_ldflags" = "x" | |
3c12e8a6 | 1168 | then |
4aed4a7a FF |
1169 | AC_MSG_CHECKING([for libstatgrab LDFLAGS]) |
1170 | temp_result="`$PKG_CONFIG --libs libstatgrab`" | |
1171 | if test "$?" = "0" | |
1172 | then | |
1173 | with_libstatgrab_ldflags="$temp_result" | |
1174 | else | |
1175 | with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)" | |
1176 | temp_result="$PKG_CONFIG --libs libstatgrab failed" | |
1177 | fi | |
1178 | AC_MSG_RESULT([$temp_result]) | |
86ca149a | 1179 | fi |
4aed4a7a | 1180 | |
176d5f79 | 1181 | if test "x$with_libstatgrab" = "xyes" |
0aa63f0c | 1182 | then |
4aed4a7a FF |
1183 | SAVE_CPPFLAGS="$CPPFLAGS" |
1184 | CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags" | |
1185 | ||
1186 | AC_CHECK_HEADERS(statgrab.h, | |
1187 | [with_libstatgrab="yes"], | |
1188 | [with_libstatgrab="no (statgrab.h not found)"]) | |
1189 | ||
1190 | CPPFLAGS="$SAVE_CPPFLAGS" | |
0aa63f0c | 1191 | fi |
4aed4a7a | 1192 | |
0aa63f0c | 1193 | if test "x$with_libstatgrab" = "xyes" |
176d5f79 | 1194 | then |
4aed4a7a FF |
1195 | SAVE_CFLAGS="$CFLAGS" |
1196 | SAVE_LDFLAGS="$LDFLAGS" | |
1197 | ||
1198 | CFLAGS="$CFLAGS $with_libstatgrab_cflags" | |
1199 | LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags" | |
1200 | ||
1201 | AC_CHECK_LIB(statgrab, sg_init, | |
1202 | [with_libstatgrab="yes"], | |
1203 | [with_libstatgrab="no (symbol sg_init not found)"]) | |
1204 | ||
1205 | CFLAGS="$SAVE_CFLAGS" | |
1206 | LDFLAGS="$SAVE_LDFLAGS" | |
176d5f79 | 1207 | fi |
4aed4a7a | 1208 | |
176d5f79 | 1209 | AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes") |
4aed4a7a FF |
1210 | if test "x$with_libstatgrab" = "xyes" |
1211 | then | |
a8287f5a | 1212 | AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)]) |
4aed4a7a FF |
1213 | BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags" |
1214 | BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags" | |
1215 | AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS) | |
1216 | AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS) | |
1217 | fi | |
28c5e282 FF |
1218 | |
1219 | AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"]) | |
1220 | if test "x$with_libkvm" = "xyes" | |
1221 | then | |
1222 | AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)]) | |
1223 | fi | |
1224 | AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes") | |
86ca149a | 1225 | |
14ffdba9 FF |
1226 | with_sensors_cflags="" |
1227 | with_sensors_ldflags="" | |
3c12e8a6 | 1228 | AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])], |
86ca149a | 1229 | [ |
14ffdba9 | 1230 | if test "x$withval" = "xno" |
86ca149a | 1231 | then |
14ffdba9 FF |
1232 | with_lm_sensors="no" |
1233 | else | |
56a554e8 | 1234 | with_lm_sensors="yes" |
14ffdba9 FF |
1235 | if test "x$withval" != "xyes" |
1236 | then | |
1237 | with_sensors_cflags="-I$withval/include" | |
1238 | with_sensors_ldflags="-L$withval/lib" | |
1239 | with_lm_sensors="yes" | |
1240 | fi | |
86ca149a FF |
1241 | fi |
1242 | ], | |
1243 | [ | |
86ca149a FF |
1244 | if test "x$ac_system" = "xLinux" |
1245 | then | |
1246 | with_lm_sensors="yes" | |
1247 | else | |
af18c7e0 | 1248 | with_lm_sensors="no (Linux only library)" |
86ca149a FF |
1249 | fi |
1250 | ]) | |
1251 | if test "x$with_lm_sensors" = "xyes" | |
1252 | then | |
14ffdba9 FF |
1253 | SAVE_CPPFLAGS="$CPPFLAGS" |
1254 | CPPFLAGS="$CPPFLAGS $with_sensors_cflags" | |
1255 | ||
1256 | # AC_CHECK_HEADERS(sensors/sensors.h, | |
1257 | # [ | |
1258 | # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.]) | |
1259 | # ], | |
1260 | # [with_lm_sensors="no (sensors/sensors.h not found)"]) | |
1261 | AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"]) | |
1262 | ||
1263 | CPPFLAGS="$SAVE_CPPFLAGS" | |
3c12e8a6 NW |
1264 | fi |
1265 | if test "x$with_lm_sensors" = "xyes" | |
1266 | then | |
14ffdba9 FF |
1267 | SAVE_CPPFLAGS="$CPPFLAGS" |
1268 | SAVE_LDFLAGS="$LDFLAGS" | |
1269 | CPPFLAGS="$CPPFLAGS $with_sensors_cflags" | |
1270 | LDFLAGS="$LDFLAGS $with_sensors_ldflags" | |
1271 | ||
1272 | AC_CHECK_LIB(sensors, sensors_init, | |
86ca149a | 1273 | [ |
14ffdba9 | 1274 | AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).]) |
86ca149a | 1275 | ], |
14ffdba9 FF |
1276 | [with_lm_sensors="no (libsensors not found)"]) |
1277 | ||
1278 | CPPFLAGS="$SAVE_CPPFLAGS" | |
1279 | LDFLAGS="$SAVE_LDFLAGS" | |
56a554e8 NW |
1280 | fi |
1281 | if test "x$with_lm_sensors" = "xyes" | |
1282 | then | |
14ffdba9 FF |
1283 | BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags" |
1284 | BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags" | |
1285 | AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS) | |
1286 | AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS) | |
86ca149a | 1287 | fi |
56a554e8 | 1288 | AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes") |
86ca149a | 1289 | |
805c4940 | 1290 | with_mysql_config="mysql_config" |
805c4940 FF |
1291 | with_mysql_cflags="" |
1292 | with_mysql_libs="" | |
e4303e15 FF |
1293 | AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])], |
1294 | [ | |
805c4940 FF |
1295 | if test "x$withval" = "xno" |
1296 | then | |
1297 | with_libmysql="no" | |
8f6c03d5 | 1298 | else if test "x$withval" = "xyes" |
e4303e15 | 1299 | then |
e4303e15 | 1300 | with_libmysql="yes" |
8f6c03d5 | 1301 | else |
a3cd4630 | 1302 | if test -f "$withval" && test -x "$withval"; |
8f6c03d5 FF |
1303 | then |
1304 | with_mysql_config="$withval" | |
1305 | else if test -x "$withval/bin/mysql_config" | |
1306 | then | |
1307 | with_mysql_config="$withval/bin/mysql_config" | |
1308 | fi; fi | |
a3cd4630 | 1309 | with_libmysql="yes" |
8f6c03d5 | 1310 | fi; fi |
e4303e15 FF |
1311 | ], |
1312 | [ | |
1313 | with_libmysql="yes" | |
1314 | ]) | |
1315 | if test "x$with_libmysql" = "xyes" | |
1316 | then | |
805c4940 FF |
1317 | with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null` |
1318 | mysql_config_status=$? | |
1319 | ||
1320 | if test $mysql_config_status -ne 0 | |
1321 | then | |
1322 | with_libmysql="no" | |
1323 | else | |
06c09fee FF |
1324 | SAVE_CPPFLAGS="$CPPFLAGS" |
1325 | CPPFLAGS="$CPPFLAGS $with_mysql_cflags" | |
805c4940 FF |
1326 | |
1327 | AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], []) | |
1328 | ||
06c09fee | 1329 | CPPFLAGS="$SAVE_CPPFLAGS" |
805c4940 | 1330 | fi |
e4303e15 FF |
1331 | fi |
1332 | if test "x$with_libmysql" = "xyes" | |
1333 | then | |
805c4940 | 1334 | with_mysql_libs=`$with_mysql_config --libs 2>/dev/null` |
8f6c03d5 FF |
1335 | mysql_config_status=$? |
1336 | ||
1337 | if test $mysql_config_status -ne 0 | |
1338 | then | |
1339 | with_libmysql="no" | |
1340 | else | |
1341 | AC_CHECK_LIB(mysqlclient, mysql_init, | |
48bc4be8 FF |
1342 | [with_libmysql="yes"], |
1343 | [with_libmysql="no (symbol 'mysql_init' not found)"], | |
8f6c03d5 FF |
1344 | [$with_mysql_libs]) |
1345 | fi | |
e4303e15 FF |
1346 | fi |
1347 | if test "x$with_libmysql" = "xyes" | |
1348 | then | |
805c4940 FF |
1349 | BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags" |
1350 | BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs" | |
1351 | AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS) | |
1352 | AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS) | |
e4303e15 | 1353 | fi |
e4303e15 | 1354 | AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes") |
86ca149a | 1355 | |
c64b3f3b SH |
1356 | with_own_liboconfig="no" |
1357 | liboconfig_LDFLAGS="$LDFLAGS" | |
1358 | liboconfig_CPPFLAGS="$CPPFLAGS" | |
1359 | AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])], | |
1360 | [ | |
1361 | if test "x$withval" != "xno" && test "x$withval" != "xyes" | |
1362 | then | |
1363 | if test -d "$withval/lib" | |
1364 | then | |
1365 | liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib" | |
1366 | fi | |
1367 | if test -d "$withval/include" | |
1368 | then | |
1369 | liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include" | |
1370 | fi | |
1371 | fi | |
1372 | if test "x$withval" = "xno" | |
1373 | then | |
1374 | AC_MSG_ERROR("liboconfig is required") | |
1375 | fi | |
1376 | ], | |
1377 | [ | |
1378 | with_liboconfig="yes" | |
1379 | ]) | |
1380 | ||
1381 | save_LDFLAGS="$LDFLAGS" | |
1382 | save_CPPFLAGS="$CPPFLAGS" | |
1383 | LDFLAGS="$liboconfig_LDFLAGS" | |
1384 | CPPFLAGS="$liboconfig_CPPFLAGS" | |
1385 | AC_CHECK_LIB(oconfig, oconfig_parse_fh, | |
1386 | [ | |
1387 | with_liboconfig="yes" | |
1388 | with_own_liboconfig="no" | |
1389 | ], | |
1390 | [ | |
1391 | with_liboconfig="yes" | |
1392 | with_own_liboconfig="yes" | |
1393 | LDFLAGS="$save_LDFLAGS" | |
1394 | CPPFLAGS="$save_CPPFLAGS" | |
1395 | ]) | |
1396 | ||
1397 | AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes") | |
1398 | if test "x$with_own_liboconfig" = "xyes" | |
1399 | then | |
1400 | with_liboconfig="yes (shipped version)" | |
1401 | fi | |
1402 | ||
6997fb33 FF |
1403 | #with_liboping="yes" |
1404 | with_own_liboping="no" | |
1405 | liboping_LDFLAGS="$LDFLAGS" | |
1406 | liboping_CPPFLAGS="$CPPFLAGS" | |
1407 | AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])], | |
1408 | [ | |
1409 | if test "x$withval" != "xno" && test "x$withval" != "xyes" | |
1410 | then | |
1411 | if test -d "$withval/lib" | |
1412 | then | |
1413 | liboping_LDFLAGS="$LDFLAGS -L$withval/lib" | |
1414 | fi | |
1415 | if test -d "$withval/include" | |
1416 | then | |
1417 | liboping_CPPFLAGS="$CPPFLAGS -I$withval/include" | |
1418 | fi | |
1419 | fi | |
1420 | if test "x$withval" = "xno" | |
1421 | then | |
1422 | with_liboping="no" | |
1423 | with_own_liboping="no" | |
fb713675 SH |
1424 | else if test "x$withval" = "xyes" |
1425 | then | |
1426 | with_liboping="yes" | |
1427 | fi; fi | |
6997fb33 FF |
1428 | ], |
1429 | [ | |
6997fb33 FF |
1430 | with_liboping="yes" |
1431 | ]) | |
1432 | ||
1433 | if test "x$with_liboping" = "xyes" | |
1434 | then | |
1435 | save_LDFLAGS="$LDFLAGS" | |
1436 | save_CPPFLAGS="$CPPFLAGS" | |
1437 | LDFLAGS="$liboping_LDFLAGS" | |
1438 | CPPFLAGS="$liboping_CPPFLAGS" | |
1439 | AC_CHECK_LIB(oping, ping_construct, | |
1440 | [ | |
1441 | with_liboping="yes" | |
1442 | with_own_liboping="no" | |
1443 | ], | |
1444 | [ | |
1445 | with_liboping="yes" | |
1446 | with_own_liboping="yes" | |
1447 | LDFLAGS="$save_LDFLAGS" | |
1448 | CPPFLAGS="$save_CPPFLAGS" | |
1449 | ]) | |
1450 | fi | |
1451 | AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes") | |
1452 | AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes") | |
6997fb33 | 1453 | |
dd7a9bc9 FF |
1454 | AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])], |
1455 | [ | |
1456 | if test "x$withval" != "xno" && test "x$withval" != "xyes" | |
1457 | then | |
1458 | LDFLAGS="$LDFLAGS -L$withval/lib" | |
1459 | CPPFLAGS="$CPPFLAGS -I$withval/include" | |
1460 | with_libpcap="yes" | |
fb713675 SH |
1461 | else |
1462 | with_libpcap="$withval" | |
dd7a9bc9 FF |
1463 | fi |
1464 | ], | |
1465 | [ | |
1466 | with_libpcap="yes" | |
1467 | ]) | |
1468 | if test "x$with_libpcap" = "xyes" | |
1469 | then | |
1470 | AC_CHECK_LIB(pcap, pcap_open_live, | |
1471 | [ | |
1472 | AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).]) | |
1473 | ], [with_libpcap="no (libpcap not found)"]) | |
1474 | fi | |
1475 | if test "x$with_libpcap" = "xyes" | |
1476 | then | |
1477 | AC_CHECK_HEADERS(pcap.h, | |
1478 | [ | |
1479 | AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.]) | |
1480 | ], [with_libpcap="no (pcap.h not found)"]) | |
1481 | fi | |
1482 | if test "x$with_libpcap" = "xyes" | |
1483 | then | |
1484 | collect_libpcap=1 | |
1485 | else | |
1486 | collect_libpcap=0 | |
1487 | fi | |
92f43553 | 1488 | AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap], |
dd7a9bc9 | 1489 | [Wether or not to use the pcap library]) |
92f43553 | 1490 | AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes") |
dd7a9bc9 | 1491 | |
a1dd93a2 OK |
1492 | AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])], |
1493 | [ | |
1494 | if test "x$withval" != "xno" && test "x$withval" != "xyes" | |
1495 | then | |
1496 | LDFLAGS="$LDFLAGS -L$withval/lib" | |
1497 | CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE" | |
1498 | with_libesmtp="yes" | |
1499 | else | |
1500 | with_libesmtp="$withval" | |
1501 | fi | |
1502 | ], | |
1503 | [ | |
1504 | with_libesmtp="yes" | |
1505 | ]) | |
1506 | if test "x$with_libesmtp" = "xyes" | |
1507 | then | |
1508 | AC_CHECK_LIB(esmtp, smtp_create_session, | |
1509 | [ | |
1510 | AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).]) | |
1511 | ], [with_libesmtp="no (libesmtp not found)"]) | |
1512 | fi | |
1513 | if test "x$with_libesmtp" = "xyes" | |
1514 | then | |
1515 | AC_CHECK_HEADERS(libesmtp.h, | |
1516 | [ | |
1517 | AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.]) | |
1518 | ], [with_libesmtp="no (libesmtp.h not found)"]) | |
1519 | fi | |
1520 | if test "x$with_libesmtp" = "xyes" | |
1521 | then | |
1522 | collect_libesmtp=1 | |
1523 | else | |
1524 | collect_libesmtp=0 | |
1525 | fi | |
1526 | AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp], | |
1527 | [Wether or not to use the esmtp library]) | |
1528 | AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes") | |
1529 | ||
3acac9b0 | 1530 | perl_interpreter="perl" |
a432a981 FF |
1531 | AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])], |
1532 | [ | |
1533 | if test "x$withval" != "xno" && test "x$withval" != "xyes" | |
1534 | then | |
1535 | LDFLAGS="$LDFLAGS -L$withval/lib" | |
1536 | CPPFLAGS="$CPPFLAGS -I$withval/include" | |
3acac9b0 | 1537 | perl_interpreter="$withval/bin/perl" |
a432a981 | 1538 | with_libperl="yes" |
fb713675 SH |
1539 | else |
1540 | with_libperl="$withval" | |
a432a981 FF |
1541 | fi |
1542 | ], | |
1543 | [ | |
1544 | with_libperl="yes" | |
1545 | ]) | |
a459afe5 | 1546 | |
f1075c22 SH |
1547 | AC_MSG_CHECKING([for perl]) |
1548 | perl_interpreter=`which "$perl_interpreter" 2> /dev/null` | |
1549 | if test -x "$perl_interpreter" | |
1550 | then | |
1551 | AC_MSG_RESULT([yes]) | |
1552 | else | |
1553 | perl_interpreter="" | |
1554 | AC_MSG_RESULT([no]) | |
1555 | fi | |
1556 | ||
a459afe5 SH |
1557 | AC_SUBST(PERL, "$perl_interpreter") |
1558 | ||
d45c77ca FF |
1559 | if test "x$with_libperl" = "xyes" \ |
1560 | && test -n "$perl_interpreter" | |
a432a981 FF |
1561 | then |
1562 | SAVE_CFLAGS=$CFLAGS | |
1563 | SAVE_LDFLAGS=$LDFLAGS | |
3acac9b0 FF |
1564 | PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts` |
1565 | PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts` | |
1566 | CFLAGS="$CFLAGS $PERL_CFLAGS" | |
1567 | LDFLAGS="$LDFLAGS $PERL_LDFLAGS" | |
a432a981 FF |
1568 | |
1569 | AC_CACHE_CHECK([for libperl], | |
1570 | [have_libperl], | |
1571 | AC_LINK_IFELSE( | |
1572 | AC_LANG_PROGRAM( | |
1573 | [[ | |
1574 | #include <EXTERN.h> | |
1575 | #include <perl.h> | |
1576 | #include <XSUB.h> | |
1577 | ]], | |
1578 | [[ | |
1579 | PerlInterpreter *perl = NULL; | |
1580 | Perl_load_module (perl, PERL_LOADMOD_NOIMPORT, | |
3acac9b0 | 1581 | newSVpv ("Collectd::Plugin::FooBar", 24), |
a432a981 FF |
1582 | Nullsv); |
1583 | ]]), | |
1584 | [have_libperl="yes"], | |
1585 | [have_libperl="no"] | |
1586 | ) | |
1587 | ) | |
1588 | ||
1589 | if test "x$have_libperl" = "xyes" | |
1590 | then | |
1591 | AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.]) | |
3acac9b0 FF |
1592 | AC_SUBST(PERL_CFLAGS) |
1593 | AC_SUBST(PERL_LDFLAGS) | |
a432a981 FF |
1594 | else |
1595 | with_libperl="no" | |
1596 | fi | |
1597 | ||
1598 | CFLAGS=$SAVE_CFLAGS | |
1599 | LDFLAGS=$SAVE_LDFLAGS | |
f1075c22 SH |
1600 | else if test -z "$perl_interpreter"; then |
1601 | with_libperl="no (no perl interpreter found)" | |
1602 | have_libperl="no" | |
1603 | fi; fi | |
a432a981 FF |
1604 | AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes") |
1605 | ||
28785769 SH |
1606 | if test "x$with_libperl" = "xyes" |
1607 | then | |
1608 | SAVE_CFLAGS=$CFLAGS | |
1609 | SAVE_LDFLAGS=$LDFLAGS | |
1610 | CFLAGS="$CFLAGS $PERL_CFLAGS" | |
1611 | LDFLAGS="$LDFLAGS $PERL_LDFLAGS" | |
1612 | ||
1613 | AC_CACHE_CHECK([if perl supports ithreads], | |
1614 | [have_perl_ithreads], | |
1615 | AC_LINK_IFELSE( | |
1616 | AC_LANG_PROGRAM( | |
1617 | [[ | |
1618 | #include <EXTERN.h> | |
1619 | #include <perl.h> | |
1620 | #include <XSUB.h> | |
1621 | ||
1622 | #if !defined(USE_ITHREADS) | |
1623 | # error "Perl does not support ithreads!" | |
1624 | #endif /* !defined(USE_ITHREADS) */ | |
1625 | ]], | |
1626 | [[ ]]), | |
1627 | [have_perl_ithreads="yes"], | |
1628 | [have_perl_ithreads="no"] | |
1629 | ) | |
1630 | ) | |
1631 | ||
1632 | if test "x$have_perl_ithreads" = "xyes" | |
1633 | then | |
1634 | AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.]) | |
1635 | fi | |
1636 | ||
1637 | CFLAGS=$SAVE_CFLAGS | |
1638 | LDFLAGS=$SAVE_LDFLAGS | |
1639 | fi | |
1640 | ||
6b93a8f0 SH |
1641 | if test "x$ac_system" = "xLinux" |
1642 | then | |
1643 | AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources]) | |
1644 | if test -z "$KERNEL_DIR" | |
1645 | then | |
1646 | KERNEL_DIR="/lib/modules/`uname -r`/source" | |
1647 | fi | |
1648 | fi | |
1649 | ||
1650 | with_own_libiptc="no" | |
8de91034 FF |
1651 | AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])], |
1652 | [ | |
1653 | if test "x$withval" != "xno" && test "x$withval" != "xyes" | |
1654 | then | |
1655 | LDFLAGS="$LDFLAGS -L$withval/lib" | |
1656 | CPPFLAGS="$CPPFLAGS -I$withval/include" | |
1657 | with_libiptc="yes" | |
fb713675 SH |
1658 | else |
1659 | with_libiptc="$withval" | |
8de91034 FF |
1660 | fi |
1661 | ], | |
1662 | [ | |
7f45f5b3 | 1663 | if test "x$ac_system" = "xLinux" |
8de91034 FF |
1664 | then |
1665 | with_libiptc="yes" | |
1666 | else | |
1667 | with_libiptc="no (Linux only)" | |
1668 | fi | |
1669 | ]) | |
1670 | if test "x$with_libiptc" = "xyes" | |
1671 | then | |
1672 | AC_CHECK_LIB(iptc, iptc_init, | |
1673 | [ | |
1674 | AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).]) | |
6b93a8f0 SH |
1675 | ], |
1676 | [ | |
1677 | with_libiptc="yes" | |
1678 | with_own_libiptc="yes" | |
1679 | ]) | |
8de91034 | 1680 | fi |
6b93a8f0 | 1681 | if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes" |
8de91034 FF |
1682 | then |
1683 | AC_CHECK_HEADERS(libiptc/libiptc.h, | |
1684 | [ | |
1685 | AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.]) | |
6b93a8f0 SH |
1686 | ], |
1687 | [ | |
1688 | with_libiptc="yes" | |
1689 | with_own_libiptc="yes" | |
1690 | ]) | |
8de91034 FF |
1691 | fi |
1692 | if test "x$with_libiptc" = "xyes" | |
1693 | then | |
6b93a8f0 SH |
1694 | SAVE_CFLAGS=$CFLAGS |
1695 | CFLAGS="$CFLAGS -I$KERNEL_DIR/include" | |
1696 | ||
1697 | AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [], | |
1698 | [ | |
1699 | with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)" | |
1700 | with_own_libiptc="no" | |
1701 | ], | |
1702 | [ | |
1703 | #include "$srcdir/src/libiptc/ipt_kernel_headers.h" | |
1704 | ]) | |
1705 | ||
1706 | CFLAGS=$SAVE_CFLAGS | |
8de91034 FF |
1707 | fi |
1708 | AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes") | |
6b93a8f0 SH |
1709 | AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes") |
1710 | if test "x$with_own_libiptc" = "xyes" | |
1711 | then | |
1712 | AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.]) | |
1713 | fi | |
8de91034 | 1714 | |
c39428ae FF |
1715 | with_snmp_config="net-snmp-config" |
1716 | with_snmp_cflags="" | |
1717 | with_snmp_libs="" | |
c02ba630 FF |
1718 | AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])], |
1719 | [ | |
7f45f5b3 | 1720 | if test "x$withval" = "xno" |
c39428ae FF |
1721 | then |
1722 | with_libnetsnmp="no" | |
ae03d749 | 1723 | else if test "x$withval" = "xyes" |
c02ba630 | 1724 | then |
c02ba630 | 1725 | with_libnetsnmp="yes" |
c39428ae | 1726 | else |
7f45f5b3 | 1727 | if test -x "$withval" |
c39428ae FF |
1728 | then |
1729 | with_snmp_config="$withval" | |
1730 | with_libnetsnmp="yes" | |
1731 | else | |
1732 | with_snmp_config="$withval/bin/net-snmp-config" | |
1733 | with_libnetsnmp="yes" | |
1734 | fi | |
1735 | fi; fi | |
c02ba630 FF |
1736 | ], |
1737 | [with_libnetsnmp="yes"]) | |
1738 | if test "x$with_libnetsnmp" = "xyes" | |
1739 | then | |
00ff99d8 | 1740 | with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null` |
c39428ae FF |
1741 | snmp_config_status=$? |
1742 | ||
1743 | if test $snmp_config_status -ne 0 | |
1744 | then | |
1745 | with_libnetsnmp="no ($with_snmp_config failed)" | |
1746 | else | |
06c09fee FF |
1747 | SAVE_CPPFLAGS="$CPPFLAGS" |
1748 | CPPFLAGS="$CPPFLAGS $with_snmp_cflags" | |
c39428ae FF |
1749 | |
1750 | AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"]) | |
1751 | ||
06c09fee | 1752 | CPPFLAGS="$SAVE_CPPFLAGS" |
c39428ae | 1753 | fi |
c02ba630 FF |
1754 | fi |
1755 | if test "x$with_libnetsnmp" = "xyes" | |
1756 | then | |
00ff99d8 | 1757 | with_snmp_libs=`$with_snmp_config --libs 2>/dev/null` |
c39428ae FF |
1758 | snmp_config_status=$? |
1759 | ||
1760 | if test $snmp_config_status -ne 0 | |
1761 | then | |
1762 | with_libnetsnmp="no ($with_snmp_config failed)" | |
1763 | else | |
1764 | AC_CHECK_LIB(netsnmp, init_snmp, | |
1765 | [with_libnetsnmp="yes"], | |
1766 | [with_libnetsnmp="no (libnetsnmp not found)"], | |
1767 | [$with_snmp_libs]) | |
1768 | fi | |
1769 | fi | |
00ff99d8 | 1770 | if test "x$with_libnetsnmp" = "xyes" |
c39428ae FF |
1771 | then |
1772 | BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags" | |
1773 | BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs" | |
1774 | AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS) | |
1775 | AC_SUBST(BUILD_WITH_LIBSNMP_LIBS) | |
c02ba630 FF |
1776 | fi |
1777 | AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes") | |
1778 | ||
6106d8df SH |
1779 | PKG_CHECK_MODULES([LIBNOTIFY], [libnotify], |
1780 | [with_libnotify="yes"], | |
1781 | [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"]) | |
1782 | ||
3fc0feb6 FF |
1783 | with_upsclient_config="libupsclient-config" |
1784 | with_upsclient_cflags="" | |
1785 | with_upsclient_libs="" | |
bc2d9402 FF |
1786 | AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])], |
1787 | [ | |
3fc0feb6 | 1788 | if test "x$withval" = "xno" |
bc2d9402 | 1789 | then |
3fc0feb6 FF |
1790 | with_libupsclient="no" |
1791 | else | |
395e2cc2 | 1792 | if test "x$withval" != "xyes" |
3fc0feb6 | 1793 | then |
a3cd4630 | 1794 | if test -f "$withval" && test -x "$withval"; |
1398c68c FF |
1795 | then |
1796 | with_upsclient_config="$withval" | |
1797 | else | |
1798 | with_upsclient_config="$withval/bin/libupsclient-config" | |
1799 | fi | |
3fc0feb6 | 1800 | fi |
a3cd4630 | 1801 | with_libupsclient="yes" |
bc2d9402 FF |
1802 | fi |
1803 | ], | |
1804 | [ | |
1805 | with_libupsclient="yes" | |
1806 | ]) | |
1807 | if test "x$with_libupsclient" = "xyes" | |
3fc0feb6 FF |
1808 | then |
1809 | with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null` | |
1810 | upsclient_config_status=$? | |
1811 | ||
1812 | if test $upsclient_config_status -ne 0 | |
1813 | then | |
1398c68c | 1814 | with_libupsclient="no ($with_upsclient_config failed)" |
3fc0feb6 FF |
1815 | fi |
1816 | fi | |
1817 | if test "x$with_libupsclient" = "xyes" | |
1398c68c | 1818 | then |
06c09fee FF |
1819 | SAVE_CPPFLAGS="$CPPFLAGS" |
1820 | CPPFLAGS="$CPPFLAGS $with_upsclient_cflags" | |
1398c68c FF |
1821 | |
1822 | AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"]) | |
1823 | ||
06c09fee | 1824 | CPPFLAGS="$SAVE_CPPFLAGS" |
1398c68c FF |
1825 | fi |
1826 | if test "x$with_libupsclient" = "xyes" | |
3fc0feb6 FF |
1827 | then |
1828 | with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null` | |
1829 | upsclient_config_status=$? | |
1830 | ||
1831 | if test $upsclient_config_status -ne 0 | |
1832 | then | |
1398c68c | 1833 | with_libupsclient="no ($with_upsclient_config failed)" |
3fc0feb6 FF |
1834 | fi |
1835 | fi | |
1836 | if test "x$with_libupsclient" = "xyes" | |
bc2d9402 FF |
1837 | then |
1838 | AC_CHECK_LIB(upsclient, upscli_connect, | |
1839 | [ | |
3fc0feb6 FF |
1840 | BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags" |
1841 | BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs" | |
1842 | AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS) | |
1843 | AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS) | |
1844 | ], | |
1845 | [ | |
1398c68c FF |
1846 | with_libupsclient="no (symbol 'upscli_connect' not found)" |
1847 | ], [$with_upsclient_libs]) | |
bc2d9402 | 1848 | fi |
8f6c03d5 FF |
1849 | if test "x$with_libupsclient" = "xyes" |
1850 | then | |
06c09fee FF |
1851 | SAVE_CPPFLAGS="$CPPFLAGS" |
1852 | CPPFLAGS="$CPPFLAGS $with_upsclient_cflags" | |
1853 | ||
7f45f5b3 | 1854 | AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [], |
8f6c03d5 FF |
1855 | [#include <stdlib.h> |
1856 | #include <stdio.h> | |
1857 | #include <upsclient.h>]) | |
06c09fee FF |
1858 | |
1859 | CPPFLAGS="$SAVE_CPPFLAGS" | |
8f6c03d5 | 1860 | fi |
bc2d9402 FF |
1861 | AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes") |
1862 | ||
558a6a1c FF |
1863 | ### BEGIN of check for libxmms ### |
1864 | with_xmms_config="xmms-config" | |
558a6a1c FF |
1865 | with_xmms_cflags="" |
1866 | with_xmms_libs="" | |
1867 | AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])], | |
1868 | [ | |
d45c77ca FF |
1869 | if test "x$withval" != "xno" \ |
1870 | && test "x$withval" != "xyes" | |
558a6a1c | 1871 | then |
a3cd4630 FF |
1872 | if test -f "$withval" && test -x "$withval"; |
1873 | then | |
1874 | with_xmms_config="$withval" | |
1875 | else if test -x "$withval/bin/xmms-config" | |
558a6a1c FF |
1876 | then |
1877 | with_xmms_config="$withval/bin/xmms-config" | |
a3cd4630 FF |
1878 | fi; fi |
1879 | with_libxmms="yes" | |
1880 | else if test "x$withval" = "xno" | |
558a6a1c FF |
1881 | then |
1882 | with_libxmms="no" | |
1883 | else | |
1884 | with_libxmms="yes" | |
a3cd4630 | 1885 | fi; fi |
558a6a1c FF |
1886 | ], |
1887 | [ | |
1888 | with_libxmms="yes" | |
1889 | ]) | |
1890 | if test "x$with_libxmms" = "xyes" | |
1891 | then | |
1892 | with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null` | |
1893 | xmms_config_status=$? | |
1894 | ||
1895 | if test $xmms_config_status -ne 0 | |
1896 | then | |
1897 | with_libxmms="no" | |
1898 | fi | |
1899 | fi | |
1900 | if test "x$with_libxmms" = "xyes" | |
1901 | then | |
1902 | with_xmms_libs=`$with_xmms_config --libs 2>/dev/null` | |
1903 | xmms_config_status=$? | |
1904 | ||
1905 | if test $xmms_config_status -ne 0 | |
1906 | then | |
1907 | with_libxmms="no" | |
1908 | fi | |
1909 | fi | |
1910 | if test "x$with_libxmms" = "xyes" | |
1911 | then | |
1912 | AC_CHECK_LIB(xmms, xmms_remote_get_info, | |
1913 | [ | |
1914 | BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags" | |
1915 | BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs" | |
1916 | AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS) | |
1917 | AC_SUBST(BUILD_WITH_LIBXMMS_LIBS) | |
1918 | ], | |
1919 | [ | |
1920 | with_libxmms="no" | |
1921 | ], | |
1922 | [$with_xmms_libs]) | |
1923 | fi | |
1924 | with_libxmms_numeric=0 | |
1925 | if test "x$with_libxmms" = "xyes" | |
1926 | then | |
1927 | with_libxmms_numeric=1 | |
1928 | fi | |
1929 | AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).]) | |
1930 | AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes") | |
1931 | ### END of check for libxmms ### | |
1932 | ||
c1406acc FF |
1933 | with_libnetlink_cflags="" |
1934 | with_libnetlink_libs="-lnetlink" | |
1935 | AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])], | |
1936 | [ | |
1937 | echo "libnetlink: withval = $withval" | |
1938 | if test "x$withval" = "xyes" | |
1939 | then | |
1940 | with_libnetlink="yes" | |
1941 | else if test "x$withval" = "xno" | |
1942 | then | |
1943 | with_libnetlink="no" | |
1944 | else | |
1945 | if test -d "$withval/include" | |
1946 | then | |
1947 | with_libnetlink_cflags="-I$withval/include" | |
1948 | with_libnetlink_libs="-L$withval/lib -lnetlink" | |
1949 | with_libnetlink="yes" | |
1950 | else | |
1951 | AC_MSG_ERROR("no such directory: $withval/include") | |
1952 | fi | |
1953 | fi; fi | |
1954 | ], | |
1955 | [ | |
1956 | if test "x$ac_system" = "xLinux" | |
1957 | then | |
1958 | with_libnetlink="yes" | |
1959 | else | |
1960 | with_libnetlink="no (Linux only library)" | |
1961 | fi | |
1962 | ]) | |
1963 | if test "x$with_libnetlink" = "xyes" | |
1964 | then | |
1965 | SAVE_CFLAGS=$CFLAGS | |
1966 | CFLAGS="$CFLAGS $with_libnetlink_cflags" | |
1967 | ||
48bc4be8 FF |
1968 | with_libnetlink="no (libnetlink.h not found)" |
1969 | ||
1970 | AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h, | |
1971 | [ | |
1972 | with_libnetlink="yes" | |
1973 | break | |
1974 | ], [], | |
c1406acc FF |
1975 | [#include <stdio.h> |
1976 | #include <sys/types.h> | |
57825ea7 | 1977 | #include <asm/types.h> |
c1406acc FF |
1978 | #include <sys/socket.h> |
1979 | #include <linux/netlink.h> | |
1980 | #include <linux/rtnetlink.h>]) | |
5d26a660 FF |
1981 | AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [], |
1982 | [#include <stdio.h> | |
1983 | #include <sys/types.h> | |
1984 | #include <asm/types.h> | |
1985 | #include <sys/socket.h>]) | |
1986 | ||
1987 | AC_COMPILE_IFELSE( | |
1988 | [#include <stdio.h> | |
1989 | #include <sys/types.h> | |
1990 | #include <asm/types.h> | |
1991 | #include <sys/socket.h> | |
1992 | #include <linux/netlink.h> | |
1993 | #include <linux/rtnetlink.h> | |
1994 | ||
1995 | int main (void) | |
1996 | { | |
1997 | int retval = TCA_STATS2; | |
1998 | return (retval); | |
1999 | }], | |
2000 | [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])] | |
2001 | []); | |
2002 | ||
2003 | AC_COMPILE_IFELSE( | |
2004 | [#include <stdio.h> | |
2005 | #include <sys/types.h> | |
2006 | #include <asm/types.h> | |
2007 | #include <sys/socket.h> | |
2008 | #include <linux/netlink.h> | |
2009 | #include <linux/rtnetlink.h> | |
2010 | ||
2011 | int main (void) | |
2012 | { | |
2013 | int retval = TCA_STATS; | |
2014 | return (retval); | |
2015 | }], | |
2016 | [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])] | |
2017 | []); | |
c1406acc FF |
2018 | |
2019 | CFLAGS="$SAVE_CFLAGS" | |
2020 | fi | |
2021 | if test "x$with_libnetlink" = "xyes" | |
2022 | then | |
2023 | AC_CHECK_LIB(netlink, rtnl_open, | |
2024 | [with_libnetlink="yes"], | |
2025 | [with_libnetlink="no (symbol 'rtnl_open' not found)"], | |
2026 | [$with_libnetlink_libs]) | |
2027 | fi | |
2028 | if test "x$with_libnetlink" = "xyes" | |
2029 | then | |
05ea4f3f FF |
2030 | BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags" |
2031 | BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs" | |
c1406acc FF |
2032 | AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS) |
2033 | AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS) | |
2034 | fi | |
2035 | AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes") | |
5d99fadf | 2036 | |
249d5776 FF |
2037 | with_libopenipmipthread="yes" |
2038 | with_libopenipmipthread_cflags="" | |
2039 | with_libopenipmipthread_libs="" | |
2040 | ||
2041 | AC_MSG_CHECKING([for pkg-config]) | |
2042 | temp_result="no" | |
2043 | if test "x$PKG_CONFIG" = "x" | |
2044 | then | |
2045 | with_libopenipmipthread="no" | |
2046 | temp_result="no" | |
2047 | else | |
2048 | temp_result="$PKG_CONFIG" | |
2049 | fi | |
2050 | AC_MSG_RESULT([$temp_result]) | |
2051 | ||
2052 | if test "x$with_libopenipmipthread" = "xyes" | |
2053 | then | |
2054 | AC_MSG_CHECKING([for libOpenIPMIpthread]) | |
2055 | $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null | |
2056 | if test "$?" != "0" | |
2057 | then | |
2058 | with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)" | |
2059 | fi | |
2060 | AC_MSG_RESULT([$with_libopenipmipthread]) | |
2061 | fi | |
2062 | ||
2063 | if test "x$with_libopenipmipthread" = "xyes" | |
2064 | then | |
2065 | AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS]) | |
2066 | temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`" | |
2067 | if test "$?" = "0" | |
2068 | then | |
2069 | with_libopenipmipthread_cflags="$temp_result" | |
2070 | else | |
2071 | with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)" | |
2072 | temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed" | |
2073 | fi | |
2074 | AC_MSG_RESULT([$temp_result]) | |
2075 | fi | |
2076 | ||
2077 | if test "x$with_libopenipmipthread" = "xyes" | |
2078 | then | |
2079 | AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS]) | |
2080 | temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`" | |
2081 | if test "$?" = "0" | |
2082 | then | |
2083 | with_libopenipmipthread_ldflags="$temp_result" | |
2084 | else | |
2085 | with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)" | |
2086 | temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed" | |
2087 | fi | |
2088 | AC_MSG_RESULT([$temp_result]) | |
2089 | fi | |
2090 | ||
2091 | if test "x$with_libopenipmipthread" = "xyes" | |
2092 | then | |
2093 | SAVE_CPPFLAGS="$CPPFLAGS" | |
2094 | CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags" | |
2095 | ||
2096 | AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h, | |
2097 | [with_libopenipmipthread="yes"], | |
2098 | [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"], | |
2099 | [#include <OpenIPMI/ipmiif.h> | |
2100 | #include <OpenIPMI/ipmi_err.h> | |
2101 | #include <OpenIPMI/ipmi_posix.h> | |
2102 | #include <OpenIPMI/ipmi_conn.h> | |
2103 | ]) | |
2104 | ||
2105 | CPPFLAGS="$SAVE_CPPFLAGS" | |
2106 | fi | |
2107 | ||
2108 | if test "x$with_libopenipmipthread" = "xyes" | |
2109 | then | |
2110 | BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags" | |
2111 | BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags" | |
2112 | AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS) | |
2113 | AC_SUBST(BUILD_WITH_OPENIPMI_LIBS) | |
2114 | fi | |
2115 | ||
f69ce75e | 2116 | dnl Check for libvirt and libxml2 libraries. |
c6be63a7 FF |
2117 | with_libxml2="no (pkg-config isn't available)" |
2118 | with_libxml2_cflags="" | |
2119 | with_libxml2_ldflags="" | |
2120 | with_libvirt="no (pkg-config isn't available)" | |
df26df90 FF |
2121 | with_libvirt_cflags="" |
2122 | with_libvirt_ldflags="" | |
c6be63a7 FF |
2123 | if test "x$PKG_CONFIG" != "x" |
2124 | then | |
2125 | pkg-config --exists 'libxml-2.0' 2>/dev/null | |
2126 | if test "$?" = "0" | |
2127 | then | |
2128 | with_libxml2="yes" | |
2129 | else | |
2130 | with_libxml2="no (pkg-config doesn't know library)" | |
2131 | fi | |
2132 | ||
2133 | pkg-config --exists libvirt 2>/dev/null | |
2134 | if test "$?" = "0" | |
2135 | then | |
2136 | with_libvirt="yes" | |
2137 | else | |
2138 | with_libvirt="no (pkg-config doesn't know library)" | |
2139 | fi | |
2140 | fi | |
df26df90 FF |
2141 | if test "x$with_libxml2" = "xyes" |
2142 | then | |
c6be63a7 FF |
2143 | with_libxml2_cflags="`pkg-config --cflags libxml-2.0`" |
2144 | if test $? -ne 0 | |
2145 | then | |
2146 | with_libxml2="no" | |
2147 | fi | |
2148 | with_libxml2_ldflags="`pkg-config --libs libxml-2.0`" | |
2149 | if test $? -ne 0 | |
2150 | then | |
2151 | with_libxml2="no" | |
2152 | fi | |
2153 | fi | |
2154 | if test "x$with_libxml2" = "xyes" | |
2155 | then | |
2156 | SAVE_CPPFLAGS="$CPPFLAGS" | |
2157 | CPPFLAGS="$CPPFLAGS $with_libxml2_cflags" | |
2158 | ||
2159 | AC_CHECK_HEADERS(libxml/parser.h, [], | |
2160 | [with_libxml2="no (libxml/parser.h not found)"]) | |
2161 | ||
2162 | CPPFLAGS="$SAVE_CPPFLAGS" | |
2163 | fi | |
2164 | if test "x$with_libxml2" = "xyes" | |
2165 | then | |
2166 | SAVE_CFLAGS="$CFLAGS" | |
ae6f041d | 2167 | SAVE_LDFLAGS="$LDFLAGS" |
c6be63a7 FF |
2168 | |
2169 | CFLAGS="$CFLAGS $with_libxml2_cflags" | |
2170 | LDFLAGS="$LDFLAGS $with_libxml2_ldflags" | |
2171 | ||
2172 | AC_CHECK_LIB(xml2, xmlXPathEval, | |
2173 | [with_libxml2="yes"], | |
2174 | [with_libxml2="no (symbol xmlXPathEval not found)"]) | |
2175 | ||
2176 | CFLAGS="$SAVE_CFLAGS" | |
2177 | LDFLAGS="$SAVE_LDFLAGS" | |
2178 | fi | |
2179 | dnl Add the right compiler flags and libraries. | |
2180 | if test "x$with_libxml2" = "xyes"; then | |
2181 | BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags" | |
2182 | BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags" | |
2183 | AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS) | |
2184 | AC_SUBST(BUILD_WITH_LIBXML2_LIBS) | |
2185 | fi | |
2186 | if test "x$with_libvirt" = "xyes" | |
2187 | then | |
df26df90 FF |
2188 | with_libvirt_cflags="`pkg-config --cflags libvirt`" |
2189 | if test $? -ne 0 | |
2190 | then | |
2191 | with_libvirt="no" | |
2192 | fi | |
2193 | with_libvirt_ldflags="`pkg-config --libs libvirt`" | |
2194 | if test $? -ne 0 | |
2195 | then | |
2196 | with_libvirt="no" | |
2197 | fi | |
2198 | fi | |
2199 | if test "x$with_libvirt" = "xyes" | |
c6be63a7 FF |
2200 | then |
2201 | SAVE_CPPFLAGS="$CPPFLAGS" | |
2202 | CPPFLAGS="$CPPFLAGS $with_libvirt_cflags" | |
2203 | ||
2204 | AC_CHECK_HEADERS(libvirt/libvirt.h, [], | |
2205 | [with_libvirt="no (libvirt/libvirt.h not found)"]) | |
2206 | ||
2207 | CPPFLAGS="$SAVE_CPPFLAGS" | |
2208 | fi | |
2209 | if test "x$with_libvirt" = "xyes" | |
df26df90 FF |
2210 | then |
2211 | SAVE_CFLAGS="$CFLAGS" | |
ae6f041d | 2212 | SAVE_LDFLAGS="$LDFLAGS" |
df26df90 FF |
2213 | |
2214 | CFLAGS="$CFLAGS $with_libvirt_cflags" | |
2215 | LDFLAGS="$LDFLAGS $with_libvirt_ldflags" | |
2216 | ||
c6be63a7 | 2217 | AC_CHECK_LIB(virt, virDomainBlockStats, |
df26df90 FF |
2218 | [with_libvirt="yes"], |
2219 | [with_libvirt="no (symbol virDomainBlockStats not found)"]) | |
2220 | ||
2221 | CFLAGS="$SAVE_CFLAGS" | |
2222 | LDFLAGS="$SAVE_LDFLAGS" | |
f69ce75e RJ |
2223 | fi |
2224 | dnl Add the right compiler flags and libraries. | |
2225 | if test "x$with_libvirt" = "xyes"; then | |
c6be63a7 FF |
2226 | BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags" |
2227 | BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags" | |
2228 | AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS) | |
2229 | AC_SUBST(BUILD_WITH_LIBVIRT_LIBS) | |
f69ce75e RJ |
2230 | fi |
2231 | ||
2232 | dnl End of check for libvirt and libxml2 libraries. | |
2233 | ||
86ca149a FF |
2234 | # Check for enabled/disabled features |
2235 | # | |
6e765a02 | 2236 | |
3c12e8a6 NW |
2237 | # AC_COLLECTD(name, enable/disable, info-text, feature/module) |
2238 | # ------------------------------------------------------------ | |
2239 | dnl | |
2240 | m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))]) | |
2241 | dnl | |
2242 | AC_DEFUN( | |
2243 | [AC_COLLECTD], | |
2244 | [ | |
2245 | m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl | |
2246 | m4_if( | |
2247 | [$2], | |
2248 | [enable], | |
2249 | [dnl | |
2250 | m4_define([EnDis],[disabled])dnl | |
2251 | m4_define([YesNo],[no])dnl | |
2252 | ],dnl | |
2253 | [m4_if( | |
2254 | [$2], | |
2255 | [disable], | |
2256 | [dnl | |
2257 | m4_define([EnDis],[enabled])dnl | |
2258 | m4_define([YesNo],[yes])dnl | |
2259 | ], | |
2260 | [dnl | |
2261 | AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl | |
2262 | ]dnl | |
2263 | )]dnl | |
2264 | )dnl | |
2265 | m4_if([$3], [feature], [], | |
2266 | [m4_if( | |
2267 | [$3], [module], [], | |
2268 | [dnl | |
2269 | AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl | |
2270 | ]dnl | |
2271 | )]dnl | |
2272 | )dnl | |
2273 | AC_ARG_ENABLE( | |
2274 | [$1], | |
2275 | AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]), | |
2276 | [], | |
2277 | enable_$1='[YesNo]'dnl | |
2278 | )# AC_ARG_ENABLE | |
2279 | if test "x$enable_$1" = "xno" | |
2280 | then | |
2281 | collectd_$1=0 | |
6e765a02 | 2282 | else |
3c12e8a6 | 2283 | if test "x$enable_$1" = "xyes" |
6e765a02 | 2284 | then |
3c12e8a6 | 2285 | collectd_$1=1 |
6e765a02 | 2286 | else |
3c12e8a6 NW |
2287 | AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.]) |
2288 | collectd_$1=1 | |
2289 | enable_$1='yes' | |
6e765a02 FF |
2290 | fi |
2291 | fi | |
3c12e8a6 NW |
2292 | AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4]) |
2293 | AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl | |
2294 | ]dnl | |
2295 | )# AC_COLLECTD(name, enable/disable, info-text, feature/module) | |
2296 | ||
a905d397 FF |
2297 | # AC_PLUGIN(name, default, info) |
2298 | # ------------------------------------------------------------ | |
2299 | dnl | |
2300 | AC_DEFUN( | |
2301 | [AC_PLUGIN], | |
2302 | [ | |
2303 | enable_plugin="no" | |
2304 | AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]), | |
2305 | [ | |
2306 | if test "x$enableval" = "xyes" | |
2307 | then | |
2308 | enable_plugin="yes" | |
2309 | else | |
2310 | enable_plugin="no" | |
2311 | fi | |
2312 | ], | |
2313 | [ | |
2314 | if test "x$2" = "xyes" | |
2315 | then | |
2316 | enable_plugin="yes" | |
2317 | else | |
2318 | enable_plugin="no" | |
2319 | fi | |
2320 | ]) | |
2321 | if test "x$enable_plugin" = "xyes" | |
2322 | then | |
2323 | AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.]) | |
2324 | fi | |
2325 | AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes") | |
2326 | enable_$1="$enable_plugin" | |
2327 | ] | |
2328 | )# AC_PLUGIN(name, default, info) | |
2329 | ||
3c12e8a6 NW |
2330 | m4_divert_once([HELP_ENABLE], [ |
2331 | collectd features:]) | |
a905d397 | 2332 | # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro. |
3c12e8a6 NW |
2333 | AC_COLLECTD([debug], [enable], [feature], [debugging]) |
2334 | AC_COLLECTD([daemon], [disable], [feature], [daemon mode]) | |
14740db4 | 2335 | AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux]) |
6e765a02 | 2336 | |
99ef5283 | 2337 | plugin_ascent="no" |
a905d397 FF |
2338 | plugin_battery="no" |
2339 | plugin_cpu="no" | |
2340 | plugin_cpufreq="no" | |
2341 | plugin_df="no" | |
2342 | plugin_disk="no" | |
2343 | plugin_entropy="no" | |
2344 | plugin_interface="no" | |
249d5776 | 2345 | plugin_ipmi="no" |
6d431b70 | 2346 | plugin_ipvs="no" |
a905d397 | 2347 | plugin_irq="no" |
553376a3 | 2348 | plugin_libvirt="no" |
a905d397 FF |
2349 | plugin_load="no" |
2350 | plugin_memory="no" | |
3fc0feb6 | 2351 | plugin_multimeter="no" |
a905d397 | 2352 | plugin_nfs="no" |
28785769 | 2353 | plugin_perl="no" |
a905d397 FF |
2354 | plugin_processes="no" |
2355 | plugin_serial="no" | |
2356 | plugin_swap="no" | |
2357 | plugin_tape="no" | |
03b7ec00 | 2358 | plugin_tcpconns="no" |
2004f542 | 2359 | plugin_thermal="no" |
a905d397 | 2360 | plugin_users="no" |
7b6abfd0 | 2361 | plugin_vmem="no" |
a905d397 FF |
2362 | plugin_vserver="no" |
2363 | plugin_wireless="no" | |
2364 | ||
2365 | # Linux | |
2366 | if test "x$ac_system" = "xLinux" | |
2367 | then | |
2368 | plugin_battery="yes" | |
2369 | plugin_cpu="yes" | |
2370 | plugin_cpufreq="yes" | |
2371 | plugin_disk="yes" | |
2372 | plugin_entropy="yes" | |
2373 | plugin_interface="yes" | |
2374 | plugin_irq="yes" | |
2375 | plugin_load="yes" | |
2376 | plugin_memory="yes" | |
2377 | plugin_nfs="yes" | |
2378 | plugin_processes="yes" | |
2379 | plugin_serial="yes" | |
2380 | plugin_swap="yes" | |
03b7ec00 | 2381 | plugin_tcpconns="yes" |
2004f542 | 2382 | plugin_thermal="yes" |
7b6abfd0 | 2383 | plugin_vmem="yes" |
a905d397 FF |
2384 | plugin_vserver="yes" |
2385 | plugin_wireless="yes" | |
fb3a07dc SH |
2386 | |
2387 | if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes" | |
2388 | then | |
2389 | plugin_ipvs="yes" | |
2390 | fi | |
a905d397 FF |
2391 | fi |
2392 | ||
2393 | # Mac OS X devices | |
2394 | if test "x$with_libiokit" = "xyes" | |
2395 | then | |
2396 | plugin_battery="yes" | |
2397 | plugin_disk="yes" | |
2398 | fi | |
2399 | ||
2400 | # Solaris | |
2401 | if test "x$with_devinfo$with_kstat" = "xyesyes" | |
2402 | then | |
2403 | plugin_cpu="yes" | |
2404 | plugin_disk="yes" | |
2405 | plugin_interface="yes" | |
2406 | plugin_memory="yes" | |
2407 | plugin_swap="yes" | |
2408 | plugin_tape="yes" | |
2409 | fi | |
2410 | ||
2411 | # libstatgrab | |
2412 | if test "x$with_libstatgrab" = "xyes" | |
2413 | then | |
9ac28385 | 2414 | plugin_cpu="yes" |
d5ad8445 | 2415 | plugin_disk="yes" |
a905d397 FF |
2416 | plugin_interface="yes" |
2417 | plugin_load="yes" | |
2418 | plugin_memory="yes" | |
2419 | plugin_swap="yes" | |
c87e3fc2 | 2420 | plugin_users="yes" |
a905d397 FF |
2421 | fi |
2422 | ||
99ef5283 FF |
2423 | if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes" |
2424 | then | |
2425 | plugin_ascent="yes" | |
2426 | fi | |
2427 | ||
249d5776 FF |
2428 | if test "x$with_libopenipmipthread" = "xyes" |
2429 | then | |
2430 | plugin_ipmi="yes" | |
2431 | fi | |
2432 | ||
a905d397 FF |
2433 | if test "x$have_processor_info" = "xyes" |
2434 | then | |
2435 | plugin_cpu="yes" | |
2436 | fi | |
2437 | if test "x$have_sysctlbyname" = "xyes" | |
2438 | then | |
2439 | plugin_cpu="yes" | |
2440 | plugin_memory="yes" | |
1695cd07 | 2441 | plugin_tcpconns="yes" |
a905d397 FF |
2442 | fi |
2443 | ||
2444 | if test "x$have_statfs" = "xyes" | |
2445 | then | |
2446 | plugin_df="yes" | |
2447 | fi | |
2448 | if test "x$have_statvfs" = "xyes" | |
2449 | then | |
2450 | plugin_df="yes" | |
2451 | fi | |
2452 | ||
2453 | if test "x$have_getifaddrs" = "xyes" | |
2454 | then | |
2455 | plugin_interface="yes" | |
2456 | fi | |
2457 | ||
c6be63a7 FF |
2458 | if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes" |
2459 | then | |
553376a3 | 2460 | plugin_libvirt="yes" |
c6be63a7 FF |
2461 | fi |
2462 | ||
a905d397 FF |
2463 | if test "x$have_getloadavg" = "xyes" |
2464 | then | |
2465 | plugin_load="yes" | |
2466 | fi | |
2467 | ||
28785769 SH |
2468 | if test "x$have_libperl$have_perl_ithreads" = "xyesyes" |
2469 | then | |
2470 | plugin_perl="yes" | |
2471 | fi | |
2472 | ||
a905d397 FF |
2473 | # Mac OS X memory interface |
2474 | if test "x$have_host_statistics" = "xyes" | |
2475 | then | |
2476 | plugin_memory="yes" | |
2477 | fi | |
2478 | ||
3fc0feb6 FF |
2479 | if test "x$have_termios_h" = "xyes" |
2480 | then | |
2481 | plugin_multimeter="yes" | |
2482 | fi | |
2483 | ||
a905d397 FF |
2484 | if test "x$have_thread_info" = "xyes" |
2485 | then | |
2486 | plugin_processes="yes" | |
2487 | fi | |
2488 | ||
2489 | if test "x$with_libkvm" = "xyes" | |
2490 | then | |
49908d76 | 2491 | plugin_processes="yes" |
a905d397 FF |
2492 | plugin_swap="yes" |
2493 | fi | |
2494 | ||
2495 | if test "x$have_getutent" = "xyes" | |
2496 | then | |
2497 | plugin_users="yes" | |
2498 | fi | |
2499 | if test "x$have_getutxent" = "xyes" | |
2500 | then | |
2501 | plugin_users="yes" | |
2502 | fi | |
2503 | ||
2504 | # FIXME: sysctl for swap plugin | |
2505 | ||
f9ee71b2 | 2506 | m4_divert_once([HELP_ENABLE], [ |
a905d397 FF |
2507 | collectd plugins:]) |
2508 | ||
3fc0feb6 FF |
2509 | AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics]) |
2510 | AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC]) | |
2511 | AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors]) | |
99ef5283 | 2512 | AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics]) |
3fc0feb6 FF |
2513 | AC_PLUGIN([battery], [$plugin_battery], [Battery statistics]) |
2514 | AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics]) | |
2515 | AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics]) | |
2516 | AC_PLUGIN([csv], [yes], [CSV output plugin]) | |
105436ca | 2517 | AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications]) |
3fc0feb6 FF |
2518 | AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics]) |
2519 | AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics]) | |
2520 | AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis]) | |
2521 | AC_PLUGIN([email], [yes], [EMail statistics]) | |
2522 | AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics]) | |
2523 | AC_PLUGIN([exec], [yes], [Execution of external programs]) | |
2524 | AC_PLUGIN([hddtemp], [yes], [Query hddtempd]) | |
2525 | AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics]) | |
2526 | AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) | |
249d5776 | 2527 | AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics]) |
6d431b70 | 2528 | AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics]) |
3fc0feb6 | 2529 | AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) |
553376a3 | 2530 | AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics]) |
3fc0feb6 FF |
2531 | AC_PLUGIN([load], [$plugin_load], [System load]) |
2532 | AC_PLUGIN([logfile], [yes], [File logging plugin]) | |
2533 | AC_PLUGIN([mbmon], [yes], [Query mbmond]) | |
0735ed71 | 2534 | AC_PLUGIN([memcached], [yes], [memcached statistics]) |
3fc0feb6 FF |
2535 | AC_PLUGIN([memory], [$plugin_memory], [Memory usage]) |
2536 | AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values]) | |
2537 | AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics]) | |
5d99fadf | 2538 | AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics]) |
3fc0feb6 FF |
2539 | AC_PLUGIN([network], [yes], [Network communication plugin]) |
2540 | AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics]) | |
62b1cfdd | 2541 | AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics]) |
a1dd93a2 | 2542 | AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier]) |
3fc0feb6 | 2543 | AC_PLUGIN([ntpd], [yes], [NTPd statistics]) |
a905d397 | 2544 | AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics]) |
28785769 | 2545 | AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter]) |
3fc0feb6 | 2546 | AC_PLUGIN([ping], [$with_liboping], [Network latency statistics]) |
bd150991 | 2547 | AC_PLUGIN([powerdns], [yes], [PowerDNS statistics]) |
3fc0feb6 | 2548 | AC_PLUGIN([processes], [$plugin_processes], [Process statistics]) |
730fef35 | 2549 | AC_PLUGIN([qmail], [yes], [QMail queue statistics]) |
3fc0feb6 FF |
2550 | AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin]) |
2551 | AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics]) | |
2552 | AC_PLUGIN([serial], [$plugin_serial], [serial port traffic]) | |
2553 | AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin]) | |
2554 | AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics]) | |
2555 | AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin]) | |
4aecad69 | 2556 | AC_PLUGIN([tail], [yes], [Parsing of logfiles]) |
3fc0feb6 | 2557 | AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics]) |
03b7ec00 | 2558 | AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics]) |
fea74b37 | 2559 | AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics]) |
2004f542 | 2560 | AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics]) |
3fc0feb6 FF |
2561 | AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin]) |
2562 | AC_PLUGIN([users], [$plugin_users], [User statistics]) | |
30f3e7b8 | 2563 | AC_PLUGIN([uuid], [yes], [UUID as hostname plugin]) |
7b6abfd0 | 2564 | AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics]) |
3fc0feb6 FF |
2565 | AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics]) |
2566 | AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics]) | |
2567 | AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics]) | |
55b43947 | 2568 | |
fb3a07dc | 2569 | dnl ip_vs.h |
d45c77ca FF |
2570 | if test "x$ac_system" = "xLinux" \ |
2571 | && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono" | |
fb3a07dc SH |
2572 | then |
2573 | enable_ipvs="$enable_ipvs (ip_vs.h not found)" | |
2574 | fi | |
2575 | ||
a459afe5 SH |
2576 | dnl Perl bindings |
2577 | AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])], | |
2578 | [ | |
2579 | if test "x$withval" != "xno" && test "x$withval" != "xyes" | |
2580 | then | |
2581 | PERL_BINDINGS_OPTIONS="$withval" | |
2582 | with_perl_bindings="yes" | |
fb713675 SH |
2583 | else |
2584 | PERL_BINDINGS_OPTIONS="" | |
2585 | with_perl_bindings="$withval" | |
a459afe5 SH |
2586 | fi |
2587 | ], | |
2588 | [ | |
2589 | PERL_BINDINGS_OPTIONS="" | |
f1075c22 SH |
2590 | if test -n "$perl_interpreter" |
2591 | then | |
2592 | with_perl_bindings="yes" | |
2593 | else | |
2594 | with_perl_bindings="no (no perl interpreter found)" | |
2595 | fi | |
a459afe5 SH |
2596 | ]) |
2597 | if test "x$with_perl_bindings" = "xyes" | |
2598 | then | |
2599 | PERL_BINDINGS="perl" | |
2600 | else | |
2601 | PERL_BINDINGS="" | |
2602 | fi | |
2603 | AC_SUBST(PERL_BINDINGS) | |
2604 | AC_SUBST(PERL_BINDINGS_OPTIONS) | |
2605 | ||
6b93a8f0 | 2606 | AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile) |
86ca149a | 2607 | |
759c5445 FF |
2608 | if test "x$with_rrdtool" = "xyes" \ |
2609 | && test "x$librrd_threadsafe" != "xyes" | |
83aa9c9e SH |
2610 | then |
2611 | with_rrdtool="yes (warning: librrd is not thread-safe)" | |
2612 | fi | |
2613 | ||
d45c77ca FF |
2614 | if test "x$with_liboping" = "xyes" \ |
2615 | && test "x$with_own_liboping" = "xyes" | |
a905d397 FF |
2616 | then |
2617 | with_liboping="yes (shipped version)" | |
2618 | fi | |
2619 | ||
6b93a8f0 SH |
2620 | if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes" |
2621 | then | |
2622 | with_libiptc="yes (shipped version)" | |
2623 | fi | |
2624 | ||
7d32c2bc | 2625 | if test "x$with_libperl" = "xyes" |
a432a981 | 2626 | then |
a459afe5 | 2627 | with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)" |
7d32c2bc | 2628 | else |
a432a981 FF |
2629 | enable_perl="no (needs libperl)" |
2630 | fi | |
2631 | ||
d45c77ca FF |
2632 | if test "x$with_perl_bindings" = "xyes" \ |
2633 | && test "x$PERL_BINDINGS_OPTIONS" != "x" | |
a459afe5 SH |
2634 | then |
2635 | with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)" | |
2636 | fi | |
2637 | ||
86ca149a FF |
2638 | cat <<EOF; |
2639 | ||
2640 | Configuration: | |
2641 | Libraries: | |
837ad77e | 2642 | libcurl . . . . . . . $with_libcurl |
05b68469 | 2643 | libesmtp . . . . . . $with_libesmtp |
837ad77e SH |
2644 | libiokit . . . . . . $with_libiokit |
2645 | libiptc . . . . . . . $with_libiptc | |
2646 | libkstat . . . . . . $with_kstat | |
2647 | libkvm . . . . . . . $with_libkvm | |
2648 | libmysql . . . . . . $with_libmysql | |
2649 | libnetlink . . . . . $with_libnetlink | |
2650 | libnetsnmp . . . . . $with_libnetsnmp | |
2651 | libnotify . . . . . . $with_libnotify | |
2652 | liboconfig . . . . . $with_liboconfig | |
2653 | libopenipmi . . . . . $with_libopenipmipthread | |
2654 | liboping . . . . . . $with_liboping | |
2655 | libpcap . . . . . . . $with_libpcap | |
2656 | libperl . . . . . . . $with_libperl | |
2657 | libpthread . . . . . $with_libpthread | |
2658 | librrd . . . . . . . $with_rrdtool | |
2659 | libsensors . . . . . $with_lm_sensors | |
2660 | libstatgrab . . . . . $with_libstatgrab | |
2661 | libupsclient . . . . $with_libupsclient | |
2662 | libvirt . . . . . . . $with_libvirt | |
2663 | libxml2 . . . . . . . $with_libxml2 | |
2664 | libxmms . . . . . . . $with_libxmms | |
86ca149a FF |
2665 | |
2666 | Features: | |
837ad77e SH |
2667 | daemon mode . . . . . $enable_daemon |
2668 | debug . . . . . . . . $enable_debug | |
6e765a02 | 2669 | |
a459afe5 | 2670 | Bindings: |
837ad77e | 2671 | perl . . . . . . . . $with_perl_bindings |
a459afe5 | 2672 | |
6e765a02 | 2673 | Modules: |
837ad77e SH |
2674 | apache . . . . . . . $enable_apache |
2675 | apcups . . . . . . . $enable_apcups | |
2676 | apple_sensors . . . . $enable_apple_sensors | |
2677 | ascent . . . . . . . $enable_ascent | |
2678 | battery . . . . . . . $enable_battery | |
2679 | cpu . . . . . . . . . $enable_cpu | |
2680 | cpufreq . . . . . . . $enable_cpufreq | |
2681 | csv . . . . . . . . . $enable_csv | |
837ad77e SH |
2682 | df . . . . . . . . . $enable_df |
2683 | disk . . . . . . . . $enable_disk | |
2684 | dns . . . . . . . . . $enable_dns | |
2685 | email . . . . . . . . $enable_email | |
2686 | entropy . . . . . . . $enable_entropy | |
2687 | exec . . . . . . . . $enable_exec | |
2688 | hddtemp . . . . . . . $enable_hddtemp | |
2689 | interface . . . . . . $enable_interface | |
2690 | iptables . . . . . . $enable_iptables | |
2691 | ipmi . . . . . . . . $enable_ipmi | |
2692 | ipvs . . . . . . . . $enable_ipvs | |
2693 | irq . . . . . . . . . $enable_irq | |
2694 | libvirt . . . . . . . $enable_libvirt | |
2695 | load . . . . . . . . $enable_load | |
2696 | logfile . . . . . . . $enable_logfile | |
2697 | mbmon . . . . . . . . $enable_mbmon | |
2698 | memcached . . . . . . $enable_memcached | |
2699 | memory . . . . . . . $enable_memory | |
2700 | multimeter . . . . . $enable_multimeter | |
2701 | mysql . . . . . . . . $enable_mysql | |
2702 | netlink . . . . . . . $enable_netlink | |
2703 | network . . . . . . . $enable_network | |
2704 | nfs . . . . . . . . . $enable_nfs | |
2705 | nginx . . . . . . . . $enable_nginx | |
105436ca | 2706 | notify_desktop . . . $enable_notify_desktop |
a1dd93a2 | 2707 | notify_email . . . . $enable_notify_email |
837ad77e SH |
2708 | ntpd . . . . . . . . $enable_ntpd |
2709 | nut . . . . . . . . . $enable_nut | |
2710 | perl . . . . . . . . $enable_perl | |
2711 | ping . . . . . . . . $enable_ping | |
2712 | powerdns . . . . . . $enable_powerdns | |
2713 | processes . . . . . . $enable_processes | |
730fef35 | 2714 | qmail . . . . . . . . $enable_qmail |
837ad77e SH |
2715 | rrdtool . . . . . . . $enable_rrdtool |
2716 | sensors . . . . . . . $enable_sensors | |
2717 | serial . . . . . . . $enable_serial | |
2718 | snmp . . . . . . . . $enable_snmp | |
2719 | swap . . . . . . . . $enable_swap | |
2720 | syslog . . . . . . . $enable_syslog | |
2721 | tail . . . . . . . . $enable_tail | |
2722 | tape . . . . . . . . $enable_tape | |
2723 | tcpconns . . . . . . $enable_tcpconns | |
2724 | teamspeak2 . . . . . $enable_teamspeak2 | |
2004f542 | 2725 | thermal . . . . . . . $enable_thermal |
837ad77e SH |
2726 | unixsock . . . . . . $enable_unixsock |
2727 | users . . . . . . . . $enable_users | |
2728 | uuid . . . . . . . . $enable_uuid | |
2729 | vmem . . . . . . . . $enable_vmem | |
2730 | vserver . . . . . . . $enable_vserver | |
2731 | wireless . . . . . . $enable_wireless | |
2732 | xmms . . . . . . . . $enable_xmms | |
86ca149a FF |
2733 | |
2734 | EOF |