#
AC_PROG_GCC_TRADITIONAL
AC_CHECK_FUNCS(gettimeofday select strdup strtol)
-AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
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)
+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")
esac
AC_MSG_RESULT([$ac_system])
-with_libsocket="yes"
-AC_CHECK_LIB(socket, socket,
-[
- AC_DEFINE(HAVE_LIBSOCKET, 1, [Define to 1 if you have the 'socket' library (-lsocket).])
-],
-[with_libsocket="no"])
-AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$with_libsocket" = "xyes")
-
with_libresolv="yes"
AC_CHECK_LIB(resolv, res_search,
[
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="no (libkstat not found)"])
+ 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)
+ 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"
fi
AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
[Wether or not to use kstat library (Solaris)])
-AM_CONDITIONAL(BUILD_WITH_KSTAT, test "x$with_kstat" = "xyes")
+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"
if BUILD_WITH_LIBRESOLV
collectd_LDFLAGS += -lresolv
endif
+if BUILD_WITH_LIBKSTAT
+collectd_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+collectd_LDFLAGS += -ldevinfo
+endif
collectd_LDADD = $(LIBLTDL) libconfig/libconfig.la "-dlopen" self
collectd_DEPENDENCIES = $(LIBLTDL) libconfig/libconfig.la
pkglib_LTLIBRARIES += cpu.la
cpu_la_SOURCES = cpu.c
cpu_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+cpu_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+cpu_la_LDFLAGS += -ldevinfo
+endif
collectd_LDADD += "-dlopen" cpu.la
collectd_DEPENDENCIES += cpu.la
endif
pkglib_LTLIBRARIES += disk.la
disk_la_SOURCES = disk.c
disk_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+disk_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+disk_la_LDFLAGS += -ldevinfo
+endif
if BUILD_WITH_LIBIOKIT
disk_la_LDFLAGS += -lIOKit
endif
pkglib_LTLIBRARIES += hddtemp.la
hddtemp_la_SOURCES = hddtemp.c
hddtemp_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBSOCKET
+hddtemp_la_LDFLAGS += -lsocket
+endif
collectd_LDADD += "-dlopen" hddtemp.la
collectd_DEPENDENCIES += hddtemp.la
endif
pkglib_LTLIBRARIES += memory.la
memory_la_SOURCES = memory.c
memory_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+memory_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+memory_la_LDFLAGS += -ldevinfo
+endif
collectd_LDADD += "-dlopen" memory.la
collectd_DEPENDENCIES += memory.la
endif
pkglib_LTLIBRARIES += swap.la
swap_la_SOURCES = swap.c
swap_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+swap_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+swap_la_LDFLAGS += -ldevinfo
+endif
collectd_LDADD += "-dlopen" swap.la
collectd_DEPENDENCIES += swap.la
endif
pkglib_LTLIBRARIES += tape.la
tape_la_SOURCES = tape.c
tape_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+tape_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+tape_la_LDFLAGS += -ldevinfo
+endif
collectd_LDADD += "-dlopen" tape.la
collectd_DEPENDENCIES += tape.la
endif
pkglib_LTLIBRARIES += traffic.la
traffic_la_SOURCES = traffic.c
traffic_la_LDFLAGS = -module -avoid-version
+if BUILD_WITH_LIBKSTAT
+traffic_la_LDFLAGS += -lkstat
+endif
+if BUILD_WITH_LIBDEVINFO
+traffic_la_LDFLAGS += -ldevinfo
+endif
collectd_LDADD += "-dlopen" traffic.la
collectd_DEPENDENCIES += traffic.la
endif