From: fabbione@sourceware.org <fabbione@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster configure
Date: 24 Nov 2007 04:57:31 -0000 [thread overview]
Message-ID: <20071124045731.20851.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: fabbione at sourceware.org 2007-11-24 04:57:31
Modified files:
. : configure
Log message:
Switch configure to use perl warnings and fix them up.
Add kernel_version version check subroutine.
Set minimal kernel version requirement to 2.6.23.
Many thanks should go to Marian Marinov <mm@yuhu.biz> for the original
patch and contribution.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/configure.diff?cvsroot=cluster&r1=1.37&r2=1.38
--- cluster/configure 2007/10/26 19:18:55 1.37
+++ cluster/configure 2007/11/24 04:57:31 1.38
@@ -13,16 +13,22 @@
###############################################################################
###############################################################################
+use warnings;
use Getopt::Long;
use POSIX qw(uname);
+
print "\nConfiguring Makefiles for your system...\n";
# Set a bunch of variables
-$ret = 0;
+my $ret = 0;
+
+# this should be only the major version without the extra version
+# eg. only the first 3 digits
+my $required_kernelversion = '2.6.23';
-%options = (
+my %options = (
help => \$help,
cc => \$cc,
debug => \$debug,
@@ -80,7 +86,7 @@
without_rgmanager => \$without_rgmanager,
);
-$err = &GetOptions (\%options,
+my $err = &GetOptions (\%options,
'help',
'cc=s',
'debug',
@@ -202,6 +208,67 @@
exit $ret;
}
+sub kernel_version {
+ my $autoconf_path = shift;
+ my $required_version = shift;
+ my $build_version = 0;
+ my $build_patchlevel = 0;
+ my $build_sublevel = 0;
+
+ print "\nChecking kernel:\n";
+
+ # add autoconf to the path
+ $autoconf_path .= '/include/linux/autoconf.h';
+ my @version = split /\./, $required_version;
+ my $current_version = 0;
+ if ( -f $autoconf_path ) {
+ # open the autoconf.h to feth VERSION, PATCHLEVEL and SUBLEVEL, if needed I can add EXTRAVERSION too
+ open AUTOCONF, '<', $autoconf_path;
+ while (<AUTOCONF>) {
+ if ($_ =~ /CONFIG_KERNELVERSION/) {
+ $current_version = $_;
+ # we don't need to check any thing else in this file so we are stopping the read
+ last;
+ }
+ }
+ close AUTOCONF;
+ # leaving only the numbers from the lines
+ # this is faster then split and doesn't alocate useless arrays
+ $current_version =~ s/.*"(.*)"\n/$1/;
+ # parse the kernel version into the variables
+ if ($current_version =~ /\-/) {
+ my @line = split /\-/, $current_version;
+ my @ver = split /\./, $line[0];
+ $build_version = $ver[0];
+ $build_patchlevel = $ver[1];
+ $build_sublevel = $ver[2];
+ } else {
+ my @kernel = split /\./, $current_version;
+ $build_version = $kernel[0];
+ $build_patchlevel = $kernel[1];
+ $build_sublevel = $kernel[2];
+ }
+ # checking VERSION, PATCHLEVEL and SUBLEVEL for the supplied kernel
+ # if needed I can add also EXTRAVERSION to the check
+ if ($build_version >= $version[0] &&
+ $build_patchlevel >= $version[1] &&
+ $build_sublevel >= $version[2]) {
+ print " Current kernel version appears to be OK\n";
+ return 1;
+ } else {
+ print " Current kernel version: ",$current_version,"\n Minimum kernel version: ",$required_version,"\n";
+ print " FAILED!\n";
+ return 0;
+ }
+ } else {
+ print " Unable to find ($autoconf_path)!\n";
+ print " Make sure that:\n - the above path is correct\n";
+ print " - your kernel is properly configured and prepared.\n";
+ print " - kernel_build and kernel_src options to configure are set properly.\n";
+ return 0;
+ }
+}
+
$pwd = `pwd`;
chomp($pwd);
@@ -245,6 +312,9 @@
$kernel_src=$kernel_build;
}
}
+if (!kernel_version($kernel_build,$required_kernelversion)) {
+ exit 1;
+}
if (!$module_dir) {
$module_dir="/lib/modules/$un[2]/kernel";
}
@@ -374,10 +444,10 @@
if (!$without_rgmanager) {
$without_rgmanager="";
}
-if (not length $release_major) {
+if (defined($release_major) && not length $release_major) {
$release_major="";
}
-if (not length $release_minor) {
+if (defined($release_minor) && not length $release_minor) {
$release_minor="";
}
@@ -462,7 +532,7 @@
}
close IFILE;
-if ((not length $release_major) || (not length $release_minor)) {
+if ((not defined($release_major)) || (not defined($release_minor))) {
open IFILE, "<make/release.mk.input" or die "Can't redirect stdin";
while (<IFILE>) {
chomp;
next reply other threads:[~2007-11-24 4:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-24 4:57 fabbione [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-01-28 6:43 [Cluster-devel] cluster configure fabbione
2008-01-07 18:58 lhh
2007-12-21 7:28 fabbione
2007-12-21 5:58 fabbione
2007-12-19 5:48 fabbione
2007-12-06 10:38 pcaulfield
2007-10-26 19:18 rmccabe
2007-10-01 3:28 fabbione
2007-09-28 6:19 fabbione
2007-09-24 14:43 fabbione
2007-09-14 14:32 teigland
2007-09-06 16:26 teigland
2007-09-06 16:24 teigland
2007-06-06 8:42 fabbione
2007-05-21 10:16 pcaulfield
2006-10-05 16:50 teigland
2006-08-02 22:47 rpeterso
2006-07-19 17:13 teigland
2006-07-19 14:51 teigland
2006-07-19 14:04 rpeterso
2006-06-28 19:54 jbrassow
2006-06-14 20:44 cfeist
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071124045731.20851.qmail@sourceware.org \
--to=fabbione@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.