configure: Enable -fvisibility=hidden for g++ as well
authorKristian Høgsberg <krh@bitplanet.net>
Thu, 9 Sep 2010 00:34:07 +0000 (20:34 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 9 Sep 2010 00:45:07 +0000 (20:45 -0400)
configure.ac

index a7ee0f5763c20500d2c7fa3d1fc45f3db821b555..bf8feb63528ad7ecdbb2da04c311efc31a9128d3 100644 (file)
@@ -155,6 +155,13 @@ fi
 if test "x$GXX" = xyes; then
     CXXFLAGS="$CXXFLAGS -Wall"
 
+    # Enable -fvisibility=hidden if using a gcc that supports it
+    save_CXXFLAGS="$CXXFLAGS"
+    AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
+    CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
+                  [CXXFLAGS="$save_CXXFLAGS" ; AC_MSG_RESULT([no])]);
+
     # Work around aliasing bugs - developers should comment this out
     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
 fi