dnl Process this file with autoconf to produce a configure script. AC_INIT(collectd, 4.0.9) AC_CONFIG_SRCDIR(src/collectd.c) AC_CONFIG_HEADERS(src/config.h) AM_INIT_AUTOMAKE(dist-bzip2) AC_LANG(C) AC_PREFIX_DEFAULT("/opt/collectd") AC_SYS_LARGEFILE # # Checks for programs. # AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes") dnl configure libtool AC_DISABLE_STATIC AC_LIBLTDL_CONVENIENCE AC_SUBST(LTDLINCL) AC_SUBST(LIBLTDL) AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL AC_PROG_LEX AC_PROG_YACC AC_CONFIG_SUBDIRS(libltdl) # # Checks for header files. # AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_DIRENT AC_CHECK_HEADERS(stdint.h) AC_CHECK_HEADERS(stdio.h) AC_CHECK_HEADERS(errno.h) AC_CHECK_HEADERS(math.h) AC_CHECK_HEADERS(syslog.h) AC_CHECK_HEADERS(fcntl.h) AC_CHECK_HEADERS(signal.h) AC_CHECK_HEADERS(assert.h) AC_CHECK_HEADERS(sys/types.h) AC_CHECK_HEADERS(sys/socket.h) AC_CHECK_HEADERS(sys/select.h) AC_CHECK_HEADERS(poll.h) AC_CHECK_HEADERS(netdb.h) AC_CHECK_HEADERS(arpa/inet.h) AC_CHECK_HEADERS(sys/resource.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(kstat.h) # For ping library AC_CHECK_HEADERS(netinet/in_systm.h, [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif ]) AC_CHECK_HEADERS(netinet/in.h, [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_NETINET_IN_SYSTM_H # include #endif ]) AC_CHECK_HEADERS(netinet/ip.h, [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_NETINET_IN_SYSTM_H # include #endif #if HAVE_NETINET_IN_H # include #endif ]) AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_NETINET_IN_SYSTM_H # include #endif #if HAVE_NETINET_IN_H # include #endif #if HAVE_NETINET_IP_H # include #endif ]) AC_CHECK_HEADERS(netinet/ip_var.h, [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_NETINET_IN_SYSTM_H # include #endif #if HAVE_NETINET_IN_H # include #endif #if HAVE_NETINET_IP_H # include #endif ]) AC_CHECK_HEADERS(netinet/ip6.h, [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_NETINET_IN_SYSTM_H # include #endif #if HAVE_NETINET_IN_H # include #endif ]) AC_CHECK_HEADERS(netinet/icmp6.h, [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_NETINET_IN_SYSTM_H # include #endif #if HAVE_NETINET_IN_H # include #endif #if HAVE_NETINET_IP6_H # include #endif ]) AC_CHECK_HEADERS(netinet/tcp.h, [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_NETINET_IN_SYSTM_H # include #endif #if HAVE_NETINET_IN_H # include #endif #if HAVE_NETINET_IP_H # include #endif ]) AC_CHECK_HEADERS(netinet/udp.h, [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_NETINET_IN_SYSTM_H # include #endif #if HAVE_NETINET_IN_H # include #endif #if HAVE_NETINET_IP_H # include #endif ]) # For cpu modules AC_CHECK_HEADERS(sys/sysctl.h, [], [], [ #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_PARAM_H # include #endif ]) AC_CHECK_HEADERS(sys/dkstat.h) AC_CHECK_HEADERS(mach/mach_init.h) AC_CHECK_HEADERS(mach/host_priv.h) AC_CHECK_HEADERS(mach/mach_error.h) AC_CHECK_HEADERS(mach/mach_host.h) AC_CHECK_HEADERS(mach/mach_port.h) AC_CHECK_HEADERS(mach/mach_types.h) AC_CHECK_HEADERS(mach/message.h) AC_CHECK_HEADERS(mach/processor_set.h) AC_CHECK_HEADERS(mach/processor.h) AC_CHECK_HEADERS(mach/processor_info.h) AC_CHECK_HEADERS(mach/task.h) AC_CHECK_HEADERS(mach/thread_act.h) AC_CHECK_HEADERS(mach/vm_region.h) AC_CHECK_HEADERS(mach/vm_map.h) AC_CHECK_HEADERS(mach/vm_prot.h) AC_CHECK_HEADERS(mach/vm_statistics.h) AC_CHECK_HEADERS(mach/kern_return.h) # For hddtemp module AC_CHECK_HEADERS(linux/major.h) AC_CHECK_HEADERS(libgen.h) # For the apple_sensors module AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h) AC_CHECK_HEADERS(IOKit/IOKitLib.h) AC_CHECK_HEADERS(IOKit/IOTypes.h) # For the battery plugin AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [], [ #if HAVE_IOKIT_IOKITLIB_H # include #endif #if HAVE_IOKIT_IOTYPES_H # include #endif ]) AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h) # For the `disk' plugin AC_CHECK_HEADERS(IOKit/IOBSD.h) AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h) # For load module AC_CHECK_HEADERS(sys/loadavg.h) # For the processes plugin AC_CHECK_HEADERS(linux/config.h) # For the swap module AC_CHECK_HEADERS(sys/swap.h, [], [], [ #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_PARAM_H # include #endif ]) # For users module AC_CHECK_HEADERS(utmp.h) AC_CHECK_HEADERS(utmpx.h) # For interface plugin AC_CHECK_HEADERS(ifaddrs.h) AC_CHECK_HEADERS(net/if.h, [], [], [ #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_SOCKET_H # include #endif ]) AC_CHECK_HEADERS(linux/if.h, [], [], [ #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_SOCKET_H # include #endif ]) AC_CHECK_HEADERS(linux/netdevice.h, [], [], [ #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_SOCKET_H # include #endif #if HAVE_LINUX_IF_H # include #endif ]) # For apache plugin AC_CHECK_HEADERS(curl/curl.h) # For quota module AC_CHECK_HEADERS(pwd.h) AC_CHECK_HEADERS(sys/ucred.h, [], [], [ #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_PARAM_H # include #endif ]) AC_CHECK_HEADERS(ctype.h) AC_CHECK_HEADERS(limits.h) AC_CHECK_HEADERS(sys/quota.h) AC_CHECK_HEADERS(xfs/xqm.h) # For mount interface AC_CHECK_HEADERS(fs_info.h) AC_CHECK_HEADERS(fshelp.h) AC_CHECK_HEADERS(paths.h) AC_CHECK_HEADERS(mntent.h) AC_CHECK_HEADERS(mnttab.h) AC_CHECK_HEADERS(sys/fstyp.h) AC_CHECK_HEADERS(sys/fs_types.h) AC_CHECK_HEADERS(sys/mntent.h) AC_CHECK_HEADERS(sys/mnttab.h) AC_CHECK_HEADERS(sys/mount.h, [], [], [ #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_PARAM_H # include #endif ]) AC_CHECK_HEADERS(sys/statfs.h) AC_CHECK_HEADERS(sys/statvfs.h) AC_CHECK_HEADERS(sys/vfs.h) AC_CHECK_HEADERS(sys/vfstab.h) # For the swap plugin, FreeBSD AC_CHECK_HEADERS(kvm.h) # For the email plugin AC_CHECK_HEADERS(linux/un.h, [], [], [ #if HAVE_SYS_SOCKET_H # include #endif ]) AC_CHECK_HEADERS(sys/un.h) AC_CHECK_HEADERS(grp.h) # For debugging interface (variable number of arguments) AC_CHECK_HEADERS(stdarg.h) # Regular expressions for the ignorelist. AC_CHECK_HEADERS(regex.h) # For the dns plugin AC_CHECK_HEADERS(arpa/nameser.h) AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [], [ #if HAVE_ARPA_NAMESER_H # include #endif ]) AC_CHECK_HEADERS(net/if_arp.h, [], [], [#if HAVE_SYS_SOCKET_H # include #endif ]) AC_CHECK_HEADERS(net/ppp_defs.h) AC_CHECK_HEADERS(net/if_ppp.h, [], [], [#if HAVE_NET_PPP_DEFS_H # include #endif ]) AC_CHECK_HEADERS(netinet/if_ether.h, [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_SOCKET_H # include #endif #if HAVE_NET_IF_H # include #endif #if HAVE_NETINET_IN_H # include #endif ]) # For the multimeter plugin AC_CHECK_HEADERS(termios.h) AC_CHECK_HEADERS(sys/ioctl.h) # # Checking for libraries # AC_CHECK_LIB(m, ext) # # Checks for typedefs, structures, and compiler characteristics. # AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UID_T AC_HEADER_TIME # # Checks for library functions. # AC_PROG_GCC_TRADITIONAL AC_CHECK_FUNCS(gettimeofday select strdup strtol) AC_CHECK_FUNCS(getaddrinfo getnameinfo) AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen) AC_CHECK_FUNCS(strncasecmp strcasecmp) AC_CHECK_FUNCS(openlog syslog closelog) AC_FUNC_STRERROR_R AC_CHECK_FUNCS(getpwnam_r) AC_CHECK_FUNCS(getgrnam_r) socket_needs_socket="no" AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket))) AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes") nanosleep_needs_rt="no" AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep))) AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes") # Regular expressions for the ignorelist. AC_CHECK_FUNCS(regcomp regerror regexec regfree) # For cpu module AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"]) # For df module AC_CHECK_FUNCS(statfs statvfs) # For load module AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"]) # For the `processes' plugin AC_CHECK_FUNCS(thread_info) # For users module AC_CHECK_FUNCS(getutent getutxent) # For interface module AC_CHECK_FUNCS(getifaddrs) # Check for NAN AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])], [ if test "x$withval" = "xno"; then nan_type="none" else if test "x$withval" = "xyes"; then nan_type="zero" else nan_type="$withval" fi; fi ], [nan_type="none"]) if test "x$nan_type" = "xnone"; then AC_CACHE_CHECK([whether NAN is defined by default], [have_nan_default], AC_COMPILE_IFELSE( AC_LANG_PROGRAM( [[ #include #include static float foo = NAN; ]], [[ if (isnan (foo)) return 0; else return 1; ]]), [have_nan_default="yes"], [have_nan_default="no"] ) ) if test "x$have_nan_default" = "xyes" then nan_type="default" fi fi if test "x$nan_type" = "xnone"; then AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99], [have_nan_isoc], AC_COMPILE_IFELSE( AC_LANG_PROGRAM( [[ #include #define __USE_ISOC99 1 #include static float foo = NAN; ]], [[ if (isnan (foo)) return 0; else return 1; ]]), [have_nan_isoc="yes"], [have_nan_isoc="no"] ) ) if test "x$have_nan_isoc" = "xyes" then nan_type="isoc99" fi fi if test "x$nan_type" = "xnone"; then AC_CACHE_CHECK([whether NAN can be defined by 0/0], [have_nan_zero], AC_RUN_IFELSE( AC_LANG_PROGRAM( [[ #include #include #ifdef NAN # undef NAN #endif #define NAN (0.0 / 0.0) #ifndef isnan # define isnan(f) ((f) != (f)) #endif static float foo = NAN; ]], [[ if (isnan (foo)) return 0; else return 1; ]]), [have_nan_zero="yes"], [have_nan_zero="no"] ) ) if test "x$have_nan_zero" = "xyes" then nan_type="zero" fi fi if test "x$nan_type" = "xdefault"; then AC_DEFINE(NAN_STATIC_DEFAULT, 1, [Define if NAN is defined by default and can initialize static variables.]) else if test "x$nan_type" = "xisoc99"; then AC_DEFINE(NAN_STATIC_ISOC, 1, [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.]) else if test "x$nan_type" = "xzero"; then AC_DEFINE(NAN_ZERO_ZERO, 1, [Define if NAN can be defined as (0.0 / 0.0)]) else AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.]) fi; fi; fi # For mount interface #AC_CHECK_FUNCS(getfsent getvfsent) have_getfsstat="no" AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"]) have_getvfsstat="no" AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"]) have_listmntent="no" AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"]) have_getmntent="no" AC_CHECK_FUNCS(getmntent, [have_getmntent="c"]) if test "x$have_getmntent" = "xno"; then AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"]) fi if test "x$have_getmntent" = "xno"; then AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"]) fi if test "x$have_getmntent" = "xno"; then AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"]) fi if test "x$have_getmntent" = "xc"; then AC_CACHE_CHECK([whether getmntent takes one argument], [have_one_getmntent], AC_COMPILE_IFELSE( AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT #include #include "$srcdir/src/utils_mount.h"]], [[ FILE *fh; struct mntent *me; fh = setmntent ("/etc/mtab", "r"); me = getmntent (fh); ]] ), [have_one_getmntent="yes"], [have_one_getmntent="no"] ) ) AC_CACHE_CHECK([whether getmntent takes two arguments], [have_two_getmntent], AC_COMPILE_IFELSE( AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT #include #include "$srcdir/src/utils_mount.h"]], [[ FILE *fh; struct mnttab mt; int status; fh = fopen ("/etc/mnttab", "r"); status = getmntent (fh, &mt); ]] ), [have_two_getmntent="yes"], [have_two_getmntent="no"] ) ) fi # Check for different versions of `getmntent' here.. if test "x$have_getmntent" = "xc"; then if test "x$have_one_getmntent" = "xyes"; then AC_DEFINE(HAVE_ONE_GETMNTENT, 1, [Define if the function getmntent exists and takes one argument.]) fi if test "x$have_two_getmntent" = "xyes"; then AC_DEFINE(HAVE_TWO_GETMNTENT, 1, [Define if the function getmntent exists and takes two arguments.]) fi fi if test "x$have_getmntent" = "xsun"; then AC_DEFINE(HAVE_SUN_GETMNTENT, 1, [Define if the function getmntent exists. It's the version from libsun.]) fi if test "x$have_getmntent" = "xseq"; then AC_DEFINE(HAVE_SEQ_GETMNTENT, 1, [Define if the function getmntent exists. It's the version from libseq.]) fi if test "x$have_getmntent" = "xgen"; then AC_DEFINE(HAVE_GEN_GETMNTENT, 1, [Define if the function getmntent exists. It's the version from libgen.]) fi # Check for structures AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors], [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])], [], [ #include #include #include ]) AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors], [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])], [], [ #include #include #include #include ]) AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_NETINET_IN_SYSTM_H # include #endif #if HAVE_NETINET_IN_H # include #endif #if HAVE_NETINET_IP_H # include #endif #if HAVE_NETINET_UDP_H # include #endif ]) AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [], [#if HAVE_STDINT_H # include #endif #if HAVE_SYS_TYPES_H # include #endif #if HAVE_NETINET_IN_SYSTM_H # include #endif #if HAVE_NETINET_IN_H # include #endif #if HAVE_NETINET_IP_H # include #endif #if HAVE_NETINET_UDP_H # include #endif ]) AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime], [], [], [ #if HAVE_KSTAT_H # include #endif ]) AC_MSG_CHECKING([for kernel type ($host_os)]) case $host_os in *linux*) AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel]) ac_system="Linux" ;; *solaris*) AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel]) ac_system="Solaris" ;; *) ac_system="unknown" esac AC_MSG_RESULT([$ac_system]) with_libresolv="yes" AC_CHECK_LIB(resolv, res_search, [ AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).]) ], [with_libresolv="no"]) AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes") m4_divert_once([HELP_WITH], [ collectd additional packages:]) # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given]) AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" then LDFLAGS="$LDFLAGS -L$withval/lib" CPPFLAGS="$CPPFLAGS -I$withval/include" with_rrdtool="yes" fi ], [with_rrdtool="yes"]) if test "x$with_rrdtool" = "xyes" then AC_CHECK_LIB(rrd, rrd_update, [ AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).]) ], [with_rrdtool="no (librrd not found)"], [-lm]) fi if test "x$with_rrdtool" = "xyes" then AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"]) fi if test "x$with_rrdtool" = "xyes" then collect_rrdtool=1 else collect_rrdtool=0 fi AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool], [Wether or not to use rrdtool library]) AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes") AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])], [ if test "x$withval" != "xno" -a "x$withval" != "xyes" then LDFLAGS="$LDFLAGS -L$withval/lib" CPPFLAGS="$CPPFLAGS -I$withval/include" with_libpthread="yes" else if test "x$withval" = "xno" then with_libpthread="no (disabled)" fi fi ], [with_libpthread="yes"]) if test "x$with_libpthread" = "xyes" then AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], []) fi if test "x$with_libpthread" = "xyes" then AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"]) fi if test "x$with_libpthread" = "xyes" then collect_pthread=1 else collect_pthread=0 fi AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread], [Wether or not to use pthread (POSIX threads) library]) AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes") if test "$ac_system" = "Solaris" then with_kstat="yes" with_devinfo="yes" else with_kstat="no (Solaris only)" with_devinfo="no (Solaris only)" fi if test "x$with_kstat" = "xyes" then AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], []) fi if test "x$with_kstat" = "xyes" then AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], []) AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"]) fi if test "x$with_kstat" = "xyes" then AC_DEFINE(HAVE_LIBKSTAT, 1, [Define to 1 if you have the 'kstat' library (-lkstat)]) fi AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes") AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes") ### BEGIN of check for libcurl ### with_curl_config="curl-config" with_curl_cflags="" with_curl_libs="" AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])], [ if test "x$withval" = "xno" then with_libcurl="no" else if test "x$withval" = "xyes" then with_libcurl="yes" else if test -x "$withval" then with_curl_config="$withval" else if test -x "$withval/bin/curl-config" then with_curl_config="$withval/bin/curl-config" fi; fi fi; fi ], [ with_libcurl="yes" ]) if test "x$with_libcurl" = "xyes" then with_curl_cflags=`$with_curl_config --cflags 2>/dev/null` curl_config_status=$? if test $curl_config_status -ne 0 then with_libcurl="no" else SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $with_curl_cflags" AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], []) CFLAGS="$SAVE_CFLAGS" fi fi if test "x$with_libcurl" = "xyes" then with_curl_libs=`$with_curl_config --libs 2>/dev/null` curl_config_status=$? if test $curl_config_status -ne 0 then with_libcurl="no" else AC_CHECK_LIB(curl, curl_easy_init, [ # We need to do this to have `HAVE_LIBCURL' defined but # `-lcurl' NOT added to the default LDFLAGS. AC_DEFINE(HAVE_LIBCURL, 1, [Define to 1 if you have the curl library.]) ], [with_libcurl="no (symbol 'curl_easy_init' not found)"], [$with_curl_libs]) fi fi if test "x$with_libcurl" = "xyes" then BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags" BUILD_WITH_LIBCURL_LIBS="$with_curl_libs" AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS) AC_SUBST(BUILD_WITH_LIBCURL_LIBS) fi AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes") ### END of check for libcurl ### with_libiokit="no" collectd_libiokit=0 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices, [ with_libiokit="yes" collectd_libiokit=1 ], [ with_libiokit="no" collectd_libiokit=0 ]) AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library]) AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes") with_libstatgrab="yes" with_libdevstat="no" AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])], [ if test "x$withval" != "xno" -a "x$withval" != "xyes" then LDFLAGS="$LDFLAGS -L$withval/lib" CPPFLAGS="$CPPFLAGS -I$withval/include" with_libstatgrab="yes" fi ], [ if test "x$ac_system" == "xunknown" then with_libstatgrab="yes" else with_libstatgrab="no" fi ]) if test "x$with_libstatgrab" = "xyes" then AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"]) fi if test "x$with_libstatgrab" = "xyes" then AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"]) fi if test "x$with_libstatgrab" = "xyes" then AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"]) fi if test "x$with_libstatgrab" = "xyes" then collect_libstatgrab=1 else collect_libstatgrab=0 fi AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab], [Wether or not to use statgrab library]) AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes") AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes") AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"]) if test "x$with_libkvm" = "xyes" then AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)]) fi AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes") AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" then LDFLAGS="$LDFLAGS -L$withval/lib" CPPFLAGS="$CPPFLAGS -I$withval/include" with_lm_sensors="yes" fi ], [ if test "x$ac_system" = "xLinux" then with_lm_sensors="yes" else with_lm_sensors="no" fi ]) if test "x$with_lm_sensors" = "xyes" then AC_CHECK_LIB(sensors, sensors_init, [ AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).]) ], [with_lm_sensors="no (libsensors not found)"]) fi if test "x$with_lm_sensors" = "xyes" then AC_CHECK_HEADERS(sensors/sensors.h, [ AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the header file.]) ], [with_lm_sensors="no (sensors/sensors.h not found)"]) fi if test "x$with_lm_sensors" = "xyes" then collect_lm_sensors=1 else collect_lm_sensors=0 fi AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors], [Wether or not to use sensors library]) AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes") with_mysql_config="mysql_config" with_mysql_cflags="" with_mysql_libs="" AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])], [ if test "x$withval" = "xno" then with_libmysql="no" else if test "x$withval" = "xyes" then with_libmysql="yes" else if test -x "$withval"; then with_mysql_config="$withval" else if test -x "$withval/bin/mysql_config" then with_mysql_config="$withval/bin/mysql_config" fi; fi fi; fi ], [ with_libmysql="yes" ]) if test "x$with_libmysql" = "xyes" then with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null` mysql_config_status=$? if test $mysql_config_status -ne 0 then with_libmysql="no" else SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $with_mysql_cflags" AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], []) CFLAGS="$SAVE_CFLAGS" fi fi if test "x$with_libmysql" = "xyes" then with_mysql_libs=`$with_mysql_config --libs 2>/dev/null` mysql_config_status=$? if test $mysql_config_status -ne 0 then with_libmysql="no" else AC_CHECK_LIB(mysqlclient, mysql_init, [ # We need to do this to have `HAVE_LIBMYSQLCLIENT' defined # but `-lmysqlclient' NOT added to the default LDFLAGS. AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library.]) ], [with_libmysql="no (libmysql not found)"], [$with_mysql_libs]) fi fi if test "x$with_libmysql" = "xyes" then BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags" BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs" AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS) AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS) fi AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes") with_own_liboconfig="no" liboconfig_LDFLAGS="$LDFLAGS" liboconfig_CPPFLAGS="$CPPFLAGS" AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" then if test -d "$withval/lib" then liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib" fi if test -d "$withval/include" then liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include" fi fi if test "x$withval" = "xno" then AC_MSG_ERROR("liboconfig is required") fi ], [ with_liboconfig="yes" ]) save_LDFLAGS="$LDFLAGS" save_CPPFLAGS="$CPPFLAGS" LDFLAGS="$liboconfig_LDFLAGS" CPPFLAGS="$liboconfig_CPPFLAGS" AC_CHECK_LIB(oconfig, oconfig_parse_fh, [ with_liboconfig="yes" with_own_liboconfig="no" ], [ with_liboconfig="yes" with_own_liboconfig="yes" LDFLAGS="$save_LDFLAGS" CPPFLAGS="$save_CPPFLAGS" ]) AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes") if test "x$with_own_liboconfig" = "xyes" then with_liboconfig="yes (shipped version)" fi #with_liboping="yes" with_own_liboping="no" liboping_LDFLAGS="$LDFLAGS" liboping_CPPFLAGS="$CPPFLAGS" AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" then if test -d "$withval/lib" then liboping_LDFLAGS="$LDFLAGS -L$withval/lib" fi if test -d "$withval/include" then liboping_CPPFLAGS="$CPPFLAGS -I$withval/include" fi fi if test "x$withval" = "xno" then with_liboping="no" with_own_liboping="no" fi ], [ #753 with_liboping="yes" ]) if test "x$with_liboping" = "xyes" then save_LDFLAGS="$LDFLAGS" save_CPPFLAGS="$CPPFLAGS" LDFLAGS="$liboping_LDFLAGS" CPPFLAGS="$liboping_CPPFLAGS" AC_CHECK_LIB(oping, ping_construct, [ with_liboping="yes" with_own_liboping="no" ], [ with_liboping="yes" with_own_liboping="yes" LDFLAGS="$save_LDFLAGS" CPPFLAGS="$save_CPPFLAGS" ]) fi AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes") AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes") if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes" then with_liboping="yes (shipped version)" fi AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" then LDFLAGS="$LDFLAGS -L$withval/lib" CPPFLAGS="$CPPFLAGS -I$withval/include" with_libpcap="yes" fi ], [ with_libpcap="yes" ]) if test "x$with_libpcap" = "xyes" then AC_CHECK_LIB(pcap, pcap_open_live, [ AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).]) ], [with_libpcap="no (libpcap not found)"]) fi if test "x$with_libpcap" = "xyes" then AC_CHECK_HEADERS(pcap.h, [ AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the header file.]) ], [with_libpcap="no (pcap.h not found)"]) fi if test "x$with_libpcap" = "xyes" then collect_libpcap=1 else collect_libpcap=0 fi AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap], [Wether or not to use the pcap library]) AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes") perl_interpreter="perl" AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" then LDFLAGS="$LDFLAGS -L$withval/lib" CPPFLAGS="$CPPFLAGS -I$withval/include" perl_interpreter="$withval/bin/perl" with_libperl="yes" fi ], [ with_libperl="yes" ]) if test "x$with_libperl" = "xyes" then SAVE_CFLAGS=$CFLAGS SAVE_LDFLAGS=$LDFLAGS PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts` PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts` CFLAGS="$CFLAGS $PERL_CFLAGS" LDFLAGS="$LDFLAGS $PERL_LDFLAGS" AC_CACHE_CHECK([for libperl], [have_libperl], AC_LINK_IFELSE( AC_LANG_PROGRAM( [[ #include #include #include ]], [[ PerlInterpreter *perl = NULL; Perl_load_module (perl, PERL_LOADMOD_NOIMPORT, newSVpv ("Collectd::Plugin::FooBar", 24), Nullsv); ]]), [have_libperl="yes"], [have_libperl="no"] ) ) if test "x$have_libperl" = "xyes" then AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.]) AC_SUBST(PERL_CFLAGS) AC_SUBST(PERL_LDFLAGS) else with_libperl="no" fi CFLAGS=$SAVE_CFLAGS LDFLAGS=$SAVE_LDFLAGS fi AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes") AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" then LDFLAGS="$LDFLAGS -L$withval/lib" CPPFLAGS="$CPPFLAGS -I$withval/include" with_libiptc="yes" fi ], [ if test "x$ac_system" = "xLinux" then with_libiptc="yes" else with_libiptc="no (Linux only)" fi ]) if test "x$with_libiptc" = "xyes" then AC_CHECK_LIB(iptc, iptc_init, [ AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).]) ], [with_libiptc="no (libiptc not found)"]) fi if test "x$with_libiptc" = "xyes" then AC_CHECK_HEADERS(libiptc/libiptc.h, [ AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the header file.]) ], [with_libiptc="no (libiptc/libiptc.h not found)"]) fi if test "x$with_libiptc" = "xyes" then collect_libiptc=1 else collect_libiptc=0 fi AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes") # TODO: Use `libupsclient-config' here. AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])], [ if test "x$withval" != "xno" && test "x$withval" != "xyes" then LDFLAGS="$LDFLAGS -L$withval/lib" CPPFLAGS="$CPPFLAGS -I$withval/include" with_libupsclient="yes" fi ], [ with_libupsclient="yes" ]) if test "x$with_libupsclient" = "xyes" then AC_CHECK_LIB(upsclient, upscli_connect, [ AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).]) ], [with_libupsclient="no (libupsclient not found)"]) fi if test "x$with_libupsclient" = "xyes" then AC_CHECK_HEADERS(upsclient.h, [ AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the header file.]) ], [with_libupsclient="no (upsclient.h not found)"]) fi if test "x$with_libupsclient" = "xyes" then AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [], [#include #include #include ]) fi AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes") # Check for enabled/disabled features # # AC_COLLECTD(name, enable/disable, info-text, feature/module) # ------------------------------------------------------------ dnl m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))]) dnl AC_DEFUN( [AC_COLLECTD], [ m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl m4_if( [$2], [enable], [dnl m4_define([EnDis],[disabled])dnl m4_define([YesNo],[no])dnl ],dnl [m4_if( [$2], [disable], [dnl m4_define([EnDis],[enabled])dnl m4_define([YesNo],[yes])dnl ], [dnl AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl ]dnl )]dnl )dnl m4_if([$3], [feature], [], [m4_if( [$3], [module], [], [dnl AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl ]dnl )]dnl )dnl AC_ARG_ENABLE( [$1], AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]), [], enable_$1='[YesNo]'dnl )# AC_ARG_ENABLE if test "x$enable_$1" = "xno" then collectd_$1=0 else if test "x$enable_$1" = "xyes" then collectd_$1=1 else AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.]) collectd_$1=1 enable_$1='yes' fi fi AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4]) AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl ]dnl )# AC_COLLECTD(name, enable/disable, info-text, feature/module) m4_divert_once([HELP_ENABLE], [ collectd features:]) AC_COLLECTD([debug], [enable], [feature], [debugging]) AC_COLLECTD([daemon], [disable], [feature], [daemon mode]) AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux]) m4_divert_once([HELP_ENABLE], [ collectd modules:]) AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics]) AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC]) AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors]) AC_COLLECTD([battery], [disable], [module], [battery statistics]) AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics]) AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics]) AC_COLLECTD([disk], [disable], [module], [disk/partition statistics]) AC_COLLECTD([csv], [disable], [module], [csv output plugin]) AC_COLLECTD([df], [disable], [module], [df statistics]) AC_COLLECTD([dns], [disable], [module], [dns statistics]) AC_COLLECTD([email], [disable], [module], [email statistics]) AC_COLLECTD([entropy], [disable], [module], [entropy statistics]) AC_COLLECTD([exec], [disable], [module], [exec of external programs]) AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics]) AC_COLLECTD([interface], [disable], [module], [interface statistics]) AC_COLLECTD([iptables], [disable], [module], [IPtables statistics]) AC_COLLECTD([irq], [disable], [module], [irq statistics]) AC_COLLECTD([load], [disable], [module], [system load statistics]) AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics]) AC_COLLECTD([memory], [disable], [module], [memory statistics]) AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics]) AC_COLLECTD([mysql], [disable], [module], [mysql statistics]) AC_COLLECTD([network], [disable], [module], [network functionality]) AC_COLLECTD([nfs], [disable], [module], [nfs statistics]) AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics]) AC_COLLECTD([nut], [disable], [module], [network UPS tools statistics]) AC_COLLECTD([perl], [disable], [module], [embedded perl interpreter]) AC_COLLECTD([ping], [disable], [module], [ping statistics]) AC_COLLECTD([processes], [disable], [module], [processes statistics]) AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics]) AC_COLLECTD([serial], [disable], [module], [serial statistics]) AC_COLLECTD([logfile], [disable], [module], [logfile log facility]) AC_COLLECTD([swap], [disable], [module], [swap statistics]) AC_COLLECTD([syslog], [disable], [module], [syslog log facility]) AC_COLLECTD([tape], [disable], [module], [tape statistics]) AC_COLLECTD([unixsock], [disable], [module], [UNIX socket plugin]) AC_COLLECTD([users], [disable], [module], [user count statistics]) AC_COLLECTD([vserver], [disable], [module], [vserver statistics]) AC_COLLECTD([wireless], [disable], [module], [wireless link statistics]) AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile) if test "x$with_libperl" = "xyes" then with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)" else enable_perl="no (needs libperl)" fi cat <