+
+AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source],
+ [],
+ [],
+ [[
+ #define _BSD_SOURCE
+ #define _DEFAULT_SOURCE
+ #include <stdint.h>
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #if HAVE_NETINET_IN_SYSTM_H
+ # include <netinet/in_systm.h>
+ #endif
+ #if HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ #if HAVE_NETINET_IP_H
+ # include <netinet/ip.h>
+ #endif
+ #if HAVE_NETINET_UDP_H
+ # include <netinet/udp.h>
+ #endif
+ ]]
+)
+
+AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
+ [],
+ [],
+ [[# include <kstat.h>]]
+)
+
+# check for pthread_setname_np
+SAVE_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -lpthread"
+
+AC_MSG_CHECKING([for pthread_setname_np])
+have_pthread_setname_np="no"
+AC_LINK_IFELSE(
+ [
+ AC_LANG_PROGRAM(
+ [[
+ #define _GNU_SOURCE
+ #include <pthread.h>
+ ]],
+ [[pthread_setname_np((pthread_t) {0}, "conftest");]]
+ )
+ ],
+ [
+ have_pthread_setname_np="yes"
+ AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [pthread_setname_np() is available.])
+ ]
+)
+
+AC_MSG_RESULT([$have_pthread_setname_np])
+
+# check for pthread_set_name_np(3) (FreeBSD)
+AC_MSG_CHECKING([for pthread_set_name_np])
+have_pthread_set_name_np="no"
+AC_LINK_IFELSE(
+ [
+ AC_LANG_PROGRAM(
+ [[#include <pthread_np.h>]],
+ [[pthread_set_name_np((pthread_t) {0}, "conftest");]]
+ )
+ ],
+ [
+ have_pthread_set_name_np="yes"
+ AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [pthread_set_name_np() is available.])
+ ]
+)
+AC_MSG_RESULT([$have_pthread_set_name_np])
+
+LDFLAGS="$SAVE_LDFLAGS"
+
+AC_CHECK_TYPES([struct ip6_ext],
+ [have_ip6_ext="yes"],
+ [have_ip6_ext="no"],
+ [[
+ #include <stdint.h>
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #if HAVE_NETINET_IN_SYSTM_H
+ # include <netinet/in_systm.h>
+ #endif
+ #if HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ #if HAVE_NETINET_IP6_H
+ # include <netinet/ip6.h>
+ #endif
+ ]]
+)
+
+if test "x$have_ip6_ext" = "xno"; then
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -DSOLARIS2=8"
+ AC_CHECK_TYPES([struct ip6_ext],
+ [have_ip6_ext="yes, with -DSOLARIS2=8"],
+ [have_ip6_ext="no"],
+ [[
+ #include <stdint.h>
+ #if HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #if HAVE_NETINET_IN_SYSTM_H
+ # include <netinet/in_systm.h>
+ #endif
+ #if HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ #if HAVE_NETINET_IP6_H
+ # include <netinet/ip6.h>
+ #endif
+ ]]
+ )
+ if test "x$have_ip6_ext" = "xno"; then
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+fi
+
+# libi2c-dev
+if test "x$ac_system" = "xLinux"; then
+ AC_CHECK_DECL([i2c_smbus_read_i2c_block_data],
+ [with_libi2c="yes"],
+ [with_libi2c="no (symbol i2c_smbus_read_i2c_block_data not found - have you installed libi2c-dev ?)"],
+ [[
+ #include <stdlib.h>
+ #include <linux/i2c-dev.h>
+ ]]
+ )
+else
+ with_libi2c="no (Linux only)"
+fi
+
+#
+# Checks for libraries begin here
+#
+
+# Check for libpthread
+SAVE_LIBS="$LIBS"
+AC_CHECK_LIB([pthread],
+ [pthread_create],
+ [],
+ [AC_MSG_ERROR([Symbol 'pthread_create' not found in libpthread])],
+ []
+)
+PTHREAD_LIBS="$LIBS"