[PATCH] check kernel headers for thread library

Ian Wienand ianw@gelato.unsw.edu.au
Fri Mar 14 00:05:00 GMT 2003


Hello,

NPTL requires recent kernel versions to work properly.  Without
checking the headers stupid people like me might occasionally forget
the --with-headers flag and get silly errors like _exit not using
exit_group & then wondering why their threads don't exit.

suggested patch attached.

btw. why through this file does AC_EGREP_CPP use 'eat flaming death'
rather than something like 'yes'?

-i
ianw@gelato.unsw.edu.au
http://www.gelato.unsw.edu.au

2003-03-14  Ian Wienand <ianw@gelato.unsw.edu.au>
 
	* sysdeps/unix/sysv/linux/configure.in : add ability for
	threading library to check kernel version.
	Make NPTL require at least 2.5.52

-------------- next part --------------
--- sysdeps/unix/sysv/linux/configure.in.orig	2003-03-14 10:48:06.000000000 +1100
+++ sysdeps/unix/sysv/linux/configure.in	2003-03-14 10:48:16.000000000 +1100
@@ -146,9 +146,6 @@
   libc_cv_gcc_unwind_find_fde=no
 fi
 
-if test -n "$sysheaders"; then
-  CPPFLAGS=$OLD_CPPFLAGS
-fi
 # The Linux filesystem standard prescribes where to place "essential"
 # files.  I.e., when the installation prefix is "/usr" we have to place
 # shared library objects and the configuration files on the root partition
@@ -193,6 +190,8 @@
     ;;
   *nptl*)
     linuxthreads_missing=
+    threads_minimum_kernel=2.5.52
+    threads_lib_name=NPTL
     ;;
   *)
     linuxthreads_missing=yes
@@ -231,6 +230,26 @@
   fi
 fi
 
+#NPTL especially has some kernel version requirements.
+if test -n "$threads_minimum_kernel"; then
+  AC_MSG_CHECKING(kernel headers at least $threads_minimum_kernel for $threads_lib_name)
+changequote(,)dnl
+  decnum=`echo "$threads_minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
+changequote([,])dnl
+  AC_EGREP_CPP([eat flaming death], [#include <linux/version.h>
+#if LINUX_VERSION_CODE < $decnum
+eat flaming death
+#endif], thread_minimum_kernel='too old!', thread_minimum_kernel=ok)
+  AC_MSG_RESULT($thread_minimum_kernel)
+  if test "$thread_minimum_kernel" = 'too old!'; then
+    AC_MSG_ERROR([*** $threads_lib_name requires kernel headers at least $threads_minimum_kernel])
+  fi
+fi
+
+#reset cpp flags
+if test -n "$sysheaders"; then
+  CPPFLAGS=$OLD_CPPFLAGS
+fi
 
 # One Linux we use ldconfig.
 use_ldconfig=yes


More information about the Libc-alpha mailing list