ax_compiler_vendor.m4 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. dnl Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun,
  2. dnl hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft,
  3. dnl watcom, etc. The vendor is returned in the cache variable
  4. dnl $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++.
  5. AC_DEFUN([AX_COMPILER_VENDOR],
  6. [AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
  7. [dnl note: don't check for gcc first since some other compilers define __GNUC__
  8. vendors="intel: __ICC,__ECC,__INTEL_COMPILER
  9. ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__
  10. pathscale: __PATHCC__,__PATHSCALE__
  11. clang: __clang__
  12. gnu: __GNUC__
  13. sun: __SUNPRO_C,__SUNPRO_CC
  14. hp: __HP_cc,__HP_aCC
  15. dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
  16. borland: __BORLANDC__,__TURBOC__
  17. comeau: __COMO__
  18. cray: _CRAYC
  19. kai: __KCC
  20. lcc: __LCC__
  21. sgi: __sgi,sgi
  22. microsoft: _MSC_VER
  23. metrowerks: __MWERKS__
  24. watcom: __WATCOMC__
  25. portland: __PGI
  26. unknown: UNKNOWN"
  27. for ventest in $vendors; do
  28. case $ventest in
  29. *:) vendor=$ventest; continue ;;
  30. *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;;
  31. esac
  32. AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
  33. #if !($vencpp)
  34. thisisanerror;
  35. #endif
  36. ])], [break])
  37. done
  38. ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
  39. ])
  40. ])