2 dnl Check for compiler mechanism to show functions in debugging
3 dnl copied from an Ali patch floating on the internet
5 AC_DEFUN([GST_CHECK_FUNCTION],[
6 dnl #1: __PRETTY_FUNCTION__
7 AC_MSG_CHECKING(whether $CC implements __PRETTY_FUNCTION__)
8 AC_CACHE_VAL(have_pretty_function,[
9 AC_TRY_LINK([#include <stdio.h>],
10 [printf("%s", __PRETTY_FUNCTION__);],
11 have_pretty_function=yes,
12 have_pretty_function=no)
14 AC_MSG_RESULT($have_pretty_function)
15 if test "$have_pretty_function" = yes; then
16 AC_DEFINE(HAVE_PRETTY_FUNCTION, 1,
17 [defined if the compiler implements __PRETTY_FUNCTION__])
21 AC_MSG_CHECKING(whether $CC implements __FUNCTION__)
22 AC_CACHE_VAL(have_function,[
23 AC_TRY_LINK([#include <stdio.h>],
24 [printf("%s", __FUNCTION__);],
28 AC_MSG_RESULT($have_function)
29 if test "$have_function" = yes; then
30 AC_DEFINE(HAVE_FUNCTION, 1,
31 [defined if the compiler implements __FUNCTION__])
35 AC_MSG_CHECKING(whether $CC implements __func__)
36 AC_CACHE_VAL(have_func,[
37 AC_TRY_LINK([#include <stdio.h>],
38 [printf("%s", __func__);],
42 AC_MSG_RESULT($have_func)
43 if test "$have_func" = yes; then
44 AC_DEFINE(HAVE_FUNC, 1,
45 [defined if the compiler implements __func__])
48 dnl now define FUNCTION to whatever works, and fallback to ""
49 if test "$have_pretty_function" = yes; then
50 function=__PRETTY_FUNCTION__
52 if test "$have_function" = yes; then
55 if test "$have_func" = yes; then
62 AC_DEFINE_UNQUOTED(GST_FUNCTION, $function, [macro to use to show function name])