X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=config.m4;h=d621ffc5766e10a6a9163ec1978f5067aa074cfd;hp=c05ed058835ba7c4f057c01c50c4267b8a25ee89;hb=c0873cbbe9e5a83305adbc2bbd94aede5437f33d;hpb=5d54598329a4d04dd0080bc1252d1de85a7befef diff --git a/config.m4 b/config.m4 index c05ed05..d621ffc 100644 --- a/config.m4 +++ b/config.m4 @@ -1,52 +1,105 @@ +PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi) + +case "PHP_EXT_BUILDDIR(psi)" in +""|.) PHP_PSI_BUILDDIR=$PHP_PSI_SRCDIR + ;; +*) PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi) + ;; +esac + +m4_foreach(incfile, [ + [ax/ax_check_sign.m4], + [ax/ax_pthread.m4], + [psi/psi.m4], + [psi/psi_const.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_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], [ ], [ ]) - sinclude(config.ax_check_sign.m4) - sinclude(config.psi.m4) - sinclude(config.psi_errno.m4) - sinclude(config.psi_glob.m4) - sinclude(config.psi_stddef.m4) - sinclude(config.psi_stdint.m4) - sinclude(config.psi_sys_types.m4) - sinclude(config.psi_type.m4) + AC_HEADER_ASSERT dnl # adds --disable-assert to define NDEBUG - PSI_LEMON + 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 + AC_MSG_CHECKING([for _GNU_SOURCE]) + AC_EGREP_CPP([gnu_source_not_defined], [ + #ifndef _GNU_SOURCE + gnu_source_not_defined + #endif + ], [ + AC_MSG_RESULT([needs define]) + AC_DEFINE([_GNU_SOURCE], [1], [ ]) + ], [ + AC_MSG_RESULT([already defined]) + ]) + + AC_MSG_CHECKING([psi source dir]) + AC_MSG_RESULT([$PHP_PSI_SRCDIR]) + AC_MSG_CHECKING([psi build dir]) + AC_MSG_RESULT([$PHP_PSI_BUILDDIR]) + PSI_CHECK_LIBJIT PSI_CHECK_LIBFFI AC_FUNC_FNMATCH - AC_HEADER_DIRENT + AC_FUNC_MMAP + PSI_CONFIG_INIT PSI_CHECK_STD_TYPES - PSI_CHECK_STDINT - PSI_CHECK_STDDEF - PSI_CHECK_SYS_TYPES - PSI_CHECK_ERRNO - PSI_CHECK_GLOB - - echo PSI_TYPES=$PSI_TYPES - echo PSI_MACROS=$PSI_MACROS - echo PSI_REDIR=$PSI_REDIR - echo PSI_DECLS=$PSI_DECLS + PSI_CONFIG_DONE PHP_SUBST(PSI_SHARED_LIBADD) + AC_DEFINE_UNQUOTED(PHP_PSI_SHLIB_SUFFIX, ["$SHLIB_SUFFIX_NAME"], DL suffix) + + PHP_ADD_INCLUDE($PHP_PSI_SRCDIR) PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src) + PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/calc) + PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/types) + PHP_ADD_INCLUDE($PHP_PSI_BUILDDIR) PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src) + PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src/types) - 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" + PHP_PSI_HEADERS=" \ + src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \ + src/calc/unary.h src/calc/cmp.h src/calc/oper.h \ + `(cd $PHP_PSI_SRCDIR/src && ls *.h types/*.h)` \ + " + # parser* should come first + PHP_PSI_SOURCES=" \ + src/parser_proc.c src/parser.c \ + `(cd $PHP_PSI_SRCDIR && ls src/*.c src/types/*.c \ + | $EGREP -v '^src/parser' \ + )` \ + " + PHP_PSI_GENERATED=" \ + src/parser_proc.c src/parser.c \ + src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \ + src/calc/unary.h src/calc/cmp.h src/calc/oper.h \ + " PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared) PHP_INSTALL_HEADERS(ext/psi, php_psi.h $PHP_PSI_HEADERS) + PHP_SUBST(PHP_PSI_GENERATED) PHP_SUBST(PHP_PSI_HEADERS) PHP_SUBST(PHP_PSI_SOURCES) @@ -54,6 +107,5 @@ if test "$PHP_PSI" != no; then PHP_SUBST(PHP_PSI_BUILDDIR) PHP_ADD_MAKEFILE_FRAGMENT - AC_MSG_RESULT() fi