[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Make AC_COMPUTE_INT public
From: |
Ralf Wildenhues |
Subject: |
Re: [PATCH] Make AC_COMPUTE_INT public |
Date: |
Mon, 19 Jun 2006 23:16:04 +0200 |
User-agent: |
Mutt/1.5.11+cvs20060403 |
Hello Paolo,
* Paolo Bonzini wrote on Mon, Jun 19, 2006 at 10:20:17PM CEST:
>
> >Please submit the patch (it wasn't in your post) to autoconf-patches.
> >If you didn't write the manual addition yet (and the NEWS entry), make
> >sure to list the limitations of AC_COMPUTE_INT.
> >
> I wrote that, but I don't know the limitations...
Well. I suppose something like
This macro works when cross-compiling, but then it assumes that the
host uses twos-complement arithmetic.
would be good. Some more nits inline.
> --- doc/autoconf.texi 16 Jun 2006 20:38:03 -0000 1.1051
> +++ doc/autoconf.texi 19 Jun 2006 20:16:45 -0000
> @@ -6111,6 +6111,17 @@ include @file{stddef.h} and @file{stdio.
> macro to work correctly.
> @end defmac
>
> address@hidden AC_COMPUTE_INT (@var{expression}, @var{var}, @dvar{includes,
> default-includes}, @var{if-fails})
> address@hidden
> +Compute the evaluation of the integer @var{expression} in @var{var}. It
s/evaluation/value/ ?
> +should be possible to evaluate the expression at compile-time, for example
> +in an initializer for a C variable of type @code{int}.
I think AC_COMPUTE_INT works portably for signed long. (This limitation
is due to 'expr' IIRC.) I'm not so sure whether it's bug-free for values
between LONG_MAX / 2 and LONG_MAX (and likewise for negative values).
I thing Stepan has a cleanup patch for _AC_COMPUTE_INT_COMPILE, but I
guess it's not appropriate at this time. Among other nits, the macro
expands _AC_COMPILE_IFELSE too often, uses 'break' in the second arg of
_AC_COMPILE_IFELSE, which skips the cleanup code; luckily the last
invocation doesn't do that, but if the binary search terminates before
the first step, there could be leftover object.. files. Of course, only
when cross-compiling.
Not sure whether these are anywhere near show-stopping. I guess not.
> +If no @var{includes} are specified, the default includes are used
> +(@pxref{Default Includes}). If you provide @var{include}, be sure to
> +include @file{stddef.h} and @file{stdio.h} which are required for this
> +macro to work correctly.
> address@hidden defmac
> +
> @defmac AC_LANG_WERROR
> @acindex{LANG_WERROR}
> Normally Autoconf ignores warnings generated by the compiler, linker, and
> Index: lib/autoconf/general.m4
> ===================================================================
> RCS file: /sources/autoconf/autoconf/lib/autoconf/general.m4,v
> retrieving revision 1.925
> diff -p -u -b -r1.925 general.m4
> --- lib/autoconf/general.m4 7 Jun 2006 05:35:46 -0000 1.925
> +++ lib/autoconf/general.m4 19 Jun 2006 20:16:46 -0000
> @@ -2716,14 +2716,15 @@ m4_define([_AC_COMPUTE_INT_RUN],
> [$2=`cat conftest.val`], [$4])])
>
>
> -# _AC_COMPUTE_INT(EXPRESSION, VARIABLE, PROLOGUE, IF-FAILS)
> +# AC_COMPUTE_INT(EXPRESSION, VARIABLE, PROLOGUE, IF-FAILS)
Please mark PROLOGUE as optional.
_AC_COMPUTE_INT_COMPILE and _AC_COMPUTE_INT_RUN suggest that the
if-fails argument is optional as well; I'm not quite sure whether
case foo in '') ;; esac
is portable shell though (i.e., the fact that $4 of
_AC_COMPUTE_INT_COMPILE is empty). Anyway, all the macros (and the
documentation) should be consistent about optionality of if-fails
(@ovar). ;-)
> # ---------------------------------------------------------
> -m4_define([_AC_COMPUTE_INT],
> +AU_ALIAS([_AC_COMPUTE_INT], [AC_COMPUTE_INT])
> +m4_define([AC_COMPUTE_INT],
AC_COMPUTE_INT needs to be AC_DEFUNed here.
> [AC_LANG_COMPILER_REQUIRE()dnl
> if test "$cross_compiling" = yes; then
> - _AC_COMPUTE_INT_COMPILE([$1], [$2], [$3], [$4])
> + _AC_COMPUTE_INT_COMPILE([$1], [$2], [AC_INCLUDES_DEFAULT([$3])], [$4])
> else
> - _AC_COMPUTE_INT_RUN([$1], [$2], [$3], [$4])
> + _AC_COMPUTE_INT_RUN([$1], [$2], [AC_INCLUDES_DEFAULT([$3])], [$4])
> fi
> rm -f conftest.val[]dnl
> -])# _AC_COMPUTE_INT
> +])# AC_COMPUTE_INT
- Re: [PATCH] Make AC_COMPUTE_INT public, Paolo Bonzini, 2006/06/19
- Re: [PATCH] Make AC_COMPUTE_INT public,
Ralf Wildenhues <=
- Re: [PATCH] Make AC_COMPUTE_INT public, Ralf Wildenhues, 2006/06/20
- Re: [PATCH] Make AC_COMPUTE_INT public, Paolo Bonzini, 2006/06/20
- Re: [PATCH] Make AC_COMPUTE_INT public, Ralf Wildenhues, 2006/06/20
- Re: [PATCH] Make AC_COMPUTE_INT public, Paul Eggert, 2006/06/20
- Re: [PATCH] Make AC_COMPUTE_INT public, Ralf Wildenhues, 2006/06/21
- Re: [PATCH] Make AC_COMPUTE_INT public, Paolo Bonzini, 2006/06/22
- Re: [PATCH] Make AC_COMPUTE_INT public, Ralf Wildenhues, 2006/06/22
- Re: [PATCH] Make AC_COMPUTE_INT public, Paolo Bonzini, 2006/06/27
- Re: [PATCH] Make AC_COMPUTE_INT public, Paul Eggert, 2006/06/27
- Re: [PATCH] Make AC_COMPUTE_INT public, Paolo Bonzini, 2006/06/28