[6/6] Installed header hygiene (BZ#20366): Test of installed headers.

Message ID 0fcc4287-2793-9a32-4673-d19ee1414c45@panix.com
State Superseded
Headers

Commit Message

Zack Weinberg Sept. 23, 2016, noon UTC
  On 09/22/2016 04:21 PM, Joseph Myers wrote:
> This patch is OK.  Does it test headers installed from the toplevel 
> Makefile as well as those installed by subdirectories?

I wasn't aware there were any such headers!  Indeed they were not being
tested.

Below, a revision that adds the necessary rules to the toplevel Makefile
as well as to Rules.  All tests still pass, so I am going to go ahead
and land the patch series.

zw

	* scripts/check-installed-headers.sh: New script.
	* Rules: In each directory that defines header files to be installed,
	run check-installed-headers.sh on them as a special test.
	* Makefile: Likewise for the headers installed at top level.

	* include/aliases.h, include/alloca.h, include/argz.h
	* include/arpa/nameser.h, include/arpa/nameser_compat.h
	* include/elf.h, include/envz.h, include/err.h
	* include/execinfo.h, include/fpu_control.h, include/getopt.h
	* include/gshadow.h, include/ifaddrs.h,include/libintl.h
	* include/link.h, include/malloc.h, include/mcheck.h
	* include/mntent.h, include/netinet/ether.h
	* include/nss.h, include/obstack.h, include/printf.h
	* include/pty.h, include/resolv.h, include/rpc/auth.h
	* include/rpc/auth_des.h, include/rpc/auth_unix.h
	* include/rpc/clnt.h, include/rpc/des_crypt.h
	* include/rpc/key_prot.h, include/rpc/netdb.h
	* include/rpc/pmap_clnt.h, include/rpc/pmap_prot.h
	* include/rpc/pmap_rmt.h, include/rpc/rpc.h
	* include/rpc/rpc_msg.h, include/rpc/svc.h
	* include/rpc/svc_auth.h, include/rpc/xdr.h
	* include/rpcsvc/nis_callback.h, include/rpcsvc/nislib.h
	* include/rpcsvc/yp.h, include/rpcsvc/ypclnt.h
	* include/rpcsvc/ypupd.h, include/shadow.h
	* include/stdio_ext.h, include/sys/epoll.h
	* include/sys/file.h, include/sys/gmon.h, include/sys/ioctl.h
	* include/sys/prctl.h, include/sys/profil.h
	* include/sys/statfs.h, include/sys/sysctl.h
	* include/sys/sysinfo.h, include/ttyent.h, include/utmp.h
	* sysdeps/arm/nacl/include/bits/setjmp.h
	* sysdeps/mips/include/sys/asm.h
	* sysdeps/unix/sysv/linux/include/sys/sysinfo.h
	* sysdeps/unix/sysv/linux/include/sys/timex.h
	* sysdeps/x86/fpu/include/bits/fenv.h:
	Add #ifndef _ISOMAC guard around internal declarations.
	Add multiple-inclusion guard if not already present.
---
 Makefile                                      |  23 ++++
 Rules                                         |  23 ++++
 include/aliases.h                             |   3 +
 include/alloca.h                              |   4 +
 include/argz.h                                |   3 +
 include/arpa/nameser.h                        |   3 +
 include/arpa/nameser_compat.h                 |   3 +
 include/elf.h                                 |   9 +-
 include/envz.h                                |   3 +
 include/err.h                                 |   6 ++
 include/execinfo.h                            |   3 +
 include/fpu_control.h                         |   6 ++
 include/getopt.h                              |   5 +-
 include/gshadow.h                             |   3 +
 include/ifaddrs.h                             |   4 +
 include/libintl.h                             |   4 +
 include/link.h                                |  11 +-
 include/malloc.h                              |   2 +
 include/mcheck.h                              |   3 +
 include/mntent.h                              |   3 +
 include/netinet/ether.h                       |   3 +
 include/nss.h                                 |   3 +
 include/obstack.h                             |   6 ++
 include/printf.h                              |   4 +
 include/pty.h                                 |   3 +
 include/resolv.h                              |  11 +-
 include/rpc/auth.h                            |   3 +
 include/rpc/auth_des.h                        |   3 +
 include/rpc/auth_unix.h                       |   6 ++
 include/rpc/clnt.h                            |   3 +
 include/rpc/des_crypt.h                       |   3 +
 include/rpc/key_prot.h                        |   6 ++
 include/rpc/netdb.h                           |   3 +
 include/rpc/pmap_clnt.h                       |   7 +-
 include/rpc/pmap_prot.h                       |   6 ++
 include/rpc/pmap_rmt.h                        |   6 ++
 include/rpc/rpc.h                             |   4 +
 include/rpc/rpc_msg.h                         |   3 +
 include/rpc/svc.h                             |   3 +
 include/rpc/svc_auth.h                        |   3 +
 include/rpc/xdr.h                             |   6 ++
 include/rpcsvc/nis_callback.h                 |   3 +
 include/rpcsvc/nislib.h                       |   3 +
 include/rpcsvc/yp.h                           |   3 +
 include/rpcsvc/ypclnt.h                       |   3 +
 include/rpcsvc/ypupd.h                        |   3 +
 include/shadow.h                              |   3 +
 include/stdio_ext.h                           |   7 +-
 include/sys/epoll.h                           |   3 +
 include/sys/file.h                            |   4 +
 include/sys/gmon.h                            |   4 +
 include/sys/ioctl.h                           |   4 +
 include/sys/prctl.h                           |   3 +
 include/sys/profil.h                          |   3 +
 include/sys/statfs.h                          |   4 +
 include/sys/sysctl.h                          |   3 +
 include/sys/sysinfo.h                         |   3 +
 include/ttyent.h                              |   7 +-
 include/utmp.h                                |   3 +
 scripts/check-installed-headers.sh            | 146
++++++++++++++++++++++++++
 sysdeps/arm/nacl/include/bits/setjmp.h        |   3 +
 sysdeps/mips/include/sys/asm.h                |   6 +-
 sysdeps/unix/sysv/linux/include/sys/sysinfo.h |   3 +
 sysdeps/unix/sysv/linux/include/sys/timex.h   |   3 +
 sysdeps/x86/fpu/include/bits/fenv.h           |   6 ++
 65 files changed, 431 insertions(+), 21 deletions(-)
 create mode 100644 scripts/check-installed-headers.sh
  

Comments

Joseph Myers Sept. 23, 2016, 12:35 p.m. UTC | #1
On Fri, 23 Sep 2016, Zack Weinberg wrote:

> On 09/22/2016 04:21 PM, Joseph Myers wrote:
> > This patch is OK.  Does it test headers installed from the toplevel 
> > Makefile as well as those installed by subdirectories?
> 
> I wasn't aware there were any such headers!  Indeed they were not being
> tested.

There's an argument for reducing the amount of stuff done by the toplevel 
Makefile - for example, by making include/ into a normal subdirectory the 
build recurses into, and installing the miscellaneous headers from there.

begin-end-check currently involves a hardcoded list of header paths 
(installed-headers in the toplevel Makefile).  It would be better for it 
to run in each directory and work off the headers list from that 
directory, like your test does, but doing so without duplicating rules 
would also imply moving toplevel header installation to a subdirectory.
  
Zack Weinberg Sept. 23, 2016, 5:19 p.m. UTC | #2
On Fri, Sep 23, 2016 at 8:35 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Fri, 23 Sep 2016, Zack Weinberg wrote:
>
>> On 09/22/2016 04:21 PM, Joseph Myers wrote:
>> > This patch is OK.  Does it test headers installed from the toplevel
>> > Makefile as well as those installed by subdirectories?
>>
>> I wasn't aware there were any such headers!  Indeed they were not being
>> tested.
>
> There's an argument for reducing the amount of stuff done by the toplevel
> Makefile - for example, by making include/ into a normal subdirectory the
> build recurses into, and installing the miscellaneous headers from there.

Or those headers could be moved to misc/, which might be less
confusing (and less work).  include/ would then contain only wrapper
and internal-use-only headers.

> begin-end-check currently involves a hardcoded list of header paths
> (installed-headers in the toplevel Makefile).  It would be better for it
> to run in each directory and work off the headers list from that
> directory, like your test does, but doing so without duplicating rules
> would also imply moving toplevel header installation to a subdirectory.

I saw that and I was thinking about doing a follow-on patch, but I've
got a lot on my plate for $dayjob right now...

zw
  
Joseph Myers Sept. 23, 2016, 9:51 p.m. UTC | #3
I'm seeing the new tests fail in misc/ for 32-bit x86, because of:

../sysdeps/unix/sysv/linux/x86/sys/elf.h:24:3: error: #warning "This header is obsolete; use <sys/procfs.h> instead." [-Werror=cpp]
 # warning "This header is obsolete; use <sys/procfs.h> instead."
   ^
cc1: all warnings being treated as errors
  
Zack Weinberg Sept. 24, 2016, 2:01 a.m. UTC | #4
On Fri, Sep 23, 2016 at 5:51 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> I'm seeing the new tests fail in misc/ for 32-bit x86, because of:
>
> ../sysdeps/unix/sysv/linux/x86/sys/elf.h:24:3: error: #warning "This header is obsolete; use <sys/procfs.h> instead." [-Werror=cpp]
>  # warning "This header is obsolete; use <sys/procfs.h> instead."
>    ^
> cc1: all warnings being treated as errors

I can't conveniently do anything with anything other than x86-64 at
the moment, but there's already a special case for sys/elf.h in
check-installed-headers.sh -- would you mind seeing if you can
generalize it?  Possibly passing $(target_alias) down from the
Makefile rather than what it does now.

zw
  

Patch

diff --git a/Makefile b/Makefile
index 4478c97..e26774d 100644
--- a/Makefile
+++ b/Makefile
@@ -318,6 +318,29 @@  $(objpfx)begin-end-check.out:
scripts/begin-end-check.pl
 	$(evaluate-test)
 endif

+ifneq "$(headers)" ""
+# Special test of all the installed headers in this directory.
+tests-special += $(objpfx)check-installed-headers-c.out
+libof-check-installed-headers-c := nonlib
+$(objpfx)check-installed-headers-c.out: \
+    scripts/check-installed-headers.sh $(headers)
+	$(SHELL) $(..)scripts/check-installed-headers.sh c \
+	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(headers) > $@; \
+	$(evaluate-test)
+
+ifneq "$(CXX)" ""
+tests-special += $(objpfx)check-installed-headers-cxx.out
+libof-check-installed-headers-cxx := nonlib
+$(objpfx)check-installed-headers-cxx.out: \
+    scripts/check-installed-headers.sh $(headers)
+	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
+	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(headers) > $@; \
+	$(evaluate-test)
+endif
+endif
+
 define summarize-tests
 @egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true
 @echo "Summary of test results$2:"
diff --git a/Rules b/Rules
index 8306d36..342d659 100644
--- a/Rules
+++ b/Rules
@@ -80,6 +80,29 @@  $(common-objpfx)dummy.c:
 	(echo 'extern void __dummy__ (void);'; \
 	 echo 'void __dummy__ (void) { }') > $@
 common-generated += dummy.o dummy.c
+
+ifneq "$(headers)" ""
+# Special test of all the installed headers in this directory.
+tests-special += $(objpfx)check-installed-headers-c.out
+libof-check-installed-headers-c := nonlib
+$(objpfx)check-installed-headers-c.out: \
+    $(..)scripts/check-installed-headers.sh $(headers)
+	$(SHELL) $(..)scripts/check-installed-headers.sh c \
+	  "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(headers) > $@; \
+	$(evaluate-test)
+
+ifneq "$(CXX)" ""
+tests-special += $(objpfx)check-installed-headers-cxx.out
+libof-check-installed-headers-cxx := nonlib
+$(objpfx)check-installed-headers-cxx.out: \
+    $(..)scripts/check-installed-headers.sh $(headers)
+	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
+	  "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+	  $(headers) > $@; \
+	$(evaluate-test)
+endif
+endif
 
 # This makes all the auxiliary and test programs.

diff --git a/include/aliases.h b/include/aliases.h
index f7cfafc..ece69eb 100644
--- a/include/aliases.h
+++ b/include/aliases.h
@@ -1,6 +1,8 @@ 
 #ifndef _ALIASES_H
 #include <inet/aliases.h>

+# ifndef _ISOMAC
+
 extern int __getaliasent_r (struct aliasent *__restrict __result_buf,
 			    char *__restrict __buffer, size_t __buflen,
 			    struct aliasent **__restrict __result)
@@ -34,4 +36,5 @@  DECLARE_NSS_PROTOTYPES (nis)
 DECLARE_NSS_PROTOTYPES (nisplus)
 #undef DECLARE_NSS_PROTOTYPES

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/alloca.h b/include/alloca.h
index 0150025..fd90664 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -1,6 +1,9 @@ 
 #ifndef _ALLOCA_H

 #include <stdlib/alloca.h>
+
+# ifndef _ISOMAC
+
 #include <stackinfo.h>

 #undef	__alloca
@@ -73,4 +76,5 @@  libc_hidden_proto (__libc_alloca_cutoff)
      extend_alloca (buf, len, s__); })
 #endif

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/argz.h b/include/argz.h
index 4eab0b6..0388c23 100644
--- a/include/argz.h
+++ b/include/argz.h
@@ -2,8 +2,11 @@ 

 #include <string/argz.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (argz_delete)
 libc_hidden_proto (__argz_count)
 libc_hidden_proto (__argz_stringify)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
