Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit 8ae8b78

Browse files
committed
autogen.pl: ensure to patch *all* Autotools output
Per open-mpi/ompi#751, ensure to patch up all Autotools output (not just in some cases). Also, adjust the patching process to only write our verbose statements and a new configure script if the content actually changed as result of the patching. (cherry picked from commit open-mpi/ompi@982455a)
1 parent 8b2ba0f commit 8ae8b78

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

autogen.pl

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ sub process_subdir {
180180
print "--- Found configure.in|ac; running autoreconf...\n";
181181
safe_system("autoreconf -ivf");
182182
print "--- Patching autotools output... :-(\n";
183-
patch_autotools_output($start);
184183
} else {
185184
my_die "Found subdir, but no autogen.sh or configure.in|ac to do anything";
186185
}
@@ -189,6 +188,9 @@ sub process_subdir {
189188
my_die "Did not generate a \"configure\" executable in $dir.\n"
190189
if (! -x "configure");
191190

191+
# Fix known issues in Autotools output
192+
patch_autotools_output($start);
193+
192194
# Chdir back to where we came from
193195
chdir($start);
194196
}
@@ -900,13 +902,19 @@ sub patch_autotools_output {
900902
unlink("config/ltmain.sh.rej");
901903
}
902904

905+
# If there's no configure script, there's nothing else to do.
906+
return
907+
if (! -f "configure");
908+
my @verbose_out;
909+
903910
# Total ugh. We have to patch the configure script itself. See below
904911
# for explainations why.
905912
open(IN, "configure") || my_die "Can't open configure";
906913
my $c;
907914
$c .= $_
908915
while(<IN>);
909916
close(IN);
917+
my $c_orig = $c;
910918

911919
# LT <=2.2.6b need to be patched for the PGI 10.0 fortran compiler
912920
# name (pgfortran). The following comes from the upstream LT patches:
@@ -915,7 +923,7 @@ sub patch_autotools_output {
915923
# Note that that patch is part of Libtool (which is not in this OMPI
916924
# source tree); we can't fix it. So all we can do is patch the
917925
# resulting configure script. :-(
918-
verbose "$indent_str"."Patching configure for Libtool PGI 10 fortran compiler name\n";
926+
push(@verbose_out, $indent_str . "Patching configure for Libtool PGI 10 fortran compiler name\n");
919927
$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;
920928
$c =~ s/pgcc\* \| pgf77\* \| pgf90\* \| pgf95\*\)/pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)/g;
921929
$c =~ s/pgf77\* \| pgf90\* \| pgf95\*\)/pgf77* | pgf90* | pgf95* | pgfortran*)/g;
@@ -925,7 +933,7 @@ sub patch_autotools_output {
925933
# Libtool install; all we can do is patch the resulting configure
926934
# script. :-( The following comes from the upstream patch:
927935
# http://lists.gnu.org/archive/html/libtool-patches/2009-11/msg00016.html
928-
verbose "$indent_str"."Patching configure for Libtool PGI version number regexps\n";
936+
push(@verbose_out, $indent_str . "Patching configure for Libtool PGI version number regexps\n");
929937
$c =~ s/\*pgCC\\ \[1-5\]\* \| \*pgcpp\\ \[1-5\]\*/*pgCC\\ [1-5]\.* | *pgcpp\\ [1-5]\.*/g;
930938

931939
# Similar issue as above -- fix the case statements that handle the Sun
@@ -960,16 +968,24 @@ sub patch_autotools_output {
960968
;;
961969
";
962970

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

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

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

981+
# Only write out verbose statements and a new configure if the
982+
# configure content actually changed
983+
return
984+
if ($c eq $c_orig);
985+
foreach my $str (@verbose_out) {
986+
verbose($str);
987+
}
988+
973989
open(OUT, ">configure.patched") || my_die "Can't open configure.patched";
974990
print OUT $c;
975991
close(OUT);
@@ -1289,6 +1305,8 @@ sub patch_autotools_output {
12891305
}
12901306
safe_system($cmd);
12911307

1308+
patch_autotools_output(".");
1309+
12921310
#---------------------------------------------------------------------------
12931311

12941312
verbose "

0 commit comments

Comments
 (0)