diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 87 |
1 files changed, 86 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 994bf286..d5083826 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,8 @@ AC_CANONICAL_HOST AM_MAINTAINER_MODE AH_TOP([ +#ifndef _GCRYPT_CONFIG_H_INCLUDED +#define _GCRYPT_CONFIG_H_INCLUDED /* need this, because some autoconf tests rely on this (e.g. stpcpy) * and it should be used for new programs */ #define _GNU_SOURCE 1 @@ -79,6 +81,7 @@ AH_BOTTOM([ # endif #endif /*DISABLED_ENDIAN_CHECK*/ +#endif /*_GCRYPT_CONFIG_H_INCLUDED*/ ]) AH_VERBATIM([_REENTRANT], @@ -572,7 +575,89 @@ case "${host}" in fi esac AC_SUBST(FALLBACK_SOCKLEN_T) - + +# +# Check for ELF visibility support. +# +AC_CACHE_CHECK(whether the visibility attribute is supported, + gcry_cv_visibility_attribute, + [gcry_cv_visibility_attribute=no + AC_LANG_CONFTEST([AC_LANG_SOURCE( + [[int foo __attribute__ ((visibility ("hidden"))) = 1; + int bar __attribute__ ((visibility ("protected"))) = 1; + ]])]) + + if ${CC-cc} -Werror -S conftest.c -o conftest.s \ + 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then + if grep '\.hidden.*foo' conftest.s >/dev/null 2>&1 ; then + if grep '\.protected.*bar' conftest.s >/dev/null 2>&1; then + gcry_cv_visibility_attribute=yes + fi + fi + fi + ]) +if test "$gcry_cv_visibility_attribute" = "yes"; then + AC_CACHE_CHECK(for broken visibility attribute, + gcry_cv_broken_visibility_attribute, + [gcry_cv_broken_visibility_attribute=yes + AC_LANG_CONFTEST([AC_LANG_SOURCE( + [[int foo (int x); + int bar (int x) __asm__ ("foo") + __attribute__ ((visibility ("hidden"))); + int bar (int x) { return x; } + ]])]) + + if ${CC-cc} -Werror -S conftest.c -o conftest.s \ + 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then + if grep '\.hidden@<:@ _@:>@foo' conftest.s >/dev/null 2>&1; + then + gcry_cv_broken_visibility_attribute=no + fi + fi + ]) +fi +if test "$gcry_cv_visibility_attribute" = "yes"; then + AC_CACHE_CHECK(for broken alias attribute, + gcry_cv_broken_alias_attribute, + [gcry_cv_broken_alias_attribute=yes + AC_LANG_CONFTEST([AC_LANG_SOURCE( + [[extern int foo (int x) __asm ("xyzzy"); + int bar (int x) { return x; } + extern __typeof (bar) foo __attribute ((weak, alias ("bar"))); + extern int dfoo; + extern __typeof (dfoo) dfoo __asm ("abccb"); + int dfoo = 1; + ]])]) + + if ${CC-cc} -Werror -S conftest.c -o conftest.s \ + 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then + if grep 'xyzzy' conftest.s >/dev/null 2>&1 && \ + grep 'abccb' conftest.s >/dev/null 2>&1; then + gcry_cv_broken_alias_attribute=no + fi + fi + ]) +fi +if test "$gcry_cv_visibility_attribute" = "yes"; then + AC_CACHE_CHECK(if gcc supports -fvisibility=hidden, + gcry_cv_gcc_has_f_visibility, + [gcry_cv_gcc_has_f_visibility=no + _gcc_cflags_save=$CFLAGS + CFLAGS="-fvisibility=hidden" + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), + gcry_cv_gcc_has_f_visibility=yes) + CFLAGS=$_gcc_cflags_save; + ]) +fi +if test "$gcry_cv_visibility_attribute" = "yes" \ + && test "$gcry_cv_broken_visibility_attribute" != "yes" \ + && test "$gcry_cv_broken_alias_attribute" != "yes" \ + && test "$gcry_cv_gcc_has_f_visibility" = "yes" + then + AC_DEFINE(GCRY_USE_VISIBILITY, 1, + [Define to use the GNU C visibility attribute]) + CFLAGS="$CFLAGS -fvisibility=hidden" +fi ####################################### |