Skip to content

Commit e8f2e53

Browse files
authored
Autotools: Sync CS in hash extension (#15302)
- AS_* macros used - list of source files added to argument directly and normalized with m4_normalize() - hash_sha3.c source file simplified
1 parent 5c87075 commit e8f2e53

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

ext/hash/config.m4

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ PHP_ARG_WITH([mhash],
33
[AS_HELP_STRING([[--with-mhash]],
44
[Include mhash support])])
55

6-
if test "$PHP_MHASH" != "no"; then
6+
AS_VAR_IF([PHP_MHASH], [no],, [
77
AC_MSG_WARN([The --with-mhash option and mhash* functions are deprecated as of PHP 8.1.0])
88
AC_DEFINE([PHP_MHASH_BC], [1], [Define to 1 if mhash support is enabled.])
9-
fi
9+
])
1010

11-
if test $ac_cv_c_bigendian_php = yes; then
12-
EXT_HASH_SHA3_SOURCES="hash_sha3.c"
11+
AS_VAR_IF([ac_cv_c_bigendian_php], [yes], [
12+
EXT_HASH_SHA3_SOURCES=
1313
AC_DEFINE([HAVE_SLOW_HASH3], [1],
1414
[Define to 1 if the PHP hash extension uses the slow SHA3 algorithm.])
1515
AC_MSG_WARN([Using SHA3 slow implementation on bigendian])
1616
SHA3_DIR=
17-
else
17+
], [
1818
AC_CHECK_SIZEOF([long])
1919
AC_MSG_CHECKING([if we're at 64-bit platform])
2020
AS_IF([test "$ac_cv_sizeof_long" -eq 4],[
@@ -30,16 +30,35 @@ else
3030
SHA3_DIR="sha3/generic64lc"
3131
SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-opt64.c"
3232
])
33-
EXT_HASH_SHA3_SOURCES="$SHA3_OPT_SRC $SHA3_DIR/KeccakHash.c $SHA3_DIR/KeccakSponge.c hash_sha3.c"
33+
EXT_HASH_SHA3_SOURCES="$SHA3_OPT_SRC $SHA3_DIR/KeccakHash.c $SHA3_DIR/KeccakSponge.c"
3434
PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
35-
fi
35+
])
3636

37-
EXT_HASH_SOURCES="hash.c hash_md.c hash_sha.c hash_sha_sse2.c hash_sha_ni.c hash_ripemd.c hash_haval.c \
38-
hash_tiger.c hash_gost.c hash_snefru.c hash_whirlpool.c hash_adler32.c \
39-
hash_crc32.c hash_fnv.c hash_joaat.c $EXT_HASH_SHA3_SOURCES
40-
murmur/PMurHash.c murmur/PMurHash128.c hash_murmur.c hash_xxhash.c"
41-
42-
PHP_NEW_EXTENSION([hash], [$EXT_HASH_SOURCES], [no],, [$PHP_HASH_CFLAGS])
37+
PHP_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])
4362
PHP_ADD_BUILD_DIR([$ext_builddir/murmur])
4463
AS_VAR_IF([SHA3_DIR],,, [PHP_ADD_BUILD_DIR([$ext_builddir/$SHA3_DIR])])
4564
PHP_INSTALL_HEADERS([ext/hash], m4_normalize([

0 commit comments

Comments
 (0)