octave-maintainers
[Top][All Lists]
Advanced

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

Re: acinclude.m4 patch


From: Rik
Subject: Re: acinclude.m4 patch
Date: Fri, 22 May 2015 20:00:28 -0700

On 05/22/2015 06:20 PM, address@hidden wrote:
Subject:
[PATCH] acinclude.m4: Use pkg-config when available in OCTAVE_CHECK_LIB
From:
Jordi Gutiérrez Hermoso <address@hidden>
Date:
05/22/2015 02:06 PM
To:
address@hidden
List-Post:
<mailto:address@hidden>
Content-Transfer-Encoding:
base64
Precedence:
list
MIME-Version:
1.0
Message-ID:
<address@hidden>
Content-Type:
text/plain; charset="utf-8"
Message:
1

# 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])
 

Looks okay.  Although, if the only package that is affected is hdf5 maybe it would be easier to set the flags like HDF5_CPPFLAGS in configure.ac.  The other libraries that use the macro OCTAVE_CHECK_LIB are things like amd, colamd, etc. which don't have pkg_config files.  At least on Ubuntu 12.04 I don't have a pkg-config file for HDF5 either.

--Rik


reply via email to

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