# --with-ereg

- Thread: https://externals.io/message/37744
- Original archive: https://news-web.php.net/php.internals/37744
- Started by Hector Santos on 2008-05-20T14:18:45+00:00
- Messages: 7
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #37744 — Hector Santos — 2008-05-20T14:18:45+00:00

URL: https://externals.io/message/37744#37744

Folks,

 From the example build at:

    http://uk3.php.net/manual/en/install.windows.building.php

where it shows the options for a minimal build:

   --disable-all
   --enable-cli
   --enable-cgi
   --enable-object-out-dir=.
   --disable-ipv6.

I've been using this to test basic quick/basic building and it works 
fine for PHP 5.2.

For PHP 5.3,  you get browscap.obj linking errors.   I don't understand 
what ereg does, but I found I had to add the option:

   --with-ereg

After buildconf.bat and running configure.js wit the options, and deleting

     del release_ts\ext\standard\brows*.*
     rd release_ts\ext\ereg /q /s

and it will make and create fine. (BTW, this was a x64 vc8 minimal build).

Is this option a new required minimal build option that should be forced?

Again, i don't know what this ereg stuff does so I can't tell the 
importance of it or how to fix it, other than adding the above switch.

Thanks

-- 
Hector Santos

---

## #37745 — Pierre Joye — 2008-05-20T14:32:59+00:00

URL: https://externals.io/message/37744#37745 · In reply to: #37744

Hi Hector,



> From the example build at:
>
>   http://uk3.php.net/manual/en/install.windows.building.php
>
> where it shows the options for a minimal build:
>
>  --disable-all
>  --enable-cli
>  --enable-cgi
>  --enable-object-out-dir=.
>  --disable-ipv6.
>
> I've been using this to test basic quick/basic building and it works fine
> for PHP 5.2.
>
> For PHP 5.3,  you get browscap.obj linking errors.   I don't understand what
> ereg does, but I found I had to add the option:
>
>  --with-ereg

Browsercap should be fixed and do not rely on any macro or def from
ereg. Patches welcome (5.3+) :)

Cheers,
-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #37746 — Elizabeth M Smith — 2008-05-20T14:33:03+00:00

URL: https://externals.io/message/37744#37746 · In reply to: #37744

Hector Santos wrote:
> Folks,
> 
> From the example build at:
> 
>    http://uk3.php.net/manual/en/install.windows.building.php
> 
> where it shows the options for a minimal build:
> 
>   --disable-all
>   --enable-cli
>   --enable-cgi
>   --enable-object-out-dir=.
>   --disable-ipv6.

ereg used to be in standard, in 5.3 it's moved out and all the places
that use it were supposed to use pcre instead - obviously one was missed

---

## #37747 — Steph Fox — 2008-05-20T14:34:31+00:00

URL: https://externals.io/message/37744#37747 · In reply to: #37744

> For PHP 5.3,  you get browscap.obj linking errors.   I don't understand 
> what ereg does, but I found I had to add the option:
>
>   --with-ereg
>
> After buildconf.bat and running configure.js wit the options, and deleting
>
>     del release_ts\ext\standard\brows*.*
>     rd release_ts\ext\ereg /q /s
>
> and it will make and create fine. (BTW, this was a x64 vc8 minimal build).
>
> Is this option a new required minimal build option that should be forced?
>
> Again, i don't know what this ereg stuff does so I can't tell the 
> importance of it or how to fix it, other than adding the above switch.

'This ereg stuff' is important, in that it supports legacy code... it moved 
from ext/standard to ext/ereg in 5_3 in the vague hope that it might be 
possible to move it out to PECL some day. But whoever did it obviously 
missed a bit.

Again, though... you're seeing errors I don't see.

- Steph

---

## #37748 — Hector Santos — 2008-05-20T15:41:25+00:00

URL: https://externals.io/message/37744#37748 · In reply to: #37747

Steph Fox wrote:
> > […]

> 'This ereg stuff' is important, in that it supports legacy code... it 
> moved from ext/standard to ext/ereg in 5_3 in the vague hope that it 
> might be possible to move it out to PECL some day. But whoever did it 
> obviously missed a bit.
> 
> Again, though... you're seeing errors I don't see.

ok, thats good.

So just to confirm (to avoid goose chasing <g>) you are saying you tried 
the minimal build options:

   --disable-all
   --enable-cli
   --enable-cgi
   --enable-object-out-dir=.
   --disable-ipv6.

