raising the head after a three-weeks refactoring
[m6w6/ext-psi] / m4 / psi / psi.m4
index ff112d77e963f546b8ce9402c8c706960ebcfc21..96c648e480918283681a11a95fd4103153023d00 100644 (file)
@@ -106,8 +106,22 @@ dnl Finish the headers with the pre-defined types etc.
 AC_DEFUN(PSI_CONFIG_DONE, [
        cat >$PSI_STDINC <<EOF
 /* generated by configure */
-#ifndef _PSI_STDINC
-# define _PSI_STDINC
+#ifndef PSI_STDINC_H
+#define PSI_STDINC_H
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#else
+# include "php_config.h"
+#endif
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+#ifndef _REENTRANT
+# define _REENTRANT
+#endif
+
 PSI_INCLUDES
 #endif
 EOF
@@ -185,6 +199,21 @@ AC_DEFUN(PSI_INCLUDES, [#define PSI_INCLUDES
 # define _REENTRANT
 #endif
 AC_INCLUDES_DEFAULT()
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
+# ifndef HAVE__BOOL
+#  ifdef __cplusplus
+typedef bool _Bool;
+#  else
+#   define _Bool signed char
+#  endif
+# endif
+# define bool _Bool
+# define false 0
+# define true 1
+# define __bool_true_false_are_defined 1
+#endif
 #ifdef HAVE_ERRNO_H
 # include <errno.h>
 #endif
@@ -407,6 +436,7 @@ AC_DEFUN(PSI_CHECK_LIBFFI, [
                PHP_EVAL_INCLINE(`$PKG_CONFIG --cflags libffi`)
                PHP_EVAL_LIBLINE(`$PKG_CONFIG --libs libffi`, PSI_SHARED_LIBADD)
                AC_DEFINE(HAVE_LIBFFI, 1, Have libffi)
+               AC_DEFINE_UNQUOTED([PHP_PSI_LIBFFI_VERSION], ["`$PKG_CONFIG --modversion libffi`"], [libffi version])
        else
                AC_CACHE_CHECK(for libffi, psi_cv_libffi_dir, [
                for psi_cv_libffi_dir in $PHP_PSI_LIBFFI {/usr{,/local},/opt}{,/libffi}