Skip to content

Commit d024dd3

Browse files
authored
Simplify nanosleep Autoconf check (php#13490)
The nanosleep() is mostly found in libc, except on systems, such as Solaris <= 10 or the discontinued OpenSolaris, it is in the rt library. This checks if nanosleep() exists in the libc, then it checks if rt library has nanosleep, prepends it to LIBS and defines the HAVE_NANOSLEEP symbol with the template from the AC_CHECK_FUNCS.
1 parent 6d721b2 commit d024dd3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

configure.ac

+3-3
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@ usleep \
620620
utime \
621621
vasprintf \
622622
asprintf \
623-
nanosleep \
624623
memmem \
625624
memrchr \
626625
mempcpy \
@@ -638,8 +637,9 @@ AC_CHECK_HEADER([sys/procctl.h], [AC_CHECK_FUNCS([procctl])])
638637

639638
AX_FUNC_WHICH_GETHOSTBYNAME_R
640639

641-
dnl Some systems (like OpenSolaris) do not have nanosleep in libc.
642-
PHP_CHECK_FUNC_LIB(nanosleep, rt)
640+
dnl Some systems (Solaris 10) do not have nanosleep in libc.
641+
AC_CHECK_FUNCS([nanosleep],,
642+
[AC_SEARCH_LIBS([nanosleep], [rt], [AC_DEFINE([HAVE_NANOSLEEP], [1])])])
643643

644644
dnl Haiku does not have network api in libc.
645645
PHP_CHECK_FUNC_LIB(setsockopt, network)

0 commit comments

Comments
 (0)