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