diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-05-18 22:11:41 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-05-24 18:36:55 -0400 |
commit | 32e2770e59582f3bea022e20d0cf6722700e7578 (patch) | |
tree | d00afd0ca46b01ba1231cfda4e06fea67bc6238d /gnulib/import/m4 | |
parent | 78a7f5766afea0dbc0ea5db957eddaf27e685af1 (diff) | |
download | binutils-32e2770e59582f3bea022e20d0cf6722700e7578.zip binutils-32e2770e59582f3bea022e20d0cf6722700e7578.tar.gz binutils-32e2770e59582f3bea022e20d0cf6722700e7578.tar.bz2 |
gnulib: import ffs
The Blackfin sim uses this function, but Windows/mingw doesn't provide it.
Diffstat (limited to 'gnulib/import/m4')
-rw-r--r-- | gnulib/import/m4/ffs.m4 | 32 | ||||
-rw-r--r-- | gnulib/import/m4/gnulib-cache.m4 | 2 | ||||
-rw-r--r-- | gnulib/import/m4/gnulib-comp.m4 | 12 | ||||
-rw-r--r-- | gnulib/import/m4/strings_h.m4 | 52 |
4 files changed, 98 insertions, 0 deletions
diff --git a/gnulib/import/m4/ffs.m4 b/gnulib/import/m4/ffs.m4 new file mode 100644 index 0000000..b6e6b31 --- /dev/null +++ b/gnulib/import/m4/ffs.m4 @@ -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 +]) diff --git a/gnulib/import/m4/gnulib-cache.m4 b/gnulib/import/m4/gnulib-cache.m4 index 79a2f61..ad7db9a 100644 --- a/gnulib/import/m4/gnulib-cache.m4 +++ b/gnulib/import/m4/gnulib-cache.m4 @@ -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 diff --git a/gnulib/import/m4/gnulib-comp.m4 b/gnulib/import/m4/gnulib-comp.m4 index db32316..75fe076 100644 --- a/gnulib/import/m4/gnulib-comp.m4 +++ b/gnulib/import/m4/gnulib-comp.m4 @@ -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 diff --git a/gnulib/import/m4/strings_h.m4 b/gnulib/import/m4/strings_h.m4 new file mode 100644 index 0000000..1dc2212 --- /dev/null +++ b/gnulib/import/m4/strings_h.m4 @@ -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]) +]) |