Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / config / linux-version
CommitLineData
805e021f
CE
1#!/bin/sh
2# Copyright 2000, International Business Machines Corporation and others.
3# All Rights Reserved.
4#
5# This software has been released under the terms of the IBM Public
6# License. For details, see the LICENSE file in the top-level source
7# directory or online at http://www.openafs.org/dl/license10.html
8
9# Verify that this build machine has the required header files for the
10# kernel versions specified in LINUX_VERS.
11#
12# The following critical variables are passed in from ./Makefile:
13#
14# LINUX_SRCDIR="/usr/src/linux-"
15# LINUX_VERS="2.2.5-15 2.2.10 2.2.12 2.2.12-20 2.2.13 2.2.14"
16#
17# To add support for a new Linux kernel rev, msut therefore add it to
18# $LINUX_VERS in ./Makefile and create $LINUX_SRCDIR$VERS, populating
19# the latter with header files including a version of the include file
20# $LINUX_SRCDIR$VERS/include/linux/version.h containing the appropriate
21# UTS_RELEASE definition.
22#
23
24# The following two tests are done so that "make install" can be executed
25# directly from the config directory.
26if [ -z "$LINUX_VERS" ]; then
27 echo LINUX_VERS is not set. Not testing header links for kernel build.
28 exit 0
29fi
30
31if [ -z "$LINUX_SRCDIR" ]; then
32 echo "LINUX_SRCDIR is not set. Not testing header links for kernel build."
33 exit 0
34fi
35
36errors="false"
37found_one="false"
38CAN_BUILD=""
39
40for VERS in $LINUX_VERS ; do
41 dir=$LINUX_SRCDIR$VERS
42 if [ ! -d $dir ] ; then
43 dir=$LINUX_SRCDIR
44 if [ ! -d $dir ] ; then
45 echo "ERROR: Cannot build for Linux kernel $VERS: $dir does not exist."
46 errors=true
47 continue
48 fi
49 fi
50 header=$LINUX_SRCDIR$VERS/include/linux/version.h
51 if [ ! -f $header ] ; then
52 header=$LINUX_SRCDIR/include/linux/version.h
53 if [ ! -f $header ] ; then
54 echo "ERROR: Cannot build for Linux kernel $VERS: $header does not exist."
55 errors=true
56 continue
57 fi
58 fi
59
60 vers=`fgrep UTS_RELEASE "$header" |
61 awk 'BEGIN { FS="\"" } { print $2 }'`
62 if [ "x$vers" = "x" ] ; then
63 echo "ERROR: Cannot build for Linux kernel $VERS:"
64 echo " No UTS_RELEASE string found in $header."
65 continue
66 elif [ "$VERS" != "$vers" ] ; then
67# Redhat kernel source has the problem that they create one version.h for
68# all their builds; So, we have to be creative here.
69# echo "ERROR: Cannot build $VERS. Wrong version '('$vers')' in $header."
70# errors=true
71# continue
72 errors=true
73 for subvers in $vers ; do
74 if [ "x$subvers" = "x$VERS" ] ; then
75 errors=false
76 continue
77 fi
78 done
79 fi
80 CAN_BUILD="$CAN_BUILD $VERS"
81 found_one="true"
82done
83
84if [ "x$errors" = "xtrue" ] ; then
85 echo "ERROR: Should be able to build at least one of $LINUX_VERS."
86 if [ "x$found_one" = "xtrue" ] ; then
87 echo " Cannot build all kernels. Only set up for $CAN_BUILD."
88 else
89 echo " Valid headers not present for any Linux kernel."
90 exit -1
91 fi
92fi
93
94exit 0