improve/fix build
authorMichael Wallner <mike@php.net>
Tue, 23 Aug 2016 14:35:17 +0000 (16:35 +0200)
committerMichael Wallner <mike@php.net>
Tue, 23 Aug 2016 14:35:17 +0000 (16:35 +0200)
m4/psi.m4
m4/psi_const.m4
m4/psi_decl.m4
src/context.c

index 9f770c903b9854a61dc0af61016332d8a7832355..41acc565fbdaf7ac31b22eb86ecc851efe96b53e 100644 (file)
--- a/m4/psi.m4
+++ b/m4/psi.m4
@@ -15,8 +15,13 @@ 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, [
 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, [
-       cat >$PSI_STDTYPES <<EOF
+       for i in $PSI_STDTYPES $PSI_TYPES $PSI_STRUCTS $PSI_UNIONS $PSI_CONSTS $PSI_REDIRS $PSI_MACROS $PSI_DECLS $PSI_VA_DECLS; do
+               cat >$i <<EOF
 /* generated by configure */
 /* generated by configure */
+#include "php_psi_stdinc.h"
+EOF
+       done
+       cat >>$PSI_STDTYPES <<EOF
 static struct psi_std_type {
        token_t type_tag;
        const char *type_name;
 static struct psi_std_type {
        token_t type_tag;
        const char *type_name;
@@ -31,16 +36,14 @@ static struct psi_std_type {
        {PSI_T_UINT32, "uint32_t", NULL},
        {PSI_T_UINT64, "uint64_t", NULL},
 EOF
        {PSI_T_UINT32, "uint32_t", NULL},
        {PSI_T_UINT64, "uint64_t", NULL},
 EOF
-       cat >$PSI_TYPES <<EOF
-/* generated by configure */
+       cat >>$PSI_TYPES <<EOF
 static struct psi_predef_type {
        token_t type_tag;
        const char *type_name;
        const char *alias;
 } psi_predef_types@<:@@:>@ = {
 EOF
 static struct psi_predef_type {
        token_t type_tag;
        const char *type_name;
        const char *alias;
 } psi_predef_types@<:@@:>@ = {
 EOF
-       cat >$PSI_STRUCTS <<EOF
-/* generated by configure */
+       cat >>$PSI_STRUCTS <<EOF
 static struct psi_predef_struct {
        token_t type_tag;
        const char *type_name;
 static struct psi_predef_struct {
        token_t type_tag;
        const char *type_name;
@@ -51,8 +54,7 @@ static struct psi_predef_struct {
        size_t array_size;
 } psi_predef_structs@<:@@:>@ = {
 EOF
        size_t array_size;
 } psi_predef_structs@<:@@:>@ = {
 EOF
-       cat >$PSI_UNIONS <<EOF
-/* generated by configure */
+       cat >>$PSI_UNIONS <<EOF
 static struct psi_predef_union {
        token_t type_tag;
        const char *type_name;
 static struct psi_predef_union {
        token_t type_tag;
        const char *type_name;
@@ -63,8 +65,7 @@ static struct psi_predef_union {
        size_t array_size;
 } psi_predef_unions@<:@@:>@ = {
 EOF
        size_t array_size;
 } psi_predef_unions@<:@@:>@ = {
 EOF
-       cat >$PSI_CONSTS <<EOF
-/* generated by configure */
+       cat >>$PSI_CONSTS <<EOF
 static struct psi_predef_const {
        token_t type_tag;
        const char *type_name;
 static struct psi_predef_const {
        token_t type_tag;
        const char *type_name;
@@ -73,17 +74,16 @@ static struct psi_predef_const {
        token_t val_type_tag;
 } psi_predef_consts@<:@@:>@ = {
 EOF
        token_t val_type_tag;
 } psi_predef_consts@<:@@:>@ = {
 EOF
-       cat >$PSI_REDIRS <<EOF
-/* generated by configure */
+       cat >>$PSI_REDIRS <<EOF
 typedef void (*psi_func_ptr)();
 static struct psi_func_redir {
        const char *name;
        psi_func_ptr func;
 } psi_func_redirs@<:@@:>@ = {
 EOF
 typedef void (*psi_func_ptr)();
 static struct psi_func_redir {
        const char *name;
        psi_func_ptr func;
 } psi_func_redirs@<:@@:>@ = {
 EOF
-       cat >$PSI_MACROS </dev/null
-       cat >$PSI_DECLS <<EOF
-/* generated by configure */
+       cat >>$PSI_MACROS <<EOF
+EOF
+       cat >>$PSI_DECLS <<EOF
 static struct psi_predef_decl {
        token_t type_tag;
        const char *type_name;
 static struct psi_predef_decl {
        token_t type_tag;
        const char *type_name;
@@ -92,8 +92,7 @@ static struct psi_predef_decl {
        size_t array_size;
 } psi_predef_decls@<:@@:>@ = {
 EOF
        size_t array_size;
 } psi_predef_decls@<:@@:>@ = {
 EOF
-       cat >$PSI_VA_DECLS <<EOF
-/* generated by configure */
+       cat >>$PSI_VA_DECLS <<EOF
 static struct psi_predef_decl psi_predef_vararg_decls@<:@@:>@ = {
 EOF
 ])
 static struct psi_predef_decl psi_predef_vararg_decls@<:@@:>@ = {
 EOF
 ])
@@ -103,7 +102,16 @@ dnl Finish the headers with the pre-defined types etc.
 AC_DEFUN(PSI_CONFIG_DONE, [
        cat >$PSI_STDINC <<EOF
 /* generated by configure */
 AC_DEFUN(PSI_CONFIG_DONE, [
        cat >$PSI_STDINC <<EOF
 /* generated by configure */
+#ifndef _PSI_STDINC
+#define _PSI_STDINC
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE
+#endif
 PSI_INCLUDES
 PSI_INCLUDES
+#endif
 EOF
        for i in $PSI_STDTYPES $PSI_TYPES $PSI_STRUCTS $PSI_UNIONS $PSI_CONSTS $PSI_REDIRS $PSI_DECLS $PSI_VA_DECLS; do
                cat >>$i <<EOF
 EOF
        for i in $PSI_STDTYPES $PSI_TYPES $PSI_STRUCTS $PSI_UNIONS $PSI_CONSTS $PSI_REDIRS $PSI_DECLS $PSI_VA_DECLS; do
                cat >>$i <<EOF
index 900b536e6d437b8362292c07a6263459364883c7..6c3cf6b28be665eaf28828e22461700a590d8fc0 100644 (file)
@@ -3,8 +3,8 @@
 psi_add_str_const() {
        grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS \
                || cat >>$PSI_CONSTS <<EOF
 psi_add_str_const() {
        grep -q "\"psi\\\\\\\\$1\"" $PSI_CONSTS \
                || cat >>$PSI_CONSTS <<EOF
-       {PSI_T_STRING, "string", "psi\\$1", $2, PSI_T_QUOTED_STRING},
-EOF 
+       {PSI_T_STRING, "string", "psi\\\\$1", $2, PSI_T_QUOTED_STRING},
+EOF
 }
 
 # psi_add_int_const(name, value)
 }
 
 # psi_add_int_const(name, value)
index 6a0ef809916b256dd99e8f7e8cfeedd93c7d2014..e142f708dbf911c2ce714416ee8116bbdef81cd6 100644 (file)
@@ -97,8 +97,9 @@ AC_DEFUN(PSI_DECL, [
                        ])
                ])
                ;;
                        ])
                ])
                ;;
-       "*")
-               PSI_REDIR($psi_symbol, $psi_symbol_redirect)
+       *)
+               PSI_REDIR($psi_symbol)
+               psi_add_decl "$psi_decl_args" $3
                ;;
        esac
 ])
                ;;
        esac
 ])
index c86a595d8c79be86b07db026024c476080d3adcf..5585dfef4cca8bf6aee358ff5909963e5600c7c1 100644 (file)
@@ -2,6 +2,8 @@
 # include "config.h"
 #endif
 
 # include "config.h"
 #endif
 
+#include "php_psi_stdinc.h"
+
 #include "php.h"
 
 #ifdef HAVE_DIRENT_H
 #include "php.h"
 
 #ifdef HAVE_DIRENT_H