Hi Arsen, Thanks for the report.
> https://bugs.gentoo.org/935126 The essential lines in the build.log attachment there seem to be: * QA Notice: Found the following implicit function declarations in configure logs: * /var/tmp/portage/dev-util/poke-4.1/work/poke-4.1/config.log:6859 - _exit * /var/tmp/portage/dev-util/poke-4.1/work/poke-4.1/config.log:11911 - _exit * Check that no features were accidentally disabled. * See https://wiki.gentoo.org/wiki/Modern_C_porting. _exit() needs <unistd.h> on POSIX-like platforms but <stdlib.h> on native Windows. > * m4/printf.m4 (gl_SNPRINTF_DIRECTIVE_N): Add missing include for > unistd.h. > (gl_PRINTF_DIRECTIVE_N): Likewise. I can't take this patch, because <unistd.h> does not exist on MSVC. I also considered using _Exit instead of _exit, since it is always declared in <stdlib.h>. But it would produce portability problems on some older platforms (Android, HP-UX, Minix). So, I'm fixing it like this: 2024-07-01 Bruno Haible <br...@clisp.org> Avoid some possibly wrong configure test results. Reported by Arsen Arsenović <ar...@gentoo.org> in <https://lists.gnu.org/archive/html/bug-gnulib/2024-07/msg00000.html>. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_N): Include necessary header file for _exit(). (gl_SNPRINTF_DIRECTIVE_N): Likewise. * m4/memmem.m4 (gl_FUNC_MEMMEM): Update comment. * m4/sleep.m4 (gl_FUNC_SLEEP): Likewise. * m4/strcasestr.m4 (gl_FUNC_STRCASESTR): Likewise. * m4/strstr.m4 (gl_FUNC_STRSTR): Likewise. * m4/wcsstr.m4 (gl_FUNC_WCSSTR): Likewise. diff --git a/m4/printf.m4 b/m4/printf.m4 index 1363fe19e4..a6daa1a62c 100644 --- a/m4/printf.m4 +++ b/m4/printf.m4 @@ -1,5 +1,5 @@ # printf.m4 -# serial 94 +# serial 95 dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -897,8 +897,12 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N] [AC_LANG_SOURCE([[ #include <signal.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> +#if defined _WIN32 && !defined __CYGWIN__ +# include <stdlib.h> +#else +# include <unistd.h> +#endif #ifdef _MSC_VER #include <crtdbg.h> #include <inttypes.h> @@ -1717,6 +1721,11 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N] #include <signal.h> #include <stdio.h> #include <string.h> +#if defined _WIN32 && !defined __CYGWIN__ +# include <stdlib.h> +#else +# include <unistd.h> +#endif #if HAVE_SNPRINTF # define my_snprintf snprintf #else diff --git a/m4/memmem.m4 b/m4/memmem.m4 index a9bc277813..e6b1d91cbb 100644 --- a/m4/memmem.m4 +++ b/m4/memmem.m4 @@ -1,5 +1,5 @@ # memmem.m4 -# serial 29 +# serial 30 dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -102,7 +102,7 @@ AC_DEFUN([gl_FUNC_MEMMEM] char *haystack = (char *) malloc (2 * m + 1); char *needle = (char *) malloc (m + 1); /* Failure to compile this test due to missing alarm is okay, - since all such platforms (mingw) also lack memmem. */ + since all such platforms (mingw, MSVC) also lack memmem. */ signal (SIGALRM, quit); alarm (5); /* Check for quadratic performance. */ diff --git a/m4/sleep.m4 b/m4/sleep.m4 index 06f58b2860..ec8764bd2a 100644 --- a/m4/sleep.m4 +++ b/m4/sleep.m4 @@ -1,5 +1,5 @@ # sleep.m4 -# serial 13 +# serial 14 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -33,7 +33,7 @@ AC_DEFUN([gl_FUNC_SLEEP] } ]], [[ /* Failure to compile this test due to missing alarm is okay, - since all such platforms (mingw) also lack sleep. */ + since all such platforms (mingw, MSVC) also lack sleep. */ unsigned int pentecost = 50 * 24 * 60 * 60; /* 50 days. */ unsigned int remaining; signal (SIGALRM, handle_alarm); diff --git a/m4/strcasestr.m4 b/m4/strcasestr.m4 index d254871677..811e680ff5 100644 --- a/m4/strcasestr.m4 +++ b/m4/strcasestr.m4 @@ -1,5 +1,5 @@ # strcasestr.m4 -# serial 28 +# serial 29 dnl Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -98,7 +98,7 @@ AC_DEFUN([gl_FUNC_STRCASESTR] char *haystack = (char *) malloc (2 * m + 2); char *needle = (char *) malloc (m + 2); /* Failure to compile this test due to missing alarm is okay, - since all such platforms (mingw) also lack strcasestr. */ + since all such platforms (mingw, MSVC) also lack strcasestr. */ signal (SIGALRM, quit); alarm (5); /* Check for quadratic performance. */ diff --git a/m4/strstr.m4 b/m4/strstr.m4 index 957ed2e307..d19559aa25 100644 --- a/m4/strstr.m4 +++ b/m4/strstr.m4 @@ -1,5 +1,5 @@ # strstr.m4 -# serial 24 +# serial 25 dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -95,7 +95,7 @@ AC_DEFUN([gl_FUNC_STRSTR] char *haystack = (char *) malloc (2 * m + 2); char *needle = (char *) malloc (m + 2); /* Failure to compile this test due to missing alarm is okay, - since all such platforms (mingw) also have quadratic strstr. */ + since all such platforms (mingw, MSVC) also have quadratic strstr. */ signal (SIGALRM, quit); alarm (5); /* Check for quadratic performance. */ diff --git a/m4/wcsstr.m4 b/m4/wcsstr.m4 index eb43b9f354..20dd8406cc 100644 --- a/m4/wcsstr.m4 +++ b/m4/wcsstr.m4 @@ -1,5 +1,5 @@ # wcsstr.m4 -# serial 3 +# serial 4 dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,7 +34,7 @@ AC_DEFUN([gl_FUNC_WCSSTR] wchar_t *haystack = (wchar_t *) malloc ((2 * m + 2) * sizeof (wchar_t)); wchar_t *needle = (wchar_t *) malloc ((m + 2) * sizeof (wchar_t)); /* Failure to compile this test due to missing alarm is okay, - since all such platforms (mingw) also have quadratic strstr. */ + since all such platforms (mingw, MSVC) also have quadratic wcsstr. */ signal (SIGALRM, quit); alarm (5); /* Check for quadratic performance. */