This adds a module for the <sys/ioctl.h> header file. 2008-10-09 Bruno Haible <[EMAIL PROTECTED]>
New module 'sys_ioctl'. * lib/sys_ioctl.in.h: New file. * m4/sys_ioctl_h.m4: New file. * modules/sys_ioctl: New file. * doc/glibc-headers/sys_ioctl.texi: Mention the new module. ============================= lib/sys_ioctl.in.h =========================== /* Substitute for and wrapper around <sys/ioctl.h>. Copyright (C) 2008 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GL_SYS_IOCTL_H @PRAGMA_SYSTEM_HEADER@ /* The include_next requires a split double-inclusion guard. */ #if @HAVE_SYS_IOCTL_H@ # @INCLUDE_NEXT@ @NEXT_SYS_IOCTL_H@ #endif #ifndef _GL_SYS_IOCTL_H #define _GL_SYS_IOCTL_H /* AIX 5.1 and Solaris 10 declare ioctl() in <unistd.h> and in <stropts.h>, but not in <sys/ioctl.h>. */ #include <unistd.h> /* The definition of GL_LINK_WARNING is copied here. */ /* Declare overridden functions. */ #ifdef __cplusplus extern "C" { #endif #if @GNULIB_IOCTL@ # if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ # undef ioctl # define ioctl rpl_ioctl extern int ioctl (int fd, int request, ... /* {void *,char *} arg */); # endif #elif @SYS_IOCTL_H_HAVE_WINSOCK2_H@ # undef ioctl # define ioctl ioctl_used_without_requesting_gnulib_module_ioctl #elif defined GNULIB_POSIXCHECK # undef ioctl # define ioctl(f,c,a) \ (GL_LINK_WARNING ("ioctl does not portably work on sockets - " \ "use gnulib module ioctl for portability"), \ ioctl (f, c, a)) #endif #ifdef __cplusplus } #endif #endif /* _GL_SYS_IOCTL_H */ #endif /* _GL_SYS_IOCTL_H */ ============================= m4/sys_ioctl_h.m4 ============================ # sys_ioctl_h.m4 serial 1 dnl Copyright (C) 2008 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 Written by Bruno Haible. AC_DEFUN([gl_SYS_IOCTL_H], [ dnl Use AC_REQUIRE here, so that the default behavior below is expanded dnl once only, before all statements that occur in other macros. AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) AC_CHECK_HEADERS_ONCE([sys/ioctl.h]) if test $ac_cv_header_sys_ioctl_h = yes; then HAVE_SYS_IOCTL_H=1 dnl Test whether <sys/ioctl.h> declares ioctl(), or whether some other dnl header file, such as <unistd.h> or <stropts.h>, is needed for that. AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl], [gl_cv_decl_ioctl_in_sys_ioctl_h], [AC_CHECK_DECL([ioctl], [gl_cv_decl_ioctl_in_sys_ioctl_h=yes], [gl_cv_decl_ioctl_in_sys_ioctl_h=no], [#include <sys/ioctl.h>]) ]) if test $gl_cv_decl_ioctl_in_sys_ioctl_h != yes; then SYS_IOCTL_H='sys/ioctl.h' fi else HAVE_SYS_IOCTL_H=0 SYS_IOCTL_H='sys/ioctl.h' fi AC_SUBST([HAVE_SYS_IOCTL_H]) dnl Execute this unconditionally, because SYS_IOCTL_H may be set by other dnl modules, after this code is executed. gl_CHECK_NEXT_HEADERS([sys/ioctl.h]) ]) dnl Unconditionally enables the replacement of <sys/ioctl.h>. AC_DEFUN([gl_REPLACE_SYS_IOCTL_H], [ AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) SYS_IOCTL_H='sys/ioctl.h' ]) AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR], [ dnl Use AC_REQUIRE here, so that the default settings are expanded once only. AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 ]) AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS], [ GNULIB_IOCTL=0; AC_SUBST([GNULIB_IOCTL]) dnl Assume proper GNU behavior unless another module says otherwise. SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H]) SYS_IOCTL_H=''; AC_SUBST([SYS_IOCTL_H]) ]) ============================= modules/sys_ioctl ============================ Description: A <sys/ioctl.h> for systems with missing declarations. Files: lib/sys_ioctl.in.h m4/sys_ioctl_h.m4 Depends-on: include_next link-warning unistd configure.ac: gl_SYS_IOCTL_H AC_PROG_MKDIR_P Makefile.am: BUILT_SOURCES += $(SYS_IOCTL_H) # We need the following in order to create <sys/ioctl.h> when the system # does not have a complete one. sys/ioctl.h: sys_ioctl.in.h @MKDIR_P@ sys rm -f [EMAIL PROTECTED] $@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''HAVE_SYS_IOCTL_H''@|$(HAVE_SYS_IOCTL_H)|g' \ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''NEXT_SYS_IOCTL_H''@|$(NEXT_SYS_IOCTL_H)|g' \ -e 's|@''GNULIB_IOCTL''@|$(GNULIB_IOCTL)|g' \ -e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \ -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ < $(srcdir)/sys_ioctl.in.h; \ } > [EMAIL PROTECTED] mv [EMAIL PROTECTED] $@ MOSTLYCLEANFILES += sys/ioctl.h sys/ioctl.h-t MOSTLYCLEANDIRS += sys Include: #include <sys/ioctl.h> License: LGPLv2+ Maintainer: all ============================================================================ *** doc/glibc-headers/sys_ioctl.texi.orig 2008-10-10 04:20:36.000000000 +0200 --- doc/glibc-headers/sys_ioctl.texi 2008-10-10 04:18:32.000000000 +0200 *************** *** 16,29 **** @uref{http://www.kernel.org/doc/man-pages/online/pages/man2/ioctl.2.html,,man ioctl}. @end itemize ! Gnulib module: --- Portability problems fixed by Gnulib: @itemize - @end itemize - - Portability problems not fixed by Gnulib: - @itemize @item This header file is missing on some platforms: mingw. --- 16,25 ---- @uref{http://www.kernel.org/doc/man-pages/online/pages/man2/ioctl.2.html,,man ioctl}. @end itemize ! Gnulib module: sys_ioctl Portability problems fixed by Gnulib: @itemize @item This header file is missing on some platforms: mingw. *************** *** 31,33 **** --- 27,33 ---- This header file does not declare the @code{ioctl} function on some platforms: AIX 5.1, Solaris 10. @end itemize + + Portability problems not fixed by Gnulib: + @itemize + @end itemize