index ce6f023..cd7ab6e 100644
--- a/include/arpa/nameser.h
+++ b/include/arpa/nameser.h
@@ -2,6 +2,8 @@ 

 #include <resolv/arpa/nameser.h>

+# ifndef _ISOMAC
+
 /* If the machine allows unaligned access we can do better than using
    the NS_GET16, NS_GET32, NS_PUT16, and NS_PUT32 macros from the
    installed header.  */
@@ -74,4 +76,5 @@  libresolv_hidden_proto (ns_samename)
 libresolv_hidden_proto (ns_makecanon)
 libresolv_hidden_proto (ns_format_ttl)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/arpa/nameser_compat.h b/include/arpa/nameser_compat.h
index 2e735ed..6928000 100644
--- a/include/arpa/nameser_compat.h
+++ b/include/arpa/nameser_compat.h
@@ -1,8 +1,11 @@ 
 #ifndef _ARPA_NAMESER_COMPAT_
 #include <resolv/arpa/nameser_compat.h>

+# ifndef _ISOMAC
+
 /* Picksome unused number to represent lookups of IPv4 and IPv6 (i.e.,
    T_A and T_AAAA).  */
 #define T_UNSPEC 62321

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/elf.h b/include/elf.h
index 60658c6..f06a33f 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -1,5 +1,8 @@ 
 #ifndef _ELF_H
