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.

45 lines
1.3KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_cxx_const_cast.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CXX_CONST_CAST
  8. #
  9. # DESCRIPTION
  10. #
  11. # If the compiler supports const_cast<>, define HAVE_CONST_CAST.
  12. #
  13. # LICENSE
  14. #
  15. # Copyright (c) 2008 Todd Veldhuizen
  16. # Copyright (c) 2008 Luc Maisonobe <luc@spaceroots.org>
  17. #
  18. # Copying and distribution of this file, with or without modification, are
  19. # permitted in any medium without royalty provided the copyright notice
  20. # and this notice are preserved. This file is offered as-is, without any
  21. # warranty.
  22. #serial 8
  23. AU_ALIAS([AC_CXX_CONST_CAST], [AX_CXX_CONST_CAST])
  24. AC_DEFUN([AX_CXX_CONST_CAST],
  25. [dnl
  26. AC_CACHE_CHECK([whether the compiler supports const_cast<>],
  27. ax_cv_cxx_const_cast,
  28. [dnl
  29. AC_LANG_PUSH([C++])
  30. AC_COMPILE_IFELSE([dnl
  31. AC_LANG_PROGRAM([],
  32. [int x = 0;
  33. const int& y = x;
  34. int& z = const_cast<int&>(y);
  35. return z;])],
  36. ax_cv_cxx_const_cast=yes,
  37. ax_cv_cxx_const_cast=no)
  38. AC_LANG_POP([C++])
  39. ])
  40. AS_IF([test "X$ax_cv_cxx_const_cast" = Xyes],
  41. [AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>])])
  42. ])