At 18:56 10/8/2002 +0200, Sascha Schumann wrote:

>    Thus the rule should be: If autoconf finds the definition, we
>     use it, otherwise we rely on our own, namespace-protected
>     version.  Example:
>
>     #ifdef HAVE_STRUCT_SYSMSG
>     typedef struct sysmsg php_sysmsg;
>     #else
>
>     typedef struct {
>         long mtype;
>         char mtext[1];
>     } php_sysmsg;
>
>     #endif

It's not a typedef but the struct itself that's provided, so that doesn't work.
I've made a patch now, that I'm not too keen on, but works.

It boils down to:
AC_TRY_COMPILE(...look for msgbuf,
         [AC_DEFINE(HAVE_STRUCT_SYSV_MSGBUF,1,[struct msgbuf is in 
sys/msg.h])],
         [AC_TRY_COMPILE(...look for mymsg,
                 [AC_DEFINE(HAVE_STRUCT_SYSV_MSGBUF,1,[struct msgbuf is in 
sys/msg.h]),
                  AC_DEFINE(msgbuf,mymsg,[msgbuf is called mymsg])
                 ])
         ])

Then in sysvmsg.c:
#ifdef HAVE_STRUCT_SYSV_MSGBUF
#define php_msgbuf msgbuf
#else
struct php_msgbuf {
         long mtype;
         char mtext[1];
};
#endif

Replace all occurences of msgbuf with php_msgbuf.

As I said - it works, but it's a double pre-processor replace for mymsg. I 
think I could just ignore
mymsg all together, but that would create two identical structs defined. 
Not sure if that's
desirable (read: no idea what that impact and in what way).

Test 001.phpt passes though.

Met vriendelijke groeten / With kind regards,

Webmaster IDG.nl
Melvyn Sopacua

<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to