source: trunk/src/grep/m4/ioctl.m4@ 3602

Last change on this file since 3602 was 3529, checked in by bird, 4 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:eol-style set to LF
File size: 1.5 KB
Line 
1# ioctl.m4 serial 6
2dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_IOCTL],
8[
9 AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
10 AC_REQUIRE([gl_SYS_SOCKET_H])
11 HAVE_IOCTL=1
12 if test "$ac_cv_header_winsock2_h" = yes; then
13 dnl Even if the 'socket' module is not used here, another part of the
14 dnl application may use it and pass file descriptors that refer to
15 dnl sockets to the ioctl() function. So enable the support for sockets.
16 HAVE_IOCTL=0
17 else
18 AC_CHECK_FUNCS([ioctl])
19 dnl On glibc systems, the second parameter is 'unsigned long int request',
20 dnl not 'int request'. We cannot simply cast the function pointer, but
21 dnl instead need a wrapper.
22 AC_CACHE_CHECK([for ioctl with POSIX signature],
23 [gl_cv_func_ioctl_posix_signature],
24 [AC_COMPILE_IFELSE(
25 [AC_LANG_PROGRAM(
26 [[#include <sys/ioctl.h>
27 /* On some platforms, ioctl() is declared in <unistd.h>. */
28 #include <unistd.h>
29 ]],
30 [[extern
31 #ifdef __cplusplus
32 "C"
33 #endif
34 int ioctl (int, int, ...);
35 ]])
36 ],
37 [gl_cv_func_ioctl_posix_signature=yes],
38 [gl_cv_func_ioctl_posix_signature=no])
39 ])
40 if test $gl_cv_func_ioctl_posix_signature != yes; then
41 REPLACE_IOCTL=1
42 fi
43 fi
44])
Note: See TracBrowser for help on using the repository browser.