tirpc: use pkg-config to find details
authorMike Frysinger <vapier@gentoo.org>
Sun, 18 Sep 2011 01:35:40 +0000 (11:35 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 19 Sep 2011 10:16:03 +0000 (20:16 +1000)
Hardcoding paths breaks cross-compiling, so use the pkg-config files
that libtirpc already provides.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
configure.ac
libnfs.pc.in

index 12b33cd5c71cb9858665527e5897d8121bcdd624..c9068313a751f57f9561213a9f14cb11d983df36 100644 (file)
@@ -11,6 +11,7 @@ AC_PROG_CC
 AC_PROG_LIBTOOL
 
 AM_PROG_CC_C_O
+PKG_PROG_PKG_CONFIG
 
 # Work around stupid autoconf default cflags. pt 2
 if test "$SAVE_CFLAGS" = "x"; then
@@ -71,12 +72,18 @@ AC_CHECK_MEMBER([struct sockaddr.sa_len],
 #include <sys/socket.h>
 ])
 
-echo "Use TI-RPC: $enable_tirpc"
+LIBNFS_PC_REQ_PRIVATE=
+
 if test "$enable_tirpc" = "yes"; then
-       CFLAGS="${CFLAGS} -I /usr/include/tirpc"
-       LDFLAGS="${LDFLAGS} -ltirpc"
+       PKG_CHECK_MODULES(TIRPC, libtirpc, [],
+               AC_MSG_ERROR([unable to locate libtirpc files]))
+       CFLAGS="${CFLAGS} ${TIRPC_CFLAGS}"
+       LIBS="${LIBS} ${TIRPC_LIBS}"
+       LIBNFS_PC_REQ_PRIVATE="${LIBNFS_PC_REQ_PRIVATE} libtirpc"
 fi
 
+AC_SUBST(LIBNFS_PC_REQ_PRIVATE)
+
 #output
 AC_CONFIG_FILES([Makefile]
                 [include/Makefile]
index fdc012c85aa4468eb59c9fa59585065c3cedad48..e7e3a913bb94dab36af1a67c71321691b42c3931 100644 (file)
@@ -12,3 +12,4 @@ Requires:
 Conflicts:
 Libs: -L${libdir} -lnfs
 Cflags: -I${includedir}
+Requires.private: @LIBNFS_PC_REQ_PRIVATE@