Blame m4/visibility_hidden.m4

rpm-build 0a0c83
dnl Copyright (C) 2003, 2008  Silicon Graphics, Inc.
rpm-build 0a0c83
dnl
rpm-build 0a0c83
dnl This program is free software: you can redistribute it and/or modify it
rpm-build 0a0c83
dnl under the terms of the GNU General Public License as published by
rpm-build 0a0c83
dnl the Free Software Foundation, either version 2 of the License, or
rpm-build 0a0c83
dnl (at your option) any later version.
rpm-build 0a0c83
dnl
rpm-build 0a0c83
dnl This program is distributed in the hope that it will be useful,
rpm-build 0a0c83
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
rpm-build 0a0c83
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
rpm-build 0a0c83
dnl GNU General Public License for more details.
rpm-build 0a0c83
dnl
rpm-build 0a0c83
dnl You should have received a copy of the GNU General Public License
rpm-build 0a0c83
dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
rpm-build 0a0c83
AC_DEFUN([AC_FUNC_GCC_VISIBILITY],
rpm-build 0a0c83
  [AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
rpm-build 0a0c83
		  libc_cv_visibility_attribute,
rpm-build 0a0c83
		  [cat > conftest.c <
rpm-build 0a0c83
		   int foo __attribute__ ((visibility ("hidden"))) = 1;
rpm-build 0a0c83
		   int bar __attribute__ ((visibility ("protected"))) = 1;
rpm-build 0a0c83
EOF
rpm-build 0a0c83
		  libc_cv_visibility_attribute=no
rpm-build 0a0c83
		  if ${CC-cc} -Werror -S conftest.c -o conftest.s \
rpm-build 0a0c83
			>/dev/null 2>&1; then
rpm-build 0a0c83
		    if grep '\.hidden.*foo' conftest.s >/dev/null; then
rpm-build 0a0c83
		      if grep '\.protected.*bar' conftest.s >/dev/null; then
rpm-build 0a0c83
			libc_cv_visibility_attribute=yes
rpm-build 0a0c83
		      fi
rpm-build 0a0c83
		    fi
rpm-build 0a0c83
		  fi
rpm-build 0a0c83
		  rm -f conftest.[cs]
rpm-build 0a0c83
		  ])
rpm-build 0a0c83
   if test $libc_cv_visibility_attribute = yes; then
rpm-build 0a0c83
     AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE, [], [GCC supports visibility attributes])
rpm-build 0a0c83
     AC_DEFINE(EXPORT, [__attribute__ ((visibility ("default"))) extern], [Visibility attribute for API symbols])
rpm-build 0a0c83
     CFLAGS="${CFLAGS} -fvisibility=hidden"
rpm-build 0a0c83
   else
rpm-build 0a0c83
     AC_DEFINE(EXPORT, [extern], [Visibility attribute for API symbols])
rpm-build 0a0c83
   fi
rpm-build 0a0c83
  ])