Skip to content

Use AC_SEARCH_LIBS for socketpair, gethostname and gethostbyaddr #14116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2024

Conversation

petk
Copy link
Member

@petk petk commented May 2, 2024

The socketpair():

  • C library: Solaris 11.4 and most other systems
  • libsocket: Solaris <= 11.3 and illumos
  • libnetwork: Haiku

The gethostname() check is moved to AC_CHECK_FUNCS:

  • C library: most systems
  • libnsl: none
  • libnetwork: Haiku (which is already checked in the libraries section)

The gethostbyaddr():

  • C library: most systems, Solaris 11.4
  • libnsl: Solaris 11.3, illumos
  • libnetwork: Haiku

This also removes redundant unused symbols:

  • HAVE_GETHOSTBYADDR
  • HAVE_LIBNETWORK
  • HAVE_LIBNSL

The outdated comment about -lnsl and -lsocket linking has been removed because these systems are long not supported anymore and this issue is not relevant anymore like mentioned. The initial solution was different than the one with the PHP_CHECK_FUNC macros at the current versions. See commit a188fac where the gethostbyaddr() was checked conditionally based on the gethostname() availability in libc. Main issue was mostly related to the redundant nsl library being always linked because of the AC_CHECK_LIB.

The socketpair():
* C library: Solaris 11.4 and most other systems
* libsocket: Solaris <= 11.3 and illumos
* libnetwork: Haiku

The gethostname() check is moved to AC_CHECK_FUNCS:
* C library: most systems
* libnsl: none
* libnetwork: Haiku (which is already checked in the libraries section)

The gethostbyaddr():
* C library: most systems, Solaris 11.4
* libnsl: Solaris 11.3, illumos
* libnetwork: Haiku

This also removes redundant unused symbols:
- HAVE_GETHOSTBYADDR
- HAVE_LIBNETWORK
- HAVE_LIBNSL

The outdated comment about -lnsl and -lsocket linking has been removed
because these systems are long not supported anymore and this issue is
not relevant anymore like mentioned. The initial solution was different
than the one with the PHP_CHECK_FUNC macros at the current versions.
See commit a188fac where the
gethostbyaddr() was checked conditionally based on the gethostname()
availability in libc. Main issue was mostly related to the redundant nsl
library being always linked because of the AC_CHECK_LIB.
@petk petk merged commit 4465e50 into php:master May 3, 2024
10 checks passed
@petk petk deleted the patch-libs branch May 3, 2024 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants