cvs: ZendEngine2 / Zend.m4
| From: | Jani Taskinen | Date: | Thu, 25 Jul 2002 23:55:07 +0000 |
| Subject: | cvs: ZendEngine2 / Zend.m4 | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-275@lists.php.net to get a copy of this message | ||
sniper Thu Jul 25 19:55:07 2002 EDT
Modified files:
/ZendEngine2 Zend.m4
Log:
Fixed 3 major failures in this test:
1. Tests work better when they are actually run..
2. When file is opened, it should be closed sometime too.
3. AC_TRY_RUN cleans after itself (rm -f conftest.*), so it's
good idea to read the values while the file still exists.
#
# James, TEST BEFORE YOU COMMIT!!!!!!!
#
# Andi, I get these results (in Linux/i386):
#
# ZEND_MM_ALIGNMENT 4
# ZEND_MM_ALIGNMENT_LOG2 2
#
# Weren't these supposed to be 8 and 3 ?
#
Index: ZendEngine2/Zend.m4
diff -u ZendEngine2/Zend.m4:1.33 ZendEngine2/Zend.m4:1.34
--- ZendEngine2/Zend.m4:1.33 Wed Jul 24 13:04:11 2002
+++ ZendEngine2/Zend.m4 Thu Jul 25 19:55:06 2002
@@ -1,5 +1,5 @@
dnl
-dnl $Id: Zend.m4,v 1.33 2002/07/24 17:04:11 imajes Exp $
+dnl $Id: Zend.m4,v 1.34 2002/07/25 23:55:06 sniper Exp $
dnl
dnl This file contains Zend specific autoconf functions.
dnl
@@ -177,18 +177,13 @@
AC_SUBST(INLINE_CFLAGS)
-])
-
-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>
+AC_TRY_RUN([
+#include <stdio.h>
typedef union _mm_align_test {
void *ptr;
@@ -196,35 +191,42 @@
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;
+int main()
+{
+ int i = ZEND_MM_ALIGNMENT;
+ int zeros = 0;
+ FILE *fp;
+
+ while (i & ~0x1) {
+ zeros++;
+ i = i >> 1;
+ }
+
+ fp = fopen("conftest.zend", "w");
+ fprintf(fp, "%d %d", ZEND_MM_ALIGNMENT, zeros);
+ fclose(fp);
+
+ exit(0);
}
+], [
+ 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, [ ])
+])
-fprintf(f, "%d %d", ZEND_MM_ALIGNMENT, zeros);
+AC_MSG_RESULT(done)
- 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_DEFUN(LIBZEND_CPLUSPLUS_CHECKS,[
- 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)