new file mode 100644
@@ -0,0 +1,21 @@
+# ODP_VISIBILITY
+# --------------
+# Enable -fvisibility=hidden if using a gcc that supports it
+
+AC_DEFUN([ODP_VISIBILITY], [dnl
+VISIBILITY_CFLAGS="-fvisibility=hidden"
+AC_CACHE_CHECK([whether $CC supports -fvisibility=hidden],
+ [odp_cv_visibility_hidden], [dnl
+OLD_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM()], [odp_cv_visibility_hidden=yes],
+ [odp_cv_visibility_hidden=no])
+CFLAGS=$OLD_CFLAGS
+])
+
+if test "x$odp_cv_visibility_hidden" != "xyes" ; then
+ VISIBILITY_CFLAGS=""
+fi
+
+AC_SUBST(VISIBILITY_CFLAGS)
+]) # ODP_VISIBILITY
@@ -1,14 +1,4 @@
-# Enable -fvisibility=hidden if using a gcc that supports it
-OLD_CFLAGS="$CFLAGS"
-AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
-VISIBILITY_CFLAGS="-fvisibility=hidden"
-CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
-AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
- [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
-
-AC_SUBST(VISIBILITY_CFLAGS)
-# Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
-CFLAGS=$OLD_CFLAGS
+ODP_VISIBILITY
AC_MSG_CHECKING(for GCC atomic builtins)
AC_LINK_IFELSE(