annotate m4/ioctl.m4 @ 40057:b06060465f09

maint: Run 'make update-copyright'
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 01 Jan 2019 00:25:11 +0100
parents 10eb9086bea0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19254
46ad39e4acfe ioctl: Override non-POSIX declaration on Haiku.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
1 # ioctl.m4 serial 5
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
13245
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_IOCTL],
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 [
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 AC_REQUIRE([gl_HEADER_SYS_SOCKET])
14987
205da32df725 ioctl: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents: 14685
diff changeset
11 HAVE_IOCTL=1
13245
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 if test "$ac_cv_header_winsock2_h" = yes; then
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 dnl Even if the 'socket' module is not used here, another part of the
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 dnl application may use it and pass file descriptors that refer to
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 dnl sockets to the ioctl() function. So enable the support for sockets.
14987
205da32df725 ioctl: Move AC_LIBOBJ invocations to module description.
Bruno Haible <bruno@clisp.org>
parents: 14685
diff changeset
16 HAVE_IOCTL=0
13245
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 else
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 AC_CHECK_FUNCS([ioctl])
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 dnl On glibc systems, the second parameter is 'unsigned long int request',
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 dnl not 'int request'. We cannot simply cast the function pointer, but
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 dnl instead need a wrapper.
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 AC_CACHE_CHECK([for ioctl with POSIX signature],
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 [gl_cv_func_ioctl_posix_signature],
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 [AC_COMPILE_IFELSE(
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 [AC_LANG_PROGRAM(
19254
46ad39e4acfe ioctl: Override non-POSIX declaration on Haiku.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
26 [[#include <sys/ioctl.h>
46ad39e4acfe ioctl: Override non-POSIX declaration on Haiku.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
27 /* On some platforms, ioctl() is declared in <unistd.h>. */
46ad39e4acfe ioctl: Override non-POSIX declaration on Haiku.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
28 #include <unistd.h>
46ad39e4acfe ioctl: Override non-POSIX declaration on Haiku.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
29 ]],
15438
591ddd1ddd1a Declare system functions in a way that works with C++.
Bruno Haible <bruno@clisp.org>
parents: 14987
diff changeset
30 [[extern
591ddd1ddd1a Declare system functions in a way that works with C++.
Bruno Haible <bruno@clisp.org>
parents: 14987
diff changeset
31 #ifdef __cplusplus
591ddd1ddd1a Declare system functions in a way that works with C++.
Bruno Haible <bruno@clisp.org>
parents: 14987
diff changeset
32 "C"
591ddd1ddd1a Declare system functions in a way that works with C++.
Bruno Haible <bruno@clisp.org>
parents: 14987
diff changeset
33 #endif
591ddd1ddd1a Declare system functions in a way that works with C++.
Bruno Haible <bruno@clisp.org>
parents: 14987
diff changeset
34 int ioctl (int, int, ...);
591ddd1ddd1a Declare system functions in a way that works with C++.
Bruno Haible <bruno@clisp.org>
parents: 14987
diff changeset
35 ]])
13245
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 ],
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 [gl_cv_func_ioctl_posix_signature=yes],
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 [gl_cv_func_ioctl_posix_signature=no])
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 ])
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 if test $gl_cv_func_ioctl_posix_signature != yes; then
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 REPLACE_IOCTL=1
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 fi
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 fi
46c3f440d469 ioctl: Move autoconf macro to a .m4 file.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 ])