TS-2207: CentOS5 out of tree perl module build fails

The older version of automake on CentOS5 doesn't supply the $(builddir)
variable, possibly because it's implicitly the current working
directory. It also doesn't supply various $abs_ variables that later
versions do. Rewrite the copy using more fundamental automake
variables.

Conflicts:
	CHANGES
diff --git a/CHANGES b/CHANGES
index 2eb97a8..f34b679 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,8 @@
   *) [TS-2217] remove the option to turn off body factory - setting it to 0 will
    result in empty responses
 
+  *) [TS-2207] CentOS5 out of tree perl module build fails.
+
   *) [TS-2191] not reschedule http_sm when the sm_list`s lock is not acquired.
 
   *) [TS-2174] traffic_shell/traffic_line miss some stats value
diff --git a/lib/perl/Makefile.am b/lib/perl/Makefile.am
index be6ea76..a389a14 100644
--- a/lib/perl/Makefile.am
+++ b/lib/perl/Makefile.am
@@ -22,8 +22,10 @@
 install-exec-local: Makefile-pl
 	$(MAKE) -f Makefile-pl INSTALLDIRS=$(INSTALLDIRS) PREFIX=$(prefix) DESTDIR=$(DESTDIR) install
 
+# The perl build needs to have the source files in the current working directory, so we need to
+# copy them to the build directory if we are building out of tree.
 Makefile-pl: Makefile.PL
-	-[ $(srcdir) != $(builddir) ] && cp -rf $(abs_srcdir)/. $(builddir)/.
+	-[ "$(srcdir)" != "$(top_builddir)/$(subdir)" ] && cp -rf "$(srcdir)/." "$(top_builddir)/$(subdir)"
 	$(PERL) Makefile.PL INSTALLDIRS=$(INSTALLDIRS) PREFIX=$(prefix)
 
 #test: check