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