Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Alex Waugh
In message <[EMAIL PROTECTED]>
  Sascha Schumann <[EMAIL PROTECTED]> wrote:

> On Thu, 2 Jan 2003, Alex Waugh wrote:
> 
> > In message <[EMAIL PROTECTED]>
> >   Sascha Schumann <[EMAIL PROTECTED]> wrote:
> >
> > > > You can; I cross compile it regularly.
> > >
> > > What is your target/host platform then?
> >
> > Building on Linux, targetting RISC OS.
> 
> Are our defaults directly applicable to RISC OS?  Or how do
> you manage that configure produces an appropiate
> php_config.h for that target?

The vast majority of tests don't require running a test program,
therefore they work equally well whether cross compiling or not. On the
few that do, the default is usually fine. For those that it gets wrong
the easiest way to change them is to put the correct values in
config.cache before running configure. eg. currently I'm doing the
following:

cat > config.cache << EOF
ac_cv_path_PROG_SENDMAIL=\${ac_cv_path_PROG_SENDMAIL=\}
lt_cv_prog_cc_can_build_shared=\${lt_cv_prog_cc_can_build_shared=no}
lt_cv_prog_cc_pic_works=\${lt_cv_prog_cc_pic_works=no}
EOF

./configure --host=arm-riscos-aof --with-config-file-path=/Choices:

Alex

-- 
Alex Waugh  [EMAIL PROTECTED]

RISC OS software from http://www.alexwaugh.com/

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Sascha Schumann
On Thu, 2 Jan 2003, Alex Waugh wrote:

> In message <[EMAIL PROTECTED]>
>   Sascha Schumann <[EMAIL PROTECTED]> wrote:
>
> > > You can; I cross compile it regularly.
> >
> > What is your target/host platform then?
>
> Building on Linux, targetting RISC OS.

Are our defaults directly applicable to RISC OS?  Or how do
you manage that configure produces an appropiate
php_config.h for that target?

- Sascha

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Alex Waugh
In message <[EMAIL PROTECTED]>
  Sascha Schumann <[EMAIL PROTECTED]> wrote:

> > You can; I cross compile it regularly.
> 
> What is your target/host platform then?

Building on Linux, targetting RISC OS.

Alex

-- 
Alex Waugh  [EMAIL PROTECTED]

RISC OS software from http://www.alexwaugh.com/

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Alex Waugh
In message <[EMAIL PROTECTED]>
  Wez Furlong <[EMAIL PROTECTED]> wrote:

> But how can you reliably detect a system with a broken libc when
> cross-compiling?
> 
> I leave this for someone else to decide, although a more-or-less
> reasonable default is to for "have_broken_glibc_fopen_append=no" and
> hope that no-one files a problem report :)

How about the following (completely untested, so I bet the brackets
don't match up :-) Not perfect, but better than a blind guess. Caching
the value also makes it easier to manually override if it gets it wrong.

Alex

AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND],[
  AC_MSG_CHECKING([for broken libc stdio])
  AC_CACHE_VAL(have_broken_glibc_fopen_append,[
  AC_TRY_RUN([
#include 
int main(int argc, char *argv[])
{
  FILE *fp;
  long position;
  char *filename = "/tmp/phpglibccheck";
  
  fp = fopen(filename, "w");
  if (fp == NULL) {
  perror("fopen");
  exit(2);
  }
  fputs("foobar", fp);
  fclose(fp);

  fp = fopen(filename, "a+");
  position = ftell(fp);
  fclose(fp);
  unlink(filename);
  if (position == 0)
return 1;
  return 0;
}
],
[have_broken_glibc_fopen_append=no],
[have_broken_glibc_fopen_append=yes ],
AC_TRY_COMPILE([
#include 
],[
#if __GLIBC_PREREQ(2,2)
int main(void)
{
  return 0;
}
#else
choke me
#endif
],
[have_broken_glibc_fopen_append=yes ],
[have_broken_glibc_fopen_append=no ]
)
)])

  if test "$have_broken_glibc_fopen_append" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on 
fopen with mode a+])
  else
