]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
autoconf: only link binaries that need it to libtirpc nfs-utils-1-2-6-rc6
authorJeff Layton <jlayton@redhat.com>
Mon, 16 Jan 2012 19:39:25 +0000 (14:39 -0500)
committerSteve Dickson <steved@redhat.com>
Mon, 16 Jan 2012 19:40:21 +0000 (14:40 -0500)
This patch is essentially the same as the previous version, but has
been respun to fix up some merge conflicts with some of Chuck's
recent changes.

When we first added tirpc support, we took a "big hammer" approach, and
had it add libtirpc to $LIBS. That had the effect of making it so that
that library was linked into every binary. That's unnecessary, and
wasteful with memory.

Don't let AC_CHECK_LIB add -ltirpc to $LIBS. Instead, have the autoconf
tests set $(LIBTIRPC) in the makefiles, and have the programs that
need it explicitly include that library. In the event that we're not
using libtirpc, then set $LIBTIRPC to a blank string.

This necessitates a change to the bindresvport_sa check too. Since that
library is no longer included in $LIBS, we need to convert that check
to use AC_CHECK_LIB instead of AC_CHECK_FUNCS.

This patch also fixes a subtle bug. If the library was usable, but the
includes were not, the test would set $enable_tirpc to "no", but
HAVE_LIBTIRPC would still be true. That configuration would likely
fail to build.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
aclocal/ipv6.m4
aclocal/libtirpc.m4
tools/rpcgen/Makefile.am
utils/gssd/Makefile.am
utils/mount/Makefile.am
utils/mountd/Makefile.am
utils/nfsd/Makefile.am
utils/showmount/Makefile.am
utils/statd/Makefile.am

