This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2 v3] tst-fanotify: new simple test


On Thursday 05 September 2013 05:54:53 Andreas Schwab wrote:
> Mike Frysinger <vapier@gentoo.org> writes:
> > +# Until we start requiring 2.6.37+ headers, we need to check for the
> > +# availability of linux/fanotify.h for testing purposes.
> > +AC_CHECK_HEADER(linux/fanotify.h, [dnl
> > +  DEFINES="$DEFINES -DHAVE_LINUX_FANOTIFY_H=1"])
> 
> Please suppress the addition of the default includes.

ah yeah, that's much nicer
-mike

diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index e55d9fd..597720e 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -102,6 +102,12 @@ else
 *** compatible kernel version])
 fi
 
+# Until we start requiring 2.6.37+ headers, we need to check for the
+# availability of linux/fanotify.h for testing purposes.
+AC_CHECK_HEADER(linux/fanotify.h,
+  [DEFINES="$DEFINES -DHAVE_LINUX_FANOTIFY_H=1"], ,
+  [/* No default includes.  */])
+
 # The result of the above test for the use of the FDE code is invalid if
 # the user overrides the decision about the minimum ABI.
 if test "$oldest_abi" != default && test "2.2.4" \< "$oldest_abi"; then
diff --git a/sysdeps/unix/sysv/linux/tst-fanotify.c b/sysdeps/unix/sysv/linux/tst-fanotify.c
index b21e160..17f3f6d 100644
--- a/sysdeps/unix/sysv/linux/tst-fanotify.c
+++ b/sysdeps/unix/sysv/linux/tst-fanotify.c
@@ -19,6 +19,18 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+
+#ifndef HAVE_LINUX_FANOTIFY_H
+
+static int
+do_test (void)
+{
+  puts ("SKIP: missing support for fanotify due to old kernel headers");
+  return 0;
+}
+
+#else
+
 #include <sys/fanotify.h>
 
 static int
@@ -55,5 +67,7 @@ do_test (void)
   return 0;
 }
 
+#endif
+
 #define TEST_FUNCTION do_test ()
 #include "../test-skeleton.c"
diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
index 76cfea1..81c7dd8 100644
--- a/sysdeps/unix/sysv/linux/configure
+++ b/sysdeps/unix/sysv/linux/configure
@@ -1,3 +1,34 @@
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
  # Local configure fragment for sysdeps/unix/sysv/linux.
 
@@ -264,6 +295,16 @@ else
 *** compatible kernel version" "$LINENO" 5
 fi
 
+# Until we start requiring 2.6.37+ headers, we need to check for the
+# availability of linux/fanotify.h for testing purposes.
+ac_fn_c_check_header_compile "$LINENO" "linux/fanotify.h" "ac_cv_header_linux_fanotify_h" "/* No default includes.  */
+"
+if test "x$ac_cv_header_linux_fanotify_h" = xyes; then :
+  DEFINES="$DEFINES -DHAVE_LINUX_FANOTIFY_H=1"
+fi
+
+
+
 # The result of the above test for the use of the FDE code is invalid if
 # the user overrides the decision about the minimum ABI.
 if test "$oldest_abi" != default && test "2.2.4" \< "$oldest_abi"; then

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]