All of lore.kernel.org
 help / color / mirror / Atom feed
* fix cross-compile when libtirpc is used
@ 2017-06-27 19:22 Waldemar Brodkorb
  2017-06-28  0:17 ` Ian Kent
  0 siblings, 1 reply; 3+ messages in thread
From: Waldemar Brodkorb @ 2017-06-27 19:22 UTC (permalink / raw)
  To: autofs

[-- Attachment #1: Type: text/plain, Size: 230 bytes --]

Hi,

I would like to suggest following patch, which uses pkg-config
to find libtirpc headers and libraries.
This allows to cross-compile autofs. The patch was suggested 
on the buildroot mailinglist, too.

Best regards
 Waldemar


[-- Attachment #2: 0002-use-pkg-config-to-search-for-libtirpc-to-fix-cross-c.patch --]
[-- Type: text/x-diff, Size: 3447 bytes --]

From 7582cb88121d1ca4431def9175469e1590e9c29f Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Tue, 27 Jun 2017 18:11:56 +0200
Subject: [PATCH] use pkg-config to search for libtirpc to fix
 cross-compilation

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 Makefile.conf.in |  3 ++-
 Makefile.rules   |  2 +-
 aclocal.m4       | 48 ------------------------------------------------
 configure.in     | 11 +++++++++--
 4 files changed, 12 insertions(+), 52 deletions(-)

diff --git a/Makefile.conf.in b/Makefile.conf.in
index 2bc3202..f879e26 100644
--- a/Makefile.conf.in
+++ b/Makefile.conf.in
@@ -64,7 +64,8 @@ RPCGEN = @PATH_RPCGEN@
 RANLIB = @PATH_RANLIB@
 
 # Use libtirpc if requested and available
-TIRPCLIB = @TIRPCLIB@
+TIRPCLIB = @TIRPC_LIBS@
+TIRPCCFLAGS = @TIRPC_CFLAGS@
 
 # Use dmalloc for memory debuging
 DMALLOCLIB = @DMALLOCLIB@
diff --git a/Makefile.rules b/Makefile.rules
index 7d1af2e..0edf9bf 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -46,7 +46,7 @@ CFLAGS += -D_REENTRANT -D_FILE_OFFSET_BITS=64
 LIBS += -lpthread
 
 ifdef TIRPCLIB
-CFLAGS += -I/usr/include/tirpc
+CFLAGS += $(TIRPCCFLAGS)
 LIBS += $(TIRPCLIB)
 endif
 
diff --git a/aclocal.m4 b/aclocal.m4
index 00811e0..31ca602 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -399,51 +399,3 @@ fi
 LIBS="$af_check_ldap_parse_page_control_save_libs"
 ])
 
-dnl --------------------------------------------------------------------------
-dnl AF_CHECK_LIBTIRPC
-dnl
-dnl Use libtirpc for rpc transport
-dnl --------------------------------------------------------------------------
-AC_DEFUN([AF_CHECK_LIBTIRPC],
-[
-# save current flags
-af_check_libtirpc_save_cflags="$CFLAGS"
-af_check_libtirpc_save_libs="$LIBS"
-CFLAGS="$CFLAGS -I/usr/include/tirpc"
-LIBS="$LIBS -ltirpc"
-
-AC_TRY_LINK(
-    [ #include <rpc/rpc.h> ],
-    [ CLIENT *cl;
-      struct sockaddr_in addr;
-      int fd;
-      unsigned long ul; struct timeval t; unsigned int ui;
-      cl = clntudp_bufcreate(&addr,ul,ul,t,&fd,ui,ui); ],
-    [ af_have_libtirpc=yes
-      AC_MSG_RESULT(yes) ],
-    [ AC_MSG_RESULT(no) ])
-
-if test "$af_have_libtirpc" = "yes"; then
-    AC_DEFINE(WITH_LIBTIRPC,1, [Define to 1 if you have the libtirpc library installed])
-    AC_DEFINE(TIRPC_WORKAROUND,1, [Define to 1 to use the libtirpc tsd usage workaround])
-    TIRPCLIB="-ltirpc"
-fi
-
-AC_CHECK_FUNCS([getrpcbyname getservbyname])
-
-# restore flags
-CFLAGS="$af_check_libtirpc_save_cflags"
-LIBS="$af_check_libtirpc_save_libs"
-])
-
-AC_DEFUN([AF_WITH_LIBTIRPC],
-[AC_MSG_CHECKING([if libtirpc is requested and available])
-AC_ARG_WITH(libtirpc,
-[  --with-libtirpc         use libtirpc if available],
-[if test "$withval" = yes; then
-  AF_CHECK_LIBTIRPC()
-else
-  AC_MSG_RESULT(no)
-fi], [AC_MSG_RESULT(no)])
-])
-
diff --git a/configure.in b/configure.in
index 0521252..43a2776 100644
--- a/configure.in
+++ b/configure.in
@@ -11,6 +11,9 @@ define([AC_CACHE_LOAD], )dnl
 define([AC_CACHE_SAVE], )dnl
 AC_INIT(.autofs-5.1.3)
 
+# for pkg-config/pkconf
+m4_include([pkg.m4])
+
 #
 # autofs installs by default in /usr
 #
@@ -124,8 +127,12 @@ AC_SUBST(flagdir)
 #
 # Use libtirpc
 #
-AF_WITH_LIBTIRPC()
-AC_SUBST(TIRPCLIB)
+PKG_PROG_PKG_CONFIG()
+
+AC_ARG_WITH([libtirpc], AS_HELP_STRING([--with-libtirpc], [Build with the TIRPC library]))
+if test "x$with_libtirpc" = "xyes"; then
+  PKG_CHECK_MODULES([TIRPC],[libtirpc])
+fi
 
 #
 # Optional include dmalloc
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: fix cross-compile when libtirpc is used
  2017-06-27 19:22 fix cross-compile when libtirpc is used Waldemar Brodkorb
@ 2017-06-28  0:17 ` Ian Kent
  2017-06-28  0:26   ` Ian Kent
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Kent @ 2017-06-28  0:17 UTC (permalink / raw)
  To: Waldemar Brodkorb, autofs

On Tue, 2017-06-27 at 21:22 +0200, Waldemar Brodkorb wrote:
> Hi,
> 
> I would like to suggest following patch, which uses pkg-config
> to find libtirpc headers and libraries.
> This allows to cross-compile autofs. The patch was suggested 
> on the buildroot mailinglist, too.

Where is the patch description?
What happens if a pkg config package is not installed?

And how are WITH_LIBTIRPC and TIRPC_WORKAROUND defined?

Ian
--
To unsubscribe from this list: send the line "unsubscribe autofs" in

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: fix cross-compile when libtirpc is used
  2017-06-28  0:17 ` Ian Kent
