]> git.ipfire.org Git - thirdparty/collectd.git/blame - configure.in
Forgot to insert name in the ChangeLog. This revision corrects this (in trunk)
[thirdparty/collectd.git] / configure.in
CommitLineData
86ca149a 1dnl Process this file with autoconf to produce a configure script.
c7d818fc 2AC_INIT(collectd, 3.9.0)
6e765a02
FF
3AC_CONFIG_SRCDIR(src/collectd.c)
4AC_CONFIG_HEADERS(src/config.h)
5AM_INIT_AUTOMAKE(dist-bzip2)
86ca149a
FF
6AC_LANG(C)
7
8AC_PREFIX_DEFAULT("/opt/collectd")
9
15996f86
FF
10#
11# Checks for programs.
12#
86ca149a
FF
13AC_PROG_CC
14AC_PROG_CPP
15AC_PROG_INSTALL
16AC_PROG_LN_S
17AC_PROG_MAKE_SET
586eed68 18AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
86ca149a
FF
19
20dnl configure libtool
21AC_DISABLE_STATIC
6e765a02
FF
22AC_LIBLTDL_CONVENIENCE
23AC_SUBST(LTDLINCL)
24AC_SUBST(LIBLTDL)
86ca149a
FF
25AC_LIBTOOL_DLOPEN
26AC_PROG_LIBTOOL
27#AC_PROG_RANLIB
7df03651 28AC_CONFIG_SUBDIRS(libltdl src/libconfig)
86ca149a 29
15996f86
FF
30#
31# Checks for header files.
32#
e708ae9b 33AC_HEADER_STDC
86ca149a 34AC_HEADER_SYS_WAIT
6e765a02 35AC_HEADER_DIRENT
6934b3d0 36AC_CHECK_HEADERS(stdint.h)
1842a7a7 37AC_CHECK_HEADERS(stdio.h)
586eed68 38AC_CHECK_HEADERS(errno.h)
3e481d27 39AC_CHECK_HEADERS(math.h)
586eed68 40AC_CHECK_HEADERS(syslog.h)
6e765a02 41AC_CHECK_HEADERS(fcntl.h)
86ca149a 42AC_CHECK_HEADERS(signal.h)
586eed68
FF
43AC_CHECK_HEADERS(assert.h)
44AC_CHECK_HEADERS(sys/types.h)
86ca149a
FF
45AC_CHECK_HEADERS(sys/socket.h)
46AC_CHECK_HEADERS(sys/select.h)
47AC_CHECK_HEADERS(netdb.h)
586eed68 48AC_CHECK_HEADERS(arpa/inet.h)
86ca149a 49AC_CHECK_HEADERS(sys/resource.h)
c988f52c 50AC_CHECK_HEADERS(sys/param.h)
15996f86 51
c9a5b034 52# For ping library
6934b3d0
FF
53AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
54[#if HAVE_STDINT_H
55# include <stdint.h>
56#endif
57])
c9a5b034 58AC_CHECK_HEADERS(netinet/in.h, [], [],
6934b3d0
FF
59[#if HAVE_STDINT_H
60# include <stdint.h>
61#endif
62#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
63# include <netinet/in_systm.h>
64#endif
65])
66AC_CHECK_HEADERS(netinet/ip.h, [], [],
6934b3d0
FF
67[#if HAVE_STDINT_H
68# include <stdint.h>
69#endif
70#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
71# include <netinet/in_systm.h>
72#endif
73#if HAVE_NETINET_IN_H
74# include <netinet/in.h>
75#endif
76])
77AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
6934b3d0
FF
78[#if HAVE_STDINT_H
79# include <stdint.h>
80#endif
81#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
82# include <netinet/in_systm.h>
83#endif
84#if HAVE_NETINET_IN_H
85# include <netinet/in.h>
86#endif
87#if HAVE_NETINET_IP_H
88# include <netinet/ip.h>
89#endif
90])
91AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
6934b3d0
FF
92[#if HAVE_STDINT_H
93# include <stdint.h>
94#endif
95#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
96# include <netinet/in_systm.h>
97#endif
98#if HAVE_NETINET_IN_H
99# include <netinet/in.h>
100#endif
101#if HAVE_NETINET_IP_H
102# include <netinet/ip.h>
103#endif
104])
105AC_CHECK_HEADERS(netinet/ip6.h, [], [],
6934b3d0
FF
106[#if HAVE_STDINT_H
107# include <stdint.h>
108#endif
6fe07031
FF
109#if HAVE_SYS_TYPES_H
110# include <sys/types.h>
111#endif
6934b3d0 112#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
113# include <netinet/in_systm.h>
114#endif
115#if HAVE_NETINET_IN_H
116# include <netinet/in.h>
117#endif
118])
119AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
6934b3d0
FF
120[#if HAVE_STDINT_H
121# include <stdint.h>
122#endif
6fe07031
FF
123#if HAVE_SYS_TYPES_H
124# include <sys/types.h>
125#endif
6934b3d0 126#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
127# include <netinet/in_systm.h>
128#endif
129#if HAVE_NETINET_IN_H
130# include <netinet/in.h>
131#endif
132#if HAVE_NETINET_IP6_H
133# include <netinet/ip6.h>
134#endif
135])
136
e1d497b7
FF
137# For cpu modules
138AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
daf3a589
FF
139AC_CHECK_HEADERS(mach/kern_return.h)
140AC_CHECK_HEADERS(mach/mach_init.h)
54800675 141AC_CHECK_HEADERS(mach/mach_host.h)
daf3a589
FF
142AC_CHECK_HEADERS(mach/host_priv.h)
143AC_CHECK_HEADERS(mach/processor_info.h)
144AC_CHECK_HEADERS(mach/processor.h)
54800675 145AC_CHECK_HEADERS(mach/vm_statistics.h)
e1d497b7 146
15996f86
FF
147# For load module
148AC_CHECK_HEADERS(sys/loadavg.h)
149
15996f86 150# For users module
82d65d87 151AC_CHECK_HEADERS(utmp.h)
6e481905 152AC_CHECK_HEADERS(utmpx.h)
86ca149a 153
a8025575
FF
154# For apache plugin
155AC_CHECK_HEADERS(curl/curl.h)
156
6e765a02
FF
157# For quota module
158AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
159AC_CHECK_HEADERS(ctype.h)
160AC_CHECK_HEADERS(limits.h)
161AC_CHECK_HEADERS(sys/quota.h)
162AC_CHECK_HEADERS(xfs/xqm.h)
163
164# For mount interface
165AC_CHECK_HEADERS(fs_info.h)
166AC_CHECK_HEADERS(fshelp.h)
167AC_CHECK_HEADERS(paths.h)
168AC_CHECK_HEADERS(mntent.h)
169AC_CHECK_HEADERS(mnttab.h)
170AC_CHECK_HEADERS(sys/fstyp.h)
171AC_CHECK_HEADERS(sys/fs_types.h)
172AC_CHECK_HEADERS(sys/mntent.h)
173AC_CHECK_HEADERS(sys/mnttab.h)
174AC_CHECK_HEADERS(sys/mount.h)
175AC_CHECK_HEADERS(sys/statfs.h)
2d03e4e3 176AC_CHECK_HEADERS(sys/statvfs.h)
6e765a02
FF
177AC_CHECK_HEADERS(sys/vfs.h)
178AC_CHECK_HEADERS(sys/vfstab.h)
179
180# For debugging interface (variable number of arguments)
181AC_CHECK_HEADERS(stdarg.h)
182
86ca149a
FF
183dnl Checking for libraries
184AC_CHECK_LIB(m, ext)
185
15996f86
FF
186#
187# Checks for typedefs, structures, and compiler characteristics.
188#
86ca149a
FF
189AC_C_CONST
190AC_TYPE_PID_T
191AC_TYPE_SIZE_T
7df03651 192AC_TYPE_UID_T
86ca149a
FF
193AC_HEADER_TIME
194
15996f86
FF
195#
196# Checks for library functions.
197#
86ca149a 198AC_PROG_GCC_TRADITIONAL
6e765a02 199AC_CHECK_FUNCS(gettimeofday select strdup strtol)
86ca149a 200AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
586eed68 201AC_CHECK_FUNCS(getaddrinfo getnameinfo)
86ca149a 202AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
6e765a02 203AC_CHECK_FUNCS(strncasecmp strcasecmp)
c988f52c 204AC_CHECK_FUNCS(openlog syslog closelog)
15996f86 205
e1d497b7
FF
206# For cpu module
207AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
208
2d03e4e3
FF
209# For df module
210AC_CHECK_FUNCS(statfs statvfs)
211
15996f86
FF
212# For load module
213AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
214
215# For users module
b898eac6 216AC_CHECK_FUNCS(getutent getutxent)
86ca149a 217
6e765a02
FF
218# For quota module
219AC_CHECK_FUNCS(quotactl)
220AC_CHECK_FUNCS(getgrgid getpwuid)
221
222# For mount interface
223AC_CHECK_FUNCS(getfsent getvfsent listmntent)
c9a5b034
FF
224AC_CHECK_FUNCS(getfsstat)
225
226# Check for different versions of `getmntent' here..
6e765a02 227AC_FUNC_GETMNTENT
c9a5b034
FF
228if test "x$ac_cv_lib_sun_getmntent" = "xyes"
229then
230 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
231 [Define if the function getmntent exists. It's the version from libsun.])
232fi
233if test "x$ac_cv_lib_seq_getmntent" = "xyes"
234then
235 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
236 [Define if the function getmntent exists. It's the version from libseq.])
237fi
238if test "x$ac_cv_lib_gen_getmntent" = "xyes"
239then
240 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
241 [Define if the function getmntent exists. It's the version from libgen.])
242fi
243
3c12e8a6 244if test "x$ac_cv_func_getmntent" = "xyes"; then
6e765a02
FF
245 saveCFLAGS="$CFLAGS"
246 CFLAGS="-Wall -Werror $CFLAGS"
247 AC_CACHE_CHECK([whether getmntent takes one argument],
248 [fu_cv_getmntent1],
249 AC_COMPILE_IFELSE(
250 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
251#include "$srcdir/src/utils_mount.h"]],
252 [[(void)getmntent((FILE *)NULL);]]
253 ),
254 [fu_cv_getmntent1=yes],
255 [fu_cv_getmntent1=no]
256 )
257 )
3c12e8a6 258 if test "x$fu_cv_getmntent1" = "xno"; then
6e765a02
FF
259 AC_CACHE_CHECK([whether getmntent takes two arguments],
260 [fu_cv_getmntent2],
261 AC_COMPILE_IFELSE(
262 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
263#include "$srcdir/src/utils_mount.h"]],
264 [[(void)getmntent((FILE *)NULL,
265 (struct mnttab *)NULL);]]
266 ),
267 [fu_cv_getmntent2=yes],
268 [fu_cv_getmntent2=no]
269 )
270 )
271 fi
272 CFLAGS="$saveCFLAGS"
273fi
3c12e8a6 274if test "x$fu_cv_getmntent1" = "xyes"; then
6e765a02
FF
275 AC_DEFINE(HAVE_GETMNTENT1,
276 1,
277 [Define if there is a function named getmntent
278 for reading the list of mounted filesystems, and
279 that function takes a single argument. (4.3BSD,
280 SunOS, HP-UX, Dynix, Irix, Linux)]
281 )
282fi
3c12e8a6 283if test "x$fu_cv_getmntent2" = "xyes"; then
6e765a02
FF
284 AC_DEFINE(HAVE_GETMNTENT2,
285 1,
286 [Define if there is a function named getmntent
287 for reading the list of mounted filesystems, and
288 that function takes two arguments. (SVR4)]
289 )
290fi
291
86ca149a
FF
292AC_MSG_CHECKING([for kernel type ($host_os)])
293case $host_os in
294 *linux*)
295 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
296 ac_system="Linux"
297 ;;
298 *solaris*)
299 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
300 ac_system="Solaris"
301 ;;
302 *)
303 ac_system="unknown"
304esac
305AC_MSG_RESULT([$ac_system])
306
a58af051
FF
307with_libsocket="yes"
308AC_CHECK_LIB(socket, socket,
309[
310 AC_DEFINE(HAVE_LIBSOCKET, 1, [Define to 1 if you have the 'socket' library (-lsocket).])
311],
312[with_libsocket="no"])
313AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$with_libsocket" = "xyes")
314
315with_libresolv="yes"
316AC_CHECK_LIB(resolv, res_search,
317[
318 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
319],
320[with_libresolv="no"])
321AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
86ca149a 322
125bdc00 323
c27cdba8
NW
324m4_divert_once([HELP_WITH], [
325collectd additional packages:])
326
86ca149a 327# AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3c12e8a6 328AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
42e281c5 329[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
86ca149a
FF
330 then
331 LDFLAGS="$LDFLAGS -L$withval/lib"
332 CPPFLAGS="$CPPFLAGS -I$withval/include"
333 with_rrdtool="yes"
334 fi
335], [with_rrdtool="yes"])
336if test "x$with_rrdtool" = "xyes"
337then
a58af051
FF
338 AC_CHECK_LIB(rrd, rrd_update,
339 [
340 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
341 ],
342 [with_rrdtool="no (librrd not found)"], [-lm])
86ca149a
FF
343fi
344if test "x$with_rrdtool" = "xyes"
345then
3c12e8a6 346 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
86ca149a 347fi
b898eac6
NW
348if test "x$with_rrdtool" = "xyes"
349then
350 collect_rrdtool=1
351else
352 collect_rrdtool=0
353fi
354AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
355 [Wether or not to use rrdtool library])
86ca149a
FF
356AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
357
3c12e8a6 358#AC_ARG_WITH(pth, [AS_HELP_STRING([--with-pth=@<:@=PREFIX@:>@], [Path to pth (experimental).]),
42e281c5 359#[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
6e765a02
FF
360# then
361# LDFLAGS="$LDFLAGS -L$withval/lib"
362# CPPFLAGS="$CPPFLAGS -I$withval/include"
363# with_pth="yes"
364# fi
365#], [with_pth="no"])
366#if test "x$with_pth" = "xyes"
367#then
3c12e8a6 368# AC_CHECK_LIB(pth, pth_init,, [with_pth="no (libpth not found)"], [])
6e765a02
FF
369#fi
370#if test "x$with_pth" = "xyes"
371#then
3c12e8a6 372# AC_CHECK_HEADERS(pth.h,, [with_pth="no (pth.h not found)"])
6e765a02
FF
373#fi
374#if test "x$with_pth" = "xyes"
375#then
376# collect_pth=1
377#else
378# collect_pth=0
379#fi
380#AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
381# [Wether or not to use pth (portable threads) library])
382#AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
383
86ca149a
FF
384if test "$ac_system" = "Solaris"
385then
386 with_kstat="yes"
3c12e8a6
NW
387else
388 with_kstat="no (Solaris only)"
389fi
390if test "x$with_kstat" = "xyes"
391then
b898eac6 392 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (libkstat not found)"])
3c12e8a6
NW
393fi
394if test "x$with_kstat" = "xyes"
395then
86ca149a
FF
396 AC_CHECK_LIB(devinfo, di_init)
397 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
86ca149a 398fi
b898eac6
NW
399if test "x$with_kstat" = "xyes"
400then
401 collect_kstat=1
402else
403 collect_kstat=0
404fi
405AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
406 [Wether or not to use kstat library (Solaris)])
407AM_CONDITIONAL(BUILD_WITH_KSTAT, test "x$with_kstat" = "xyes")
86ca149a 408
1842a7a7
FF
409### BEGIN of check for libcurl ###
410with_curl_config="curl-config"
411with_curl_prefix=0
412with_curl_libs=""
413AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
414[
415 if test "x$withval" != "xno" -a "x$withval" != "xyes"
416 then
417 if test -x "$withval/bin/curl-config"
418 then
419 with_curl_config="$withval/bin/curl-config"
420 with_curl_prefix=1
421 fi
422 fi
423 if test "x$withval" = "xno"
424 then
425 with_libcurl="no"
426 else
427 with_libcurl="yes"
428 fi
429],
430[
431 with_libcurl="yes"
432])
433if test "x$with_libcurl" = "xyes"
434then
435 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
436 curl_config_status=$?
437
438 if test $curl_config_status -ne 0
439 then
440 with_libcurl="no"
441 else
442 AC_CHECK_LIB(curl, curl_easy_init,
443 [
444 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
445 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
446 ],
447 [
448 with_libcurl="no"
449 ],
450 [$with_curl_libs])
451 fi
452fi
453if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
454then
455 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
456 curl_config_status=$?
457
458 if test $curl_config_status -ne 0
459 then
460 with_libcurl="no"
461 else
462 if test -d "$with_curl_prefix/include"
463 then
464 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
465 fi
466 fi
467fi
468
469with_libcurl_numeric=0
470if test "x$with_libcurl" = "xyes"
471then
472 with_libcurl_numeric=1
473fi
474AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
475AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
476### END of check for libcurl ###
477
3c12e8a6 478AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
86ca149a 479[
1842a7a7 480 if test "x$withval" != "xno" -a "x$withval" != "xyes"
86ca149a 481 then
42e281c5
NW
482 LDFLAGS="$LDFLAGS -L$withval/lib"
483 CPPFLAGS="$CPPFLAGS -I$withval/include"
484 with_libstatgrab="yes"
86ca149a
FF
485 fi
486],
487[
f830bd02 488 if test "x$ac_system" == "xunknown"
86ca149a 489 then
86ca149a 490 with_libstatgrab="yes"
f830bd02
NW
491 else
492 with_libstatgrab="no"
86ca149a
FF
493 fi
494])
495if test "x$with_libstatgrab" = "xyes"
496then
e1d497b7
FF
497 AC_CHECK_LIB(devstat, getdevs)
498 AC_CHECK_LIB(kvm, kvm_getargv)
176d5f79 499 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (libstatgrab not found)"])
3c12e8a6
NW
500fi
501if test "x$with_libstatgrab" = "xyes"
502then
176d5f79 503 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
86ca149a 504fi
176d5f79
NW
505if test "x$with_libstatgrab" = "xyes"
506then
507 collect_libstatgrab=1
508else
509 collect_libstatgrab=0
510fi
511AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
512 [Wether or not to use statgrab library])
513AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
86ca149a 514
3c12e8a6 515AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
86ca149a 516[
56a554e8 517 if test "x$withval" != "xno" && test "x$withval" != "xyes"
86ca149a 518 then
56a554e8
NW
519 LDFLAGS="$LDFLAGS -L$withval/lib"
520 CPPFLAGS="$CPPFLAGS -I$withval/include"
521 with_lm_sensors="yes"
86ca149a
FF
522 fi
523],
524[
86ca149a
FF
525 if test "x$ac_system" = "xLinux"
526 then
527 with_lm_sensors="yes"
528 else
529 with_lm_sensors="no"
530 fi
531])
532if test "x$with_lm_sensors" = "xyes"
533then
534 AC_CHECK_LIB(sensors, sensors_init,
535 [
86ca149a
FF
536 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
537 ],
56a554e8 538 [with_lm_sensors="no (libsensors not found)"])
3c12e8a6
NW
539fi
540if test "x$with_lm_sensors" = "xyes"
541then
86ca149a
FF
542 AC_CHECK_HEADERS(sensors/sensors.h,
543 [
86ca149a
FF
544 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
545 ],
56a554e8
NW
546 [with_lm_sensors="no (sensors/sensors.h not found)"])
547fi
548if test "x$with_lm_sensors" = "xyes"
549then
550 collect_lm_sensors=1
551else
552 collect_lm_sensors=0
86ca149a 553fi
56a554e8
NW
554AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
555 [Wether or not to use sensors library])
556AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
86ca149a 557
e4303e15
FF
558AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
559[
560 if test "x$withval" != "xno" && test "x$withval" != "xyes"
561 then
562 LDFLAGS="$LDFLAGS -L$withval/lib"
563 CPPFLAGS="$CPPFLAGS -I$withval/include"
564 with_libmysql="yes"
565 fi
566],
567[
568 with_libmysql="yes"
569])
570if test "x$with_libmysql" = "xyes"
571then
2bb1a064
FF
572 AC_CHECK_LIB(mysqlclient, mysql_init,
573 [
574 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
575 ], [with_libmysql="no (libmysql not found)"])
e4303e15
FF
576fi
577if test "x$with_libmysql" = "xyes"
578then
2bb1a064
FF
579 AC_CHECK_HEADERS(mysql/mysql.h,
580 [
581 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
582 ], [with_libmysql="no (mysql/mysql.h not found)"])
e4303e15
FF
583fi
584if test "x$with_libmysql" = "xyes"
585then
586 collect_libmysql=1
587else
588 collect_libmysql=0
589fi
590AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
591 [Wether or not to use mysql library])
592AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
86ca149a 593
010d7b9e
FF
594# Define `step' and `hearbeat' values..
595declare -i collectd_step=10
596declare -i collectd_heartbeat=25
597AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
598[
599 if test "x$withval" != "xno" -a "x$withval" != "xyes"
600 then
601 declare -i tmp_collectd_step="$withval"
602 if test $tmp_collectd_step -gt 0
603 then
604 collectd_step=$tmp_collectd_step
605 let "collectd_heartbeat=$collectd_step*2"
606 fi
607 fi
608], [])
609AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
610[
611 if test "x$withval" != "xno" -a "x$withval" != "xyes"
612 then
613 declare -i tmp_collectd_heartbeat="$withval"
614 if test $tmp_collectd_heartbeat -gt 0
615 then
616 collectd_heartbeat=$tmp_collectd_heartbeat
617 fi
618 fi
619], [])
620
621if test $collectd_step -ne 10
622then
4ed2fa99 623 AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
010d7b9e
FF
624fi
625if test $collectd_heartbeat -ne 25
626then
627 AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
628fi
629
86ca149a
FF
630#
631# Check for enabled/disabled features
632#
6e765a02 633
3c12e8a6
NW
634# AC_COLLECTD(name, enable/disable, info-text, feature/module)
635# ------------------------------------------------------------
636dnl
637m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
638dnl
639AC_DEFUN(
640 [AC_COLLECTD],
641 [
642 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
643 m4_if(
644 [$2],
645 [enable],
646 [dnl
647 m4_define([EnDis],[disabled])dnl
648 m4_define([YesNo],[no])dnl
649 ],dnl
650 [m4_if(
651 [$2],
652 [disable],
653 [dnl
654 m4_define([EnDis],[enabled])dnl
655 m4_define([YesNo],[yes])dnl
656 ],
657 [dnl
658 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
659 ]dnl
660 )]dnl
661 )dnl
662 m4_if([$3], [feature], [],
663 [m4_if(
664 [$3], [module], [],
665 [dnl
666 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
667 ]dnl
668 )]dnl
669 )dnl
670 AC_ARG_ENABLE(
671 [$1],
672 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
673 [],
674 enable_$1='[YesNo]'dnl
675 )# AC_ARG_ENABLE
676if test "x$enable_$1" = "xno"
677then
678 collectd_$1=0
6e765a02 679else
3c12e8a6 680 if test "x$enable_$1" = "xyes"
6e765a02 681 then
3c12e8a6 682 collectd_$1=1
6e765a02 683 else
3c12e8a6
NW
684 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
685 collectd_$1=1
686 enable_$1='yes'
6e765a02
FF
687 fi
688fi
3c12e8a6
NW
689 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
690 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
691 ]dnl
692)# AC_COLLECTD(name, enable/disable, info-text, feature/module)
693
3c12e8a6
NW
694m4_divert_once([HELP_ENABLE], [
695collectd features:])
3c12e8a6
NW
696AC_COLLECTD([debug], [enable], [feature], [debugging])
697AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
6e765a02 698
f9ee71b2
NW
699m4_divert_once([HELP_ENABLE], [
700collectd modules:])
a8025575 701AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
84b0b421 702AC_COLLECTD([battery], [disable], [module], [battery statistics])
96cf2ccb 703AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
55b43947
FF
704AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
705AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
2d03e4e3 706AC_COLLECTD([df], [disable], [module], [df statistics])
55b43947
FF
707AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
708AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
709AC_COLLECTD([load], [disable], [module], [system load statistics])
710AC_COLLECTD([memory], [disable], [module], [memory statistics])
e4303e15 711AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
55b43947
FF
712AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
713AC_COLLECTD([ping], [disable], [module], [ping statistics])
714AC_COLLECTD([processes], [disable], [module], [processes statistics])
715AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
716AC_COLLECTD([serial], [disable], [module], [serial statistics])
717AC_COLLECTD([swap], [disable], [module], [swap statistics])
718AC_COLLECTD([tape], [disable], [module], [tape statistics])
719AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
720AC_COLLECTD([users], [disable], [module], [user count statistics])
5e70f2e0 721AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
08037975 722AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
55b43947
FF
723
724#m4_divert_once([HELP_ENABLE], [
725#collectd modules:])
96cf2ccb
FF
726#AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
727#if test "x$enable_cpu" != "xno"
728#then
729# if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$have_sysctlbyname" = "xyes"
730# then
731# enable_cpu="yes"
732# else
733# enable_cpu="no"
734# fi
735#fi
736#if test "x$enable_cpu" = "xno"
737#then
738# AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
739#fi
740#AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
86ca149a 741
55b43947
FF
742#AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
743#if test "x$enable_cpufreq" != "xno"
744#then
745# if test "x$ac_system" = "xLinux"
746# then
747# enable_cpufreq="yes"
748# else
749# enable_cpufreq="no"
750# fi
751#fi
752#if test "x$enable_cpufreq" = "xno"
753#then
754# AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
755#fi
756#AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
86ca149a 757
55b43947
FF
758#AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
759#if test "x$enable_disk" != "xno"
760#then
761# if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
762# then
763# enable_disk="yes"
764# else
765# enable_disk="no"
766# fi
767#fi
768#if test "x$enable_disk" = "xno"
769#then
770# AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
771#fi
772#AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
86ca149a 773
55b43947
FF
774#AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
775#if test "x$enable_hddtemp" = "xno"
776#then
777# AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
778#fi
779#AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
86ca149a 780
55b43947
FF
781#AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
782#if test "x$enable_load" != "xno"
783#then
784# if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
785# then
786# enable_load="yes"
787# else
788# enable_load="no"
789# fi
790#fi
791#if test "x$enable_load" = "xno"
792#then
793# AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
794#fi
795#AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
86ca149a 796
55b43947
FF
797#AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
798#if test "x$enable_memory" != "xno"
799#then
800# if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
801# then
802# enable_memory="yes"
803# else
804# enable_memory="no"
805# fi
806#fi
807#if test "x$enable_memory" = "xno"
808#then
809# AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
810#fi
811#AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
86ca149a 812
55b43947
FF
813#AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
814#if test "x$enable_nfs" != "xno"
815#then
816# if test "x$ac_system" = "xLinux"
817# then
818# enable_nfs="yes"
819# else
820# enable_nfs="no"
821# fi
822#fi
823#if test "x$enable_nfs" = "xno"
824#then
825# AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
826#fi
827#AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
86ca149a 828
55b43947
FF
829#AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
830#if test "x$enable_ping" != "xno"
831#then
832# enable_ping="yes"
833#fi
834#if test "x$enable_ping" = "xno"
835#then
836# AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
837#fi
838#AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
86ca149a 839
55b43947
FF
840#AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
841#if test "x$enable_processes" != "xno"
842#then
843# if test "x$ac_system" = "xLinux"
844# then
845# enable_processes="yes"
846# else
847# enable_processes="no"
848# fi
849#fi
850#if test "x$enable_processes" = "xno"
851#then
852# AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
853#fi
854#AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
86ca149a 855
55b43947 856##AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
0dace18f 857
55b43947
FF
858#AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
859#if test "x$enable_sensors" != "xno"
860#then
861# if test "x$with_lm_sensors" = "xyes"
862# then
863# enable_sensors="yes"
864# else
865# enable_sensors="no"
866# fi
867#fi
868#if test "x$enable_sensors" = "xno"
869#then
870# AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
871#fi
872#AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
86ca149a 873
55b43947
FF
874#AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
875#if test "x$enable_serial" != "xno"
876#then
877# if test "x$ac_system" = "xLinux"
878# then
879# enable_serial="yes"
880# else
881# enable_serial="no"
882# fi
883#fi
884#if test "x$enable_serial" = "xno"
885#then
886# AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
887#fi
888#AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
86ca149a 889
55b43947
FF
890#AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
891#if test "x$enable_swap" != "xno"
892#then
893# if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
894# then
895# enable_swap="yes"
896# else
897# enable_swap="no"
898# fi
899#fi
900#if test "x$enable_swap" = "xno"
901#then
902# AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
903#fi
904#AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
86ca149a 905
55b43947
FF
906#AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
907#if test "x$enable_tape" != "xno"
908#then
909# if test "x$with_kstat" = "xyes"
910# then
911# enable_tape="yes"
912# else
913# enable_tape="no"
914# fi
915#fi
916#if test "x$enable_tape" = "xno"
917#then
918# AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
919#fi
920#AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
86ca149a 921
55b43947
FF
922#AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
923#if test "x$enable_traffic" != "xno"
924#then
925# if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
926# then
927# enable_traffic="yes"
928# else
929# enable_traffic="no"
930# fi
931#fi
932#if test "x$enable_traffic" = "xno"
933#then
934# AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
935#fi
936#AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
86ca149a 937
55b43947 938#AC_COLLECTD([users], [disable], [module], [user count statistics])
0127d402 939
7a8f7c2e 940AC_OUTPUT(Makefile src/libconfig/Makefile src/liboping/Makefile src/Makefile)
86ca149a
FF
941
942cat <<EOF;
943
944Configuration:
945 Libraries:
a8025575 946 libcurl . . . . . . $with_libcurl
86ca149a
FF
947 librrd . . . . . . $with_rrdtool
948 lm_sensors . . . . $with_lm_sensors
949 libstatgrab . . . . $with_libstatgrab
950 libkstat . . . . . $with_kstat
e4303e15 951 libmysql . . . . . $with_libmysql
86ca149a
FF
952
953 Features:
6e765a02
FF
954 debug . . . . . . . $enable_debug
955 daemon mode . . . . $enable_daemon
010d7b9e
FF
956 step . . . . . . . $collectd_step seconds
957 heartbeat . . . . . $collectd_heartbeat seconds
6e765a02
FF
958
959 Modules:
84b0b421 960 battery . . . . . . $enable_battery
86ca149a
FF
961 cpu . . . . . . . . $enable_cpu
962 cpufreq . . . . . . $enable_cpufreq
2d03e4e3 963 df . . . . . . . . $enable_df
86ca149a
FF
964 disk . . . . . . . $enable_disk
965 hddtemp . . . . . . $enable_hddtemp
966 load . . . . . . . $enable_load
967 memory . . . . . . $enable_memory
1f2a5bff 968 mysql . . . . . . . $enable_mysql
86ca149a
FF
969 nfs . . . . . . . . $enable_nfs
970 ping . . . . . . . $enable_ping
971 processes . . . . . $enable_processes
972 sensors . . . . . . $enable_sensors
973 serial . . . . . . $enable_serial
974 swap . . . . . . . $enable_swap
975 tape . . . . . . . $enable_tape
976 traffic . . . . . . $enable_traffic
0127d402 977 users . . . . . . . $enable_users
5e70f2e0 978 vserver . . . . . . $enable_vserver
08037975 979 wireless . . . . . $enable_wireless
86ca149a
FF
980
981EOF