pe*alloc
[m6w6/ext-psi] / config.m4
1 PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi)
2
3 case "PHP_EXT_BUILDDIR(psi)" in
4 ""|.) PHP_PSI_BUILDDIR=$PHP_PSI_SRCDIR
5 ;;
6 *) PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi)
7 ;;
8 esac
9
10 m4_foreach(incfile, [
11 [ax/ax_check_sign.m4],
12 [ax/ax_pthread.m4],
13 [psi/psi.m4],
14 [psi/psi_const.m4],
15 [psi/psi_type.m4]], [
16 dnl pecl build
17 sinclude([m4/]incfile)
18 dnl php-src build
19 sinclude([ext/psi/m4/]incfile)
20 ])
21
22 PHP_ARG_ENABLE(psi, whether to enable PHP System Interface support,
23 [ --enable-psi Enable PSI (PHP System Interface) support])
24
25 if test "$PHP_PSI" != no; then
26
27 PHP_ARG_ENABLE(psi-maintainer-mode, whether to enable maintainer mode,
28 [ --enable-psi-maintainer-mode
29 PSI: enable maintainer mode
30 . make dependencies], [no], [no])
31
32 PHP_ARG_WITH(psi-libjit, where to find libjit,
33 [ --with-psi-libjit=DIR PSI: path to libjit], [ ], [ ])
34
35 PHP_ARG_WITH(psi-libffi, where to find libffi,
36 [ --with-psi-libffi=DIR PSI: path to libffi], [ ], [ ])
37
38 AC_HEADER_ASSERT dnl # adds --disable-assert to define NDEBUG
39
40 dnl we cannot use AC_USE_SYSTEM_EXTENSIONS here, because we're way too late
41 dnl in the game, and we're currently only targeting _GNU_SOURCE for now
42 AC_MSG_CHECKING([for _GNU_SOURCE])
43 AC_EGREP_CPP([gnu_source_not_defined], [
44 #ifndef _GNU_SOURCE
45 gnu_source_not_defined
46 #endif
47 ], [
48 AC_MSG_RESULT([needs define])
49 AC_DEFINE([_GNU_SOURCE], [1], [ ])
50 ], [
51 AC_MSG_RESULT([already defined])
52 ])
53
54 AC_MSG_CHECKING([psi source dir])
55 AC_MSG_RESULT([$PHP_PSI_SRCDIR])
56 AC_MSG_CHECKING([psi build dir])
57 AC_MSG_RESULT([$PHP_PSI_BUILDDIR])
58
59 PSI_CHECK_LIBJIT
60 PSI_CHECK_LIBFFI
61
62 AC_FUNC_FNMATCH
63 AC_FUNC_MMAP
64
65 PSI_CONFIG_INIT
66 PSI_CHECK_STD_TYPES
67 PSI_CONFIG_DONE
68
69 PHP_SUBST(PSI_SHARED_LIBADD)
70
71 AC_DEFINE_UNQUOTED(PHP_PSI_SHLIB_SUFFIX, ["$SHLIB_SUFFIX_NAME"], DL suffix)
72
73 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR)
74 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src)
75 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/calc)
76 PHP_ADD_INCLUDE($PHP_PSI_SRCDIR/src/types)
77 PHP_ADD_INCLUDE($PHP_PSI_BUILDDIR)
78 PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src)
79 PHP_ADD_BUILD_DIR($PHP_PSI_BUILDDIR/src/types)
80
81 PHP_PSI_HEADERS=" \
82 src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \
83 src/calc/unary.h src/calc/cmp.h src/calc/oper.h \
84 `(cd $PHP_PSI_SRCDIR/src && ls *.h types/*.h)` \
85 "
86 # parser* should come first
87 PHP_PSI_SOURCES=" \
88 src/parser_proc.c src/parser.c \
89 `(cd $PHP_PSI_SRCDIR && ls src/*.c src/types/*.c \
90 | $EGREP -v '^src/parser' \
91 )` \
92 "
93 PHP_PSI_GENERATED=" \
94 src/parser_proc.c src/parser.c \
95 src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \
96 src/calc/unary.h src/calc/cmp.h src/calc/oper.h \
97 "
98
99 PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared)
100 PHP_INSTALL_HEADERS(ext/psi, php_psi.h $PHP_PSI_HEADERS)
101
102 PHP_SUBST(PHP_PSI_GENERATED)
103 PHP_SUBST(PHP_PSI_HEADERS)
104 PHP_SUBST(PHP_PSI_SOURCES)
105
106 PHP_SUBST(PHP_PSI_SRCDIR)
107 PHP_SUBST(PHP_PSI_BUILDDIR)
108
109 PHP_ADD_MAKEFILE_FRAGMENT
110 AC_MSG_RESULT()
111 fi