2 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_FUNC_FFSLL],
9 AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
10 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
12 dnl Persuade glibc <string.h> and AIX <strings.h> to declare ffsll().
13 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
15 AC_CHECK_FUNCS_ONCE([ffsll])
16 if test $ac_cv_func_ffsll = yes; then
17 dnl Test whether ffsll works.
18 dnl On AIX 7.2 in 32-bit mode it is completely broken.
19 AC_CACHE_CHECK([whether ffsll works],
20 [gl_cv_func_ffsll_works],
25 int dummy (long long x) { return 42; }
26 int main (int argc, char *argv[])
28 int (* volatile my_ffsll) (long long) = argc ? ffsll : dummy;
29 long long int x = -128LL;
30 return my_ffsll (x) != 8;
33 [gl_cv_func_ffsll_works=yes],
34 [gl_cv_func_ffsll_works=no],
36 # Guess yes on glibc systems.
37 *-gnu* | gnu*) gl_cv_func_ffsll_works="guessing yes" ;;
38 # Guess yes on musl systems.
39 *-musl*) gl_cv_func_ffsll_works="guessing yes" ;;
40 # Guess yes on native Windows.
41 mingw*) gl_cv_func_ffsll_works="guessing yes" ;;
43 aix*) gl_cv_func_ffsll_works="guessing no" ;;
44 # If we don't know, obey --enable-cross-guesses.
45 *) gl_cv_func_ffsll_works="$gl_cross_guess_normal" ;;
49 case "$gl_cv_func_ffsll_works" in