[PATCH libdrm 2/2] configure.ac: set VISIBILITY_CFLAGS for SUNCC

Emil Velikov emil.l.velikov at gmail.com
Mon Mar 9 05:37:40 PDT 2015


For non-GCC (Sun) compilers check for "-xldscope=hidden". Use it if 
supported to hide the internal symbols.

Cc: Alan Coopersmith <alan.coopersmith at oracle.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 configure.ac | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/configure.ac b/configure.ac
index 1fcc8de..91c6662 100644
--- a/configure.ac
+++ b/configure.ac
@@ -405,6 +405,19 @@ if test "x$GCC" = xyes; then
     # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
     CFLAGS=$save_CFLAGS
     AC_SUBST([VISIBILITY_CFLAGS])
+else
+    # Enable -xldscope=hidden if using a compiler that supports it (SUNCC)
+    save_CFLAGS="$CFLAGS"
+    AC_MSG_CHECKING([whether $CC supports -xldscope=hidden])
+    VISIBILITY_CFLAGS="-xldscope=hidden"
+    CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
+                   [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
+
+    # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
+    CFLAGS=$save_CFLAGS
+    AC_SUBST([VISIBILITY_CFLAGS])
+
 fi
 
 AC_MSG_CHECKING([whether $CC supports __attribute__((visibility))])
-- 
2.3.1



More information about the dri-devel mailing list