Add auto* stuff to set __func__.

SVN revision: 54735
This commit is contained in:
Kim Woelders 2010-11-20 07:30:23 +00:00
parent 209cf4b466
commit 2fb4182a04
2 changed files with 36 additions and 0 deletions

View File

@ -43,6 +43,7 @@ AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
AC_C___ATTRIBUTE__
AC_C___FUNC__
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(wchar_t, 4)

35
m4/ac_func.m4 Normal file
View File

@ -0,0 +1,35 @@
dnl Copyright (C) 2010 Kim Woelders
dnl This code is public domain and can be freely used or copied.
dnl Macro for defining __func__ if not already defined
dnl Usage: AC_C___FUNC__
dnl If __func__ is not defined and __FUNCTION__ is, __func__ is defined
dnl to __FUNCTION__. If __FUNCTION__ isn't defined either, __func__ is
dnl defined to "FUNC".
AC_DEFUN([AC_C___FUNC__],
[
AC_CACHE_CHECK([for __func__], ac_cv___func__, [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([], [[const char *s = __func__;]])
], [
ac_cv___func__=yes
], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([], [[const char *s = __FUNCTION__;]])
], [
ac_cv___func__=function
], [
ac_cv___func__=no
])
])
])
if test $ac_cv___func__ = function; then
AC_DEFINE(__func__, __FUNCTION__, [Define __func__ appropriately if missing])
elif test $ac_cv___func__ = no; then
AC_DEFINE(__func__, "FUNC", [Define __func__ appropriately if missing])
fi
])