Don't assume Perl lives in /usr/bin; do a proper test for it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1389 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_annotate.in b/cachegrind/cg_annotate.in
index d6f1848..67d5af3 100644
--- a/cachegrind/cg_annotate.in
+++ b/cachegrind/cg_annotate.in
@@ -1,4 +1,4 @@
-#! /usr/bin/perl -w
+#! @PERL@ -w
 
 ##--------------------------------------------------------------------##
 ##--- The cache simulation framework: instrumentation, recording   ---##
diff --git a/configure.in b/configure.in
index 8d22798..2912b15 100644
--- a/configure.in
+++ b/configure.in
@@ -19,6 +19,9 @@
    AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
 fi
 
+# figure out where perl lives
+AC_PATH_PROG(PERL, perl)
+
 # some older automake's don't have it so try something on our own
 ifdef([AM_PROG_AS],[AM_PROG_AS],
 [
diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in
index 688b698..e9b2a94 100755
--- a/tests/vg_regtest.in
+++ b/tests/vg_regtest.in
@@ -1,4 +1,4 @@
-#! /usr/bin/perl -w
+#! @PERL@ -w
 ##--------------------------------------------------------------------##
 ##--- Valgrind regression testing script                vg_regtest ---##
 ##--------------------------------------------------------------------##