diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-06-16 11:51:21 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-06-16 13:17:19 +0900 |
commit | c2d9967f78d2e6f93f8d9876c2b3ab25aa6b86e7 (patch) | |
tree | 938aebd645ee59b00b64befe1da72669343dc3af /configure.ac | |
parent | d4db18d6adf93ba48bb15657f4d96d15cf0b7f93 (diff) | |
download | ruby-c2d9967f78d2e6f93f8d9876c2b3ab25aa6b86e7.tar.gz |
Configure ioctl request argument type [Bug #17759]
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 93065427fa..38ab4bd586 100644 --- a/configure.ac +++ b/configure.ac @@ -2753,6 +2753,36 @@ AS_IF([test "x$rb_cv_const_page_size" = xyes], [AC_DEFINE(HAVE_CONST_PAGE_SIZE, 1)], [AC_DEFINE(HAVE_CONST_PAGE_SIZE, 0)] ) + +AS_IF([test "x$ac_cv_func_ioctl" = xyes], [ + AC_CACHE_CHECK([ioctl request type], rb_cv_ioctl_request_type, + [rb_cv_ioctl_request_type=no + dnl corresponding NUM2IOCTLREQ needs to be defined + for type in "unsigned long:ULONG_MAX" int:INT_MAX; do + max=`echo $type | sed 's/.*://'` + type=`echo $type | sed 's/:.*//'` + RUBY_WERROR_FLAG([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + @%:@include <limits.h> + @%:@include <sys/types.h> + @%:@if defined(HAVE_SYS_IOCTL_H) && !defined(_WIN32) + @%:@include <sys/ioctl.h> + @%:@endif + ]], [[ + $type req = $max; + if (ioctl(0, req)) {/* do nothing*/}; + ]])], + [rb_cv_ioctl_request_type="$type"]) + ]) + test "x$rb_cv_ioctl_request_type" = xno || break + done]) + AS_CASE(["$rb_cv_ioctl_request_type"], [no|int], [], + ["unsigned long"], [ + AC_DEFINE_UNQUOTED(IOCTL_REQ_TYPE, [$rb_cv_ioctl_request_type]) + AC_DEFINE_UNQUOTED(NUM2IOCTLREQ(num), [NUM2ULONG(num)]) + ]) +]) + } : "runtime section" && { |