[RFC/PATCH 2/4] make yellow pages support optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If rpcsvc/ypclnt.h is not available don't compile in Yellow Pages
support.
---
I did wonder if this deserves an explicit --without-yp or --disable-yp
rather than checking for the presence of ypclnt.h. Also I can't see
anything in rpc_subs.c that actually uses anything defined in ypclnt.h
so perhaps a cleaner change for that file is to simply remove the
include.

I am unable to test that yp support still works with my change. I'll see
if I can set something up but if anyone has a setup that can test this
change that'd really help.

 Makefile.conf.in    |    3 +++
 configure           |   16 ++++++++++++++++
 configure.in        |    9 +++++++++
 include/config.h.in |    3 +++
 lib/rpc_subs.c      |    2 ++
 modules/Makefile    |    9 +++++++--
 6 files changed, 40 insertions(+), 2 deletions(-)

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 ba3bba6..d11b8a0 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 d33a3c4..6acc48d 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -27,7 +27,9 @@
 #include <net/if.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#ifdef HAVE_YPCLNT
 #include <rpcsvc/ypclnt.h>
+#endif
 #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
-- 
1.7.10.2.dirty

--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux