diff options
author | James Cox <imajes@php.net> | 2002-07-24 17:04:11 +0000 |
---|---|---|
committer | James Cox <imajes@php.net> | 2002-07-24 17:04:11 +0000 |
commit | 5626fc5a39d49c74b2484dfa930880daaf18e9b2 (patch) | |
tree | 7a9f2d0094bc3b46600958d3afaed430d064389c /Zend/Zend.m4 | |
parent | 5b3ee5f27a306fcd960fa3628c36e07dc7fa1845 (diff) | |
download | php-git-5626fc5a39d49c74b2484dfa930880daaf18e9b2.tar.gz |
move testing for the alignment values into configure.
Diffstat (limited to 'Zend/Zend.m4')
-rw-r--r-- | Zend/Zend.m4 | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index 44bd9a9f71..dae379c830 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -183,3 +183,48 @@ AC_DEFUN(LIBZEND_CPLUSPLUS_CHECKS,[ ]) +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) |