[Mesa-dev] [PATCH 1/4] configure: add visibility macro detectionto configure

Marc Dietrich marvin24 at gmx.de
Tue Feb 17 01:06:53 PST 2015


Am Montag, 16. Februar 2015, 10:14:02 schrieb Matt Turner:
> On Mon, Feb 16, 2015 at 1:36 AM, Marc Dietrich <marvin24 at gmx.de> wrote:
> > This adds clang/gcc visibility macro detection to configure and
> > util/macros.h. This is can be used to conveniently add e.g. a "HIDDEN"
> > attribute to a function.
> > 
> > Signed-off-by: Marc Dietrich <marvin24 at gmx.de>
> > ---
> > 
> >  configure.ac      | 28 ++++++----------------------
> >  src/util/macros.h |  6 ++++++
> >  2 files changed, 12 insertions(+), 22 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 351027b..6b1592f 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -189,6 +189,7 @@ AX_GCC_FUNC_ATTRIBUTE([flatten])
> > 
> >  AX_GCC_FUNC_ATTRIBUTE([format])
> >  AX_GCC_FUNC_ATTRIBUTE([malloc])
> >  AX_GCC_FUNC_ATTRIBUTE([packed])
> > 
> > +AX_GCC_FUNC_ATTRIBUTE([visibility])
> 
> This hunk looks fine.
> 
> >  AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
> > 
> > @@ -245,17 +246,13 @@ if test "x$GCC" = xyes; then
> > 
> >                    AC_MSG_RESULT([yes]),
> >                    [CFLAGS="$save_CFLAGS -Wmissing-prototypes";
> >                    
> >                     AC_MSG_RESULT([no])]);
> > 
> > +    CFLAGS=$save_CFLAGS
> > 
> >      # Enable -fvisibility=hidden if using a gcc that supports it
> > 
> > -    save_CFLAGS="$CFLAGS"
> > -    AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
> > -    VISIBILITY_CFLAGS="-fvisibility=hidden"
> > -    CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
> > -    AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
> > -                  [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
> > -
> > -    # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
> > -    CFLAGS=$save_CFLAGS
> > +    if test "x${ax_cv_have_func_attribute_visibility}" = xyes; then
> > +       CFLAGS="$CFLAGS -fvisibility=hidden"
> > +       CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
> > +    fi
> 
> I was going to suggest not making this change when I thought this was
> a nop, but this is just wrong. :)
> 
> You shouldn't modify CFLAGS/CXXFLAGS in configure, and even if we were
> (and removing VISIBILITY_CFLAGS) we should have removed
> VISIBILITY_CFLAGS from all of the places its used in Makefiles.

ah, you are right. This wasn't my intention. Updated patch posted.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150217/9a529b4f/attachment.sig>


More information about the mesa-dev mailing list