diff options
author | Yureka <yuka@yuka.dev> | 2022-10-01 16:11:00 +0200 |
---|---|---|
committer | Björn Esser <besser82@fedoraproject.org> | 2022-11-01 10:40:53 +0100 |
commit | 13435fdc1b8c704fd46b0a9027791db0134bd77b (patch) | |
tree | 9900211bfd89435011c00b3d3afa14627c386288 /configure.ac | |
parent | 06a09d43f8899ba099b31379866e21e9554050fc (diff) | |
download | libxcrypt-13435fdc1b8c704fd46b0a9027791db0134bd77b.tar.gz libxcrypt-13435fdc1b8c704fd46b0a9027791db0134bd77b.tar.bz2 libxcrypt-13435fdc1b8c704fd46b0a9027791db0134bd77b.zip |
configure: Restore ucontext api functionality check.
In c3f01c72b303cbbb0cc8983120677edee2f3fa4b the use of the ucontext api
in the main program was removed, and with it the configure check for it.
However, the ucontext api is still used in the "explicit_bzero" test and
this has the same problem as described in the comment:
> The ucontext.h functions that we use were withdrawn from
> POSIX.1-2008, so the existence of the header does not prove
> we can use the functions.
Thus, restore the full configure check and use it instead of the header
check for the explicit_bzero test.
See https://bugs.gentoo.org/838172
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index cb71fcc..40915d4 100644 --- a/configure.ac +++ b/configure.ac @@ -290,6 +290,39 @@ fi AC_SUBST([PYTHON]) AM_CONDITIONAL([ENABLE_KA_TABLE_GEN], [test x"$PYTHON" != "xfalse"]) +# The ucontext.h functions that we use were withdrawn from +# POSIX.1-2008, so the existence of the header does not prove +# we can use the functions. +AS_IF([test $ac_cv_header_ucontext_h = yes], + [AC_CACHE_CHECK([whether all ucontext.h functions are available], + [ac_cv_header_ucontext_h_fns_available], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +// This code isn't intended to make sense; it just validates the +// type signature of all four context functions, and avoids tripping +// any of the many warnings we may have active. +#include <ucontext.h> +static int x; +static void fn1(void) {} +static void fn2(int a, int b) { x = a - b; } +]], [[ + ucontext_t uc1, uc2; + if (getcontext(&uc1)) return 1; + if (setcontext(&uc1)) return 1; + makecontext(&uc1, fn1, 0); + makecontext(&uc2, fn2, 2, 1, 1); + if (swapcontext(&uc1, &uc2)) return 1; + return x; +]])], + [ac_cv_header_ucontext_h_fns_available=yes], + [ac_cv_header_ucontext_h_fns_available=no])])], + [ac_cv_header_ucontext_h_fns_available=no]) + +if test $ac_cv_header_ucontext_h_fns_available = yes; then + AC_DEFINE([USE_SWAPCONTEXT], 1, + [Define to 1 if getcontext, setcontext, makecontext, and swapcontext are + available from ucontext.h without deprecation warnings.]) +fi + # Configure options. AC_ARG_ENABLE([failure-tokens], AS_HELP_STRING( |