$NetBSD$

- Use @CC@ instead of gcc for the compiler.
- Prefer the installed cqual over the one in $PATH.
- Error messages belong on stderr, not stdout.

--- bin/gcqual.in.orig	2006-07-17 08:55:02.000000000 +0200
+++ bin/gcqual.in	2006-07-17 08:57:26.000000000 +0200
@@ -22,10 +22,10 @@ use File::Basename;
 
 
 # Global config options -- should probably do something smarter with $CC
-$CC="gcc";
-$cqual="cqual";
-$pkgdatadir = "@prefix@/share/@PACKAGE@"; # Yuck. Is there a better way?
-$scriptname = $0;
+my $CC = "@CC@";
+my $cqual = (-f "@prefix@/bin/cqual" ? "@prefix@/bin/cqual" : "cqual");
+my $pkgdatadir = "@prefix@/share/@PACKAGE@"; # Yuck. Is there a better way?
+my $scriptname = $0;
 
 sub usage
 {
@@ -237,10 +237,10 @@ if ($#ifiles >= 0) {
     }
     print ("@cmd\n") if ($debug);
     system(@cmd) == 0 
-	or die "cqual failed: $?";
+	or die "cqual failed with exitcode " . ($?>>8) . ": $!";
 }
 else
 {
-    print ("Could not parse command line args.  No .c or .i files specified?\n");
+    print STDERR ("Could not parse command line args.  No .c or .i files specified?\n");
     usage();
 }
