~ubuntu-branches/ubuntu/oneiric/soqt/oneiric

« back to all changes in this revision

Viewing changes to cfg/m4/compile_functionname.m4

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2004-05-29 02:58:50 UTC
  • Revision ID: james.westby@ubuntu.com-20040529025850-phd20eva5uyhhdrf
Tags: upstream-1.0.2
ImportĀ upstreamĀ versionĀ 1.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
############################################################################
 
2
# Usage:
 
3
#   SIM_AC_CHECK_VAR_FUNCTIONNAME
 
4
#
 
5
# Side-Effects:
 
6
#   config.h:
 
7
#     HAVE_VAR___func__              (1 if exists)
 
8
#     HAVE_VAR___PRETTY_FUNCTION__   (1 if exists)
 
9
#     HAVE_VAR___FUNCTION__          (1 if exists)
 
10
#
 
11
# (Note that only one of these will be defined.)
 
12
#
 
13
# Authors:
 
14
#   Lars J. Aas <larsa@sim.no>
 
15
#   Morten Eriksen <mortene@sim.no>
 
16
 
 
17
AC_DEFUN([SIM_AC_CHECK_VAR_FUNCTIONNAME], [
 
18
AC_CACHE_CHECK([for function name variable],
 
19
  sim_cv_var_functionname, [
 
20
  # __func__ is the identifier used by compilers which are
 
21
  # compliant with the C99 ISO/IEC 9899:1999 standard.
 
22
  AC_TRY_COMPILE(
 
23
    [#include <stdio.h>],
 
24
    [(void)printf("%s\n",__func__)],
 
25
    [sim_cv_var_functionname=__func__],
 
26
    [sim_cv_var_functionname=none])
 
27
  if test x"$sim_cv_var_functionname" = x"none"; then
 
28
    # GCC uses __PRETTY_FUNCTION__
 
29
    AC_TRY_COMPILE(
 
30
      [#include <stdio.h>],
 
31
      [(void)printf("%s\n",__PRETTY_FUNCTION__)],
 
32
      [sim_cv_var_functionname=__PRETTY_FUNCTION__],
 
33
      [sim_cv_var_functionname=none])
 
34
  fi
 
35
  if test x"$sim_cv_var_functionname" = x"none"; then
 
36
    AC_TRY_COMPILE(
 
37
      [#include <stdio.h>],
 
38
      [(void)printf("%s\n",__FUNCTION__)],
 
39
      [sim_cv_var_functionname=__FUNCTION__],
 
40
      [sim_cv_var_functionname=none])
 
41
  fi])
 
42
 
 
43
# FIXME: these can probably be contracted to a single test inside a loop.
 
44
# 20010330 mortene.
 
45
 
 
46
if test x"$sim_cv_var_functionname" = x"__func__"; then
 
47
  AC_DEFINE([HAVE_VAR___func__], 1,
 
48
    [Define this to true if the __func__ variable contains the current function name])
 
49
fi
 
50
 
 
51
if test x"$sim_cv_var_functionname" = x"__PRETTY_FUNCTION__"; then
 
52
  AC_DEFINE([HAVE_VAR___PRETTY_FUNCTION__], 1,
 
53
    [Define this to true if the __PRETTY_FUNCTION__ variable contains the current function name])
 
54
fi
 
55
 
 
56
if test x"$sim_cv_var_functionname" = x"__FUNCTION__"; then
 
57
  AC_DEFINE([HAVE_VAR___FUNCTION__], 1,
 
58
    [Define this to true if the __FUNCTION__ variable contains the current function name])
 
59
fi
 
60
])
 
61