1dnl $Id$
2dnl
3AC_DEFUN([AC_HAVE_PRAGMA_WEAK], [
4if test "${enable_shared}" = "yes"; then
5AC_MSG_CHECKING(for pragma weak)
6AC_CACHE_VAL(ac_have_pragma_weak, [
7ac_have_pragma_weak=no
8cat > conftest_foo.$ac_ext <<'EOF'
9[#]line __oline__ "configure"
10#include "confdefs.h"
11#pragma weak foo = _foo
12int _foo = 17;
13EOF
14cat > conftest_bar.$ac_ext <<'EOF'
15[#]line __oline__ "configure"
16#include "confdefs.h"
17extern int foo;
18
19int t(void) {
20  return foo;
21}
22
23int main(int argc, char **argv) {
24  return t();
25}
26EOF
27if AC_TRY_EVAL('CC -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest_foo.$ac_ext conftest_bar.$ac_ext 1>&AC_FD_CC'); then
28ac_have_pragma_weak=yes
29fi
30rm -rf conftest*
31])
32if test "$ac_have_pragma_weak" = "yes"; then
33	AC_DEFINE(HAVE_PRAGMA_WEAK, 1, [Define this if your compiler supports \`#pragma weak.'])dnl
34fi
35AC_MSG_RESULT($ac_have_pragma_weak)
36fi
37])
38