AC_MSG_RESULT(no)
  fi
])


-- 
Alex Waugh  [EMAIL PROTECTED]

RISC OS software from http://www.alexwaugh.com/

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Sascha Schumann
> You can; I cross compile it regularly.

What is your target/host platform then?

- Sascha

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Alex Waugh
In message <[EMAIL PROTECTED]>
  Sascha Schumann <[EMAIL PROTECTED]> wrote:

> On Thu, 2 Jan 2003, Wez Furlong wrote:
> 
> > But how can you reliably detect a system with a broken libc when
> > cross-compiling?
> 
> I don't think that you can successfully cross-compile PHP
> anyway, so the point is moot anyway.

You can; I cross compile it regularly.

Alex

-- 
Alex Waugh  [EMAIL PROTECTED]

RISC OS software from http://www.alexwaugh.com/

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Sascha Schumann
On Thu, 2 Jan 2003, Wez Furlong wrote:

> But how can you reliably detect a system with a broken libc when
> cross-compiling?

I don't think that you can successfully cross-compile PHP
anyway, so the point is moot anyway.

- Sascha

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Wez Furlong
But how can you reliably detect a system with a broken libc when
cross-compiling?

I leave this for someone else to decide, although a more-or-less
reasonable default is to for "have_broken_glibc_fopen_append=no" and
hope that no-one files a problem report :)

--Wez

On Thu, 2 Jan 2003, Derick Rethans wrote:

> On Thu, 2 Jan 2003, Wez Furlong wrote:
>
> > Defaulting to assuming that the target has a broken libc can cause race
> > conditions (as the append operation is no-longer atomic).
> >
> > Default to assuming a working libc will cause "a+" operations to fail
> > when the target actually has a broken libc.
>
> "broken glibc" << doesn't that imply that this define only need to be
> disabled for known broken systems and thus we can make the default not
> to define this thing.


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Derick Rethans
On Thu, 2 Jan 2003, Wez Furlong wrote:

> Defaulting to assuming that the target has a broken libc can cause race
> conditions (as the append operation is no-longer atomic).
> 
> Default to assuming a working libc will cause "a+" operations to fail
> when the target actually has a broken libc.

"broken glibc" << doesn't that imply that this define only need to be 
disabled for known broken systems and thus we can make the default not 
to define this thing.

Derick

-- 

-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Wez Furlong
Sure, but would should the default option be?

Defaulting to assuming that the target has a broken libc can cause race
conditions (as the append operation is no-longer atomic).

Default to assuming a working libc will cause "a+" operations to fail
when the target actually has a broken libc.

I don't want to start adding all kinds of weird target checks; I leave
that to other people more familiar with this stuff.

--Wez.

On Thu, 2 Jan 2003, Alex Waugh wrote:

> In message 
>   "Wez Furlong" <[EMAIL PROTECTED]> wrote:
>
> > wez Wed Jan  1 04:58:17 2003 EDT
> >
> >   Modified files:
> > /php4   acinclude.m4 configure.in
> > /php4/main  streams.c
> >   Log:
> >   Workaround for glibc 2.2.9x and later "a+" bug that does not seek to EOF for
> >   files fopen()ed with that mode.
>
> This breaks the build when cross compiling. Please could you add a
> default option to AC_TRY_RUN


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 / acinclude.m4 configure.in /main streams.c

2003-01-02 Thread Alex Waugh
In message 
  "Wez Furlong" <[EMAIL PROTECTED]> wrote:

> wez   Wed Jan  1 04:58:17 2003 EDT
> 
>   Modified files:  
> /php4 acinclude.m4 configure.in 
> /php4/mainstreams.c 
>   Log:
>   Workaround for glibc 2.2.9x and later "a+" bug that does not seek to EOF for
>   files fopen()ed with that mode.

This breaks the build when cross compiling. Please could you add a
default option to AC_TRY_RUN

Cheers

Alex

-- 
Alex Waugh  [EMAIL PROTECTED]

RISC OS software from http://www.alexwaugh.com/

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php