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.

44 lines
1.4KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_cxx_static_cast.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CXX_STATIC_CAST
  8. #
  9. # DESCRIPTION
  10. #
  11. # If the compiler supports static_cast<>, define HAVE_STATIC_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 7
  23. AU_ALIAS([AC_CXX_STATIC_CAST], [AX_CXX_STATIC_CAST])
  24. AC_DEFUN([AX_CXX_STATIC_CAST],
  25. [AC_CACHE_CHECK(whether the compiler supports static_cast<>,
  26. ax_cv_cxx_static_cast,
  27. [AC_LANG_SAVE
  28. AC_LANG_CPLUSPLUS
  29. AC_TRY_COMPILE([#include <typeinfo>
  30. class Base { public : Base () {} virtual void f () = 0; };
  31. class Derived : public Base { public : Derived () {} virtual void f () {} };
  32. int g (Derived&) { return 0; }],[
  33. Derived d; Base& b = d; Derived& s = static_cast<Derived&> (b); return g (s);],
  34. ax_cv_cxx_static_cast=yes, ax_cv_cxx_static_cast=no)
  35. AC_LANG_RESTORE
  36. ])
  37. if test "$ax_cv_cxx_static_cast" = yes; then
  38. AC_DEFINE(HAVE_STATIC_CAST,,
  39. [define if the compiler supports static_cast<>])
  40. fi
  41. ])