summaryrefslogtreecommitdiff
path: root/src/config.m4
blob: a421c0cd092958ab52e73e8f2763c40acbd47ab3 (plain)
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
dnl $Id$
dnl config.m4 for extension snuffleupagus

sources="snuffleupagus.c sp_config.c sp_config_utils.c sp_harden_rand.c"
sources="$sources sp_unserialize.c sp_utils.c sp_disable_xxe.c sp_list.c"
sources="$sources sp_disabled_functions.c sp_execute.c sp_upload_validation.c"
sources="$sources sp_cookie_encryption.c sp_network_utils.c tweetnacl.c"
sources="$sources sp_config_keywords.c sp_var_parser.c sp_var_value.c sp_tree.c"
sources="$sources sp_pcre_compat.c sp_crypt.c sp_session.c sp_sloppy.c sp_wrapper.c"
sources="$sources sp_ini.c sp_php_compat.c sp_config_scanner.c sp_ifilter.c"

PHP_ARG_ENABLE(snuffleupagus, whether to enable snuffleupagus support,
[  --enable-snuffleupagus           Enable snuffleupagus support])

PHP_ARG_ENABLE(coverage, whether to enable coverage support,
[  --enable-coverage           Enable coverage support], no, no)

PHP_ARG_ENABLE(debug, whether to enable debug messages,
[  --enable-debug           Enable debug messages], no, no)

PHP_ARG_ENABLE(debug-stderr, whether to enable debug messages,
[  --enable-debug-stderr           Enable debug messages], no, no)

AC_PROG_CC_STDC()

CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter"
CFLAGS="$CFLAGS -Wformat=2 -Wformat-security -D_FORTIFY_SOURCE=2"
CFLAGS="$CFLAGS -fstack-protector-strong"

LDFLAGS="$LDFLAGS `pcre2-config --libs8`"

if test "$PHP_DEBUG" = "yes"; then
  AC_DEFINE(SP_DEBUG, 1, [Enable SP debug messages])
  CFLAGS="$CFLAGS -g -ggdb -O0"
  if test "$PHP_DEBUG_STDERR" = "yes"; then
    AC_DEFINE(SP_DEBUG_STDERR, 1, [Print SP debug messages to stderr])
  fi
fi

AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE(HAVE_PCRE, 1, [have pcre]))

if test "$PHP_SNUFFLEUPAGUS" = "yes"; then
   if test "$PHP_COVERAGE" = "yes"; then
      CFLAGS="$CFLAGS --coverage -O0 -g"
   fi
   PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi

# PHP_PROG_RE2C([2.0])
PHP_ADD_MAKEFILE_FRAGMENT()