Blame m4/sys_ioctl_h.m4

Packit Service fdd496
# sys_ioctl_h.m4 serial 10
Packit Service fdd496
dnl Copyright (C) 2008-2017 Free Software Foundation, Inc.
Packit Service fdd496
dnl This file is free software; the Free Software Foundation
Packit Service fdd496
dnl gives unlimited permission to copy and/or distribute it,
Packit Service fdd496
dnl with or without modifications, as long as this notice is preserved.
Packit Service fdd496
Packit Service fdd496
dnl Written by Bruno Haible.
Packit Service fdd496
Packit Service fdd496
AC_DEFUN([gl_SYS_IOCTL_H],
Packit Service fdd496
[
Packit Service fdd496
  dnl Use AC_REQUIRE here, so that the default behavior below is expanded
Packit Service fdd496
  dnl once only, before all statements that occur in other macros.
Packit Service fdd496
  AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
Packit Service fdd496
Packit Service fdd496
  AC_CHECK_HEADERS_ONCE([sys/ioctl.h])
Packit Service fdd496
  if test $ac_cv_header_sys_ioctl_h = yes; then
Packit Service fdd496
    HAVE_SYS_IOCTL_H=1
Packit Service fdd496
    dnl Test whether <sys/ioctl.h> declares ioctl(), or whether some other
Packit Service fdd496
    dnl header file, such as <unistd.h> or <stropts.h>, is needed for that.
Packit Service fdd496
    AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl],
Packit Service fdd496
      [gl_cv_decl_ioctl_in_sys_ioctl_h],
Packit Service fdd496
      [dnl We cannot use AC_CHECK_DECL because it produces its own messages.
Packit Service fdd496
       AC_COMPILE_IFELSE(
Packit Service fdd496
         [AC_LANG_PROGRAM(
Packit Service fdd496
            [AC_INCLUDES_DEFAULT([#include <sys/ioctl.h>])],
Packit Service fdd496
            [(void) ioctl;])],
Packit Service fdd496
         [gl_cv_decl_ioctl_in_sys_ioctl_h=yes],
Packit Service fdd496
         [gl_cv_decl_ioctl_in_sys_ioctl_h=no])
Packit Service fdd496
      ])
Packit Service fdd496
  else
Packit Service fdd496
    HAVE_SYS_IOCTL_H=0
Packit Service fdd496
  fi
Packit Service fdd496
  AC_SUBST([HAVE_SYS_IOCTL_H])
Packit Service fdd496
  dnl <sys/ioctl.h> is always overridden, because of GNULIB_POSIXCHECK.
Packit Service fdd496
  gl_CHECK_NEXT_HEADERS([sys/ioctl.h])
Packit Service fdd496
Packit Service fdd496
  dnl Check for declarations of anything we want to poison if the
Packit Service fdd496
  dnl corresponding gnulib module is not in use.
Packit Service fdd496
  gl_WARN_ON_USE_PREPARE([[#include <sys/ioctl.h>
Packit Service fdd496
/* Some platforms declare ioctl in the wrong header.  */
Packit Service fdd496
#if !(defined __GLIBC__ && !defined __UCLIBC__)
Packit Service fdd496
# include <unistd.h>
Packit Service fdd496
#endif
Packit Service fdd496
    ]], [ioctl])
Packit Service fdd496
])
Packit Service fdd496
Packit Service fdd496
AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR],
Packit Service fdd496
[
Packit Service fdd496
  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
Packit Service fdd496
  AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
Packit Service fdd496
  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
Packit Service fdd496
  dnl Define it also as a C macro, for the benefit of the unit tests.
Packit Service fdd496
  gl_MODULE_INDICATOR_FOR_TESTS([$1])
Packit Service fdd496
])
Packit Service fdd496
Packit Service fdd496
AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS],
Packit Service fdd496
[
Packit Service fdd496
  GNULIB_IOCTL=0;         AC_SUBST([GNULIB_IOCTL])
Packit Service fdd496
  dnl Assume proper GNU behavior unless another module says otherwise.
Packit Service fdd496
  SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H])
Packit Service fdd496
  SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
Packit Service fdd496
                        AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
Packit Service fdd496
  REPLACE_IOCTL=0;      AC_SUBST([REPLACE_IOCTL])
Packit Service fdd496
])