2008-10-28 20:22:29 +03: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.
|
2010-10-23 18:32:44 +04:00
|
|
|
# Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
|
2009-03-20 13:13:01 +03:00
|
|
|
# Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
|
2008-10-28 20:22:29 +03:00
|
|
|
# $COPYRIGHT$
|
|
|
|
#
|
|
|
|
# Additional copyrights may follow
|
|
|
|
#
|
|
|
|
# $HEADER$
|
|
|
|
#
|
|
|
|
|
2010-10-23 18:32:44 +04:00
|
|
|
# OPAL_CHECK_VISIBILITY
|
2008-10-28 20:22:29 +03:00
|
|
|
# --------------------------------------------------------
|
2010-10-23 18:32:44 +04:00
|
|
|
AC_DEFUN([OPAL_CHECK_VISIBILITY],[
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_REQUIRE([AC_PROG_GREP])
|
|
|
|
|
2010-10-23 18:35:25 +04:00
|
|
|
msg="whether to enable symbol visibility"
|
|
|
|
# Check if the compiler has support for visibility, like some
|
|
|
|
# versions of gcc, icc Sun Studio cc.
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_ARG_ENABLE(visibility,
|
|
|
|
AC_HELP_STRING([--enable-visibility],
|
|
|
|
[enable visibility feature of certain compilers/linkers (default: enabled)]))
|
2010-10-23 18:32:44 +04:00
|
|
|
if test "$enable_visibility" = "no"; then
|
2010-10-23 18:35:25 +04:00
|
|
|
AC_MSG_CHECKING([$msg])
|
2010-10-23 18:32:44 +04:00
|
|
|
AC_MSG_RESULT([no (disabled)])
|
2008-10-28 20:22:29 +03:00
|
|
|
have_visibility=0
|
|
|
|
else
|
|
|
|
CFLAGS_orig="$CFLAGS"
|
|
|
|
add=
|
2009-03-20 13:13:01 +03:00
|
|
|
|
|
|
|
# check using gcc -fvisibility=hidden flag
|
|
|
|
CFLAGS="$CFLAGS_orig -fvisibility=hidden"
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_CACHE_CHECK([if $CC supports -fvisibility],
|
2010-10-23 18:32:44 +04:00
|
|
|
[opal_cv_cc_fvisibility],
|
|
|
|
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
2008-10-28 20:22:29 +03:00
|
|
|
__attribute__((visibility("default"))) int foo;
|
2010-10-23 18:32:44 +04:00
|
|
|
]],[[int i;]])],
|
|
|
|
[opal_cv_cc_fvisibility=yes],
|
2008-10-28 20:22:29 +03:00
|
|
|
[if test -s conftest.err ; then
|
|
|
|
$GREP -iq "visibility" conftest.err
|
|
|
|
if test "$?" = "0" ; then
|
2010-10-23 18:32:44 +04:00
|
|
|
opal_cv_cc_fvisibility=no
|
2008-10-28 20:22:29 +03:00
|
|
|
else
|
2010-10-23 18:32:44 +04:00
|
|
|
opal_cv_cc_fvisibility=yes
|
2008-10-28 20:22:29 +03:00
|
|
|
fi
|
|
|
|
else
|
2010-10-23 18:32:44 +04:00
|
|
|
opal_cv_cc_fvisibility=yes
|
2008-10-28 20:22:29 +03:00
|
|
|
fi],
|
2010-10-23 18:32:44 +04:00
|
|
|
[opal_cv_cc_fvisibility=no])
|
2008-10-28 20:22:29 +03:00
|
|
|
])
|
2009-04-15 22:13:27 +04:00
|
|
|
if test "$ompi_c_vendor" = "sun" ; then
|
|
|
|
# Check using Sun Studio -xldscope=hidden flag
|
|
|
|
CFLAGS="$CFLAGS_orig -xldscope=hidden"
|
|
|
|
AC_CACHE_CHECK([if $CC supports -xldscope],
|
2010-10-23 18:32:44 +04:00
|
|
|
[opal_cv_cc_xldscope],
|
|
|
|
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
2009-04-15 22:13:27 +04:00
|
|
|
__attribute__((visibility("default"))) int foo;
|
2010-10-23 18:32:44 +04:00
|
|
|
]],[[int i;]])],
|
|
|
|
[opal_cv_cc_fvisibilty=yes],
|
2009-04-15 22:13:27 +04:00
|
|
|
[if test -s conftest.err ; then
|
|
|
|
$GREP -iq "visibility" conftest.err
|
|
|
|
if test "$?" = "0" ; then
|
2010-10-23 18:32:44 +04:00
|
|
|
opal_cv_cc_xldscope="no"
|
2009-04-15 22:13:27 +04:00
|
|
|
else
|
2010-10-23 18:32:44 +04:00
|
|
|
opal_cv_cc_xldscope="yes"
|
2009-04-15 22:13:27 +04:00
|
|
|
fi
|
|
|
|
else
|
2010-10-23 18:32:44 +04:00
|
|
|
opal_cv_cc_xldscope="yes"
|
2009-04-15 22:13:27 +04:00
|
|
|
fi],
|
2010-10-23 18:32:44 +04:00
|
|
|
[opal_cv_cc_xldscope="no"])
|
2009-04-15 22:13:27 +04:00
|
|
|
])
|
|
|
|
fi
|
2010-10-23 18:32:44 +04:00
|
|
|
if test "$opal_cv_cc_fvisibility" = "yes" ; then
|
2008-10-28 20:22:29 +03:00
|
|
|
add=" -fvisibility=hidden"
|
|
|
|
have_visibility=1
|
2010-10-23 18:35:25 +04:00
|
|
|
AC_MSG_CHECKING([$msg])
|
2010-10-23 18:32:44 +04:00
|
|
|
AC_MSG_RESULT([yes (via$add)])
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_MSG_WARN([$add has been added to CFLAGS])
|
2010-10-23 18:32:44 +04:00
|
|
|
elif test "$opal_cv_cc_xldscope" = "yes" ; then
|
2009-03-20 13:13:01 +03:00
|
|
|
add=" -xldscope=hidden"
|
|
|
|
have_visibility=1
|
2010-10-23 18:35:25 +04:00
|
|
|
AC_MSG_CHECKING([$msg])
|
2010-10-23 18:32:44 +04:00
|
|
|
AC_MSG_RESULT([yes (via$add)])
|
2009-03-20 13:13:01 +03:00
|
|
|
AC_MSG_WARN([$add has been added to CFLAGS])
|
2008-10-28 20:22:29 +03:00
|
|
|
elif test "$enable_visibility" = "yes"; then
|
|
|
|
AC_MSG_ERROR([Symbol visibility support requested but compiler does not seem to support it. Aborting])
|
|
|
|
else
|
2010-10-23 18:35:25 +04:00
|
|
|
AC_MSG_CHECKING([$msg])
|
2010-10-23 18:32:44 +04:00
|
|
|
AC_MSG_RESULT([no (unsupported)])
|
2008-10-28 20:22:29 +03:00
|
|
|
have_visibility=0
|
|
|
|
fi
|
|
|
|
CFLAGS="$CFLAGS_orig$add"
|
2009-07-24 08:12:29 +04:00
|
|
|
OPAL_VISIBILITY_CFLAGS="$add"
|
2008-10-28 20:22:29 +03:00
|
|
|
unset add
|
|
|
|
fi
|
2010-10-23 18:32:44 +04:00
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED([OPAL_C_HAVE_VISIBILITY], [$have_visibility],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether C compiler supports -fvisibility])
|
|
|
|
])
|