Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.6KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_cxx_use_numtrait.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CXX_USE_NUMTRAIT
  8. #
  9. # DESCRIPTION
  10. #
  11. # If the compiler supports numeric traits promotions, define
  12. # HAVE_USE_NUMTRAIT.
  13. #
  14. # LICENSE
  15. #
  16. # Copyright (c) 2008 Todd Veldhuizen
  17. # Copyright (c) 2008 Luc Maisonobe <luc@spaceroots.org>
  18. #
  19. # Copying and distribution of this file, with or without modification, are
  20. # permitted in any medium without royalty provided the copyright notice
  21. # and this notice are preserved. This file is offered as-is, without any
  22. # warranty.
  23. #serial 7
  24. AU_ALIAS([AC_CXX_USE_NUMTRAIT], [AX_CXX_USE_NUMTRAIT])
  25. AC_DEFUN([AX_CXX_USE_NUMTRAIT],
  26. [AC_CACHE_CHECK(whether the compiler supports numeric traits promotions,
  27. ax_cv_cxx_use_numtrait,
  28. [AC_REQUIRE([AX_CXX_TYPENAME])
  29. AC_LANG_SAVE
  30. AC_LANG_CPLUSPLUS
  31. AC_TRY_COMPILE([
  32. #ifndef HAVE_TYPENAME
  33. #define typename
  34. #endif
  35. template<class T_numtype> class SumType { public : typedef T_numtype T_sumtype; };
  36. template<> class SumType<char> { public : typedef int T_sumtype; };
  37. template<class T> class A {};
  38. template<class T> A<typename SumType<T>::T_sumtype> sum(A<T>)
  39. { return A<typename SumType<T>::T_sumtype>(); }
  40. ],[A<float> x; sum(x); return 0;],
  41. ax_cv_cxx_use_numtrait=yes, ax_cv_cxx_use_numtrait=no)
  42. AC_LANG_RESTORE
  43. ])
  44. if test "$ax_cv_cxx_use_numtrait" = yes; then
  45. AC_DEFINE(HAVE_USE_NUMTRAIT,,[define if the compiler supports numeric traits promotions])
  46. fi
  47. ])