@ 2017-06-28  0:26   ` Ian Kent
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Kent @ 2017-06-28  0:26 UTC (permalink / raw)
  To: Waldemar Brodkorb, autofs

On Wed, 2017-06-28 at 08:17 +0800, Ian Kent wrote:
> On Tue, 2017-06-27 at 21:22 +0200, Waldemar Brodkorb wrote:
> > Hi,
> > 
> > I would like to suggest following patch, which uses pkg-config
> > to find libtirpc headers and libraries.
> > This allows to cross-compile autofs. The patch was suggested 
> > on the buildroot mailinglist, too.
> 
> Where is the patch description?
> What happens if a pkg config package is not installed?
> 
> And how are WITH_LIBTIRPC and TIRPC_WORKAROUND defined?

And another small detail.

[raven@pluto autofs-dev.git]$ make configure
autoconf
/usr/bin/m4:configure.in:15: cannot open `pkg.m4': No such file or directory
autom4te: /usr/bin/m4 failed with exit status: 1
Makefile:52: recipe for target 'configure' failed
make: *** [configure] Error 1


--
To unsubscribe from this list: send the line "unsubscribe autofs" in

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-28  0:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 19:22 fix cross-compile when libtirpc is used Waldemar Brodkorb
2017-06-28  0:17 ` Ian Kent
2017-06-28  0:26   ` Ian Kent

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.