diff options
author | Ingo Klöcker <[email protected]> | 2022-03-28 15:17:41 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2022-03-28 15:22:48 +0000 |
commit | fe588fef0963987b5624dc8c4bc73202ac2c9298 (patch) | |
tree | b37d44a27518d13ff65466c6095aa8f100a8b0b5 /configure.ac | |
parent | cpp: Put local helper function into unnamed namespace (diff) | |
download | gpgme-fe588fef0963987b5624dc8c4bc73202ac2c9298.tar.gz gpgme-fe588fef0963987b5624dc8c4bc73202ac2c9298.zip |
cpp: Set default visibility of all symbols to hidden
* configure.ac: Add -fvisibility=hidden to GPGME_CPP_CFLAGS if gcc
supports the flag.
* lang/cpp/src/Makefile.am (AM_CPPFLAGS): Add GPGME_CPP_CFLAGS.
* m4/ax_gcc_func_attribute.m4: New.
--
With this change all defined symbols are hidden by default, so that they
are not exported anymore. All symbols that are part of the ABI and that
shall still be exported are already marked as having default visibility.
The m4 macro was taken from the website mentioned in the License header
of the file.
GnuPG-bug-id: 5906
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 43256093..78824962 100644 --- a/configure.ac +++ b/configure.ac @@ -331,8 +331,6 @@ for language in $enabled_languages; do fi done - - # Enable C++ 11 if cpp language is requested LIST_MEMBER("cpp", $enabled_languages) if test "$found" = "1"; then @@ -354,6 +352,16 @@ if test "$found" = "1"; then fi fi +# Check whether compiler supports visibility attribute (if cpp language is enabled) +LIST_MEMBER("cpp", $enabled_languages) +if test "$found" = "1"; then + AX_GCC_FUNC_ATTRIBUTE(visibility) + if test "$ax_cv_have_func_attribute_visibility" = "yes"; then + GPGME_CPP_CFLAGS="$GPGME_CPP_CFLAGS -fvisibility=hidden" + fi +fi +AC_SUBST(GPGME_CPP_CFLAGS) + # Check that if qt is enabled cpp also is enabled LIST_MEMBER("qt", $enabled_languages) if test "$found" = "1"; then |