tests: robustify pc.test

* configure.ac: Check for dladdr in -ldl.
* tests/Makefile.am (pc_LDADD): Adde $(dl_LIBS).
* tests/pc.c: Include "config.h" and <dlfcn.h>.
(main): Use dladdr to find the address to unmap.
diff --git a/configure.ac b/configure.ac
index b21941e..0d009ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -729,6 +729,14 @@
 		  [Define to 1 if the system provides __builtin_popcount function])
 fi
 
+dl_LIBS=
+AC_CHECK_LIB([dl], [dladdr], [])
+if test "x$ac_cv_lib_dl_dladdr" = xyes; then
+	AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if the system provides dladdr])
+	dl_LIBS='-ldl'
+fi
+AC_SUBST(dl_LIBS)
+
 AC_PATH_PROG([PERL], [perl])
 
 dnl stack trace with libunwind