summaryrefslogtreecommitdiffstats
path: root/gl/m4/visibility.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/visibility.m4')
-rw-r--r--gl/m4/visibility.m426
1 files changed, 24 insertions, 2 deletions
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4
index 6d3f9c9..077c476 100644
--- a/gl/m4/visibility.m4
+++ b/gl/m4/visibility.m4
@@ -1,4 +1,4 @@
1# visibility.m4 serial 2 (gettext-0.18) 1# visibility.m4 serial 3 (gettext-0.18)
2dnl Copyright (C) 2005, 2008-2010 Free Software Foundation, Inc. 2dnl Copyright (C) 2005, 2008-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -26,15 +26,37 @@ AC_DEFUN([gl_VISIBILITY],
26 CFLAG_VISIBILITY= 26 CFLAG_VISIBILITY=
27 HAVE_VISIBILITY=0 27 HAVE_VISIBILITY=0
28 if test -n "$GCC"; then 28 if test -n "$GCC"; then
29 dnl First, check whether -Werror can be added to the command line, or
30 dnl whether it leads to an error because of some other option that the
31 dnl user has put into $CC $CFLAGS $CPPFLAGS.
32 AC_MSG_CHECKING([whether the -Werror option is usable])
33 AC_CACHE_VAL([gl_cv_cc_vis_werror], [
34 gl_save_CFLAGS="$CFLAGS"
35 CFLAGS="$CFLAGS -Werror"
36 AC_TRY_COMPILE([], [],
37 [gl_cv_cc_vis_werror=yes],
38 [gl_cv_cc_vis_werror=no])
39 CFLAGS="$gl_save_CFLAGS"])
40 AC_MSG_RESULT([$gl_cv_cc_vis_werror])
41 dnl Now check whether visibility declarations are supported.
29 AC_MSG_CHECKING([for simple visibility declarations]) 42 AC_MSG_CHECKING([for simple visibility declarations])
30 AC_CACHE_VAL([gl_cv_cc_visibility], [ 43 AC_CACHE_VAL([gl_cv_cc_visibility], [
31 gl_save_CFLAGS="$CFLAGS" 44 gl_save_CFLAGS="$CFLAGS"
32 CFLAGS="$CFLAGS -fvisibility=hidden" 45 CFLAGS="$CFLAGS -fvisibility=hidden"
46 dnl We use the option -Werror and a function dummyfunc, because on some
47 dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
48 dnl "visibility attribute not supported in this configuration; ignored"
49 dnl at the first function definition in every compilation unit, and we
50 dnl don't want to use the option in this case.
51 if test $gl_cv_cc_vis_werror = yes; then
52 CFLAGS="$CFLAGS -Werror"
53 fi
33 AC_TRY_COMPILE( 54 AC_TRY_COMPILE(
34 [extern __attribute__((__visibility__("hidden"))) int hiddenvar; 55 [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
35 extern __attribute__((__visibility__("default"))) int exportedvar; 56 extern __attribute__((__visibility__("default"))) int exportedvar;
36 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); 57 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
37 extern __attribute__((__visibility__("default"))) int exportedfunc (void);], 58 extern __attribute__((__visibility__("default"))) int exportedfunc (void);
59 void dummyfunc (void) {}],
38 [], 60 [],
39 [gl_cv_cc_visibility=yes], 61 [gl_cv_cc_visibility=yes],
40 [gl_cv_cc_visibility=no]) 62 [gl_cv_cc_visibility=no])