cvs: ZendEngine2 / Zend.m4 zend_mm.c

From: Date: Wed, 24 Jul 2002 17:04:11 +0000
Subject: cvs: ZendEngine2 / Zend.m4 zend_mm.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-273@lists.php.net to get a copy of this message
imajes Wed Jul 24 13:04:11 2002 EDT Modified files: /ZendEngine2 Zend.m4 zend_mm.c Log: move testing for the alignment values into configure. Index: ZendEngine2/Zend.m4 diff -u ZendEngine2/Zend.m4:1.32 ZendEngine2/Zend.m4:1.33 --- ZendEngine2/Zend.m4:1.32 Tue Jul 23 20:50:04 2002 +++ ZendEngine2/Zend.m4 Wed Jul 24 13:04:11 2002 @@ -1,5 +1,5 @@ dnl -dnl $Id: Zend.m4,v 1.32 2002/07/24 00:50:04 imajes Exp $ +dnl $Id: Zend.m4,v 1.33 2002/07/24 17:04:11 imajes Exp $ dnl dnl This file contains Zend specific autoconf functions. dnl @@ -183,3 +183,48 @@ ]) +dnl test and set the alignment define for ZEND_MM +dnl this also does the logarithmic test for ZEND_MM. + +AC_MSG_CHECKING(for MM alignment and log values) + +AC_TRY_RUN([#include <stdio.h> + +typedef union _mm_align_test { + void *ptr; + double dbl; + long lng; +} mm_align_test; + +int main() { + +#if (defined (__GNUC__) && __GNUC__ >= 2) +#define ZEND_MM_ALIGNMENT (__alignof__ (mm_align_test)) +#else +#define ZEND_MM_ALIGNMENT (sizeof(mm_align_test)) +#endif + +int i = ZEND_MM_ALIGNMENT; +int zeros = 0; +FILE *f = fopen("conftest.zend", "w"); + +while (i & ~0x1) { + zeros++; + i = i >> 1; +} + +fprintf(f, "%d %d", ZEND_MM_ALIGNMENT, zeros); + + exit(0); +}],zend_mm_test=true,zend_mm_test=false,zend_mm_test=false) + +if test $zend_mm_test = true; then + + LIBZEND_MM_ALIGN=cat ./conftest.zend | cut -d ' ' -f 1 + LIBZEND_MM_ALIGN_LOG2=cat ./conftest.zend | cut -d ' ' -f 2 + + AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT, $LIBZEND_MM_ALIGN, [ ]) + AC_DEFINE_UNQUOTED(ZEND_MM_ALIGNMENT_LOG2, $LIBZEND_MM_ALIGN_LOG2, [ ]) +fi; + +AC_MSG_RESULT(done) Index: ZendEngine2/zend_mm.c diff -u ZendEngine2/zend_mm.c:1.11 ZendEngine2/zend_mm.c:1.12 --- ZendEngine2/zend_mm.c:1.11 Mon Jun 24 09:21:49 2002 +++ ZendEngine2/zend_mm.c Wed Jul 24 13:04:11 2002 @@ -34,6 +34,7 @@ #define MAX(a, b) (((a)>(b))?(a):(b)) #endif +#if 0 /* Platform alignment test */ typedef union _mm_align_test { void *ptr; @@ -50,6 +51,7 @@ /* We're going to need some kind of configure test for this */ #undef ZEND_MM_ALIGNMENT #define ZEND_MM_ALIGNMENT 8 +#endif #define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-1)

« previous php.zend-engine.cvs (#273) next »