xref: /PHP-8.4/ext/sodium/config.m4 (revision bb35da33)
1PHP_ARG_WITH([sodium],
2  [for sodium support],
3  [AS_HELP_STRING([--with-sodium],
4    [Include sodium support])])
5
6if test "$PHP_SODIUM" != "no"; then
7  PKG_CHECK_MODULES([LIBSODIUM], [libsodium >= 1.0.8])
8
9  PHP_EVAL_INCLINE([$LIBSODIUM_CFLAGS])
10  PHP_EVAL_LIBLINE([$LIBSODIUM_LIBS], [SODIUM_SHARED_LIBADD])
11
12  AC_DEFINE([HAVE_LIBSODIUMLIB], [1],
13    [Define to 1 if the PHP extension 'sodium' is available.])
14
15  SODIUM_COMPILER_FLAGS=$LIBSODIUM_CFLAGS
16
17  dnl Add -Wno-type-limits and -Wno-logical-op as this may arise on 32bits platforms
18  AC_CHECK_SIZEOF([long])
19  AS_IF([test "$ac_cv_sizeof_long" -eq 4], [
20    SODIUM_COMPILER_FLAGS="$SODIUM_COMPILER_FLAGS -Wno-type-limits"
21    AX_CHECK_COMPILE_FLAG([-Wno-logical-op],
22      [SODIUM_COMPILER_FLAGS="$SODIUM_COMPILER_FLAGS -Wno-logical-op"],,
23      [-Werror])
24  ])
25
26  PHP_NEW_EXTENSION([sodium],
27    [libsodium.c sodium_pwhash.c],
28    [$ext_shared],,
29    [$SODIUM_COMPILER_FLAGS])
30  PHP_INSTALL_HEADERS([ext/sodium], [php_libsodium.h])
31  PHP_SUBST([SODIUM_SHARED_LIBADD])
32fi
33