-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathconfig.m4
134 lines (105 loc) · 4.02 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
dnl config.m4 for extension zephir_parser
dnl Functions -----------------------------------------------------------------
AC_DEFUN([PHP_ZEPHIR_PARSER_ADD_SOURCES], [
PHP_ZEPHIR_PARSER_SOURCES="$PHP_ZEPHIR_PARSER_SOURCES $1"
])
AC_DEFUN([PHP_ZEPHIR_PARSER_ADD_HEADERS], [
PHP_ZEPHIR_PARSER_HEADERS="$PHP_ZEPHIR_PARSER_HEADERS $1"
])
AC_DEFUN([PHP_ZEPHIR_PARSER_ADD_FLAGS], [
PHP_ZEPHIR_PARSER_FLAGS="$PHP_ZEPHIR_PARSER_FLAGS $1"
])
dnl Zephir Parser -------------------------------------------------------------
PHP_ARG_ENABLE(zephir-parser, whether to enable Zephir Parser,
dnl Make sure that the comment is aligned:
[ --enable-zephir-parser Enable Zephir Parser], yes)
dnl Debug Mode ----------------------------------------------------------------
PHP_ARG_ENABLE(zephir-parser-debug,
whether to enable debugging support in Zephir Parser,
dnl Make sure that the comment is aligned:
[ --enable-zephir-parser-debug
Enable debugging support in Zephir Parser], no, no)
dnl Main ----------------------------------------------------------------------
if test "$PHP_ZEPHIR_PARSER" = "yes"; then
AC_MSG_CHECKING([for PHP version])
_found_version=`${PHP_CONFIG} --version`
_found_vernum=`${PHP_CONFIG} --vernum`
if test "$_found_vernum" -lt "70000"; then
AC_MSG_ERROR(
[not supported. Need a PHP version >= 7.0.0 (found $_found_version)]
)
else
AC_MSG_RESULT([$_found_version (ok)])
fi
AC_DEFINE(HAVE_ZEPHIR_PARSER, 1, [Whether you have Zephir Parser])
if test "$PHP_ZEPHIR_PARSER_DEBUG" != "no"; then
AC_DEFINE(USE_ZEPHIR_PARSER_DEBUG, 1,
[Include debugging support in Zephir Parser])
fi
PHP_ZEPHIR_PARSER_ADD_FLAGS([-I@ext_srcdir@/parser])
PHP_ZEPHIR_PARSER_ADD_SOURCES([
zephir_parser.c
parser/parser.c
parser/scanner.c
])
PHP_ZEPHIR_PARSER_ADD_HEADERS([
zephir_parser.h
parser/parser.h
parser/scanner.h
parser/xx.h
parser/zephir.h
])
PHP_NEW_EXTENSION(zephir_parser, $PHP_ZEPHIR_PARSER_SOURCES, $ext_shared,, $PHP_ZEPHIR_PARSER_FLAGS)
ifdef([PHP_INSTALL_HEADERS],
[PHP_INSTALL_HEADERS([ext/zephir_parser], $PHP_ZEPHIR_PARSER_HEADERS)])
PHP_ADD_MAKEFILE_FRAGMENT([parser.mk])
dnl Create directories because PECL can't
if test ! -d parser; then
mkdir parser
fi
fi
dnl Code Coverage -------------------------------------------------------------
PHP_ARG_ENABLE(coverage, whether to include code coverage symbols,
[ --enable-coverage Enable code coverage], no, no)
if test "$PHP_COVERAGE" != "no"; then
dnl Check if ccache is being used
case `$php_shtool path $CC` in
*ccache*[)] ccache=yes;;
*[)] ccache=no;;
esac
if test "$ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
err_msg=$(cat | tr '\012' ' ' <<ΕΟF
ccache must be disabled when --enable-coverage option is used.
You can disable ccache by setting environment variable CCACHE_DISABLE=1.
ΕΟF
)
AC_MSG_ERROR([$err_msg])
fi
AC_CHECK_PROG(LCOV, lcov, lcov)
PHP_SUBST(LCOV)
if test -z "$LCOV"; then
AC_MSG_ERROR([lcov testing requested but lcov not found])
fi
AC_CHECK_PROG(GENHTML, genhtml, genhtml)
PHP_SUBST(GENHTML)
if test -z "$GENHTML"; then
AC_MSG_ERROR([Could not find genhtml from the LCOV package])
fi
changequote({,})
dnl Remove all optimization flags from CFLAGS
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
dnl Remove --coverage flag from LDFLAGS
LDFLAGS=`echo "$LDFLAGS" | $SED -e 's/--coverage)//g' -e 's/-fprofile-arcs//g' -e 's/-ftest-coverage//g'`
changequote([,])
dnl Add the special flags
if test "$($CC --version | head -n 1 | cut -d' ' -f1)" = "Apple"; then
LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage"
else
LDFLAGS="$LDFLAGS -coverage"
fi
CFLAGS="$CFLAGS -O0 -ggdb -fprofile-arcs -ftest-coverage"
CXXFLAGS="$CXXFLAGS -O0 -ggdb -fprofile-arcs -ftest-coverage"
PHP_ADD_MAKEFILE_FRAGMENT([coverage.mk])
AC_DEFINE(USE_COVERAGE, 1, [Whether coverage is enabled])
fi