[runtime] Prioritize loading a profiler library from the installation dir over standa...
[mono.git] / configure.ac
index 62eff48f56d31a643fc5f2b024daba606d1e73ab..891ccf2a210b9eac036a7e344d5932ad1df1e754 100644 (file)
@@ -526,26 +526,30 @@ AC_CACHE_CHECK([for clang],
        [])
 ])
 
+AC_ARG_ENABLE(visiblity-hidden,
+[  --disable-visibility-hidden    disable usage of -fvisiblity=hidden]
+   disable_visibility_hidden=no, disable_visibility_hidden=yes)
+
 WARN=''
 if test x"$GCC" = xyes; then
         WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value'
+
+               # We require C99 with some GNU extensions, e.g. `linux` macro
+               CFLAGS="$CFLAGS -std=gnu99"
+
                # The runtime code does not respect ANSI C strict aliasing rules
-               CFLAGS="$CFLAGS -std=c99 -fno-strict-aliasing"
+               CFLAGS="$CFLAGS -fno-strict-aliasing"
 
                # We rely on signed overflow to behave
                CFLAGS="$CFLAGS -fwrapv"
 
-               ORIG_CFLAGS=$CFLAGS
-               CFLAGS="$CFLAGS -Wdeclaration-after-statement"
-               AC_MSG_CHECKING(for -Wdeclaration-after-statement option to gcc)
-               AC_TRY_COMPILE([],[
-                               return 0;
-               ], [
-                  AC_MSG_RESULT(yes)
-               ], [
-                  AC_MSG_RESULT(no)
-                  CFLAGS=$ORIG_CFLAGS
-               ])
+               CFLAGS="$CFLAGS -DMONO_DLL_EXPORT"
+               if test x"$disable_visibility_hidden" = xno; then
+                  # Don't export any symbols by default
+                  SHARED_CFLAGS="-fvisibility=hidden"
+                  CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB -fvisibility=hidden"
+                  CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
+               fi
 
                ORIG_CFLAGS=$CFLAGS
                # Check for the normal version, since gcc ignores unknown -Wno options
@@ -677,6 +681,7 @@ if test x$werror_flag = xyes; then
        WERROR_CFLAGS="-Werror"
 fi
 AC_SUBST([WERROR_CFLAGS])
+AC_SUBST([SHARED_CFLAGS])
 
 ac_configure_args="$ac_configure_args \"CPPFLAGS_FOR_EGLIB=$EGLIB_CPPFLAGS\" \"CFLAGS_FOR_EGLIB=$CFLAGS_FOR_EGLIB\""
 AC_CONFIG_SUBDIRS(eglib)