Skip to content

update musl libc test to fix "cross" compilation on glibc system #19352

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,21 @@ esac

dnl Detect musl libc
AC_MSG_CHECKING([whether we are using musl libc])
if command -v ldd >/dev/null && ldd --version 2>&1 | grep ^musl >/dev/null 2>&1
then
AC_MSG_RESULT([yes])
AC_DEFINE([__MUSL__], [1], [Define to 1 when using musl libc.])
else
AC_MSG_RESULT([no])
fi
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([[
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <features.h>
#ifdef __USE_GNU
#error Not using musl
#endif
int main(void) { return 0; }
]])],
[AC_MSG_RESULT([yes])
AC_DEFINE([__MUSL__], [1], [Define to 1 when using musl libc.])],
[AC_MSG_RESULT([no])]
)

dnl Add _GNU_SOURCE compile definition because the php_config.h with definitions
dnl by AC_USE_SYSTEM_EXTENSIONS might be included after the system headers which
Expand Down