|
Packit |
fc043f |
# visibility.m4 serial 1 (gettext-0.15)
|
|
Packit |
fc043f |
dnl Copyright (C) 2005 Free Software Foundation, Inc.
|
|
Packit |
fc043f |
dnl This file is free software; the Free Software Foundation
|
|
Packit |
fc043f |
dnl gives unlimited permission to copy and/or distribute it,
|
|
Packit |
fc043f |
dnl with or without modifications, as long as this notice is preserved.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
dnl From Bruno Haible.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
dnl Tests whether the compiler supports the command-line option
|
|
Packit |
fc043f |
dnl -fvisibility=hidden and the function and variable attributes
|
|
Packit |
fc043f |
dnl __attribute__((__visibility__("hidden"))) and
|
|
Packit |
fc043f |
dnl __attribute__((__visibility__("default"))).
|
|
Packit |
fc043f |
dnl Does *not* test for __visibility__("protected") - which has tricky
|
|
Packit |
fc043f |
dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
|
|
Packit |
fc043f |
dnl MacOS X.
|
|
Packit |
fc043f |
dnl Does *not* test for __visibility__("internal") - which has processor
|
|
Packit |
fc043f |
dnl dependent semantics.
|
|
Packit |
fc043f |
dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
|
|
Packit |
fc043f |
dnl "really only recommended for legacy code".
|
|
Packit |
fc043f |
dnl Set the variable CFLAG_VISIBILITY.
|
|
Packit |
fc043f |
dnl Defines and sets the variable HAVE_VISIBILITY.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
AC_DEFUN([gl_VISIBILITY],
|
|
Packit |
fc043f |
[
|
|
Packit |
fc043f |
AC_REQUIRE([AC_PROG_CC])
|
|
Packit |
fc043f |
CFLAG_VISIBILITY=
|
|
Packit |
fc043f |
HAVE_VISIBILITY=0
|
|
Packit |
fc043f |
if test -n "$GCC"; then
|
|
Packit |
fc043f |
AC_MSG_CHECKING([for simple visibility declarations])
|
|
Packit |
fc043f |
AC_CACHE_VAL(gl_cv_cc_visibility, [
|
|
Packit |
fc043f |
gl_save_CFLAGS="$CFLAGS"
|
|
Packit |
fc043f |
CFLAGS="$CFLAGS -fvisibility=hidden"
|
|
Packit |
fc043f |
AC_TRY_COMPILE(
|
|
Packit |
fc043f |
[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
|
|
Packit |
fc043f |
extern __attribute__((__visibility__("default"))) int exportedvar;
|
|
Packit |
fc043f |
extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
|
|
Packit |
fc043f |
extern __attribute__((__visibility__("default"))) int exportedfunc (void);],
|
|
Packit |
fc043f |
[],
|
|
Packit |
fc043f |
gl_cv_cc_visibility=yes,
|
|
Packit |
fc043f |
gl_cv_cc_visibility=no)
|
|
Packit |
fc043f |
CFLAGS="$gl_save_CFLAGS"])
|
|
Packit |
fc043f |
AC_MSG_RESULT([$gl_cv_cc_visibility])
|
|
Packit |
fc043f |
if test $gl_cv_cc_visibility = yes; then
|
|
Packit |
fc043f |
CFLAG_VISIBILITY="-fvisibility=hidden"
|
|
Packit |
fc043f |
HAVE_VISIBILITY=1
|
|
Packit |
fc043f |
fi
|
|
Packit |
fc043f |
fi
|
|
Packit |
fc043f |
AC_SUBST([CFLAG_VISIBILITY])
|
|
Packit |
fc043f |
AC_SUBST([HAVE_VISIBILITY])
|
|
Packit |
fc043f |
AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
|
|
Packit |
fc043f |
[Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
|
|
Packit |
fc043f |
])
|