and the current PHP 5.3 CVS built correctly, without errors?

I did trace it down the other day and the compiling errors make sense:

With the above options, the corresponding global

     PHP_EREG is "no"

So the ext\ereg\config.w32 logic is not applied and the new (moved) 
ext/ereg/regex folder is never set.   Since it was always off the root 
folder, it was always found.  But no mas.

Hence

    REGEX
    HSREGEX

are never defined nor set to zero.

However, they are hard coded in:

    main\config.w32.h

#define REGEX 1
#define HSREGEX 1

and there is no way possible to ever set these to zero.

Hence browscap.h will get a compiler error because it is attempting 
include the regex.h here with no /I include path never set.

So I noticed the movement of the regex\ folder to ext\ereg\regex folder 
and the first thing I did was add /I ext\ereg\regex as part of the 
makefile BASE_INCLUDE:

BASE_INCLUDES=/I . /I main /I Zend /I TSRM /I ext /I ext\ereg\regex.

I don't know yet if this is correct, but I'm just checking to see what 
happens next.

Now browscap.c finds it but you have unresolved links to the php_reg* 
stuff like so:

    ereg.obj : error LNK2019: unresolved external
               symbol php_regcomp referenced in function _php_regcomp
    browscap.obj : error LNK2001: unresolved external symbol php_regcomp

Of course, they the extension was never compiled. Its a minimal build.

So I figured, "Ok, why is browscap needed anyway?  And what is the 
alternative to when REGEX is set to 0?

So lets try that, after all, its hardcoded and maybe it should be turned 
off.  So I explored changing ext\ereg\config.w32 to do:

if (PHP_EREG != "no") {
    ...
} else {
    ADD_SOURCES("ext/ereg/regex", "regcomp.c regexec.c
              regerror.c regfree.c", "ereg");
    AC_DEFINE('REGEX', 0, 'System Bundled regex');
    ADD_FLAG("STATIC_EXT_OBJS", "$(EREG_GLOBAL_OBJS)");
}

to see what happens when REGEX is set to ZERO in

    main\config.w32.h

I was just winging it, but I forget now, browscap.c was simply never 
designed to be compiled without REGEX and I didn't enough about to begin 
breaking things.

So I stopped and looked at the options.  I found the following 
differences in the old 5.2 and 5.3 configure.js help

File: D:\phpdev\php52\configure-help.txt

     --enable-mbregex               multibyte regex support
     --disable-mbregex-backtrack    check multibyte regex backtrack
     --without-pcre-regex           Perl Compatible Regular Expressions

File: D:\phpdev\php53\configure-help.txt

     --enable-mbregex              multibyte regex support
     --disable-mbregex-backtrack   check multibyte regex backtrack
     --without-ereg                POSIX extended regular expressions


and went with:

     --with-ereg

and it worked.

So I can't see how it worked for in 5.3 with this off. Browscap.c will 
died. :-)

I'll be happy to patch it but I honestly don't know enough about its 
design or purpose.   I did know about some Browscap.ini file and I 
figured it is related to that.  Buts that's about it.

The real question I had when I was going thru all this is why isn't 
configure.js turning off defines if something isn't set.


-- 
Hector Santos

---

## #37749 — Pierre Joye — 2008-05-20T15:51:06+00:00

URL: https://externals.io/message/37744#37749 · In reply to: #37748

hi Hector,


> Steph Fox wrote:
> > […]
>
> > […]
>
> ok, thats good.
>
> So just to confirm (to avoid goose chasing <g>) you are saying you tried the
> minimal build options:
>
>  --disable-all
>  --enable-cli
>  --enable-cgi
>  --enable-object-out-dir=.
>  --disable-ipv6.
>
> and the current PHP 5.3 CVS built correctly, without errors?

No. As Liz and I said earlier, there is a problem in the browscap.c
code. The ereg usage has to be replaced by pcre (browser_name_pattern,
browser_name_regex management).

Cheers,
-- 
Pierre
http://blog.thepimp.net | http://www.libgd.org

---

## #37750 — Steph Fox — 2008-05-20T15:52:26+00:00

URL: https://externals.io/message/37744#37750 · In reply to: #37748

> So just to confirm (to avoid goose chasing <g>) you are saying you tried 
> the minimal build options:

No, I'm saying I don't read closely enough :)

To me, 'minimal build options' means an empty configure line, 
not --disable-all. I've never used --disable-all.

- Steph
