ID:               26462
 User updated by:  jdolecek at NetBSD dot org
 Reported By:      jdolecek at NetBSD dot org
 Status:           Closed
 Bug Type:         BC math related
 Operating System: NetBSD 1.6ZF
 PHP Version:      4.3.4
 Assigned To:      sniper
 New Comment:

Yes, this works. Arguably it's not right to #ifdef HAVE_CONFIG_H just
../../config.h, since it's always necessary to bring that in before you
#include php_bcmath.h and it's not related to libbcmath build per-se
(it's libbcmath configure which defines HAVE_CONFIG_H). It would be
also aesthetically more pleasing to use #include <php.h> instead of
#include "php.h".

But I don't really care about the details. It's cool it now compiles
out of box. Thank you.


Previous Comments:
------------------------------------------------------------------------

[2003-12-01 09:01:23] [EMAIL PROTECTED]

This patch should work better:

http://www.php.net/~jani/patches/bug26462.patch

(fixed in CVS too)


------------------------------------------------------------------------

[2003-12-01 07:17:59] jdolecek at NetBSD dot org

I split your patch into two files, so that there would
we one patch per patched file.

Yes, phpize is from PHP 4.3.4.

libtool 1.4
autoconf 2.57
automake 1.7.6

Note: all other php4 modules build fine, so it's only problem with
bcmath. Perhaps 'your' libfool magically strips some -I directives? Can
you paste your compile line for libcmath/src/init.c?

The problem happens due to init.c not picking .../ext/bcmath/config.h
before including php_bcmath.h. Due to this, the #ifdef WITH_BCMATH
block won't be included. Thus, BCG() macro is not defined and obviously
the compile fails due to 'missing' _zero_ et.al. I'm not sure why it
works for you - this is obviously wrong and shouldn't work anywhere.

Anyway, adding #include "../../config.h" just before #include
"../../php_bcmath.h" in bcmath.h fixed the compile problem, thus this
updated patch to bcmath.h works fine:

--- bcmath.h.orig       2002-11-22 10:27:08.000000000 +0100
+++ bcmath.h    2003-12-01 13:10:05.000000000 +0100
@@ -52,8 +52,9 @@
                           in the case of leading zeros generated. */
     } bc_struct;

-#include <php.h>
-#include <ext/bcmath/php_bcmath.h>
+#include "php.h"
+#include "../../config.h"
+#include "../../php_bcmath.h"


Note the file should really use #include <php.h>, because
php.h comes from installed PHP headers, not local bcmath module stuff.
So I propose this patch as 'final':

--- libbcmath/src/bcmath.h.orig 2002-11-22 10:27:08.000000000 +0100
+++ libbcmath/src/bcmath.h      2003-12-01 13:16:46.000000000 +0100
@@ -53,7 +53,8 @@
     } bc_struct;

 #include <php.h>
-#include <ext/bcmath/php_bcmath.h>
+#include "../../config.h"
+#include "../../php_bcmath.h"


 /* The base used in storing the numbers in n_value above.


With this patch (and the config.m4 fix to not include number.c), the
module compiles fine for me.

------------------------------------------------------------------------

[2003-12-01 03:49:13] [EMAIL PROTECTED]

What two patches? There's exactly 1 (one) file I gave.
Anyway, this works just fine for me..

What libtool, autoconf and automake versions you're using?
Is the phpize you're using from PHP 4.3.4 ?



------------------------------------------------------------------------

[2003-12-01 03:26:16] jdolecek at NetBSD dot org

Sorry about not providing the steps at first.
Here it is:

1. tar xzf php-4.3.4.tar.bz2 php-4.3.4/ext/bcmath
2. cd php-4.3.4/ext/bcmath
3. patch < patch1; patch < patch2
4. phpize
5. ./configure --enable-bcmath
6. gmake

patch1 and patch2 are your two patches.

These steps get me reliably to the same compilation failure, as pasted
in previous feedback.

------------------------------------------------------------------------

[2003-11-30 03:36:26] [EMAIL PROTECTED]

Exactly HOW is the configure run? Give the full process, not just some
part of it..


------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/26462

-- 
Edit this bug report at http://bugs.php.net/?id=26462&edit=1

Reply via email to