|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-09-10 14:57 UTC] michael at orlitzky dot com
Description:
------------
There is a check in configure.in that looks for -fvisibility=hidden support when the user is building with GCC:
dnl activate some gcc specific optimizations for gcc >= 4
if test "$GCC" = "yes"; then
case $host_alias in
*darwin*)
GCC_MAJOR_VERSION=`$CC -dumpversion | /usr/bin/sed -nE '1s/([[0-9]]+)\.[[0-$
;;
*)
GCC_MAJOR_VERSION=`$CC --version | $SED -n '1s/[[^0-9]]*//;1s/\..*//;1p'`
;;
esac
if test $GCC_MAJOR_VERSION -ge 4; then
CFLAGS="$CFLAGS -fvisibility=hidden"
fi
fi
The idea is to parse off the major version number from the end of the "gcc --version" output, and see if it's 4 or more. However, the regular expression in question doesn't work when $CC is a little weird. This is the expected result, with a vanilla GCC:
$CC --version | sed -n '1s/[[^0-9]]*//;1s/\..*//;1p'
4
But this is what happens when my CC is set:
CC=x86_64-pc-linux-gnu-gcc
$ $CC --version | sed -n '1s/[[^0-9]]*//;1s/\..*//;1p'
x6_64-pc-linux-gnu-gcc (Gentoo Hardened 4
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 14:00:01 2025 UTC |
FYI. The current test in php-7.2.2 gives a false pass (aka yes) when the compile is done with -c. Without -c the flag fails. System AIX, complier xlc root@x065:[/data/prj/php/php-7.2.2]xlc_r -c -I/opt/include -I/opt/include/mysql -qmaxmem=-1 -qarch=pwr5 -fvisibility=hidden -I/opt/include x.c root@x065:[/data/prj/php/php-7.2.2]xlc_r -I/opt/include -I/opt/include/mysql -qmaxmem=-1 -qarch=pwr5 -fvisibility=hidden -I/opt/include x.c ld: 0706-005 Cannot find or open file: visibility=hidden ld:fopen(): A file or directory in the path name does not exist.