fix char_width decl
[m6w6/ext-psi] / config.m4
index 1207c0ca943a1b07f01687e838eb514e128dd064..75ea3f73052a5f4b9f32695e04179762693530d2 100644 (file)
--- a/config.m4
+++ b/config.m4
@@ -1,67 +1,64 @@
+m4_foreach(incfile, [
+       [ax/ax_check_compile_flag.m4],
+       [ax/ax_check_sign.m4],
+       [ax/ax_pthread.m4],
+       [psi/psi.m4],
+       [psi/psi_type.m4]], [
+       dnl pecl build
+       sinclude([m4/]incfile)
+       dnl php-src build
+       sinclude([ext/psi/m4/]incfile)
+])
+
 PHP_ARG_ENABLE(psi, whether to enable PHP System Interface support,
-[  --enable-psi            Enable PHP System Interface support])
+[  --enable-psi            Enable PSI (PHP System Interface) support])
 
 if test "$PHP_PSI" != no; then
-       PHP_CONFIGURE_PART(Configuring PSI)
 
-       PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi)
-       PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi)
+       PHP_ARG_ENABLE(psi-maintainer-mode, whether to enable maintainer mode,
+       [  --enable-psi-maintainer-mode
+                          PSI: enable maintainer mode
+                           . make dependencies], [no], [no])
+    PHP_ARG_ENABLE(psi-threaded-parser, whether to enable threaded parser,
+    [  --enable-psi-threaded-parser
+                          PSI: enable threads for startup parsing], [yes], [no])
 
-       sinclude(config.ax_check_sign.m4)
-       sinclude(config.psi.m4)
-       sinclude(config.psi_type.m4)
-       sinclude(config.psi_const.m4)
-       sinclude(config.psi_decl.m4)
-       sinclude(config.psi_macro.m4)
-       sinclude(config.psi_struct.m4)
+       PHP_ARG_WITH(psi-libjit, where to find libjit,
+       [  --with-psi-libjit=DIR   PSI: path to libjit], [ ], [ ])
 
-       sinclude(config.psi_errno.m4)
-       sinclude(config.psi_glob.m4)
-       sinclude(config.psi_stddef.m4)
-       sinclude(config.psi_stdio.m4)
-       sinclude(config.psi_stdint.m4)
-       sinclude(config.psi_sys_types.m4)
+       PHP_ARG_WITH(psi-libffi, where to find libffi,
+       [  --with-psi-libffi=DIR   PSI: path to libffi], [ ], [ ])
 
-       PSI_LEMON
-       PSI_CHECK_LIBJIT
-       PSI_CHECK_LIBFFI
+       AC_HEADER_ASSERT dnl # adds --disable-assert to define NDEBUG
 
-       AC_FUNC_FNMATCH
-       AC_HEADER_DIRENT
+       PSI_CONFIG_INIT
+       
+       PSI_CHECK_MAINTAINER_MODE
+       PSI_CHECK_THREADED_PARSER
 
+       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
+       PSI_CHECK_GNU_SOURCE
+       PSI_CHECK_CPP
        PSI_CHECK_STD_TYPES
-       PSI_CHECK_STDINT
-       PSI_CHECK_STDDEF
-       PSI_CHECK_SYS_TYPES
-       PSI_CHECK_ERRNO
-       PSI_CHECK_GLOB
-       PSI_CHECK_STDIO
-
-       echo PSI_TYPES=$PSI_TYPES
-       echo PSI_MACROS=$PSI_MACROS
-       echo PSI_REDIRS=$PSI_REDIRS
-       echo PSI_DECLS=$PSI_DECLS
-       echo PSI_STRUCTS=$PSI_STRUCTS
+       
+       AC_HEADER_DIRENT
+       AC_FUNC_FNMATCH
+       AC_FUNC_MMAP
+       AC_CHECK_FUNCS([mknodat eaccess])
 
-       PHP_SUBST(PSI_SHARED_LIBADD)
+       PSI_CHECK_PTHREAD
+       PSI_CHECK_LIBJIT
+       PSI_CHECK_LIBFFI
 
-       PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src)
-       PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src)
+       PSI_CONFIG_DONE
 
-       PHP_PSI_HEADERS=`(cd $PHP_PSI_SRCDIR/src && echo *.h)`
-       PHP_PSI_SOURCES="src/parser_proc.c src/parser.c src/module.c src/context.c"
-       PHP_PSI_SOURCES="$PHP_PSI_SOURCES src/libjit.c src/libffi.c"
+       AC_DEFINE_UNQUOTED(PHP_PSI_SHLIB_SUFFIX, ["$SHLIB_SUFFIX_NAME"], DL suffix)
 
+       PHP_SUBST(PSI_SHARED_LIBADD)
        PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared)
        PHP_INSTALL_HEADERS(ext/psi, php_psi.h $PHP_PSI_HEADERS)
 
-       PHP_SUBST(PHP_PSI_HEADERS)
-       PHP_SUBST(PHP_PSI_SOURCES)
-
-       PHP_SUBST(PHP_PSI_SRCDIR)
-       PHP_SUBST(PHP_PSI_BUILDDIR)
-
        PHP_ADD_MAKEFILE_FRAGMENT
-
        AC_MSG_RESULT()
 fi