[v4,4/20] m4: move -fvisibility=hidden check to separate file

Message ID 1507316415-2144-5-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • Another build system update
Related show

Commit Message

Github ODP bot Oct. 6, 2017, 6:59 p.m.
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 213 (lumag:plat-def)
 ** https://github.com/Linaro/odp/pull/213
 ** Patch: https://github.com/Linaro/odp/pull/213.patch
 ** Base sha: a63f25ff2994b2df78c24f1f8b63d0e06628eb68
 ** Merge commit sha: d50e2e291ff11c1319e66c699d2f82260d59c383
 **/
 m4/odp_visibility.m4                   | 21 +++++++++++++++++++++
 platform/linux-generic/m4/configure.m4 | 12 +-----------
 2 files changed, 22 insertions(+), 11 deletions(-)
 create mode 100644 m4/odp_visibility.m4

Patch

diff --git a/m4/odp_visibility.m4 b/m4/odp_visibility.m4
new file mode 100644
index 000000000..955971f3c
--- /dev/null
+++ b/m4/odp_visibility.m4
@@ -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
diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4
index 4d6ef49b9..4e3ce6344 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -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(