--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,20 @@ gl_VISIBILITY
 AC_CHECK_HEADERS([sys/klog.h])
 AC_CHECK_FUNCS([klogctl])
 
+AC_CACHE_CHECK([for ioctl with POSIX signature],
+  [gl_cv_func_ioctl_posix_signature],
+  [AC_COMPILE_IFELSE(
+     [AC_LANG_PROGRAM(
+        [[#include <sys/ioctl.h>]],
+        [[int ioctl (int, int, ...);]])
+     ],
+     [gl_cv_func_ioctl_posix_signature=yes],
+     [gl_cv_func_ioctl_posix_signature=no])
+  ])
+if test "x$gl_cv_func_ioctl_posix_signature" = xyes; then
+  AC_DEFINE([HAVE_POSIX_IOCTL], [1], [Have ioctl with POSIX signature])
+fi
+
 # Check host os
 case "$host_os" in
   linux*)
