[Mesa-dev] [PATCH 1/2] Fix config check that claims to test if CXX supports -fvisibility=hidden option to actually test the C++ compiler.

tom fogal tfogal at sci.utah.edu
Tue Apr 26 09:45:22 PDT 2011


On 04/26/2011 06:00 AM, Jon TURNEY wrote:
> Looking at this bit of autofoolery, I notice that at the moment it is just
> checking if CC supports -fvisibility=hidden twice

We use visibility=hidden for *both* C and C++ code, no?

Is the issue that the Cygwin C compiler supports hidden visibility, and 
the C++ compiler does not?  If that's the case, can we have some sort of 
ifdef magic that automagically disables hidden visibility for the 
combination of C++ and Cygwin?

There's relatively little C++ in Mesa, compared to C (last I checked, 
admittedly not too recently).  Turning off visibility when the C++ 
compiler doesn't support it seems like using a sledgehammer to pound in 
a nail.

-tom

> Signed-off-by: Jon TURNEY<jon.turney at dronecode.org.uk>
> ---
>   configure.ac |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 3b05ca3..37ea5e7 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -170,8 +170,10 @@ if test "x$GXX" = xyes; then
>       AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
>       VISIBILITY_CXXFLAGS="-fvisibility=hidden"
>       CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
> +    AC_LANG_PUSH([C++])
>       AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
>   		   [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
> +    AC_LANG_POP([C++])
>
>       # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
>       CXXFLAGS=$save_CXXFLAGS



More information about the mesa-dev mailing list