diff --git a/autogen.pl b/autogen.pl index 9d2c3bbd09..e728c90145 100755 --- a/autogen.pl +++ b/autogen.pl @@ -180,7 +180,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"; } @@ -189,6 +188,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); } @@ -900,6 +902,11 @@ 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"; @@ -907,6 +914,7 @@ sub patch_autotools_output { $c .= $_ while(); 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: @@ -915,7 +923,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; @@ -925,7 +933,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 @@ -960,16 +968,24 @@ 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; + # 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); @@ -1289,6 +1305,8 @@ foreach my $project (@{$projects}) { } safe_system($cmd); +patch_autotools_output("."); + #--------------------------------------------------------------------------- verbose "