diff mbox

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

Message ID 1425904660-13743-2-git-send-email-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Emil Velikov March 9, 2015, 12:37 p.m. UTC
For non-GCC (Sun) compilers check for "-xldscope=hidden". Use it if 
supported to hide the internal symbols.

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

Patch

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))])