better dependency management
[m6w6/ext-psi] / config.m4
index cece1cb375ff8a2cf7fd37e34f6501680c2af192..fa209641b1acb375ce910bdaac7153cc13df8541 100644 (file)
--- a/config.m4
+++ b/config.m4
@@ -58,6 +58,22 @@ if test "$PHP_PSI" != no; then
        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
+
+       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], [], [ ])
+       ], [
+               AC_MSG_RESULT([already defined])
+       ])
+
        psi_save_LIBS=$LIBS
        LIBS=
 
@@ -67,6 +83,7 @@ if test "$PHP_PSI" != no; then
 
        AC_PATH_PROG(NM, nm)
        AC_FUNC_FNMATCH
+       AC_FUNC_MMAP
 
        PSI_CONFIG_INIT
        PSI_CHECK_STD_TYPES
@@ -116,6 +133,7 @@ if test "$PHP_PSI" != no; then
        AC_DEFINE_UNQUOTED([PSI_DECLS], ["$PSI_DECLS"], [Predefined functions])
        AC_DEFINE_UNQUOTED([PSI_VA_DECLS], ["$PSI_VA_DECLS"], [Predefined vararg functions])
 
+       PHP_ADD_INCLUDE($PHP_PSI_SRCDIR)
        PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src)
        PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/types)
        PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src)