1 From 1ecd1f2008bfab7bb3cd6ada135c980414a7f1ba Mon Sep 17 00:00:00 2001
2 From: "Yann E. MORIN" <yann.morin.1998@free.fr>
3 Date: Sun, 23 Nov 2014 15:53:56 +0100
4 Subject: [PATCH] configure: use pkg-config to find libtirpc
6 Currently, we use a custom function to find libtirpc's headers and
7 libraries. This works fine for shared linking.
9 But for static linking, this forgets to link with -lpthread, which is
12 A recent patch was sent to libtirpc to add that missing -lpthread in its
13 Libs.private section of its .pc file. Thus, pkg-config will soon be able
14 to return the appropriate libraries.
16 So, use pkg-config to find libtirpc.
18 And for older libtirpc versions, there is no change in behaviour: we're
19 still missing the -lpthread. But once libtirpc has been fixed, we'll
20 automatically get that missing library for free! :-)
22 Remove the --with-libirpcinclude flag as it is no longer needed: pkg-config
23 will provide us with the -I and -L flags, now.
25 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
26 Cc: Steve Dickson <steved@redhat.com>
30 http://article.gmane.org/gmane.linux.nfs/67708
32 aclocal/libtirpc.m4 | 68 ++++++++++-------------------------------------------
33 1 file changed, 13 insertions(+), 55 deletions(-)
35 diff --git a/aclocal/libtirpc.m4 b/aclocal/libtirpc.m4
36 index b823364..4a19c1a 100644
37 --- a/aclocal/libtirpc.m4
38 +++ b/aclocal/libtirpc.m4
39 @@ -2,50 +2,19 @@ dnl Checks for TI-RPC library and headers
41 AC_DEFUN([AC_LIBTIRPC], [
43 - AC_ARG_WITH([tirpcinclude],
44 - [AC_HELP_STRING([--with-tirpcinclude=DIR],
45 - [use TI-RPC headers in DIR])],
46 - [tirpc_header_dir=$withval],
47 - [tirpc_header_dir=/usr/include/tirpc])
49 - dnl if --enable-tirpc was specifed, the following components
50 - dnl must be present, and we set up HAVE_ macros for them.
52 - if test "$enable_tirpc" != "no"; then
54 - dnl look for the library
55 - AC_CHECK_LIB([tirpc], [clnt_tli_create], [:],
56 - [if test "$enable_tirpc" = "yes"; then
57 - AC_MSG_ERROR([libtirpc not found.])
59 - AC_MSG_WARN([libtirpc not found. TIRPC disabled!])
64 - if test "$enable_tirpc" != "no"; then
65 - dnl also must have the headers installed where we expect
66 - dnl look for headers; add -I compiler option if found
67 - AC_CHECK_HEADERS([${tirpc_header_dir}/netconfig.h],
68 - AC_SUBST([AM_CPPFLAGS], ["-I${tirpc_header_dir}"]),
69 - [if test "$enable_tirpc" = "yes"; then
70 - AC_MSG_ERROR([libtirpc headers not found.])
72 - AC_MSG_WARN([libtirpc headers not found. TIRPC disabled!])
78 - dnl now set $LIBTIRPC accordingly
79 - if test "$enable_tirpc" != "no"; then
80 - AC_DEFINE([HAVE_LIBTIRPC], 1,
81 - [Define to 1 if you have and wish to use libtirpc.])
87 + PKG_PROG_PKG_CONFIG([0.9.0])
89 + [test "$enable_tirpc" != "no"],
90 + [PKG_CHECK_MODULES([TIRPC], [libtirpc >= 0.2.4],
91 + [LIBTIRPC="${TIRPC_LIBS}"
92 + AM_CPPFLAGS="${AM_CPPFLAGS} ${TIRPC_CFLAGS}"
93 + AC_DEFINE([HAVE_LIBTIRPC], [1],
94 + [Define to 1 if you have and wish to use libtirpc.])],
95 + [AS_IF([test "$enable_tirpc" = "yes"],
96 + [AC_MSG_ERROR([libtirpc not found.])],
99 + AC_SUBST([AM_CPPFLAGS])