Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 102 additions & 1 deletion autogen.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
#
# Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2009-2021 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved.
Expand Down Expand Up @@ -1137,6 +1137,102 @@ sub in_tarball {
return $tarball;
}

##############################################################################

sub replace_config_sub_guess {
# This could be simpler if we could use some Perl modules for this
# functionality (e.g., DateTime). But I don't want to introduce
# any CPAN dependencies here, so just do sometime simple, even if
# it's a bit laborious. Use a few private helper functions for
# this kind of functionality.

sub _get_timestamp {
my $filename = shift;

my $ret;
if (-x $filename) {
my $out = `$filename --version`;
$out =~ m/GNU config\.[a-z]+ \((.+)\)/;
$ret = $1;
}

return $ret;
}

sub _split_timestamp {
my $ts = shift;

$ts =~ m/(\d+)-(\d+)-(\d+)/;
return $1, $2, $3;
}

# Returns true if timestamp $a > timestamp $b.
sub _timestamp_gt {
my ($a, $b) = @_;

my ($year_a, $month_a, $day_a) = _split_timestamp($a);
my ($year_b, $month_b, $day_b) = _split_timestamp($b);

# Don't try to be clever -- just do a simple set of explicit
# comparisons.
if ($year_a > $year_b) {
return 1;
} elsif ($year_a < $year_b) {
return 0;
} else {
if ($month_a > $month_b) {
return 1;
} elsif ($month_a < $month_b) {
return 0;
} else {
if ($day_a > $day_b) {
return 1;
} else {
return 0;
}
}
}
}

my ($topdir) = @_;

# Find the stashed known-good files, and get their version
# timestamps.
my $cached_dir = "$topdir/config/from-savannah";
my @files = qw/config.guess config.sub/;
my %known_good_timestamps;
foreach my $file (@files) {
my $filename = "$cached_dir/upstream-$file";
my_die("Cannot find $filename")
if (! -f $filename);

my $ts = _get_timestamp($filename);
$known_good_timestamps{$file} = $ts;
}

# Find all config.guess/config.sub files in the tree. If their
# versions are older than the stashed known-good files, update
# them from the stash.
my @files;
File::Find::find(sub {
push(@files, $File::Find::name)
if ($_ eq "config.guess" ||
$_ eq "config.sub") }, $topdir);

foreach my $file (@files) {
# Skip anything in the 3rd-party tree
next
if ($file =~ /\/3rd-party\//);

my $base = basename($file);
my $ts = _get_timestamp($file);
if (_timestamp_gt($known_good_timestamps{$base}, $ts)) {
print("=== Replacing $file with newer version\n");
safe_system("cp -f $cached_dir/upstream-$base $file");
}
}
}

##############################################################################
##############################################################################
## main - do the real work...
Expand Down Expand Up @@ -1458,6 +1554,11 @@ sub in_tarball {

patch_autotools_output(".");

# Per https://github.com/open-mpi/ompi/issues/8410, replace config.sub
# and config.guess with known-good versions if the Autoconf-installed
# versions are older.
replace_config_sub_guess(".");

#---------------------------------------------------------------------------

verbose "
Expand Down
6 changes: 4 additions & 2 deletions config/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2021 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2010 Oracle and/or its affiliates. All rights
# reserved.
# Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
Expand All @@ -30,7 +30,9 @@ EXTRA_DIST = \
opal_mca_priority_sort.pl \
find_common_syms \
getdate.sh \
make_manpage.pl
make_manpage.pl \
from-savannah/upstream-config.guess \
from-savannah/upstream-config.sub

maintainer-clean-local:
rm -f opal_get_version.sh
11 changes: 11 additions & 0 deletions config/from-savannah/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
These files downloaded from
https://git.savannah.gnu.org/gitweb/?p=config.git at git hash
6faca61810d335c7837f320733fe8e15a1431fc2 on 26 Jan 2021.

They were stashed here in the Open MPI repository in response to
https://github.com/open-mpi/ompi/issues/8410, where it was determined
that the responses from `config.*` installed by Autoconf were not
sufficient for some modern platforms (e.g., Apple M1 Macs).

`autogen.pl` will copy in these files if they are, in fact, newer than
the corresponding files installed by Autoconf.
Loading