[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patches] OPTION_EGLIBC_INET work-in-progress
- To: patches@xxxxxxxxxx
- Subject: [patches] OPTION_EGLIBC_INET work-in-progress
- From: Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
- Date: Fri, 13 Apr 2007 18:06:33 -0700
Here's a dump of the patch I'm playing with at the moment for making
network support into an EGLIBC option group. Comments welcome.
I'm intending to make the C preprocessor symbol tie-ins more
consistent: the symbol will always be named OPTION_EGLIBC_INET,
instead of something ad-hoc. I also have some nsswitch build issues
remaining to work through.
I'm hoping this won't conflict with the recent changes to nss from the
upstream sources.
Index: nscd/Makefile
===================================================================
--- nscd/Makefile (revision 1902)
+++ nscd/Makefile (working copy)
@@ -20,10 +20,13 @@
#
# Sub-makefile for nscd portion of the library.
#
+include ../option-groups.mak
+
subdir := nscd
-routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai nscd_initgroups
-aux := nscd_helper
+routines-$(OPTION_EGLIBC_INET) += \
+ nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai nscd_initgroups
+aux-$(OPTION_EGLIBC_INET) += nscd_helper
include ../Makeconfig
@@ -38,11 +41,11 @@
ifeq ($(have-thread-library),yes)
ifneq (yesyes,$(have-fpie)$(build-shared))
-others += nscd
+others-$(OPTION_EGLIBC_INET) += nscd
endif
-install-sbin := nscd
+install-sbin-$(OPTION_EGLIBC_INET) += nscd
-extra-objs := $(nscd-modules:=.o)
+extra-objs-$(OPTION_EGLIBC_INET) += $(nscd-modules:=.o)
endif
Index: sysdeps/unix/sysv/linux/Makefile
===================================================================
--- sysdeps/unix/sysv/linux/Makefile (revision 1902)
+++ sysdeps/unix/sysv/linux/Makefile (working copy)
@@ -15,8 +15,11 @@
sysdep_routines += sysctl clone llseek umount umount2 readahead \
setfsuid setfsgid makedev
-CFLAGS-gethostid.c = -fexceptions
+inet-CFLAGS-$(OPTION_EGLIBC_INET) = -DOPTION_EGLIBC_INET
+
+CFLAGS-gethostid.c = -fexceptions $(inet-CFLAGS-y)
+
sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
sys/klog.h sys/kdaemon.h \
sys/user.h sys/procfs.h sys/prctl.h \
Index: sysdeps/unix/sysv/linux/gethostid.c
===================================================================
--- sysdeps/unix/sysv/linux/gethostid.c (revision 1902)
+++ sysdeps/unix/sysv/linux/gethostid.c (working copy)
@@ -91,6 +91,7 @@
return id;
}
+#ifdef OPTION_EGLIBC_INET
/* Getting from the file was not successful. An intelligent guess for
a unique number of a host is its IP address. Return this. */
if (__gethostname (hostname, MAXHOSTNAMELEN) < 0 || hostname[0] == '\0')
@@ -117,5 +118,9 @@
/* For the return value to be not exactly the IP address we do some
bit fiddling. */
return (int32_t) (in.s_addr << 16 | in.s_addr >> 16);
+#else
+ /* Return an arbitrary value. */
+ return 0;
+#endif
}
#endif
Index: pwd/Makefile
===================================================================
--- pwd/Makefile (revision 1902)
+++ pwd/Makefile (working copy)
@@ -19,6 +19,8 @@
#
# Sub-makefile for pwd portion of the library.
#
+include ../option-groups.mak
+
subdir := pwd
headers := pwd.h
@@ -32,8 +34,10 @@
ifeq ($(have-thread-library),yes)
-CFLAGS-getpwuid_r.c = -DUSE_NSCD=1
-CFLAGS-getpwnam_r.c = -DUSE_NSCD=1
+nscd-CFLAGS-$(OPTION_EGLIBC_INET) = -DUSE_NSCD=1
+
+CFLAGS-getpwuid_r.c = $(nscd-CFLAGS-y)
+CFLAGS-getpwnam_r.c = $(nscd-CFLAGS-y)
CFLAGS-getpwent_r.c = -fexceptions
CFLAGS-getpwent.c = -fexceptions
CFLAGS-getpw.c = -fexceptions
Index: misc/Makefile
===================================================================
--- misc/Makefile (revision 1902)
+++ misc/Makefile (working copy)
@@ -19,6 +19,7 @@
#
# Sub-makefile for misc portion of the library.
#
+include ../option-groups.mak
subdir := misc
Index: inet/Makefile
===================================================================
--- inet/Makefile (revision 1902)
+++ inet/Makefile (working copy)
@@ -19,6 +19,8 @@
#
# Sub-makefile for inet portion of the library.
#
+include ../option-groups.mak
+
subdir := inet
headers := netinet/ether.h netinet/in.h netinet/in_systm.h \
@@ -28,7 +30,8 @@
distribute := netgroup.h
-routines := htonl htons \
+routines-$(OPTION_EGLIBC_INET) \
+ += htonl htons \
inet_lnaof inet_mkadr \
inet_netof inet_ntoa inet_net herrno herrno-loc \
gethstbyad gethstbyad_r gethstbynm gethstbynm2 gethstbynm2_r \
@@ -49,7 +52,7 @@
getipv4sourcefilter setipv4sourcefilter \
getsourcefilter setsourcefilter inet6_opt inet6_rth
-aux := check_pf ifreq
+aux-$(OPTION_EGLIBC_INET) += check_pf ifreq
tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \
tst-gethnm test-ifaddrs bug-if1
@@ -58,11 +61,13 @@
ifeq ($(have-thread-library),yes)
-CFLAGS-gethstbyad_r.c = -DUSE_NSCD=1 -fexceptions
+nscd-CFLAGS-$(OPTION_EGLIBC_INET) = -DUSE_NSCD=1
+
+CFLAGS-gethstbyad_r.c = $(nscd-CFLAGS-y) -fexceptions
CFLAGS-gethstbyad.c = -fexceptions
-CFLAGS-gethstbynm_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbynm_r.c = $(nscd-CFLAGS-y) -fexceptions
CFLAGS-gethstbynm.c = -fexceptions
-CFLAGS-gethstbynm2_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbynm2_r.c = $(nscd-CFLAGS-y) -fexceptions
CFLAGS-gethstbynm2.c = -fexceptions
CFLAGS-gethstent_r.c = -fexceptions
CFLAGS-gethstent.c = -fexceptions
Index: nss/getnssent_r.c
===================================================================
--- nss/getnssent_r.c (revision 1902)
+++ nss/getnssent_r.c (working copy)
@@ -60,11 +60,13 @@
} fct;
int no_more;
+#if OPTION_EGLIBC_INET
if (res && __res_maybe_init (&_res, 0) == -1)
{
__set_h_errno (NETDB_INTERNAL);
return;
}
+#endif /* OPTION_EGLIBC_INET */
/* Cycle through the services and run their `setXXent' functions until
we find an available service. */
@@ -103,11 +105,13 @@
} fct;
int no_more;
+#ifdef OPTION_EGLIBC_INET
if (res && __res_maybe_init (&_res, 0) == -1)
{
__set_h_errno (NETDB_INTERNAL);
return;
}
+#endif /* OPTION_EGLIBC_INET */
/* Cycle through all the services and run their endXXent functions. */
no_more = setup (func_name, lookup_fct, &fct.ptr, nip, startp, 1);
@@ -143,12 +147,14 @@
int no_more;
enum nss_status status;
+#ifdef OPTION_EGLIBC_INET
if (res && __res_maybe_init (&_res, 0) == -1)
{
*h_errnop = NETDB_INTERNAL;
*result = NULL;
return errno;
}
+#endif /* OPTION_EGLIBC_INET */
/* Initialize status to return if no more functions are found. */
status = NSS_STATUS_NOTFOUND;
@@ -163,7 +169,7 @@
int is_last_nip = *nip == *last_nip;
status = DL_CALL_FCT (fct.f,
- (resbuf, buffer, buflen, &errno, &h_errno));
+ (resbuf, buffer, buflen, &errno, h_errnop));
/* The the status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
provided buffer is too small. In this case we should give
Index: nss/Makefile
===================================================================
--- nss/Makefile (revision 1902)
+++ nss/Makefile (working copy)
@@ -19,6 +19,8 @@
#
# Makefile for name service switch.
#
+include ../option-groups.mak
+
subdir := nss
headers := nss.h
@@ -27,20 +29,22 @@
nsswitch.conf digits_dots.c function.def
# This is the trivial part which goes into libc itself.
-routines = nsswitch getnssent getnssent_r digits_dots \
- $(addsuffix -lookup,$(databases))
+routines-y = nsswitch getnssent getnssent_r \
+ $(addsuffix -lookup,$(databases-y))
+routines-$(OPTION_EGLIBC_INET) += digits_dots
# These are the databases that go through nss dispatch.
# Caution: if you add a database here, you must add its real name
# in databases.def, too.
-databases = proto service hosts network grp pwd rpc ethers \
- spwd netgrp key alias
-
+databases-y = grp pwd spwd
+databases-$(OPTION_EGLIBC_INET) \
+ += proto service hosts network rpc ethers \
+ netgrp key alias
others := getent
install-bin := getent
-tests = test-netdb
-xtests = bug-erange
+tests-$(OPTION_EGLIBC_INET) += test-netdb
+xtests-$(OPTION_EGLIBC_INET) += bug-erange
include ../Makeconfig
@@ -62,7 +66,7 @@
vpath %.c $(subdir-dirs)
-libnss_files-routines := $(addprefix files-,$(databases))
+libnss_files-routines := $(addprefix files-,$(databases-y))
distribute += files-XXX.c files-parse.c
@@ -83,3 +87,9 @@
# a statically-linked program that hasn't already loaded it.
$(services:%=$(objpfx)libnss_%.so): $(common-objpfx)libc.so \
$(common-objpfx)libc_nonshared.a
+
+OPTION_EGLIBC_INET-CFLAGS-$(OPTION_EGLIBC_INET) = -DOPTION_EGLIBC_INET=1
+
+CFLAGS-nsswitch.c = $(OPTION_EGLIBC_INET-CFLAGS-y)
+CFLAGS-getnssent_r.c = $(OPTION_EGLIBC_INET-CFLAGS-y)
+CFLAGS-getent.c = $(OPTION_EGLIBC_INET-CFLAGS-y)
Index: nss/nsswitch.c
===================================================================
--- nss/nsswitch.c (revision 1902)
+++ nss/nsswitch.c (working copy)
@@ -700,6 +700,7 @@
}
+#ifdef OPTION_EGLIBC_INET
/* Called by nscd and nscd alone. */
void
__nss_disable_nscd (void)
@@ -709,6 +710,7 @@
__nss_not_use_nscd_group = -1;
__nss_not_use_nscd_hosts = -1;
}
+#endif /* OPTION_EGLIBC_INET */
/* Free all resources if necessary. */
Index: nss/getent.c
===================================================================
--- nss/getent.c (revision 1902)
+++ nss/getent.c (working copy)
@@ -88,6 +88,7 @@
fprintf (stream, gettext ("Written by %s.\n"), "Thorsten Kukuk");
}
+#ifdef OPTION_EGLIBC_INET
/* This is for aliases */
static inline void
print_aliases (struct aliasent *alias)
@@ -176,6 +177,7 @@
return result;
}
+#endif /* OPTION_EGLIBC_INET */
/* This is for group */
static inline void
@@ -234,6 +236,7 @@
return result;
}
+#ifdef OPTION_EGLIBC_INET
/* This is for hosts */
static void
print_hosts (struct hostent *host)
@@ -469,6 +472,7 @@
return result;
}
+#endif /* OPTION_EGLIBC_INET */
/* Now is all for passwd */
static inline void
@@ -521,6 +525,7 @@
return result;
}
+#ifdef OPTION_EGLIBC_INET
/* This is for protocols */
static inline void
print_protocols (struct protoent *proto)
@@ -672,6 +677,7 @@
return result;
}
+#endif /* OPTION_EGLIBC_INET */
/* This is for shadow */
static void
@@ -738,19 +744,24 @@
} databases[] =
{
#define D(name) { #name, name ## _keys },
-D(ahosts)
-D(ahostsv4)
-D(ahostsv6)
-D(aliases)
-D(ethers)
+#ifdef OPTION_EGLIBC_INET
+#define DN(name) D(name)
+#else
+#define DN(name)
+#endif
+DN(ahosts)
+DN(ahostsv4)
+DN(ahostsv6)
+DN(aliases)
+DN(ethers)
D(group)
-D(hosts)
-D(netgroup)
-D(networks)
+DN(hosts)
+DN(netgroup)
+DN(networks)
D(passwd)
-D(protocols)
-D(rpc)
-D(services)
+DN(protocols)
+DN(rpc)
+DN(services)
D(shadow)
#undef D
{ NULL, NULL }
Index: hesiod/Makefile
===================================================================
--- hesiod/Makefile (revision 1902)
+++ hesiod/Makefile (working copy)
@@ -19,12 +19,14 @@
#
# Sub-makefile for hesiod portion of the library.
#
+include ../option-groups.mak
+
subdir := hesiod
distribute := hesiod.h hesiod_p.h README.hesiod nss_hesiod/nss_hesiod.h
-extra-libs := libnss_hesiod
-extra-libs-others = $(extra-libs)
+extra-libs-$(OPTION_EGLIBC_INET) += libnss_hesiod
+extra-libs-others-y += $(extra-libs-y)
subdir-dirs = nss_hesiod
vpath %.c nss_hesiod
Index: grp/Makefile
===================================================================
--- grp/Makefile (revision 1902)
+++ grp/Makefile (working copy)
@@ -19,6 +19,8 @@
#
# Sub-makefile for grp portion of the library.
#
+include ../option-groups.mak
+
subdir := grp
headers := grp.h
@@ -47,14 +49,16 @@
ifeq ($(have-thread-library),yes)
-CFLAGS-getgrgid_r.c = -DUSE_NSCD=1 -fexceptions
-CFLAGS-getgrnam_r.c = -DUSE_NSCD=1 -fexceptions
+nscd-CFLAGS-$(OPTION_EGLIBC_INET) = -DUSE_NSCD=1
+
+CFLAGS-getgrgid_r.c = $(nscd-CFLAGS-y) -fexceptions
+CFLAGS-getgrnam_r.c = $(nscd-CFLAGS-y) -fexceptions
CFLAGS-getgrent_r.c = -fexceptions
CFLAGS-getgrent.c = -fexceptions
CFLAGS-fgetgrent.c = -fexceptions
CFLAGS-fgetgrent_r.c = -fexceptions -D_IO_MTSAFE_IO
CFLAGS-putgrent.c = -fexceptions -D_IO_MTSAFE_IO
-CFLAGS-initgroups.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-initgroups.c = $(nscd-CFLAGS-y) -fexceptions
CFLAGS-getgrgid.c = -fexceptions
endif
Index: option-groups.mak
===================================================================
--- option-groups.mak (revision 1902)
+++ option-groups.mak (working copy)
@@ -14,12 +14,15 @@
# defaults from option-groups.defaults.
-include $(option_group_config_file)
-# Establish 'routines-y', etc. as simply expanded variables.
-routines-y :=
-others-y :=
-install-bin-y :=
-install-sbin-y :=
-extra-objs-y :=
-tests-y :=
-xtests-y :=
-test-srcs-y :=
+# Establish 'routines-y', etc. as simply-expanded variables.
+routines-y :=
+aux-y :=
+others-y :=
+extra-libs-y :=
+extra-libs-others-y :=
+install-bin-y :=
+install-sbin-y :=
+extra-objs-y :=
+tests-y :=
+xtests-y :=
+test-srcs-y :=
Index: Makerules
===================================================================
--- Makerules (revision 1902)
+++ Makerules (working copy)
@@ -407,6 +407,7 @@
# Include targets in the selected option groups.
routines += $(routines-y)
+aux += $(aux-y)
others += $(others-y)
extra-libs += $(extra-libs-y)
extra-libs-others += $(extra-libs-others-y)
Index: socket/Makefile
===================================================================
--- socket/Makefile (revision 1902)
+++ socket/Makefile (working copy)
@@ -19,6 +19,8 @@
#
# Sub-makefile for socket portion of the library.
#
+include ../option-groups.mak
+
subdir := socket
headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
Index: option-groups.defaults
===================================================================
--- option-groups.defaults (revision 1902)
+++ option-groups.defaults (working copy)
@@ -11,3 +11,4 @@
OPTION_EGLIBC_CATGETS = y
OPTION_EGLIBC_LOCALES = y
OPTION_EGLIBC_LIBM = y
+OPTION_EGLIBC_INET = y
Index: extra-lib.mk
===================================================================
--- extra-lib.mk (revision 1902)
+++ extra-lib.mk (working copy)
@@ -25,7 +25,9 @@
extra-objs := $(extra-objs)
# The modules that go in $(lib).
-all-$(lib)-routines := $($(lib)-routines) $($(lib)-sysdep_routines)
+all-$(lib)-routines := $($(lib)-routines) \
+ $($(lib)-routines-y) \
+ $($(lib)-sysdep_routines)
# Add each flavor of library to the lists of things to build and install.
install-lib += $(foreach o,$(object-suffixes-$(lib)),$(lib:lib%=$(libtype$o)))
Index: nptl/Makefile
===================================================================
--- nptl/Makefile (revision 1902)
+++ nptl/Makefile (working copy)
@@ -112,7 +112,7 @@
pt-raise pt-system \
flockfile ftrylockfile funlockfile \
sigaction \
- herrno res pt-allocrtsig \
+ pt-allocrtsig \
pthread_kill_other_threads \
pthread_getaffinity pthread_setaffinity \
pthread_attr_getaffinity pthread_attr_setaffinity \
@@ -129,6 +129,8 @@
# pthread_setgid pthread_setegid pthread_setregid \
# pthread_setresgid
+libpthread_routines-$(OPTION_EGLIBC_INET) := herrno res
+
libpthread-shared-only-routines = version pt-allocrtsig unwind-forcedunwind
libpthread-static-only-routines = pthread_atfork
@@ -154,6 +156,9 @@
CFLAGS-cancellation.c = -fasynchronous-unwind-tables
CFLAGS-libc-cancellation.c = -fasynchronous-unwind-tables
+res-CFLAGS-$(OPTION_EGLIBC_INET) := -DHAVE_RESOLVER
+CFLAGS-pthread_create.c := $(res-CFLAGS-y)
+
# Calling pthread_exit() must cause the registered cancel handlers to
# be executed. Therefore exceptions have to be thrown through this
# function.
Index: nptl/pthread_create.c
===================================================================
--- nptl/pthread_create.c (revision 1902)
+++ nptl/pthread_create.c (working copy)
@@ -235,8 +235,10 @@
THREAD_SETMEM (pd, cpuclock_offset, now);
#endif
+#ifdef HAVE_RESOLVER
/* Initialize resolver state pointer. */
__resp = &pd->res;
+#endif
#ifdef __NR_set_robust_list
# ifndef __ASSUME_SET_ROBUST_LIST
@@ -302,8 +304,10 @@
/* Run the destructor for the thread-local data. */
__nptl_deallocate_tsd ();
+#ifdef HAVE_RESOLVER
/* Clean up any state libc stored in thread-local variables. */
__libc_thread_freeres ();
+#endif
/* If this is the last thread we terminate the process now. We
do not notify the debugger, it might just irritate it if there
Index: option-groups.def
===================================================================
--- option-groups.def (revision 1902)
+++ option-groups.def (working copy)
@@ -67,3 +67,16 @@
EGLIBC's math library 'libm'. If you disable this option
group, you will not be able to build 'libstdc++' against the
resulting EGLIBC installation.
+
+config OPTION_EGLIBC_INET
+ bool "Networking support"
+ help
+ This option group includes networking-specific functions and
+ data. When disabled, networking functions like gethostbyname
+ and getifaddrs are omitted.
+
+ Network-related system calls do not fall in this option group,
+ because many of these are also used for other inter-process
+ communication mechanisms. For example, the 'syslog' routines
+ use Unix-domain sockets to communicate with the syslog daemon;
+ syslog is valuable in non-networked contexts.
Index: posix/Makefile
===================================================================
--- posix/Makefile (revision 1902)
+++ posix/Makefile (working copy)
@@ -19,6 +19,8 @@
#
# Sub-makefile for POSIX portion of the library.
#
+include ../option-groups.mak
+
subdir := posix
headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \
@@ -55,7 +57,7 @@
getopt getopt1 getopt_init \
sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \
sched_primin sched_rr_gi sched_getaffinity sched_setaffinity \
- getaddrinfo gai_strerror wordexp \
+ wordexp \
pread pwrite pread64 pwrite64 \
spawn_faction_init spawn_faction_destroy spawn_faction_addclose \
spawn_faction_addopen spawn_faction_adddup2 \
@@ -68,12 +70,14 @@
posix_madvise \
get_child_max
+routines-$(OPTION_EGLIBC_INET) += getaddrinfo gai_strerror
+
include ../Makeconfig
aux := init-posix environ
tests := tstgetopt testfnm runtests runptests \
tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
- tst-getlogin tst-mmap tst-getaddrinfo tst-truncate \
+ tst-getlogin tst-mmap tst-truncate \
tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
@@ -83,14 +87,16 @@
bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
bug-regex25 bug-regex26 tst-nice tst-nanosleep tst-regex2 \
transbug tst-rxspencer tst-pcre tst-boost \
- bug-ga1 tst-vfork1 tst-vfork2 tst-waitid \
- tst-getaddrinfo2 bug-glob1 bug-glob2 tst-sysconf \
+ tst-vfork1 tst-vfork2 tst-waitid \
+ bug-glob1 bug-glob2 tst-sysconf \
tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
- tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2 \
- tst-getaddrinfo3
-xtests := bug-ga2
+ tst-execvp3 tst-execvp4
+tests-$(OPTION_EGLIBC_INET) \
+ += tst-getaddrinfo bug-ga1 tst-getaddrinfo2 \
+ tst-rfc3484 tst-rfc3484-2 tst-getaddrinfo3
+xtests-$(OPTION_EGLIBC_INET) += bug-ga2
ifeq (yes,$(build-shared))
test-srcs := globtest
tests += wordexp-test tst-exec tst-spawn
@@ -133,8 +139,10 @@
endif
# eglibc: endif
+nscd-CFLAGS-$(OPTION_EGLIBC_INET) = -DUSE_NSCD=1
+
CFLAGS-regex.c = -Wno-strict-prototypes
-CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions -DUSE_NSCD
+CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions $(nscd-CFLAGS-y)
CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
Index: resolv/Makefile
===================================================================
--- resolv/Makefile (revision 1902)
+++ resolv/Makefile (working copy)
@@ -20,6 +20,8 @@
#
# Sub-makefile for resolv portion of the library.
#
+include ../option-groups.mak
+
subdir := resolv
headers := resolv.h \
@@ -29,22 +31,23 @@
distribute := ../conf/portability.h mapv4v6addr.h mapv4v6hostent.h \
Banner res_hconf.h res_debug.h README gai_misc.h ga_test.c
-routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \
+routines-$(OPTION_EGLIBC_INET) \
+ += herror inet_addr inet_ntop inet_pton nsap_addr res_init \
res_hconf res_libc res-state
-tests = tst-aton tst-leaks
-xtests = tst-leaks2
+tests-$(OPTION_EGLIBC_INET) += tst-aton tst-leaks
+xtests-$(OPTION_EGLIBC_INET) += tst-leaks2
generate := mtrace-tst-leaks tst-leaks.mtrace tst-leaks2.mtrace
include ../Makeconfig
-extra-libs := libresolv libnss_dns
+extra-libs-$(OPTION_EGLIBC_INET) += libresolv libnss_dns
ifeq ($(have-thread-library),yes)
-extra-libs += libanl
-routines += gai_sigqueue
+extra-libs-$(OPTION_EGLIBC_INET) += libanl
+routines-$(OPTION_EGLIBC_INET) += gai_sigqueue
endif
-extra-libs-others = $(extra-libs)
+extra-libs-others-y += $(extra-libs-y)
libresolv-routines := gethnamaddr res_comp res_debug \
res_data res_mkquery res_query res_send \
inet_net_ntop inet_net_pton inet_neta base64 \
@@ -62,7 +65,7 @@
libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes))
endif
-ifeq (yesyes,$(build-shared)$(have-thread-library))
+ifeq (yesyesy,$(build-shared)$(have-thread-library)$(OPTION_EGLIBC_INET))
tests: $(objpfx)ga_test
endif
Index: sunrpc/Makefile
===================================================================
--- sunrpc/Makefile (revision 1902)
+++ sunrpc/Makefile (working copy)
@@ -19,6 +19,8 @@
#
# Sub-makefile for sunrpc portion of the library.
#
+include ../option-groups.mak
+
subdir := sunrpc
# The code in this subdirectory is taken from Sun's RPCSRC-4.0
@@ -52,12 +54,13 @@
svc_auth.h types.h xdr.h auth_des.h \
des_crypt.h key_prot.h rpc_des.h) \
$(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
-install-others = $(inst_sysconfdir)/rpc
+install-others-$(OPTION_EGLIBC_INET) += $(inst_sysconfdir)/rpc
generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
$(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
generated-dirs := rpcsvc
-routines := auth_none auth_unix authuxprot bindrsvprt \
+routines-$(OPTION_EGLIBC_INET) \
+ += auth_none auth_unix authuxprot bindrsvprt \
clnt_gen clnt_perr clnt_raw clnt_simp clnt_tcp \
clnt_udp rpc_dtable get_myaddr getrpcport \
pmap_clnt pm_getmaps pm_getport pmap_prot \
@@ -69,9 +72,9 @@
key_call key_prot netname openchild rtime svcauth_des xcrypt\
clnt_unix svc_unix create_xid xdr_intXX_t
-others := rpcinfo
-install-bin := rpcgen
-install-sbin := rpcinfo
+others-$(OPTION_EGLIBC_INET) += rpcinfo
+install-bin-$(OPTION_EGLIBC_INET) += rpcgen
+install-sbin-$(OPTION_EGLIBC_INET) += rpcinfo
rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
rpc_scan.o rpc_util.o rpc_svcout.o rpc_clntout.o \
rpc_tblout.o rpc_sample.o
@@ -79,18 +82,20 @@
distribute := proto.h rpc_util.h rpc_parse.h rpc_scan.h \
$(rpcgen-objs:.o=.c) etc.rpc \
errqueue.h
-extra-objs = $(rpcgen-objs)
+extra-objs-$(OPTION_EGLIBC_INET) += $(rpcgen-objs)
all: # Make this the default target; it will be defined in Rules.
include ../Makeconfig
+ifeq (y,$(OPTION_EGLIBC_INET))
tests = tst-xdrmem tst-xdrmem2
xtests := tst-getmyaddr
ifeq ($(have-thread-library),yes)
xtests += thrsvc
endif
+endif
distribute += thrsvc.c
ifeq (yes,$(build-static-nss))
@@ -102,8 +107,9 @@
ifneq (yes,$(install-bootstrap-headers))
# We can only build this library if we can run the rpcgen we build.
headers += $(rpcsvc:%.x=rpcsvc/%.h)
-extra-libs := librpcsvc
-extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
+extra-libs-$(OPTION_EGLIBC_INET) += librpcsvc
+# Make it in `others' pass, not `lib' pass.
+extra-libs-others-y += $(extra-libs-y)
librpcsvc-routines = $(rpcsvc:%.x=x%)
librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
omit-deps = $(librpcsvc-routines)
Index: nis/Makefile
===================================================================
--- nis/Makefile (revision 1902)
+++ nis/Makefile (working copy)
@@ -19,6 +19,8 @@
#
# Makefile for NIS/NIS+ part.
#
+include ../option-groups.mak
+
subdir := nis
aux := nis_hash
@@ -33,15 +35,18 @@
spwd netgrp alias publickey
# Specify rules for the nss_* modules.
-services := nis nisplus compat
+services-y = compat
+services-$(OPTION_EGLIBC_INET) += nis nisplus
-extra-libs = libnsl $(services:%=libnss_%)
+extra-libs-y += $(services-y:%=libnss_%)
+extra-libs-$(OPTION_EGLIBC_INET) += libnsl
+
# These libraries will be built in the `others' pass rather than
# the `lib' pass, because they depend on libc.so being built already.
-extra-libs-others = $(extra-libs)
+extra-libs-others-y += $(extra-libs-y)
# The sources are found in the appropriate subdir.
-subdir-dirs = $(services:%=nss_%)
+subdir-dirs = $(services-y:%=nss_%)
vpath %.c $(subdir-dirs)
libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
@@ -70,20 +75,22 @@
include ../Rules
-$(objpfx)libnss_compat.so: $(objpfx)libnsl.so$(libnsl.so-version)
-$(objpfx)libnss_nis.so: $(objpfx)libnsl.so$(libnsl.so-version) \
+OPTION_EGLIBC_INET-libnsl-$(OPTION_EGLIBC_INET) \
+ := $(objpfx)libnsl.so$(libnsl.so-version)
+$(objpfx)libnss_compat.so:
+$(objpfx)libnss_nis.so: $(OPTION_EGLIBC_INET-libnsl-y) \
$(common-objpfx)nss/libnss_files.so
-$(objpfx)libnss_nisplus.so: $(objpfx)libnsl.so$(libnsl.so-version)
+$(objpfx)libnss_nisplus.so: $(OPTION_EGLIBC_INET-libnsl-y)
# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
# This ensures they will load libc.so for needed symbols if loaded by
# a statically-linked program that hasn't already loaded it.
-$(services:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: $(common-objpfx)libc.so\
- $(common-objpfx)libc_nonshared.a
+$(services-y:%=$(objpfx)libnss_%.so) $(objpfx)libnsl.so: \
+ $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
ifeq ($(build-shared),yes)
-$(others:%=$(objpfx)%): $(objpfx)libnsl.so$(libnsl.so-version)
+$(others:%=$(objpfx)%): $(OPTION_EGLIBC_INET-libnsl-y)
else
$(others:%=$(objpfx)%): $(objpfx)libnsl.a
endif