AC_DEFUN([AC_DEFINE_DIR], [
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
- ac_define_dir=`eval echo [$]$2`
- ac_define_dir=`eval echo [$]ac_define_dir`
+ last_ac_define_dir=`eval echo [$]$2`
+ ac_define_dir=`eval echo [$]last_ac_define_dir`
+ ac_define_dir_counter=0
+ while test "x[$]last_ac_define_dir" != "x[$]ac_define_dir"; do
+ last_ac_define_dir="[$]ac_define_dir"
+ ac_define_dir=`eval echo [$]last_ac_define_dir`
+ AS_VAR_ARITH([ac_define_dir_counter], [$ac_define_dir_counter + 1])
+ AS_VAR_IF([ac_define_dir_counter], [128],
+ [AC_MSG_ERROR([detected recusive directory expansion when expanding $1=[$]$2: [$]ac_define_dir])
+ break])
+ done
$1="$ac_define_dir"
AC_SUBST($1)
ifelse($3, ,
])
-# RB_TYPE_INTMAX_T
-# -----------------
-AC_DEFUN([RB_TYPE_INTMAX_T],
-[
- AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
- AC_CHECK_TYPE([intmax_t],
- [AC_DEFINE([HAVE_INTMAX_T], 1,
- [Define to 1 if the system has the type `intmax_t'.]) ac_cv_c_intmax_t=yes],
- [test $ac_cv_type_long_long_int = yes \
- && ac_type='long long int' \
- || ac_type='long int'
- AC_DEFINE_UNQUOTED([intmax_t], [$ac_type],
- [Define to the widest signed integer type
- if <stdint.h> and <inttypes.h> do not define.]) ac_cv_c_intmax_t="$ac_type"])
-])
-
-
-# RB_TYPE_UINTMAX_T
-# -----------------
-AC_DEFUN([RB_TYPE_UINTMAX_T],
-[
- AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
- AC_CHECK_TYPE([uintmax_t],
- [AC_DEFINE([HAVE_UINTMAX_T], 1,
- [Define to 1 if the system has the type `uintmax_t'.]) ac_cv_c_uintmax_t=yes],
- [test $ac_cv_type_unsigned_long_long_int = yes \
- && ac_type='unsigned long long int' \
- || ac_type='unsigned long int'
- AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type],
- [Define to the widest unsigned integer type
- if <stdint.h> and <inttypes.h> do not define.]) ac_cv_c_uintmax_t="$ac_type"])
-])
-
-
-# RB_TYPE_INTPTR_T
-# -----------------
-AC_DEFUN([RB_TYPE_INTPTR_T],
-[
- AC_CHECK_TYPE([intptr_t],
- [AC_DEFINE([HAVE_INTPTR_T], 1,
- [Define to 1 if the system has the type `intptr_t'.]) ac_cv_c_intptr_t=yes],
- [for ac_type in 'int' 'long int' 'long long int'; do
- AC_COMPILE_IFELSE(
- [AC_LANG_BOOL_COMPILE_TRY(
- [AC_INCLUDES_DEFAULT],
- [[sizeof (void *) <= sizeof ($ac_type)]])],
- [AC_DEFINE_UNQUOTED([intptr_t], [$ac_type],
- [Define to the type of a signed integer type wide enough to
- hold a pointer, if such a type exists, and if the system
- does not define it.]) ac_cv_c_intptr_t="$ac_type"
- ac_type=])
- test -z "$ac_type" && break
- done])
-])
-
-
-# RB_TYPE_UINTPTR_T
-# -----------------
-AC_DEFUN([RB_TYPE_UINTPTR_T],
-[
- AC_CHECK_TYPE([uintptr_t],
- [AC_DEFINE([HAVE_UINTPTR_T], 1,
- [Define to 1 if the system has the type `uintptr_t'.]) ac_cv_c_uintptr_t=yes],
- [for ac_type in 'unsigned int' 'unsigned long int' \
- 'unsigned long long int'; do
- AC_COMPILE_IFELSE(
- [AC_LANG_BOOL_COMPILE_TRY(
- [AC_INCLUDES_DEFAULT],
- [[sizeof (void *) <= sizeof ($ac_type)]])],
- [AC_DEFINE_UNQUOTED([uintptr_t], [$ac_type],
- [Define to the type of an unsigned integer type wide enough to
- hold a pointer, if such a type exists, and if the system
- does not define it.]) ac_cv_c_uintptr_t="$ac_type"
- ac_type=])
- test -z "$ac_type" && break
- done])
-])
-
dnl IPv6 support macros..pretty much swiped from wget
dnl RB_PROTO_INET6
esac
])
+
+
+AC_DEFUN([RB_CHECK_TIMERFD_CREATE],
+ [AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)],
+ [rb__cv_timerfd_create_works],
+ [AC_TRY_RUN([
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TIMERFD_H
+#include <sys/timerfd.h>
+#endif
+int main(int argc, char *argv[])
+{
+#if defined(HAVE_TIMERFD_CREATE) && defined(HAVE_SYS_TIMERFD_H)
+ if (timerfd_create(CLOCK_REALTIME, 0) < 0) {
+ return 1;
+ }
+#else
+ return 1;
+#endif
+ return 0;
+}
+ ],
+ [rb__cv_timerfd_create_works=yes],
+ [rb__cv_timerfd_create_works=no])
+ ])
+case $rb__cv_timerfd_create_works in
+ yes) AC_DEFINE([USE_TIMERFD_CREATE], 1,
+ [Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...)]);;
+esac
+])
+