octave-maintainers
[Top][All Lists]
Advanced

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

[PATCH] acinclude.m4: Use pkg-config when available in OCTAVE_CHECK_LIB


From: Jordi Gutiérrez Hermoso
Subject: [PATCH] acinclude.m4: Use pkg-config when available in OCTAVE_CHECK_LIB
Date: Fri, 22 May 2015 17:06:32 -0400
User-agent: Mercurial-patchbomb/3.3.2

# HG changeset patch
# User Jordi Gutiérrez Hermoso <address@hidden>
# Date 1432328517 14400
#      Fri May 22 17:01:57 2015 -0400
# Node ID 431f166a56cb347f8351950411f58f1b9c5f6621
# Parent  561af1ab60990a990c70c279475b621846639a83
acinclude.m4: Use pkg-config when available in OCTAVE_CHECK_LIB

(Hi, I'm using the Mercurial patchbomb extension to email you a patch
for code review.)

The following patch uses pkg-config to add extra flags whenever
possible. 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 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.

Any comments if this is the best way to do this? It seems to have
solved my immediate problem and now hdf5 is recognised on Debian
without needing to pass extra flags to the configure script.

diff --git a/m4/acinclude.m4 b/m4/acinclude.m4
--- a/m4/acinclude.m4
+++ b/m4/acinclude.m4
@@ -598,6 +598,12 @@ AC_DEFUN([OCTAVE_CHECK_LIB], [
     ;;
   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"
+  ])
+
   warn_$1="$3"
   m4_set_add([summary_warning_list], [warn_$1])
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]