autotools: restore HAVE_IOCTL_* detections

This restores `CURL_CHECK_FUNC_IOCTL` detection. I deleted it in
4d73854462 and
c3456652a0 (2022-08), because the
`HAVE_IOCTL` result it generated was unused in the source. But,
I did miss the fact that this had two dependent checks:
`CURL_CHECK_FUNC_IOCTL_FIONBIO`,
`CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR` that we do actually need:
`HAVE_IOCTL_FIONBIO`, `HAVE_IOCTL_SIOCGIFADDR`.

Regression from 4d73854462

Ref: #11964 (effort to sync cmake detections with autotools)

Closes #12008
This commit is contained in:
Viktor Szakats 2023-10-02 11:24:14 +00:00
parent 2a5f6b60b3
commit 4c6365af02
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
2 changed files with 88 additions and 0 deletions

View File

@ -3550,6 +3550,7 @@ CURL_CHECK_FUNC_GETIFADDRS
CURL_CHECK_FUNC_GMTIME_R CURL_CHECK_FUNC_GMTIME_R
CURL_CHECK_FUNC_INET_NTOP CURL_CHECK_FUNC_INET_NTOP
CURL_CHECK_FUNC_INET_PTON CURL_CHECK_FUNC_INET_PTON
CURL_CHECK_FUNC_IOCTL
CURL_CHECK_FUNC_IOCTLSOCKET CURL_CHECK_FUNC_IOCTLSOCKET
CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
CURL_CHECK_FUNC_MEMRCHR CURL_CHECK_FUNC_MEMRCHR

View File

@ -3323,6 +3323,93 @@ AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
]) ])
dnl CURL_CHECK_FUNC_IOCTL
dnl -------------------------------------------------
dnl Verify if ioctl is available, prototyped, and
dnl can be compiled. If all of these are true, and
dnl usage has not been previously disallowed with
dnl shell variable curl_disallow_ioctl, then
dnl HAVE_IOCTL will be defined.
AC_DEFUN([CURL_CHECK_FUNC_IOCTL], [
AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl
#
tst_links_ioctl="unknown"
tst_proto_ioctl="unknown"
tst_compi_ioctl="unknown"
tst_allow_ioctl="unknown"
#
AC_MSG_CHECKING([if ioctl can be linked])
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([ioctl])
],[
AC_MSG_RESULT([yes])
tst_links_ioctl="yes"
],[
AC_MSG_RESULT([no])
tst_links_ioctl="no"
])
#
if test "$tst_links_ioctl" = "yes"; then
AC_MSG_CHECKING([if ioctl is prototyped])
AC_EGREP_CPP([ioctl],[
$curl_includes_stropts
],[
AC_MSG_RESULT([yes])
tst_proto_ioctl="yes"
],[
AC_MSG_RESULT([no])
tst_proto_ioctl="no"
])
fi
#
if test "$tst_proto_ioctl" = "yes"; then
AC_MSG_CHECKING([if ioctl is compilable])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
$curl_includes_stropts
]],[[
if(0 != ioctl(0, 0, 0))
return 1;
]])
],[
AC_MSG_RESULT([yes])
tst_compi_ioctl="yes"
],[
AC_MSG_RESULT([no])
tst_compi_ioctl="no"
])
fi
#
if test "$tst_compi_ioctl" = "yes"; then
AC_MSG_CHECKING([if ioctl usage allowed])
if test "x$curl_disallow_ioctl" != "xyes"; then
AC_MSG_RESULT([yes])
tst_allow_ioctl="yes"
else
AC_MSG_RESULT([no])
tst_allow_ioctl="no"
fi
fi
#
AC_MSG_CHECKING([if ioctl might be used])
if test "$tst_links_ioctl" = "yes" &&
test "$tst_proto_ioctl" = "yes" &&
test "$tst_compi_ioctl" = "yes" &&
test "$tst_allow_ioctl" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1,
[Define to 1 if you have the ioctl function.])
curl_cv_func_ioctl="yes"
CURL_CHECK_FUNC_IOCTL_FIONBIO
CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
else
AC_MSG_RESULT([no])
curl_cv_func_ioctl="no"
fi
])
dnl CURL_CHECK_FUNC_IOCTL_FIONBIO dnl CURL_CHECK_FUNC_IOCTL_FIONBIO
dnl ------------------------------------------------- dnl -------------------------------------------------
dnl Verify if ioctl with the FIONBIO command is dnl Verify if ioctl with the FIONBIO command is