ax_check_export_capability.m4 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # @synopsis AX_CHECK_EXPORT_CAPABILITY
  2. #
  3. # Does the compiler support the exporting of library symbols?
  4. # @version 1.0 Jan 31 2009
  5. # @author Steve Underwood
  6. #
  7. # Permission to use, copy, modify, distribute, and sell this file for any
  8. # purpose is hereby granted without fee, provided that the above copyright
  9. # and this permission notice appear in all copies. No representations are
  10. # made about the suitability of this software for any purpose. It is
  11. # provided "as is" without express or implied warranty.
  12. AC_DEFUN([AX_CHECK_EXPORT_CAPABILITY],
  13. [AC_CACHE_CHECK([if $1 supports library symbol export],
  14. ac_cv_symbol_export_capability,
  15. [# Initialize to unknown
  16. ac_cv_symbol_export_capability="no"
  17. case "${ax_cv_c_compiler_vendor}" in
  18. gnu)
  19. save_CFLAGS="${CFLAGS}"
  20. CFLAGS="${CFLAGS} -fvisibility=hidden"
  21. AC_COMPILE_IFELSE(
  22. [AC_LANG_PROGRAM(
  23. [int foo __attribute__ ((visibility("default")));],
  24. [;]
  25. )],
  26. [AC_MSG_RESULT([yes])
  27. COMP_VENDOR_CFLAGS="-fvisibility=hidden -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS"
  28. COMP_VENDOR_CXXFLAGS="-fvisibility=hidden -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS"
  29. ac_cv_symbol_export_capability="yes"],
  30. [AC_MSG_RESULT([no])]
  31. )
  32. CFLAGS="${save_CFLAGS}"
  33. ;;
  34. sun)
  35. save_CFLAGS="${CFLAGS}"
  36. CFLAGS="${CFLAGS} -xldscope=hidden"
  37. AC_COMPILE_IFELSE(
  38. [AC_LANG_PROGRAM(
  39. [int foo __attribute__ ((visibility("default")));],
  40. [;]
  41. )],
  42. [AC_MSG_RESULT([yes])
  43. COMP_VENDOR_CFLAGS="-xldscope=hidden -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS"
  44. COMP_VENDOR_CXXFLAGS="-xldscope=hidden -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS"
  45. ac_cv_symbol_export_capability="yes"],
  46. [AC_MSG_RESULT([no])]
  47. )
  48. CFLAGS="${save_CFLAGS}"
  49. ;;
  50. esac])
  51. AS_IF([test AS_VAR_GET(ac_cv_symbol_export_capability) = yes], [$2], [$3])[]dnl
  52. ]) # AX_CHECK_EXPORT_CAPABILITY