X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=config.m4;h=75ea3f73052a5f4b9f32695e04179762693530d2;hp=8e6c1d121253445a11d50ad0d0fbdbea2392ffda;hb=fb8f7887c289ae74d6e8dd85d55ae09e6796e890;hpb=633acd548ce5da37812bca7119e57c8f56e974e2 diff --git a/config.m4 b/config.m4 index 8e6c1d1..75ea3f7 100644 --- a/config.m4 +++ b/config.m4 @@ -1,71 +1,64 @@ -PHP_ARG_WITH(psi, whether to enable psi support, -[ --with-psi[[=path to libjit]] - Enable PHP System Interface support]) +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) - - if test -z "$PKG_CONFIG" - then - AC_PATH_PROG(PKG_CONFIG, pkg-config, false) - fi - - export PKG_CONFIG_PATH="/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH" +PHP_ARG_ENABLE(psi, whether to enable PHP System Interface support, +[ --enable-psi Enable PSI (PHP System Interface) support]) + +if test "$PHP_PSI" != no; then + + 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]) + + 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 libffi, + [ --with-psi-libffi=DIR PSI: path to libffi], [ ], [ ]) + + AC_HEADER_ASSERT dnl # adds --disable-assert to define NDEBUG + + PSI_CONFIG_INIT - AC_CACHE_CHECK(for libffi, 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_MSG_ERROR([Could not find libjit, please provide the base install path]) - fi + PSI_CHECK_MAINTAINER_MODE + PSI_CHECK_THREADED_PARSER - AC_CACHE_CHECK(for libjit, PSI_cv_LIBJIT_DIR, [ - for PSI_cv_LIBJIT_DIR in $PHP_PSI {/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_ERROR([Could not find libjit, please provide the base install path]) - fi + 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 - PHP_SUBST(PSI_SHARED_LIBADD) + AC_HEADER_DIRENT + AC_FUNC_FNMATCH + AC_FUNC_MMAP + AC_CHECK_FUNCS([mknodat eaccess]) - PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi) - PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi) + 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/validator.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