Eric Blake wrote: > _Too much_ copy-n-paste from the sys/socket module. Yes... Still copy&paste is the right technique since the same problem deserves the same solution.
It occurs also for the sys_select module: MacOS X <sys/select.h> is not self-contained: gcc -DHAVE_CONFIG_H -I. -I. -I. -I.. -I./.. -I../gllib -I./../gllib -g -O2 -MT test-sys_select.o -MD -MP -MF .deps/test-sys_select.Tpo -c -o test-sys_select.o test-sys_select.c In file included from /usr/include/sys/select.h:71, from test-sys_select.c:22: /usr/include/sys/event.h:66: error: parse error before "uintptr_t" /usr/include/sys/event.h:68: error: parse error before "flags" /usr/include/sys/event.h:69: error: parse error before "fflags" /usr/include/sys/event.h:70: error: parse error before "data" /usr/include/sys/event.h:72: error: parse error before '}' token In file included from test-sys_select.c:22: /usr/include/sys/select.h:88: error: parse error before "u_int" make[4]: *** [test-sys_select.o] Error 1 This proposed patch fixes it (copy&pasted :-)). 2007-03-03 Bruno Haible <[EMAIL PROTECTED]> * lib/sys_select_.h: New file. * m4/sys_socket_h.m4 (gl_HEADER_SYS_SELECT): Test whether sys/select.h is self-contained. Set ABSOLUTE_SYS_SELECT_H, HAVE_SYS_SELECT_H. * modules/sys_select (Files): Add lib/sys_select_.h. (Depends-on): Add absolute-header. (Makefile.am): Substitute ABSOLUTE_SYS_SELECT_H, HAVE_SYS_SELECT_H into sys/select.h. *** m4/sys_select_h.m4 27 Jun 2006 21:21:13 -0000 1.1 --- m4/sys_select_h.m4 3 Mar 2007 13:40:52 -0000 *************** *** 1,18 **** ! # sys_select_h.m4 serial 1 ! dnl Copyright (C) 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. - dnl Adapted from arpa_inet.m4, written by Simon Josefsson. - AC_DEFUN([gl_HEADER_SYS_SELECT], [ ! AC_CHECK_HEADERS_ONCE([sys/select.h]) ! if test $ac_cv_header_sys_select_h = yes; then SYS_SELECT_H='' else SYS_SELECT_H='sys/select.h' fi ! AC_SUBST(SYS_SELECT_H) ]) --- 1,32 ---- ! # sys_select_h.m4 serial 2 ! dnl Copyright (C) 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_HEADER_SYS_SELECT], [ ! AC_CACHE_CHECK([whether <sys/select.h> is self-contained], ! [gl_cv_header_sys_select_h_selfcontained], ! [ ! AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/select.h>], [])], ! [gl_cv_header_sys_select_h_selfcontained=yes], ! [gl_cv_header_sys_select_h_selfcontained=no]) ! ]) ! if test $gl_cv_header_sys_select_h_selfcontained = yes; then SYS_SELECT_H='' else SYS_SELECT_H='sys/select.h' + AC_CHECK_HEADERS([sys/select.h]) + gl_ABSOLUTE_HEADER([sys/select.h]) + ABSOLUTE_SYS_SELECT_H=\"$gl_cv_absolute_sys_select_h\" + AC_SUBST([ABSOLUTE_SYS_SELECT_H]) + if test $ac_cv_header_sys_select_h = yes; then + HAVE_SYS_SELECT_H=1 + else + HAVE_SYS_SELECT_H=0 + fi + AC_SUBST([HAVE_SYS_SELECT_H]) fi ! AC_SUBST([SYS_SELECT_H]) ]) *** modules/sys_select 22 Jan 2007 23:07:42 -0000 1.7 --- modules/sys_select 3 Mar 2007 13:40:52 -0000 *************** *** 1,10 **** Description: ! A <sys/select.h> for systems lacking it (e.g., Mingw). Files: m4/sys_select_h.m4 Depends-on: sys_socket configure.ac: --- 1,12 ---- Description: ! A <sys/select.h> for systems lacking it. Files: + lib/sys_select_.h m4/sys_select_h.m4 Depends-on: + absolute-header sys_socket configure.ac: *************** *** 20,26 **** @MKDIR_P@ sys rm -f [EMAIL PROTECTED] $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ! echo '#include <sys/socket.h>'; \ } > [EMAIL PROTECTED] mv [EMAIL PROTECTED] $@ MOSTLYCLEANFILES += sys/select.h sys/select.h-t --- 22,30 ---- @MKDIR_P@ sys rm -f [EMAIL PROTECTED] $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ ! sed -e 's|@''ABSOLUTE_SYS_SELECT_H''@|$(ABSOLUTE_SYS_SELECT_H)|g' \ ! -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \ ! < $(srcdir)/sys_select_.h; \ } > [EMAIL PROTECTED] mv [EMAIL PROTECTED] $@ MOSTLYCLEANFILES += sys/select.h sys/select.h-t