On 13-10-10 12:23 PM, Ross Burton wrote:
> Improve configure speed by checking the autoconf cache before compiling and
> running the test.
>
> As this means cross-compilation environments can trivially seed this cache as
> appropriate, remove the cross-compiling value (which for embedded systems 
> using
> uclibc is wrong).
>
> Signed-off-by: Ross Burton <[email protected]>
> ---
>  xorg-macros.m4.in |    9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
> index 18c33e9..2788f8f 100644
> --- a/xorg-macros.m4.in
> +++ b/xorg-macros.m4.in
> @@ -1320,7 +1320,8 @@ AC_ARG_ENABLE(malloc0returnsnull,
>  
>  AC_MSG_CHECKING([whether malloc(0) returns NULL])
>  if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
> -     AC_RUN_IFELSE([AC_LANG_PROGRAM([
> +AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
> +     [AC_RUN_IFELSE([AC_LANG_PROGRAM([
>  #include <stdlib.h>
>  ],[
>      char *m0, *r0, *c0, *p;
> @@ -1330,9 +1331,9 @@ if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
>      c0 = calloc(0,10);
>      exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
>  ])],
> -             [MALLOC_ZERO_RETURNS_NULL=yes],
> -             [MALLOC_ZERO_RETURNS_NULL=no],
> -             [MALLOC_ZERO_RETURNS_NULL=yes])
> +             [xorg_cv_malloc0_returns_null=yes],
> +             [xorg_cv_malloc0_returns_null=no])])
> +MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
>  fi
>  AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
>  
If all modules expanding the macro are setting $enableval to auto, then
I think it works fine.

Now suppose a next module is configured using
--disable-malloc0returnsnull, $enableval is now "no". The AC_LANG_PROGRAM
is not executed, the value of xorg_cv_malloc0_returns_null is not
changed (remains to the cached "yes" value), the value of
MALLOC_ZERO_RETURNS_NULL does not change (remains to "yes") and value of
*ZERO_CFLAGS do not change and are now wrong.

There are a number of permutations to check. Assuming the
AC_LANG_PROGRAM test always return the same value, it may be preceeded
by a module that was configured with enableval set to "yes" or "no".

I am also assuming that a module would not provide an alternate
implementation of malloc which would break my assumption above.

I don't understand why someone would configure a module with --enable or
--disable. Can you make sense out of this?


_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to