forked from NoiseByNorthwest/php-spx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.m4
More file actions
97 lines (85 loc) · 3.58 KB
/
config.m4
File metadata and controls
97 lines (85 loc) · 3.58 KB
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
PHP_ARG_ENABLE(SPX, whether to enable SPX extension,
[ --enable-spx Enable SPX extension])
PHP_ARG_ENABLE(SPX-DEV, whether to enable SPX developer build flags,
[ --enable-spx-dev Compile SPX with debugging symbols])
if test -z "$PHP_ZLIB_DIR"; then
PHP_ARG_WITH(zlib-dir, for ZLIB,
[ --with-zlib-dir[=DIR] Set the path to ZLIB install prefix.], no)
fi
PHP_ARG_WITH(spx-assets-dir, for assets path,
[ --with-spx-assets-dir[=DIR] Set the installation path of assets.], $prefix/share/misc/php-spx/assets)
if test "$PHP_SPX" = "yes"; then
AC_DEFINE(HAVE_SPX, 1, [spx])
AC_MSG_CHECKING([for assets directory])
AC_MSG_RESULT([ $PHP_SPX_ASSETS_DIR ])
AC_DEFINE_UNQUOTED([SPX_HTTP_UI_ASSETS_DIR], [ "$PHP_SPX_ASSETS_DIR/web-ui" ], [path of web-ui assets directory])
PHP_SUBST([PHP_SPX_ASSETS_DIR])
CFLAGS="$CFLAGS -Werror -Wall -Wno-attributes -O3 -pthread"
php_ver_num=$(echo $PHP_VERSION | awk -F. '{printf("%d%02d%02d",$1,$2,$3)}')
if test "$php_ver_num" -ge 80200; then
CFLAGS="$CFLAGS -std=c11"
AC_MSG_NOTICE([Adding -std=c11 because PHP >= 8.2])
else
CFLAGS="$CFLAGS -std=gnu90"
AC_MSG_NOTICE([Adding -std=gnu90 because PHP < 8.2])
fi
# Disabling typedef-redefinition is required for:
# - macOS, see https://github.com/NoiseByNorthwest/php-spx/pull/270
# - clang, see https://github.com/NoiseByNorthwest/php-spx/pull/305
# Furthermore, typedef-redefinition is also allowed with c11 and above.
CFLAGS="$CFLAGS -Wno-typedef-redefinition"
if test "$PHP_SPX_DEV" = "yes"
then
CFLAGS="$CFLAGS -g"
fi
AC_MSG_CHECKING([for zlib header])
if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
if test -f "$PHP_ZLIB_DIR/include/zlib/zlib.h"; then
PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include/zlib"
elif test -f "$PHP_ZLIB_DIR/include/zlib.h"; then
PHP_ZLIB_DIR="$PHP_ZLIB_DIR"
PHP_ZLIB_INCDIR="$PHP_ZLIB_DIR/include"
else
AC_MSG_ERROR([Can't find ZLIB headers under "$PHP_ZLIB_DIR"])
fi
else
for i in /usr/local /usr /opt/local; do
if test -f "$i/include/zlib/zlib.h"; then
PHP_ZLIB_DIR="$i"
PHP_ZLIB_INCDIR="$i/include/zlib"
elif test -f "$i/include/zlib.h"; then
PHP_ZLIB_DIR="$i"
PHP_ZLIB_INCDIR="$i/include"
fi
done
fi
AC_MSG_CHECKING([for zlib location])
if test "$PHP_ZLIB_DIR" != "no" && test "$PHP_ZLIB_DIR" != "yes"; then
AC_MSG_RESULT([$PHP_ZLIB_DIR])
PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/$PHP_LIBDIR, SPX_SHARED_LIBADD)
PHP_ADD_INCLUDE($PHP_ZLIB_INCDIR)
else
AC_MSG_ERROR([spx support requires ZLIB. Use --with-zlib-dir=<DIR> to specify the prefix where ZLIB headers and library are located])
fi
PHP_NEW_EXTENSION(spx,
src/php_spx.c \
src/spx_profiler.c \
src/spx_profiler_tracer.c \
src/spx_profiler_sampler.c \
src/spx_reporter_full.c \
src/spx_reporter_fp.c \
src/spx_reporter_trace.c \
src/spx_metric.c \
src/spx_resource_stats.c \
src/spx_hmap.c \
src/spx_str_builder.c \
src/spx_output_stream.c \
src/spx_php.c \
src/spx_stdio.c \
src/spx_config.c \
src/spx_utils.c \
src/spx_fmt.c,
$ext_shared)
PHP_ADD_MAKEFILE_FRAGMENT
fi