Advertisement
Guest User

Untitled

a guest
Apr 14th, 2014
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. cat > conftest.$ac_ext <<EOF
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif
  5. char nm_test_var;
  6. void nm_test_func(){}
  7. #ifdef __cplusplus
  8. }
  9. #endif
  10. int main(){nm_test_var='a';nm_test_func();return(0);}
  11. EOF
  12.  
  13. if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  14. (eval $ac_compile) 2>&5
  15. ac_status=$?
  16. echo "$as_me:$LINENO: \$? = $ac_status" >&5
  17. (exit $ac_status); }; then
  18. # Now try to grab the symbols.
  19. nlist=conftest.nm
  20. if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
  21. (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
  22. ac_status=$?
  23. echo "$as_me:$LINENO: \$? = $ac_status" >&5
  24. (exit $ac_status); } && test -s "$nlist"; then
  25. # Try sorting and uniquifying the output.
  26. if sort "$nlist" | uniq > "$nlist"T; then
  27. mv -f "$nlist"T "$nlist"
  28. else
  29. rm -f "$nlist"T
  30. fi
  31.  
  32. # Make sure that we snagged all the symbols we need.
  33. if grep ' nm_test_var$' "$nlist" >/dev/null; then
  34. if grep ' nm_test_func$' "$nlist" >/dev/null; then
  35. cat <<EOF > conftest.$ac_ext
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. EOF
  41. # Now generate the symbol file.
  42. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
  43.  
  44. cat <<EOF >> conftest.$ac_ext
  45. #if defined (__STDC__) && __STDC__
  46. # define lt_ptr_t void *
  47. #else
  48. # define lt_ptr_t char *
  49. # define const
  50. #endif
  51.  
  52. /* The mapping between symbol names and symbols. */
  53. const struct {
  54. const char *name;
  55. lt_ptr_t address;
  56. }
  57. lt_preloaded_symbols[] =
  58. {
  59. EOF
  60. $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
  61. cat <<\EOF >> conftest.$ac_ext
  62. {0, (lt_ptr_t) 0}
  63. };
  64.  
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. EOF
  69. # Now try linking the two files.
  70. mv conftest.$ac_objext conftstm.$ac_objext
  71. lt_save_LIBS="$LIBS"
  72. lt_save_CFLAGS="$CFLAGS"
  73. LIBS="conftstm.$ac_objext"
  74. CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
  75. if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  76. (eval $ac_link) 2>&5
  77. ac_status=$?
  78. echo "$as_me:$LINENO: \$? = $ac_status" >&5
  79. (exit $ac_status); } && test -s conftest${ac_exeext}; then
  80. pipe_works=yes
  81. fi
  82. LIBS="$lt_save_LIBS"
  83. CFLAGS="$lt_save_CFLAGS"
  84. else
  85. echo "cannot find nm_test_func in $nlist" >&5
  86. fi
  87. else
  88. echo "cannot find nm_test_var in $nlist" >&5
  89. fi
  90. else
  91. echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
  92. fi
  93. else
  94. echo "$progname: failed program was:" >&5
  95. cat conftest.$ac_ext >&5
  96. fi
  97. rm -rf conftest* conftst*
  98.  
  99. # Do not use the global_symbol_pipe unless it works.
  100. if test "$pipe_works" = yes; then
  101. break
  102. else
  103. lt_cv_sys_global_symbol_pipe=
  104. fi
  105. done
  106.  
  107. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement