diff options
author | Roland McGrath <roland@redhat.com> | 2010-08-24 11:55:53 -0700 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 2010-08-24 11:56:52 -0700 |
commit | 090555538d4347a52807ba9f08cf20ed13206afe (patch) | |
tree | e8ddcd0e24e9c8efe85342caae73c3ba934e6ec0 /scripts | |
parent | f2ac4868b7b69c32c4de9895b4a1e22b91cc6aa8 (diff) | |
download | glibc-090555538d4347a52807ba9f08cf20ed13206afe.tar.gz |
Rejigger header generation for default uname implementation.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/config-uname.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/scripts/config-uname.sh b/scripts/config-uname.sh new file mode 100755 index 0000000000..cf32ca53bf --- /dev/null +++ b/scripts/config-uname.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +config_os=$1 +config_release=$2 +uname_machine=$3 + +uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'` +if test $uname_sysname != $config_os; then + config_release=`echo $config_os | sed s/$uname_sysname//` +fi + +if test -r /vmunix; then + kernel_id=`strings /vmunix | grep UNIX` +elif test -r /dynix; then + kernel_id=`strings /dynix | grep DYNIX` +else + kernel_id= +fi + +kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'` +if test x`echo "$config_release" | sed "s/^$kernel_release//"` \ + != x$config_release; then + # The configuration release is a substring of the kernel release. + uname_release=$kernel_release +elif test x$config_release != x; then + uname_release=$config_release +elif test x$kernel_release != x; then + uname_release=$kernel_release +else + uname_release=unknown +fi + +kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'` +if test -n "$kernel_version"; then + uname_version="$kernel_version" +else + uname_version=unknown +fi + +cat <<EOF +/* This file is generated by $0. DO NOT EDIT. + + This is used only by the generic uname function for systems with no real + uname call. If this data is not correct, it does not matter much. */ + +#define UNAME_SYSNAME "$uname_sysname" +#define UNAME_RELEASE "$uname_release" +#define UNAME_VERSION "$uname_version" +#define UNAME_MACHINE "$uname_machine" +EOF |