Blob Blame History Raw
autofs-5.0.7 - make yellow pages support optional

From: Chris Packham <chris.packham@alliedtelesis.co.nz>

If rpcsvc/ypclnt.h is not available don't compile in Yellow Pages
support.
---

 CHANGELOG           |    1 +
 Makefile.conf.in    |    3 +++
 configure           |   16 ++++++++++++++++
 configure.in        |    9 +++++++++
 include/config.h.in |    3 +++
 lib/rpc_subs.c      |    1 -
 modules/Makefile    |    9 +++++++--
 7 files changed, 39 insertions(+), 3 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 1130db6..ed17163 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -25,6 +25,7 @@
 - don't schedule new alarms after readmap.
 - use numeric protocol ids instead of protoent structs.
 - lib/defaults.c: use WITH_LDAP conditional around LDAP types.
+- make yellow pages support optional.
 
 25/07/2012 autofs-5.0.7
 =======================
diff --git a/Makefile.conf.in b/Makefile.conf.in
index 802318b..3766d45 100644
--- a/Makefile.conf.in
+++ b/Makefile.conf.in
@@ -43,6 +43,9 @@ NISPLUS = @HAVE_NISPLUS@
 # SMBFS support: yes (1) no (0)
 SMBFS = @HAVE_SMBMOUNT@
 
+# YellowPages support: yes (1) no (0)
+YPCLNT = @HAVE_YPCLNT@
+
 # Support for calling e2fsck when mounting ext2 filesystems
 EXT2FS = @HAVE_E2FSCK@
 
diff --git a/configure b/configure
index 3722a46..cf6428c 100755
--- a/configure
+++ b/configure
@@ -614,6 +614,7 @@ XML_FLAGS
 LIBLDAP
 HAVE_LDAP
 LDAP_FLAGS
+HAVE_YPCLNT
 HAVE_NISPLUS
 EGREP
 GREP
@@ -4575,6 +4576,21 @@ fi
 
 
 
+# YellowPages support?
+HAVE_YPCLNT=0
+ac_fn_c_check_header_mongrel "$LINENO" "rpcsvc/ypclnt.h" "ac_cv_header_rpcsvc_ypclnt_h" "$ac_includes_default"
+if test "x$ac_cv_header_rpcsvc_ypclnt_h" = xyes; then :
+  HAVE_YPCLNT=1
+fi
+
+
+
+if test "$HAVE_YPCLNT" = "1"; then
+
+$as_echo "#define HAVE_YPCLNT 1" >>confdefs.h
+
+fi
+
 #
 # OpenLDAP support?  Expect that this may have a special directory...
 #
diff --git a/configure.in b/configure.in
index 90bda62..363c376 100644
--- a/configure.in
+++ b/configure.in
@@ -213,6 +213,15 @@ HAVE_NISPLUS=0
 AC_CHECK_HEADER(rpcsvc/nis.h, HAVE_NISPLUS=1)
 AC_SUBST(HAVE_NISPLUS)
 
+# YellowPages support?
+HAVE_YPCLNT=0
+AC_CHECK_HEADER([rpcsvc/ypclnt.h], HAVE_YPCLNT=1)
+AC_SUBST(HAVE_YPCLNT)
+if test "$HAVE_YPCLNT" = "1"; then
+	AC_DEFINE(HAVE_YPCLNT, 1,
+		[Define if using YellowPages])
+fi
+
 #
 # OpenLDAP support?  Expect that this may have a special directory...
 #
diff --git a/include/config.h.in b/include/config.h.in
index 9bdf98a..7f1c5b5 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -72,6 +72,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define if using YellowPages */
+#undef HAVE_YPCLNT
+
 /* Use libxml2 tsd usage workaround */
 #undef LIBXML2_WORKAROUND
 
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index ad1d557..718caf9 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -27,7 +27,6 @@
 #include <net/if.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <rpcsvc/ypclnt.h>
 #include <errno.h>
 #include <sys/ioctl.h>
 #include <ctype.h>
diff --git a/modules/Makefile b/modules/Makefile
index 939da7c..c5deb24 100644
--- a/modules/Makefile
+++ b/modules/Makefile
@@ -5,13 +5,13 @@
 -include ../Makefile.conf
 include ../Makefile.rules
 
-SRCS :=	lookup_yp.c  lookup_file.c lookup_program.c  lookup_userhome.c \
+SRCS :=	lookup_file.c lookup_program.c  lookup_userhome.c \
 	lookup_multi.c lookup_hosts.c lookup_dir.c \
 	parse_sun.c    \
 	mount_generic.c  mount_nfs.c  mount_afs.c  mount_autofs.c \
 	mount_changer.c  mount_bind.c
 
-MODS :=	lookup_yp.so lookup_file.so lookup_program.so lookup_userhome.so \
+MODS :=	lookup_file.so lookup_program.so lookup_userhome.so \
 	lookup_multi.so lookup_hosts.so lookup_dir.so \
 	parse_sun.so \
 	mount_generic.so mount_nfs.so mount_afs.so mount_autofs.so \
@@ -37,6 +37,11 @@ ifeq ($(NISPLUS), 1)
   MODS += lookup_nisplus.so
 endif
 
+ifeq ($(YPCLNT), 1)
+  SRCS += lookup_yp.c
+  MODS += lookup_yp.so
+endif
+
 ifeq ($(LDAP), 1)
   SRCS += lookup_ldap.c
   MODS += lookup_ldap.so