Build: configure.ac: Use AS_IF and AS_CASE where required.

This makes no functional difference in the generated configure
(at least with the Autotools versions I have installed) but this
change might prevent future bugs like the one that was just
fixed in the commit 5a5bd7f871.
This commit is contained in:
Lasse Collin 2023-03-21 14:04:37 +02:00
parent 3b8890a402
commit 53cc475f26
1 changed files with 15 additions and 15 deletions

View File

@ -895,7 +895,7 @@ TUKLIB_MBSTR
sha256_header_found=no sha256_header_found=no
sha256_type_found=no sha256_type_found=no
sha256_func_found=no sha256_func_found=no
if test "x$enable_external_sha256" = "xyes"; then AS_IF([test "x$enable_external_sha256" = "xyes"], [
# Test for Common Crypto before others, because Darwin has sha256.h # Test for Common Crypto before others, because Darwin has sha256.h
# too and we don't want to use that, because on older versions it # too and we don't want to use that, because on older versions it
# uses OpenSSL functions, whose SHA256_Init is not guaranteed to # uses OpenSSL functions, whose SHA256_Init is not guaranteed to
@ -925,7 +925,7 @@ if test "x$enable_external_sha256" = "xyes"; then
[sha256_func_found=yes ; break]) [sha256_func_found=yes ; break])
fi fi
fi fi
fi ])
AM_CONDITIONAL([COND_INTERNAL_SHA256], [test "x$sha256_func_found" = xno]) AM_CONDITIONAL([COND_INTERNAL_SHA256], [test "x$sha256_func_found" = xno])
if test "x$enable_external_sha256$sha256_func_found" = xyesno; then if test "x$enable_external_sha256$sha256_func_found" = xyesno; then
AC_MSG_ERROR([--enable-external-sha256 was specified but no supported external SHA-256 implementation was found]) AC_MSG_ERROR([--enable-external-sha256 was specified but no supported external SHA-256 implementation was found])
@ -958,9 +958,9 @@ AC_CHECK_DECL([_mm_movemask_epi8],
# If everything above is supported, runtime detection will be used to keep the # If everything above is supported, runtime detection will be used to keep the
# binaries working on systems that don't support the required extensions. # binaries working on systems that don't support the required extensions.
AC_MSG_CHECKING([if _mm_clmulepi64_si128 is usable]) AC_MSG_CHECKING([if _mm_clmulepi64_si128 is usable])
if test "x$enable_clmul_crc" = xno ; then AS_IF([test "x$enable_clmul_crc" = xno], [
AC_MSG_RESULT([no, --disable-clmul-crc was used]) AC_MSG_RESULT([no, --disable-clmul-crc was used])
else ], [
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <immintrin.h> #include <immintrin.h>
@ -989,19 +989,19 @@ __m128i my_clmul(__m128i a)
], [ ], [
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
]) ])
fi ])
# Check for sandbox support. If one is found, set enable_sandbox=found. # Check for sandbox support. If one is found, set enable_sandbox=found.
case $enable_sandbox in AS_CASE([$enable_sandbox],
auto | capsicum) [auto | capsicum], [
AX_CHECK_CAPSICUM([enable_sandbox=found], [:]) AX_CHECK_CAPSICUM([enable_sandbox=found], [:])
;; ]
esac )
case $enable_sandbox in AS_CASE([$enable_sandbox],
auto | pledge) [auto | pledge], [
AC_CHECK_FUNCS([pledge], [enable_sandbox=found ; break]) AC_CHECK_FUNCS([pledge], [enable_sandbox=found ; break])
;; ]
esac )
# If a specific sandboxing method was explicitly requested and it wasn't # If a specific sandboxing method was explicitly requested and it wasn't
# found, give an error. # found, give an error.
@ -1030,7 +1030,7 @@ if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then
AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY" AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
fi fi
if test "$GCC" = yes ; then AS_IF([test "$GCC" = yes], [
# Enable as much warnings as possible. These commented warnings won't # Enable as much warnings as possible. These commented warnings won't
# work for this package though: # work for this package though:
# * -Wunreachable-code breaks several assert(0) cases, which are # * -Wunreachable-code breaks several assert(0) cases, which are
@ -1111,7 +1111,7 @@ if test "$GCC" = yes ; then
if test "x$enable_werror" = "xyes"; then if test "x$enable_werror" = "xyes"; then
AM_CFLAGS="$AM_CFLAGS -Werror" AM_CFLAGS="$AM_CFLAGS -Werror"
fi fi
fi ])
############################################################################### ###############################################################################