xref: /PHP-8.2/ext/hash/config.m4 (revision d20d1137)
1PHP_ARG_WITH([mhash],
2  [for mhash support],
3  [AS_HELP_STRING([[--with-mhash]],
4    [Include mhash support])])
5
6if test "$PHP_MHASH" != "no"; then
7  if test "$PHP_HASH" = "no"; then
8    PHP_HASH="yes"
9  fi
10
11  AC_DEFINE(PHP_MHASH_BC, 1, [ ])
12fi
13
14if test $ac_cv_c_bigendian_php = yes; then
15  EXT_HASH_SHA3_SOURCES="hash_sha3.c"
16  AC_DEFINE(HAVE_SLOW_HASH3, 1, [Define if hash3 algo is available])
17  AC_MSG_WARN("Use SHA3 slow implementation on bigendian")
18else
19  AC_CHECK_SIZEOF([long])
20  AC_MSG_CHECKING([if we're at 64-bit platform])
21  AS_IF([test "$ac_cv_sizeof_long" -eq 4],[
22    AC_MSG_RESULT([no])
23    SHA3_DIR="sha3/generic32lc"
24    SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-inplace32BI.c"
25  ],[
26    AC_MSG_RESULT([yes])
27    SHA3_DIR="sha3/generic64lc"
28    SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-opt64.c"
29  ])
30  EXT_HASH_SHA3_SOURCES="$SHA3_OPT_SRC $SHA3_DIR/KeccakHash.c $SHA3_DIR/KeccakSponge.c hash_sha3.c"
31
32  dnl Add -Wno-implicit-fallthrough flag as it happens on 32 bit builds
33  AX_CHECK_COMPILE_FLAG([-Wno-implicit-fallthrough],
34    [PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -Wno-implicit-fallthrough"],,
35    [-Werror])
36
37  PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
38
39  PHP_ADD_BUILD_DIR(ext/hash/$SHA3_DIR, 1)
40fi
41
42PHP_ADD_BUILD_DIR(ext/hash/murmur, 1)
43PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -I@ext_srcdir@/xxhash"
44
45EXT_HASH_SOURCES="hash.c hash_md.c hash_sha.c hash_ripemd.c hash_haval.c \
46  hash_tiger.c hash_gost.c hash_snefru.c hash_whirlpool.c hash_adler32.c \
47  hash_crc32.c hash_fnv.c hash_joaat.c $EXT_HASH_SHA3_SOURCES
48  murmur/PMurHash.c murmur/PMurHash128.c hash_murmur.c hash_xxhash.c"
49EXT_HASH_HEADERS="php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h \
50  php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h \
51  php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h \
52  php_hash_fnv.h php_hash_joaat.h php_hash_sha3.h php_hash_murmur.h \
53  php_hash_xxhash.h"
54
55PHP_NEW_EXTENSION(hash, $EXT_HASH_SOURCES, 0,,$PHP_HASH_CFLAGS)
56PHP_INSTALL_HEADERS(ext/hash, $EXT_HASH_HEADERS)
57