1
1

Strengthen and simplify the visibility test. Adding an "fprintf"

makes the test a bit more difficult, per discussions with Paul
Hargrove when going through the release process for hwloc 1.3.2.

This "improved" test is already on OMPI v1.4 -- not sure why it's not
on the trunk or OMPI v1.5 branch.  It looks like the extra fprintf got
lost in the translation from AC_TRY_LINK to AC_LINK_IFELSE.

This commit was SVN r25909.
Этот коммит содержится в:
Jeff Squyres 2012-02-13 22:07:25 +00:00
родитель 6ec768f0c6
Коммит 717b04f198

Просмотреть файл

@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2009-2011 Oracle and/or its affiliates. All rights reserved.
# $COPYRIGHT$
#
@ -43,48 +43,32 @@ AC_DEFUN([OPAL_CHECK_VISIBILITY],[
case "$ompi_c_vendor" in
sun)
# Check using Sun Studio -xldscope=hidden flag
opal_add="-xldscope=hidden"
opal_add=-xldscope=hidden
CFLAGS="$CFLAGS_orig $opal_add"
AC_MSG_CHECKING([if $CC supports -xldscope])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
__attribute__((visibility("default"))) int foo;
]],[[int i;]])],
[],
[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=])])
])
AS_IF([test "$opal_add" = ""],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])])
;;
*)
# Check using -fvisibility=hidden
opal_add=-fvisibility=hidden
CFLAGS="$CFLAGS_orig $opal_add"
AC_MSG_CHECKING([if $CC supports -fvisibility])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
__attribute__((visibility("default"))) int foo;
]],[[int i;]])],
[],
[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=])])
])
AS_IF([test "$opal_add" = ""],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])])
;;
esac
AC_MSG_CHECKING([if $CC supports $opal_add])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
__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=])])
])
AS_IF([test "$opal_add" = ""],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])])
CFLAGS=$CFLAGS_orig
OPAL_VISIBILITY_CFLAGS=$opal_add