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.
|
2012-02-14 02:07:25 +04:00
|
|
|
# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
|
2011-11-22 04:01:09 +04:00
|
|
|
# Copyright (c) 2009-2011 Oracle and/or its affiliates. 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
|
|
|
# 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)]))
|
2011-11-22 04:01:09 +04:00
|
|
|
|
|
|
|
opal_visibility_define=0
|
|
|
|
opal_msg="whether to enable symbol visibility"
|
|
|
|
|
2010-10-23 18:32:44 +04:00
|
|
|
if test "$enable_visibility" = "no"; then
|
2011-11-22 04:01:09 +04:00
|
|
|
AC_MSG_CHECKING([$opal_msg])
|
2010-10-23 18:32:44 +04:00
|
|
|
AC_MSG_RESULT([no (disabled)])
|
2008-10-28 20:22:29 +03:00
|
|
|
else
|
2011-11-22 04:01:09 +04:00
|
|
|
CFLAGS_orig=$CFLAGS
|
2009-03-20 13:13:01 +03:00
|
|
|
|
2011-11-22 04:01:09 +04:00
|
|
|
opal_add=
|
2014-05-06 19:01:34 +04:00
|
|
|
case "$opal_c_vendor" in
|
2011-11-22 04:01:09 +04:00
|
|
|
sun)
|
2009-04-15 22:13:27 +04:00
|
|
|
# Check using Sun Studio -xldscope=hidden flag
|
2012-02-14 02:07:25 +04:00
|
|
|
opal_add=-xldscope=hidden
|
2014-05-06 02:22:33 +04:00
|
|
|
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $opal_add -errwarn=%all"
|
2011-11-22 04:01:09 +04:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
# Check using -fvisibility=hidden
|
|
|
|
opal_add=-fvisibility=hidden
|
2014-05-06 02:22:33 +04:00
|
|
|
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $opal_add -Werror"
|
2011-11-22 04:01:09 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-02-14 02:07:25 +04:00
|
|
|
AC_MSG_CHECKING([if $CC supports $opal_add])
|
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
2012-02-17 04:09:32 +04:00
|
|
|
#include <stdio.h>
|
2012-02-14 02:07:25 +04:00
|
|
|
__attribute__((visibility("default"))) int foo;
|
|
|
|
]],[[fprintf(stderr, "Hello, world\n");]])],
|
|
|
|
[AS_IF([test -s conftest.err],
|
|
|
|
[$GREP -iq visibility conftest.err
|
|
|
|
# If we find "visibility" in the stderr, then
|
|
|
|
# assume it doesn't work
|
|
|
|
AS_IF([test "$?" = "0"], [opal_add=])])
|
2012-02-17 04:09:32 +04:00
|
|
|
], [opal_add=])
|
2012-02-14 02:07:25 +04:00
|
|
|
AS_IF([test "$opal_add" = ""],
|
|
|
|
[AC_MSG_RESULT([no])],
|
|
|
|
[AC_MSG_RESULT([yes])])
|
|
|
|
|
2011-11-22 04:01:09 +04:00
|
|
|
CFLAGS=$CFLAGS_orig
|
|
|
|
OPAL_VISIBILITY_CFLAGS=$opal_add
|
|
|
|
|
|
|
|
if test "$opal_add" != "" ; then
|
|
|
|
opal_visibility_define=1
|
|
|
|
AC_MSG_CHECKING([$opal_msg])
|
|
|
|
AC_MSG_RESULT([yes (via $opal_add)])
|
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])
|
2011-11-22 04:01:09 +04:00
|
|
|
else
|
|
|
|
AC_MSG_CHECKING([$opal_msg])
|
|
|
|
AC_MSG_RESULT([no (unsupported)])
|
2008-10-28 20:22:29 +03:00
|
|
|
fi
|
2011-11-22 04:01:09 +04:00
|
|
|
unset opal_add
|
2008-10-28 20:22:29 +03:00
|
|
|
fi
|
2010-10-23 18:32:44 +04:00
|
|
|
|
2011-11-22 04:01:09 +04:00
|
|
|
AC_DEFINE_UNQUOTED([OPAL_C_HAVE_VISIBILITY], [$opal_visibility_define],
|
|
|
|
[Whether C compiler supports symbol visibility or not])
|
2008-10-28 20:22:29 +03:00
|
|
|
])
|