flush
[m6w6/ext-psi] / m4 / psi.m4
index 4f098514e9a06f88dc27dee7bba4c54c834884fd..4729740cdfbaf3bd2cbb4fc93804568d8ea1a68d 100644 (file)
--- a/m4/psi.m4
+++ b/m4/psi.m4
@@ -1,10 +1,72 @@
-PSI_TYPES=
-PSI_STRUCTS=
-PSI_CONSTS=
-PSI_REDIRS=
-PSI_MACROS=
-PSI_DECLS=
-PSI_VA_DECLS=
+PSI_STDINC=$PHP_PSI_SRCDIR/php_psi_stdinc.h
+PSI_TYPES=$PHP_PSI_SRCDIR/php_psi_types.h
+PSI_STRUCTS=$PHP_PSI_SRCDIR/php_psi_structs.h
+PSI_CONSTS=$PHP_PSI_SRCDIR/php_psi_consts.h
+PSI_REDIRS=$PHP_PSI_SRCDIR/php_psi_redirs.h
+PSI_MACROS=$PHP_PSI_SRCDIR/php_psi_macros.h
+PSI_DECLS=$PHP_PSI_SRCDIR/php_psi_decls.h
+PSI_VA_DECLS=$PHP_PSI_SRCDIR/php_psi_va_decls.h
+
+AC_DEFUN(PSI_CONFIG_INIT, [
+       cat >$PSI_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
+static struct psi_predef_struct {
+       token_t type_tag;
+       const char *type_name;
+       const char *var_name;
+       size_t offset;
+       size_t size;
+       size_t pointer_level;
+       size_t array_size;
+} psi_predef_structs@<:@@:>@ = {
+EOF
+       cat >$PSI_CONSTS <<EOF
+static struct psi_predef_const {
+       token_t type_tag;
+       const char *type_name;
+       const char *var_name;
+       const char *val_text;
+       token_t val_type_tag;
+} psi_predef_consts@<:@@:>@ = {
+EOF
+       cat >$PSI_REDIRS <<EOF
+static struct psi_func_redir {
+       const char *name;
+       void (*func)(void);
+} psi_func_redirs@<:@@:>@ = {
+EOF
+       cat >$PSI_MACROS </dev/null
+       cat >$PSI_DECLS <<EOF
+static struct psi_predef_decl {
+       token_t type_tag;
+       const char *type_name;
+       const char *var_name;
+       size_t pointer_level;
+       size_t array_size;
+} psi_predef_decls@<:@@:>@ = {
+EOF
+       cat >$PSI_VA_DECLS <<EOF
+static struct psi_predef_decl psi_predef_vararg_decls@<:@@:>@ = {
+EOF
+])
+
+AC_DEFUN(PSI_CONFIG_DONE, [
+       cat >$PSI_STDINC <<EOF
+PSI_INCLUDES
+EOF
+       for i in $PSI_TYPES $PSI_STRUCTS $PSI_CONSTS $PSI_REDIRS $PSI_DECLS $PSI_VA_DECLS; do
+               cat >>$i <<EOF
+       {0}
+};
+EOF
+       done
+])
 
 psi_includes() {
        local have_
@@ -17,7 +79,67 @@ EOF
 }
 
 AC_DEFUN(PSI_INCLUDES, [AC_INCLUDES_DEFAULT()
-`psi_includes`])
+#ifdef HAVE_ERRNO_H
+# include <errno.h>
+#endif
+#ifdef HAVE_GLOB_H
+# include <glob.h>
+#endif
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+#ifdef HAVE_XLOCALE_H
+# include <xlocale.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_TCP_H
+# include <netinet/tcp.h>
+#endif
+#ifdef HAVE_ARPA_NAMESER_H
+# include <arpa/nameser.h>
+#endif
+#ifdef HAVE_NETDB_H
+# include <netdb.h>
+#endif
+#ifdef HAVE_POLL_H
+# include <poll.h>
+#endif
+#ifdef HAVE_RESOLV_H
+# include <resolv.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TIMES_H
+# include <sys/times.h>
+#endif
+#ifdef HAVE_SYS_UIO_H
+# include <sys/uio.h>
+#endif
+#ifdef HAVE_SYS_UTSNAME_H
+# include <sys/utsname.h>
+#endif
+#ifdef HAVE_TIME_H
+# include <time.h>
+#endif
+#ifdef HAVE_SYSLOG_H
+# include <syslog.h>
+#endif
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+#ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+#endif
+])
 
 AC_DEFUN(PSI_LEMON, [
        AC_ARG_VAR(LEMON, The lemon parser generator of the SQLite project)
@@ -130,6 +252,10 @@ AC_DEFUN(PSI_CHECK_LIBFFI, [
                ], [
                ], -L$psi_cv_libffi_dir/$PHP_LIBDIR)
        ], -L$psi_cv_libffi_dir/$PHP_LIBDIR)
+       PHP_CHECK_LIBRARY(ffi, ffi_prep_cif_var, [
+               AC_DEFINE(PSI_HAVE_FFI_PREP_CIF_VAR, 1, [ ])
+       ], [
+       ], -L$psi_cv_libffi_dir/$PHP_LIBDIR)
 ])
 
 dnl PSI_COMPUTE_STR(variable, string or expression)