[glib] gresource: libelf, try pkg-config first then fall-back to AC_CHECK_LIB



commit 14945449580d394b5e1e009f71792ccac51fc41e
Author: Antoine Jacoutot <ajacoutot gnome org>
Date:   Sat Mar 31 20:20:19 2012 +0200

    gresource: libelf, try pkg-config first then fall-back to AC_CHECK_LIB
    
    On some systems gelf.h may not be stored under the top level include
    directory in which case we need to add the correct include paths in
    cflags by using pkg-config(1).

 configure.ac    |    7 ++++---
 gio/Makefile.am |    3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 82d74c6..7c7b814 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1799,12 +1799,13 @@ dnl ************************
 dnl *** check for libelf ***
 dnl ************************
 
-AC_CHECK_LIB([elf], [elf_begin], have_libelf=yes, have_libelf=no)
+PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [
+  AC_CHECK_LIB([elf], [elf_begin], have_libelf=yes, have_libelf=no)
+  ])
 if test $have_libelf = yes; then
   AC_DEFINE(HAVE_LIBELF, 1, [Define if libelf is available])
-  ELF_LIBS=-lelf
+  LIBELF_LIBS=-lelf
 fi
-AC_SUBST(ELF_LIBS)
 
 dnl ****************************************
 dnl *** platform dependent source checks ***
diff --git a/gio/Makefile.am b/gio/Makefile.am
index 69db690..7bc53a6 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -704,10 +704,11 @@ EXTRA_DIST += $(completion_DATA)
 
 bin_PROGRAMS += gresource
 gresource_SOURCES = gresource-tool.c
+gresource_CPPFLAGS = $(LIBELF_CFLAGS) $(AM_CPPFLAGS)
 gresource_LDADD = libgio-2.0.la \
 	$(top_builddir)/glib/libglib-2.0.la 		\
 	$(top_builddir)/gobject/libgobject-2.0.la \
-	$(ELF_LIBS)
+	$(LIBELF_LIBS)
 
 # ------------------------------------------------------------------------
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]