mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
gnulib: import ffs
The Blackfin sim uses this function, but Windows/mingw doesn't provide it.
This commit is contained in:
32
gnulib/import/m4/ffs.m4
Normal file
32
gnulib/import/m4/ffs.m4
Normal file
@ -0,0 +1,32 @@
|
||||
# ffs.m4 serial 4
|
||||
dnl Copyright (C) 2011-2021 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FUNC_FFS],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
|
||||
|
||||
dnl We can't use AC_CHECK_FUNC here, because ffs() is defined as a
|
||||
dnl static inline function when compiling for Android 4.2 or older.
|
||||
dnl But require that ffs() is declared; otherwise we may be using
|
||||
dnl the GCC built-in function, which leads to warnings
|
||||
dnl "warning: implicit declaration of function 'ffs'".
|
||||
AC_CACHE_CHECK([for ffs], [gl_cv_func_ffs],
|
||||
[AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[#include <strings.h>
|
||||
int x;
|
||||
]],
|
||||
[[int (*func) (int) = ffs;
|
||||
return func (x);
|
||||
]])
|
||||
],
|
||||
[gl_cv_func_ffs=yes],
|
||||
[gl_cv_func_ffs=no])
|
||||
])
|
||||
if test $gl_cv_func_ffs = no; then
|
||||
HAVE_FFS=0
|
||||
fi
|
||||
])
|
@ -44,6 +44,7 @@
|
||||
# dirent \
|
||||
# dirfd \
|
||||
# errno \
|
||||
# ffs \
|
||||
# fnmatch-gnu \
|
||||
# frexpl \
|
||||
# gendocs \
|
||||
@ -88,6 +89,7 @@ gl_MODULES([
|
||||
dirent
|
||||
dirfd
|
||||
errno
|
||||
ffs
|
||||
fnmatch-gnu
|
||||
frexpl
|
||||
gendocs
|
||||
|
@ -84,6 +84,7 @@ AC_DEFUN([gl_EARLY],
|
||||
# Code from module fd-hook:
|
||||
# Code from module fd-safer-flag:
|
||||
# Code from module fdopendir:
|
||||
# Code from module ffs:
|
||||
# Code from module filename:
|
||||
# Code from module filenamecat-lgpl:
|
||||
# Code from module flexmember:
|
||||
@ -194,6 +195,7 @@ AC_DEFUN([gl_EARLY],
|
||||
# Code from module strerror-override:
|
||||
# Code from module strerror_r-posix:
|
||||
# Code from module string:
|
||||
# Code from module strings:
|
||||
# Code from module strnlen:
|
||||
# Code from module strnlen1:
|
||||
# Code from module strstr:
|
||||
@ -329,6 +331,11 @@ AC_DEFUN([gl_INIT],
|
||||
fi
|
||||
gl_DIRENT_MODULE_INDICATOR([fdopendir])
|
||||
gl_MODULE_INDICATOR([fdopendir])
|
||||
gl_FUNC_FFS
|
||||
if test $HAVE_FFS = 0; then
|
||||
AC_LIBOBJ([ffs])
|
||||
fi
|
||||
gl_STRINGS_MODULE_INDICATOR([ffs])
|
||||
gl_FILE_NAME_CONCAT_LGPL
|
||||
AC_C_FLEXIBLE_ARRAY_MEMBER
|
||||
gl_FLOAT_H
|
||||
@ -712,6 +719,7 @@ AC_DEFUN([gl_INIT],
|
||||
dnl For the modules argp, error.
|
||||
gl_MODULE_INDICATOR([strerror_r-posix])
|
||||
gl_HEADER_STRING_H
|
||||
gl_HEADER_STRINGS_H
|
||||
gl_FUNC_STRNLEN
|
||||
if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then
|
||||
AC_LIBOBJ([strnlen])
|
||||
@ -990,6 +998,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
||||
lib/fd-safer-flag.c
|
||||
lib/fd-safer.c
|
||||
lib/fdopendir.c
|
||||
lib/ffs.c
|
||||
lib/filename.h
|
||||
lib/filenamecat-lgpl.c
|
||||
lib/filenamecat.h
|
||||
@ -1130,6 +1139,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
||||
lib/strerror.c
|
||||
lib/strerror_r.c
|
||||
lib/string.in.h
|
||||
lib/strings.in.h
|
||||
lib/stripslash.c
|
||||
lib/strnlen.c
|
||||
lib/strnlen1.c
|
||||
@ -1204,6 +1214,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
||||
m4/fcntl.m4
|
||||
m4/fcntl_h.m4
|
||||
m4/fdopendir.m4
|
||||
m4/ffs.m4
|
||||
m4/filenamecat.m4
|
||||
m4/flexmember.m4
|
||||
m4/float_h.m4
|
||||
@ -1306,6 +1317,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
||||
m4/strerror.m4
|
||||
m4/strerror_r.m4
|
||||
m4/string_h.m4
|
||||
m4/strings_h.m4
|
||||
m4/strnlen.m4
|
||||
m4/strstr.m4
|
||||
m4/strtok_r.m4
|
||||
|
52
gnulib/import/m4/strings_h.m4
Normal file
52
gnulib/import/m4/strings_h.m4
Normal file
@ -0,0 +1,52 @@
|
||||
# Configure a replacement for <strings.h>.
|
||||
# serial 6
|
||||
|
||||
# Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_HEADER_STRINGS_H],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default behavior below is expanded
|
||||
dnl once only, before all statements that occur in other macros.
|
||||
AC_REQUIRE([gl_HEADER_STRINGS_H_BODY])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_HEADER_STRINGS_H_BODY],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
|
||||
|
||||
gl_CHECK_NEXT_HEADERS([strings.h])
|
||||
if test $ac_cv_header_strings_h = yes; then
|
||||
HAVE_STRINGS_H=1
|
||||
else
|
||||
HAVE_STRINGS_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_STRINGS_H])
|
||||
|
||||
dnl Check for declarations of anything we want to poison if the
|
||||
dnl corresponding gnulib module is not in use.
|
||||
gl_WARN_ON_USE_PREPARE([[
|
||||
/* Minix 3.1.8 has a bug: <sys/types.h> must be included before
|
||||
<strings.h>. */
|
||||
#include <sys/types.h>
|
||||
#include <strings.h>
|
||||
]], [ffs strcasecmp strncasecmp])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
|
||||
AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
|
||||
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS],
|
||||
[
|
||||
GNULIB_FFS=0; AC_SUBST([GNULIB_FFS])
|
||||
dnl Assume proper GNU behavior unless another module says otherwise.
|
||||
HAVE_FFS=1; AC_SUBST([HAVE_FFS])
|
||||
HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP])
|
||||
HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
|
||||
])
|
Reference in New Issue
Block a user