Resolve conflicts for functions introduced in Android API level 23.
+ * lib/unistd.in.h (sethostname): Consider REPLACE_SETHOSTNAME. Disable
+ _GL_CXXALIASWARN invocation on non-glibc systems.
+ * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_SETHOSTNAME.
+ * modules/unistd (Makefile.am): Substitute REPLACE_SETHOSTNAME.
+ * m4/sethostname.m4 (gl_FUNC_SETHOSTNAME): Conditionally set
+ REPLACE_SETHOSTNAME.
+ * modules/sethostname (Depends-on, configure.ac): Consider
+ REPLACE_SETHOSTNAME.
+
* lib/string.in.h (mempcpy): Consider REPLACE_MEMPCPY. Disable
_GL_CXXALIASWARN invocation on non-glibc systems.
* m4/string_h.m4 (gl_STRING_H_DEFAULTS): Initialize REPLACE_MEMPCPY.
Platforms with no ability to set the hostname return -1 and set
errno = ENOSYS. */
-# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
+# if @REPLACE_SETHOSTNAME@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef sethostname
+# define sethostname rpl_sethostname
+# endif
+_GL_FUNCDECL_RPL (sethostname, int, (const char *name, size_t len)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (sethostname, int, (const char *name, size_t len));
+# else
+# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
_GL_ARG_NONNULL ((1)));
-# endif
+# endif
/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
and FreeBSD 6.4 the second parameter is int. On Solaris 11
2011-10, the first parameter is not const. */
_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
+# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (sethostname);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef sethostname
# if HAVE_RAW_DECL_SETHOSTNAME
-# sethostname.m4 serial 2
+# sethostname.m4 serial 3
dnl Copyright (C) 2011-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
gl_CHECK_FUNCS_ANDROID([sethostname], [[#include <unistd.h>]])
if test $ac_cv_func_sethostname = no; then
HAVE_SETHOSTNAME=0
+ case "$gl_cv_onwards_func_sethostname" in
+ future*) REPLACE_SETHOSTNAME=1 ;;
+ esac
fi
AC_CHECK_DECLS([sethostname])
-# unistd_h.m4 serial 92
+# unistd_h.m4 serial 93
dnl Copyright (C) 2006-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK])
REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT])
REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR])
+ REPLACE_SETHOSTNAME=0; AC_SUBST([REPLACE_SETHOSTNAME])
REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP])
REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK])
REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT])
Depends-on:
unistd
-errno [test $HAVE_SETHOSTNAME = 0]
-fopen-gnu [test $HAVE_SETHOSTNAME = 0]
+errno [test $HAVE_SETHOSTNAME = 0 || test $REPLACE_SETHOSTNAME = 1]
+fopen-gnu [test $HAVE_SETHOSTNAME = 0 || test $REPLACE_SETHOSTNAME = 1]
configure.ac:
gl_FUNC_SETHOSTNAME
-gl_CONDITIONAL([GL_COND_OBJ_SETHOSTNAME], [test $HAVE_SETHOSTNAME = 0])
+gl_CONDITIONAL([GL_COND_OBJ_SETHOSTNAME],
+ [test $HAVE_SETHOSTNAME = 0 || test $REPLACE_SETHOSTNAME = 1])
gl_UNISTD_MODULE_INDICATOR([sethostname])
Makefile.am:
-e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \
-e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \
-e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \
+ -e 's|@''REPLACE_SETHOSTNAME''@|$(REPLACE_SETHOSTNAME)|g' \
-e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \
-e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \
-e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \