diff --git a/gnulib/ChangeLog b/gnulib/ChangeLog index 810aa1e62da..8e14d308eb1 100644 --- a/gnulib/ChangeLog +++ b/gnulib/ChangeLog @@ -1,3 +1,12 @@ +2021-05-04 Mike Frysinger + + * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add gnulib. + * Makefile.in, import/Makefile.am, import/Makefile.in, + import/m4/gnulib-cache.m4, import/m4/gnulib-comp.m4, aclocal.m4, + config.in, configure: Regenerate. + * import/getdelim.c, import/getline.c, import/m4/getdelim.m4, + import/m4/getline.m4: New files. + 2021-03-24 Mike Frysinger * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add gitlog-to-changelog. diff --git a/gnulib/Makefile.in b/gnulib/Makefile.in index 29767ab7d5f..b6439515a40 100644 --- a/gnulib/Makefile.in +++ b/gnulib/Makefile.in @@ -159,7 +159,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/getcwd-abort-bug.m4 \ $(top_srcdir)/import/m4/getcwd-path-max.m4 \ $(top_srcdir)/import/m4/getcwd.m4 \ + $(top_srcdir)/import/m4/getdelim.m4 \ $(top_srcdir)/import/m4/getdtablesize.m4 \ + $(top_srcdir)/import/m4/getline.m4 \ $(top_srcdir)/import/m4/getlogin.m4 \ $(top_srcdir)/import/m4/getlogin_r.m4 \ $(top_srcdir)/import/m4/getpagesize.m4 \ diff --git a/gnulib/aclocal.m4 b/gnulib/aclocal.m4 index 55fb90ab60b..50c77599a7a 100644 --- a/gnulib/aclocal.m4 +++ b/gnulib/aclocal.m4 @@ -1232,7 +1232,9 @@ m4_include([import/m4/fstatat.m4]) m4_include([import/m4/getcwd-abort-bug.m4]) m4_include([import/m4/getcwd-path-max.m4]) m4_include([import/m4/getcwd.m4]) +m4_include([import/m4/getdelim.m4]) m4_include([import/m4/getdtablesize.m4]) +m4_include([import/m4/getline.m4]) m4_include([import/m4/getlogin.m4]) m4_include([import/m4/getlogin_r.m4]) m4_include([import/m4/getpagesize.m4]) diff --git a/gnulib/config.in b/gnulib/config.in index 164fab27885..e3f581423f9 100644 --- a/gnulib/config.in +++ b/gnulib/config.in @@ -191,9 +191,15 @@ /* Define to 1 when the gnulib module getcwd should be tested. */ #undef GNULIB_TEST_GETCWD +/* Define to 1 when the gnulib module getdelim should be tested. */ +#undef GNULIB_TEST_GETDELIM + /* Define to 1 when the gnulib module getdtablesize should be tested. */ #undef GNULIB_TEST_GETDTABLESIZE +/* Define to 1 when the gnulib module getline should be tested. */ +#undef GNULIB_TEST_GETLINE + /* Define to 1 when the gnulib module getlogin_r should be tested. */ #undef GNULIB_TEST_GETLOGIN_R @@ -401,10 +407,22 @@ */ #undef HAVE_DECL_GETCWD +/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you + don't. */ +#undef HAVE_DECL_GETC_UNLOCKED + +/* Define to 1 if you have the declaration of `getdelim', and to 0 if you + don't. */ +#undef HAVE_DECL_GETDELIM + /* Define to 1 if you have the declaration of `getdtablesize', and to 0 if you don't. */ #undef HAVE_DECL_GETDTABLESIZE +/* Define to 1 if you have the declaration of `getline', and to 0 if you + don't. */ +#undef HAVE_DECL_GETLINE + /* Define to 1 if you have the declaration of `getlogin', and to 0 if you don't. */ #undef HAVE_DECL_GETLOGIN @@ -512,6 +530,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FEATURES_H +/* Define to 1 if you have the `flockfile' function. */ +#undef HAVE_FLOCKFILE + /* Define to 1 if you have the `fnmatch' function. */ #undef HAVE_FNMATCH @@ -527,6 +548,9 @@ /* Define to 1 if you have the `fstatat' function. */ #undef HAVE_FSTATAT +/* Define to 1 if you have the `funlockfile' function. */ +#undef HAVE_FUNLOCKFILE + /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD @@ -534,6 +558,9 @@ tested with the replacement. */ #undef HAVE_GETCWD_SHORTER +/* Define to 1 if you have the `getdelim' function. */ +#undef HAVE_GETDELIM + /* Define to 1 if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE diff --git a/gnulib/configure b/gnulib/configure index d6737ac4d3e..4d6ba9ad78b 100644 --- a/gnulib/configure +++ b/gnulib/configure @@ -773,114 +773,6 @@ GNULIB_SIGPROCMASK GNULIB_SIGNAL_H_SIGPIPE GNULIB_RAISE GNULIB_PTHREAD_SIGMASK -REPLACE_VSPRINTF -REPLACE_VSNPRINTF -REPLACE_VPRINTF -REPLACE_VFPRINTF -REPLACE_VDPRINTF -REPLACE_VASPRINTF -REPLACE_TMPFILE -REPLACE_STDIO_WRITE_FUNCS -REPLACE_STDIO_READ_FUNCS -REPLACE_SPRINTF -REPLACE_SNPRINTF -REPLACE_RENAMEAT -REPLACE_RENAME -REPLACE_REMOVE -REPLACE_PRINTF -REPLACE_POPEN -REPLACE_PERROR -REPLACE_OBSTACK_PRINTF -REPLACE_GETLINE -REPLACE_GETDELIM -REPLACE_FTELLO -REPLACE_FTELL -REPLACE_FSEEKO -REPLACE_FSEEK -REPLACE_FREOPEN -REPLACE_FPURGE -REPLACE_FPRINTF -REPLACE_FOPEN -REPLACE_FFLUSH -REPLACE_FDOPEN -REPLACE_FCLOSE -REPLACE_DPRINTF -HAVE_VDPRINTF -HAVE_VASPRINTF -HAVE_RENAMEAT -HAVE_POPEN -HAVE_PCLOSE -HAVE_FTELLO -HAVE_FSEEKO -HAVE_DPRINTF -HAVE_DECL_VSNPRINTF -HAVE_DECL_SNPRINTF -HAVE_DECL_OBSTACK_PRINTF -HAVE_DECL_GETLINE -HAVE_DECL_GETDELIM -HAVE_DECL_FTELLO -HAVE_DECL_FSEEKO -HAVE_DECL_FPURGE -HAVE_DECL_FCLOSEALL -GNULIB_MDA_TEMPNAM -GNULIB_MDA_PUTW -GNULIB_MDA_GETW -GNULIB_MDA_FILENO -GNULIB_MDA_FDOPEN -GNULIB_MDA_FCLOSEALL -GNULIB_VSPRINTF_POSIX -GNULIB_VSNPRINTF -GNULIB_VPRINTF_POSIX -GNULIB_VPRINTF -GNULIB_VFPRINTF_POSIX -GNULIB_VFPRINTF -GNULIB_VDPRINTF -GNULIB_VSCANF -GNULIB_VFSCANF -GNULIB_VASPRINTF -GNULIB_TMPFILE -GNULIB_STDIO_H_SIGPIPE -GNULIB_STDIO_H_NONBLOCKING -GNULIB_SPRINTF_POSIX -GNULIB_SNPRINTF -GNULIB_SCANF -GNULIB_RENAMEAT -GNULIB_RENAME -GNULIB_REMOVE -GNULIB_PUTS -GNULIB_PUTCHAR -GNULIB_PUTC -GNULIB_PRINTF_POSIX -GNULIB_PRINTF -GNULIB_POPEN -GNULIB_PERROR -GNULIB_PCLOSE -GNULIB_OBSTACK_PRINTF_POSIX -GNULIB_OBSTACK_PRINTF -GNULIB_GETLINE -GNULIB_GETDELIM -GNULIB_GETCHAR -GNULIB_GETC -GNULIB_FWRITE -GNULIB_FTELLO -GNULIB_FTELL -GNULIB_FSEEKO -GNULIB_FSEEK -GNULIB_FSCANF -GNULIB_FREOPEN -GNULIB_FREAD -GNULIB_FPUTS -GNULIB_FPUTC -GNULIB_FPURGE -GNULIB_FPRINTF_POSIX -GNULIB_FPRINTF -GNULIB_FOPEN -GNULIB_FGETS -GNULIB_FGETC -GNULIB_FFLUSH -GNULIB_FDOPEN -GNULIB_FCLOSE -GNULIB_DPRINTF GL_GENERATE_NETINET_IN_H_FALSE GL_GENERATE_NETINET_IN_H_TRUE NETINET_IN_H @@ -1114,6 +1006,114 @@ REPLACE_GETRANDOM HAVE_GETRANDOM GNULIB_GETRANDOM LIB_GETLOGIN +REPLACE_VSPRINTF +REPLACE_VSNPRINTF +REPLACE_VPRINTF +REPLACE_VFPRINTF +REPLACE_VDPRINTF +REPLACE_VASPRINTF +REPLACE_TMPFILE +REPLACE_STDIO_WRITE_FUNCS +REPLACE_STDIO_READ_FUNCS +REPLACE_SPRINTF +REPLACE_SNPRINTF +REPLACE_RENAMEAT +REPLACE_RENAME +REPLACE_REMOVE +REPLACE_PRINTF +REPLACE_POPEN +REPLACE_PERROR +REPLACE_OBSTACK_PRINTF +REPLACE_GETLINE +REPLACE_GETDELIM +REPLACE_FTELLO +REPLACE_FTELL +REPLACE_FSEEKO +REPLACE_FSEEK +REPLACE_FREOPEN +REPLACE_FPURGE +REPLACE_FPRINTF +REPLACE_FOPEN +REPLACE_FFLUSH +REPLACE_FDOPEN +REPLACE_FCLOSE +REPLACE_DPRINTF +HAVE_VDPRINTF +HAVE_VASPRINTF +HAVE_RENAMEAT +HAVE_POPEN +HAVE_PCLOSE +HAVE_FTELLO +HAVE_FSEEKO +HAVE_DPRINTF +HAVE_DECL_VSNPRINTF +HAVE_DECL_SNPRINTF +HAVE_DECL_OBSTACK_PRINTF +HAVE_DECL_GETLINE +HAVE_DECL_GETDELIM +HAVE_DECL_FTELLO +HAVE_DECL_FSEEKO +HAVE_DECL_FPURGE +HAVE_DECL_FCLOSEALL +GNULIB_MDA_TEMPNAM +GNULIB_MDA_PUTW +GNULIB_MDA_GETW +GNULIB_MDA_FILENO +GNULIB_MDA_FDOPEN +GNULIB_MDA_FCLOSEALL +GNULIB_VSPRINTF_POSIX +GNULIB_VSNPRINTF +GNULIB_VPRINTF_POSIX +GNULIB_VPRINTF +GNULIB_VFPRINTF_POSIX +GNULIB_VFPRINTF +GNULIB_VDPRINTF +GNULIB_VSCANF +GNULIB_VFSCANF +GNULIB_VASPRINTF +GNULIB_TMPFILE +GNULIB_STDIO_H_SIGPIPE +GNULIB_STDIO_H_NONBLOCKING +GNULIB_SPRINTF_POSIX +GNULIB_SNPRINTF +GNULIB_SCANF +GNULIB_RENAMEAT +GNULIB_RENAME +GNULIB_REMOVE +GNULIB_PUTS +GNULIB_PUTCHAR +GNULIB_PUTC +GNULIB_PRINTF_POSIX +GNULIB_PRINTF +GNULIB_POPEN +GNULIB_PERROR +GNULIB_PCLOSE +GNULIB_OBSTACK_PRINTF_POSIX +GNULIB_OBSTACK_PRINTF +GNULIB_GETLINE +GNULIB_GETDELIM +GNULIB_GETCHAR +GNULIB_GETC +GNULIB_FWRITE +GNULIB_FTELLO +GNULIB_FTELL +GNULIB_FSEEKO +GNULIB_FSEEK +GNULIB_FSCANF +GNULIB_FREOPEN +GNULIB_FREAD +GNULIB_FPUTS +GNULIB_FPUTC +GNULIB_FPURGE +GNULIB_FPRINTF_POSIX +GNULIB_FPRINTF +GNULIB_FOPEN +GNULIB_FGETS +GNULIB_FGETC +GNULIB_FFLUSH +GNULIB_FDOPEN +GNULIB_FCLOSE +GNULIB_DPRINTF WINDOWS_64_BIT_ST_SIZE WINDOWS_STAT_TIMESPEC NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H @@ -3731,6 +3731,7 @@ as_fn_append ac_func_list " mbsrtowcs" gl_fnmatch_required=GNU as_fn_append ac_header_list " sys/stat.h" as_fn_append ac_func_list " fstatat" +as_fn_append ac_func_list " getdelim" as_fn_append ac_func_list " getdtablesize" as_fn_append ac_func_list " getlogin_r" as_fn_append ac_func_list " getprogname" @@ -6720,7 +6721,9 @@ fi # Code from module fstatat: # Code from module getcwd: # Code from module getcwd-lgpl: + # Code from module getdelim: # Code from module getdtablesize: + # Code from module getline: # Code from module getlogin_r: # Code from module getprogname: # Code from module getrandom: @@ -10548,6 +10551,129 @@ cat >>confdefs.h <<_ACEOF _ACEOF + GNULIB_DPRINTF=0; + GNULIB_FCLOSE=0; + GNULIB_FDOPEN=0; + GNULIB_FFLUSH=0; + GNULIB_FGETC=0; + GNULIB_FGETS=0; + GNULIB_FOPEN=0; + GNULIB_FPRINTF=0; + GNULIB_FPRINTF_POSIX=0; + GNULIB_FPURGE=0; + GNULIB_FPUTC=0; + GNULIB_FPUTS=0; + GNULIB_FREAD=0; + GNULIB_FREOPEN=0; + GNULIB_FSCANF=0; + GNULIB_FSEEK=0; + GNULIB_FSEEKO=0; + GNULIB_FTELL=0; + GNULIB_FTELLO=0; + GNULIB_FWRITE=0; + GNULIB_GETC=0; + GNULIB_GETCHAR=0; + GNULIB_GETDELIM=0; + GNULIB_GETLINE=0; + GNULIB_OBSTACK_PRINTF=0; + GNULIB_OBSTACK_PRINTF_POSIX=0; + GNULIB_PCLOSE=0; + GNULIB_PERROR=0; + GNULIB_POPEN=0; + GNULIB_PRINTF=0; + GNULIB_PRINTF_POSIX=0; + GNULIB_PUTC=0; + GNULIB_PUTCHAR=0; + GNULIB_PUTS=0; + GNULIB_REMOVE=0; + GNULIB_RENAME=0; + GNULIB_RENAMEAT=0; + GNULIB_SCANF=0; + GNULIB_SNPRINTF=0; + GNULIB_SPRINTF_POSIX=0; + GNULIB_STDIO_H_NONBLOCKING=0; + GNULIB_STDIO_H_SIGPIPE=0; + GNULIB_TMPFILE=0; + GNULIB_VASPRINTF=0; + GNULIB_VFSCANF=0; + GNULIB_VSCANF=0; + GNULIB_VDPRINTF=0; + GNULIB_VFPRINTF=0; + GNULIB_VFPRINTF_POSIX=0; + GNULIB_VPRINTF=0; + GNULIB_VPRINTF_POSIX=0; + GNULIB_VSNPRINTF=0; + GNULIB_VSPRINTF_POSIX=0; + GNULIB_MDA_FCLOSEALL=1; + GNULIB_MDA_FDOPEN=1; + GNULIB_MDA_FILENO=1; + GNULIB_MDA_GETW=1; + GNULIB_MDA_PUTW=1; + GNULIB_MDA_TEMPNAM=1; + HAVE_DECL_FCLOSEALL=1; + HAVE_DECL_FPURGE=1; + HAVE_DECL_FSEEKO=1; + HAVE_DECL_FTELLO=1; + HAVE_DECL_GETDELIM=1; + HAVE_DECL_GETLINE=1; + HAVE_DECL_OBSTACK_PRINTF=1; + HAVE_DECL_SNPRINTF=1; + HAVE_DECL_VSNPRINTF=1; + HAVE_DPRINTF=1; + HAVE_FSEEKO=1; + HAVE_FTELLO=1; + HAVE_PCLOSE=1; + HAVE_POPEN=1; + HAVE_RENAMEAT=1; + HAVE_VASPRINTF=1; + HAVE_VDPRINTF=1; + REPLACE_DPRINTF=0; + REPLACE_FCLOSE=0; + REPLACE_FDOPEN=0; + REPLACE_FFLUSH=0; + REPLACE_FOPEN=0; + REPLACE_FPRINTF=0; + REPLACE_FPURGE=0; + REPLACE_FREOPEN=0; + REPLACE_FSEEK=0; + REPLACE_FSEEKO=0; + REPLACE_FTELL=0; + REPLACE_FTELLO=0; + REPLACE_GETDELIM=0; + REPLACE_GETLINE=0; + REPLACE_OBSTACK_PRINTF=0; + REPLACE_PERROR=0; + REPLACE_POPEN=0; + REPLACE_PRINTF=0; + REPLACE_REMOVE=0; + REPLACE_RENAME=0; + REPLACE_RENAMEAT=0; + REPLACE_SNPRINTF=0; + REPLACE_SPRINTF=0; + REPLACE_STDIO_READ_FUNCS=0; + REPLACE_STDIO_WRITE_FUNCS=0; + REPLACE_TMPFILE=0; + REPLACE_VASPRINTF=0; + REPLACE_VDPRINTF=0; + REPLACE_VFPRINTF=0; + REPLACE_VPRINTF=0; + REPLACE_VSNPRINTF=0; + REPLACE_VSPRINTF=0; + +ac_fn_c_check_decl "$LINENO" "getdelim" "ac_cv_have_decl_getdelim" "$ac_includes_default" +if test "x$ac_cv_have_decl_getdelim" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETDELIM $ac_have_decl +_ACEOF + + + + ac_fn_c_check_decl "$LINENO" "getdtablesize" "ac_cv_have_decl_getdtablesize" "$ac_includes_default" if test "x$ac_cv_have_decl_getdtablesize" = xyes; then : @@ -10560,6 +10686,17 @@ cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETDTABLESIZE $ac_have_decl _ACEOF +ac_fn_c_check_decl "$LINENO" "getline" "ac_cv_have_decl_getline" "$ac_includes_default" +if test "x$ac_cv_have_decl_getline" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETLINE $ac_have_decl +_ACEOF + ac_fn_c_check_decl "$LINENO" "getlogin_r" "ac_cv_have_decl_getlogin_r" "$ac_includes_default" if test "x$ac_cv_have_decl_getlogin_r" = xyes; then : ac_have_decl=1 @@ -15962,116 +16099,6 @@ _ACEOF - GNULIB_DPRINTF=0; - GNULIB_FCLOSE=0; - GNULIB_FDOPEN=0; - GNULIB_FFLUSH=0; - GNULIB_FGETC=0; - GNULIB_FGETS=0; - GNULIB_FOPEN=0; - GNULIB_FPRINTF=0; - GNULIB_FPRINTF_POSIX=0; - GNULIB_FPURGE=0; - GNULIB_FPUTC=0; - GNULIB_FPUTS=0; - GNULIB_FREAD=0; - GNULIB_FREOPEN=0; - GNULIB_FSCANF=0; - GNULIB_FSEEK=0; - GNULIB_FSEEKO=0; - GNULIB_FTELL=0; - GNULIB_FTELLO=0; - GNULIB_FWRITE=0; - GNULIB_GETC=0; - GNULIB_GETCHAR=0; - GNULIB_GETDELIM=0; - GNULIB_GETLINE=0; - GNULIB_OBSTACK_PRINTF=0; - GNULIB_OBSTACK_PRINTF_POSIX=0; - GNULIB_PCLOSE=0; - GNULIB_PERROR=0; - GNULIB_POPEN=0; - GNULIB_PRINTF=0; - GNULIB_PRINTF_POSIX=0; - GNULIB_PUTC=0; - GNULIB_PUTCHAR=0; - GNULIB_PUTS=0; - GNULIB_REMOVE=0; - GNULIB_RENAME=0; - GNULIB_RENAMEAT=0; - GNULIB_SCANF=0; - GNULIB_SNPRINTF=0; - GNULIB_SPRINTF_POSIX=0; - GNULIB_STDIO_H_NONBLOCKING=0; - GNULIB_STDIO_H_SIGPIPE=0; - GNULIB_TMPFILE=0; - GNULIB_VASPRINTF=0; - GNULIB_VFSCANF=0; - GNULIB_VSCANF=0; - GNULIB_VDPRINTF=0; - GNULIB_VFPRINTF=0; - GNULIB_VFPRINTF_POSIX=0; - GNULIB_VPRINTF=0; - GNULIB_VPRINTF_POSIX=0; - GNULIB_VSNPRINTF=0; - GNULIB_VSPRINTF_POSIX=0; - GNULIB_MDA_FCLOSEALL=1; - GNULIB_MDA_FDOPEN=1; - GNULIB_MDA_FILENO=1; - GNULIB_MDA_GETW=1; - GNULIB_MDA_PUTW=1; - GNULIB_MDA_TEMPNAM=1; - HAVE_DECL_FCLOSEALL=1; - HAVE_DECL_FPURGE=1; - HAVE_DECL_FSEEKO=1; - HAVE_DECL_FTELLO=1; - HAVE_DECL_GETDELIM=1; - HAVE_DECL_GETLINE=1; - HAVE_DECL_OBSTACK_PRINTF=1; - HAVE_DECL_SNPRINTF=1; - HAVE_DECL_VSNPRINTF=1; - HAVE_DPRINTF=1; - HAVE_FSEEKO=1; - HAVE_FTELLO=1; - HAVE_PCLOSE=1; - HAVE_POPEN=1; - HAVE_RENAMEAT=1; - HAVE_VASPRINTF=1; - HAVE_VDPRINTF=1; - REPLACE_DPRINTF=0; - REPLACE_FCLOSE=0; - REPLACE_FDOPEN=0; - REPLACE_FFLUSH=0; - REPLACE_FOPEN=0; - REPLACE_FPRINTF=0; - REPLACE_FPURGE=0; - REPLACE_FREOPEN=0; - REPLACE_FSEEK=0; - REPLACE_FSEEKO=0; - REPLACE_FTELL=0; - REPLACE_FTELLO=0; - REPLACE_GETDELIM=0; - REPLACE_GETLINE=0; - REPLACE_OBSTACK_PRINTF=0; - REPLACE_PERROR=0; - REPLACE_POPEN=0; - REPLACE_PRINTF=0; - REPLACE_REMOVE=0; - REPLACE_RENAME=0; - REPLACE_RENAMEAT=0; - REPLACE_SNPRINTF=0; - REPLACE_SPRINTF=0; - REPLACE_STDIO_READ_FUNCS=0; - REPLACE_STDIO_WRITE_FUNCS=0; - REPLACE_TMPFILE=0; - REPLACE_VASPRINTF=0; - REPLACE_VDPRINTF=0; - REPLACE_VFPRINTF=0; - REPLACE_VPRINTF=0; - REPLACE_VSNPRINTF=0; - REPLACE_VSPRINTF=0; - - ac_fn_c_check_decl "$LINENO" "setenv" "ac_cv_have_decl_setenv" "$ac_includes_default" if test "x$ac_cv_have_decl_setenv" = xyes; then : @@ -20705,6 +20732,160 @@ $as_echo "#define GNULIB_TEST_GETCWD 1" >>confdefs.h + + + + if test $ac_cv_func_getdelim = yes; then + HAVE_GETDELIM=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working getdelim function" >&5 +$as_echo_n "checking for working getdelim function... " >&6; } +if ${gl_cv_func_working_getdelim+:} false; then : + $as_echo_n "(cached) " >&6 +else + echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ + Lucky GNU user + #endif +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky GNU user" >/dev/null 2>&1; then : + gl_cv_func_working_getdelim="guessing yes" +else + case "$host_os" in + *-musl*) gl_cv_func_working_getdelim="guessing yes" ;; + *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; + esac + +fi +rm -f conftest* + + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# include +# include +# include + int main () + { + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + { + /* Test result for a NULL buffer and a zero size. + Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len = getdelim (&line, &siz, '\n', in); + if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) + { free (line); fclose (in); return 2; } + free (line); + } + { + /* Test result for a NULL buffer and a non-zero size. + This crashes on FreeBSD 8.0. */ + char *line = NULL; + size_t siz = (size_t)(~0) / 4; + if (getdelim (&line, &siz, '\n', in) == -1) + { fclose (in); return 3; } + free (line); + } + fclose (in); + return 0; + } + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_working_getdelim=yes +else + gl_cv_func_working_getdelim=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_getdelim" >&5 +$as_echo "$gl_cv_func_working_getdelim" >&6; } + case "$gl_cv_func_working_getdelim" in + *yes) ;; + *) REPLACE_GETDELIM=1 ;; + esac + else + HAVE_GETDELIM=0 + fi + + if test $ac_cv_have_decl_getdelim = no; then + HAVE_DECL_GETDELIM=0 + fi + + if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS getdelim.$ac_objext" + + + for ac_func in flockfile funlockfile +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + ac_fn_c_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default" +if test "x$ac_cv_have_decl_getc_unlocked" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETC_UNLOCKED $ac_have_decl +_ACEOF + + + fi + + + + + + GNULIB_GETDELIM=1 + + + + + +$as_echo "#define GNULIB_TEST_GETDELIM 1" >>confdefs.h + + + + + + + + if test $ac_cv_func_getdtablesize = yes && test $ac_cv_have_decl_getdtablesize = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getdtablesize works" >&5 @@ -20802,6 +20983,145 @@ $as_echo "#define GNULIB_TEST_GETDTABLESIZE 1" >>confdefs.h + + gl_getline_needs_run_time_check=no + ac_fn_c_check_func "$LINENO" "getline" "ac_cv_func_getline" +if test "x$ac_cv_func_getline" = xyes; then : + gl_getline_needs_run_time_check=yes +else + am_cv_func_working_getline=no +fi + + if test $gl_getline_needs_run_time_check = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working getline function" >&5 +$as_echo_n "checking for working getline function... " >&6; } +if ${am_cv_func_working_getline+:} false; then : + $as_echo_n "(cached) " >&6 +else + echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ + Lucky GNU user + #endif +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Lucky GNU user" >/dev/null 2>&1; then : + am_cv_func_working_getline="guessing yes" +else + case "$host_os" in + *-musl*) am_cv_func_working_getline="guessing yes" ;; + *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; + esac + +fi +rm -f conftest* + + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# include +# include +# include + int main () + { + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + { + /* Test result for a NULL buffer and a zero size. + Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len = getline (&line, &siz, in); + if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) + { free (line); fclose (in); return 2; } + free (line); + } + { + /* Test result for a NULL buffer and a non-zero size. + This crashes on FreeBSD 8.0. */ + char *line = NULL; + size_t siz = (size_t)(~0) / 4; + if (getline (&line, &siz, in) == -1) + { fclose (in); return 3; } + free (line); + } + fclose (in); + return 0; + } + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + am_cv_func_working_getline=yes +else + am_cv_func_working_getline=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_working_getline" >&5 +$as_echo "$am_cv_func_working_getline" >&6; } + fi + + if test $ac_cv_have_decl_getline = no; then + HAVE_DECL_GETLINE=0 + fi + + case "$am_cv_func_working_getline" in + *yes) ;; + *) + REPLACE_GETLINE=1 + ;; + esac + + if test $REPLACE_GETLINE = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS getline.$ac_objext" + + + : + + fi + + + + + + GNULIB_GETLINE=1 + + + + + +$as_echo "#define GNULIB_TEST_GETLINE 1" >>confdefs.h + + + + + + + + + if test $ac_cv_have_decl_getlogin_r = no; then HAVE_DECL_GETLOGIN_R=0 fi diff --git a/gnulib/import/Makefile.am b/gnulib/import/Makefile.am index a79d6e1e537..83aff17a793 100644 --- a/gnulib/import/Makefile.am +++ b/gnulib/import/Makefile.am @@ -42,6 +42,7 @@ # fnmatch-gnu \ # frexpl \ # getcwd \ +# getline \ # gettimeofday \ # gitlog-to-changelog \ # glob \ @@ -691,6 +692,15 @@ EXTRA_libgnu_a_SOURCES += getcwd-lgpl.c ## end gnulib module getcwd-lgpl +## begin gnulib module getdelim + + +EXTRA_DIST += getdelim.c + +EXTRA_libgnu_a_SOURCES += getdelim.c + +## end gnulib module getdelim + ## begin gnulib module getdtablesize @@ -700,6 +710,15 @@ EXTRA_libgnu_a_SOURCES += getdtablesize.c ## end gnulib module getdtablesize +## begin gnulib module getline + + +EXTRA_DIST += getline.c + +EXTRA_libgnu_a_SOURCES += getline.c + +## end gnulib module getline + ## begin gnulib module getlogin_r diff --git a/gnulib/import/Makefile.in b/gnulib/import/Makefile.in index f703f362f73..60004ac1339 100644 --- a/gnulib/import/Makefile.in +++ b/gnulib/import/Makefile.in @@ -56,6 +56,7 @@ # fnmatch-gnu \ # frexpl \ # getcwd \ +# getline \ # gettimeofday \ # gitlog-to-changelog \ # glob \ @@ -217,7 +218,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/import/m4/getcwd-abort-bug.m4 \ $(top_srcdir)/import/m4/getcwd-path-max.m4 \ $(top_srcdir)/import/m4/getcwd.m4 \ + $(top_srcdir)/import/m4/getdelim.m4 \ $(top_srcdir)/import/m4/getdtablesize.m4 \ + $(top_srcdir)/import/m4/getline.m4 \ $(top_srcdir)/import/m4/getlogin.m4 \ $(top_srcdir)/import/m4/getlogin_r.m4 \ $(top_srcdir)/import/m4/getpagesize.m4 \ @@ -1781,10 +1784,10 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.c alloca.in.h arpa_inet.in.h \ filenamecat.h flexmember.h float.c float.in.h itold.c \ fnmatch.c fnmatch_loop.c fnmatch.c fnmatch.in.h fpucw.h free.c \ frexp.c frexp.c frexpl.c fstat.c stat-w32.c stat-w32.h \ - at-func.c fstatat.c getcwd.c getcwd-lgpl.c getdtablesize.c \ - getlogin_r.c getrandom.c gettimeofday.c \ - $(top_srcdir)/import/extra/gitlog-to-changelog glob.c \ - glob_internal.h glob_pattern_p.c globfree.c glob-libc.h \ + at-func.c fstatat.c getcwd.c getcwd-lgpl.c getdelim.c \ + getdtablesize.c getline.c getlogin_r.c getrandom.c \ + gettimeofday.c $(top_srcdir)/import/extra/gitlog-to-changelog \ + glob.c glob_internal.h glob_pattern_p.c globfree.c glob-libc.h \ glob.in.h hard-locale.h inet_ntop.c intprops.h inttypes.in.h \ isblank.c float+.h isnan.c isnand-nolibm.h isnand.c float+.h \ isnan.c isnanl-nolibm.h isnanl.c cdefs.h libc-config.h \ @@ -1864,9 +1867,9 @@ EXTRA_libgnu_a_SOURCES = alloca.c btowc.c canonicalize-lgpl.c \ fchdir.c fcntl.c fdopendir.c float.c itold.c fnmatch.c \ fnmatch_loop.c fnmatch.c free.c frexp.c frexp.c frexpl.c \ fstat.c stat-w32.c at-func.c fstatat.c getcwd.c getcwd-lgpl.c \ - getdtablesize.c getlogin_r.c getrandom.c gettimeofday.c glob.c \ - glob_pattern_p.c globfree.c inet_ntop.c isblank.c isnan.c \ - isnand.c isnan.c isnanl.c lstat.c malloc.c \ + getdelim.c getdtablesize.c getline.c getlogin_r.c getrandom.c \ + gettimeofday.c glob.c glob_pattern_p.c globfree.c inet_ntop.c \ + isblank.c isnan.c isnand.c isnan.c isnanl.c lstat.c malloc.c \ lc-charset-dispatch.c mbrtowc.c mbtowc-lock.c mbsinit.c \ mbsrtowcs-state.c mbsrtowcs.c mbtowc.c memchr.c memmem.c \ memmem.c mempcpy.c memrchr.c mkdir.c mkdtemp.c mkostemp.c \ @@ -2023,7 +2026,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstatat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcwd-lgpl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcwd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdelim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdtablesize.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getlogin_r.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getprogname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getrandom.Po@am__quote@ diff --git a/gnulib/import/getdelim.c b/gnulib/import/getdelim.c new file mode 100644 index 00000000000..4bebc004da2 --- /dev/null +++ b/gnulib/import/getdelim.c @@ -0,0 +1,147 @@ +/* getdelim.c --- Implementation of replacement getdelim function. + Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2021 Free Software + Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +/* Ported from glibc by Simon Josefsson. */ + +/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc + optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */ +#define _GL_ARG_NONNULL(params) + +#include + +#include + +#include +#include +#include +#include + +#ifndef SSIZE_MAX +# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) +#endif + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +# define getc_maybe_unlocked(fp) getc(fp) +#elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED +# undef flockfile +# undef funlockfile +# define flockfile(x) ((void) 0) +# define funlockfile(x) ((void) 0) +# define getc_maybe_unlocked(fp) getc(fp) +#else +# define getc_maybe_unlocked(fp) getc_unlocked(fp) +#endif + +static void +alloc_failed (void) +{ +#if defined _WIN32 && ! defined __CYGWIN__ + /* Avoid errno problem without using the realloc module; see: + https://lists.gnu.org/r/bug-gnulib/2016-08/msg00025.html */ + errno = ENOMEM; +#endif +} + +/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and + NUL-terminate it). *LINEPTR is a pointer returned from malloc (or + NULL), pointing to *N characters of space. It is realloc'ed as + necessary. Returns the number of characters read (not including + the null terminator), or -1 on error or EOF. */ + +ssize_t +getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp) +{ + ssize_t result; + size_t cur_len = 0; + + if (lineptr == NULL || n == NULL || fp == NULL) + { + errno = EINVAL; + return -1; + } + + flockfile (fp); + + if (*lineptr == NULL || *n == 0) + { + char *new_lineptr; + *n = 120; + new_lineptr = (char *) realloc (*lineptr, *n); + if (new_lineptr == NULL) + { + alloc_failed (); + result = -1; + goto unlock_return; + } + *lineptr = new_lineptr; + } + + for (;;) + { + int i; + + i = getc_maybe_unlocked (fp); + if (i == EOF) + { + result = -1; + break; + } + + /* Make enough space for len+1 (for final NUL) bytes. */ + if (cur_len + 1 >= *n) + { + size_t needed_max = + SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX; + size_t needed = 2 * *n + 1; /* Be generous. */ + char *new_lineptr; + + if (needed_max < needed) + needed = needed_max; + if (cur_len + 1 >= needed) + { + result = -1; + errno = EOVERFLOW; + goto unlock_return; + } + + new_lineptr = (char *) realloc (*lineptr, needed); + if (new_lineptr == NULL) + { + alloc_failed (); + result = -1; + goto unlock_return; + } + + *lineptr = new_lineptr; + *n = needed; + } + + (*lineptr)[cur_len] = i; + cur_len++; + + if (i == delimiter) + break; + } + (*lineptr)[cur_len] = '\0'; + result = cur_len ? cur_len : result; + + unlock_return: + funlockfile (fp); /* doesn't set errno */ + + return result; +} diff --git a/gnulib/import/getline.c b/gnulib/import/getline.c new file mode 100644 index 00000000000..a72cb180449 --- /dev/null +++ b/gnulib/import/getline.c @@ -0,0 +1,27 @@ +/* getline.c --- Implementation of replacement getline function. + Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 3, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . */ + +/* Written by Simon Josefsson. */ + +#include + +#include + +ssize_t +getline (char **lineptr, size_t *n, FILE *stream) +{ + return getdelim (lineptr, n, '\n', stream); +} diff --git a/gnulib/import/m4/getdelim.m4 b/gnulib/import/m4/getdelim.m4 new file mode 100644 index 00000000000..244a7319254 --- /dev/null +++ b/gnulib/import/m4/getdelim.m4 @@ -0,0 +1,99 @@ +# getdelim.m4 serial 15 + +dnl Copyright (C) 2005-2007, 2009-2021 Free Software Foundation, Inc. +dnl +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_PREREQ([2.59]) + +AC_DEFUN([gl_FUNC_GETDELIM], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Persuade glibc to declare getdelim(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_DECLS_ONCE([getdelim]) + + AC_CHECK_FUNCS_ONCE([getdelim]) + if test $ac_cv_func_getdelim = yes; then + HAVE_GETDELIM=1 + dnl Found it in some library. Verify that it works. + AC_CACHE_CHECK([for working getdelim function], + [gl_cv_func_working_getdelim], + [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +# include +# include +# include + int main () + { + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + { + /* Test result for a NULL buffer and a zero size. + Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len = getdelim (&line, &siz, '\n', in); + if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) + { free (line); fclose (in); return 2; } + free (line); + } + { + /* Test result for a NULL buffer and a non-zero size. + This crashes on FreeBSD 8.0. */ + char *line = NULL; + size_t siz = (size_t)(~0) / 4; + if (getdelim (&line, &siz, '\n', in) == -1) + { fclose (in); return 3; } + free (line); + } + fclose (in); + return 0; + } + ]])], + [gl_cv_func_working_getdelim=yes], + [gl_cv_func_working_getdelim=no], + [dnl We're cross compiling. + dnl Guess it works on glibc2 systems and musl systems. + AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ + Lucky GNU user + #endif +#endif + ], + [gl_cv_func_working_getdelim="guessing yes"], + [case "$host_os" in + *-musl*) gl_cv_func_working_getdelim="guessing yes" ;; + *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; + esac + ]) + ]) + ]) + case "$gl_cv_func_working_getdelim" in + *yes) ;; + *) REPLACE_GETDELIM=1 ;; + esac + else + HAVE_GETDELIM=0 + fi + + if test $ac_cv_have_decl_getdelim = no; then + HAVE_DECL_GETDELIM=0 + fi +]) + +# Prerequisites of lib/getdelim.c. +AC_DEFUN([gl_PREREQ_GETDELIM], +[ + AC_CHECK_FUNCS([flockfile funlockfile]) + AC_CHECK_DECLS([getc_unlocked]) +]) diff --git a/gnulib/import/m4/getline.m4 b/gnulib/import/m4/getline.m4 new file mode 100644 index 00000000000..58b27c73f0f --- /dev/null +++ b/gnulib/import/m4/getline.m4 @@ -0,0 +1,109 @@ +# getline.m4 serial 30 + +dnl Copyright (C) 1998-2003, 2005-2007, 2009-2021 Free Software Foundation, +dnl Inc. +dnl +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_PREREQ([2.59]) + +dnl See if there's a working, system-supplied version of the getline function. +dnl We can't just do AC_REPLACE_FUNCS([getline]) because some systems +dnl have a function by that name in -linet that doesn't have anything +dnl to do with the function we need. +AC_DEFUN([gl_FUNC_GETLINE], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Persuade glibc to declare getline(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_DECLS_ONCE([getline]) + + gl_getline_needs_run_time_check=no + AC_CHECK_FUNC([getline], + [dnl Found it in some library. Verify that it works. + gl_getline_needs_run_time_check=yes], + [am_cv_func_working_getline=no]) + if test $gl_getline_needs_run_time_check = yes; then + AC_CACHE_CHECK([for working getline function], + [am_cv_func_working_getline], + [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +# include +# include +# include + int main () + { + FILE *in = fopen ("./conftest.data", "r"); + if (!in) + return 1; + { + /* Test result for a NULL buffer and a zero size. + Based on a test program from Karl Heuer. */ + char *line = NULL; + size_t siz = 0; + int len = getline (&line, &siz, in); + if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) + { free (line); fclose (in); return 2; } + free (line); + } + { + /* Test result for a NULL buffer and a non-zero size. + This crashes on FreeBSD 8.0. */ + char *line = NULL; + size_t siz = (size_t)(~0) / 4; + if (getline (&line, &siz, in) == -1) + { fclose (in); return 3; } + free (line); + } + fclose (in); + return 0; + } + ]])], + [am_cv_func_working_getline=yes], + [am_cv_func_working_getline=no], + [dnl We're cross compiling. + dnl Guess it works on glibc2 systems and musl systems. + AC_EGREP_CPP([Lucky GNU user], + [ +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ + Lucky GNU user + #endif +#endif + ], + [am_cv_func_working_getline="guessing yes"], + [case "$host_os" in + *-musl*) am_cv_func_working_getline="guessing yes" ;; + *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; + esac + ]) + ]) + ]) + fi + + if test $ac_cv_have_decl_getline = no; then + HAVE_DECL_GETLINE=0 + fi + + case "$am_cv_func_working_getline" in + *yes) ;; + *) + dnl Set REPLACE_GETLINE always: Even if we have not found the broken + dnl getline function among $LIBS, it may exist in libinet and the + dnl executable may be linked with -linet. + REPLACE_GETLINE=1 + ;; + esac +]) + +# Prerequisites of lib/getline.c. +AC_DEFUN([gl_PREREQ_GETLINE], +[ + : +]) diff --git a/gnulib/import/m4/gnulib-cache.m4 b/gnulib/import/m4/gnulib-cache.m4 index 00dcf604059..6481bde894e 100644 --- a/gnulib/import/m4/gnulib-cache.m4 +++ b/gnulib/import/m4/gnulib-cache.m4 @@ -47,6 +47,7 @@ # fnmatch-gnu \ # frexpl \ # getcwd \ +# getline \ # gettimeofday \ # gitlog-to-changelog \ # glob \ @@ -89,6 +90,7 @@ gl_MODULES([ fnmatch-gnu frexpl getcwd + getline gettimeofday gitlog-to-changelog glob diff --git a/gnulib/import/m4/gnulib-comp.m4 b/gnulib/import/m4/gnulib-comp.m4 index c3926e0d06d..ab4f5f9a0b0 100644 --- a/gnulib/import/m4/gnulib-comp.m4 +++ b/gnulib/import/m4/gnulib-comp.m4 @@ -101,7 +101,9 @@ AC_DEFUN([gl_EARLY], # Code from module fstatat: # Code from module getcwd: # Code from module getcwd-lgpl: + # Code from module getdelim: # Code from module getdtablesize: + # Code from module getline: # Code from module getlogin_r: # Code from module getprogname: # Code from module getrandom: @@ -392,12 +394,24 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([getcwd-lgpl]) fi gl_UNISTD_MODULE_INDICATOR([getcwd]) + gl_FUNC_GETDELIM + if test $HAVE_GETDELIM = 0 || test $REPLACE_GETDELIM = 1; then + AC_LIBOBJ([getdelim]) + gl_PREREQ_GETDELIM + fi + gl_STDIO_MODULE_INDICATOR([getdelim]) gl_FUNC_GETDTABLESIZE if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then AC_LIBOBJ([getdtablesize]) gl_PREREQ_GETDTABLESIZE fi gl_UNISTD_MODULE_INDICATOR([getdtablesize]) + gl_FUNC_GETLINE + if test $REPLACE_GETLINE = 1; then + AC_LIBOBJ([getline]) + gl_PREREQ_GETLINE + fi + gl_STDIO_MODULE_INDICATOR([getline]) gl_FUNC_GETLOGIN_R if test $HAVE_GETLOGIN_R = 0 || test $REPLACE_GETLOGIN_R = 1; then AC_LIBOBJ([getlogin_r]) @@ -990,7 +1004,9 @@ AC_DEFUN([gl_FILE_LIST], [ lib/fstatat.c lib/getcwd-lgpl.c lib/getcwd.c + lib/getdelim.c lib/getdtablesize.c + lib/getline.c lib/getlogin_r.c lib/getprogname.c lib/getprogname.h @@ -1198,7 +1214,9 @@ AC_DEFUN([gl_FILE_LIST], [ m4/getcwd-abort-bug.m4 m4/getcwd-path-max.m4 m4/getcwd.m4 + m4/getdelim.m4 m4/getdtablesize.m4 + m4/getline.m4 m4/getlogin.m4 m4/getlogin_r.m4 m4/getpagesize.m4 diff --git a/gnulib/update-gnulib.sh b/gnulib/update-gnulib.sh index c734829126f..1950bec6f51 100755 --- a/gnulib/update-gnulib.sh +++ b/gnulib/update-gnulib.sh @@ -39,6 +39,7 @@ IMPORTED_GNULIB_MODULES="\ fnmatch-gnu \ frexpl \ getcwd \ + getline \ gettimeofday \ gitlog-to-changelog \ glob \