2007-05-04 13:03:37 +04:00
|
|
|
# -*- shell-script -*-
|
|
|
|
#
|
|
|
|
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
# University Research and Technology
|
|
|
|
# Corporation. All rights reserved.
|
|
|
|
# Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
# of Tennessee Research Foundation. All rights
|
|
|
|
# reserved.
|
|
|
|
# Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
|
|
|
# University of Stuttgart. All rights reserved.
|
|
|
|
# Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
# All rights reserved.
|
|
|
|
# Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
|
|
|
|
# $COPYRIGHT$
|
|
|
|
#
|
|
|
|
# Additional copyrights may follow
|
|
|
|
#
|
|
|
|
# $HEADER$
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
# OMPI_CHECK_VISIBILITY
|
|
|
|
# --------------------------------------------------------
|
|
|
|
AC_DEFUN([OMPI_CHECK_VISIBILITY],[
|
2007-06-01 06:31:15 +04:00
|
|
|
AC_REQUIRE([AC_PROG_GREP])
|
|
|
|
|
2008-03-08 00:13:20 +03:00
|
|
|
# Check if the compiler has support for visibility, like some versions of gcc, icc.
|
2007-05-04 13:03:37 +04:00
|
|
|
AC_ARG_ENABLE(visibility,
|
|
|
|
AC_HELP_STRING([--enable-visibility],
|
2008-03-05 04:30:32 +03:00
|
|
|
[enable visibility feature of certain compilers/linkers (default: enabled)]))
|
|
|
|
if test "$enable_visibility" = "no"; then
|
2008-03-08 00:13:20 +03:00
|
|
|
AC_MSG_CHECKING([enable symbol visibility])
|
2008-03-05 04:30:32 +03:00
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
have_visibility=0
|
|
|
|
else
|
2007-05-04 13:03:37 +04:00
|
|
|
CFLAGS_orig="$CFLAGS"
|
|
|
|
CFLAGS="$CFLAGS_orig -fvisibility=hidden"
|
|
|
|
add=
|
|
|
|
AC_CACHE_CHECK([if $CC supports -fvisibility],
|
2007-10-12 02:06:39 +04:00
|
|
|
[ompi_cv_cc_fvisibility],
|
2007-05-04 13:03:37 +04:00
|
|
|
[AC_TRY_LINK([
|
|
|
|
#include <stdio.h>
|
|
|
|
__attribute__((visibility("default"))) int foo;
|
|
|
|
void bar(void) { fprintf(stderr, "bar\n"); };
|
|
|
|
],[],
|
|
|
|
[if test -s conftest.err ; then
|
2007-06-01 06:31:15 +04:00
|
|
|
$GREP -iq "visibility" conftest.err
|
2007-05-04 13:03:37 +04:00
|
|
|
if test "$?" = "0" ; then
|
2007-10-12 02:06:39 +04:00
|
|
|
ompi_cv_cc_fvisibility="no"
|
2007-05-04 13:03:37 +04:00
|
|
|
else
|
2007-10-12 02:06:39 +04:00
|
|
|
ompi_cv_cc_fvisibility="yes"
|
2007-05-04 13:03:37 +04:00
|
|
|
fi
|
|
|
|
else
|
2007-10-12 02:06:39 +04:00
|
|
|
ompi_cv_cc_fvisibility="yes"
|
2007-05-04 13:03:37 +04:00
|
|
|
fi],
|
2007-10-12 02:06:39 +04:00
|
|
|
[ompi_cv_cc_fvisibility="no"])
|
2007-05-04 13:03:37 +04:00
|
|
|
])
|
|
|
|
|
2007-10-12 02:06:39 +04:00
|
|
|
if test "$ompi_cv_cc_fvisibility" = "yes" ; then
|
2007-05-04 13:03:37 +04:00
|
|
|
add=" -fvisibility=hidden"
|
|
|
|
have_visibility=1
|
2008-03-08 00:13:20 +03:00
|
|
|
AC_MSG_CHECKING([enable symbol visibility])
|
2008-03-05 04:30:32 +03:00
|
|
|
AC_MSG_RESULT([yes])
|
2007-05-04 13:03:37 +04:00
|
|
|
AC_MSG_WARN([$add has been added to CFLAGS])
|
2008-03-05 04:30:32 +03:00
|
|
|
elif test "$enable_visibility" = "yes"; then
|
|
|
|
AC_MSG_ERROR([Symbol visibility support requested but compiler does not seem to support it. Aborting])
|
2007-05-04 13:03:37 +04:00
|
|
|
else
|
2008-03-08 00:13:20 +03:00
|
|
|
AC_MSG_CHECKING([enable symbol visibility])
|
2008-03-05 04:30:32 +03:00
|
|
|
AC_MSG_RESULT([no])
|
2007-05-04 13:03:37 +04:00
|
|
|
have_visibility=0
|
|
|
|
fi
|
|
|
|
CFLAGS="$CFLAGS_orig$add"
|
|
|
|
unset add
|
|
|
|
fi
|
2007-05-04 19:58:08 +04:00
|
|
|
AC_DEFINE_UNQUOTED([OMPI_C_HAVE_VISIBILITY], [$have_visibility],
|
|
|
|
[Whether C compiler supports -fvisibility])
|
|
|
|
|
2007-05-04 13:03:37 +04:00
|
|
|
])
|