Skip to content
Browse files

check if -fvisibility is supported before using it

Because e.g. cygwin is not supposed to support it

Change-Id: I6f1b8c9484c58dcb2ba07e2edd364e00a4b68fed
Reviewed-on: http://review.couchbase.org/14524
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
  • Loading branch information...
1 parent e3ff59f commit 8ee02f40667038544d80c4a93d00a677697e547f Aliaksey Kandratsenka committed with alk Apr 4, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 m4/couchbase.m4
View
15 m4/couchbase.m4
@@ -84,7 +84,20 @@ AC_DEFUN([COUCHBASE_GENERIC_COMPILER], [
CXX_OPTIMIZE="$GCC_CXX_OPTIMIZE"
C_DEBUG="$GCC_C_DEBUG"
CXX_DEBUG="$GCC_CXX_DEBUG"
- VISIBILITY="$GCC_VISIBILITY"
+
+ AC_MSG_CHECKING([checking if -fvisibility is supported])
+ gcc_fvisibility_supported=no
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $GCC_VISIBILITY"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [gcc_fvisibility_supported=yes])
+ CFLAGS="$save_CFLAGS"
+ AC_MSG_RESULT([$gcc_fvisibility_supported])
+
+ AS_IF([test x"$gcc_fvisibility_supported" = xyes],
+ [VISIBILITY="$GCC_VISIBILITY"],
+ [VISIBILITY=""])
+
CPP_WARNINGS="$GCC_CPP_WARNINGS"
C_COMPILER_WARNINGS="$GCC_C_COMPILER_WARNINGS"
CXX_COMPILER_WARNINGS="$GCC_CXX_COMPILER_WARNINGS"

0 comments on commit 8ee02f4

Please sign in to comment.
Something went wrong with that request. Please try again.