From 16c1804e696304140e54108ddd2889cf7b54b768 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 4 Apr 2010 01:02:09 -0700 Subject: Fix retrieving of kernel header version. (cherry picked from commit 9e37946dba22b53c5108eef777e867f93c894502) --- csu/Makefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'csu') diff --git a/csu/Makefile b/csu/Makefile index 0e2ae07cf7..69e07c71cf 100644 --- a/csu/Makefile +++ b/csu/Makefile @@ -1,5 +1,5 @@ # Makefile for csu code for GNU C library. -# Copyright (C) 1995-2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 1995-2004, 2005, 2006, 2010 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -209,8 +209,19 @@ $(objpfx)version-info.h: $(common-objpfx)config.make $(all-Banner-files) linux*) version=`(printf '%s\n%s\n' \ '#include ' \ UTS_RELEASE \ - | $(CC) $(CPPFLAGS) -E -P - -DNOT_IN_libc=1 | \ + | $(CC) $(CPPFLAGS) -O -E -P - -DNOT_IN_libc=1 | \ sed -e 's/"\([^"]*\)".*/\1/p' -e d) 2>/dev/null`;\ + if [ -z "$$version" ]; then \ + version=`(printf '%s\n%s\n' \ + '#include ' \ + LINUX_VERSION_CODE \ + | $(CC) $(CPPFLAGS) -O -E -P - -DNOT_IN_libc=1 \ + | sed -n -e '/^[123456789].*/p' \ + | awk '{v=$$1; \ + printf("%d.%d.%d\n", \ + v/65535, v/256%256, v%256)}') \ + 2>/dev/null`; \ + fi; \ if [ -z "$$version" ]; then \ if [ -r /proc/version ]; then \ version=`sed 's/.*Linux version \([^ ]*\) .*/>>\1<