flush
authorMichael Wallner <mike@php.net>
Tue, 25 Oct 2016 12:45:10 +0000 (14:45 +0200)
committerMichael Wallner <mike@php.net>
Tue, 25 Oct 2016 12:45:10 +0000 (14:45 +0200)
config.m4
m4/psi/psi.m4
psi.d/getopt.psi
tests/getopt/getopt001.phpt

index 2c7af0b58cbe2d0fec1d7534000c0f0da53b6370..98c064876b0a384ace46dbf8b52a704b4b9b4850 100644 (file)
--- a/config.m4
+++ b/config.m4
@@ -48,7 +48,7 @@ PHP_ARG_ENABLE(psi, whether to enable PHP System Interface support,
 
 if test "$PHP_PSI" != no; then
        PHP_CONFIGURE_PART(Configuring PSI)
 
 if test "$PHP_PSI" != no; then
        PHP_CONFIGURE_PART(Configuring PSI)
-
+       
        PHP_ARG_ENABLE(psi-posix, whether to pre-define POSIX decls,
        [  --enable-psi-posix=...  PSI: pre-define POSIX decls], [ ], [ ])
 
        PHP_ARG_ENABLE(psi-posix, whether to pre-define POSIX decls,
        [  --enable-psi-posix=...  PSI: pre-define POSIX decls], [ ], [ ])
 
@@ -60,6 +60,20 @@ if test "$PHP_PSI" != no; then
 
        AC_HEADER_ASSERT dnl # adds --disable-assert to define NDEBUG
        
 
        AC_HEADER_ASSERT dnl # adds --disable-assert to define NDEBUG
        
+       dnl we cannot use AC_USE_SYSTEM_EXTENSIONS here, because we're way too late
+       dnl in the game, and we're currently only targeting _GNU_SOURCE for now
+       AC_MSG_CHECKING([for _GNU_SOURCE])
+       AC_EGREP_CPP([gnu_source_defined], [
+               #ifndef _GNU_SOURCE
+               gnu_source_not_defined
+               #endif
+       ], [
+               AC_MSG_RESULT([needs define])
+               AC_DEFINE([_GNU_SOURCE], [], [ ])
+       ], [
+               AC_MSG_RESULT([already defined])
+       ])
+
        psi_save_LIBS=$LIBS
        LIBS=
 
        psi_save_LIBS=$LIBS
        LIBS=
 
index b0bbbf3056f3908fbfd07427b684192e4b5b1416..ff112d77e963f546b8ce9402c8c706960ebcfc21 100644 (file)
@@ -15,7 +15,7 @@ dnl PSI_CONFIG_INIT()
 dnl Creates stubs of the headers with pre-defined types etc.
 dnl These headers are included by src/context.c.
 dnl This macro must be called prior any checks for a type, struct, decl etc.
 dnl Creates stubs of the headers with pre-defined types etc.
 dnl These headers are included by src/context.c.
 dnl This macro must be called prior any checks for a type, struct, decl etc.
-AC_DEFUN(PSI_CONFIG_INIT, [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])dnl
+AC_DEFUN(PSI_CONFIG_INIT, [
        for i in $PSI_STDTYPES $PSI_TYPES $PSI_STRUCTS $PSI_UNIONS $PSI_CONSTS $PSI_REDIRS $PSI_MACROS $PSI_DECLS $PSI_VA_DECLS $PSI_FN_DECLS; do
                cat >$i <<EOF
 /* generated by configure */
        for i in $PSI_STDTYPES $PSI_TYPES $PSI_STRUCTS $PSI_UNIONS $PSI_CONSTS $PSI_REDIRS $PSI_MACROS $PSI_DECLS $PSI_VA_DECLS $PSI_FN_DECLS; do
                cat >$i <<EOF
 /* generated by configure */
index 5f5bae6fcb67d6ac3224e55b94837d8b6589a502..5e1e427ce50cec30c22d678b954bb9815c4e131b 100644 (file)
@@ -1,5 +1,6 @@
-function psi\opterr() : int {
-       return to_int(opterr);
+function psi\opterr(int $value) : void {
+       let _v = intval($value);
+       return void(opterr_set);
 }
 function psi\optind() : int {
        return to_int(optind);
 }
 function psi\optind() : int {
        return to_int(optind);
index 462b4709bafe4696dc1974737e3792cf1ec27386..2209d09c86d98d441c16ac29054fee3c92809d93 100644 (file)
@@ -19,6 +19,8 @@ $args = [
 
 $opts = "v::x:s:";
 
 
 $opts = "v::x:s:";
 
+psi\opterr(0);
+
 while (($opt = chr(psi\getopt($args, $opts)))) {
        switch ($opt) {
        case "v":
 while (($opt = chr(psi\getopt($args, $opts)))) {
        switch ($opt) {
        case "v":