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.

92 lines
3.6KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_cxx_var_prettyfunc.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CXX_VAR_PRETTYFUNC
  8. #
  9. # DESCRIPTION
  10. #
  11. # This function tries to determine the best C++ macro/identifier that
  12. # contains the current function name. Depending on the compiler, this may
  13. # be __PRETTY_FUNCTION__ (GCC), __FUNCSIG__ (MSVC), __func__ (C++
  14. # standard), __FUNCTION__ (fallback).
  15. #
  16. # The function will define HAVE_PRETTYFUNC if a macro exists, and define
  17. # __PRETTYFUNC__ to the best possible macro. When HAVE_PRETTYFUNC is not
  18. # defined, __PRETTYFUNC__ will contain the constant string "<<unknown>>".
  19. #
  20. # LICENSE
  21. #
  22. # Copyright (c) 2014 Olaf Lenz <olenz@icp.uni-stuttgart.de>
  23. #
  24. # This program is free software: you can redistribute it and/or modify it
  25. # under the terms of the GNU General Public License as published by the
  26. # Free Software Foundation, either version 3 of the License, or (at your
  27. # option) any later version.
  28. #
  29. # This program is distributed in the hope that it will be useful, but
  30. # WITHOUT ANY WARRANTY; without even the implied warranty of
  31. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  32. # Public License for more details.
  33. #
  34. # You should have received a copy of the GNU General Public License along
  35. # with this program. If not, see <https://www.gnu.org/licenses/>.
  36. #
  37. # As a special exception, the respective Autoconf Macro's copyright owner
  38. # gives unlimited permission to copy, distribute and modify the configure
  39. # scripts that are the output of Autoconf when processing the Macro. You
  40. # need not follow the terms of the GNU General Public License when using
  41. # or distributing such scripts, even though portions of the text of the
  42. # Macro appear in them. The GNU General Public License (GPL) does govern
  43. # all other use of the material that constitutes the Autoconf Macro.
  44. #
  45. # This special exception to the GPL applies to versions of the Autoconf
  46. # Macro released by the Autoconf Archive. When you make and distribute a
  47. # modified version of the Autoconf Macro, you may extend this special
  48. # exception to the GPL to apply to your modified version as well.
  49. #serial 2
  50. AC_DEFUN([AX_CXX_VAR_PRETTYFUNC],
  51. [
  52. # try to find best __FUNCTION__ variant
  53. AC_CACHE_CHECK([whether $CXX can get a pretty function name], ac_cv_cxx_var_prettyfunc,
  54. ac_cv_cxx_var_prettyfunc=no
  55. AC_COMPILE_IFELSE(
  56. [AC_LANG_PROGRAM(,[const char *s = __PRETTY_FUNCTION__])],
  57. [ ac_cv_cxx_var_prettyfunc=__PRETTY_FUNCTION__ ])
  58. AS_IF([test "x$ac_cv_cxx_var_prettyfunc" = "xno"], [
  59. AC_COMPILE_IFELSE(
  60. [AC_LANG_PROGRAM(,[const char *s = __FUNCSIG__])],
  61. [ ac_cv_cxx_var_prettyfunc=__FUNCSIG__ ])
  62. ])
  63. AS_IF([test "x$ac_cv_cxx_var_prettyfunc" = "xno"], [
  64. AC_COMPILE_IFELSE(
  65. [AC_LANG_PROGRAM(,[const char *s = __func__])],
  66. [ ac_cv_cxx_var_prettyfunc=__func__ ])
  67. ])
  68. AS_IF([test "x$ac_cv_cxx_var_prettyfunc" = "xno"], [
  69. AC_COMPILE_IFELSE(
  70. [AC_LANG_PROGRAM(,[const char *s = __FUNCTION__])],
  71. [ ac_cv_cxx_var_prettyfunc=__FUNCTION__ ])
  72. ])
  73. )
  74. AS_IF([test "x$ac_cv_cxx_var_prettyfunc" != "xno"], [
  75. AC_DEFINE(HAVE_PRETTYFUNC,, [Whether __PRETTY_FUNCTION__ has a useful value.])
  76. AC_DEFINE_UNQUOTED(__PRETTYFUNC__,$ac_cv_cxx_var_prettyfunc,
  77. [contains the function wherein the macro is called])
  78. ],[
  79. AC_DEFINE(__PRETTYFUNC__,"<<unknown>>")
  80. ])
  81. ])dnl