Allow building against libelf and elfutils

Adds configure-time check to test the function signature of elf_hash
function, which may be provided by the libelf or elfutils packages.
In the former, the 'name' argument must be an unsigned char pointer.
In the later, the same argument must be a signed char pointer.
The check sets the ELF_HASH_TAKES_SIGNED_CHAR symbol in config.h,
and this is used at the existing call site to pass the proper type.

Signed-off-by: Zachary T Welch <zwelch@codesourcery.com>
diff --git a/configure.ac b/configure.ac
index 5e426cb..9863784 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,6 +123,17 @@
 	AC_MSG_RESULT([yes])],[
 	AC_MSG_RESULT([no])])
 
+saved_CFLAGS="${CFLAGS}"
+CFLAGS="${CFLAGS} -Wall -Werror"
+AC_MSG_CHECKING([whether elf_hash takes a signed char string])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libelf.h>]], [[
+	(void) elf_hash("name");
+	]])],
+	[AC_DEFINE([ELF_HASH_TAKES_SIGNED_CHAR], [1],
+		[elf_hash() takes signed char])
+	 AC_MSG_RESULT([yes])],
+	[AC_MSG_RESULT([no])])
+CFLAGS="${saved_CFLAGS}"
 
 CPPFLAGS=" \
 	${CPPFLAGS} \