1
0
mirror of https://github.com/ceph/ceph synced 2024-12-29 23:12:27 +00:00
ceph/m4/ax_c_pretty_func.m4
Noah Watkins ac044812d0 assert: choose function-var name on non-gnu
Selects __PRETTY_FUNCTION__ or __func__. Linux assumes GNU, and chooses
__PRETTY_FUNCTION__ if gcc/g++ versions are favorable.

This also includes a fix in ax_c_var_func.m4:

AC_TRY_COMPILE will wrap the test in main{}, and then GCC will complain
about nested functions. Just use the original main{} body.

diff --git a/m4/ax_c_var_func.m4 b/m4/ax_c_var_func.m4
index 0ad7d2b..8b57563 100644
--- a/m4/ax_c_var_func.m4
+++ b/m4/ax_c_var_func.m4
@@ -57,9 +57,9 @@ AC_DEFUN([AX_C_VAR_FUNC],
 [AC_REQUIRE([AC_PROG_CC])
 AC_CACHE_CHECK(whether $CC recognizes __func__, ac_cv_c_var_func,
 AC_TRY_COMPILE(,
-[int main() {
+[
 char *s = __func__;
-}],
+],
 AC_DEFINE(HAVE_FUNC,,
 [Define if the C complier supports __func__]) ac_cv_c_var_func=yes,
 ac_cv_c_var_func=no) )

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2013-11-06 14:16:28 -08:00

19 lines
487 B
Plaintext

#
# Test for C compiler support of __PRETTY_FUNCTION__
#
# - Adapted from ax_c_var_func (Noah Watkins)
#
AU_ALIAS([AC_C_PRETTY_FUNC], [AX_C_PRETTY_FUNC])
AC_DEFUN([AX_C_PRETTY_FUNC],
[AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK(whether $CC recognizes __PRETTY_FUNCTION__, ac_cv_c_pretty_func,
AC_TRY_COMPILE(,
[
char *s = __PRETTY_FUNCTION__;
],
AC_DEFINE(HAVE_PRETTY_FUNC,,
[Define if the C complier supports __PRETTY_FUNCTION__]) ac_cv_c_pretty_func=yes,
ac_cv_c_pretty_func=no) )
])dnl