diff options
author | Simon Josefsson <simon@josefsson.org> | 2009-03-04 17:38:15 +0100 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2009-03-04 17:38:15 +0100 |
commit | 4844b4ebb0fa4c9c8acf8aaa55deabc69579e0ea (patch) | |
tree | 09b7c0a85c0b4cb269609ac12b31e15ef50ba2f8 /lib/glm4 | |
parent | d8ec4e76435caa40932c61611be2cedfa811afe3 (diff) | |
download | libtasn1-4844b4ebb0fa4c9c8acf8aaa55deabc69579e0ea.tar.gz libtasn1-4844b4ebb0fa4c9c8acf8aaa55deabc69579e0ea.tar.bz2 libtasn1-4844b4ebb0fa4c9c8acf8aaa55deabc69579e0ea.zip |
Use -fvisibility=hidden and mark public APIs explicitly.
Diffstat (limited to 'lib/glm4')
-rw-r--r-- | lib/glm4/gnulib-cache.m4 | 3 | ||||
-rw-r--r-- | lib/glm4/gnulib-comp.m4 | 2 | ||||
-rw-r--r-- | lib/glm4/visibility.m4 | 52 |
3 files changed, 56 insertions, 1 deletions
diff --git a/lib/glm4/gnulib-cache.m4 b/lib/glm4/gnulib-cache.m4 index 3c1d474..de4581f 100644 --- a/lib/glm4/gnulib-cache.m4 +++ b/lib/glm4/gnulib-cache.m4 @@ -15,13 +15,14 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib/gllib --m4-base=lib/glm4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=dummy --lgpl=2 --libtool --macro-prefix=lgl --no-vc-files ld-version-script stdint +# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib/gllib --m4-base=lib/glm4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=dummy --lgpl=2 --libtool --macro-prefix=lgl --no-vc-files ld-version-script stdint visibility # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) gl_MODULES([ ld-version-script stdint + visibility ]) gl_AVOID([dummy]) gl_SOURCE_BASE([lib/gllib]) diff --git a/lib/glm4/gnulib-comp.m4 b/lib/glm4/gnulib-comp.m4 index 435a364..79e80fe 100644 --- a/lib/glm4/gnulib-comp.m4 +++ b/lib/glm4/gnulib-comp.m4 @@ -43,6 +43,7 @@ AC_DEFUN([lgl_INIT], gl_LD_VERSION_SCRIPT AC_REQUIRE([gl_MULTIARCH]) gl_STDINT_H + gl_VISIBILITY gl_WCHAR_H m4_ifval(lgl_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([lgl_LIBSOURCES_DIR])[ || @@ -182,6 +183,7 @@ AC_DEFUN([lgl_FILE_LIST], [ m4/longlong.m4 m4/multiarch.m4 m4/stdint.m4 + m4/visibility.m4 m4/wchar.m4 m4/wint_t.m4 ]) diff --git a/lib/glm4/visibility.m4 b/lib/glm4/visibility.m4 new file mode 100644 index 0000000..70bca56 --- /dev/null +++ b/lib/glm4/visibility.m4 @@ -0,0 +1,52 @@ +# visibility.m4 serial 2 (gettext-0.18) +dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl Tests whether the compiler supports the command-line option +dnl -fvisibility=hidden and the function and variable attributes +dnl __attribute__((__visibility__("hidden"))) and +dnl __attribute__((__visibility__("default"))). +dnl Does *not* test for __visibility__("protected") - which has tricky +dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on +dnl MacOS X. +dnl Does *not* test for __visibility__("internal") - which has processor +dnl dependent semantics. +dnl Does *not* test for #pragma GCC visibility push(hidden) - which is +dnl "really only recommended for legacy code". +dnl Set the variable CFLAG_VISIBILITY. +dnl Defines and sets the variable HAVE_VISIBILITY. + +AC_DEFUN([gl_VISIBILITY], +[ + AC_REQUIRE([AC_PROG_CC]) + CFLAG_VISIBILITY= + HAVE_VISIBILITY=0 + if test -n "$GCC"; then + AC_MSG_CHECKING([for simple visibility declarations]) + AC_CACHE_VAL([gl_cv_cc_visibility], [ + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fvisibility=hidden" + AC_TRY_COMPILE( + [extern __attribute__((__visibility__("hidden"))) int hiddenvar; + extern __attribute__((__visibility__("default"))) int exportedvar; + extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); + extern __attribute__((__visibility__("default"))) int exportedfunc (void);], + [], + [gl_cv_cc_visibility=yes], + [gl_cv_cc_visibility=no]) + CFLAGS="$gl_save_CFLAGS"]) + AC_MSG_RESULT([$gl_cv_cc_visibility]) + if test $gl_cv_cc_visibility = yes; then + CFLAG_VISIBILITY="-fvisibility=hidden" + HAVE_VISIBILITY=1 + fi + fi + AC_SUBST([CFLAG_VISIBILITY]) + AC_SUBST([HAVE_VISIBILITY]) + AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY], + [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) +]) |