1085.1.4
by Monty Taylor
pandora-build v1 |
1 |
dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc. |
1259.2.1
by Monty Taylor
Updates to pandora-build visibility settings. |
2 |
dnl Copyright (C) 2009 Monty Taylor |
1085.1.4
by Monty Taylor
pandora-build v1 |
3 |
dnl This file is free software; the Free Software Foundation |
4 |
dnl gives unlimited permission to copy and/or distribute it, |
|
5 |
dnl with or without modifications, as long as this notice is preserved. |
|
6 |
||
7 |
dnl From Bruno Haible. |
|
8 |
||
9 |
dnl Tests whether the compiler supports the command-line option |
|
10 |
dnl -fvisibility=hidden and the function and variable attributes |
|
11 |
dnl __attribute__((__visibility__("hidden"))) and |
|
12 |
dnl __attribute__((__visibility__("default"))). |
|
13 |
dnl Does *not* test for __visibility__("protected") - which has tricky |
|
14 |
dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on |
|
15 |
dnl MacOS X. |
|
16 |
dnl Does *not* test for __visibility__("internal") - which has processor |
|
17 |
dnl dependent semantics. |
|
18 |
dnl Does *not* test for #pragma GCC visibility push(hidden) - which is |
|
19 |
dnl "really only recommended for legacy code". |
|
20 |
dnl Set the variable CFLAG_VISIBILITY. |
|
21 |
dnl Defines and sets the variable HAVE_VISIBILITY. |
|
22 |
||
1724.1.1
by Monty Taylor
Rearranged how we set -fvisibility, allowing us to turn it on on a |
23 |
AC_DEFUN([PANDORA_CHECK_VISIBILITY], |
1085.1.4
by Monty Taylor
pandora-build v1 |
24 |
[
|
25 |
AC_REQUIRE([AC_PROG_CC]) |
|
26 |
CFLAG_VISIBILITY= |
|
27 |
HAVE_VISIBILITY=0 |
|
1259.2.1
by Monty Taylor
Updates to pandora-build visibility settings. |
28 |
AS_IF([test -n "$GCC"],[ |
1085.1.4
by Monty Taylor
pandora-build v1 |
29 |
AC_MSG_CHECKING([for simple visibility declarations]) |
30 |
AC_CACHE_VAL([gl_cv_cc_visibility], [ |
|
31 |
gl_save_CFLAGS="$CFLAGS" |
|
1992.6.9
by Monty Taylor
Updated pandora-build files to version 0.165 |
32 |
CFLAGS="$CFLAGS -fvisibility=hidden -Werror" |
1085.1.4
by Monty Taylor
pandora-build v1 |
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);], |
|
2127.1.1
by Monty Taylor
Don't do visibility hidden on OSX, there is a GCC bug (or seems to be) which causes everything to go apeshit-bat-ass-crazy. |
38 |
[],[
|
39 |
case "$host_os" in |
|
40 |
*darwin*) |
|
41 |
gl_cv_cc_visibility=no |
|
42 |
;;
|
|
43 |
*) |
|
44 |
gl_cv_cc_visibility=yes |
|
45 |
;;
|
|
46 |
esac
|
|
47 |
],[gl_cv_cc_visibility=no]) |
|
1085.1.4
by Monty Taylor
pandora-build v1 |
48 |
CFLAGS="$gl_save_CFLAGS"]) |
49 |
AC_MSG_RESULT([$gl_cv_cc_visibility]) |
|
50 |
if test $gl_cv_cc_visibility = yes; then |
|
51 |
CFLAG_VISIBILITY="-fvisibility=hidden" |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
52 |
CXXFLAG_VISIBILITY="-fvisibility=hidden -fvisibility-inlines-hidden" |
1724.1.1
by Monty Taylor
Rearranged how we set -fvisibility, allowing us to turn it on on a |
53 |
NO_VISIBILITY="-fvisibility=default" |
1085.1.4
by Monty Taylor
pandora-build v1 |
54 |
HAVE_VISIBILITY=1 |
55 |
fi
|
|
1259.2.1
by Monty Taylor
Updates to pandora-build visibility settings. |
56 |
])
|
57 |
AS_IF([test "x$SUNCC" = "xyes"],[ |
|
58 |
CFLAG_VISIBILITY="-xldscope=hidden" |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
59 |
CXXFLAG_VISIBILITY="-xldscope=hidden" |
1724.1.1
by Monty Taylor
Rearranged how we set -fvisibility, allowing us to turn it on on a |
60 |
NO_VISIBILITY="-xldscope=global" |
1259.2.1
by Monty Taylor
Updates to pandora-build visibility settings. |
61 |
HAVE_VISIBILITY=1 |
62 |
])
|
|
1085.1.4
by Monty Taylor
pandora-build v1 |
63 |
AC_SUBST([CFLAG_VISIBILITY]) |
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
64 |
AC_SUBST([CXXFLAG_VISIBILITY]) |
1724.1.1
by Monty Taylor
Rearranged how we set -fvisibility, allowing us to turn it on on a |
65 |
AC_SUBST([NO_VISIBILITY]) |
1085.1.4
by Monty Taylor
pandora-build v1 |
66 |
AC_SUBST([HAVE_VISIBILITY]) |
67 |
AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY], |
|
68 |
[Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) |
|
69 |
])
|
|
1724.1.1
by Monty Taylor
Rearranged how we set -fvisibility, allowing us to turn it on on a |
70 |
|
71 |
AC_DEFUN([PANDORA_ENABLE_VISIBILITY],[ |
|
72 |
AC_REQUIRE([PANDORA_CHECK_VISIBILITY]) |
|
73 |
AM_CFLAGS="${AM_CFLAGS} ${CFLAG_VISIBILITY}" |
|
2119.4.1
by Monty Taylor
Turns on -fvisibility=hidden by default. Symbols intended to be used by |
74 |
AM_CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAG_VISIBILITY}" |
1724.1.1
by Monty Taylor
Rearranged how we set -fvisibility, allowing us to turn it on on a |
75 |
])
|