Attached a patch backporting the --compat-libtool option to the version of lcov currently in Debian unstable (1.5-1).
diff -r ff5dbc491003 -r 3b3de3b41a23 bin/geninfo
--- a/bin/geninfo	Thu Jul 05 15:28:56 2007 +0200
+++ b/bin/geninfo	Thu Jul 05 15:46:16 2007 +0200
@@ -104,6 +104,7 @@ our $follow;
 our $follow;
 our $nochecksum;
 our $preserve_paths;
+our $compat_libtool;
 our $adjust_testname = (`uname -m` =~ /^s390/); # Always on on s390
 our $config;		# Configuration file contents
 our $compatibility;	# Compatibility version flag - used to indicate
@@ -147,7 +148,8 @@ if (!GetOptions("test-name=s" => \$test_
 		"version" =>\$version,
 		"quiet" => \$quiet,
 		"help" => \$help,
-		"follow" => \$follow
+		"follow" => \$follow,
+		"compat-libtool" => \$compat_libtool
 		))
 {
 	print_usage(*STDERR);
@@ -305,6 +307,7 @@ sequentially.
   -f, --follow                      Follow links when searching .da/.gcda files
   -n, --no-checksum                 Do not calculate checksum for each line
   -b, --base-directory DIR          Use DIR as base directory for relative paths
+      --compat-libtool              Assume libtool environment
 
 See $lcov_url for more information about this tool.
 END_OF_USAGE
@@ -385,6 +388,7 @@ sub process_dafile($)
 
 	my $da_filename;	# Name of data file to process
 	my $da_dir;		# Directory of data file
+	my $source_dir;		# Directory of source file
 	my $da_basename;	# data filename without ".da/.gcda" extension
 	my $bb_filename;	# Name of respective graph file
 	my %bb_content;		# Contents of graph file
@@ -415,11 +419,11 @@ sub process_dafile($)
 	# Get directory and basename of data file
 	($da_dir, $da_basename) = split_filename($da_filename);
 
-	# Check for writable $da_dir (gcov will try to write files there)
-	stat($da_dir);
-	if (!-w _)
-	{
-		die("ERROR: cannot write to directory $da_dir!\n");
+	# avoid files from .libs dirs 	 
+	if ($compat_libtool && $da_dir =~ m/(.*)\/\.libs$/) {
+		$source_dir = $1;
+	} else {
+		$source_dir = $da_dir;
 	}
 
 	if (-z $da_filename)
@@ -438,7 +442,14 @@ sub process_dafile($)
 	}
 	else
 	{
-		$base_dir = $da_dir;
+		$base_dir = $source_dir;
+	}
+
+	# Check for writable $base_dir (gcov will try to write files there)
+	stat($base_dir);
+	if (!-w _)
+	{
+		die("ERROR: cannot write to directory $base_dir!\n");
 	}
 
 	# Construct name of graph file
diff -r ff5dbc491003 -r 3b3de3b41a23 bin/lcov
--- a/bin/lcov	Thu Jul 05 15:28:56 2007 +0200
+++ b/bin/lcov	Thu Jul 05 15:46:16 2007 +0200
@@ -147,6 +147,7 @@ our $follow;		# If set, indicates that f
 our $follow;		# If set, indicates that find shall follow links
 our $diff_path = "";	# Path removed from tracefile when applying diff
 our $base_directory;	# Base directory (cwd of gcc during compilation)
+our $compat_libtool;	# Specify to work with libtool build environment
 our $config;		# Configuration file contents
 chomp($cwd);
 our $tool_dir = dirname($0);	# Directory where genhtml tool is installed
@@ -203,7 +204,8 @@ if (!GetOptions("directory|d|di=s" => \@
 		"version" => \$version,
 		"follow" => \$follow,
 		"path=s" => \$diff_path,
-		"base-directory=s" => \$base_directory
+		"base-directory=s" => \$base_directory,
+		"compat-libtool" => \$compat_libtool
 		))
 {
 	print_usage(*STDERR);
@@ -346,6 +348,7 @@ get coverage data for a user space progr
       --convert-filenames         Convert filenames when applying diff
       --strip DEPTH               Strip initial DEPTH directory levels in diff
       --path PATH                 Strip PATH from tracefile when applying diff
+      --compat-libtool            Assume libtool environment
 
 See $lcov_url for more information about this tool.
 END_OF_USAGE
@@ -462,6 +465,10 @@ sub userspace_capture()
 	if ($base_directory)
 	{
 		@param = (@param, "--base-directory", $base_directory);
+	}
+	if ($compat_libtool)
+	{
+		@param = (@param, "--compat-libtool");
 	}
 
 	system(@param);

Reply via email to