On 13-10-11 08:24 AM, 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). > > Finally remove the configure option as the autoconf site cache is a better way > of setting this value for cross-compiled environments. > > Signed-off-by: Ross Burton <[email protected]> > --- > xorg-macros.m4.in | 21 ++++++--------------- > 1 file changed, 6 insertions(+), 15 deletions(-) > > diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in > index 18c33e9..a675c94 100644 > --- a/xorg-macros.m4.in > +++ b/xorg-macros.m4.in > @@ -1312,15 +1312,9 @@ AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env]) > # malloc(0) returns NULL. Packages should add one of these cflags to > # their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. > AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[ > -AC_ARG_ENABLE(malloc0returnsnull, > - AS_HELP_STRING([--enable-malloc0returnsnull], > - [malloc(0) returns NULL (default: auto)]), > - [MALLOC_ZERO_RETURNS_NULL=$enableval], > - [MALLOC_ZERO_RETURNS_NULL=auto]) > - > -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_CHECK([whether malloc(0) returns NULL], > + [xorg_cv_malloc0_returns_null], > + [AC_RUN_IFELSE([AC_LANG_PROGRAM([ > #include <stdlib.h> > ],[ > char *m0, *r0, *c0, *p; > @@ -1330,13 +1324,10 @@ 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]) > -fi > -AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) > + [xorg_cv_malloc0_returns_null=yes], > + [xorg_cv_malloc0_returns_null=no])]) > > -if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then > +if test "x$xorg_cv_malloc0_returns_null" = xyes; then > MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" > XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS > XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC"
In http://www.x.org/wiki/CrossCompilingXorg: A number of steps in the autoconfig process implicitly assume that the build system and the host system are the same. For example, library components want to build and run test programs to determine the behavior of certain host system elements. This is clearly impossible when crosscompiling. To work around these issues, the --enable-malloc0returnsnull (or --disable-malloc0returnsnull, depending on the host system) must be passed to configure. There seems to be two methods to inform the module configuration on how malloc behaves: 1. Manually provide the information using --enable-malloc0returnsnull (yes or no) 2. "Seed the cache" as you suggested, if I understood correctly The first method is already in use (see https://bugs.freedesktop.org/show_bug.cgi?id=69798). I would hesitate removing this option without some kind of advanced warning.
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
