1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.5.0)
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
8 AC_PREFIX_DEFAULT("/opt/collectd")
11 # Checks for programs.
21 AC_LIBLTDL_CONVENIENCE
27 AC_CONFIG_SUBDIRS(libltdl)
30 # Checks for header files.
34 AC_CHECK_HEADERS(fcntl.h)
35 AC_CHECK_HEADERS(signal.h)
36 AC_CHECK_HEADERS(sys/socket.h)
37 AC_CHECK_HEADERS(sys/select.h)
38 AC_CHECK_HEADERS(netdb.h)
39 AC_CHECK_HEADERS(sys/resource.h)
40 AC_CHECK_HEADERS(errno.h)
41 AC_CHECK_HEADERS(syslog.h)
44 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
47 AC_CHECK_HEADERS(sys/loadavg.h)
50 AC_CHECK_HEADERS(arpa/inet.h)
51 AC_CHECK_HEADERS(netinet/in.h)
54 AC_CHECK_HEADERS(utmp.h)
55 AC_CHECK_HEADERS(utmpx.h)
58 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
59 AC_CHECK_HEADERS(ctype.h)
60 AC_CHECK_HEADERS(limits.h)
61 AC_CHECK_HEADERS(sys/quota.h)
62 AC_CHECK_HEADERS(xfs/xqm.h)
65 AC_CHECK_HEADERS(fs_info.h)
66 AC_CHECK_HEADERS(fshelp.h)
67 AC_CHECK_HEADERS(paths.h)
68 AC_CHECK_HEADERS(mntent.h)
69 AC_CHECK_HEADERS(mnttab.h)
70 AC_CHECK_HEADERS(sys/fstyp.h)
71 AC_CHECK_HEADERS(sys/fs_types.h)
72 AC_CHECK_HEADERS(sys/mntent.h)
73 AC_CHECK_HEADERS(sys/mnttab.h)
74 AC_CHECK_HEADERS(sys/mount.h)
75 AC_CHECK_HEADERS(sys/statfs.h)
76 AC_CHECK_HEADERS(sys/vfs.h)
77 AC_CHECK_HEADERS(sys/vfstab.h)
79 # For debugging interface (variable number of arguments)
80 AC_CHECK_HEADERS(stdarg.h)
82 dnl Checking for libraries
86 # Checks for typedefs, structures, and compiler characteristics.
94 # Checks for library functions.
96 AC_PROG_GCC_TRADITIONAL
97 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
98 AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
99 AC_CHECK_FUNCS(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
100 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
101 AC_CHECK_FUNCS(strncasecmp strcasecmp)
102 AC_CHECK_FUNCS(openlog syslog closelog)
105 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
108 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
111 AC_CHECK_FUNCS(getutent getutxent)
114 AC_CHECK_FUNCS(quotactl)
115 AC_CHECK_FUNCS(getgrgid getpwuid)
117 # For mount interface
118 AC_CHECK_FUNCS(getfsent getvfsent listmntent)
120 if test "x$ac_cv_func_getmntent" = 'xyes'; then
122 CFLAGS="-Wall -Werror $CFLAGS"
123 AC_CACHE_CHECK([whether getmntent takes one argument],
126 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
127 #include "$srcdir/src/utils_mount.h"]],
128 [[(void)getmntent((FILE *)NULL);]]
130 [fu_cv_getmntent1=yes],
131 [fu_cv_getmntent1=no]
134 if test "x$fu_cv_getmntent1" = 'xno'; then
135 AC_CACHE_CHECK([whether getmntent takes two arguments],
138 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
139 #include "$srcdir/src/utils_mount.h"]],
140 [[(void)getmntent((FILE *)NULL,
141 (struct mnttab *)NULL);]]
143 [fu_cv_getmntent2=yes],
144 [fu_cv_getmntent2=no]
150 if test "x$fu_cv_getmntent1" = 'xyes'; then
151 AC_DEFINE(HAVE_GETMNTENT1,
153 [Define if there is a function named getmntent
154 for reading the list of mounted filesystems, and
155 that function takes a single argument. (4.3BSD,
156 SunOS, HP-UX, Dynix, Irix, Linux)]
159 if test "x$fu_cv_getmntent2" = 'xyes'; then
160 AC_DEFINE(HAVE_GETMNTENT2,
162 [Define if there is a function named getmntent
163 for reading the list of mounted filesystems, and
164 that function takes two arguments. (SVR4)]
168 AC_MSG_CHECKING([for kernel type ($host_os)])
171 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
175 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
181 AC_MSG_RESULT([$ac_system])
183 dnl Checks for libraries.
184 AC_CHECK_LIB(socket, socket)
185 AC_CHECK_LIB(resolv, res_search)
187 m4_divert_once([HELP_WITH], [
188 collectd additional packages:])
190 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
191 AC_ARG_WITH(rrdtool, AS_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
192 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
194 LDFLAGS="$LDFLAGS -L$withval/lib"
195 CPPFLAGS="$CPPFLAGS -I$withval/include"
198 ], [with_rrdtool="yes"])
199 if test "x$with_rrdtool" = "xyes"
201 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
203 if test "x$with_rrdtool" = "xyes"
205 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
207 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
209 AC_ARG_WITH(pth, AS_HELP_STRING([--with-pth=PFX], [Path to pth (experimental).]),
210 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
212 LDFLAGS="$LDFLAGS -L$withval/lib"
213 CPPFLAGS="$CPPFLAGS -I$withval/include"
217 if test "x$with_pth" = "xyes"
219 AC_CHECK_LIB(pth, pth_init,, [with_pth="no"], [])
221 if test "x$with_pth" = "xyes"
223 AC_CHECK_HEADERS(pth.h,, [with_pth="no"])
225 if test "x$with_pth" = "xyes"
231 AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
232 [Wether or not to use pth (portable threads) library])
233 AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
235 if test "$ac_system" = "Solaris"
238 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
239 AC_CHECK_LIB(devinfo, di_init)
240 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
242 with_kstat="no (Solaris only)"
245 AC_ARG_WITH(libstatgrab, AS_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
248 if test "x$withval" != "xno"
250 if test "x$withval" != "xyes"
252 LDFLAGS="$LDFLAGS -L$withval/lib"
253 CPPFLAGS="$CPPFLAGS -I$withval/include"
254 with_libstatgrab="yes"
260 if test "x$ac_system" != "xunknown"
262 with_libstatgrab="no"
264 with_libstatgrab="yes"
267 if test "x$with_libstatgrab" = "xyes"
269 AC_CHECK_LIB(devstat, getdevs)
270 AC_CHECK_LIB(kvm, kvm_getargv)
271 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
272 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
275 AC_ARG_WITH(lm-sensors, AS_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
278 if test "x$withval" != "xno"
280 if test "x$withval" != "xyes"
282 LDFLAGS="$LDFLAGS -L$withval/lib"
283 CPPFLAGS="$CPPFLAGS -I$withval/include"
284 with_lm_sensors="yes"
290 if test "x$ac_system" = "xLinux"
292 with_lm_sensors="yes"
297 if test "x$with_lm_sensors" = "xyes"
299 AC_CHECK_LIB(sensors, sensors_init,
301 with_lm_sensors="yes"
302 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
304 [with_lm_sensors="no (not found)"])
305 AC_CHECK_HEADERS(sensors/sensors.h,
307 with_lm_sensors="yes"
308 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
310 [with_lm_sensors="no (not found)"])
316 # Check for enabled/disabled features
319 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
320 # ------------------------------------------------------------
322 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
327 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
332 m4_define([EnDis],[disabled])dnl
333 m4_define([YesNo],[no])dnl
339 m4_define([EnDis],[enabled])dnl
340 m4_define([YesNo],[yes])dnl
343 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
347 m4_if([$3], [feature], [],
351 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
357 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
359 enable_$1='[YesNo]'dnl
361 if test "x$enable_$1" = 'xno'
365 if test "x$enable_$1" = 'xyes'
369 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
374 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
375 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
377 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
381 m4_divert_once([HELP_ENABLE], [
383 AC_COLLECTD([debug], [enable], [feature], [debugging])
384 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
386 m4_divert_once([HELP_ENABLE], [
388 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
389 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
390 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
391 AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
392 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
393 AC_COLLECTD([load], [disable], [module], [system load statistics])
394 AC_COLLECTD([memory], [disable], [module], [memory statistics])
395 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
396 AC_COLLECTD([ping], [disable], [module], [ping statistics])
397 AC_COLLECTD([processes], [disable], [module], [processes statistics])
398 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
399 AC_COLLECTD([serial], [disable], [module], [serial statistics])
400 AC_COLLECTD([swap], [disable], [module], [swap statistics])
401 AC_COLLECTD([tape], [disable], [module], [tape statistics])
402 AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
403 AC_COLLECTD([users], [disable], [module], [user count statistics])
405 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
411 librrd . . . . . . $with_rrdtool
412 libpth . . . . . . $with_pth (experimental)
413 lm_sensors . . . . $with_lm_sensors
414 libstatgrab . . . . $with_libstatgrab
415 libkstat . . . . . $with_kstat
418 debug . . . . . . . $enable_debug
419 daemon mode . . . . $enable_daemon
422 cpu . . . . . LKC . $enable_cpu
423 cpufreq . . . L . $enable_cpufreq
424 disk . . . . LK . $enable_disk
425 quota . . . . A . $enable_quota (experimental)
426 hddtemp . . . A . $enable_hddtemp
427 load . . . . LGE . $enable_load
428 memory . . . LKG . $enable_memory
429 nfs . . . . . L . $enable_nfs
430 ping . . . . A . $enable_ping
431 processes . . L . $enable_processes
432 sensors . . . S . $enable_sensors
433 serial . . . L . $enable_serial
434 swap . . . . LKG . $enable_swap
435 tape . . . . K . $enable_tape
436 traffic . . . LKG . $enable_traffic
437 users . . . . A . $enable_users
440 K ... libkstat (Solaris)