Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.
Merged
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
36 changes: 31 additions & 5 deletions autogen.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved.
# Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
# Copyright (c) 2015 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -180,7 +182,6 @@ sub process_subdir {
print "--- Found configure.in|ac; running autoreconf...\n";
safe_system("autoreconf -ivf");
print "--- Patching autotools output... :-(\n";
patch_autotools_output($start);
} else {
my_die "Found subdir, but no autogen.sh or configure.in|ac to do anything";
}
Expand All @@ -189,6 +190,9 @@ sub process_subdir {
my_die "Did not generate a \"configure\" executable in $dir.\n"
if (! -x "configure");

# Fix known issues in Autotools output
patch_autotools_output($start);

# Chdir back to where we came from
chdir($start);
}
Expand Down Expand Up @@ -900,13 +904,19 @@ sub patch_autotools_output {
unlink("config/ltmain.sh.rej");
}

# If there's no configure script, there's nothing else to do.
return
if (! -f "configure");
my @verbose_out;

# Total ugh. We have to patch the configure script itself. See below
# for explainations why.
open(IN, "configure") || my_die "Can't open configure";
my $c;
$c .= $_
while(<IN>);
close(IN);
my $c_orig = $c;

# LT <=2.2.6b need to be patched for the PGI 10.0 fortran compiler
# name (pgfortran). The following comes from the upstream LT patches:
Expand All @@ -915,7 +925,7 @@ sub patch_autotools_output {
# Note that that patch is part of Libtool (which is not in this OMPI
# source tree); we can't fix it. So all we can do is patch the
# resulting configure script. :-(
verbose "$indent_str"."Patching configure for Libtool PGI 10 fortran compiler name\n";
push(@verbose_out, $indent_str . "Patching configure for Libtool PGI 10 fortran compiler name\n");
$c =~ s/gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn/gfortran g95 xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn/g;
$c =~ s/pgcc\* \| pgf77\* \| pgf90\* \| pgf95\*\)/pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)/g;
$c =~ s/pgf77\* \| pgf90\* \| pgf95\*\)/pgf77* | pgf90* | pgf95* | pgfortran*)/g;
Expand All @@ -925,7 +935,7 @@ sub patch_autotools_output {
# Libtool install; all we can do is patch the resulting configure
# script. :-( The following comes from the upstream patch:
# http://lists.gnu.org/archive/html/libtool-patches/2009-11/msg00016.html
verbose "$indent_str"."Patching configure for Libtool PGI version number regexps\n";
push(@verbose_out, $indent_str . "Patching configure for Libtool PGI version number regexps\n");
$c =~ s/\*pgCC\\ \[1-5\]\* \| \*pgcpp\\ \[1-5\]\*/*pgCC\\ [1-5]\.* | *pgcpp\\ [1-5]\.*/g;

# Similar issue as above -- fix the case statements that handle the Sun
Expand Down Expand Up @@ -960,16 +970,30 @@ sub patch_autotools_output {
;;
";

verbose "$indent_str"."Patching configure for Sun Studio Fortran version strings ($tag)\n";
push(@verbose_out, $indent_str . "Patching configure for Sun Studio Fortran version strings ($tag)\n");
$c =~ s/$search_string/$replace_string/;
}

# See http://git.savannah.gnu.org/cgit/libtool.git/commit/?id=v2.2.6-201-g519bf91 for details
# Note that this issue was fixed in LT 2.2.8, however most distros are still using 2.2.6b

verbose "$indent_str"."Patching configure for IBM xlf libtool bug\n";
push(@verbose_out, $indent_str . "Patching configure for IBM xlf libtool bug\n");
$c =~ s/(\$LD -shared \$libobjs \$deplibs \$)compiler_flags( -soname \$soname)/$1linker_flags$2/g;

# Fix consequence of broken libtool.m4 from libtool 2.4.3
# see http://lists.gnu.org/archive/html/bug-libtool/2015-07/msg00002.html
push(@verbose_out, $indent_str . "Patching configure for libtool.m4 bug\n");
$c =~ s/test x-L = \"\$p\"/test x-L = \"x\$p\"/g;
$c =~ s/test x-R = \"\$p\"/test x-R = \"x\$p\"/g;

# Only write out verbose statements and a new configure if the
# configure content actually changed
return
if ($c eq $c_orig);
foreach my $str (@verbose_out) {
verbose($str);
}

open(OUT, ">configure.patched") || my_die "Can't open configure.patched";
print OUT $c;
close(OUT);
Expand Down Expand Up @@ -1289,6 +1313,8 @@ sub patch_autotools_output {
}
safe_system($cmd);

patch_autotools_output(".");

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

verbose "
Expand Down