-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use AX_CHECK_COMPILE_FLAG macro to check for -fvisibility=hidden #2124
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
Conversation
…ort. The existing check for -fvisibility=hidden support came from a time when only GCC had it. The test for it used a regular expression to parse the GCC major version from the output of `$CC --version`, and would look for version 4 or greater. The regular expression used to accomplish this is doomed, however, since GCC can be built with a custom version string (--with-pkgversion). Moreover, the $CC variable can be set to something that confuses it but is otherwise valid. For example, it would fail with CC=x86_64-pc-linux-gnu-gcc. This commit fixes two aspects of the feature test. First, it no longer limits the test to GCC. At least clang now supports the flag, and can make use of it when GCC is its backend. Second, support for the flag is tested directly, by attempting to pass it to the compiler, rather than by parsing its version string. The latter is accomplished with a new macro, AX_CHECK_COMPILE_FLAG, taken from the autoconf archive. The new macro has been added to acinclude.m4, and the test stanza in configure.in has been replaced with a single call to the new macro. Note that the new macro calls AC_PREREQ(2.64) -- a more stringent requirement than the existing AC_PREREQ(2.59) in configure.in. The difference represents about six years of autoconf releases, from v2.59 in December of 2003 to v2.64 in July of 2009. This problem was noticed by Brian Evans, who also suggested the fix. PHP-Bug: 73062
I'm not sure if we can actually use it due to license of It looks to me that it is GPL code but I'm not sure either what consequences it could have... :) |
Good catch. There are a number of files in the repository that have a non-PHP license block at the top, indicating that their licenses differ from the default PHP-3.01 license. In particular, there are other autoconf macros with a GPL license like It would be better to ship |
In commit 086f9ad, I added a new macro AX_CHECK_COMPILE_FLAG from the autoconf archive. Jakub Zelenka pointed out that the license of the macro (GPL-3+ with exception) does not agree with the license of PHP itself (PHP-3.01). We should therefore ship the macro in a separate file with its own license header. That is allowed and is done for many other files in the PHP repository. This commit adds a new top-level "m4" directory and places the upstream ax_check_compile_flag.m4 file in it. The macro is no longer inlined; instead, our acinclude.m4 now includes the aforementioned file with m4_include. PHP-Bug: 73062 Pull-Request: 2124
Merged 9e18b6e Thanks :) |
This breaks some stuff ... pecl extensions can't compile because they are looking for the m4. I'm on it ... |
Fixed. |
The existing check for
-fvisibility=hidden
support came from a timewhen only GCC had it. The test for it used a regular expression to
parse the GCC major version from the output of
$CC --version
, andwould look for version 4 or greater.
The regular expression used to accomplish this is doomed, however,
since GCC can be built with a custom version string
(--with-pkgversion
). Moreover, theCC
variable can be set tosomething that confuses it but is otherwise valid. For example, it
would fail with
CC=x86_64-pc-linux-gnu-gcc
.This commit fixes two aspects of the feature test. First, it no longer
limits the test to GCC. At least clang now supports the flag, and can
make use of it when GCC is its backend. Second, support for the flag
is tested directly, by attempting to pass it to the compiler, rather
than by parsing its version string. The latter is accomplished with a
new macro,
AX_CHECK_COMPILE_FLAG
, taken from the autoconf archive.The new macro has been added to acinclude.m4, and the test stanza in
configure.in has been replaced with a single call to the new macro.
Note that the new macro calls
AC_PREREQ(2.64)
-- a more stringentrequirement than the existing
AC_PREREQ(2.59)
in configure.in. Thedifference represents about six years of autoconf releases, from v2.59
in December of 2003 to v2.64 in July of 2009.
This problem was noticed by Brian Evans, who also suggested the fix.
PHP-Bug: 73062