diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2015-03-09 12:18:32 +0000 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2015-04-28 11:18:43 +0100 |
commit | 40902b9fa12e41f28706e5fca6289ef26f6d81bc (patch) | |
tree | 1399821c82f8ff65eb6e60d23bc6fd3001a4a8b5 /configure.ac | |
parent | 0d78b37b1cac304ce5e84d1207f0a43abd29c000 (diff) |
configure.ac: split -fvisibility and __attribute__((visibility)) checks
The former does not imply the latter and vice-versa. One such example is
the Sun compiler.
v2: Add missing closing brakets. (Alan)
Cc: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 155d5771..76cf91eb 100644 --- a/configure.ac +++ b/configure.ac @@ -415,12 +415,17 @@ if test "x$GCC" = xyes; then # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed. CFLAGS=$save_CFLAGS + AC_SUBST([VISIBILITY_CFLAGS]) +fi - if test "x$VISIBILITY_CFLAGS" != x; then - AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler has -fvisibility support]) - fi +AC_MSG_CHECKING([whether $CC supports __attribute__((visibility))]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([ + int foo_default( void ) __attribute__((visibility("default"))); + int foo_hidden( void ) __attribute__((visibility("hidden"))); +])], HAVE_ATTRIBUTE_VISIBILITY="yes"; AC_MSG_RESULT([yes]), AC_MSG_RESULT([no])); - AC_SUBST([VISIBILITY_CFLAGS]) +if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then + AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports __attribute__((visibility))]) fi AC_SUBST(WARN_CFLAGS) |