diff options
author | Zachary T Welch <zwelch@codesourcery.com> | 2010-12-10 14:52:33 -0800 |
---|---|---|
committer | Joe Damato <ice799@gmail.com> | 2011-01-06 11:41:20 -0800 |
commit | 6188614fe288df30e9d7145106fc6350468d58f9 (patch) | |
tree | d6f46d7c707a4a799a32206fff57fbfb667f5e12 | |
parent | 3ba522fed3d34f476090da9349be96e15e0652cb (diff) | |
download | ltrace-6188614fe288df30e9d7145106fc6350468d58f9.tar.gz |
Allow libelf to be found in non-standard locations
Adds '--with-libelf' option to configure, allowing users to specify
an alternate prefix for finding that library and its headers.
Signed-off-by: Zachary T Welch <zwelch@codesourcery.com>
-rw-r--r-- | configure.ac | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 942fcbd..172de11 100644 --- a/configure.ac +++ b/configure.ac @@ -33,8 +33,27 @@ AC_PROG_LIBTOOL AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2]) AM_MAINTAINER_MODE +AC_ARG_WITH([libelf], + AS_HELP_STRING([--with-libelf], [Prefix of libelf headers/library]), + [case "${withval}" in + (no) + AC_MSG_ERROR([*** libelf is a required dependency]) + ;; + (yes) + AC_MSG_ERROR([*** --with-libelf requires you to specify a path]) + ;; + (*) + AM_CPPFLAGS="${AM_CPPFLAGS} -I${withval}/include" + AM_LDFLAGS="${AM_LDFLAGS} -L${withval}/lib" + ;; +esac],[]) + # Checks for libraries. +saved_CPPFLAGS="${CPPFLAGS}" +saved_LDFLAGS="${LDFLAGS}" +CPPFLAGS="${CPPFLAGS} ${AM_CPPFLAGS}" +LDFLAGS="${LDFLAGS} ${AM_LDFLAGS}" # libelf AC_CHECK_HEADERS([elf.h gelf.h],, [AC_MSG_ERROR([*** libelf.h or gelf.h not found on your system])] @@ -42,6 +61,8 @@ AC_CHECK_HEADERS([elf.h gelf.h],, AC_CHECK_LIB([elf], [elf_begin],, [AC_MSG_ERROR([*** libelf not found on your system])] ) +CPPFLAGS="${saved_CPPFLAGS}" +LDFLAGS="${saved_LDFLAGS}" # HAVE_LIBIBERTY @@ -117,6 +138,10 @@ if test x"$enable_libunwind" = xyes; then fi +saved_CPPFLAGS="${CPPFLAGS}" +saved_LDFLAGS="${LDFLAGS}" +CPPFLAGS="${CPPFLAGS} ${AM_CPPFLAGS}" +LDFLAGS="${LDFLAGS} ${AM_LDFLAGS}" # HAVE_ELF_C_READ_MMAP AC_MSG_CHECKING([whether elf_begin accepts ELF_C_READ_MMAP]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gelf.h>]], [[ @@ -140,6 +165,8 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libelf.h>]], [[ AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) CFLAGS="${saved_CFLAGS}" +CPPFLAGS="${saved_CPPFLAGS}" +LDFLAGS="${saved_LDFLAGS}" AM_CPPFLAGS=" \ ${AM_CPPFLAGS} \ |