xref: /PHP-8.4/ext/hash/config.m4 (revision 7e1e450b)
1PHP_ARG_WITH([mhash],
2  [for mhash support],
3  [AS_HELP_STRING([--with-mhash],
4    [Include mhash support])])
5
6AS_VAR_IF([PHP_MHASH], [no],, [
7  AC_MSG_WARN([The --with-mhash option and mhash* functions are deprecated as of PHP 8.1.0])
8  AC_DEFINE([PHP_MHASH_BC], [1], [Define to 1 if mhash support is enabled.])
9])
10
11AS_VAR_IF([ac_cv_c_bigendian_php], [yes], [
12  EXT_HASH_SHA3_SOURCES=
13  AC_DEFINE([HAVE_SLOW_HASH3], [1],
14    [Define to 1 if the PHP hash extension uses the slow SHA3 algorithm.])
15  AC_MSG_WARN([Using SHA3 slow implementation on bigendian])
16  SHA3_DIR=
17], [
18  AC_CHECK_SIZEOF([long])
19  AC_MSG_CHECKING([if we're at 64-bit platform])
20  AS_IF([test "$ac_cv_sizeof_long" -eq 4],[
21    AC_MSG_RESULT([no])
22    SHA3_DIR="sha3/generic32lc"
23    SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-inplace32BI.c"
24    dnl Add -Wno-implicit-fallthrough flag as it happens on 32 bit builds
25    AX_CHECK_COMPILE_FLAG([-Wno-implicit-fallthrough],
26      [PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -Wno-implicit-fallthrough"],,
27      [-Werror])
28  ],[
29    AC_MSG_RESULT([yes])
30    SHA3_DIR="sha3/generic64lc"
31    SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-opt64.c"
32  ])
33  EXT_HASH_SHA3_SOURCES="$SHA3_OPT_SRC $SHA3_DIR/KeccakHash.c $SHA3_DIR/KeccakSponge.c"
34  PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
35])
36
37PHP_NEW_EXTENSION([hash], m4_normalize([
38    $EXT_HASH_SHA3_SOURCES
39    hash_adler32.c
40    hash_crc32.c
41    hash_fnv.c
42    hash_gost.c
43    hash_haval.c
44    hash_joaat.c
45    hash_md.c
46    hash_murmur.c
47    hash_ripemd.c
48    hash_sha_ni.c
49    hash_sha_sse2.c
50    hash_sha.c
51    hash_sha3.c
52    hash_snefru.c
53    hash_tiger.c
54    hash_whirlpool.c
55    hash_xxhash.c
56    hash.c
57    murmur/PMurHash.c
58    murmur/PMurHash128.c
59  ]),
60  [no],,
61  [$PHP_HASH_CFLAGS])
62PHP_ADD_BUILD_DIR([$ext_builddir/murmur])
63AS_VAR_IF([SHA3_DIR],,, [PHP_ADD_BUILD_DIR([$ext_builddir/$SHA3_DIR])])
64PHP_INSTALL_HEADERS([ext/hash], m4_normalize([
65  php_hash_adler32.h
66  php_hash_crc32.h
67  php_hash_fnv.h
68  php_hash_gost.h
69  php_hash_haval.h
70  php_hash_joaat.h
71  php_hash_md.h
72  php_hash_murmur.h
73  php_hash_ripemd.h
74  php_hash_sha.h
75  php_hash_sha3.h
76  php_hash_snefru.h
77  php_hash_tiger.h
78  php_hash_whirlpool.h
79  php_hash_xxhash.h
80  php_hash.h
81  xxhash/xxhash.h
82]))
83