<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 13-10-11 08:24 AM, Ross Burton
wrote:<br>
</div>
<blockquote
cite="mid:1381494285-10776-1-git-send-email-ross.burton@intel.com"
type="cite">
<pre wrap="">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 <a class="moz-txt-link-rfc2396E" href="mailto:ross.burton@intel.com"><ross.burton@intel.com></a>
---
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"
</pre>
</blockquote>
<br>
In <a class="moz-txt-link-freetext" href="http://www.x.org/wiki/CrossCompilingXorg">http://www.x.org/wiki/CrossCompilingXorg</a>:<br>
<blockquote>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. <br>
</blockquote>
There seems to be two methods to inform the module configuration on
how malloc behaves:<br>
<ol>
<li>Manually provide the information using
--enable-malloc0returnsnull (yes or no)<br>
</li>
<li>"Seed the cache" as you suggested, if I understood correctly<br>
</li>
</ol>
The first method is already in use (see
<a class="moz-txt-link-freetext" href="https://bugs.freedesktop.org/show_bug.cgi?id=69798">https://bugs.freedesktop.org/show_bug.cgi?id=69798</a>). I would
hesitate removing this option without some kind of advanced warning.
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>