On 27/04/2011 11:39, Dan Nicholson wrote: > On Tue, Apr 26, 2011 at 5:00 AM, Jon TURNEY wrote: >> Alternatively, the configuration check could be made more complex to avoid >> using this flag is the target isn't ELF or using the flag generates a warning > > You could add -Werror to the CFLAGS used for the visibility test since > any host that's throwing warnings for something so simple probably has > issues with visibility. Something like: > > diff --git a/configure.ac b/configure.ac > index 8989c2b..ec662a3 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -152,7 +152,7 @@ if test "x$GCC" = xyes; then > save_CFLAGS="$CFLAGS" > AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden]) > VISIBILITY_CFLAGS="-fvisibility=hidden" > - CFLAGS="$CFLAGS $VISIBILITY_CFLAGS" > + CFLAGS="$CFLAGS $VISIBILITY_CFLAGS -Werror" > AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]), > [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]); > > Does that do the right thing?
Yes, this works, and in fact this was the approach I initially tried, and seems more elegant. However, I was concerned about false negatives. As far as I can tell, nothing guarantees that the test program compiled by AC_LANG_PROGRAM() compiles without warnings, only without errors, so using -Werror might cause this test to fail for reasons unrelated to -fvisibility. Looking at this a bit more, though, a bit of googling seems to indicate we wouldn't be the first to use this construction, so perhaps it's ok :-) _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev