Re: autoconf-2.69c released [beta]

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

 



Bob Friesenhahn <bfriesen@xxxxxxxxxxxxxxxxxxx> writes:

> Gavin, thanks very much for your help.  Just in case someone reads this
> discussion later, I found that there was a small syntax error in the
> above.  The following is what finally worked for me (a small change after
> ac_cv_have_C__func__='no'):

> # Test for C compiler __func__ support
> if test "$ac_cv_have_C__func__" != 'yes' ; then
> AC_CACHE_CHECK(for C compiler __func__ support, ac_cv_have_C__func__,
> [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
> [[const char *func=__func__;
> return (func != 0 ? 0 : 1);
> ]])],
> [ac_cv_have_C__func__='yes'],
> [ac_cv_have_C__func__='no'])])

> if test "$ac_cv_have_C__func__" = 'yes' ; then
>  AC_DEFINE(HAS_C__func__,1,Define if C compiler supports __func__)
> fi
> fi

This is separate from the question of how Autoconf should handle old
configure scripts and how autoupdate should work, but while you're
manually making changes to macros anyway, you will probably be happier in
the long run if you quote all arguments and make a habit of using AS_IF
instead of open-coded shell if statements.

# Test for C compiler __func__ support
AS_IF([test "$ac_cv_have_C__func__" != 'yes'], [
AC_CACHE_CHECK([for C compiler __func__ support], [ac_cv_have_C__func__],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
[[const char *func=__func__;
return (func != 0 ? 0 : 1);
]])],
[ac_cv_have_C__func__='yes'],
[ac_cv_have_C__func__='no'])])

AS_IF([test "$ac_cv_have_C__func__" = 'yes'], [
 AC_DEFINE([HAS_C__func__],[1],[Define if C compiler supports __func__])
])
])

This will protect against a lot of edge cases.

-- 
Russ Allbery (eagle@xxxxxxxxx)             <https://www.eyrie.org/~eagle/>




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux