diff options
author | Roland McGrath <roland@hack.frob.com> | 2014-07-03 20:35:42 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2014-07-03 20:35:42 -0700 |
commit | c1f5acd4f49a390ba536af0104835be37cba19ca (patch) | |
tree | 11c494a920f347dab703da56fad175293d65d323 | |
parent | 4d614fe5e0625f197805978730214e5236ef360c (diff) | |
download | glibc-c1f5acd4f49a390ba536af0104835be37cba19ca.tar.gz |
Robustify Linux kernel headers configure checks
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/configure | 169 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/configure.ac | 16 |
3 files changed, 37 insertions, 153 deletions
@@ -1,5 +1,10 @@ 2014-07-03 Roland McGrath <roland@hack.frob.com> + * sysdeps/unix/sysv/linux/configure.ac: Use AC_TRY_COMPILE rather than + AC_EGREP_CPP for kernel header checks, so they only succeed if + including <linux/version.h> actually works right. + * sysdeps/unix/sysv/linux/configure: Regenerated. + * sysdeps/s390/nptl/tls.h (THREAD_SET_POINTER_GUARD): Refer to the value so it's not diagnosed as unused. diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure index 57fda6c32d..e8f83fbd12 100644 --- a/sysdeps/unix/sysv/linux/configure +++ b/sysdeps/unix/sysv/linux/configure @@ -37,137 +37,6 @@ if test -n "$sysheaders"; then CPPFLAGS="$CPPFLAGS $SYSINCLUDES" fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking installed Linux kernel header files" >&5 $as_echo_n "checking installed Linux kernel header files... " >&6; } if ${libc_cv_linux2632+:} false; then : @@ -177,17 +46,22 @@ else /* end confdefs.h. */ #include <linux/version.h> #if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < (2 *65536+ 6 *256+ 32) /* 2.6.32 */ -eat flaming death +# error kernel headers missing or too old #endif +int +main () +{ + + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "eat flaming death" >/dev/null 2>&1; then : - libc_cv_linux2632='TOO OLD!' -else +if ac_fn_c_try_compile "$LINENO"; then : libc_cv_linux2632='2.6.32 or later' +else + libc_cv_linux2632='missing or too old!' fi -rm -f conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_linux2632" >&5 $as_echo "$libc_cv_linux2632" >&6; } @@ -231,17 +105,22 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <linux/version.h> #if LINUX_VERSION_CODE < $decnum -eat flaming death +# error kernel headers too old #endif +int +main () +{ + + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "eat flaming death" >/dev/null 2>&1; then : - libc_minimum_kernel='too old!' -else +if ac_fn_c_try_compile "$LINENO"; then : libc_minimum_kernel=ok +else + libc_minimum_kernel='too old!' fi -rm -f conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_minimum_kernel" >&5 $as_echo "$libc_minimum_kernel" >&6; } if test "$libc_minimum_kernel" = ok; then diff --git a/sysdeps/unix/sysv/linux/configure.ac b/sysdeps/unix/sysv/linux/configure.ac index e172ffe379..9b09b3fdd3 100644 --- a/sysdeps/unix/sysv/linux/configure.ac +++ b/sysdeps/unix/sysv/linux/configure.ac @@ -8,14 +8,14 @@ if test -n "$sysheaders"; then fi define([libc_cv_linuxVER], [libc_cv_linux]patsubst(LIBC_LINUX_VERSION,[\.]))dnl AC_CACHE_CHECK(installed Linux kernel header files, libc_cv_linuxVER, [dnl -AC_EGREP_CPP([eat flaming death], [#include <linux/version.h> +AC_TRY_COMPILE([#include <linux/version.h> #if !defined LINUX_VERSION_CODE || LINUX_VERSION_CODE < ]dnl patsubst(LIBC_LINUX_VERSION,[^\([^.]*\)\.\([^.]*\)\.\([^.]*\)$],dnl [ (\1 *65536+ \2 *256+ \3) /* \1.\2.\3 */])[ -eat flaming death -#endif], - libc_cv_linuxVER='TOO OLD!', - libc_cv_linuxVER='LIBC_LINUX_VERSION or later')]) +# error kernel headers missing or too old +#endif], [], + [libc_cv_linuxVER='LIBC_LINUX_VERSION or later'], + [libc_cv_linuxVER='missing or too old!'])]) if test "$libc_cv_linuxVER" != 'LIBC_LINUX_VERSION or later'; then AC_MSG_ERROR([GNU libc requires kernel header files from Linux LIBC_LINUX_VERSION or later to be installed before configuring. @@ -52,10 +52,10 @@ changequote(,)dnl decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`; abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`; changequote([,])dnl -AC_EGREP_CPP([eat flaming death], [#include <linux/version.h> +AC_TRY_COMPILE([#include <linux/version.h> #if LINUX_VERSION_CODE < $decnum -eat flaming death -#endif], libc_minimum_kernel='too old!', libc_minimum_kernel=ok) +# error kernel headers too old +#endif], [], [libc_minimum_kernel=ok], [libc_minimum_kernel='too old!']) AC_MSG_RESULT($libc_minimum_kernel) if test "$libc_minimum_kernel" = ok; then AC_DEFINE_UNQUOTED(__LINUX_KERNEL_VERSION, $decnum) |