diff --git a/darshan-gen-cc.pl.in b/darshan-gen-cc.pl.in index a979e6c0b1adafd582c34792f51ad7951c3e5d04..4188fdbbecb708bfc402d8d0759030c3e7033435 100644 --- a/darshan-gen-cc.pl.in +++ b/darshan-gen-cc.pl.in @@ -37,6 +37,15 @@ if (!($link_cmd)) exit(1); } +# we just want the first line of output from the mpi script's -v argument; +# the rest we assume will be generated by the underlying compiler +my $version_out = `$input_file -v 2>/dev/null |head -n 1`; +if (!($version_out)) +{ + printf STDERR "Error: failed to invoke $input_file with -v\n"; + exit(1); +} + # check command lines for accuracy if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) { @@ -45,6 +54,7 @@ if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) } chomp($compile_cmd); chomp($link_cmd); +chomp($version_out); # # Incomprehensible re to eat the leading path of the compiler command @@ -128,6 +138,18 @@ for arg in "$@" ; do # The compiler links by default linking=no ;; + -v) + # Pass this argument to the compiler as well. +EOF +print OUTPUT<<"EOF"; + echo "$version_out" +EOF +print OUTPUT<<'EOF'; + # if there is only 1 argument, it must be -v. + if [ "$#" -eq "1" ] ; then + linking=no + fi + ;; -show) addarg=no Show=echo diff --git a/darshan-gen-cxx.pl.in b/darshan-gen-cxx.pl.in index 48d8234d84df6ef96a45e516e80f430b24f97abd..b423b1d42da7f7fe77ff09a91016d17af1559d70 100644 --- a/darshan-gen-cxx.pl.in +++ b/darshan-gen-cxx.pl.in @@ -37,6 +37,15 @@ if (!($link_cmd)) exit(1); } +# we just want the first line of output from the mpi script's -v argument; +# the rest we assume will be generated by the underlying compiler +my $version_out = `$input_file -v 2>/dev/null |head -n 1`; +if (!($version_out)) +{ + printf STDERR "Error: failed to invoke $input_file with -v\n"; + exit(1); +} + # check command lines for accuracy if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) { @@ -45,6 +54,7 @@ if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) } chomp($compile_cmd); chomp($link_cmd); +chomp($version_out); # # Incomprehensible re to eat the leading path of the compiler command @@ -128,6 +138,18 @@ for arg in "$@" ; do # The compiler links by default linking=no ;; + -v) + # Pass this argument to the compiler as well. +EOF +print OUTPUT<<"EOF"; + echo "$version_out" +EOF +print OUTPUT<<'EOF'; + # if there is only 1 argument, it must be -v. + if [ "$#" -eq "1" ] ; then + linking=no + fi + ;; -show) addarg=no Show=echo diff --git a/darshan-gen-fortran.pl.in b/darshan-gen-fortran.pl.in index 7b33bddda7a3376be8b64022eaa7da13fccf16ee..e8cfce1bb617b90a9602ce1c1fadc4f36e28483b 100644 --- a/darshan-gen-fortran.pl.in +++ b/darshan-gen-fortran.pl.in @@ -37,6 +37,15 @@ if (!($link_cmd)) exit(1); } +# we just want the first line of output from the mpi script's -v argument; +# the rest we assume will be generated by the underlying compiler +my $version_out = `$input_file -v 2>/dev/null |head -n 1`; +if (!($version_out)) +{ + printf STDERR "Error: failed to invoke $input_file with -v\n"; + exit(1); +} + # check command lines for accuracy if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) { @@ -45,6 +54,7 @@ if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) } chomp($compile_cmd); chomp($link_cmd); +chomp($version_out); # # Incomprehensible re to eat the leading path of the compiler command @@ -128,6 +138,18 @@ for arg in "$@" ; do # The compiler links by default linking=no ;; + -v) + # Pass this argument to the compiler as well. +EOF +print OUTPUT<<"EOF"; + echo "$version_out" +EOF +print OUTPUT<<'EOF'; + # if there is only 1 argument, it must be -v. + if [ "$#" -eq "1" ] ; then + linking=no + fi + ;; -show) addarg=no Show=echo