1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AC_CONFIG_AUX_DIR([libltdl/config])
7 m4_ifdef([LT_PACKAGE_VERSION],
8 # libtool >= 2.2
9 [
10 LT_CONFIG_LTDL_DIR([libltdl])
11 LT_INIT([dlopen])
12 LTDL_INIT([convenience])
13 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
14 ]
15 ,
16 # libtool <= 1.5
17 [
18 AC_LIBLTDL_CONVENIENCE
19 AC_SUBST(LTDLINCL)
20 AC_SUBST(LIBLTDL)
21 AC_LIBTOOL_DLOPEN
22 AC_CONFIG_SUBDIRS(libltdl)
23 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
24 ]
25 )
27 AM_INIT_AUTOMAKE(dist-bzip2)
28 AC_LANG(C)
30 AC_PREFIX_DEFAULT("/opt/collectd")
32 AC_SYS_LARGEFILE
34 #
35 # Checks for programs.
36 #
37 AC_PROG_CC
38 AC_PROG_CPP
39 AC_PROG_INSTALL
40 AC_PROG_LN_S
41 AC_PROG_MAKE_SET
42 AM_PROG_CC_C_O
43 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
45 AC_DISABLE_STATIC
46 AC_PROG_LIBTOOL
47 AC_PROG_LEX
48 AC_PROG_YACC
49 PKG_PROG_PKG_CONFIG
51 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
52 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
54 AC_MSG_CHECKING([for kernel type ($host_os)])
55 case $host_os in
56 *linux*)
57 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
58 ac_system="Linux"
59 ;;
60 *solaris*)
61 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
62 ac_system="Solaris"
63 ;;
64 *darwin*)
65 ac_system="Darwin"
66 ;;
67 *openbsd*)
68 ac_system="OpenBSD"
69 ;;
70 *aix*)
71 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
72 ac_system="AIX"
73 ;;
74 *)
75 ac_system="unknown"
76 esac
77 AC_MSG_RESULT([$ac_system])
79 if test "x$ac_system" = "xLinux"
80 then
81 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
82 if test -z "$KERNEL_DIR"
83 then
84 KERNEL_DIR="/lib/modules/`uname -r`/source"
85 fi
87 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
88 AC_SUBST(KERNEL_CFLAGS)
89 fi
91 if test "x$ac_system" = "xSolaris"
92 then
93 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
94 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
95 fi
96 if test "x$ac_system" = "xAIX"
97 then
98 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
99 fi
101 # Where to install .pc files.
102 pkgconfigdir="${libdir}/pkgconfig"
103 AC_SUBST(pkgconfigdir)
105 # Check for standards compliance mode
106 AC_ARG_ENABLE(standards,
107 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
108 [enable_standards="$enableval"],
109 [enable_standards="no"])
110 if test "x$enable_standards" = "xyes"
111 then
112 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
113 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
114 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
115 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
116 if test "x$GCC" = "xyes"
117 then
118 CFLAGS="$CFLAGS -std=c99"
119 fi
120 fi
121 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
123 #
124 # Checks for header files.
125 #
126 AC_HEADER_STDC
127 AC_HEADER_SYS_WAIT
128 AC_HEADER_DIRENT
129 AC_HEADER_STDBOOL
131 AC_CHECK_HEADERS(stdio.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)
133 # For ping library
134 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
135 [#if HAVE_STDINT_H
136 # include <stdint.h>
137 #endif
138 #if HAVE_SYS_TYPES_H
139 # include <sys/types.h>
140 #endif
141 ])
142 AC_CHECK_HEADERS(netinet/in.h, [], [],
143 [#if HAVE_STDINT_H
144 # include <stdint.h>
145 #endif
146 #if HAVE_SYS_TYPES_H
147 # include <sys/types.h>
148 #endif
149 #if HAVE_NETINET_IN_SYSTM_H
150 # include <netinet/in_systm.h>
151 #endif
152 ])
153 AC_CHECK_HEADERS(netinet/ip.h, [], [],
154 [#if HAVE_STDINT_H
155 # include <stdint.h>
156 #endif
157 #if HAVE_SYS_TYPES_H
158 # include <sys/types.h>
159 #endif
160 #if HAVE_NETINET_IN_SYSTM_H
161 # include <netinet/in_systm.h>
162 #endif
163 #if HAVE_NETINET_IN_H
164 # include <netinet/in.h>
165 #endif
166 ])
167 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
168 [#if HAVE_STDINT_H
169 # include <stdint.h>
170 #endif
171 #if HAVE_SYS_TYPES_H
172 # include <sys/types.h>
173 #endif
174 #if HAVE_NETINET_IN_SYSTM_H
175 # include <netinet/in_systm.h>
176 #endif
177 #if HAVE_NETINET_IN_H
178 # include <netinet/in.h>
179 #endif
180 #if HAVE_NETINET_IP_H
181 # include <netinet/ip.h>
182 #endif
183 ])
184 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
185 [#if HAVE_STDINT_H
186 # include <stdint.h>
187 #endif
188 #if HAVE_SYS_TYPES_H
189 # include <sys/types.h>
190 #endif
191 #if HAVE_NETINET_IN_SYSTM_H
192 # include <netinet/in_systm.h>
193 #endif
194 #if HAVE_NETINET_IN_H
195 # include <netinet/in.h>
196 #endif
197 #if HAVE_NETINET_IP_H
198 # include <netinet/ip.h>
199 #endif
200 ])
201 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
202 [#if HAVE_STDINT_H
203 # include <stdint.h>
204 #endif
205 #if HAVE_SYS_TYPES_H
206 # include <sys/types.h>
207 #endif
208 #if HAVE_NETINET_IN_SYSTM_H
209 # include <netinet/in_systm.h>
210 #endif
211 #if HAVE_NETINET_IN_H
212 # include <netinet/in.h>
213 #endif
214 ])
215 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
216 [#if HAVE_STDINT_H
217 # include <stdint.h>
218 #endif
219 #if HAVE_SYS_TYPES_H
220 # include <sys/types.h>
221 #endif
222 #if HAVE_NETINET_IN_SYSTM_H
223 # include <netinet/in_systm.h>
224 #endif
225 #if HAVE_NETINET_IN_H
226 # include <netinet/in.h>
227 #endif
228 #if HAVE_NETINET_IP6_H
229 # include <netinet/ip6.h>
230 #endif
231 ])
232 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
233 [#if HAVE_STDINT_H
234 # include <stdint.h>
235 #endif
236 #if HAVE_SYS_TYPES_H
237 # include <sys/types.h>
238 #endif
239 #if HAVE_NETINET_IN_SYSTM_H
240 # include <netinet/in_systm.h>
241 #endif
242 #if HAVE_NETINET_IN_H
243 # include <netinet/in.h>
244 #endif
245 #if HAVE_NETINET_IP_H
246 # include <netinet/ip.h>
247 #endif
248 ])
249 AC_CHECK_HEADERS(netinet/udp.h, [], [],
250 [#if HAVE_STDINT_H
251 # include <stdint.h>
252 #endif
253 #if HAVE_SYS_TYPES_H
254 # include <sys/types.h>
255 #endif
256 #if HAVE_NETINET_IN_SYSTM_H
257 # include <netinet/in_systm.h>
258 #endif
259 #if HAVE_NETINET_IN_H
260 # include <netinet/in.h>
261 #endif
262 #if HAVE_NETINET_IP_H
263 # include <netinet/ip.h>
264 #endif
265 ])
267 # For cpu modules
268 AC_CHECK_HEADERS(sys/dkstat.h)
269 if test "x$ac_system" = "xDarwin"
270 then
271 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)
272 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
273 fi
274 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
275 [
276 #if HAVE_SYS_TYPES_H
277 # include <sys/types.h>
278 #endif
279 #if HAVE_SYS_PARAM_H
280 # include <sys/param.h>
281 #endif
282 ])
284 AC_MSG_CHECKING([for sysctl kern.cp_times])
285 if test -x /sbin/sysctl
286 then
287 /sbin/sysctl kern.cp_times 2>/dev/null
288 if test $? -eq 0
289 then
290 AC_MSG_RESULT([yes])
291 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
292 [Define if sysctl supports kern.cp_times])
293 else
294 AC_MSG_RESULT([no])
295 fi
296 else
297 AC_MSG_RESULT([no])
298 fi
300 # For hddtemp module
301 AC_CHECK_HEADERS(linux/major.h libgen.h)
303 # For the battery plugin
304 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
305 [
306 #if HAVE_IOKIT_IOKITLIB_H
307 # include <IOKit/IOKitLib.h>
308 #endif
309 #if HAVE_IOKIT_IOTYPES_H
310 # include <IOKit/IOTypes.h>
311 #endif
312 ])
314 # For the swap module
315 have_linux_wireless_h="no"
316 if test "x$ac_system" = "xLinux"
317 then
318 AC_CHECK_HEADERS(linux/wireless.h,
319 [have_linux_wireless_h="yes"],
320 [have_linux_wireless_h="no"],
321 [
322 #include <dirent.h>
323 #include <sys/ioctl.h>
324 #include <sys/socket.h>
325 ])
326 fi
328 # For the swap module
329 have_sys_swap_h="yes"
330 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
331 [
332 #undef _FILE_OFFSET_BITS
333 #undef _LARGEFILE64_SOURCE
334 #if HAVE_SYS_TYPES_H
335 # include <sys/types.h>
336 #endif
337 #if HAVE_SYS_PARAM_H
338 # include <sys/param.h>
339 #endif
340 ])
342 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
343 then
344 hint_64=""
345 if test "x$GCC" = "xyes"
346 then
347 hint_64="CFLAGS='-m64'"
348 else
349 hint_64="CFLAGS='-xarch=v9'"
350 fi
351 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
352 fi
354 # For load module
355 # For the processes plugin
356 # For users module
357 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
359 # For interface plugin
360 AC_CHECK_HEADERS(ifaddrs.h)
361 AC_CHECK_HEADERS(net/if.h, [], [],
362 [
363 #if HAVE_SYS_TYPES_H
364 # include <sys/types.h>
365 #endif
366 #if HAVE_SYS_SOCKET_H
367 # include <sys/socket.h>
368 #endif
369 ])
370 AC_CHECK_HEADERS(linux/if.h, [], [],
371 [
372 #if HAVE_SYS_TYPES_H
373 # include <sys/types.h>
374 #endif
375 #if HAVE_SYS_SOCKET_H
376 # include <sys/socket.h>
377 #endif
378 ])
379 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
380 [
381 #if HAVE_SYS_TYPES_H
382 # include <sys/types.h>
383 #endif
384 #if HAVE_SYS_SOCKET_H
385 # include <sys/socket.h>
386 #endif
387 #if HAVE_LINUX_IF_H
388 # include <linux/if.h>
389 #endif
390 ])
392 # For ipvs module
393 have_linux_ip_vs_h="no"
394 have_net_ip_vs_h="no"
395 have_ip_vs_h="no"
396 ip_vs_h_needs_kernel_cflags="no"
397 if test "x$ac_system" = "xLinux"
398 then
399 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
400 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
401 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
403 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
404 then
405 SAVE_CFLAGS="$CFLAGS"
406 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
408 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
410 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
411 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
412 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
414 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
415 then
416 ip_vs_h_needs_kernel_cflags="yes"
417 fi
419 CFLAGS="$SAVE_CFLAGS"
420 fi
421 fi
422 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
424 # For quota module
425 AC_CHECK_HEADERS(sys/ucred.h, [], [],
426 [
427 #if HAVE_SYS_TYPES_H
428 # include <sys/types.h>
429 #endif
430 #if HAVE_SYS_PARAM_H
431 # include <sys/param.h>
432 #endif
433 ])
435 # For mount interface
436 AC_CHECK_HEADERS(sys/mount.h, [], [],
437 [
438 #if HAVE_SYS_TYPES_H
439 # include <sys/types.h>
440 #endif
441 #if HAVE_SYS_PARAM_H
442 # include <sys/param.h>
443 #endif
444 ])
446 # For the email plugin
447 AC_CHECK_HEADERS(linux/un.h, [], [],
448 [
449 #if HAVE_SYS_SOCKET_H
450 # include <sys/socket.h>
451 #endif
452 ])
454 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.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)
456 # For the dns plugin
457 AC_CHECK_HEADERS(arpa/nameser.h)
458 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
459 [
460 #if HAVE_ARPA_NAMESER_H
461 # include <arpa/nameser.h>
462 #endif
463 ])
465 AC_CHECK_HEADERS(net/if_arp.h, [], [],
466 [#if HAVE_SYS_SOCKET_H
467 # include <sys/socket.h>
468 #endif
469 ])
470 AC_CHECK_HEADERS(net/ppp_defs.h)
471 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
472 [#if HAVE_NET_PPP_DEFS_H
473 # include <net/ppp_defs.h>
474 #endif
475 ])
476 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
477 [#if HAVE_STDINT_H
478 # include <stdint.h>
479 #endif
480 #if HAVE_SYS_TYPES_H
481 # include <sys/types.h>
482 #endif
483 #if HAVE_SYS_SOCKET_H
484 # include <sys/socket.h>
485 #endif
486 #if HAVE_NET_IF_H
487 # include <net/if.h>
488 #endif
489 #if HAVE_NETINET_IN_H
490 # include <netinet/in.h>
491 #endif
492 ])
494 AC_CHECK_HEADERS(netinet/ip_compat.h)
496 # For the multimeter plugin
497 have_termios_h="no"
498 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
500 #
501 # Checks for typedefs, structures, and compiler characteristics.
502 #
503 AC_C_CONST
504 AC_TYPE_PID_T
505 AC_TYPE_SIZE_T
506 AC_TYPE_UID_T
507 AC_HEADER_TIME
509 #
510 # Checks for library functions.
511 #
512 AC_PROG_GCC_TRADITIONAL
513 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
515 AC_FUNC_STRERROR_R
517 SAVE_CFLAGS="$CFLAGS"
518 # Emulate behavior of src/Makefile.am
519 if test "x$GCC" = "xyes"
520 then
521 CFLAGS="$CFLAGS -Wall -Werror"
522 fi
524 AC_CACHE_CHECK([for strtok_r],
525 [c_cv_have_strtok_r_default],
526 AC_LINK_IFELSE(
527 AC_LANG_PROGRAM(
528 [[[[
529 #include <stdlib.h>
530 #include <stdio.h>
531 #include <string.h>
532 ]]]],
533 [[[[
534 char buffer[] = "foo,bar,baz";
535 char *token;
536 char *dummy;
537 char *saveptr;
539 dummy = buffer;
540 saveptr = NULL;
541 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
542 {
543 dummy = NULL;
544 printf ("token = %s;\n", token);
545 }
546 ]]]]),
547 [c_cv_have_strtok_r_default="yes"],
548 [c_cv_have_strtok_r_default="no"]
549 )
550 )
552 if test "x$c_cv_have_strtok_r_default" = "xno"
553 then
554 CFLAGS="$CFLAGS -D_REENTRANT=1"
556 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
557 [c_cv_have_strtok_r_reentrant],
558 AC_LINK_IFELSE(
559 AC_LANG_PROGRAM(
560 [[[[
561 #include <stdlib.h>
562 #include <stdio.h>
563 #include <string.h>
564 ]]]],
565 [[[[
566 char buffer[] = "foo,bar,baz";
567 char *token;
568 char *dummy;
569 char *saveptr;
571 dummy = buffer;
572 saveptr = NULL;
573 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
574 {
575 dummy = NULL;
576 printf ("token = %s;\n", token);
577 }
578 ]]]]),
579 [c_cv_have_strtok_r_reentrant="yes"],
580 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
581 )
582 )
583 fi
585 CFLAGS="$SAVE_CFLAGS"
586 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
587 then
588 CFLAGS="$CFLAGS -D_REENTRANT=1"
589 fi
591 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
593 socket_needs_socket="no"
594 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
595 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
597 clock_gettime_needs_rt="no"
598 clock_gettime_needs_posix4="no"
599 have_clock_gettime="no"
600 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
601 if test "x$have_clock_gettime" = "xno"
602 then
603 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
604 have_clock_gettime="yes"])
605 fi
606 if test "x$have_clock_gettime" = "xno"
607 then
608 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
609 have_clock_gettime="yes"])
610 fi
611 if test "x$have_clock_gettime" = "xyes"
612 then
613 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
614 else
615 AC_MSG_WARN(cannot find clock_gettime)
616 fi
618 nanosleep_needs_rt="no"
619 nanosleep_needs_posix4="no"
620 AC_CHECK_FUNCS(nanosleep,
621 [],
622 AC_CHECK_LIB(rt, nanosleep,
623 [nanosleep_needs_rt="yes"],
624 AC_CHECK_LIB(posix4, nanosleep,
625 [nanosleep_needs_posix4="yes"],
626 AC_MSG_ERROR(cannot find nanosleep))))
628 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
629 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
631 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
632 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
633 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
634 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
635 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
636 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
637 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
638 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
639 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
640 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
641 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
642 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
644 # Check for strptime {{{
645 if test "x$GCC" = "xyes"
646 then
647 SAVE_CFLAGS="$CFLAGS"
648 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
649 fi
651 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
652 if test "x$have_strptime" = "xyes"
653 then
654 AC_CACHE_CHECK([whether strptime is exported by default],
655 [c_cv_have_strptime_default],
656 AC_COMPILE_IFELSE(
657 AC_LANG_PROGRAM(
658 [[
659 AC_INCLUDES_DEFAULT
660 #include <time.h>
661 ]],
662 [[
663 struct tm stm;
664 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
665 ]]),
666 [c_cv_have_strptime_default="yes"],
667 [c_cv_have_strptime_default="no"]))
668 fi
669 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
670 then
671 AC_CACHE_CHECK([whether strptime needs standards mode],
672 [c_cv_have_strptime_standards],
673 AC_COMPILE_IFELSE(
674 AC_LANG_PROGRAM(
675 [[
676 #ifndef _ISOC99_SOURCE
677 # define _ISOC99_SOURCE 1
678 #endif
679 #ifndef _POSIX_C_SOURCE
680 # define _POSIX_C_SOURCE 200112L
681 #endif
682 #ifndef _XOPEN_SOURCE
683 # define _XOPEN_SOURCE 500
684 #endif
685 AC_INCLUDES_DEFAULT
686 #include <time.h>
687 ]],
688 [[
689 struct tm stm;
690 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
691 ]]),
692 [c_cv_have_strptime_standards="yes"],
693 [c_cv_have_strptime_standards="no"]))
695 if test "x$c_cv_have_strptime_standards" = "xyes"
696 then
697 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
698 else
699 have_strptime="no"
700 fi
701 fi
703 if test "x$GCC" = "xyes"
704 then
705 CFLAGS="$SAVE_CFLAGS"
706 fi
708 # }}} Check for strptime
710 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
711 if test "x$have_swapctl" = "xyes"; then
712 AC_CACHE_CHECK([whether swapctl takes two arguments],
713 [c_cv_have_swapctl_two_args],
714 AC_COMPILE_IFELSE(
715 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
716 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
717 # undef _FILE_OFFSET_BITS
718 # undef _LARGEFILE64_SOURCE
719 #endif
720 #include <sys/stat.h>
721 #include <sys/swap.h>]],
722 [[
723 int num = swapctl(0, NULL);
724 ]]
725 ),
726 [c_cv_have_swapctl_two_args="yes"],
727 [c_cv_have_swapctl_two_args="no"]
728 )
729 )
730 AC_CACHE_CHECK([whether swapctl takes three arguments],
731 [c_cv_have_swapctl_three_args],
732 AC_COMPILE_IFELSE(
733 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
734 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
735 # undef _FILE_OFFSET_BITS
736 # undef _LARGEFILE64_SOURCE
737 #endif
738 #include <sys/stat.h>
739 #include <sys/swap.h>]],
740 [[
741 int num = swapctl(0, NULL,0);
742 ]]
743 ),
744 [c_cv_have_swapctl_three_args="yes"],
745 [c_cv_have_swapctl_three_args="no"]
746 )
747 )
748 fi
749 # Check for different versions of `swapctl' here..
750 if test "x$have_swapctl" = "xyes"; then
751 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
752 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
753 [Define if the function swapctl exists and takes two arguments.])
754 fi
755 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
756 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
757 [Define if the function swapctl exists and takes three arguments.])
758 fi
759 fi
761 # Check for NAN
762 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
763 [
764 if test "x$withval" = "xno"; then
765 nan_type="none"
766 else if test "x$withval" = "xyes"; then
767 nan_type="zero"
768 else
769 nan_type="$withval"
770 fi; fi
771 ],
772 [nan_type="none"])
773 if test "x$nan_type" = "xnone"; then
774 AC_CACHE_CHECK([whether NAN is defined by default],
775 [c_cv_have_nan_default],
776 AC_COMPILE_IFELSE(
777 AC_LANG_PROGRAM(
778 [[
779 #include <stdlib.h>
780 #include <math.h>
781 static double foo = NAN;
782 ]],
783 [[
784 if (isnan (foo))
785 return 0;
786 else
787 return 1;
788 ]]),
789 [c_cv_have_nan_default="yes"],
790 [c_cv_have_nan_default="no"]
791 )
792 )
793 if test "x$c_cv_have_nan_default" = "xyes"
794 then
795 nan_type="default"
796 fi
797 fi
798 if test "x$nan_type" = "xnone"; then
799 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
800 [c_cv_have_nan_isoc],
801 AC_COMPILE_IFELSE(
802 AC_LANG_PROGRAM(
803 [[
804 #include <stdlib.h>
805 #define __USE_ISOC99 1
806 #include <math.h>
807 static double foo = NAN;
808 ]],
809 [[
810 if (isnan (foo))
811 return 0;
812 else
813 return 1;
814 ]]),
815 [c_cv_have_nan_isoc="yes"],
816 [c_cv_have_nan_isoc="no"]
817 )
818 )
819 if test "x$c_cv_have_nan_isoc" = "xyes"
820 then
821 nan_type="isoc99"
822 fi
823 fi
824 if test "x$nan_type" = "xnone"; then
825 SAVE_LDFLAGS=$LDFLAGS
826 LDFLAGS="$LDFLAGS -lm"
827 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
828 [c_cv_have_nan_zero],
829 AC_RUN_IFELSE(
830 AC_LANG_PROGRAM(
831 [[
832 #include <stdlib.h>
833 #include <math.h>
834 #ifdef NAN
835 # undef NAN
836 #endif
837 #define NAN (0.0 / 0.0)
838 #ifndef isnan
839 # define isnan(f) ((f) != (f))
840 #endif
841 static double foo = NAN;
842 ]],
843 [[
844 if (isnan (foo))
845 return 0;
846 else
847 return 1;
848 ]]),
849 [c_cv_have_nan_zero="yes"],
850 [c_cv_have_nan_zero="no"]
851 )
852 )
853 LDFLAGS=$SAVE_LDFLAGS
854 if test "x$c_cv_have_nan_zero" = "xyes"
855 then
856 nan_type="zero"
857 fi
858 fi
860 if test "x$nan_type" = "xdefault"; then
861 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
862 [Define if NAN is defined by default and can initialize static variables.])
863 else if test "x$nan_type" = "xisoc99"; then
864 AC_DEFINE(NAN_STATIC_ISOC, 1,
865 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
866 else if test "x$nan_type" = "xzero"; then
867 AC_DEFINE(NAN_ZERO_ZERO, 1,
868 [Define if NAN can be defined as (0.0 / 0.0)])
869 else
870 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
871 fi; fi; fi
873 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
874 [
875 if test "x$withval" = "xnothing"; then
876 fp_layout_type="nothing"
877 else if test "x$withval" = "xendianflip"; then
878 fp_layout_type="endianflip"
879 else if test "x$withval" = "xintswap"; then
880 fp_layout_type="intswap"
881 else
882 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
883 fi; fi; fi
884 ],
885 [fp_layout_type="unknown"])
887 if test "x$fp_layout_type" = "xunknown"; then
888 AC_CACHE_CHECK([if doubles are stored in x86 representation],
889 [c_cv_fp_layout_need_nothing],
890 AC_RUN_IFELSE(
891 AC_LANG_PROGRAM(
892 [[[[
893 #include <stdlib.h>
894 #include <stdio.h>
895 #include <string.h>
896 #if HAVE_STDINT_H
897 # include <stdint.h>
898 #endif
899 #if HAVE_INTTYPES_H
900 # include <inttypes.h>
901 #endif
902 #if HAVE_STDBOOL_H
903 # include <stdbool.h>
904 #endif
905 ]]]],
906 [[[[
907 uint64_t i0;
908 uint64_t i1;
909 uint8_t c[8];
910 double d;
912 d = 8.642135e130;
913 memcpy ((void *) &i0, (void *) &d, 8);
915 i1 = i0;
916 memcpy ((void *) c, (void *) &i1, 8);
918 if ((c[0] == 0x2f) && (c[1] == 0x25)
919 && (c[2] == 0xc0) && (c[3] == 0xc7)
920 && (c[4] == 0x43) && (c[5] == 0x2b)
921 && (c[6] == 0x1f) && (c[7] == 0x5b))
922 return (0);
923 else
924 return (1);
925 ]]]]),
926 [c_cv_fp_layout_need_nothing="yes"],
927 [c_cv_fp_layout_need_nothing="no"]
928 )
929 )
930 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
931 fp_layout_type="nothing"
932 fi
933 fi
934 if test "x$fp_layout_type" = "xunknown"; then
935 AC_CACHE_CHECK([if endianflip converts to x86 representation],
936 [c_cv_fp_layout_need_endianflip],
937 AC_RUN_IFELSE(
938 AC_LANG_PROGRAM(
939 [[[[
940 #include <stdlib.h>
941 #include <stdio.h>
942 #include <string.h>
943 #if HAVE_STDINT_H
944 # include <stdint.h>
945 #endif
946 #if HAVE_INTTYPES_H
947 # include <inttypes.h>
948 #endif
949 #if HAVE_STDBOOL_H
950 # include <stdbool.h>
951 #endif
952 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
953 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
954 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
955 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
956 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
957 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
958 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
959 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
960 ]]]],
961 [[[[
962 uint64_t i0;
963 uint64_t i1;
964 uint8_t c[8];
965 double d;
967 d = 8.642135e130;
968 memcpy ((void *) &i0, (void *) &d, 8);
970 i1 = endianflip (i0);
971 memcpy ((void *) c, (void *) &i1, 8);
973 if ((c[0] == 0x2f) && (c[1] == 0x25)
974 && (c[2] == 0xc0) && (c[3] == 0xc7)
975 && (c[4] == 0x43) && (c[5] == 0x2b)
976 && (c[6] == 0x1f) && (c[7] == 0x5b))
977 return (0);
978 else
979 return (1);
980 ]]]]),
981 [c_cv_fp_layout_need_endianflip="yes"],
982 [c_cv_fp_layout_need_endianflip="no"]
983 )
984 )
985 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
986 fp_layout_type="endianflip"
987 fi
988 fi
989 if test "x$fp_layout_type" = "xunknown"; then
990 AC_CACHE_CHECK([if intswap converts to x86 representation],
991 [c_cv_fp_layout_need_intswap],
992 AC_RUN_IFELSE(
993 AC_LANG_PROGRAM(
994 [[[[
995 #include <stdlib.h>
996 #include <stdio.h>
997 #include <string.h>
998 #if HAVE_STDINT_H
999 # include <stdint.h>
1000 #endif
1001 #if HAVE_INTTYPES_H
1002 # include <inttypes.h>
1003 #endif
1004 #if HAVE_STDBOOL_H
1005 # include <stdbool.h>
1006 #endif
1007 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1008 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1009 ]]]],
1010 [[[[
1011 uint64_t i0;
1012 uint64_t i1;
1013 uint8_t c[8];
1014 double d;
1016 d = 8.642135e130;
1017 memcpy ((void *) &i0, (void *) &d, 8);
1019 i1 = intswap (i0);
1020 memcpy ((void *) c, (void *) &i1, 8);
1022 if ((c[0] == 0x2f) && (c[1] == 0x25)
1023 && (c[2] == 0xc0) && (c[3] == 0xc7)
1024 && (c[4] == 0x43) && (c[5] == 0x2b)
1025 && (c[6] == 0x1f) && (c[7] == 0x5b))
1026 return (0);
1027 else
1028 return (1);
1029 ]]]]),
1030 [c_cv_fp_layout_need_intswap="yes"],
1031 [c_cv_fp_layout_need_intswap="no"]
1032 )
1033 )
1034 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1035 fp_layout_type="intswap"
1036 fi
1037 fi
1039 if test "x$fp_layout_type" = "xnothing"; then
1040 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1041 [Define if doubles are stored in x86 representation.])
1042 else if test "x$fp_layout_type" = "xendianflip"; then
1043 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1044 [Define if endianflip is needed to convert to x86 representation.])
1045 else if test "x$fp_layout_type" = "xintswap"; then
1046 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1047 [Define if intswap is needed to convert to x86 representation.])
1048 else
1049 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1050 fi; fi; fi
1052 have_getfsstat="no"
1053 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1054 have_getvfsstat="no"
1055 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1056 have_listmntent="no"
1057 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1059 have_getmntent="no"
1060 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1061 if test "x$have_getmntent" = "xno"; then
1062 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1063 fi
1064 if test "x$have_getmntent" = "xno"; then
1065 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1066 fi
1067 if test "x$have_getmntent" = "xno"; then
1068 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1069 fi
1071 if test "x$have_getmntent" = "xc"; then
1072 AC_CACHE_CHECK([whether getmntent takes one argument],
1073 [c_cv_have_one_getmntent],
1074 AC_COMPILE_IFELSE(
1075 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1076 #include "$srcdir/src/utils_mount.h"]],
1077 [[
1078 FILE *fh;
1079 struct mntent *me;
1080 fh = setmntent ("/etc/mtab", "r");
1081 me = getmntent (fh);
1082 ]]
1083 ),
1084 [c_cv_have_one_getmntent="yes"],
1085 [c_cv_have_one_getmntent="no"]
1086 )
1087 )
1088 AC_CACHE_CHECK([whether getmntent takes two arguments],
1089 [c_cv_have_two_getmntent],
1090 AC_COMPILE_IFELSE(
1091 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1092 #include "$srcdir/src/utils_mount.h"]],
1093 [[
1094 FILE *fh;
1095 struct mnttab mt;
1096 int status;
1097 fh = fopen ("/etc/mnttab", "r");
1098 status = getmntent (fh, &mt);
1099 ]]
1100 ),
1101 [c_cv_have_two_getmntent="yes"],
1102 [c_cv_have_two_getmntent="no"]
1103 )
1104 )
1105 fi
1107 # Check for different versions of `getmntent' here..
1109 if test "x$have_getmntent" = "xc"; then
1110 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1111 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1112 [Define if the function getmntent exists and takes one argument.])
1113 fi
1114 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1115 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1116 [Define if the function getmntent exists and takes two arguments.])
1117 fi
1118 fi
1119 if test "x$have_getmntent" = "xsun"; then
1120 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1121 [Define if the function getmntent exists. It's the version from libsun.])
1122 fi
1123 if test "x$have_getmntent" = "xseq"; then
1124 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1125 [Define if the function getmntent exists. It's the version from libseq.])
1126 fi
1127 if test "x$have_getmntent" = "xgen"; then
1128 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1129 [Define if the function getmntent exists. It's the version from libgen.])
1130 fi
1132 # Check for htonll
1133 AC_MSG_CHECKING([if have htonll defined])
1135 have_htonll="no"
1136 AC_LINK_IFELSE([
1137 AC_LANG_PROGRAM([
1138 #include <sys/types.h>
1139 #include <netinet/in.h>
1140 #if HAVE_INTTYPES_H
1141 # include <inttypes.h>
1142 #endif
1143 ], [
1144 return htonll(0);
1145 ])
1146 ], [
1147 have_htonll="yes"
1148 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1149 ])
1151 AC_MSG_RESULT([$have_htonll])
1153 # Check for structures
1154 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1155 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1156 [],
1157 [
1158 #include <sys/types.h>
1159 #include <sys/socket.h>
1160 #include <net/if.h>
1161 ])
1162 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1163 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1164 [],
1165 [
1166 #include <sys/types.h>
1167 #include <sys/socket.h>
1168 #include <linux/if.h>
1169 #include <linux/netdevice.h>
1170 ])
1172 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1173 [],
1174 [
1175 #include <netinet/in.h>
1176 #include <net/if.h>
1177 ])
1179 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1180 [
1181 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1182 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1183 have_struct_kinfo_proc_freebsd="yes"
1184 ],
1185 [
1186 have_struct_kinfo_proc_freebsd="no"
1187 ],
1188 [
1189 AC_INCLUDES_DEFAULT
1190 #include <kvm.h>
1191 #include <sys/param.h>
1192 #include <sys/sysctl.h>
1193 #include <sys/user.h>
1194 ])
1196 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1197 [
1198 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1199 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1200 have_struct_kinfo_proc_openbsd="yes"
1201 ],
1202 [
1203 have_struct_kinfo_proc_openbsd="no"
1204 ],
1205 [
1206 AC_INCLUDES_DEFAULT
1207 #include <sys/param.h>
1208 #include <sys/sysctl.h>
1209 #include <kvm.h>
1210 ])
1212 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1213 [#define _BSD_SOURCE
1214 #if HAVE_STDINT_H
1215 # include <stdint.h>
1216 #endif
1217 #if HAVE_SYS_TYPES_H
1218 # include <sys/types.h>
1219 #endif
1220 #if HAVE_NETINET_IN_SYSTM_H
1221 # include <netinet/in_systm.h>
1222 #endif
1223 #if HAVE_NETINET_IN_H
1224 # include <netinet/in.h>
1225 #endif
1226 #if HAVE_NETINET_IP_H
1227 # include <netinet/ip.h>
1228 #endif
1229 #if HAVE_NETINET_UDP_H
1230 # include <netinet/udp.h>
1231 #endif
1232 ])
1233 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1234 [#define _BSD_SOURCE
1235 #if HAVE_STDINT_H
1236 # include <stdint.h>
1237 #endif
1238 #if HAVE_SYS_TYPES_H
1239 # include <sys/types.h>
1240 #endif
1241 #if HAVE_NETINET_IN_SYSTM_H
1242 # include <netinet/in_systm.h>
1243 #endif
1244 #if HAVE_NETINET_IN_H
1245 # include <netinet/in.h>
1246 #endif
1247 #if HAVE_NETINET_IP_H
1248 # include <netinet/ip.h>
1249 #endif
1250 #if HAVE_NETINET_UDP_H
1251 # include <netinet/udp.h>
1252 #endif
1253 ])
1255 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1256 [],
1257 [],
1258 [
1259 #if HAVE_KSTAT_H
1260 # include <kstat.h>
1261 #endif
1262 ])
1264 #
1265 # Checks for libraries begin here
1266 #
1267 with_libresolv="yes"
1268 AC_CHECK_LIB(resolv, res_search,
1269 [
1270 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1271 ],
1272 [with_libresolv="no"])
1273 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1275 dnl Check for HAL (hardware abstraction library)
1276 with_libhal="yes"
1277 AC_CHECK_LIB(hal,libhal_device_property_exists,
1278 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1279 [with_libhal="no"])
1280 if test "x$with_libhal" = "xyes"; then
1281 if test "x$PKG_CONFIG" != "x"; then
1282 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1283 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1284 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1285 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1286 fi
1287 fi
1289 m4_divert_once([HELP_WITH], [
1290 collectd additional packages:])
1292 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1294 if test "x$ac_system" = "xAIX"
1295 then
1296 with_perfstat="yes"
1297 with_procinfo="yes"
1298 else
1299 with_perfstat="no (AIX only)"
1300 with_procinfo="no (AIX only)"
1301 fi
1303 if test "x$with_perfstat" = "xyes"
1304 then
1305 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1306 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1307 fi
1308 if test "x$with_perfstat" = "xyes"
1309 then
1310 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1311 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1312 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1313 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1314 then
1315 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1316 fi
1317 fi
1318 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1320 # Processes plugin under AIX.
1321 if test "x$with_procinfo" = "xyes"
1322 then
1323 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1324 fi
1325 if test "x$with_procinfo" = "xyes"
1326 then
1327 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1328 fi
1330 if test "x$ac_system" = "xSolaris"
1331 then
1332 with_kstat="yes"
1333 with_devinfo="yes"
1334 else
1335 with_kstat="no (Solaris only)"
1336 with_devinfo="no (Solaris only)"
1337 fi
1339 if test "x$with_kstat" = "xyes"
1340 then
1341 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1342 fi
1343 if test "x$with_kstat" = "xyes"
1344 then
1345 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1346 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1347 fi
1348 if test "x$with_kstat" = "xyes"
1349 then
1350 AC_DEFINE(HAVE_LIBKSTAT, 1,
1351 [Define to 1 if you have the 'kstat' library (-lkstat)])
1352 fi
1353 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1354 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1356 with_libiokit="no"
1357 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1358 [
1359 with_libiokit="yes"
1360 ],
1361 [
1362 with_libiokit="no"
1363 ])
1364 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1366 with_libkvm="no"
1367 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1368 if test "x$with_kvm_getprocs" = "xyes"
1369 then
1370 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1371 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1372 with_libkvm="yes"
1373 fi
1374 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1376 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1377 if test "x$with_kvm_getswapinfo" = "xyes"
1378 then
1379 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1380 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1381 with_libkvm="yes"
1382 fi
1383 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1385 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1386 if test "x$with_kvm_nlist" = "xyes"
1387 then
1388 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1389 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1390 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1391 with_libkvm="yes"
1392 fi
1393 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1395 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1396 if test "x$with_kvm_openfiles" = "xyes"
1397 then
1398 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1399 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1400 with_libkvm="yes"
1401 fi
1402 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1404 # --with-libcredis {{{
1405 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1406 [
1407 if test "x$withval" = "xyes"
1408 then
1409 with_libcredis="yes"
1410 else if test "x$withval" = "xno"
1411 then
1412 with_libcredis="no"
1413 else
1414 with_libcredis="yes"
1415 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1416 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1417 fi; fi
1418 ],
1419 [with_libcredis="yes"])
1421 SAVE_CPPFLAGS="$CPPFLAGS"
1422 SAVE_LDFLAGS="$LDFLAGS"
1424 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1425 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1427 if test "x$with_libcredis" = "xyes"
1428 then
1429 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1430 then
1431 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1432 fi
1433 AC_CHECK_HEADERS(credis.h,
1434 [with_libcredis="yes"],
1435 [with_libcredis="no (credis.h not found)"])
1436 fi
1437 if test "x$with_libcredis" = "xyes"
1438 then
1439 if test "x$LIBCREDIS_LDFLAGS" != "x"
1440 then
1441 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1442 fi
1443 AC_CHECK_LIB(credis, credis_info,
1444 [with_libcredis="yes"],
1445 [with_libcredis="no (symbol 'credis_info' not found)"])
1447 fi
1449 CPPFLAGS="$SAVE_CPPFLAGS"
1450 LDFLAGS="$SAVE_LDFLAGS"
1452 if test "x$with_libcredis" = "xyes"
1453 then
1454 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1455 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1456 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1457 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1458 fi
1459 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1460 # }}}
1462 # --with-libcurl {{{
1463 with_curl_config="curl-config"
1464 with_curl_cflags=""
1465 with_curl_libs=""
1466 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1467 [
1468 if test "x$withval" = "xno"
1469 then
1470 with_libcurl="no"
1471 else if test "x$withval" = "xyes"
1472 then
1473 with_libcurl="yes"
1474 else
1475 if test -f "$withval" && test -x "$withval"
1476 then
1477 with_curl_config="$withval"
1478 with_libcurl="yes"
1479 else if test -x "$withval/bin/curl-config"
1480 then
1481 with_curl_config="$withval/bin/curl-config"
1482 with_libcurl="yes"
1483 fi; fi
1484 with_libcurl="yes"
1485 fi; fi
1486 ],
1487 [
1488 with_libcurl="yes"
1489 ])
1490 if test "x$with_libcurl" = "xyes"
1491 then
1492 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1493 curl_config_status=$?
1495 if test $curl_config_status -ne 0
1496 then
1497 with_libcurl="no ($with_curl_config failed)"
1498 else
1499 SAVE_CPPFLAGS="$CPPFLAGS"
1500 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1502 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1504 CPPFLAGS="$SAVE_CPPFLAGS"
1505 fi
1506 fi
1507 if test "x$with_libcurl" = "xyes"
1508 then
1509 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1510 curl_config_status=$?
1512 if test $curl_config_status -ne 0
1513 then
1514 with_libcurl="no ($with_curl_config failed)"
1515 else
1516 AC_CHECK_LIB(curl, curl_easy_init,
1517 [with_libcurl="yes"],
1518 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1519 [$with_curl_libs])
1520 fi
1521 fi
1522 if test "x$with_libcurl" = "xyes"
1523 then
1524 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1525 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1526 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1527 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1528 fi
1529 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1530 # }}}
1532 # --with-libdbi {{{
1533 with_libdbi_cppflags=""
1534 with_libdbi_ldflags=""
1535 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1536 [
1537 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1538 then
1539 with_libdbi_cppflags="-I$withval/include"
1540 with_libdbi_ldflags="-L$withval/lib"
1541 with_libdbi="yes"
1542 else
1543 with_libdbi="$withval"
1544 fi
1545 ],
1546 [
1547 with_libdbi="yes"
1548 ])
1549 if test "x$with_libdbi" = "xyes"
1550 then
1551 SAVE_CPPFLAGS="$CPPFLAGS"
1552 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1554 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1556 CPPFLAGS="$SAVE_CPPFLAGS"
1557 fi
1558 if test "x$with_libdbi" = "xyes"
1559 then
1560 SAVE_CPPFLAGS="$CPPFLAGS"
1561 SAVE_LDFLAGS="$LDFLAGS"
1562 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1563 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1565 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1567 CPPFLAGS="$SAVE_CPPFLAGS"
1568 LDFLAGS="$SAVE_LDFLAGS"
1569 fi
1570 if test "x$with_libdbi" = "xyes"
1571 then
1572 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1573 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1574 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1575 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1576 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1577 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1578 fi
1579 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1580 # }}}
1582 # --with-libesmtp {{{
1583 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1584 [
1585 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1586 then
1587 LDFLAGS="$LDFLAGS -L$withval/lib"
1588 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1589 with_libesmtp="yes"
1590 else
1591 with_libesmtp="$withval"
1592 fi
1593 ],
1594 [
1595 with_libesmtp="yes"
1596 ])
1597 if test "x$with_libesmtp" = "xyes"
1598 then
1599 AC_CHECK_LIB(esmtp, smtp_create_session,
1600 [
1601 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1602 ], [with_libesmtp="no (libesmtp not found)"])
1603 fi
1604 if test "x$with_libesmtp" = "xyes"
1605 then
1606 AC_CHECK_HEADERS(libesmtp.h,
1607 [
1608 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1609 ], [with_libesmtp="no (libesmtp.h not found)"])
1610 fi
1611 if test "x$with_libesmtp" = "xyes"
1612 then
1613 collect_libesmtp=1
1614 else
1615 collect_libesmtp=0
1616 fi
1617 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1618 [Wether or not to use the esmtp library])
1619 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1620 # }}}
1622 # --with-libganglia {{{
1623 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1624 [
1625 if test -f "$withval" && test -x "$withval"
1626 then
1627 with_libganglia_config="$withval"
1628 with_libganglia="yes"
1629 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1630 then
1631 with_libganglia_config="$withval/bin/ganglia-config"
1632 with_libganglia="yes"
1633 else if test -d "$withval"
1634 then
1635 GANGLIA_CPPFLAGS="-I$withval/include"
1636 GANGLIA_LDFLAGS="-L$withval/lib"
1637 with_libganglia="yes"
1638 else
1639 with_libganglia_config="ganglia-config"
1640 with_libganglia="$withval"
1641 fi; fi; fi
1642 ],
1643 [
1644 with_libganglia_config="ganglia-config"
1645 with_libganglia="yes"
1646 ])
1648 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1649 then
1650 if test "x$GANGLIA_CPPFLAGS" = "x"
1651 then
1652 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1653 fi
1655 if test "x$GANGLIA_LDFLAGS" = "x"
1656 then
1657 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1658 fi
1660 if test "x$GANGLIA_LIBS" = "x"
1661 then
1662 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1663 fi
1664 fi
1666 SAVE_CPPFLAGS="$CPPFLAGS"
1667 SAVE_LDFLAGS="$LDFLAGS"
1668 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1669 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1671 if test "x$with_libganglia" = "xyes"
1672 then
1673 AC_CHECK_HEADERS(gm_protocol.h,
1674 [
1675 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1676 [Define to 1 if you have the <gm_protocol.h> header file.])
1677 ], [with_libganglia="no (gm_protocol.h not found)"])
1678 fi
1680 if test "x$with_libganglia" = "xyes"
1681 then
1682 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1683 [
1684 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1685 [Define to 1 if you have the ganglia library (-lganglia).])
1686 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1687 fi
1689 CPPFLAGS="$SAVE_CPPFLAGS"
1690 LDFLAGS="$SAVE_LDFLAGS"
1692 AC_SUBST(GANGLIA_CPPFLAGS)
1693 AC_SUBST(GANGLIA_LDFLAGS)
1694 AC_SUBST(GANGLIA_LIBS)
1695 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1696 # }}}
1698 # --with-libgcrypt {{{
1699 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1700 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1701 GCRYPT_LIBS="$GCRYPT_LIBS"
1702 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1703 [
1704 if test -f "$withval" && test -x "$withval"
1705 then
1706 with_libgcrypt_config="$withval"
1707 with_libgcrypt="yes"
1708 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1709 then
1710 with_libgcrypt_config="$withval/bin/gcrypt-config"
1711 with_libgcrypt="yes"
1712 else if test -d "$withval"
1713 then
1714 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1715 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1716 with_libgcrypt="yes"
1717 else
1718 with_libgcrypt_config="gcrypt-config"
1719 with_libgcrypt="$withval"
1720 fi; fi; fi
1721 ],
1722 [
1723 with_libgcrypt_config="libgcrypt-config"
1724 with_libgcrypt="yes"
1725 ])
1727 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1728 then
1729 if test "x$GCRYPT_CPPFLAGS" = "x"
1730 then
1731 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1732 fi
1734 if test "x$GCRYPT_LDFLAGS" = "x"
1735 then
1736 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1737 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1738 fi
1740 if test "x$GCRYPT_LIBS" = "x"
1741 then
1742 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1743 fi
1744 fi
1746 SAVE_CPPFLAGS="$CPPFLAGS"
1747 SAVE_LDFLAGS="$LDFLAGS"
1748 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1749 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1751 if test "x$with_libgcrypt" = "xyes"
1752 then
1753 if test "x$GCRYPT_CPPFLAGS" != "x"
1754 then
1755 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1756 fi
1757 AC_CHECK_HEADERS(gcrypt.h,
1758 [with_libgcrypt="yes"],
1759 [with_libgcrypt="no (gcrypt.h not found)"])
1760 fi
1762 if test "x$with_libgcrypt" = "xyes"
1763 then
1764 if test "x$GCRYPT_LDFLAGS" != "x"
1765 then
1766 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1767 fi
1768 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1769 [with_libgcrypt="yes"],
1770 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1772 if test "$with_libgcrypt" != "no"; then
1773 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1774 fi
1775 fi
1777 CPPFLAGS="$SAVE_CPPFLAGS"
1778 LDFLAGS="$SAVE_LDFLAGS"
1780 if test "x$with_libgcrypt" = "xyes"
1781 then
1782 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1783 fi
1785 AC_SUBST(GCRYPT_CPPFLAGS)
1786 AC_SUBST(GCRYPT_LDFLAGS)
1787 AC_SUBST(GCRYPT_LIBS)
1788 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1789 # }}}
1791 # --with-libiptc {{{
1792 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1793 [
1794 if test "x$withval" = "xshipped"
1795 then
1796 with_libiptc="own"
1797 else if test "x$withval" = "xyes"
1798 then
1799 with_libiptc="pkgconfig"
1800 else if test "x$withval" = "xno"
1801 then
1802 with_libiptc="no"
1803 else
1804 with_libiptc="yes"
1805 with_libiptc_cflags="-I$withval/include"
1806 with_libiptc_libs="-L$withval/lib"
1807 fi; fi; fi
1808 ],
1809 [
1810 if test "x$ac_system" = "xLinux"
1811 then
1812 with_libiptc="pkgconfig"
1813 else
1814 with_libiptc="no (Linux only)"
1815 fi
1816 ])
1818 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1819 then
1820 with_libiptc="no (Don't have pkg-config)"
1821 fi
1823 if test "x$with_libiptc" = "xpkgconfig"
1824 then
1825 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1826 if test $? -ne 0
1827 then
1828 with_libiptc="no (pkg-config doesn't know libiptc)"
1829 fi
1830 fi
1831 if test "x$with_libiptc" = "xpkgconfig"
1832 then
1833 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1834 if test $? -ne 0
1835 then
1836 with_libiptc="no ($PKG_CONFIG failed)"
1837 fi
1838 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1839 if test $? -ne 0
1840 then
1841 with_libiptc="no ($PKG_CONFIG failed)"
1842 fi
1843 fi
1845 SAVE_CPPFLAGS="$CPPFLAGS"
1846 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1848 # check whether the header file for libiptc is available.
1849 if test "x$with_libiptc" = "xpkgconfig"
1850 then
1851 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1852 [with_libiptc="no (header file missing)"])
1853 fi
1854 # If the header file is available, check for the required type declaractions.
1855 # They may be missing in old versions of libiptc. In that case, they will be
1856 # declared in the iptables plugin.
1857 if test "x$with_libiptc" = "xpkgconfig"
1858 then
1859 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1860 fi
1861 # Check for the iptc_init symbol in the library.
1862 # This could be in iptc or ip4tc
1863 if test "x$with_libiptc" = "xpkgconfig"
1864 then
1865 SAVE_LIBS="$LIBS"
1866 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1867 [with_libiptc="pkgconfig"],
1868 [with_libiptc="no"],
1869 [$with_libiptc_libs])
1870 LIBS="$SAVE_LIBS"
1871 fi
1872 if test "x$with_libiptc" = "xpkgconfig"
1873 then
1874 with_libiptc="yes"
1875 fi
1877 CPPFLAGS="$SAVE_CPPFLAGS"
1879 if test "x$with_libiptc" = "xown"
1880 then
1881 with_libiptc_cflags=""
1882 with_libiptc_libs=""
1883 fi
1884 if test "x$with_libiptc" = "xown"
1885 then
1886 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1887 [
1888 with_libiptc="no (Linux iptables headers not found)"
1889 ],
1890 [
1891 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1892 ])
1893 fi
1894 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1895 if test "x$with_libiptc" = "xown"
1896 then
1897 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1898 with_libiptc="yes"
1899 fi
1901 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1902 if test "x$with_libiptc" = "xyes"
1903 then
1904 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1905 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1906 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1907 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1908 fi
1909 # }}}
1911 # --with-java {{{
1912 with_java_home="$JAVA_HOME"
1913 with_java_vmtype="client"
1914 with_java_cflags=""
1915 with_java_libs=""
1916 JAVAC="$JAVAC"
1917 JAR="$JAR"
1918 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1919 [
1920 if test "x$withval" = "xno"
1921 then
1922 with_java="no"
1923 else if test "x$withval" = "xyes"
1924 then
1925 with_java="yes"
1926 else
1927 with_java_home="$withval"
1928 with_java="yes"
1929 fi; fi
1930 ],
1931 [with_java="yes"])
1932 if test "x$with_java" = "xyes"
1933 then
1934 if test -d "$with_java_home"
1935 then
1936 AC_MSG_CHECKING([for jni.h])
1937 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1938 if test "x$TMPDIR" != "x"
1939 then
1940 AC_MSG_RESULT([found in $TMPDIR])
1941 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1942 else
1943 AC_MSG_RESULT([not found])
1944 fi
1946 AC_MSG_CHECKING([for jni_md.h])
1947 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1948 if test "x$TMPDIR" != "x"
1949 then
1950 AC_MSG_RESULT([found in $TMPDIR])
1951 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1952 else
1953 AC_MSG_RESULT([not found])
1954 fi
1956 AC_MSG_CHECKING([for libjvm.so])
1957 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1958 if test "x$TMPDIR" != "x"
1959 then
1960 AC_MSG_RESULT([found in $TMPDIR])
1961 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1962 else
1963 AC_MSG_RESULT([not found])
1964 fi
1966 if test "x$JAVAC" = "x"
1967 then
1968 AC_MSG_CHECKING([for javac])
1969 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1970 if test "x$TMPDIR" != "x"
1971 then
1972 JAVAC="$TMPDIR"
1973 AC_MSG_RESULT([$JAVAC])
1974 else
1975 AC_MSG_RESULT([not found])
1976 fi
1977 fi
1978 if test "x$JAR" = "x"
1979 then
1980 AC_MSG_CHECKING([for jar])
1981 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1982 if test "x$TMPDIR" != "x"
1983 then
1984 JAR="$TMPDIR"
1985 AC_MSG_RESULT([$JAR])
1986 else
1987 AC_MSG_RESULT([not found])
1988 fi
1989 fi
1990 else if test "x$with_java_home" != "x"
1991 then
1992 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1993 fi; fi
1994 fi
1996 if test "x$JAVA_CPPFLAGS" != "x"
1997 then
1998 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1999 fi
2000 if test "x$JAVA_CFLAGS" != "x"
2001 then
2002 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2003 fi
2004 if test "x$JAVA_LDFLAGS" != "x"
2005 then
2006 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2007 fi
2008 if test "x$JAVAC" = "x"
2009 then
2010 with_javac_path="$PATH"
2011 if test "x$with_java_home" != "x"
2012 then
2013 with_javac_path="$with_java_home:with_javac_path"
2014 if test -d "$with_java_home/bin"
2015 then
2016 with_javac_path="$with_java_home/bin:with_javac_path"
2017 fi
2018 fi
2020 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2021 fi
2022 if test "x$JAVAC" = "x"
2023 then
2024 with_java="no (javac not found)"
2025 fi
2026 if test "x$JAR" = "x"
2027 then
2028 with_jar_path="$PATH"
2029 if test "x$with_java_home" != "x"
2030 then
2031 with_jar_path="$with_java_home:$with_jar_path"
2032 if test -d "$with_java_home/bin"
2033 then
2034 with_jar_path="$with_java_home/bin:$with_jar_path"
2035 fi
2036 fi
2038 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2039 fi
2040 if test "x$JAR" = "x"
2041 then
2042 with_java="no (jar not found)"
2043 fi
2045 SAVE_CPPFLAGS="$CPPFLAGS"
2046 SAVE_CFLAGS="$CFLAGS"
2047 SAVE_LDFLAGS="$LDFLAGS"
2048 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2049 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2050 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2052 if test "x$with_java" = "xyes"
2053 then
2054 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2055 fi
2056 if test "x$with_java" = "xyes"
2057 then
2058 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2059 [with_java="yes"],
2060 [with_java="no (libjvm not found)"],
2061 [$JAVA_LIBS])
2062 fi
2063 if test "x$with_java" = "xyes"
2064 then
2065 JAVA_LIBS="$JAVA_LIBS -ljvm"
2066 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2067 fi
2069 CPPFLAGS="$SAVE_CPPFLAGS"
2070 CFLAGS="$SAVE_CFLAGS"
2071 LDFLAGS="$SAVE_LDFLAGS"
2073 AC_SUBST(JAVA_CPPFLAGS)
2074 AC_SUBST(JAVA_CFLAGS)
2075 AC_SUBST(JAVA_LDFLAGS)
2076 AC_SUBST(JAVA_LIBS)
2077 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2078 # }}}
2080 # --with-libmemcached {{{
2081 with_libmemcached_cppflags=""
2082 with_libmemcached_ldflags=""
2083 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2084 [
2085 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2086 then
2087 with_libmemcached_cppflags="-I$withval/include"
2088 with_libmemcached_ldflags="-L$withval/lib"
2089 with_libmemcached="yes"
2090 else
2091 with_libmemcached="$withval"
2092 fi
2093 ],
2094 [
2095 with_libmemcached="yes"
2096 ])
2097 if test "x$with_libmemcached" = "xyes"
2098 then
2099 SAVE_CPPFLAGS="$CPPFLAGS"
2100 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2102 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2104 CPPFLAGS="$SAVE_CPPFLAGS"
2105 fi
2106 if test "x$with_libmemcached" = "xyes"
2107 then
2108 SAVE_CPPFLAGS="$CPPFLAGS"
2109 SAVE_LDFLAGS="$LDFLAGS"
2110 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2111 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2113 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2115 CPPFLAGS="$SAVE_CPPFLAGS"
2116 LDFLAGS="$SAVE_LDFLAGS"
2117 fi
2118 if test "x$with_libmemcached" = "xyes"
2119 then
2120 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2121 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2122 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2123 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2124 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2125 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2126 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2127 fi
2128 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2129 # }}}
2131 # --with-libmodbus {{{
2132 with_libmodbus_config=""
2133 with_libmodbus_cflags=""
2134 with_libmodbus_libs=""
2135 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2136 [
2137 if test "x$withval" = "xno"
2138 then
2139 with_libmodbus="no"
2140 else if test "x$withval" = "xyes"
2141 then
2142 with_libmodbus="use_pkgconfig"
2143 else if test -d "$with_libmodbus/lib"
2144 then
2145 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2146 with_libmodbus_cflags="-I$withval/include"
2147 with_libmodbus_libs="-L$withval/lib -lmodbus"
2148 with_libmodbus="yes"
2149 fi; fi; fi
2150 ],
2151 [with_libmodbus="use_pkgconfig"])
2153 # configure using pkg-config
2154 if test "x$with_libmodbus" = "xuse_pkgconfig"
2155 then
2156 if test "x$PKG_CONFIG" = "x"
2157 then
2158 with_libmodbus="no (Don't have pkg-config)"
2159 fi
2160 fi
2161 if test "x$with_libmodbus" = "xuse_pkgconfig"
2162 then
2163 AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
2164 $PKG_CONFIG --exists 'modbus' 2>/dev/null
2165 if test $? -ne 0
2166 then
2167 with_libmodbus="no (pkg-config doesn't know modbus)"
2168 fi
2169 fi
2170 if test "x$with_libmodbus" = "xuse_pkgconfig"
2171 then
2172 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
2173 if test $? -ne 0
2174 then
2175 with_libmodbus="no ($PKG_CONFIG failed)"
2176 fi
2177 with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
2178 if test $? -ne 0
2179 then
2180 with_libmodbus="no ($PKG_CONFIG failed)"
2181 fi
2182 fi
2183 if test "x$with_libmodbus" = "xuse_pkgconfig"
2184 then
2185 with_libmodbus="yes"
2186 fi
2188 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2189 # the actual checks.
2190 if test "x$with_libmodbus" = "xyes"
2191 then
2192 SAVE_CPPFLAGS="$CPPFLAGS"
2193 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2195 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2197 CPPFLAGS="$SAVE_CPPFLAGS"
2198 fi
2199 if test "x$with_libmodbus" = "xyes"
2200 then
2201 SAVE_CPPFLAGS="$CPPFLAGS"
2202 SAVE_LDFLAGS="$LDFLAGS"
2204 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2205 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2207 AC_CHECK_LIB(modbus, modbus_connect,
2208 [with_libmodbus="yes"],
2209 [with_libmodbus="no (symbol modbus_connect not found)"])
2211 CPPFLAGS="$SAVE_CPPFLAGS"
2212 LDFLAGS="$SAVE_LDFLAGS"
2213 fi
2214 if test "x$with_libmodbus" = "xyes"
2215 then
2216 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2217 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2218 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2219 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2220 fi
2221 # }}}
2223 # --with-libmysql {{{
2224 with_mysql_config="mysql_config"
2225 with_mysql_cflags=""
2226 with_mysql_libs=""
2227 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2228 [
2229 if test "x$withval" = "xno"
2230 then
2231 with_libmysql="no"
2232 else if test "x$withval" = "xyes"
2233 then
2234 with_libmysql="yes"
2235 else
2236 if test -f "$withval" && test -x "$withval";
2237 then
2238 with_mysql_config="$withval"
2239 else if test -x "$withval/bin/mysql_config"
2240 then
2241 with_mysql_config="$withval/bin/mysql_config"
2242 fi; fi
2243 with_libmysql="yes"
2244 fi; fi
2245 ],
2246 [
2247 with_libmysql="yes"
2248 ])
2249 if test "x$with_libmysql" = "xyes"
2250 then
2251 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2252 mysql_config_status=$?
2254 if test $mysql_config_status -ne 0
2255 then
2256 with_libmysql="no ($with_mysql_config failed)"
2257 else
2258 SAVE_CPPFLAGS="$CPPFLAGS"
2259 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2261 have_mysql_h="no"
2262 have_mysql_mysql_h="no"
2263 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2265 if test "x$have_mysql_h" = "xno"
2266 then
2267 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2268 fi
2270 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2271 then
2272 with_libmysql="no (mysql.h not found)"
2273 fi
2275 CPPFLAGS="$SAVE_CPPFLAGS"
2276 fi
2277 fi
2278 if test "x$with_libmysql" = "xyes"
2279 then
2280 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2281 mysql_config_status=$?
2283 if test $mysql_config_status -ne 0
2284 then
2285 with_libmysql="no ($with_mysql_config failed)"
2286 else
2287 AC_CHECK_LIB(mysqlclient, mysql_init,
2288 [with_libmysql="yes"],
2289 [with_libmysql="no (symbol 'mysql_init' not found)"],
2290 [$with_mysql_libs])
2292 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2293 [with_libmysql="yes"],
2294 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2295 [$with_mysql_libs])
2296 fi
2297 fi
2298 if test "x$with_libmysql" = "xyes"
2299 then
2300 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2301 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2302 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2303 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2304 fi
2305 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2306 # }}}
2308 # --with-libnetlink {{{
2309 with_libnetlink_cflags=""
2310 with_libnetlink_libs="-lnetlink"
2311 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2312 [
2313 echo "libnetlink: withval = $withval"
2314 if test "x$withval" = "xyes"
2315 then
2316 with_libnetlink="yes"
2317 else if test "x$withval" = "xno"
2318 then
2319 with_libnetlink="no"
2320 else
2321 if test -d "$withval/include"
2322 then
2323 with_libnetlink_cflags="-I$withval/include"
2324 with_libnetlink_libs="-L$withval/lib -lnetlink"
2325 with_libnetlink="yes"
2326 else
2327 AC_MSG_ERROR("no such directory: $withval/include")
2328 fi
2329 fi; fi
2330 ],
2331 [
2332 if test "x$ac_system" = "xLinux"
2333 then
2334 with_libnetlink="yes"
2335 else
2336 with_libnetlink="no (Linux only library)"
2337 fi
2338 ])
2339 if test "x$with_libnetlink" = "xyes"
2340 then
2341 SAVE_CFLAGS="$CFLAGS"
2342 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2344 with_libnetlink="no (libnetlink.h not found)"
2346 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2347 [
2348 with_libnetlink="yes"
2349 break
2350 ], [],
2351 [#include <stdio.h>
2352 #include <sys/types.h>
2353 #include <asm/types.h>
2354 #include <sys/socket.h>
2355 #include <linux/netlink.h>
2356 #include <linux/rtnetlink.h>])
2357 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2358 [#include <stdio.h>
2359 #include <sys/types.h>
2360 #include <asm/types.h>
2361 #include <sys/socket.h>])
2363 AC_COMPILE_IFELSE(
2364 [#include <stdio.h>
2365 #include <sys/types.h>
2366 #include <asm/types.h>
2367 #include <sys/socket.h>
2368 #include <linux/netlink.h>
2369 #include <linux/rtnetlink.h>
2371 int main (void)
2372 {
2373 int retval = TCA_STATS2;
2374 return (retval);
2375 }],
2376 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2377 []);
2379 AC_COMPILE_IFELSE(
2380 [#include <stdio.h>
2381 #include <sys/types.h>
2382 #include <asm/types.h>
2383 #include <sys/socket.h>
2384 #include <linux/netlink.h>
2385 #include <linux/rtnetlink.h>
2387 int main (void)
2388 {
2389 int retval = TCA_STATS;
2390 return (retval);
2391 }],
2392 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2393 []);
2395 CFLAGS="$SAVE_CFLAGS"
2396 fi
2397 if test "x$with_libnetlink" = "xyes"
2398 then
2399 AC_CHECK_LIB(netlink, rtnl_open,
2400 [with_libnetlink="yes"],
2401 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2402 [$with_libnetlink_libs])
2403 fi
2404 if test "x$with_libnetlink" = "xyes"
2405 then
2406 SAVE_CFLAGS="$CFLAGS"
2407 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2409 AC_CACHE_CHECK(
2410 [if function 'rtnl_dump_filter' expects five arguments],
2411 [c_cv_rtnl_dump_filter_five_args],
2412 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2413 [
2414 AC_INCLUDES_DEFAULT
2415 #include <asm/types.h>
2416 #include <sys/socket.h>
2417 #if HAVE_LIBNETLINK_H
2418 # include <libnetlink.h>
2419 #elif HAVE_IPROUTE_LIBNETLINK_H
2420 # include <iproute/libnetlink.h>
2421 #elif HAVE_LINUX_LIBNETLINK_H
2422 # include <linux/libnetlink.h>
2423 #endif
2424 ],
2425 [
2426 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2427 return 1;
2428 return 0;
2429 ]
2430 )],
2431 [c_cv_rtnl_dump_filter_five_args="yes"],
2432 [c_cv_rtnl_dump_filter_five_args="no"]
2433 )
2434 )
2436 AC_CACHE_CHECK(
2437 [if function 'rtnl_dump_filter' expects three arguments],
2438 [c_cv_rtnl_dump_filter_three_args],
2439 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2440 [
2441 AC_INCLUDES_DEFAULT
2442 #include <asm/types.h>
2443 #include <sys/socket.h>
2444 #if HAVE_LIBNETLINK_H
2445 # include <libnetlink.h>
2446 #elif HAVE_IPROUTE_LIBNETLINK_H
2447 # include <iproute/libnetlink.h>
2448 #elif HAVE_LINUX_LIBNETLINK_H
2449 # include <linux/libnetlink.h>
2450 #endif
2451 ],
2452 [
2453 if (rtnl_dump_filter(NULL, NULL, NULL))
2454 return 1;
2455 return 0;
2456 ]
2457 )],
2458 [c_cv_rtnl_dump_filter_three_args="yes"],
2459 [c_cv_rtnl_dump_filter_three_args="no"]
2460 )
2461 )
2463 CFLAGS="$SAVE_CFLAGS"
2465 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2466 then
2467 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2468 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2469 fi
2470 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2471 then
2472 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2473 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2474 fi
2476 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2477 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2478 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2479 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2480 fi
2481 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2482 # }}}
2484 # --with-libnetapp {{{
2485 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2486 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2487 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2488 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2489 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2490 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2491 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2492 [
2493 if test -d "$withval"
2494 then
2495 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2496 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2497 with_libnetapp="yes"
2498 else
2499 with_libnetapp="$withval"
2500 fi
2501 ],
2502 [
2503 with_libnetapp="yes"
2504 ])
2506 SAVE_CPPFLAGS="$CPPFLAGS"
2507 SAVE_LDFLAGS="$LDFLAGS"
2508 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2509 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2511 if test "x$with_libnetapp" = "xyes"
2512 then
2513 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2514 then
2515 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2516 fi
2517 AC_CHECK_HEADERS(netapp_api.h,
2518 [with_libnetapp="yes"],
2519 [with_libnetapp="no (netapp_api.h not found)"])
2520 fi
2522 if test "x$with_libnetapp" = "xyes"
2523 then
2524 if test "x$LIBNETAPP_LDFLAGS" != "x"
2525 then
2526 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2527 fi
2529 if test "x$LIBNETAPP_LIBS" = "x"
2530 then
2531 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2532 fi
2533 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2535 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2536 [with_libnetapp="yes"],
2537 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2538 [$LIBNETAPP_LIBS])
2539 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2540 fi
2542 CPPFLAGS="$SAVE_CPPFLAGS"
2543 LDFLAGS="$SAVE_LDFLAGS"
2545 if test "x$with_libnetapp" = "xyes"
2546 then
2547 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2548 fi
2550 AC_SUBST(LIBNETAPP_CPPFLAGS)
2551 AC_SUBST(LIBNETAPP_LDFLAGS)
2552 AC_SUBST(LIBNETAPP_LIBS)
2553 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2554 # }}}
2556 # --with-libnetsnmp {{{
2557 with_snmp_config="net-snmp-config"
2558 with_snmp_cflags=""
2559 with_snmp_libs=""
2560 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2561 [
2562 if test "x$withval" = "xno"
2563 then
2564 with_libnetsnmp="no"
2565 else if test "x$withval" = "xyes"
2566 then
2567 with_libnetsnmp="yes"
2568 else
2569 if test -x "$withval"
2570 then
2571 with_snmp_config="$withval"
2572 with_libnetsnmp="yes"
2573 else
2574 with_snmp_config="$withval/bin/net-snmp-config"
2575 with_libnetsnmp="yes"
2576 fi
2577 fi; fi
2578 ],
2579 [with_libnetsnmp="yes"])
2580 if test "x$with_libnetsnmp" = "xyes"
2581 then
2582 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2583 snmp_config_status=$?
2585 if test $snmp_config_status -ne 0
2586 then
2587 with_libnetsnmp="no ($with_snmp_config failed)"
2588 else
2589 SAVE_CPPFLAGS="$CPPFLAGS"
2590 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2592 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2594 CPPFLAGS="$SAVE_CPPFLAGS"
2595 fi
2596 fi
2597 if test "x$with_libnetsnmp" = "xyes"
2598 then
2599 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2600 snmp_config_status=$?
2602 if test $snmp_config_status -ne 0
2603 then
2604 with_libnetsnmp="no ($with_snmp_config failed)"
2605 else
2606 AC_CHECK_LIB(netsnmp, init_snmp,
2607 [with_libnetsnmp="yes"],
2608 [with_libnetsnmp="no (libnetsnmp not found)"],
2609 [$with_snmp_libs])
2610 fi
2611 fi
2612 if test "x$with_libnetsnmp" = "xyes"
2613 then
2614 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2615 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2616 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2617 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2618 fi
2619 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2620 # }}}
2622 # --with-liboconfig {{{
2623 with_own_liboconfig="no"
2624 liboconfig_LDFLAGS="$LDFLAGS"
2625 liboconfig_CPPFLAGS="$CPPFLAGS"
2626 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2627 [
2628 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2629 then
2630 if test -d "$withval/lib"
2631 then
2632 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2633 fi
2634 if test -d "$withval/include"
2635 then
2636 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2637 fi
2638 fi
2639 if test "x$withval" = "xno"
2640 then
2641 AC_MSG_ERROR("liboconfig is required")
2642 fi
2643 ],
2644 [
2645 with_liboconfig="yes"
2646 ])
2648 save_LDFLAGS="$LDFLAGS"
2649 save_CPPFLAGS="$CPPFLAGS"
2650 LDFLAGS="$liboconfig_LDFLAGS"
2651 CPPFLAGS="$liboconfig_CPPFLAGS"
2652 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2653 [
2654 with_liboconfig="yes"
2655 with_own_liboconfig="no"
2656 ],
2657 [
2658 with_liboconfig="yes"
2659 with_own_liboconfig="yes"
2660 LDFLAGS="$save_LDFLAGS"
2661 CPPFLAGS="$save_CPPFLAGS"
2662 ])
2664 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2665 if test "x$with_own_liboconfig" = "xyes"
2666 then
2667 with_liboconfig="yes (shipped version)"
2668 fi
2669 # }}}
2671 # --with-liboping {{{
2672 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2673 [
2674 if test "x$withval" = "xyes"
2675 then
2676 with_liboping="yes"
2677 else if test "x$withval" = "xno"
2678 then
2679 with_liboping="no"
2680 else
2681 with_liboping="yes"
2682 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2683 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2684 fi; fi
2685 ],
2686 [with_liboping="yes"])
2688 SAVE_CPPFLAGS="$CPPFLAGS"
2689 SAVE_LDFLAGS="$LDFLAGS"
2691 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2692 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2694 if test "x$with_liboping" = "xyes"
2695 then
2696 if test "x$LIBOPING_CPPFLAGS" != "x"
2697 then
2698 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2699 fi
2700 AC_CHECK_HEADERS(oping.h,
2701 [with_liboping="yes"],
2702 [with_liboping="no (oping.h not found)"])
2703 fi
2704 if test "x$with_liboping" = "xyes"
2705 then
2706 if test "x$LIBOPING_LDFLAGS" != "x"
2707 then
2708 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2709 fi
2710 AC_CHECK_LIB(oping, ping_construct,
2711 [with_liboping="yes"],
2712 [with_liboping="no (symbol 'ping_construct' not found)"])
2713 fi
2715 CPPFLAGS="$SAVE_CPPFLAGS"
2716 LDFLAGS="$SAVE_LDFLAGS"
2718 if test "x$with_liboping" = "xyes"
2719 then
2720 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2721 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2722 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2723 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2724 fi
2725 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2726 # }}}
2728 # --with-oracle {{{
2729 with_oracle_cppflags=""
2730 with_oracle_libs=""
2731 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2732 [
2733 if test "x$withval" = "xyes"
2734 then
2735 if test "x$ORACLE_HOME" = "x"
2736 then
2737 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2738 fi
2739 with_oracle="yes"
2740 else if test "x$withval" = "xno"
2741 then
2742 with_oracle="no"
2743 else
2744 with_oracle="yes"
2745 ORACLE_HOME="$withval"
2746 fi; fi
2747 ],
2748 [
2749 if test "x$ORACLE_HOME" = "x"
2750 then
2751 with_oracle="no (ORACLE_HOME is not set)"
2752 else
2753 with_oracle="yes"
2754 fi
2755 ])
2756 if test "x$ORACLE_HOME" != "x"
2757 then
2758 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2760 if test -e "$ORACLE_HOME/lib/ldflags"
2761 then
2762 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2763 fi
2764 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2765 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2766 fi
2767 if test "x$with_oracle" = "xyes"
2768 then
2769 SAVE_CPPFLAGS="$CPPFLAGS"
2770 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2772 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2774 CPPFLAGS="$SAVE_CPPFLAGS"
2775 fi
2776 if test "x$with_oracle" = "xyes"
2777 then
2778 SAVE_CPPFLAGS="$CPPFLAGS"
2779 SAVE_LDFLAGS="$LDFLAGS"
2780 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2781 LDFLAGS="$LDFLAGS $with_oracle_libs"
2783 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2785 CPPFLAGS="$SAVE_CPPFLAGS"
2786 LDFLAGS="$SAVE_LDFLAGS"
2787 fi
2788 if test "x$with_oracle" = "xyes"
2789 then
2790 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2791 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2792 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2793 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2794 fi
2795 # }}}
2797 # --with-libowcapi {{{
2798 with_libowcapi_cppflags=""
2799 with_libowcapi_libs="-lowcapi"
2800 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2801 [
2802 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2803 then
2804 with_libowcapi_cppflags="-I$withval/include"
2805 with_libowcapi_libs="-L$withval/lib -lowcapi"
2806 with_libowcapi="yes"
2807 else
2808 with_libowcapi="$withval"
2809 fi
2810 ],
2811 [
2812 with_libowcapi="yes"
2813 ])
2814 if test "x$with_libowcapi" = "xyes"
2815 then
2816 SAVE_CPPFLAGS="$CPPFLAGS"
2817 CPPFLAGS="$with_libowcapi_cppflags"
2819 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2821 CPPFLAGS="$SAVE_CPPFLAGS"
2822 fi
2823 if test "x$with_libowcapi" = "xyes"
2824 then
2825 SAVE_LDFLAGS="$LDFLAGS"
2826 SAVE_CPPFLAGS="$CPPFLAGS"
2827 LDFLAGS="$with_libowcapi_libs"
2828 CPPFLAGS="$with_libowcapi_cppflags"
2830 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2832 LDFLAGS="$SAVE_LDFLAGS"
2833 CPPFLAGS="$SAVE_CPPFLAGS"
2834 fi
2835 if test "x$with_libowcapi" = "xyes"
2836 then
2837 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2838 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2839 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2840 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2841 fi
2842 # }}}
2844 # --with-libpcap {{{
2845 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2846 [
2847 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2848 then
2849 LDFLAGS="$LDFLAGS -L$withval/lib"
2850 CPPFLAGS="$CPPFLAGS -I$withval/include"
2851 with_libpcap="yes"
2852 else
2853 with_libpcap="$withval"
2854 fi
2855 ],
2856 [
2857 with_libpcap="yes"
2858 ])
2859 if test "x$with_libpcap" = "xyes"
2860 then
2861 AC_CHECK_LIB(pcap, pcap_open_live,
2862 [
2863 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2864 ], [with_libpcap="no (libpcap not found)"])
2865 fi
2866 if test "x$with_libpcap" = "xyes"
2867 then
2868 AC_CHECK_HEADERS(pcap.h,,
2869 [with_libpcap="no (pcap.h not found)"])
2870 fi
2871 if test "x$with_libpcap" = "xyes"
2872 then
2873 AC_CHECK_HEADERS(pcap-bpf.h,,
2874 [with_libpcap="no (pcap-bpf.h not found)"])
2875 fi
2876 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2877 # }}}
2879 # --with-libperl {{{
2880 perl_interpreter="perl"
2881 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2882 [
2883 if test -f "$withval" && test -x "$withval"
2884 then
2885 perl_interpreter="$withval"
2886 with_libperl="yes"
2887 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2888 then
2889 LDFLAGS="$LDFLAGS -L$withval/lib"
2890 CPPFLAGS="$CPPFLAGS -I$withval/include"
2891 perl_interpreter="$withval/bin/perl"
2892 with_libperl="yes"
2893 else
2894 with_libperl="$withval"
2895 fi; fi
2896 ],
2897 [
2898 with_libperl="yes"
2899 ])
2901 AC_MSG_CHECKING([for perl])
2902 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2903 if test -x "$perl_interpreter"
2904 then
2905 AC_MSG_RESULT([yes ($perl_interpreter)])
2906 else
2907 perl_interpreter=""
2908 AC_MSG_RESULT([no])
2909 fi
2911 AC_SUBST(PERL, "$perl_interpreter")
2913 if test "x$with_libperl" = "xyes" \
2914 && test -n "$perl_interpreter"
2915 then
2916 SAVE_CFLAGS="$CFLAGS"
2917 SAVE_LDFLAGS="$LDFLAGS"
2918 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2919 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2920 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2921 CFLAGS="$CFLAGS $PERL_CFLAGS"
2922 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2924 AC_CACHE_CHECK([for libperl],
2925 [c_cv_have_libperl],
2926 AC_LINK_IFELSE(
2927 AC_LANG_PROGRAM(
2928 [[
2929 #define PERL_NO_GET_CONTEXT
2930 #include <EXTERN.h>
2931 #include <perl.h>
2932 #include <XSUB.h>
2933 ]],
2934 [[
2935 dTHX;
2936 load_module (PERL_LOADMOD_NOIMPORT,
2937 newSVpv ("Collectd::Plugin::FooBar", 24),
2938 Nullsv);
2939 ]]),
2940 [c_cv_have_libperl="yes"],
2941 [c_cv_have_libperl="no"]
2942 )
2943 )
2945 if test "x$c_cv_have_libperl" = "xyes"
2946 then
2947 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2948 AC_SUBST(PERL_CFLAGS)
2949 AC_SUBST(PERL_LDFLAGS)
2950 else
2951 with_libperl="no"
2952 fi
2954 CFLAGS="$SAVE_CFLAGS"
2955 LDFLAGS="$SAVE_LDFLAGS"
2956 else if test -z "$perl_interpreter"; then
2957 with_libperl="no (no perl interpreter found)"
2958 c_cv_have_libperl="no"
2959 fi; fi
2960 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2962 if test "x$with_libperl" = "xyes"
2963 then
2964 SAVE_CFLAGS="$CFLAGS"
2965 SAVE_LDFLAGS="$LDFLAGS"
2966 CFLAGS="$CFLAGS $PERL_CFLAGS"
2967 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2969 AC_CACHE_CHECK([if perl supports ithreads],
2970 [c_cv_have_perl_ithreads],
2971 AC_LINK_IFELSE(
2972 AC_LANG_PROGRAM(
2973 [[
2974 #include <EXTERN.h>
2975 #include <perl.h>
2976 #include <XSUB.h>
2978 #if !defined(USE_ITHREADS)
2979 # error "Perl does not support ithreads!"
2980 #endif /* !defined(USE_ITHREADS) */
2981 ]],
2982 [[ ]]),
2983 [c_cv_have_perl_ithreads="yes"],
2984 [c_cv_have_perl_ithreads="no"]
2985 )
2986 )
2988 if test "x$c_cv_have_perl_ithreads" = "xyes"
2989 then
2990 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2991 fi
2993 CFLAGS="$SAVE_CFLAGS"
2994 LDFLAGS="$SAVE_LDFLAGS"
2995 fi
2997 if test "x$with_libperl" = "xyes"
2998 then
2999 SAVE_CFLAGS="$CFLAGS"
3000 SAVE_LDFLAGS="$LDFLAGS"
3001 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3002 # (see issues #41 and #42)
3003 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3004 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3006 AC_CACHE_CHECK([for broken Perl_load_module()],
3007 [c_cv_have_broken_perl_load_module],
3008 AC_LINK_IFELSE(
3009 AC_LANG_PROGRAM(
3010 [[
3011 #define PERL_NO_GET_CONTEXT
3012 #include <EXTERN.h>
3013 #include <perl.h>
3014 #include <XSUB.h>
3015 ]],
3016 [[
3017 dTHX;
3018 load_module (PERL_LOADMOD_NOIMPORT,
3019 newSVpv ("Collectd::Plugin::FooBar", 24),
3020 Nullsv);
3021 ]]),
3022 [c_cv_have_broken_perl_load_module="no"],
3023 [c_cv_have_broken_perl_load_module="yes"]
3024 )
3025 )
3027 CFLAGS="$SAVE_CFLAGS"
3028 LDFLAGS="$SAVE_LDFLAGS"
3029 fi
3030 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3031 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3033 if test "x$with_libperl" = "xyes"
3034 then
3035 SAVE_CFLAGS="$CFLAGS"
3036 SAVE_LDFLAGS="$LDFLAGS"
3037 CFLAGS="$CFLAGS $PERL_CFLAGS"
3038 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3040 AC_CHECK_MEMBER(
3041 [struct mgvtbl.svt_local],
3042 [have_struct_mgvtbl_svt_local="yes"],
3043 [have_struct_mgvtbl_svt_local="no"],
3044 [
3045 #include <EXTERN.h>
3046 #include <perl.h>
3047 #include <XSUB.h>
3048 ])
3050 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3051 then
3052 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3053 [Define if Perl's struct mgvtbl has member svt_local.])
3054 fi
3056 CFLAGS="$SAVE_CFLAGS"
3057 LDFLAGS="$SAVE_LDFLAGS"
3058 fi
3059 # }}}
3061 # --with-libpq {{{
3062 with_pg_config="pg_config"
3063 with_libpq_includedir=""
3064 with_libpq_libdir=""
3065 with_libpq_cppflags=""
3066 with_libpq_ldflags=""
3067 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3068 [Path to libpq.])],
3069 [
3070 if test "x$withval" = "xno"
3071 then
3072 with_libpq="no"
3073 else if test "x$withval" = "xyes"
3074 then
3075 with_libpq="yes"
3076 else
3077 if test -f "$withval" && test -x "$withval";
3078 then
3079 with_pg_config="$withval"
3080 else if test -x "$withval/bin/pg_config"
3081 then
3082 with_pg_config="$withval/bin/pg_config"
3083 fi; fi
3084 with_libpq="yes"
3085 fi; fi
3086 ],
3087 [
3088 with_libpq="yes"
3089 ])
3090 if test "x$with_libpq" = "xyes"
3091 then
3092 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3093 pg_config_status=$?
3095 if test $pg_config_status -eq 0
3096 then
3097 if test -n "$with_libpq_includedir"; then
3098 for dir in $with_libpq_includedir; do
3099 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3100 done
3101 fi
3102 else
3103 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3104 fi
3106 SAVE_CPPFLAGS="$CPPFLAGS"
3107 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3109 AC_CHECK_HEADERS(libpq-fe.h, [],
3110 [with_libpq="no (libpq-fe.h not found)"], [])
3112 CPPFLAGS="$SAVE_CPPFLAGS"
3113 fi
3114 if test "x$with_libpq" = "xyes"
3115 then
3116 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3117 pg_config_status=$?
3119 if test $pg_config_status -eq 0
3120 then
3121 if test -n "$with_libpq_libdir"; then
3122 for dir in $with_libpq_libdir; do
3123 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3124 done
3125 fi
3126 else
3127 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3128 fi
3130 SAVE_LDFLAGS="$LDFLAGS"
3131 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3133 AC_CHECK_LIB(pq, PQconnectdb,
3134 [with_libpq="yes"],
3135 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3137 AC_CHECK_LIB(pq, PQserverVersion,
3138 [with_libpq="yes"],
3139 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3141 LDFLAGS="$SAVE_LDFLAGS"
3142 fi
3143 if test "x$with_libpq" = "xyes"
3144 then
3145 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3146 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3147 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3148 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3149 fi
3150 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3151 # }}}
3153 # --with-libpthread {{{
3154 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3155 [ if test "x$withval" != "xno" \
3156 && test "x$withval" != "xyes"
3157 then
3158 LDFLAGS="$LDFLAGS -L$withval/lib"
3159 CPPFLAGS="$CPPFLAGS -I$withval/include"
3160 with_libpthread="yes"
3161 else
3162 if test "x$withval" = "xno"
3163 then
3164 with_libpthread="no (disabled)"
3165 fi
3166 fi
3167 ], [with_libpthread="yes"])
3168 if test "x$with_libpthread" = "xyes"
3169 then
3170 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3171 fi
3173 if test "x$with_libpthread" = "xyes"
3174 then
3175 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3176 fi
3177 if test "x$with_libpthread" = "xyes"
3178 then
3179 collect_pthread=1
3180 else
3181 collect_pthread=0
3182 fi
3183 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3184 [Wether or not to use pthread (POSIX threads) library])
3185 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3186 # }}}
3188 # --with-python {{{
3189 with_python_prog=""
3190 with_python_path="$PATH"
3191 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3192 [
3193 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3194 then
3195 with_python="$withval"
3196 else if test -x "$withval"
3197 then
3198 with_python_prog="$withval"
3199 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3200 with_python="yes"
3201 else if test -d "$withval"
3202 then
3203 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3204 with_python="yes"
3205 else
3206 AC_MSG_WARN([Argument not recognized: $withval])
3207 fi; fi; fi
3208 ], [with_python="yes"])
3210 SAVE_PATH="$PATH"
3211 SAVE_CPPFLAGS="$CPPFLAGS"
3212 SAVE_LDFLAGS="$LDFLAGS"
3213 SAVE_LIBS="$LIBS"
3215 PATH="$with_python_path"
3217 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3218 then
3219 AC_MSG_CHECKING([for python])
3220 with_python_prog="`which python 2>/dev/null`"
3221 if test "x$with_python_prog" = "x"
3222 then
3223 AC_MSG_RESULT([not found])
3224 with_python="no (interpreter not found)"
3225 else
3226 AC_MSG_RESULT([$with_python_prog])
3227 fi
3228 fi
3230 if test "x$with_python" = "xyes"
3231 then
3232 AC_MSG_CHECKING([for Python CPPFLAGS])
3233 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3234 python_config_status=$?
3236 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3237 then
3238 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3239 with_python="no"
3240 else
3241 AC_MSG_RESULT([$python_include_path])
3242 fi
3243 fi
3245 if test "x$with_python" = "xyes"
3246 then
3247 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3248 AC_CHECK_HEADERS(Python.h,
3249 [with_python="yes"],
3250 [with_python="no ('Python.h' not found)"])
3251 fi
3253 if test "x$with_python" = "xyes"
3254 then
3255 AC_MSG_CHECKING([for Python LDFLAGS])
3256 python_library_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0))" | "$with_python_prog" 2>&1`
3257 python_config_status=$?
3259 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3260 then
3261 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3262 with_python="no"
3263 else
3264 AC_MSG_RESULT([$python_library_path])
3265 fi
3266 fi
3268 if test "x$with_python" = "xyes"
3269 then
3270 AC_MSG_CHECKING([for Python LIBS])
3271 python_library_flags=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0))" | "$with_python_prog" 2>&1`
3272 python_config_status=$?
3274 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3275 then
3276 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3277 with_python="no"
3278 else
3279 AC_MSG_RESULT([$python_library_flags])
3280 fi
3281 fi
3283 if test "x$with_python" = "xyes"
3284 then
3285 LDFLAGS="-L$python_library_path $LDFLAGS"
3286 LIBS="$python_library_flags $LIBS"
3288 AC_CHECK_FUNC(PyObject_CallFunction,
3289 [with_python="yes"],
3290 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3291 fi
3293 PATH="$SAVE_PATH"
3294 CPPFLAGS="$SAVE_CPPFLAGS"
3295 LDFLAGS="$SAVE_LDFLAGS"
3296 LIBS="$SAVE_LIBS"
3298 if test "x$with_python" = "xyes"
3299 then
3300 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3301 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3302 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3303 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3304 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3305 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3306 fi
3307 # }}} --with-python
3309 # --with-librabbitmq {{{
3310 with_librabbitmq_cppflags=""
3311 with_librabbitmq_ldflags=""
3312 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3313 [
3314 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3315 then
3316 with_librabbitmq_cppflags="-I$withval/include"
3317 with_librabbitmq_ldflags="-L$withval/lib"
3318 with_librabbitmq="yes"
3319 else
3320 with_librabbitmq="$withval"
3321 fi
3322 ],
3323 [
3324 with_librabbitmq="yes"
3325 ])
3326 SAVE_CPPFLAGS="$CPPFLAGS"
3327 SAVE_LDFLAGS="$LDFLAGS"
3328 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3329 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3330 if test "x$with_librabbitmq" = "xyes"
3331 then
3332 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3333 fi
3334 if test "x$with_librabbitmq" = "xyes"
3335 then
3336 # librabbitmq up to version 0.9.1 provides "library_errno", later
3337 # versions use "library_error". The library does not provide a version
3338 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3339 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3340 [
3341 #if HAVE_STDLIB_H
3342 # include <stdlib.h>
3343 #endif
3344 #if HAVE_STDIO_H
3345 # include <stdio.h>
3346 #endif
3347 #if HAVE_STDINT_H
3348 # include <stdint.h>
3349 #endif
3350 #if HAVE_INTTYPES_H
3351 # include <inttypes.h>
3352 #endif
3353 #include <amqp.h>
3354 ])
3355 fi
3356 if test "x$with_librabbitmq" = "xyes"
3357 then
3358 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3359 fi
3360 if test "x$with_librabbitmq" = "xyes"
3361 then
3362 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3363 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3364 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3365 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3366 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3367 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3368 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3369 fi
3370 CPPFLAGS="$SAVE_CPPFLAGS"
3371 LDFLAGS="$SAVE_LDFLAGS"
3372 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3373 # }}}
3375 # --with-librouteros {{{
3376 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3377 [
3378 if test "x$withval" = "xyes"
3379 then
3380 with_librouteros="yes"
3381 else if test "x$withval" = "xno"
3382 then
3383 with_librouteros="no"
3384 else
3385 with_librouteros="yes"
3386 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3387 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3388 fi; fi
3389 ],
3390 [with_librouteros="yes"])
3392 SAVE_CPPFLAGS="$CPPFLAGS"
3393 SAVE_LDFLAGS="$LDFLAGS"
3395 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3396 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3398 if test "x$with_librouteros" = "xyes"
3399 then
3400 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3401 then
3402 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3403 fi
3404 AC_CHECK_HEADERS(routeros_api.h,
3405 [with_librouteros="yes"],
3406 [with_librouteros="no (routeros_api.h not found)"])
3407 fi
3408 if test "x$with_librouteros" = "xyes"
3409 then
3410 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3411 then
3412 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3413 fi
3414 AC_CHECK_LIB(routeros, ros_interface,
3415 [with_librouteros="yes"],
3416 [with_librouteros="no (symbol 'ros_interface' not found)"])
3417 fi
3419 CPPFLAGS="$SAVE_CPPFLAGS"
3420 LDFLAGS="$SAVE_LDFLAGS"
3422 if test "x$with_librouteros" = "xyes"
3423 then
3424 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3425 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3426 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3427 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3428 fi
3429 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3430 # }}}
3432 # --with-librrd {{{
3433 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3434 librrd_cflags=""
3435 librrd_ldflags=""
3436 librrd_threadsafe="yes"
3437 librrd_rrdc_update="no"
3438 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3439 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3440 then
3441 librrd_cflags="-I$withval/include"
3442 librrd_ldflags="-L$withval/lib"
3443 with_librrd="yes"
3444 else
3445 with_librrd="$withval"
3446 fi
3447 ], [with_librrd="yes"])
3448 if test "x$with_librrd" = "xyes"
3449 then
3450 SAVE_CPPFLAGS="$CPPFLAGS"
3451 SAVE_LDFLAGS="$LDFLAGS"
3453 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3454 LDFLAGS="$LDFLAGS $librrd_ldflags"
3456 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3458 CPPFLAGS="$SAVE_CPPFLAGS"
3459 LDFLAGS="$SAVE_LDFLAGS"
3460 fi
3461 if test "x$with_librrd" = "xyes"
3462 then
3463 SAVE_CPPFLAGS="$CPPFLAGS"
3464 SAVE_LDFLAGS="$LDFLAGS"
3466 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3467 LDFLAGS="$LDFLAGS $librrd_ldflags"
3469 AC_CHECK_LIB(rrd_th, rrd_update_r,
3470 [with_librrd="yes"
3471 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3472 ],
3473 [librrd_threadsafe="no"
3474 AC_CHECK_LIB(rrd, rrd_update,
3475 [with_librrd="yes"
3476 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3477 ],
3478 [with_librrd="no (symbol 'rrd_update' not found)"],
3479 [-lm])
3480 ],
3481 [-lm])
3483 if test "x$librrd_threadsafe" = "xyes"
3484 then
3485 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3486 else
3487 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3488 fi
3490 CPPFLAGS="$SAVE_CPPFLAGS"
3491 LDFLAGS="$SAVE_LDFLAGS"
3492 fi
3493 if test "x$with_librrd" = "xyes"
3494 then
3495 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3496 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3497 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3498 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3499 fi
3500 if test "x$librrd_threadsafe" = "xyes"
3501 then
3502 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3503 fi
3504 # }}}
3506 # --with-libsensors {{{
3507 with_sensors_cflags=""
3508 with_sensors_ldflags=""
3509 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3510 [
3511 if test "x$withval" = "xno"
3512 then
3513 with_libsensors="no"
3514 else
3515 with_libsensors="yes"
3516 if test "x$withval" != "xyes"
3517 then
3518 with_sensors_cflags="-I$withval/include"
3519 with_sensors_ldflags="-L$withval/lib"
3520 with_libsensors="yes"
3521 fi
3522 fi
3523 ],
3524 [
3525 if test "x$ac_system" = "xLinux"
3526 then
3527 with_libsensors="yes"
3528 else
3529 with_libsensors="no (Linux only library)"
3530 fi
3531 ])
3532 if test "x$with_libsensors" = "xyes"
3533 then
3534 SAVE_CPPFLAGS="$CPPFLAGS"
3535 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3537 # AC_CHECK_HEADERS(sensors/sensors.h,
3538 # [
3539 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3540 # ],
3541 # [with_libsensors="no (sensors/sensors.h not found)"])
3542 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3544 CPPFLAGS="$SAVE_CPPFLAGS"
3545 fi
3546 if test "x$with_libsensors" = "xyes"
3547 then
3548 SAVE_CPPFLAGS="$CPPFLAGS"
3549 SAVE_LDFLAGS="$LDFLAGS"
3550 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3551 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3553 AC_CHECK_LIB(sensors, sensors_init,
3554 [
3555 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3556 ],
3557 [with_libsensors="no (libsensors not found)"])
3559 CPPFLAGS="$SAVE_CPPFLAGS"
3560 LDFLAGS="$SAVE_LDFLAGS"
3561 fi
3562 if test "x$with_libsensors" = "xyes"
3563 then
3564 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3565 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3566 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3567 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3568 fi
3569 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3570 # }}}
3572 # --with-libstatgrab {{{
3573 with_libstatgrab_cflags=""
3574 with_libstatgrab_ldflags=""
3575 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3576 [
3577 if test "x$withval" != "xno" \
3578 && test "x$withval" != "xyes"
3579 then
3580 with_libstatgrab_cflags="-I$withval/include"
3581 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3582 with_libstatgrab="yes"
3583 with_libstatgrab_pkg_config="no"
3584 else
3585 with_libstatgrab="$withval"
3586 with_libstatgrab_pkg_config="yes"
3587 fi
3588 ],
3589 [
3590 with_libstatgrab="yes"
3591 with_libstatgrab_pkg_config="yes"
3592 ])
3594 if test "x$with_libstatgrab" = "xyes" \
3595 && test "x$with_libstatgrab_pkg_config" = "xyes"
3596 then
3597 if test "x$PKG_CONFIG" != "x"
3598 then
3599 AC_MSG_CHECKING([pkg-config for libstatgrab])
3600 temp_result="found"
3601 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3602 if test "$?" != "0"
3603 then
3604 with_libstatgrab_pkg_config="no"
3605 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3606 temp_result="not found"
3607 fi
3608 AC_MSG_RESULT([$temp_result])
3609 else
3610 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3611 with_libstatgrab_pkg_config="no"
3612 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3613 fi
3614 fi
3616 if test "x$with_libstatgrab" = "xyes" \
3617 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3618 && test "x$with_libstatgrab_cflags" = "x"
3619 then
3620 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3621 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3622 if test "$?" = "0"
3623 then
3624 with_libstatgrab_cflags="$temp_result"
3625 else
3626 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3627 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3628 fi
3629 AC_MSG_RESULT([$temp_result])
3630 fi
3632 if test "x$with_libstatgrab" = "xyes" \
3633 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3634 && test "x$with_libstatgrab_ldflags" = "x"
3635 then
3636 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3637 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3638 if test "$?" = "0"
3639 then
3640 with_libstatgrab_ldflags="$temp_result"
3641 else
3642 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3643 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3644 fi
3645 AC_MSG_RESULT([$temp_result])
3646 fi
3648 if test "x$with_libstatgrab" = "xyes"
3649 then
3650 SAVE_CPPFLAGS="$CPPFLAGS"
3651 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3653 AC_CHECK_HEADERS(statgrab.h,
3654 [with_libstatgrab="yes"],
3655 [with_libstatgrab="no (statgrab.h not found)"])
3657 CPPFLAGS="$SAVE_CPPFLAGS"
3658 fi
3660 if test "x$with_libstatgrab" = "xyes"
3661 then
3662 SAVE_CFLAGS="$CFLAGS"
3663 SAVE_LDFLAGS="$LDFLAGS"
3665 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3666 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3668 AC_CHECK_LIB(statgrab, sg_init,
3669 [with_libstatgrab="yes"],
3670 [with_libstatgrab="no (symbol sg_init not found)"])
3672 CFLAGS="$SAVE_CFLAGS"
3673 LDFLAGS="$SAVE_LDFLAGS"
3674 fi
3676 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3677 if test "x$with_libstatgrab" = "xyes"
3678 then
3679 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3680 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3681 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3682 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3683 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3684 fi
3685 # }}}
3687 # --with-libtokyotyrant {{{
3688 with_libtokyotyrant_cppflags=""
3689 with_libtokyotyrant_ldflags=""
3690 with_libtokyotyrant_libs=""
3691 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3692 [
3693 if test "x$withval" = "xno"
3694 then
3695 with_libtokyotyrant="no"
3696 else if test "x$withval" = "xyes"
3697 then
3698 with_libtokyotyrant="yes"
3699 else
3700 with_libtokyotyrant_cppflags="-I$withval/include"
3701 with_libtokyotyrant_ldflags="-L$withval/include"
3702 with_libtokyotyrant_libs="-ltokyotyrant"
3703 with_libtokyotyrant="yes"
3704 fi; fi
3705 ],
3706 [
3707 with_libtokyotyrant="yes"
3708 ])
3710 if test "x$with_libtokyotyrant" = "xyes"
3711 then
3712 if $PKG_CONFIG --exists tokyotyrant
3713 then
3714 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3715 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3716 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3717 fi
3718 fi
3720 SAVE_CPPFLAGS="$CPPFLAGS"
3721 SAVE_LDFLAGS="$LDFLAGS"
3722 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3723 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3725 if test "x$with_libtokyotyrant" = "xyes"
3726 then
3727 AC_CHECK_HEADERS(tcrdb.h,
3728 [
3729 AC_DEFINE(HAVE_TCRDB_H, 1,
3730 [Define to 1 if you have the <tcrdb.h> header file.])
3731 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3732 fi
3734 if test "x$with_libtokyotyrant" = "xyes"
3735 then
3736 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3737 [
3738 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3739 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3740 ],
3741 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3742 [$with_libtokyotyrant_libs])
3743 fi
3745 CPPFLAGS="$SAVE_CPPFLAGS"
3746 LDFLAGS="$SAVE_LDFLAGS"
3748 if test "x$with_libtokyotyrant" = "xyes"
3749 then
3750 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3751 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3752 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3753 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3754 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3755 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3756 fi
3757 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3758 # }}}
3760 # --with-libupsclient {{{
3761 with_libupsclient_config=""
3762 with_libupsclient_cflags=""
3763 with_libupsclient_libs=""
3764 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3765 [
3766 if test "x$withval" = "xno"
3767 then
3768 with_libupsclient="no"
3769 else if test "x$withval" = "xyes"
3770 then
3771 with_libupsclient="use_pkgconfig"
3772 else
3773 if test -x "$withval"
3774 then
3775 with_libupsclient_config="$withval"
3776 with_libupsclient="use_libupsclient_config"
3777 else if test -x "$withval/bin/libupsclient-config"
3778 then
3779 with_libupsclient_config="$withval/bin/libupsclient-config"
3780 with_libupsclient="use_libupsclient_config"
3781 else
3782 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3783 with_libupsclient_cflags="-I$withval/include"
3784 with_libupsclient_libs="-L$withval/lib -lupsclient"
3785 with_libupsclient="yes"
3786 fi; fi
3787 fi; fi
3788 ],
3789 [with_libupsclient="use_pkgconfig"])
3791 # configure using libupsclient-config
3792 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3793 then
3794 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3795 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3796 if test $? -ne 0
3797 then
3798 with_libupsclient="no ($with_libupsclient_config failed)"
3799 fi
3800 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3801 if test $? -ne 0
3802 then
3803 with_libupsclient="no ($with_libupsclient_config failed)"
3804 fi
3805 fi
3806 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3807 then
3808 with_libupsclient="yes"
3809 fi
3811 # configure using pkg-config
3812 if test "x$with_libupsclient" = "xuse_pkgconfig"
3813 then
3814 if test "x$PKG_CONFIG" = "x"
3815 then
3816 with_libupsclient="no (Don't have pkg-config)"
3817 fi
3818 fi
3819 if test "x$with_libupsclient" = "xuse_pkgconfig"
3820 then
3821 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3822 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3823 if test $? -ne 0
3824 then
3825 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3826 fi
3827 fi
3828 if test "x$with_libupsclient" = "xuse_pkgconfig"
3829 then
3830 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3831 if test $? -ne 0
3832 then
3833 with_libupsclient="no ($PKG_CONFIG failed)"
3834 fi
3835 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3836 if test $? -ne 0
3837 then
3838 with_libupsclient="no ($PKG_CONFIG failed)"
3839 fi
3840 fi
3841 if test "x$with_libupsclient" = "xuse_pkgconfig"
3842 then
3843 with_libupsclient="yes"
3844 fi
3846 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3847 # the actual checks.
3848 if test "x$with_libupsclient" = "xyes"
3849 then
3850 SAVE_CPPFLAGS="$CPPFLAGS"
3851 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3853 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3855 CPPFLAGS="$SAVE_CPPFLAGS"
3856 fi
3857 if test "x$with_libupsclient" = "xyes"
3858 then
3859 SAVE_CPPFLAGS="$CPPFLAGS"
3860 SAVE_LDFLAGS="$LDFLAGS"
3862 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3863 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3865 AC_CHECK_LIB(upsclient, upscli_connect,
3866 [with_libupsclient="yes"],
3867 [with_libupsclient="no (symbol upscli_connect not found)"])
3869 CPPFLAGS="$SAVE_CPPFLAGS"
3870 LDFLAGS="$SAVE_LDFLAGS"
3871 fi
3872 if test "x$with_libupsclient" = "xyes"
3873 then
3874 SAVE_CPPFLAGS="$CPPFLAGS"
3875 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3877 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3878 [#include <stdlib.h>
3879 #include <stdio.h>
3880 #include <upsclient.h>])
3882 CPPFLAGS="$SAVE_CPPFLAGS"
3883 fi
3884 if test "x$with_libupsclient" = "xyes"
3885 then
3886 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3887 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3888 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3889 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3890 fi
3891 # }}}
3893 # --with-libxmms {{{
3894 with_xmms_config="xmms-config"
3895 with_xmms_cflags=""
3896 with_xmms_libs=""
3897 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3898 [
3899 if test "x$withval" != "xno" \
3900 && test "x$withval" != "xyes"
3901 then
3902 if test -f "$withval" && test -x "$withval";
3903 then
3904 with_xmms_config="$withval"
3905 else if test -x "$withval/bin/xmms-config"
3906 then
3907 with_xmms_config="$withval/bin/xmms-config"
3908 fi; fi
3909 with_libxmms="yes"
3910 else if test "x$withval" = "xno"
3911 then
3912 with_libxmms="no"
3913 else
3914 with_libxmms="yes"
3915 fi; fi
3916 ],
3917 [
3918 with_libxmms="yes"
3919 ])
3920 if test "x$with_libxmms" = "xyes"
3921 then
3922 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3923 xmms_config_status=$?
3925 if test $xmms_config_status -ne 0
3926 then
3927 with_libxmms="no"
3928 fi
3929 fi
3930 if test "x$with_libxmms" = "xyes"
3931 then
3932 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3933 xmms_config_status=$?
3935 if test $xmms_config_status -ne 0
3936 then
3937 with_libxmms="no"
3938 fi
3939 fi
3940 if test "x$with_libxmms" = "xyes"
3941 then
3942 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3943 [
3944 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3945 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3946 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3947 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3948 ],
3949 [
3950 with_libxmms="no"
3951 ],
3952 [$with_xmms_libs])
3953 fi
3954 with_libxmms_numeric=0
3955 if test "x$with_libxmms" = "xyes"
3956 then
3957 with_libxmms_numeric=1
3958 fi
3959 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3960 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3961 # }}}
3963 # --with-libyajl {{{
3964 with_libyajl_cppflags=""
3965 with_libyajl_ldflags=""
3966 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3967 [
3968 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3969 then
3970 with_libyajl_cppflags="-I$withval/include"
3971 with_libyajl_ldflags="-L$withval/lib"
3972 with_libyajl="yes"
3973 else
3974 with_libyajl="$withval"
3975 fi
3976 ],
3977 [
3978 with_libyajl="yes"
3979 ])
3980 if test "x$with_libyajl" = "xyes"
3981 then
3982 SAVE_CPPFLAGS="$CPPFLAGS"
3983 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3985 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3986 AC_CHECK_HEADERS(yajl/yajl_version.h)
3988 CPPFLAGS="$SAVE_CPPFLAGS"
3989 fi
3990 if test "x$with_libyajl" = "xyes"
3991 then
3992 SAVE_CPPFLAGS="$CPPFLAGS"
3993 SAVE_LDFLAGS="$LDFLAGS"
3994 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3995 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3997 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3999 CPPFLAGS="$SAVE_CPPFLAGS"
4000 LDFLAGS="$SAVE_LDFLAGS"
4001 fi
4002 if test "x$with_libyajl" = "xyes"
4003 then
4004 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4005 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4006 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4007 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4008 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4009 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4010 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4011 fi
4012 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4013 # }}}
4015 # --with-libvarnish {{{
4016 with_libvarnish_cppflags=""
4017 with_libvarnish_cflags=""
4018 with_libvarnish_libs=""
4019 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4020 [
4021 if test "x$withval" = "xno"
4022 then
4023 with_libvarnish="no"
4024 else if test "x$withval" = "xyes"
4025 then
4026 with_libvarnish="use_pkgconfig"
4027 else if test -d "$with_libvarnish/lib"
4028 then
4029 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4030 with_libvarnish_cflags="-I$withval/include"
4031 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4032 with_libvarnish="yes"
4033 fi; fi; fi
4034 ],
4035 [with_libvarnish="use_pkgconfig"])
4037 # configure using pkg-config
4038 if test "x$with_libvarnish" = "xuse_pkgconfig"
4039 then
4040 if test "x$PKG_CONFIG" = "x"
4041 then
4042 with_libvarnish="no (Don't have pkg-config)"
4043 fi
4044 fi
4045 if test "x$with_libvarnish" = "xuse_pkgconfig"
4046 then
4047 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4048 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4049 if test $? -ne 0
4050 then
4051 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4052 fi
4053 fi
4054 if test "x$with_libvarnish" = "xuse_pkgconfig"
4055 then
4056 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4057 if test $? -ne 0
4058 then
4059 with_libvarnish="no ($PKG_CONFIG failed)"
4060 fi
4061 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4062 if test $? -ne 0
4063 then
4064 with_libvarnish="no ($PKG_CONFIG failed)"
4065 fi
4066 fi
4067 if test "x$with_libvarnish" = "xuse_pkgconfig"
4068 then
4069 with_libvarnish="yes"
4070 fi
4072 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4073 # the actual checks.
4074 if test "x$with_libvarnish" = "xyes"
4075 then
4076 SAVE_CPPFLAGS="$CPPFLAGS"
4077 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4078 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4080 CPPFLAGS="$SAVE_CPPFLAGS"
4081 fi
4082 if test "x$with_libvarnish" = "xyes"
4083 then
4084 SAVE_CPPFLAGS="$CPPFLAGS"
4085 #SAVE_LDFLAGS="$LDFLAGS"
4087 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4088 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4090 AC_CHECK_LIB(varnishapi, VSL_OpenStats,
4091 [with_libvarnish="yes"],
4092 [with_libvarnish="no (symbol VSL_OpenStats not found)"],
4093 [$with_libvarnish_libs])
4095 CPPFLAGS="$SAVE_CPPFLAGS"
4096 #LDFLAGS="$SAVE_LDFLAGS"
4097 fi
4098 if test "x$with_libvarnish" = "xyes"
4099 then
4100 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4101 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4102 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4103 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4104 fi
4105 # }}}
4107 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4108 with_libxml2="no (pkg-config isn't available)"
4109 with_libxml2_cflags=""
4110 with_libxml2_ldflags=""
4111 with_libvirt="no (pkg-config isn't available)"
4112 with_libvirt_cflags=""
4113 with_libvirt_ldflags=""
4114 if test "x$PKG_CONFIG" != "x"
4115 then
4116 pkg-config --exists 'libxml-2.0' 2>/dev/null
4117 if test "$?" = "0"
4118 then
4119 with_libxml2="yes"
4120 else
4121 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4122 fi
4124 pkg-config --exists libvirt 2>/dev/null
4125 if test "$?" = "0"
4126 then
4127 with_libvirt="yes"
4128 else
4129 with_libvirt="no (pkg-config doesn't know libvirt)"
4130 fi
4131 fi
4132 if test "x$with_libxml2" = "xyes"
4133 then
4134 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4135 if test $? -ne 0
4136 then
4137 with_libxml2="no"
4138 fi
4139 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4140 if test $? -ne 0
4141 then
4142 with_libxml2="no"
4143 fi
4144 fi
4145 if test "x$with_libxml2" = "xyes"
4146 then
4147 SAVE_CPPFLAGS="$CPPFLAGS"
4148 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4150 AC_CHECK_HEADERS(libxml/parser.h, [],
4151 [with_libxml2="no (libxml/parser.h not found)"])
4153 CPPFLAGS="$SAVE_CPPFLAGS"
4154 fi
4155 if test "x$with_libxml2" = "xyes"
4156 then
4157 SAVE_CFLAGS="$CFLAGS"
4158 SAVE_LDFLAGS="$LDFLAGS"
4160 CFLAGS="$CFLAGS $with_libxml2_cflags"
4161 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4163 AC_CHECK_LIB(xml2, xmlXPathEval,
4164 [with_libxml2="yes"],
4165 [with_libxml2="no (symbol xmlXPathEval not found)"])
4167 CFLAGS="$SAVE_CFLAGS"
4168 LDFLAGS="$SAVE_LDFLAGS"
4169 fi
4170 dnl Add the right compiler flags and libraries.
4171 if test "x$with_libxml2" = "xyes"; then
4172 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4173 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4174 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4175 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4176 fi
4177 if test "x$with_libvirt" = "xyes"
4178 then
4179 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4180 if test $? -ne 0
4181 then
4182 with_libvirt="no"
4183 fi
4184 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4185 if test $? -ne 0
4186 then
4187 with_libvirt="no"
4188 fi
4189 fi
4190 if test "x$with_libvirt" = "xyes"
4191 then
4192 SAVE_CPPFLAGS="$CPPFLAGS"
4193 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4195 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4196 [with_libvirt="no (libvirt/libvirt.h not found)"])
4198 CPPFLAGS="$SAVE_CPPFLAGS"
4199 fi
4200 if test "x$with_libvirt" = "xyes"
4201 then
4202 SAVE_CFLAGS="$CFLAGS"
4203 SAVE_LDFLAGS="$LDFLAGS"
4205 CFLAGS="$CFLAGS $with_libvirt_cflags"
4206 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4208 AC_CHECK_LIB(virt, virDomainBlockStats,
4209 [with_libvirt="yes"],
4210 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4212 CFLAGS="$SAVE_CFLAGS"
4213 LDFLAGS="$SAVE_LDFLAGS"
4214 fi
4215 dnl Add the right compiler flags and libraries.
4216 if test "x$with_libvirt" = "xyes"; then
4217 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4218 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4219 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4220 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4221 fi
4222 # }}}
4224 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4225 with_libopenipmipthread="yes"
4226 with_libopenipmipthread_cflags=""
4227 with_libopenipmipthread_libs=""
4229 AC_MSG_CHECKING([for pkg-config])
4230 temp_result="no"
4231 if test "x$PKG_CONFIG" = "x"
4232 then
4233 with_libopenipmipthread="no"
4234 temp_result="no"
4235 else
4236 temp_result="$PKG_CONFIG"
4237 fi
4238 AC_MSG_RESULT([$temp_result])
4240 if test "x$with_libopenipmipthread" = "xyes"
4241 then
4242 AC_MSG_CHECKING([for libOpenIPMIpthread])
4243 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4244 if test "$?" != "0"
4245 then
4246 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4247 fi
4248 AC_MSG_RESULT([$with_libopenipmipthread])
4249 fi
4251 if test "x$with_libopenipmipthread" = "xyes"
4252 then
4253 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4254 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4255 if test "$?" = "0"
4256 then
4257 with_libopenipmipthread_cflags="$temp_result"
4258 else
4259 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4260 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4261 fi
4262 AC_MSG_RESULT([$temp_result])
4263 fi
4265 if test "x$with_libopenipmipthread" = "xyes"
4266 then
4267 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4268 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4269 if test "$?" = "0"
4270 then
4271 with_libopenipmipthread_ldflags="$temp_result"
4272 else
4273 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4274 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4275 fi
4276 AC_MSG_RESULT([$temp_result])
4277 fi
4279 if test "x$with_libopenipmipthread" = "xyes"
4280 then
4281 SAVE_CPPFLAGS="$CPPFLAGS"
4282 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4284 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4285 [with_libopenipmipthread="yes"],
4286 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4287 [#include <OpenIPMI/ipmiif.h>
4288 #include <OpenIPMI/ipmi_err.h>
4289 #include <OpenIPMI/ipmi_posix.h>
4290 #include <OpenIPMI/ipmi_conn.h>
4291 ])
4293 CPPFLAGS="$SAVE_CPPFLAGS"
4294 fi
4296 if test "x$with_libopenipmipthread" = "xyes"
4297 then
4298 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4299 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4300 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4301 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4302 fi
4303 # }}}
4305 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4306 [with_libnotify="yes"],
4307 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4308 with_libnotify="no"
4309 else
4310 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4311 fi])
4313 # Check for enabled/disabled features
4314 #
4316 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4317 # ------------------------------------------------------------
4318 dnl
4319 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4320 dnl
4321 AC_DEFUN(
4322 [AC_COLLECTD],
4323 [
4324 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4325 m4_if(
4326 [$2],
4327 [enable],
4328 [dnl
4329 m4_define([EnDis],[disabled])dnl
4330 m4_define([YesNo],[no])dnl
4331 ],dnl
4332 [m4_if(
4333 [$2],
4334 [disable],
4335 [dnl
4336 m4_define([EnDis],[enabled])dnl
4337 m4_define([YesNo],[yes])dnl
4338 ],
4339 [dnl
4340 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4341 ]dnl
4342 )]dnl
4343 )dnl
4344 m4_if([$3], [feature], [],
4345 [m4_if(
4346 [$3], [module], [],
4347 [dnl
4348 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4349 ]dnl
4350 )]dnl
4351 )dnl
4352 AC_ARG_ENABLE(
4353 [$1],
4354 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4355 [],
4356 enable_$1='[YesNo]'dnl
4357 )# AC_ARG_ENABLE
4358 if test "x$enable_$1" = "xno"
4359 then
4360 collectd_$1=0
4361 else
4362 if test "x$enable_$1" = "xyes"
4363 then
4364 collectd_$1=1
4365 else
4366 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4367 collectd_$1=1
4368 enable_$1='yes'
4369 fi
4370 fi
4371 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4372 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4373 ]dnl
4374 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4376 # AC_PLUGIN(name, default, info)
4377 # ------------------------------------------------------------
4378 dnl
4379 AC_DEFUN(
4380 [AC_PLUGIN],
4381 [
4382 enable_plugin="no"
4383 force="no"
4384 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4385 [
4386 if test "x$enableval" = "xyes"
4387 then
4388 enable_plugin="yes"
4389 else if test "x$enableval" = "xforce"
4390 then
4391 enable_plugin="yes"
4392 force="yes"
4393 else
4394 enable_plugin="no (disabled on command line)"
4395 fi; fi
4396 ],
4397 [
4398 if test "x$enable_all_plugins" = "xauto"
4399 then
4400 if test "x$2" = "xyes"
4401 then
4402 enable_plugin="yes"
4403 else
4404 enable_plugin="no"
4405 fi
4406 else
4407 enable_plugin="$enable_all_plugins"
4408 fi
4409 ])
4410 if test "x$enable_plugin" = "xyes"
4411 then
4412 if test "x$2" = "xyes" || test "x$force" = "xyes"
4413 then
4414 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4415 if test "x$2" != "xyes"
4416 then
4417 dependency_warning="yes"
4418 fi
4419 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4420 dependency_error="yes"
4421 enable_plugin="no (dependency error)"
4422 fi
4423 fi
4424 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4425 enable_$1="$enable_plugin"
4426 ]
4427 )# AC_PLUGIN(name, default, info)
4429 m4_divert_once([HELP_ENABLE], [
4430 collectd features:])
4431 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4432 AC_COLLECTD([debug], [enable], [feature], [debugging])
4433 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4434 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4436 dependency_warning="no"
4437 dependency_error="no"
4439 plugin_ascent="no"
4440 plugin_battery="no"
4441 plugin_bind="no"
4442 plugin_conntrack="no"
4443 plugin_contextswitch="no"
4444 plugin_cpu="no"
4445 plugin_cpufreq="no"
4446 plugin_curl_json="no"
4447 plugin_curl_xml="no"
4448 plugin_df="no"
4449 plugin_disk="no"
4450 plugin_entropy="no"
4451 plugin_interface="no"
4452 plugin_ipmi="no"
4453 plugin_ipvs="no"
4454 plugin_irq="no"
4455 plugin_libvirt="no"
4456 plugin_load="no"
4457 plugin_memory="no"
4458 plugin_multimeter="no"
4459 plugin_nfs="no"
4460 plugin_fscache="no"
4461 plugin_perl="no"
4462 plugin_processes="no"
4463 plugin_protocols="no"
4464 plugin_serial="no"
4465 plugin_swap="no"
4466 plugin_tape="no"
4467 plugin_tcpconns="no"
4468 plugin_ted="no"
4469 plugin_thermal="no"
4470 plugin_users="no"
4471 plugin_uptime="no"
4472 plugin_vmem="no"
4473 plugin_vserver="no"
4474 plugin_wireless="no"
4475 plugin_zfs_arc="no"
4477 # Linux
4478 if test "x$ac_system" = "xLinux"
4479 then
4480 plugin_battery="yes"
4481 plugin_conntrack="yes"
4482 plugin_contextswitch="yes"
4483 plugin_cpu="yes"
4484 plugin_cpufreq="yes"
4485 plugin_disk="yes"
4486 plugin_entropy="yes"
4487 plugin_interface="yes"
4488 plugin_irq="yes"
4489 plugin_load="yes"
4490 plugin_memory="yes"
4491 plugin_nfs="yes"
4492 plugin_fscache="yes"
4493 plugin_processes="yes"
4494 plugin_protocols="yes"
4495 plugin_serial="yes"
4496 plugin_swap="yes"
4497 plugin_tcpconns="yes"
4498 plugin_thermal="yes"
4499 plugin_uptime="yes"
4500 plugin_vmem="yes"
4501 plugin_vserver="yes"
4502 plugin_wireless="yes"
4504 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4505 then
4506 plugin_ipvs="yes"
4507 fi
4508 fi
4510 if test "x$ac_system" = "xOpenBSD"
4511 then
4512 plugin_tcpconns="yes"
4513 fi
4515 # Mac OS X devices
4516 if test "x$with_libiokit" = "xyes"
4517 then
4518 plugin_battery="yes"
4519 plugin_disk="yes"
4520 fi
4522 # AIX
4523 if test "x$with_perfstat" = "xyes"
4524 then
4525 plugin_cpu="yes"
4526 plugin_disk="yes"
4527 plugin_memory="yes"
4528 plugin_swap="yes"
4529 plugin_interface="yes"
4530 plugin_load="yes"
4531 fi
4533 if test "x$with_procinfo" = "xyes"
4534 then
4535 plugin_processes="yes"
4536 fi
4538 # Solaris
4539 if test "x$with_kstat" = "xyes"
4540 then
4541 plugin_uptime="yes"
4542 plugin_zfs_arc="yes"
4543 fi
4545 if test "x$with_devinfo$with_kstat" = "xyesyes"
4546 then
4547 plugin_cpu="yes"
4548 plugin_disk="yes"
4549 plugin_interface="yes"
4550 plugin_memory="yes"
4551 plugin_tape="yes"
4552 fi
4554 # libstatgrab
4555 if test "x$with_libstatgrab" = "xyes"
4556 then
4557 plugin_cpu="yes"
4558 plugin_disk="yes"
4559 plugin_interface="yes"
4560 plugin_load="yes"
4561 plugin_memory="yes"
4562 plugin_swap="yes"
4563 plugin_users="yes"
4564 fi
4566 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4567 then
4568 plugin_ascent="yes"
4569 if test "x$have_strptime" = "xyes"
4570 then
4571 plugin_bind="yes"
4572 fi
4573 fi
4575 if test "x$with_libopenipmipthread" = "xyes"
4576 then
4577 plugin_ipmi="yes"
4578 fi
4580 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4581 then
4582 plugin_curl_json="yes"
4583 fi
4585 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4586 then
4587 plugin_curl_xml="yes"
4588 fi
4590 if test "x$have_processor_info" = "xyes"
4591 then
4592 plugin_cpu="yes"
4593 fi
4594 if test "x$have_sysctl" = "xyes"
4595 then
4596 plugin_cpu="yes"
4597 plugin_memory="yes"
4598 plugin_uptime="yes"
4599 if test "x$ac_system" = "xDarwin"
4600 then
4601 plugin_swap="yes"
4602 fi
4603 fi
4604 if test "x$have_sysctlbyname" = "xyes"
4605 then
4606 plugin_contextswitch="yes"
4607 plugin_cpu="yes"
4608 plugin_memory="yes"
4609 plugin_tcpconns="yes"
4610 fi
4612 # Df plugin: Check if we know how to determine mount points first.
4613 #if test "x$have_listmntent" = "xyes"; then
4614 # plugin_df="yes"
4615 #fi
4616 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4617 then
4618 plugin_df="yes"
4619 fi
4620 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4621 then
4622 plugin_df="yes"
4623 fi
4624 #if test "x$have_getmntent" = "xseq"
4625 #then
4626 # plugin_df="yes"
4627 #fi
4628 if test "x$c_cv_have_one_getmntent" = "xyes"
4629 then
4630 plugin_df="yes"
4631 fi
4633 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4634 if test "x$plugin_df" = "xyes"
4635 then
4636 plugin_df="no"
4637 if test "x$have_statfs" = "xyes"
4638 then
4639 plugin_df="yes"
4640 fi
4641 if test "x$have_statvfs" = "xyes"
4642 then
4643 plugin_df="yes"
4644 fi
4645 fi
4647 if test "x$have_getifaddrs" = "xyes"
4648 then
4649 plugin_interface="yes"
4650 fi
4652 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4653 then
4654 plugin_libvirt="yes"
4655 fi
4657 if test "x$have_getloadavg" = "xyes"
4658 then
4659 plugin_load="yes"
4660 fi
4662 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4663 then
4664 plugin_perl="yes"
4665 fi
4667 # Mac OS X memory interface
4668 if test "x$have_host_statistics" = "xyes"
4669 then
4670 plugin_memory="yes"
4671 fi
4673 if test "x$have_termios_h" = "xyes"
4674 then
4675 plugin_multimeter="yes"
4676 plugin_ted="yes"
4677 fi
4679 if test "x$have_thread_info" = "xyes"
4680 then
4681 plugin_processes="yes"
4682 fi
4684 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4685 then
4686 plugin_processes="yes"
4687 fi
4689 if test "x$with_kvm_getswapinfo" = "xyes"
4690 then
4691 plugin_swap="yes"
4692 fi
4694 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4695 then
4696 plugin_swap="yes"
4697 fi
4699 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4700 then
4701 plugin_tcpconns="yes"
4702 fi
4704 if test "x$have_getutent" = "xyes"
4705 then
4706 plugin_users="yes"
4707 fi
4708 if test "x$have_getutxent" = "xyes"
4709 then
4710 plugin_users="yes"
4711 fi
4713 m4_divert_once([HELP_ENABLE], [
4714 collectd plugins:])
4716 AC_ARG_ENABLE([all-plugins],
4717 AC_HELP_STRING([--enable-all-plugins],
4718 [enable all plugins (auto by def)]),
4719 [
4720 if test "x$enableval" = "xyes"
4721 then
4722 enable_all_plugins="yes"
4723 else if test "x$enableval" = "xauto"
4724 then
4725 enable_all_plugins="auto"
4726 else
4727 enable_all_plugins="no"
4728 fi; fi
4729 ],
4730 [enable_all_plugins="auto"])
4732 m4_divert_once([HELP_ENABLE], [])
4734 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4735 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4736 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4737 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4738 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4739 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4740 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4741 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4742 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4743 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4744 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4745 AC_PLUGIN([csv], [yes], [CSV output plugin])
4746 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4747 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4748 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4749 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4750 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4751 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4752 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4753 AC_PLUGIN([email], [yes], [EMail statistics])
4754 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4755 AC_PLUGIN([exec], [yes], [Execution of external programs])
4756 AC_PLUGIN([filecount], [yes], [Count files in directories])
4757 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4758 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4759 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4760 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4761 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4762 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4763 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4764 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4765 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4766 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4767 AC_PLUGIN([load], [$plugin_load], [System load])
4768 AC_PLUGIN([logfile], [yes], [File logging plugin])
4769 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4770 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4771 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4772 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4773 AC_PLUGIN([match_regex], [yes], [The regex match])
4774 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4775 AC_PLUGIN([match_value], [yes], [The value match])
4776 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4777 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4778 AC_PLUGIN([memcached], [yes], [memcached statistics])
4779 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4780 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4781 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4782 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4783 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4784 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4785 AC_PLUGIN([network], [yes], [Network communication plugin])
4786 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4787 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4788 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4789 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4790 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4791 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4792 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4793 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4794 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4795 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4796 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4797 # FIXME: Check for libevent, too.
4798 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4799 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4800 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4801 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4802 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4803 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4804 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4805 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
4806 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4807 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4808 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4809 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4810 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4811 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4812 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4813 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4814 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4815 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4816 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4817 AC_PLUGIN([target_notification], [yes], [The notification target])
4818 AC_PLUGIN([target_replace], [yes], [The replace target])
4819 AC_PLUGIN([target_scale],[yes], [The scale target])
4820 AC_PLUGIN([target_set], [yes], [The set target])
4821 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
4822 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4823 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4824 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4825 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4826 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
4827 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4828 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4829 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4830 AC_PLUGIN([users], [$plugin_users], [User statistics])
4831 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4832 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
4833 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4834 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4835 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4836 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4837 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
4838 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4839 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4841 dnl Default configuration file
4842 # Load either syslog or logfile
4843 LOAD_PLUGIN_SYSLOG=""
4844 LOAD_PLUGIN_LOGFILE=""
4846 AC_MSG_CHECKING([which default log plugin to load])
4847 default_log_plugin="none"
4848 if test "x$enable_syslog" = "xyes"
4849 then
4850 default_log_plugin="syslog"
4851 else
4852 LOAD_PLUGIN_SYSLOG="##"
4853 fi
4855 if test "x$enable_logfile" = "xyes"
4856 then
4857 if test "x$default_log_plugin" = "xnone"
4858 then
4859 default_log_plugin="logfile"
4860 else
4861 LOAD_PLUGIN_LOGFILE="#"
4862 fi
4863 else
4864 LOAD_PLUGIN_LOGFILE="##"
4865 fi
4866 AC_MSG_RESULT([$default_log_plugin])
4868 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4869 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4871 DEFAULT_LOG_LEVEL="info"
4872 if test "x$enable_debug" = "xyes"
4873 then
4874 DEFAULT_LOG_LEVEL="debug"
4875 fi
4876 AC_SUBST(DEFAULT_LOG_LEVEL)
4878 # Load only one of rrdtool, network, csv in the default config.
4879 LOAD_PLUGIN_RRDTOOL=""
4880 LOAD_PLUGIN_NETWORK=""
4881 LOAD_PLUGIN_CSV=""
4883 AC_MSG_CHECKING([which default write plugin to load])
4884 default_write_plugin="none"
4885 if test "x$enable_rrdtool" = "xyes"
4886 then
4887 default_write_plugin="rrdtool"
4888 else
4889 LOAD_PLUGIN_RRDTOOL="##"
4890 fi
4892 if test "x$enable_network" = "xyes"
4893 then
4894 if test "x$default_write_plugin" = "xnone"
4895 then
4896 default_write_plugin="network"
4897 else
4898 LOAD_PLUGIN_NETWORK="#"
4899 fi
4900 else
4901 LOAD_PLUGIN_NETWORK="##"
4902 fi
4904 if test "x$enable_csv" = "xyes"
4905 then
4906 if test "x$default_write_plugin" = "xnone"
4907 then
4908 default_write_plugin="csv"
4909 else
4910 LOAD_PLUGIN_CSV="#"
4911 fi
4912 else
4913 LOAD_PLUGIN_CSV="##"
4914 fi
4915 AC_MSG_RESULT([$default_write_plugin])
4917 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4918 AC_SUBST(LOAD_PLUGIN_NETWORK)
4919 AC_SUBST(LOAD_PLUGIN_CSV)
4921 dnl ip_vs.h
4922 if test "x$ac_system" = "xLinux" \
4923 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
4924 then
4925 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4926 fi
4928 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
4929 then
4930 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
4931 fi
4933 dnl Perl bindings
4934 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4935 [
4936 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4937 then
4938 PERL_BINDINGS_OPTIONS="$withval"
4939 with_perl_bindings="yes"
4940 else
4941 PERL_BINDINGS_OPTIONS=""
4942 with_perl_bindings="$withval"
4943 fi
4944 ],
4945 [
4946 PERL_BINDINGS_OPTIONS=""
4947 if test -n "$perl_interpreter"
4948 then
4949 with_perl_bindings="yes"
4950 else
4951 with_perl_bindings="no (no perl interpreter found)"
4952 fi
4953 ])
4954 if test "x$with_perl_bindings" = "xyes"
4955 then
4956 PERL_BINDINGS="perl"
4957 else
4958 PERL_BINDINGS=""
4959 fi
4960 AC_SUBST(PERL_BINDINGS)
4961 AC_SUBST(PERL_BINDINGS_OPTIONS)
4963 dnl libcollectdclient
4964 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4965 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4966 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4968 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4970 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4972 AC_SUBST(LCC_VERSION_MAJOR)
4973 AC_SUBST(LCC_VERSION_MINOR)
4974 AC_SUBST(LCC_VERSION_PATCH)
4975 AC_SUBST(LCC_VERSION_EXTRA)
4976 AC_SUBST(LCC_VERSION_STRING)
4978 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4980 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/owniptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
4982 if test "x$with_librrd" = "xyes" \
4983 && test "x$librrd_threadsafe" != "xyes"
4984 then
4985 with_librrd="yes (warning: librrd is not thread-safe)"
4986 fi
4988 if test "x$with_libperl" = "xyes"
4989 then
4990 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4991 else
4992 enable_perl="no (needs libperl)"
4993 fi
4995 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4996 then
4997 enable_perl="no (libperl doesn't support ithreads)"
4998 fi
5000 if test "x$with_perl_bindings" = "xyes" \
5001 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5002 then
5003 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5004 fi
5006 cat <<EOF;
5008 Configuration:
5009 Libraries:
5010 libcurl . . . . . . . $with_libcurl
5011 libdbi . . . . . . . $with_libdbi
5012 libcredis . . . . . . $with_libcredis
5013 libesmtp . . . . . . $with_libesmtp
5014 libganglia . . . . . $with_libganglia
5015 libgcrypt . . . . . . $with_libgcrypt
5016 libiokit . . . . . . $with_libiokit
5017 libiptc . . . . . . . $with_libiptc
5018 libjvm . . . . . . . $with_java
5019 libkstat . . . . . . $with_kstat
5020 libkvm . . . . . . . $with_libkvm
5021 libmemcached . . . . $with_libmemcached
5022 libmodbus . . . . . . $with_libmodbus
5023 libmysql . . . . . . $with_libmysql
5024 libnetapp . . . . . . $with_libnetapp
5025 libnetlink . . . . . $with_libnetlink
5026 libnetsnmp . . . . . $with_libnetsnmp
5027 libnotify . . . . . . $with_libnotify
5028 liboconfig . . . . . $with_liboconfig
5029 libopenipmi . . . . . $with_libopenipmipthread
5030 liboping . . . . . . $with_liboping
5031 libpcap . . . . . . . $with_libpcap
5032 libperfstat . . . . . $with_perfstat
5033 libperl . . . . . . . $with_libperl
5034 libpq . . . . . . . . $with_libpq
5035 libpthread . . . . . $with_libpthread
5036 librabbitmq . . . . . $with_librabbitmq
5037 librouteros . . . . . $with_librouteros
5038 librrd . . . . . . . $with_librrd
5039 libsensors . . . . . $with_libsensors
5040 libstatgrab . . . . . $with_libstatgrab
5041 libtokyotyrant . . . $with_libtokyotyrant
5042 libupsclient . . . . $with_libupsclient
5043 libvarnish . . . . . $with_libvarnish
5044 libvirt . . . . . . . $with_libvirt
5045 libxml2 . . . . . . . $with_libxml2
5046 libxmms . . . . . . . $with_libxmms
5047 libyajl . . . . . . . $with_libyajl
5048 libevent . . . . . . $with_libevent
5049 protobuf-c . . . . . $have_protoc_c
5050 oracle . . . . . . . $with_oracle
5051 python . . . . . . . $with_python
5053 Features:
5054 daemon mode . . . . . $enable_daemon
5055 debug . . . . . . . . $enable_debug
5057 Bindings:
5058 perl . . . . . . . . $with_perl_bindings
5060 Modules:
5061 amqp . . . . . . . $enable_amqp
5062 apache . . . . . . . $enable_apache
5063 apcups . . . . . . . $enable_apcups
5064 apple_sensors . . . . $enable_apple_sensors
5065 ascent . . . . . . . $enable_ascent
5066 battery . . . . . . . $enable_battery
5067 bind . . . . . . . . $enable_bind
5068 conntrack . . . . . . $enable_conntrack
5069 contextswitch . . . . $enable_contextswitch
5070 cpu . . . . . . . . . $enable_cpu
5071 cpufreq . . . . . . . $enable_cpufreq
5072 csv . . . . . . . . . $enable_csv
5073 curl . . . . . . . . $enable_curl
5074 curl_json . . . . . . $enable_curl_json
5075 curl_xml . . . . . . $enable_curl_xml
5076 dbi . . . . . . . . . $enable_dbi
5077 df . . . . . . . . . $enable_df
5078 disk . . . . . . . . $enable_disk
5079 dns . . . . . . . . . $enable_dns
5080 email . . . . . . . . $enable_email
5081 entropy . . . . . . . $enable_entropy
5082 exec . . . . . . . . $enable_exec
5083 filecount . . . . . . $enable_filecount
5084 fscache . . . . . . . $enable_fscache
5085 gmond . . . . . . . . $enable_gmond
5086 hddtemp . . . . . . . $enable_hddtemp
5087 interface . . . . . . $enable_interface
5088 ipmi . . . . . . . . $enable_ipmi
5089 iptables . . . . . . $enable_iptables
5090 ipvs . . . . . . . . $enable_ipvs
5091 irq . . . . . . . . . $enable_irq
5092 java . . . . . . . . $enable_java
5093 libvirt . . . . . . . $enable_libvirt
5094 load . . . . . . . . $enable_load
5095 logfile . . . . . . . $enable_logfile
5096 lpar... . . . . . . . $enable_lpar
5097 madwifi . . . . . . . $enable_madwifi
5098 match_empty_counter . $enable_match_empty_counter
5099 match_hashed . . . . $enable_match_hashed
5100 match_regex . . . . . $enable_match_regex
5101 match_timediff . . . $enable_match_timediff
5102 match_value . . . . . $enable_match_value
5103 mbmon . . . . . . . . $enable_mbmon
5104 memcachec . . . . . . $enable_memcachec
5105 memcached . . . . . . $enable_memcached
5106 memory . . . . . . . $enable_memory
5107 modbus . . . . . . . $enable_modbus
5108 multimeter . . . . . $enable_multimeter
5109 mysql . . . . . . . . $enable_mysql
5110 netapp . . . . . . . $enable_netapp
5111 netlink . . . . . . . $enable_netlink
5112 network . . . . . . . $enable_network
5113 nfs . . . . . . . . . $enable_nfs
5114 nginx . . . . . . . . $enable_nginx
5115 notify_desktop . . . $enable_notify_desktop
5116 notify_email . . . . $enable_notify_email
5117 ntpd . . . . . . . . $enable_ntpd
5118 nut . . . . . . . . . $enable_nut
5119 olsrd . . . . . . . . $enable_olsrd
5120 onewire . . . . . . . $enable_onewire
5121 openvpn . . . . . . . $enable_openvpn
5122 oracle . . . . . . . $enable_oracle
5123 perl . . . . . . . . $enable_perl
5124 pinba . . . . . . . . $enable_pinba
5125 ping . . . . . . . . $enable_ping
5126 postgresql . . . . . $enable_postgresql
5127 powerdns . . . . . . $enable_powerdns
5128 processes . . . . . . $enable_processes
5129 protocols . . . . . . $enable_protocols
5130 python . . . . . . . $enable_python
5131 redis . . . . . . . . $enable_redis
5132 routeros . . . . . . $enable_routeros
5133 rrdcached . . . . . . $enable_rrdcached
5134 rrdtool . . . . . . . $enable_rrdtool
5135 sensors . . . . . . . $enable_sensors
5136 serial . . . . . . . $enable_serial
5137 snmp . . . . . . . . $enable_snmp
5138 swap . . . . . . . . $enable_swap
5139 syslog . . . . . . . $enable_syslog
5140 table . . . . . . . . $enable_table
5141 tail . . . . . . . . $enable_tail
5142 tape . . . . . . . . $enable_tape
5143 target_notification . $enable_target_notification
5144 target_replace . . . $enable_target_replace
5145 target_scale . . . . $enable_target_scale
5146 target_set . . . . . $enable_target_set
5147 target_v5upgrade . . $enable_target_v5upgrade
5148 tcpconns . . . . . . $enable_tcpconns
5149 teamspeak2 . . . . . $enable_teamspeak2
5150 ted . . . . . . . . . $enable_ted
5151 thermal . . . . . . . $enable_thermal
5152 threshold . . . . . . $enable_threshold
5153 tokyotyrant . . . . . $enable_tokyotyrant
5154 unixsock . . . . . . $enable_unixsock
5155 uptime . . . . . . . $enable_uptime
5156 users . . . . . . . . $enable_users
5157 uuid . . . . . . . . $enable_uuid
5158 varnish . . . . . . . $enable_varnish
5159 vmem . . . . . . . . $enable_vmem
5160 vserver . . . . . . . $enable_vserver
5161 wireless . . . . . . $enable_wireless
5162 write_http . . . . . $enable_write_http
5163 write_redis . . . . . $enable_write_redis
5164 xmms . . . . . . . . $enable_xmms
5165 zfs_arc . . . . . . . $enable_zfs_arc
5167 EOF
5169 if test "x$dependency_error" = "xyes"; then
5170 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5171 fi
5173 if test "x$dependency_warning" = "xyes"; then
5174 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5175 fi
5177 # vim: set fdm=marker :