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