X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=config.m4;h=75ea3f73052a5f4b9f32695e04179762693530d2;hp=807670c4c4f955de2c8cbe9f307a25215e24a773;hb=f9a22bf3b60ca02611f7040cd5dcde433849a09b;hpb=7eb47ef2fc5655e7196e4e0fbf5104eed8274601 diff --git a/config.m4 b/config.m4 index 807670c..75ea3f7 100644 --- a/config.m4 +++ b/config.m4 @@ -1,101 +1,64 @@ -PHP_ARG_ENABLE(psi, whether to enable psi support, -[ --enable-psi Enable PHP System Interface support]) -PHP_ARG_WITH(psi-libjit, where to find libjit, -[ --with-psi-libjit=DIR PSI: path to libjit]) -PHP_ARG_WITH(psi-libffi, where to find libjit, -[ --with-psi-libffi=DIR PSI: path to libffi]) +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) +]) -if test "$PHP_PSI" != "no"; then - AC_ARG_VAR(LEMON, The lemon parser generator of the SQLite project) - AC_PATH_PROG(LEMON, lemon, ./lemon) - PHP_SUBST(LEMON) +PHP_ARG_ENABLE(psi, whether to enable PHP System Interface support, +[ --enable-psi Enable PSI (PHP System Interface) support]) - if test -z "$PKG_CONFIG" - then - AC_PATH_PROG(PKG_CONFIG, pkg-config, false) - fi +if test "$PHP_PSI" != no; then - export PKG_CONFIG_PATH="$PHP_PSI_LIBFFI/lib/pkgconfig:$PHP_PSI_LIBJIT/lib/pkgconfig:$PKG_CONFIG_PATH" + 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]) - AC_CACHE_CHECK(for libffi through pkg-config, PSI_cv_LIBFFI, [ - if $PKG_CONFIG --exists libffi - then - PSI_cv_LIBFFI=true - else - PSI_cv_LIBFFI=false - fi]) - if $PSI_cv_LIBFFI - then - PHP_EVAL_INCLINE(`$PKG_CONFIG --cflags libffi`) - PHP_EVAL_LIBLINE(`$PKG_CONFIG --libs libffi`, PSI_SHARED_LIBADD) - else - AC_CACHE_CHECK(for libffi, PSI_cv_LIBFFI_DIR, [ - for PSI_cv_LIBFFI_DIR in $PHP_PSI_LIBFFI {/usr{,/local},/opt}{,/libffi} - do - if test -e $PSI_cv_LIBFFI_DIR/include/ffi/ffi.h - then - break - fi - PSI_cv_LIBFFI_DIR= - done]) - if test -n "$PSI_cv_LIBFFI_DIR" - then - PHP_CHECK_LIBRARY(ffi, ffi_closure_alloc, [ - AC_DEFINE(PSI_HAVE_FFI_CLOSURE_ALLOC, 1, [ ]) - ], [ - ], -L$PSI_cv_LIBFFI_DIR/$PHP_LIBDIR) - PHP_CHECK_LIBRARY(ffi, ffi_closure_free, [ - AC_DEFINE(PSI_HAVE_FFI_CLOSURE_FREE, 1, [ ]) - ], [ - ], -L$PSI_cv_LIBFFI_DIR/$PHP_LIBDIR) - PHP_CHECK_LIBRARY(ffi, ffi_prep_closure, [ - AC_DEFINE(PSI_HAVE_FFI_PREP_CLOSURE, 1, [ ]) - ], [ - ], -L$PSI_cv_LIBFFI_DIR/$PHP_LIBDIR) - PHP_ADD_INCLUDE($PSI_cv_LIBFFI_DIR/include/ffi) - PHP_ADD_LIBRARY_WITH_PATH(ffi, $PSI_cv_LIBFFI_DIR/$PHP_LIBDIR, PSI_SHARED_LIBADD) - else - AC_MSG_WARN([Could not find libffi, please provide the base install path]) - fi - fi + PHP_ARG_WITH(psi-libjit, where to find libjit, + [ --with-psi-libjit=DIR PSI: path to libjit], [ ], [ ]) - AC_CACHE_CHECK(for libjit, PSI_cv_LIBJIT_DIR, [ - for PSI_cv_LIBJIT_DIR in $PHP_PSI_LIBJIT {/usr{,/local},/opt}{,/libjit} - do - if test -e $PSI_cv_LIBJIT_DIR/include/jit/jit.h - then - break - fi - PSI_cv_LIBJIT_DIR= - done]) - if test -n "$PSI_cv_LIBJIT_DIR" - then - PHP_ADD_INCLUDE($PSI_cv_LIBJIT_DIR/include) - PHP_ADD_LIBRARY_WITH_PATH(jit, $PSI_cv_LIBJIT_DIR/$PHP_LIBDIR, PSI_SHARED_LIBADD) - else - AC_MSG_WARN([Could not find libjit, please provide the base install path]) - fi + PHP_ARG_WITH(psi-libffi, where to find libffi, + [ --with-psi-libffi=DIR PSI: path to libffi], [ ], [ ]) - PHP_SUBST(PSI_SHARED_LIBADD) + AC_HEADER_ASSERT dnl # adds --disable-assert to define NDEBUG - PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi) - PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi) + PSI_CONFIG_INIT + + PSI_CHECK_MAINTAINER_MODE + PSI_CHECK_THREADED_PARSER - PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src) - PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src) + 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 + + AC_HEADER_DIRENT + AC_FUNC_FNMATCH + AC_FUNC_MMAP + AC_CHECK_FUNCS([mknodat eaccess]) - PHP_PSI_HEADERS=`(cd $PHP_PSI_SRCDIR/src && echo *.h)` - PHP_PSI_SOURCES="src/parser_proc.c src/parser.c src/validator.c src/module.c src/context.c" - PHP_PSI_SOURCES="$PHP_PSI_SOURCES src/libjit.c src/libffi.c" + PSI_CHECK_PTHREAD + PSI_CHECK_LIBJIT + PSI_CHECK_LIBFFI - PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared) - PHP_INSTALL_HEADERS(ext/psi, php_psi.h $PHP_PSI_HEADERS) + PSI_CONFIG_DONE - PHP_SUBST(PHP_PSI_HEADERS) - PHP_SUBST(PHP_PSI_SOURCES) + AC_DEFINE_UNQUOTED(PHP_PSI_SHLIB_SUFFIX, ["$SHLIB_SUFFIX_NAME"], DL suffix) - PHP_SUBST(PHP_PSI_SRCDIR) - PHP_SUBST(PHP_PSI_BUILDDIR) + 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_ADD_MAKEFILE_FRAGMENT + AC_MSG_RESULT() fi