-# include <elf/elf.h>
+#include <elf/elf.h>
+
+# ifndef _ISOMAC
+
 /* Some information which is not meant for the public and therefore not
    in <elf.h>.  */
 # include <dl-dtprocnum.h>
@@ -9,4 +12,6 @@ 
 # define DT_1_SUPPORTED_MASK \
    (DF_1_NOW | DF_1_NODELETE | DF_1_INITFIRST | DF_1_NOOPEN \
     | DF_1_ORIGIN | DF_1_NODEFLIB)
-#endif
+
+# endif /* !_ISOMAC */
+#endif /* elf.h */
diff --git a/include/envz.h b/include/envz.h
index 8cfd9b5..633fcc6 100644
--- a/include/envz.h
+++ b/include/envz.h
@@ -2,7 +2,10 @@ 

 #include <string/envz.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (envz_entry)
 libc_hidden_proto (envz_remove)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/err.h b/include/err.h
index 737dfc1..3828559 100644
--- a/include/err.h
+++ b/include/err.h
@@ -1,8 +1,14 @@ 
+#ifndef _ERR_H
 #include <misc/err.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (warn)
 libc_hidden_proto (warnx)
 libc_hidden_proto (vwarn)
 libc_hidden_proto (vwarnx)
 libc_hidden_proto (verr)
 libc_hidden_proto (verrx)
+
+# endif /* !_ISOMAC */
+#endif /* err.h */
diff --git a/include/execinfo.h b/include/execinfo.h
index c929821..0b132b0 100644
--- a/include/execinfo.h
+++ b/include/execinfo.h
@@ -1,6 +1,8 @@ 
 #ifndef _EXECINFO_H
 #include <debug/execinfo.h>

+# ifndef _ISOMAC
+
 extern int __backtrace (void **__array, int __size);
 libc_hidden_proto (__backtrace)

@@ -10,4 +12,5 @@  extern void __backtrace_symbols_fd (void *const
*__array, int __size,
 				    int __fd);
 libc_hidden_proto (__backtrace_symbols_fd)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/fpu_control.h b/include/fpu_control.h
index d0b5e9c..4498a83 100644
--- a/include/fpu_control.h
+++ b/include/fpu_control.h
@@ -1,4 +1,10 @@ 
+#ifndef _FPU_CONTROL_H
 #include_next <fpu_control.h>

+# ifndef _ISOMAC
+
 /* Called at startup.  It can be used to manipulate fpu control
register.  */
 extern void __setfpucw (fpu_control_t);
+
+# endif /* !_ISOMAC */
+#endif /* fpu_control.h */
diff --git a/include/getopt.h b/include/getopt.h
index 6f2693d..c094972 100644
--- a/include/getopt.h
+++ b/include/getopt.h
@@ -3,11 +3,10 @@ 
 #include <features.h>		/* Get __GNU_LIBRARY__ defined now.  */
 #include <posix/getopt.h>

-# ifdef _GETOPT_H
+# if defined _GETOPT_H && !defined _ISOMAC

 /* Now define the internal interfaces.  */
 extern void __getopt_clean_environment (char **__env);

-# endif
-
+# endif /* _GETOPT_H && !_ISOMAC */
 #endif
diff --git a/include/gshadow.h b/include/gshadow.h
index 8a981f6..532801a 100644
--- a/include/gshadow.h
+++ b/include/gshadow.h
@@ -1,6 +1,8 @@ 
 #ifndef _GSHADOW_H
 #include <gshadow/gshadow.h>

