Blame m4/sys_ioctl_h.m4

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