xref: /PHP-7.3/ext/hash/config.m4 (revision 7f6387b5)
1dnl config.m4 for extension hash
2
3PHP_ARG_WITH(mhash, for mhash support,
4[  --with-mhash[=DIR]        Include mhash support])
5
6PHP_ARG_ENABLE(hash, whether to enable hash support,
7[  --disable-hash          Disable hash support], yes)
8
9if test "$PHP_MHASH" != "no"; then
10  if test "$PHP_HASH" = "no"; then
11    PHP_HASH="yes"
12  fi
13
14  AC_DEFINE(PHP_MHASH_BC, 1, [ ])
15fi
16
17if test "$PHP_HASH" != "no"; then
18  AC_DEFINE(HAVE_HASH_EXT,1,[Have HASH Extension])
19
20  PHP_C_BIGENDIAN
21
22  AC_CHECK_SIZEOF(short, 2)
23  AC_CHECK_SIZEOF(int, 4)
24  AC_CHECK_SIZEOF(long, 4)
25  AC_CHECK_SIZEOF(long long, 8)
26
27  if test $ac_cv_c_bigendian_php = yes; then
28    EXT_HASH_SHA3_SOURCES="hash_sha3.c"
29    AC_DEFINE(HAVE_SLOW_HASH3, 1, [Define is hash3 algo is available])
30    AC_MSG_WARN("Use SHA3 slow implementation on bigendian")
31  else
32    PHP_CHECK_64BIT([
33      SHA3_DIR="sha3/generic32lc"
34      SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-inplace32BI.c"
35    ],[
36      SHA3_DIR="sha3/generic64lc"
37      SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-opt64.c"
38    ])
39    EXT_HASH_SHA3_SOURCES="$SHA3_OPT_SRC $SHA3_DIR/KeccakHash.c $SHA3_DIR/KeccakSponge.c hash_sha3.c"
40    PHP_HASH_CFLAGS="-I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded"
41
42    PHP_ADD_BUILD_DIR(ext/hash/$SHA3_DIR, 1)
43  fi
44
45  EXT_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  EXT_HASH_HEADERS="php_hash.h php_hash_md.h php_hash_sha.h php_hash_ripemd.h \
49    php_hash_haval.h php_hash_tiger.h php_hash_gost.h php_hash_snefru.h \
50    php_hash_whirlpool.h php_hash_adler32.h php_hash_crc32.h \
51    php_hash_fnv.h php_hash_joaat.h php_hash_sha3.h"
52
53  PHP_NEW_EXTENSION(hash, $EXT_HASH_SOURCES, $ext_shared,,$PHP_HASH_CFLAGS)
54  ifdef([PHP_INSTALL_HEADERS], [
55  	PHP_INSTALL_HEADERS(ext/hash, $EXT_HASH_HEADERS)
56  ])
57fi
58