diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2026-02-13 17:37:50 -0800 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2026-02-13 17:44:46 -0800 |
| commit | f81d3a4882ea499a9a36ae7f277d7745e7c09928 (patch) | |
| tree | 213eac6d1ad6dcaf7e73c487c170d37a99744ac6 /m4 | |
| parent | a937396e7626a2a217e747aa1320d669f2323032 (diff) | |
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'm4')
| -rw-r--r-- | m4/getdelim.m4 | 43 | ||||
| -rw-r--r-- | m4/getline.m4 | 43 | ||||
| -rw-r--r-- | m4/selinux-selinux-h.m4 | 14 |
3 files changed, 46 insertions, 54 deletions
diff --git a/m4/getdelim.m4 b/m4/getdelim.m4 index 8b6eff47aa2..736c4e8b2eb 100644 --- a/m4/getdelim.m4 +++ b/m4/getdelim.m4 @@ -1,5 +1,5 @@ # getdelim.m4 -# serial 21 +# serial 22 dnl Copyright (C) 2005-2007, 2009-2026 Free Software Foundation, Inc. dnl @@ -37,7 +37,6 @@ AC_DEFUN([gl_FUNC_GETDELIM], gl_cv_func_working_getdelim=no ;; *) echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data - touch conftest.empty AC_RUN_IFELSE([AC_LANG_SOURCE([[ # include <stdio.h> # include <stdlib.h> @@ -68,36 +67,32 @@ AC_DEFUN([gl_FUNC_GETDELIM], free (line); } fclose (in); - { - /* Test that reading EOF as the first character sets the first byte - in the buffer to NUL. This fails on glibc 2.42 and earlier. */ - in = fopen ("./conftest.empty", "r"); - if (!in) - return 1; - char *line = malloc (1); - line[0] = 'A'; - size_t siz = 1; - if (getdelim (&line, &siz, '\n', in) != -1 || line[0] != '\0') - result |= 8; - free (line); - } - fclose (in); return result; } ]])], [gl_cv_func_working_getdelim=yes], [gl_cv_func_working_getdelim=no], - [case "$host_os" in - # Guess yes on musl. - *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;; - # Guess no on glibc. - *-gnu* | gnu*) gl_cv_func_working_getdelim="guessing no" ;; - *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; - esac + [dnl We're cross compiling. + dnl Guess it works on glibc2 systems and musl systems. + AC_EGREP_CPP([Lucky GNU user], + [ +#include <features.h> +#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* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;; + *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; + esac + ]) ]) ;; esac - rm -f conftest.data conftest.empty + rm -f conftest.data ]) case "$gl_cv_func_working_getdelim" in *yes) ;; diff --git a/m4/getline.m4 b/m4/getline.m4 index ed32fa10bfb..25539dc20c3 100644 --- a/m4/getline.m4 +++ b/m4/getline.m4 @@ -1,5 +1,5 @@ # getline.m4 -# serial 35 +# serial 36 dnl Copyright (C) 1998-2003, 2005-2007, 2009-2026 Free Software Foundation, dnl Inc. @@ -31,7 +31,6 @@ AC_DEFUN([gl_FUNC_GETLINE], AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline], [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data - touch conftest.empty AC_RUN_IFELSE([AC_LANG_SOURCE([[ # include <stdio.h> # include <stdlib.h> @@ -62,34 +61,30 @@ AC_DEFUN([gl_FUNC_GETLINE], free (line); } fclose (in); - { - /* Test that reading EOF as the first character sets the first byte - in the buffer to NUL. This fails on glibc 2.42 and earlier. */ - in = fopen ("./conftest.empty", "r"); - if (!in) - return 1; - char *line = malloc (1); - line[0] = 'A'; - size_t siz = 1; - if (getline (&line, &siz, in) != -1 || line[0] != '\0') - result |= 8; - free (line); - } - fclose (in); return result; } ]])], [am_cv_func_working_getline=yes], [am_cv_func_working_getline=no], - [case "$host_os" in - # Guess yes on musl. - *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;; - # Guess no on glibc. - *-gnu* | gnu*) am_cv_func_working_getline="guessing no" ;; - *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; - esac + [dnl We're cross compiling. + dnl Guess it works on glibc2 systems and musl systems. + AC_EGREP_CPP([Lucky GNU user], + [ +#include <features.h> +#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* | midipix*) am_cv_func_working_getline="guessing yes" ;; + *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; + esac + ]) ]) - rm -f conftest.data conftest.empty + rm -f conftest.data ]) else am_cv_func_working_getline=no diff --git a/m4/selinux-selinux-h.m4 b/m4/selinux-selinux-h.m4 index b3fcd2102e2..c964ced0728 100644 --- a/m4/selinux-selinux-h.m4 +++ b/m4/selinux-selinux-h.m4 @@ -1,5 +1,5 @@ # selinux-selinux-h.m4 -# serial 10 -*- Autoconf -*- +# serial 12 -*- Autoconf -*- dnl Copyright (C) 2006-2007, 2009-2026 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -49,7 +49,7 @@ AC_DEFUN([gl_CHECK_HEADER_SELINUX_SELINUX_H], USE_SELINUX_SELINUX_H=0 fi - case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in + case "$ac_cv_search_getfilecon_raw:$ac_cv_header_selinux_selinux_h" in no:*) # already warned ;; *:no) @@ -79,15 +79,17 @@ AC_DEFUN([gl_LIBSELINUX], LIB_SELINUX= if test "$with_selinux" != no; then gl_saved_LIBS=$LIBS - AC_SEARCH_LIBS([setfilecon], [selinux], - [test "$ac_cv_search_setfilecon" = "none required" || - LIB_SELINUX=$ac_cv_search_setfilecon]) + dnl On Android, in Termux, prefer libandroid-selinux.so, because it + dnl defines many more API functions than /system/lib/libselinux.so. + AC_SEARCH_LIBS([getfilecon_raw], [android-selinux selinux], + [test "$ac_cv_search_getfilecon_raw" = "none required" || + LIB_SELINUX=$ac_cv_search_getfilecon_raw]) LIBS=$gl_saved_LIBS fi AC_SUBST([LIB_SELINUX]) # Warn if SELinux is found but libselinux is absent; - if test "$ac_cv_search_setfilecon" = no; then + if test "$ac_cv_search_getfilecon_raw" = no; then if test "$host" = "$build" \ && { test -d /sys/fs/selinux || test -d /selinux; }; then AC_MSG_WARN([This system supports SELinux but libselinux is missing.]) |
