712f710c33739f099e0559946d8259f31f724e3b
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / nfs-utils / 0008-tirpc-with-pkgconfig.patch
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
5
6 Currently, we use a custom function to find libtirpc's headers and
7 libraries. This works fine for shared linking.
8
9 But for static linking, this forgets to link with -lpthread, which is
10 required by libtirpc.
11
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.
15
16 So, use pkg-config to find libtirpc.
17
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! :-)
21
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.
24
25 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
26 Cc: Steve Dickson <steved@redhat.com>
27
28 ---
29 Patch sent upstream:
30     http://article.gmane.org/gmane.linux.nfs/67708
31 ---
32  aclocal/libtirpc.m4 | 68 ++++++++++-------------------------------------------
33  1 file changed, 13 insertions(+), 55 deletions(-)
34
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
40  dnl
41  AC_DEFUN([AC_LIBTIRPC], [
42  
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])
48 -
49 -  dnl if --enable-tirpc was specifed, the following components
50 -  dnl must be present, and we set up HAVE_ macros for them.
51 -
52 -  if test "$enable_tirpc" != "no"; then
53 -
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.])
58 -                 else
59 -                       AC_MSG_WARN([libtirpc not found. TIRPC disabled!])
60 -                       enable_tirpc="no"
61 -                 fi])
62 -  fi
63 -
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.])
71 -                      else
72 -                        AC_MSG_WARN([libtirpc headers not found. TIRPC disabled!])
73 -                        enable_tirpc="no"
74 -                      fi])
75 -
76 -  fi
77 -
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.])
82 -    LIBTIRPC="-ltirpc"
83 -  else
84 -    LIBTIRPC=""
85 -  fi
86 -
87 +  PKG_PROG_PKG_CONFIG([0.9.0])
88 +  AS_IF(
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.])],
97 +                              [LIBTIRPC=""])])])
98 +
99 +  AC_SUBST([AM_CPPFLAGS])
100    AC_SUBST(LIBTIRPC)
101  
102  ])dnl