summaryrefslogtreecommitdiffstats
path: root/gl/m4/visibility.m4
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2007-01-24 22:47:25 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2007-01-24 22:47:25 (GMT)
commitfe856aa957978504137c1d425815d4ed8a22be40 (patch)
treea5bb46ce0e64b2056f75700eadbf27aba7c39418 /gl/m4/visibility.m4
parent210f39bc84cfbb21cd72dc054e43f13815ee0616 (diff)
downloadmonitoring-plugins-fe856aa957978504137c1d425815d4ed8a22be40.tar.gz
Sync with gnulib - lots of extraneous code removed in preference to GNU code
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1580 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'gl/m4/visibility.m4')
-rw-r--r--gl/m4/visibility.m452
1 files changed, 52 insertions, 0 deletions
diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4
new file mode 100644
index 0000000..2ff6330
--- /dev/null
+++ b/gl/m4/visibility.m4
@@ -0,0 +1,52 @@
1# visibility.m4 serial 1 (gettext-0.15)
2dnl Copyright (C) 2005 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible.
8
9dnl Tests whether the compiler supports the command-line option
10dnl -fvisibility=hidden and the function and variable attributes
11dnl __attribute__((__visibility__("hidden"))) and
12dnl __attribute__((__visibility__("default"))).
13dnl Does *not* test for __visibility__("protected") - which has tricky
14dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
15dnl MacOS X.
16dnl Does *not* test for __visibility__("internal") - which has processor
17dnl dependent semantics.
18dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
19dnl "really only recommended for legacy code".
20dnl Set the variable CFLAG_VISIBILITY.
21dnl Defines and sets the variable HAVE_VISIBILITY.
22
23AC_DEFUN([gl_VISIBILITY],
24[
25 AC_REQUIRE([AC_PROG_CC])
26 CFLAG_VISIBILITY=
27 HAVE_VISIBILITY=0
28 if test -n "$GCC"; then
29 AC_MSG_CHECKING([for simple visibility declarations])
30 AC_CACHE_VAL(gl_cv_cc_visibility, [
31 gl_save_CFLAGS="$CFLAGS"
32 CFLAGS="$CFLAGS -fvisibility=hidden"
33 AC_TRY_COMPILE(
34 [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
35 extern __attribute__((__visibility__("default"))) int exportedvar;
36 extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
37 extern __attribute__((__visibility__("default"))) int exportedfunc (void);],
38 [],
39 gl_cv_cc_visibility=yes,
40 gl_cv_cc_visibility=no)
41 CFLAGS="$gl_save_CFLAGS"])
42 AC_MSG_RESULT([$gl_cv_cc_visibility])
43 if test $gl_cv_cc_visibility = yes; then
44 CFLAG_VISIBILITY="-fvisibility=hidden"
45 HAVE_VISIBILITY=1
46 fi
47 fi
48 AC_SUBST([CFLAG_VISIBILITY])
49 AC_SUBST([HAVE_VISIBILITY])
50 AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
51 [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
52])