@@ -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}
12901306safe_system($cmd );
12911307
1308+ patch_autotools_output(" ." );
1309+
12921310# ---------------------------------------------------------------------------
12931311
12941312verbose "
0 commit comments