diff mbox series

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

Message ID 1507226415-26756-5-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v3,1/20] .gitignore: ignore only libtool m4 files | expand

Commit Message

Github ODP bot Oct. 5, 2017, 5:59 p.m. UTC
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: 52cfe7ba6d2541cf5ee464e46e91b2da5efe1497
 ** Merge commit sha: 4157d06d3a16265d7d6152d7ae4918ec5623c10c
 **/
 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
diff mbox series

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(