[Xcb] hidden-visibility and library size

Vincent Torri Vincent.Torri at iecn.u-nancy.fr
Wed Dec 28 09:32:28 PST 2005


>
> It should probably use AC_COMPILE_IFELSE rather than AC_TRY_LINK.

here is another version.

I have included all the possible tests that we can use. Of course, only
those that we will use will be necessary.

Vincent
-------------- next part --------------
dnl Detection and configuration of the visibility feature of gcc
dnl Vincent Torri 2005-12-24
dnl
dnl AC_CHECK_VISIBILITY([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Check the visibility feature of gcc and define VISIBILITY_CFLAGS
dnl
AC_DEFUN([AC_CHECK_VISIBILITY],
   [VISIBILITY_CFLAGS=""
    AC_MSG_CHECKING([whether ${CC} supports -fvisibility=hidden])
    save_CFLAGS=${CFLAGS}
    CFLAGS="$CFLAGS -fvisibility=hidden"
    AC_COMPILE_IFELSE(
       [AC_LANG_PROGRAM(
          [[
int a __attribute__ ((visibility("hidden")));
int b __attribute__ ((visibility("default")));
#pragma GCC visibility push(hidden)
extern void f(int);
#pragma GCC visibility pop
#pragma GCC visibility push(default)
extern void g(int);
#pragma GCC visibility pop
          ]],
          [[]]
        )],
       [VISIBILITY_CFLAGS="-fvisibility=hidden"
        AC_DEFINE(HAVE_VISIBILITY_FEATURE)
        m4_if([$1], [], [:], [$1])],
       [m4_if([$2], [], [:], [$2])])
    AC_MSG_RESULT(${visibility})
    CFLAGS=${save_CFLAGS}
    AC_SUBST(VISIBILITY_CFLAGS)
   ])


More information about the Xcb mailing list