bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature: C preprocessor supports __func__ or __FUNCTION__?


From: R. Bernstein
Subject: Re: Feature: C preprocessor supports __func__ or __FUNCTION__?
Date: Mon, 15 Jul 2002 06:40:51 -0400

Enclosed should be a patch for autoconf-2.53 to test if __func__ is
supported by the C Preprocessor, and cpp.m4 which would get added to 
.../autoconf.../lib/autoconf/cpp.m4

--- lib/autoconf/Makefile-orig.am       Tue Feb  5 03:16:36 2002
+++ lib/autoconf/Makefile.am    Mon Jul 15 05:50:31 2002
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 
-## Copyright 2001 Free Software Foundation, Inc.
+## Copyright 2002 Free Software Foundation, Inc.
 ##
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
        autoconf.m4 \
         general.m4 status.m4 oldnames.m4 specific.m4 \
        autoheader.m4 autoupdate.m4 autotest.m4 \
-       lang.m4 c.m4 fortran.m4 \
+       lang.m4 c.m4 cpp.m4 fortran.m4 \
         functions.m4 headers.m4 types.m4 libs.m4 programs.m4
 
 nodist_autoconflib_DATA = autoconf.m4f
--- doc/autoconf-orig.texi      Fri Mar  8 07:57:41 2002
+++ doc/autoconf.texi   Mon Jul 15 06:15:53 2002
@@ -4903,6 +4903,15 @@
 @code{HAVE_LONG_DOUBLE}.
 @end defmac
 
address@hidden AC_CPP_FUNC
address@hidden CPP_FUNC
address@hidden __func__
+If the C preprocessor supports the @code{__func__} variable, do nothing.
+Otherwise define @code{__func__} to @code{__FUNCTION__} if it accepts that, or
+the empty string (@code{""}) if nothing works. 
+
address@hidden defmac
+
 @defmac AC_C_STRINGIZE
 @acindex C_STRINGIZE
 @cvindex HAVE_STRINGIZE
--- THANKS.orig Mon Feb 25 12:32:14 2002
+++ THANKS      Mon Jul 15 06:03:28 2002
@@ -142,6 +142,7 @@
 Ralf S. Engelschall         address@hidden
 Richard Stallman            address@hidden
 Robert Lipe                 address@hidden
+Rocky Bernstein             address@hidden
 Robert S. Maier             address@hidden
 Roland McGrath              address@hidden
 RĂ¼diger Kuhlmann            address@hidden
# This file is part of Autoconf.                       -*- Autoconf -*-
# Programming languages support.
# Copyright 2002
# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# As a special exception, the Free Software Foundation gives unlimited
# permission to copy, distribute and modify the configure scripts that
# are the output of Autoconf.  You need not follow the terms of the GNU
# General Public License when using or distributing such scripts, even
# though portions of the text of Autoconf appear in them.  The GNU
# General Public License (GPL) does govern all other use of the material
# that constitutes the Autoconf program.
#
# Certain portions of the Autoconf source text are designed to be copied
# (in certain cases, depending on the input) into the output of
# Autoconf.  We call these the "data" portions.  The rest of the Autoconf
# source text consists of comments plus executable code that decides which
# of the data portions to output in any given case.  We call these
# comments and executable code the "non-data" portions.  Autoconf never
# copies any of the non-data portions into its output.
#
# This special exception to the GPL applies to versions of Autoconf
# released by the Free Software Foundation.  When you make and
# distribute a modified version of Autoconf, you may extend this special
# exception to the GPL to apply to your modified version as well, *unless*
# your modified version has the potential to copy into its output some
# of the text that was the non-data portion of the version that you started
# with.  (In other words, unless your change moves or copies text from
# the non-data portions to the data portions.)  If your modification has
# such potential, you must delete any notice of this special exception
# to the GPL from your modified version.
#

# ------------------ #
# The C Preprocessor #
# ------------------ #

# AC_CPP_FUNC
# ------------------ #
# Checks to see if ANSI C99 CPP variable __func__ works.
# If not, perhaps __FUNCTION__ works instead. 
# If not, we'll just define __func__ to "". 
AC_DEFUN([AC_CPP_FUNC],
[AC_REQUIRE([AC_PROG_CC_STDC])dnl
AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[char *foo = __func__;]])],
  [ac_cv_cpp_func=yes], 
  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[char *foo = __FUNCTION__;]])],
  [ac_cv_cpp_func=__FUNCTION__], 
  [ac_cv_cpp_func=no])])])
if test $ac_cv_cpp_func = __FUNCTION__; then
  AC_DEFINE(__func__,__FUNCTION__,
            [Define to __FUNCTION__ or "" if `__func__' does not conform to 
ANSI C.])
elif test $ac_cv_cpp_func = no; then
  AC_DEFINE(__func__,"",
            [Define to __FUNCTION__ or "" if `__func__' does not conform to 
ANSI C.])
fi
])# AC_CPP_FUNC
I think one should consider renaming AC_C_STRINGIZE (keeping the old
alias) to AC_CPP_STRINGIZE and code for it in c.m4 moved to cpp.m4.

Again, thanks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]