summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-06-29 23:20:18 -0600
committerTavian Barnes <tavianator@gmail.com>2010-06-29 23:20:18 -0600
commitd21ccd4d088d3cacfdb8ca6e65c5d675773e92f8 (patch)
tree0029aa2b0c2f05c1fbb487c8e5be354914c972b3 /configure.ac
parent1874938c0d35990f95e494a7fef066bf97001d8f (diff)
downloaddimension-d21ccd4d088d3cacfdb8ca6e65c5d675773e92f8.tar.xz
Add some functionality checks to configure.ac for platform.c.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac57
1 files changed, 55 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index ced49a6..9ce9b2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,8 +68,61 @@ PKG_CHECK_MODULES([libsandglass], [libsandglass >= 0.2],
AC_SUBST(libsandglass_CFLAGS)
AC_SUBST(libsandglass_LIBS)
-dnl Ensure compilation in C99 mode
-AC_DEFINE([_XOPEN_SOURCE], [600])
+dnl Platform feature tests
+
+AC_MSG_CHECKING([for sched_getaffinity()])
+AC_LINK_IFELSE(
+ AC_LANG_PROGRAM(
+ [
+ #define _GNU_SOURCE
+ #include <sched.h>
+ ],
+ [
+ cpu_set_t cpuset;
+ sched_getaffinity(0, sizeof(cpuset), &cpuset);
+ ]
+ ),
+ [AC_DEFINE([DMNSN_SCHED_GETAFFINITY], [1])
+ AC_MSG_RESULT([yes])],
+ [AC_DEFINE([DMNSN_SCHED_GETAFFINITY], [0])
+ AC_MSG_RESULT([no])]
+)
+
+AC_MSG_CHECKING([for sysconf(_SC_NPROCESSORS_ONLN)])
+AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM(
+ [ #include <unistd.h> ],
+ [ sysconf(_SC_NPROCESSORS_ONLN); ]
+ ),
+ [AC_DEFINE([DMNSN_SC_NPROCESSORS_ONLN], [1])
+ AC_MSG_RESULT([yes])],
+ [AC_DEFINE([DMNSN_SC_NPROCESSORS_ONLN], [0])
+ AC_MSG_RESULT([no])]
+)
+
+AC_MSG_CHECKING([for backtrace()])
+AC_LINK_IFELSE(
+ AC_LANG_PROGRAM(
+ [ #include <execinfo.h> ],
+ [ backtrace(0, 0); ]
+ ),
+ [AC_DEFINE([DMNSN_BACKTRACE], [1])
+ AC_MSG_RESULT([yes])],
+ [AC_DEFINE([DMNSN_BACKTRACE], [0])
+ AC_MSG_RESULT([no])]
+)
+
+AC_MSG_CHECKING([for gettid()])
+AC_COMPILE_IFELSE(
+ AC_LANG_PROGRAM(
+ [ #include <sys/syscall.h> ],
+ [ syscall(SYS_gettid); ]
+ ),
+ [AC_DEFINE([DMNSN_GETTID], [1])
+ AC_MSG_RESULT([yes])],
+ [AC_DEFINE([DMNSN_GETTID], [0])
+ AC_MSG_RESULT([no])]
+)
dnl Generate Makefiles
AC_CONFIG_MACRO_DIR([m4])