-
Notifications
You must be signed in to change notification settings - Fork 9
/
cit_funcstring.m4
47 lines (40 loc) · 1.42 KB
/
cit_funcstring.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- Autoconf -*-
## Autoconf macro for testing if compiler provides string with
## function names.
##
# CIT_HAVE_FUNTIONSTRING
# Defines preprocessor macro __FUNCTION_NAME__.
# ------------
AC_DEFUN([CIT_FUNCTIONSTRING], [
AC_LANG(C++)
set_function_name=no
AC_MSG_CHECKING([whether C++ compiler defines __PRETTY_FUNCTION__])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]],
[[const char* name = __PRETTY_FUNCTION__;]])],
[AC_MSG_RESULT(yes)
set_function_name=yes
AC_DEFINE([__FUNCTION_NAME__], [__PRETTY_FUNCTION__], [Define __FUNCTION_NAME__ to __PRETTY_FUNCTION__.])],
[AC_MSG_RESULT(no)])
if test "$set_function_name" == no; then
AC_MSG_CHECKING([whether C++ compiler defines __FUNCTION__])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]],
[[const char* name = __FUNCTION__;]])],
[AC_MSG_RESULT(yes)
set_function_name=yes
AC_DEFINE([__FUNCTION_NAME__], [__FUNCTION__], [Define __FUNCTION_NAME__ to __FUNCTION__.])],
[AC_MSG_RESULT(no)])
fi
if test "$set_function_name" == no; then
AC_MSG_CHECKING([whether C++ compiler defines __func__])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]],
[[const char* name = __func__;]])],
[AC_MSG_RESULT(yes)
set_function_name=yes
AC_DEFINE([__FUNCTION_NAME__], [__func__], [Define __FUNCTION_NAME__ to __func__.])],
[AC_MSG_RESULT(no)])
fi
]))
dnl end of file