+# ifndef _ISOMAC
+
 extern int __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer,
 			  size_t buflen, struct sgrp **result);
 extern int __sgetsgent_r (const char *string, struct sgrp *resbuf,
@@ -12,4 +14,5 @@  extern int _nss_files_parse_sgent (char *line, struct
sgrp *result,
                                    size_t datalen, int *errnop);
 libc_hidden_proto (_nss_files_parse_sgent)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/ifaddrs.h b/include/ifaddrs.h
index 2787f21..54f4b7a 100644
--- a/include/ifaddrs.h
+++ b/include/ifaddrs.h
@@ -1,5 +1,8 @@ 
 #ifndef _IFADDRS_H
 #include <inet/ifaddrs.h>
+
+# ifndef _ISOMAC
+
 #include <stdbool.h>
 #include <stdint.h>

@@ -30,4 +33,5 @@  extern void __check_native (uint32_t a1_index, int
*a1_native,
 extern uint32_t __bump_nl_timestamp (void) attribute_hidden;
 #endif

+# endif /* !_ISOMAC */
 #endif	/* ifaddrs.h */
diff --git a/include/libintl.h b/include/libintl.h
index 0551a04..9a11367 100644
--- a/include/libintl.h
+++ b/include/libintl.h
@@ -1,5 +1,8 @@ 
 #ifndef _LIBINTL_H
 #include <intl/libintl.h>
+
+# ifndef _ISOMAC
+
 #include <locale.h>

 /* Now define the internal interfaces.  */
@@ -46,4 +49,5 @@  libc_hidden_proto (_libc_intl_domainname)
 # define _(msgid) \
   __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/link.h b/include/link.h
index 32a7392..0558442 100644
--- a/include/link.h
+++ b/include/link.h
@@ -24,12 +24,18 @@ 
 # error this should be impossible
 #endif

+# ifndef _ISOMAC
 /* Get most of the contents from the public header, but we define a
    different `struct link_map' type for private use.  The la_objopen
    prototype uses the type, so we have to declare it separately.  */
-#define link_map	link_map_public
-#define la_objopen	la_objopen_wrongproto
+#  define link_map	link_map_public
+#  define la_objopen	la_objopen_wrongproto
+# endif
+
 #include <elf/link.h>
+
+# ifndef _ISOMAC
+
 #undef	link_map
 #undef	la_objopen

@@ -341,4 +347,5 @@  extern int __dl_iterate_phdr (int (*callback)
(struct dl_phdr_info *info,
    `ELF64_R_TYPE'.  */
 #define ELFW(type)	_ElfW (ELF, __ELF_NATIVE_CLASS, type)

+# endif /* !_ISOMAC */
 #endif /* include/link.h */
diff --git a/include/malloc.h b/include/malloc.h
index 42fc8ed..70d32c7 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -1,6 +1,7 @@ 
 #ifndef _MALLOC_H
 #include <malloc/malloc.h>

+# ifndef _ISOMAC

 /* In the GNU libc we rename the global variable
    `__malloc_initialized' to `__libc_malloc_initialized'.  */
@@ -11,4 +12,5 @@  extern int __malloc_initialized attribute_hidden;
 struct malloc_state;
 typedef struct malloc_state *mstate;

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/mcheck.h b/include/mcheck.h
index b0037a7..8883c3d 100644
--- a/include/mcheck.h
+++ b/include/mcheck.h
@@ -2,7 +2,10 @@ 

 #include <malloc/mcheck.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (mcheck)
 libc_hidden_proto (mcheck_check_all)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/mntent.h b/include/mntent.h
index b34674a..169210f 100644
--- a/include/mntent.h
+++ b/include/mntent.h
@@ -1,6 +1,8 @@ 
 #ifndef _MNTENT_H
 #include <misc/mntent.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern FILE *__setmntent (const char *__file, const char *__mode);
 extern struct mntent *__getmntent_r (FILE *__stream,
@@ -14,4 +16,5 @@  libc_hidden_proto (__setmntent)
 libc_hidden_proto (__getmntent_r)
 libc_hidden_proto (__endmntent)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/netinet/ether.h b/include/netinet/ether.h
index 2efe4c0..8bfe7e0 100644
--- a/include/netinet/ether.h
+++ b/include/netinet/ether.h
@@ -1,6 +1,8 @@ 
 #ifndef _NETINET_ETHER_H
 #include <inet/netinet/ether.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (ether_aton_r)
 libc_hidden_proto (ether_ntoa_r)

@@ -39,4 +41,5 @@  DECLARE_NSS_PROTOTYPES (nisplus)

 #undef DECLARE_NSS_PROTOTYPES

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/nss.h b/include/nss.h
index 1e8cc39..6358a10 100644
--- a/include/nss.h
+++ b/include/nss.h
@@ -1,6 +1,8 @@ 
 #ifndef _NSS_H
 #include <nss/nss.h>

+# ifndef _ISOMAC
+
 #define NSS_INVALID_FIELD_CHARACTERS ":\n"
 extern const char __nss_invalid_field_characters[] attribute_hidden;

@@ -11,4 +13,5 @@  _Bool __nss_valid_list_field (char **list)
 const char *__nss_rewrite_field (const char *value, char **to_be_freed)
   attribute_hidden internal_function;

+# endif /* !_ISOMAC */
 #endif /* _NSS_H */
diff --git a/include/obstack.h b/include/obstack.h
index 349d59b..fe2e595 100644
--- a/include/obstack.h
+++ b/include/obstack.h
@@ -1,3 +1,9 @@ 
+#ifndef _OBSTACK_H
 #include <malloc/obstack.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (_obstack_newchunk)
+
+# endif /* !_ISOMAC */
+#endif /* obstack.h */
diff --git a/include/printf.h b/include/printf.h
index b12b5dc..984f263 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -1,6 +1,9 @@ 
 #ifndef	_PRINTF_H

 #include <stdio-common/printf.h>
+
+# ifndef _ISOMAC
+
 #include <xlocale.h>

 /* Now define the internal interfaces.  */
@@ -13,4 +16,5 @@  extern int __printf_fp_l (FILE *, locale_t, const
struct printf_info *,
 			  const void *const *);
 libc_hidden_proto (__printf_fp_l)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/pty.h b/include/pty.h
index a91be80..4979bb7 100644
--- a/include/pty.h
+++ b/include/pty.h
@@ -1,6 +1,9 @@ 
 #ifndef _PTY_H
 #include <login/pty.h>

+# ifndef _ISOMAC
+
 libutil_hidden_proto (openpty)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/resolv.h b/include/resolv.h
index 52ac218..699cc81 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -1,17 +1,19 @@ 
 #ifndef _RESOLV_H_

-#define RES_SET_H_ERRNO(r,x)			\
+# ifndef _ISOMAC
+#  include <stdbool.h>
+#  define RES_SET_H_ERRNO(r,x)			\
   do						\
     {						\
       (r)->res_h_errno = x;			\
       __set_h_errno(x);				\
     }						\
   while (0)
+# endif

-#include <stdbool.h>
 #include <resolv/resolv.h>

-#ifdef _RESOLV_H_
+# if defined _RESOLV_H_ && !defined _ISOMAC

 # if IS_IN (libc)
 #  define __resp __libc_resp
@@ -97,6 +99,5 @@  libresolv_hidden_proto (__p_secstodate)
 extern const char *_res_opcodes[];
 libresolv_hidden_proto (_res_opcodes)

-#endif
-
+# endif /* _RESOLV_H_ && !_ISOMAC */
 #endif
diff --git a/include/rpc/auth.h b/include/rpc/auth.h
index 0219fd9..2e55cce 100644
--- a/include/rpc/auth.h
+++ b/include/rpc/auth.h
@@ -1,6 +1,8 @@ 
 #ifndef _RPC_AUTH_H
 #include <sunrpc/rpc/auth.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (getnetname)
 libc_hidden_proto (netname2user)
 libc_hidden_proto (host2netname)
@@ -41,4 +43,5 @@  libc_hidden_proto (key_setnet)
 libc_hidden_proto (key_setsecret)
 libc_hidden_proto (netname2host)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/auth_des.h b/include/rpc/auth_des.h
index 0e9db1a..6afed56 100644
--- a/include/rpc/auth_des.h
+++ b/include/rpc/auth_des.h
@@ -2,6 +2,8 @@ 

 #include <sunrpc/rpc/auth_des.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (getpublickey)
 libc_hidden_proto (getsecretkey)
 libc_hidden_proto (rtime)
@@ -32,4 +34,5 @@  libc_hidden_proto (authdes_getucred)
 libc_hidden_proto (xdr_authdes_cred)
 libc_hidden_proto (xdr_authdes_verf)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/auth_unix.h b/include/rpc/auth_unix.h
index 07031c9..019efa2 100644
--- a/include/rpc/auth_unix.h
+++ b/include/rpc/auth_unix.h
@@ -1,3 +1,9 @@ 
+#ifndef _RPC_AUTH_UNIX_H
 #include <sunrpc/rpc/auth_unix.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (xdr_authunix_parms)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/auth_unix.h */
diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h
index d79a6a7..a397023 100644
--- a/include/rpc/clnt.h
+++ b/include/rpc/clnt.h
@@ -1,6 +1,8 @@ 
 #ifndef _RPC_CLNT_H
 #include <sunrpc/rpc/clnt.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern int _openchild (const char *command, FILE **fto, FILE **ffrom);

@@ -27,4 +29,5 @@  libc_hidden_proto (get_myaddress)
 libc_hidden_proto (clntunix_create)
 libc_hidden_proto (__libc_clntudp_bufcreate)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/des_crypt.h b/include/rpc/des_crypt.h
index 44f7e66..7a34957 100644
--- a/include/rpc/des_crypt.h
+++ b/include/rpc/des_crypt.h
@@ -1,6 +1,8 @@ 
 #ifndef __DES_CRYPT_H__
 #include <sunrpc/rpc/des_crypt.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */

 extern int xencrypt (char *secret, char *passwd);
@@ -12,4 +14,5 @@  libc_hidden_proto (cbc_crypt)
 libc_hidden_proto (xencrypt)
 libc_hidden_proto (xdecrypt)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/key_prot.h b/include/rpc/key_prot.h
index 29d14cc..4711a94 100644
--- a/include/rpc/key_prot.h
+++ b/include/rpc/key_prot.h
@@ -1,5 +1,8 @@ 
+#ifndef _KEY_PROT_H_RPCGEN
 #include <sunrpc/rpc/key_prot.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (xdr_cryptkeyarg)
 libc_hidden_proto (xdr_cryptkeyarg2)
 libc_hidden_proto (xdr_cryptkeyres)
@@ -10,3 +13,6 @@  libc_hidden_proto (xdr_keystatus)
 libc_hidden_proto (xdr_getcredres)
 libc_hidden_proto (xdr_netnamestr)
 libc_hidden_proto (xdr_unixcred)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/key_prot.h */
diff --git a/include/rpc/netdb.h b/include/rpc/netdb.h
index 65af237..9b84668 100644
--- a/include/rpc/netdb.h
+++ b/include/rpc/netdb.h
@@ -1,6 +1,8 @@ 
 #ifndef _RPC_NETDB_H
 #include <sunrpc/rpc/netdb.h>

+# ifndef _ISOMAC
+
 extern int __getrpcbyname_r (const char *__name, struct rpcent
*__result_buf,
 			     char *__buffer, size_t __buflen,
 			     struct rpcent **__result);
@@ -48,4 +50,5 @@  DECLARE_NSS_PROTOTYPES (nisplus)

 #undef DECLARE_NSS_PROTOTYPES

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h
index 67628e0..ec907c2 100644
--- a/include/rpc/pmap_clnt.h
+++ b/include/rpc/pmap_clnt.h
@@ -1,5 +1,7 @@ 
 #ifndef _RPC_PMAP_CLNT_H
-# include <sunrpc/rpc/pmap_clnt.h>
+#include <sunrpc/rpc/pmap_clnt.h>
+
+# ifndef _ISOMAC

 libc_hidden_proto (pmap_getport)
 libc_hidden_proto (pmap_set)
@@ -18,4 +20,5 @@  libc_hidden_proto (clnt_broadcast)
 libc_hidden_proto (pmap_getmaps)
 libc_hidden_proto (pmap_rmtcall)

-#endif
+# endif /* !_ISOMAC */
+#endif /* rpc/pmap_clnt.h */
diff --git a/include/rpc/pmap_prot.h b/include/rpc/pmap_prot.h
index 2e9076e..a2573d1 100644
--- a/include/rpc/pmap_prot.h
+++ b/include/rpc/pmap_prot.h
@@ -1,4 +1,10 @@ 
+#ifndef _RPC_PMAP_PROT_H
 #include <sunrpc/rpc/pmap_prot.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (xdr_pmap)
 libc_hidden_proto (xdr_pmaplist)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/pmap_prot.h */
diff --git a/include/rpc/pmap_rmt.h b/include/rpc/pmap_rmt.h
index e8822da..ae53a02 100644
--- a/include/rpc/pmap_rmt.h
+++ b/include/rpc/pmap_rmt.h
@@ -1,4 +1,10 @@ 
+#ifndef _RPC_PMAP_RMT_H
 #include <sunrpc/rpc/pmap_rmt.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (xdr_rmtcall_args)
 libc_hidden_proto (xdr_rmtcallres)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/pmap_rmt.h */
diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
index 58bdef3..4c9ee82 100644
--- a/include/rpc/rpc.h
+++ b/include/rpc/rpc.h
@@ -1,5 +1,8 @@ 
 #ifndef _RPC_RPC_H
 #include <sunrpc/rpc/rpc.h>
+
+# ifndef _ISOMAC
+
 #include <libc-tsd.h>

 /* Now define the internal interfaces.  */
@@ -56,4 +59,5 @@  libc_hidden_proto (__rpc_thread_createerr)

 #endif /* _RPC_THREAD_SAFE_ */

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/rpc_msg.h b/include/rpc/rpc_msg.h
index be1f483..93c5ab8 100644
--- a/include/rpc/rpc_msg.h
+++ b/include/rpc/rpc_msg.h
@@ -1,6 +1,8 @@ 
 #ifndef _RPC_MSG_H
 #include <sunrpc/rpc/rpc_msg.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (_seterr_reply)

 /* Now define the internal interfaces.  */
@@ -14,4 +16,5 @@  libc_hidden_proto (xdr_callmsg)
 libc_hidden_proto (xdr_rejected_reply)
 libc_hidden_proto (xdr_replymsg)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/svc.h b/include/rpc/svc.h
index 61a8ab3..465bf44 100644
--- a/include/rpc/svc.h
+++ b/include/rpc/svc.h
@@ -1,6 +1,8 @@ 
 #ifndef _RPC_SVC_H
 #include <sunrpc/rpc/svc.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (xprt_register)
 libc_hidden_proto (xprt_unregister)
 libc_hidden_proto (svc_register)
@@ -37,4 +39,5 @@  libc_hidden_proto (svc_getreq_poll)

 extern void __svc_accept_failed (void) attribute_hidden;

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/svc_auth.h b/include/rpc/svc_auth.h
index 582bb31..2609d19 100644
--- a/include/rpc/svc_auth.h
+++ b/include/rpc/svc_auth.h
@@ -1,6 +1,8 @@ 
 #ifndef _RPC_SVC_AUTH_H
 #include <sunrpc/rpc/svc_auth.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern enum auth_stat _svcauth_unix (struct svc_req *rqst,
 				     struct rpc_msg *msg);
@@ -9,4 +11,5 @@  extern enum auth_stat _svcauth_short (struct svc_req *rqst,

 libc_hidden_proto (_authenticate)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index 57971d0..e1bff1c 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -1,5 +1,8 @@ 
+#ifndef _RPC_XDR_H
 #include <sunrpc/rpc/xdr.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (xdrstdio_create)
 libc_hidden_proto (xdr_array)
 libc_hidden_proto (xdr_bool)
@@ -45,3 +48,6 @@  libc_hidden_proto (xdr_int64_t)
 libc_hidden_proto (xdr_uint64_t)
 libc_hidden_proto (xdr_quad_t)
 libc_hidden_proto (xdr_u_quad_t)
+
+# endif /* !_ISOMAC */
+#endif /* rpc/xdr.h */
diff --git a/include/rpcsvc/nis_callback.h b/include/rpcsvc/nis_callback.h
index dfa9cd3..0515d07 100644
--- a/include/rpcsvc/nis_callback.h
+++ b/include/rpcsvc/nis_callback.h
@@ -1,7 +1,10 @@ 
 #ifndef _RPCSVC_NIS_CALLBACK_H
 #include <nis/rpcsvc/nis_callback.h>

+# ifndef _ISOMAC
+
 libnsl_hidden_proto (xdr_obj_p)
 libnsl_hidden_proto (xdr_cback_data)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpcsvc/nislib.h b/include/rpcsvc/nislib.h
index 635c513..05b1987 100644
--- a/include/rpcsvc/nislib.h
+++ b/include/rpcsvc/nislib.h
@@ -1,6 +1,8 @@ 
 #ifndef __RPCSVC_NISLIB_H__
 #include <nis/rpcsvc/nislib.h>

+# ifndef _ISOMAC
+
 libnsl_hidden_proto (nis_leaf_of_r)
 libnsl_hidden_proto (nis_name_of_r)
 libnsl_hidden_proto (nis_getnames)
@@ -44,4 +46,5 @@  libnsl_hidden_proto (nis_clone_object)

 extern const_nis_name __nis_domain_of (const_nis_name) __THROW;

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpcsvc/yp.h b/include/rpcsvc/yp.h
index 04a973e..b6d7c15 100644
--- a/include/rpcsvc/yp.h
+++ b/include/rpcsvc/yp.h
@@ -1,6 +1,8 @@ 
 #ifndef __RPCSVC_YP_H__
 #include <nis/rpcsvc/yp.h>

+# ifndef _ISOMAC
+
 libnsl_hidden_proto (xdr_ypstat)
 libnsl_hidden_proto (xdr_ypxfrstat)
 libnsl_hidden_proto (xdr_domainname)
@@ -23,4 +25,5 @@  libnsl_hidden_proto (xdr_ypresp_order)
 libnsl_hidden_proto (xdr_ypbind_resp)
 libnsl_hidden_proto (xdr_ypresp_master)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpcsvc/ypclnt.h b/include/rpcsvc/ypclnt.h
index b38dc6b..1b4e2f2 100644
--- a/include/rpcsvc/ypclnt.h
+++ b/include/rpcsvc/ypclnt.h
@@ -1,10 +1,13 @@ 
 #ifndef __RPCSVC_YPCLNT_H__
 #include <nis/rpcsvc/ypclnt.h>

+# ifndef _ISOMAC
+
 libnsl_hidden_proto (ypbinderr_string)
 libnsl_hidden_proto (yp_bind)
 libnsl_hidden_proto (yp_get_default_domain)
 libnsl_hidden_proto (ypprot_err)
 libnsl_hidden_proto (yp_master)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/rpcsvc/ypupd.h b/include/rpcsvc/ypupd.h
index 7601971..6d179dd 100644
--- a/include/rpcsvc/ypupd.h
+++ b/include/rpcsvc/ypupd.h
@@ -1,8 +1,11 @@ 
 #ifndef __RPCSVC_YPUPD_H__
 #include <nis/rpcsvc/ypupd.h>

+# ifndef _ISOMAC
+
 libnsl_hidden_proto (xdr_yp_buf)
 libnsl_hidden_proto (xdr_ypdelete_args)
 libnsl_hidden_proto (xdr_ypupdate_args)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/shadow.h b/include/shadow.h
index a3f897c..124a1ab 100644
--- a/include/shadow.h
+++ b/include/shadow.h
@@ -1,6 +1,8 @@ 
 #ifndef _SHADOW_H
 #include <shadow/shadow.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern int __getspent_r (struct spwd *__result_buf, char *__buffer,
 			 size_t __buflen, struct spwd **__result)
@@ -47,4 +49,5 @@  DECLARE_NSS_PROTOTYPES (nisplus)
 #undef DECLARE_NSS_PROTOTYPES


+# endif /* !_ISOMAC */
 #endif
diff --git a/include/stdio_ext.h b/include/stdio_ext.h
index 354146f..29c6e68 100644
--- a/include/stdio_ext.h
+++ b/include/stdio_ext.h
@@ -1,6 +1,7 @@ 
 #ifndef	_STDIO_EXT_H
+#include <stdio-common/stdio_ext.h>

-# include <stdio-common/stdio_ext.h>
+# ifndef _ISOMAC

 libc_hidden_proto (__fsetlocking)

@@ -18,5 +19,5 @@  libc_hidden_proto (__fsetlocking)
      __result;								\
   })

-
-#endif
+# endif /* !_ISOMAC */
+#endif /* stdio_ext.h */
diff --git a/include/sys/epoll.h b/include/sys/epoll.h
index ce1c2e2..86e0a54 100644
--- a/include/sys/epoll.h
+++ b/include/sys/epoll.h
@@ -1,6 +1,9 @@ 
 #ifndef _SYS_EPOLL_H
 #include_next <sys/epoll.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (epoll_pwait)

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/file.h b/include/sys/file.h
index e73a4d1..d0cd1f9 100644
--- a/include/sys/file.h
+++ b/include/sys/file.h
@@ -1,6 +1,10 @@ 
 #ifndef _SYS_FILE_H
 #include <misc/sys/file.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern int __flock (int __fd, int __operation);
+
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/gmon.h b/include/sys/gmon.h
index 55739cf..30889d8 100644
--- a/include/sys/gmon.h
+++ b/include/sys/gmon.h
@@ -1,6 +1,8 @@ 
 #ifndef _SYS_GMON_H
 #include <gmon/sys/gmon.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */

 /* Write current profiling data to file.  */
@@ -12,4 +14,6 @@  extern void __bb_init_func (struct __bb *bb);
 extern void __bb_exit_func (void);

 extern struct gmonparam _gmonparam attribute_hidden;
+
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
index ebadd52..bfc6909 100644
--- a/include/sys/ioctl.h
+++ b/include/sys/ioctl.h
@@ -1,6 +1,10 @@ 
 #ifndef _SYS_IOCTL_H
 #include <misc/sys/ioctl.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern int __ioctl (int __fd, unsigned long int __request, ...);
+
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/prctl.h b/include/sys/prctl.h
index 316f454..0920ed6 100644
--- a/include/sys/prctl.h
+++ b/include/sys/prctl.h
@@ -1,6 +1,9 @@ 
 #ifndef _SYS_PRCTL_H
 #include_next <sys/prctl.h>

+# ifndef _ISOMAC
+
 extern int __prctl (int __option, ...);

+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/profil.h b/include/sys/profil.h
index 7bf1700..2b11330 100644
--- a/include/sys/profil.h
+++ b/include/sys/profil.h
@@ -1,9 +1,12 @@ 
 #ifndef _PROFIL_H
 #include <gmon/sys/profil.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */

 extern int __sprofil (struct prof *__profp, int __profcnt,
 		      struct timeval *__tvp, unsigned int __flags);

+# endif /* !_ISOMAC */
 #endif /* _PROFIL_H */
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
index e34ad02..3fac4a3 100644
--- a/include/sys/statfs.h
+++ b/include/sys/statfs.h
@@ -1,10 +1,14 @@ 
 #ifndef _SYS_STATFS_H
 #include <io/sys/statfs.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern int __statfs (const char *__file, struct statfs *__buf);
 libc_hidden_proto (__statfs)
 extern int __fstatfs (int __fildes, struct statfs *__buf);
 extern int __statfs64 (const char *__file, struct statfs64 *__buf);
 extern int __fstatfs64 (int __fildes, struct statfs64 *__buf);
+
+# endif /* !_ISOMAC */
 #endif
diff --git a/include/sys/sysctl.h b/include/sys/sysctl.h
index 4fffb4f..2a15e91 100644
--- a/include/sys/sysctl.h
+++ b/include/sys/sysctl.h
@@ -1,10 +1,13 @@ 
 #ifndef _SYS_SYSCTL_H
 #include_next <sys/sysctl.h>

+# ifndef _ISOMAC
+
 /* Read or write system parameters (Linux, FreeBSD specific).  */
 extern int __sysctl (int *__name, int __nlen, void *__oldval,
 		     size_t *__oldlenp, void *__newval, size_t __newlen);
 libc_hidden_proto (__sysctl)


+# endif /* !_ISOMAC */
 #endif  /* _SYS_SYSCTL_H */
diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h
index d33055a..c33eae2 100644
--- a/include/sys/sysinfo.h
+++ b/include/sys/sysinfo.h
@@ -1,6 +1,8 @@ 
 #ifndef _SYS_SYSINFO_H
 #include_next <sys/sysinfo.h>

+# ifndef _ISOMAC
+
 /* Now we define the internal interface.  */

 /* Return number of configured processors.  */
@@ -18,4 +20,5 @@  extern long int __get_avphys_pages (void);
 /* Return maximum number of processes this real user ID can have.  */
 extern long int __get_child_max (void);

+# endif /* !_ISOMAC */
 #endif /* sys/sysinfo.h */
diff --git a/include/ttyent.h b/include/ttyent.h
index 81e5211..53a6668 100644
--- a/include/ttyent.h
+++ b/include/ttyent.h
@@ -1,5 +1,7 @@ 
 #ifndef	_TTYENT_H
-# include <misc/ttyent.h>
+#include <misc/ttyent.h>
+
+# ifndef _ISOMAC

 extern __typeof (getttyent) __getttyent __THROW;
 libc_hidden_proto (__getttyent)
@@ -8,4 +10,5 @@  libc_hidden_proto (__setttyent)
 extern __typeof (endttyent) __endttyent __THROW;
 libc_hidden_proto (__endttyent)

-#endif
+# endif /* !_ISOMAC */
+#endif /* ttyent.h */
diff --git a/include/utmp.h b/include/utmp.h
index 28207d1..6b2e262 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -1,6 +1,8 @@ 
 #ifndef _UTMP_H
 #include <login/utmp.h>

+# ifndef _ISOMAC
+
 /* Now define the internal interfaces.  */
 extern void __updwtmp (const char *__wtmp_file, const struct utmp *__utmp);
 extern int __utmpname (const char *__file);
@@ -18,4 +20,5 @@  extern int __getutline_r (const struct utmp *__line,

 libutil_hidden_proto (login_tty)

+# endif /* !_ISOMAC */
 #endif
diff --git a/scripts/check-installed-headers.sh
b/scripts/check-installed-headers.sh
new file mode 100644
index 0000000..7fbc725
--- /dev/null
+++ b/scripts/check-installed-headers.sh
@@ -0,0 +1,146 @@ 
+#! /bin/sh
+# Copyright (C) 2016 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+# Check installed headers for cleanliness.  For each header, confirm
+# that it's possible to compile a file that includes that header and
+# does nothing else, in several different compilation modes.  Also,
+# scan the header for a set of obsolete typedefs that should no longer
+# appear.
+
+# These compilation switches assume GCC or compatible, which is probably
+# fine since we also assume that when _building_ glibc.
+c_modes="-std=c89 -std=gnu89 -std=c11 -std=gnu11"
+cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11"
+
+# An exhaustive test of feature selection macros would take far too long.
+# These are probably the most commonly used three.
+lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700"
+
+# sys/types.h+bits/types.h have to define the obsolete types.
+# rpc(svc)/* have the obsolete types too deeply embedded in their API
+# to remove.
+skip_obsolete_type_check='*/sys/types.h|*/bits/types.h|*/rpc/*|*/rpcsvc/*'
+obsolete_type_re=\
+'\<((__)?(quad_t|u(short|int|long|_(char|short|int([0-9]+_t)?|long|quad_t))))\>'
+
+if [ $# -lt 3 ]; then
+    echo "usage: $0 c|c++ \"compile command\" header header header..." >&2
+    exit 2
+fi
+case "$1" in
+    (c)
+        lang_modes="$c_modes"
+        cih_test_c=$(mktemp ${TMPDIR-/tmp}/cih_test_XXXXXX.c)
+        already="$skip_obsolete_type_check"
+    ;;
+    (c++)
+        lang_modes="$cxx_modes"
+        cih_test_c=$(mktemp ${TMPDIR-/tmp}/cih_test_XXXXXX.cc)
+        # The obsolete-type check can be skipped for C++; it is
+        # sufficient to do it for C.
+        already="*"
+    ;;
+    (*)
+        echo "usage: $0 c|c++ \"compile command\" header header
header..." >&2
+        exit 2;;
+esac
+shift
+cc_cmd="$1"
+shift
+trap "rm -f '$cih_test_c'" 0
+
+failed=0
+is_x86_64=unknown
+for header in "$@"; do
+    # Skip various headers for which this test gets a false failure.
+    case "$header" in
+        # bits/* are not meant to be included directly and usually #error
+        # out if you try it.
+        # regexp.h is a stub containing only an #error.
+        # Sun RPC's .x files are traditionally installed in
+        # $prefix/include/rpcsvc, but they are not C header files.
+        (bits/* | regexp.h | rpcsvc/*.x)
+            continue;;
+
+        # sys/elf.h and sys/vm86.h are "unsupported on x86-64" and
+        # #error out on that target.
+        (sys/elf.h | sys/vm86.h)
+            case "$is_x86_64" in
+                (yes) continue;;
+                (no)  ;;
+                (unknown)
+                    cat >"$cih_test_c" <<EOF
+#if defined __x86_64__ && __x86_64__
+#error "is x86-64"
+#endif
+EOF
+                    if $cc_cmd -fsyntax-only "$cih_test_c" > /dev/null 2>&1
+                    then
+                        is_x86_64=no
+                    else
+                        is_x86_64=yes
+                        continue
+                    fi
+                ;;
+            esac
+    esac
+
+    echo :: "$header"
+    for lang_mode in "" $lang_modes; do
+        for lib_mode in "" $lib_modes; do
+            echo :::: $lang_mode $lib_mode
+            if [ -z "$lib_mode" ]; then
+                expanded_lib_mode='/* default library mode */'
+            else
+                expanded_lib_mode=$(echo : $lib_mode | \
+                    sed 's/^: -D/#define /; s/=/ /')
+            fi
+            cat >"$cih_test_c" <<EOF
+/* These macros may have been defined on the command line.  They are
+   inappropriate for this test.  */
+#undef _LIBC
+#undef _GNU_SOURCE
+#undef _REENTRANT
+/* The library mode is selected here rather than on the command line to
+   ensure that this selection wins. */
+$expanded_lib_mode
+#include <$header>
+int avoid_empty_translation_unit;
+EOF
+            if $cc_cmd -fsyntax-only $lang_mode "$cih_test_c" 2>&1
+            then
+                includes=$($cc_cmd -fsyntax-only -H $lang_mode \
+                              "$cih_test_c" 2>&1 | sed -ne 's/^[.][.]*
//p')
+                for h in $includes; do
+                    # Don't repeat work.
+                    eval 'case "$h" in ('"$already"') continue;; esac'
+
+                    if grep -qE "$obsolete_type_re" "$h"; then
+                        echo "*** Obsolete types detected:"
+                        grep -HE "$obsolete_type_re" "$h"
+                        failed=1
+                    fi
+                    already="$already|$h"
+                done
+            else
+                failed=1
+            fi
+        done
+    done
+done
+exit $failed
diff --git a/sysdeps/arm/nacl/include/bits/setjmp.h
b/sysdeps/arm/nacl/include/bits/setjmp.h
index 6b6a235..e1fe505 100644
--- a/sysdeps/arm/nacl/include/bits/setjmp.h
+++ b/sysdeps/arm/nacl/include/bits/setjmp.h
@@ -24,6 +24,8 @@ 
 # include <sysdeps/arm/bits/setjmp.h>
 #endif

+# ifndef _ISOMAC
+
 /* Register list for a ldm/stm instruction to load/store
    the general registers from a __jmp_buf.

@@ -35,4 +37,5 @@ 
 /* Index of __jmp_buf where the sp register resides.  */
 #define __JMP_BUF_SP		0

+# endif /* _ISOMAC */
 #endif  /* include/bits/setjmp.h */
diff --git a/sysdeps/mips/include/sys/asm.h b/sysdeps/mips/include/sys/asm.h
index 7e288df..67acf74 100644
--- a/sysdeps/mips/include/sys/asm.h
+++ b/sysdeps/mips/include/sys/asm.h
@@ -16,8 +16,9 @@ 
    <http://www.gnu.org/licenses/>.  */

 #ifndef _SYS_ASM_H
+#include_next <sys/asm.h>

-# include_next <sys/asm.h>
+# ifndef _ISOMAC

 # undef __mips_cfi_startproc
 # define __mips_cfi_startproc cfi_startproc
@@ -50,4 +51,5 @@ 
 	cfi_restore (gp)
 # endif

-#endif
+# endif /* _ISOMAC */
+#endif /* sys/asm.h */
diff --git a/sysdeps/unix/sysv/linux/include/sys/sysinfo.h
b/sysdeps/unix/sysv/linux/include/sys/sysinfo.h
index 50077fb..b76f7e0 100644
--- a/sysdeps/unix/sysv/linux/include/sys/sysinfo.h
+++ b/sysdeps/unix/sysv/linux/include/sys/sysinfo.h
@@ -21,6 +21,9 @@ 

 #include_next <sys/sysinfo.h>

+# ifndef _ISOMAC
+
 extern __typeof (sysinfo) __sysinfo __THROW;

+# endif /* _ISOMAC */
 #endif /* sys/sysinfo.h */
diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h
b/sysdeps/unix/sysv/linux/include/sys/timex.h
index ace90ee..4b4ff88 100644
--- a/sysdeps/unix/sysv/linux/include/sys/timex.h
+++ b/sysdeps/unix/sysv/linux/include/sys/timex.h
@@ -21,6 +21,9 @@ 

 #include_next <sys/timex.h>

+# ifndef _ISOMAC
+
 libc_hidden_proto (__adjtimex)

+# endif /* _ISOMAC */
 #endif /* sys/timex.h */
diff --git a/sysdeps/x86/fpu/include/bits/fenv.h
b/sysdeps/x86/fpu/include/bits/fenv.h
index 6e8b733..a410ed0 100644
--- a/sysdeps/x86/fpu/include/bits/fenv.h
+++ b/sysdeps/x86/fpu/include/bits/fenv.h
@@ -16,8 +16,11 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */

+#ifndef _BITS_FENV_H
 #include_next <bits/fenv.h>

+# ifndef _ISOMAC
+
 /* Ensure __feraiseexcept calls in glibc are optimized the same as
    feraiseexcept calls.  */

@@ -40,3 +43,6 @@  __NTH (__feraiseexcept (int __excepts))

 __END_DECLS
 #endif
+
+# endif /* _ISOMAC */
+#endif /* bits/fenv.h */