From: Marco Maggi Date: Thu, 18 Oct 2018 11:27:40 +0000 (+0200) Subject: reorganised check for compiler supporting visibility X-Git-Tag: R_2_2_7~21^2~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78646864c984bb9a2cf7677bb78e87f931bb4576;p=libexpat reorganised check for compiler supporting visibility --- diff --git a/expat/acinclude.m4 b/expat/acinclude.m4 index e6b5f63a..0d12c3e8 100644 --- a/expat/acinclude.m4 +++ b/expat/acinclude.m4 @@ -8,5 +8,6 @@ m4_include(conftools/ax-append-flag.m4) m4_include(conftools/ax-append-compile-flags.m4) m4_include(conftools/ax-append-link-flags.m4) dnl m4_include(conftools/ax-gcc-version.m4) +m4_include(conftools/expat-compiler-supports-visibility.mp4) ### end of file diff --git a/expat/configure.ac b/expat/configure.ac index 37d9850a..20d894d0 100644 --- a/expat/configure.ac +++ b/expat/configure.ac @@ -90,14 +90,9 @@ AC_LANG_POP([C++]) AS_IF([test "$GCC" = yes], [AX_APPEND_LINK_FLAGS([-fno-strict-aliasing],[LDFLAGS])]) -AC_MSG_CHECKING(whether compiler supports visibility) -AS_VAR_COPY(OLDCFLAGS,CFLAGS) -AS_VAR_APPEND(CFLAGS,[" -fvisibility=hidden -Wall -Werror"]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[void __attribute__((visibility("default"))) foo(void); void foo(void) {}]])], - [AC_MSG_RESULT(yes) - AS_VAR_SET(CFLAGS,"$OLDCFLAGS -fvisibility=hidden -DXML_ENABLE_VISIBILITY=1")], - [AC_MSG_RESULT(no) - AS_VAR_COPY(CFLAGS, OLDCFLAGS)]) +EXPAT_COMPILER_SUPPORTS_VISIBILITY([ + AX_APPEND_FLAG([-fvisibility=hidden], [CFLAGS]) + AX_APPEND_FLAG([-DXML_ENABLE_VISIBILITY=1], [CFLAGS])]) dnl Checks for header files. AC_HEADER_STDC diff --git a/expat/conftools/expat-compiler-supports-visibility.mp4 b/expat/conftools/expat-compiler-supports-visibility.mp4 new file mode 100644 index 00000000..2ea9f974 --- /dev/null +++ b/expat/conftools/expat-compiler-supports-visibility.mp4 @@ -0,0 +1,20 @@ +dnl expat-compiler-supports-visibility.mp4 +dnl +dnl SYNOPSIS +dnl +dnl EXPAT_COMPILER_SUPPORTS_VISIBILITY([ACTION-IF-YES], [ACTION-IF-NO]) +dnl + +AC_DEFUN([EXPAT_COMPILER_SUPPORTS_VISIBILITY], + [AC_MSG_CHECKING(whether compiler supports visibility) + AS_VAR_COPY([OLDFLAGS],[CFLAGS]) + AS_VAR_APPEND(CFLAGS,[" -fvisibility=hidden -Wall -Werror"]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[void __attribute__((visibility("default"))) foo(void); void foo(void) {}]])], + [AC_MSG_RESULT(yes) + AS_VAR_COPY([CFLAGS],[OLDFLAGS]) + $1], + [AC_MSG_RESULT(no) + AS_VAR_COPY([CFLAGS],[OLDFLAGS]) + $2])]) + +dnl end of file