changeset 22036:a2c29df93df7

acinclude.m4: Use pkg-config from OCTAVE_CHECK_LIB whenever possible The following patch uses pkg-config to add extra flags if pkg-config finds the module in question in OCTAVE_CHECK_LIB. This was necessary for me in Debian in order to find the HDF5 libraries, and seems useful in general. Like it often happens with m4 and autoconf, I cargo-culted and generalised this code from existing checks for sndfile in configure.ac. It probably would make sense to move the original code into its own m4 macro, so we can have a little less code duplication in the autoconf files. * acinclude.m4 (OCTAVE_CHECK_LIB): add a generic pkg-config check.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Mon, 04 Jul 2016 20:21:14 -0400
parents 634fbedbfb5b
children 782ecfde4859
files m4/acinclude.m4
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/m4/acinclude.m4	Sun Jul 03 23:39:36 2016 +0200
+++ b/m4/acinclude.m4	Mon Jul 04 20:21:14 2016 -0400
@@ -667,6 +667,12 @@
     ;;
   esac
 
+  PKG_CHECK_EXISTS([$1], [
+    m4_toupper([$1])_CPPFLAGS="$($PKG_CONFIG --cflags-only-I $1) $m4_toupper([$1])_CPPFLAGS"
+    m4_toupper([$1])_LDFLAGS="$($PKG_CONFIG --libs-only-L $1) $m4_toupper([$1])_LDFLAGS"
+    m4_toupper([$1])_LIBS="$($PKG_CONFIG --libs-only-l $1) $m4_toupper([$1])_LIBS"
+  ])
+
   if test -n "$m4_toupper([$1])_LIBS"; then
     ac_octave_save_CPPFLAGS="$CPPFLAGS"
     ac_octave_save_LDFLAGS="$LDFLAGS"