Skip to contentSkip to conversation

use pkg-config to search for libtirpc to fix cross-compilation

PATCH In review Waldemar Brodkorb 2 participants 3 messages Jun 30, 2017 – Jul 7, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 use pkg-config to search for libtirpc to fix cross-compilation

When trying to cross-compile autofs for example with a buildsystem like buildroot, the compilation fails in case the user wants to use libtirpc library as RPC implementation. A hard coded include path in aclocal.m4 is used. Other opensource software like rpcbind or nfs-utils are suing autotools pkgconfig infrastructure to find the libtirpc headers and to pass the correct linker flags.

Convert configure.in to use PKG_CHECK_MODULES and remove the hand written autoconf macros from aclocal.m4. Move aclocal.m4 to m4 directory, so that autoconf does not skip global directories, otherwise pkg.m4 (pkg-config macros) are not found.

This fixes cross-compilation of autofs and allows to use alternative C libraries as uClibc-ng without internal RPC support to be used in cross-compiling environments.

---
v1 -> v2:
- add a better commit decription
- add back missing TIRPC_WORKAROUND/WITH_LIBTIRPC defines
- add back AC_CHECK_FUNCS([getrpcbyname getservbyname])
v2 -> v3:
- move aclocal.m4 to m4 directory and remove m4_include

---
 Makefile.conf.in    |   3 +-
 Makefile.rules      |   2 +-
 aclocal.m4          | 449 ----------------------------------------------------
 configure.in        |  14 +-
 m4/autofs-macros.m4 | 401 ++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 416 insertions(+), 453 deletions(-)
 delete mode 100644 aclocal.m4
 create mode 100644 m4/autofs-macros.m4
Makefile.conf.in +2 -1
index 2bc3202..f879e26 100644
@@ -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@
Makefile.rules +1 -1
index 7d1af2e..0edf9bf 100644
@@ -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
 
aclocal.m4 deleted +0 -449

449 lines not on this page · raw message

configure.in +12 -2
index 0521252..16653ed 100644
@@ -11,6 +11,7 @@ define([AC_CACHE_LOAD], )dnl
 define([AC_CACHE_SAVE], )dnl
 AC_INIT(.autofs-5.1.3)
 
+AC_CONFIG_MACRO_DIR([m4])
 #
 # autofs installs by default in /usr
 #
@@ -124,8 +125,17 @@ AC_SUBST(flagdir)
 #
 # Use libtirpc
 #
-AF_WITH_LIBTIRPC()
-AC_SUBST(TIRPCLIB)
+PKG_PROG_PKG_CONFIG()
+AC_ARG_WITH([libtirpc], AS_HELP_STRING([--with-libtirpc], [use libtirpc if available]))
+if test "x$with_libtirpc" = "xyes"; then
+  PKG_CHECK_MODULES([TIRPC],[libtirpc],[
+		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])
+    ])
+  AC_CHECK_FUNCS([getrpcbyname getservbyname])
+fi
 
 #
 # Optional include dmalloc
m4/autofs-macros.m4 new file +401 -0

401 lines not on this page · raw message

Signature · 4 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe autofs" in
#1 lore raw

Hi,

friendly ping?

Quoted 7 lines

When trying to cross-compile autofs for example with a buildsystem like buildroot, the compilation fails in case the user wants to use libtirpc library as RPC implementation. A hard coded include path in aclocal.m4 is used. Other opensource software like rpcbind or nfs-utils are suing autotools pkgconfig infrastructure to find the libtirpc headers and to pass the correct linker flags.

Quoted 8 lines

Convert configure.in to use PKG_CHECK_MODULES and remove the hand written autoconf macros from aclocal.m4. Move aclocal.m4 to m4 directory, so that autoconf does not skip global directories, otherwise pkg.m4 (pkg-config macros) are not found.

This fixes cross-compilation of autofs and allows to use alternative C libraries as uClibc-ng without internal RPC support to be used in cross-compiling environments.

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

maintainer
#2 lore raw
Quoted 3 lines · Waldemar Brodkorb

Hi,

friendly ping?

Oh right, I didn't say what's happening.

The patch is in my patch queue.

I'll get to committing what I have in the queue fairly soon.

There were a couple of bugs in the 5.1.3 release that need to be fixed.
So another release will be done sooner rather than later as well, can't say exactly when but I'd like to do it fairly soon.

Quoted 8 lines
Quoted 8 lines

When trying to cross-compile autofs for example with a buildsystem like buildroot, the compilation fails in case the user wants to use libtirpc library as RPC implementation. A hard coded include path in aclocal.m4 is used. Other opensource software like rpcbind or nfs-utils are suing autotools pkgconfig infrastructure to find the libtirpc headers and to pass the correct linker flags.

Quoted 8 lines
Quoted 8 lines

Convert configure.in to use PKG_CHECK_MODULES and remove the hand written autoconf macros from aclocal.m4. Move aclocal.m4 to m4 directory, so that autoconf does not skip global directories, otherwise pkg.m4 (pkg-config macros) are not found.

This fixes cross-compilation of autofs and allows to use alternative C libraries as uClibc-ng without internal RPC support to be used in cross-compiling environments.

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