index 4e39fbe8cc3045ee0d991d8a3616bc84406c12e5..75a85826a4975032c3bf5548eeeda7339807ff81 100644 (file)
@@ -10,9 +10,11 @@ AC_DEFUN([AC_IPV6], [
     fi
 
     dnl IPv6-enabled networking functions required for IPv6
-    AC_CHECK_FUNCS([getifaddrs getnameinfo bindresvport_sa], ,
+    AC_CHECK_FUNCS([getifaddrs getnameinfo], ,
                    [AC_MSG_ERROR([Missing library functions needed for IPv6.])])
 
+    AC_CHECK_LIB([tirpc], [bindresvport_sa], [:],
+                [AC_MSG_ERROR([Missing library functions needed for IPv6.])])
   fi
 
 ])dnl
index 9f0fde0a6cb93fad7a6c31824b293717223e52a9..19b8361794854d0b616db61891e68aa1074cc7d3 100644 (file)
@@ -13,8 +13,8 @@ AC_DEFUN([AC_LIBTIRPC], [
 
   if test "$enable_tirpc" != "no"; then
 
-    dnl look for the library; add to LIBS if found
-    AC_CHECK_LIB([tirpc], [clnt_tli_create], ,
+    dnl look for the library
+    AC_CHECK_LIB([tirpc], [clnt_tli_create], [:],
                  [if test "$enable_tirpc" = "yes"; then
                        AC_MSG_ERROR([libtirpc not found.])
                  else
@@ -37,4 +37,15 @@ AC_DEFUN([AC_LIBTIRPC], [
 
   fi
 
+  dnl now set $LIBTIRPC accordingly
+  if test "$enable_tirpc" != "no"; then
+    AC_DEFINE([HAVE_LIBTIRPC], 1,
+              [Define to 1 if you have and wish to use libtirpc.])
+    LIBTIRPC="-ltirpc"
+  else
+    LIBTIRPC=""
+  fi
+
+  AC_SUBST(LIBTIRPC)
+
 ])dnl
index 51a2bfa006f63146588749f8a9db2e1753ebd7cb..8a9ec89cea76b1d74841d2d48e5e3f5265090c7b 100644 (file)
@@ -12,6 +12,7 @@ rpcgen_SOURCES = rpc_clntout.c rpc_cout.c rpc_hout.c rpc_main.c \
 rpcgen_CFLAGS=$(CFLAGS_FOR_BUILD)
 rpcgen_CPPLAGS=$(CPPFLAGS_FOR_BUILD)
 rpcgen_LDFLAGS=$(LDFLAGS_FOR_BUILD)
+rpcgen_LDADD=$(LIBTIRPC)
 
 MAINTAINERCLEANFILES = Makefile.in
 
index 9136189bb1d0c2d0f2de4de2d874cb0b36c1e75b..d29e132ab7191ed88ce625903c3afc651e4aca07 100644 (file)
@@ -40,7 +40,7 @@ gssd_SOURCES = \
 
 gssd_LDADD =   ../../support/nfs/libnfs.a \
                $(RPCSECGSS_LIBS) $(GSSGLUE_LIBS) $(KRBLIBS)
-gssd_LDFLAGS = $(KRBLDFLAGS)
+gssd_LDFLAGS = $(KRBLDFLAGS) $(LIBTIRPC)
 
 gssd_CFLAGS = $(AM_CFLAGS) $(CFLAGS) \
              $(RPCSECGSS_CFLAGS) $(GSSGLUE_CFLAGS) $(KRBCFLAGS)
@@ -59,7 +59,7 @@ svcgssd_SOURCES = \
 svcgssd_LDADD = \
        ../../support/nfs/libnfs.a \
        $(RPCSECGSS_LIBS) $(GSSGLUE_LIBS) $(LIBNFSIDMAP) \
-       $(KRBLIBS)
+       $(KRBLIBS) $(LIBTIRPC)
 
 svcgssd_LDFLAGS = $(KRBLDFLAGS)
 
index 7bc3e2bf5b00731289905b229dfc258612c95159..7627854f311f377c9dab7120e503d6e145bcf380 100644 (file)
@@ -24,7 +24,8 @@ EXTRA_DIST += nfsmount.conf
 endif
 
 mount_nfs_LDADD = ../../support/nfs/libnfs.a \
-                 ../../support/export/libexport.a
+                 ../../support/export/libexport.a \
+                 $(LIBTIRPC)
 
 mount_nfs_SOURCES = $(mount_common)
 
index 5a2d1b65b7d9deba0c12cfc7389faab272ce3545..7db968b91b702979a0f2b1f381d38e9ee2ce3916 100644 (file)
@@ -12,7 +12,7 @@ mountd_SOURCES = mountd.c mount_dispatch.c auth.c rmtab.c cache.c \
 mountd_LDADD = ../../support/export/libexport.a \
               ../../support/nfs/libnfs.a \
               ../../support/misc/libmisc.a \
-              $(LIBBSD) $(LIBWRAP) $(LIBNSL) $(LIBBLKID) $(LIBDL)
+              $(LIBBSD) $(LIBWRAP) $(LIBNSL) $(LIBBLKID) $(LIBDL) $(LIBTIRPC)
 mountd_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) \
                  -I$(top_builddir)/support/include \
                  -I$(top_srcdir)/support/export
index c4c6fb095d9e666d4d7de689b92a9f483e8420ac..1536065813afa5045cc205302d8d2f6dcb40c28c 100644 (file)
@@ -8,7 +8,7 @@ KPREFIX         = @kprefix@
 sbin_PROGRAMS  = nfsd
 
 nfsd_SOURCES = nfsd.c nfssvc.c
-nfsd_LDADD = ../../support/nfs/libnfs.a
+nfsd_LDADD = ../../support/nfs/libnfs.a $(LIBTIRPC)
 
 MAINTAINERCLEANFILES = Makefile.in
 
index 077b2c7a94f64b04b0bd92ee489257518eb99f75..4ba5ead572fc45d6f373aa50dbf7d1e4a8f81d6f 100644 (file)
@@ -7,7 +7,8 @@ sbin_PROGRAMS   = showmount
 showmount_SOURCES = showmount.c
 showmount_LDADD = ../../support/export/libexport.a \
                  ../../support/nfs/libnfs.a \
-                 ../../support/misc/libmisc.a
+                 ../../support/misc/libmisc.a \
+                 $(LIBTIRPC)
 showmount_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) \
                   -I$(top_builddir)/support/export
 
index 17447914aa69c3066e7dda1b1ae5fb376072bf37..dc2bfc4e3697a44f8fafa040db835b347f778cd0 100644 (file)
@@ -15,10 +15,10 @@ BUILT_SOURCES = $(GENFILES)
 statd_LDADD = ../../support/nsm/libnsm.a \
              ../../support/nfs/libnfs.a \
              ../../support/misc/libmisc.a \
-             $(LIBWRAP) $(LIBNSL) $(LIBCAP)
+             $(LIBWRAP) $(LIBNSL) $(LIBCAP) $(LIBTIRPC)
 sm_notify_LDADD = ../../support/nsm/libnsm.a \
                  ../../support/nfs/libnfs.a \
-                 $(LIBNSL) $(LIBCAP)
+                 $(LIBNSL) $(LIBCAP) $(LIBTIRPC)
 
 EXTRA_DIST = sim_sm_inter.x $(man8_MANS) COPYRIGHT simulate.c