2004-01-08 16:34:31 +03:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
2005-11-05 22:57:48 +03:00
|
|
|
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
dnl University Research and Technology
|
|
|
|
dnl Corporation. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
dnl of Tennessee Research Foundation. All rights
|
|
|
|
dnl reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
dnl University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
dnl All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
dnl $COPYRIGHT$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
2004-01-08 16:34:31 +03:00
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
2005-09-14 05:40:25 +04:00
|
|
|
# _OMPI_C_WEAK_SYMBOLS(action_if_found, [action_if_not_found])
|
|
|
|
# ------------------------------------------------------------
|
|
|
|
AC_DEFUN([_OMPI_C_WEAK_SYMBOLS],[
|
|
|
|
# need two files because icc will incorrectly not create the
|
|
|
|
# symbols if they are not used in the object file in which they
|
|
|
|
# are defined. Blah!
|
2007-05-30 17:01:36 +04:00
|
|
|
# To get to compile with icc, have them in a separate header.
|
|
|
|
cat > conftest_weak.h <<EOF
|
|
|
|
int real(int i);
|
|
|
|
int fake(int i);
|
|
|
|
EOF
|
|
|
|
|
2005-09-14 05:40:25 +04:00
|
|
|
cat > conftest_weak.c <<EOF
|
2007-05-30 17:01:36 +04:00
|
|
|
#include "conftest_weak.h"
|
2005-09-14 05:40:25 +04:00
|
|
|
#pragma weak fake = real
|
|
|
|
int real(int i) { return i; }
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > conftest.c <<EOF
|
2007-05-30 17:01:36 +04:00
|
|
|
#include "conftest_weak.h"
|
2006-09-23 03:58:23 +04:00
|
|
|
int main() { return fake(3); }
|
2005-09-14 05:40:25 +04:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# Try the compile
|
2010-11-13 02:22:11 +03:00
|
|
|
OPAL_LOG_COMMAND(
|
2005-09-14 05:40:25 +04:00
|
|
|
[$CC $CFLAGS -c conftest_weak.c],
|
2010-11-13 02:22:11 +03:00
|
|
|
OPAL_LOG_COMMAND(
|
2005-09-14 05:40:25 +04:00
|
|
|
[$CC $CFLAGS conftest.c conftest_weak.o -o conftest $LDFLAGS $LIBS],
|
|
|
|
[ompi_c_weak_symbols_happy=1],
|
|
|
|
[ompi_c_weak_symbols_happy=0]),
|
|
|
|
[ompi_c_weak_symbols_happy=0])
|
|
|
|
|
|
|
|
AS_IF([test "$ompi_c_weak_symbols_happy" = "1"], [$1], [$2])
|
|
|
|
|
|
|
|
unset ompi_c_weak_symbols_happy
|
2007-11-06 15:20:58 +03:00
|
|
|
rm -f conftest_weak.h conftest_weak.c conftest.c conftest
|
2005-09-14 05:40:25 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
|
2005-07-09 22:52:53 +04:00
|
|
|
# OMPI_C_WEAK_SYMBOLS()
|
|
|
|
# ---------------------
|
|
|
|
# sets OMPI_C_WEAK_SYMBOLS=1 if C compiler has support for weak symbols
|
2005-09-14 05:40:25 +04:00
|
|
|
AC_DEFUN([OMPI_C_WEAK_SYMBOLS],[
|
|
|
|
AC_CACHE_CHECK([for weak symbol support],
|
|
|
|
[ompi_cv_c_weak_symbols],
|
|
|
|
[_OMPI_C_WEAK_SYMBOLS([ompi_cv_c_weak_symbols="yes"],
|
|
|
|
[ompi_cv_c_weak_symbols="no"])])
|
2004-01-08 16:34:31 +03:00
|
|
|
|
2005-07-09 22:52:53 +04:00
|
|
|
AS_IF([test "$ompi_cv_c_weak_symbols" = "yes"],
|
2009-05-07 00:11:28 +04:00
|
|
|
[OPAL_C_HAVE_WEAK_SYMBOLS=1], [OPAL_C_HAVE_WEAK_SYMBOLS=0])
|
2005-07-09 22:52:53 +04:00
|
|
|
]) dnl
|