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