Branch
Hash :
7b089321
Author :
Date :
2025-01-01T09:24:36
maint: run 'make update-copyright'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
# hasmntopt.m4
# serial 1
dnl Copyright (C) 2024-2025 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.
dnl This file is offered as-is, without any warranty.
AC_DEFUN([gl_FUNC_HASMNTOPT],
[
AC_REQUIRE([gl_MNTENT_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
gl_CHECK_FUNCS_ANDROID([setmntent],
[[#include <stdio.h>
#include <mntent.h>
]])
if test $ac_cv_func_setmntent != yes; then
HAVE_SETMNTENT=0
fi
gl_CHECK_FUNCS_ANDROID([hasmntopt],
[[#include <stdio.h>
#include <mntent.h>
]])
if test $ac_cv_func_hasmntopt = yes; then
dnl hasmntopt has the dumbest possible implementation on musl libc 1.2.5:
dnl it confuses the "atime" option with the "noatime" option.
AC_CACHE_CHECK([whether hasmntopt works],
[gl_cv_func_hasmntopt_works],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <mntent.h>
#include <stddef.h>
]],
[[int result = 0;
/* This test fails on musl libc 1.2.5. */
{
char options[] = "rw,noatime";
struct mntent me;
me.mnt_opts = options;
if (hasmntopt (&me, "atime") != NULL)
result |= 1;
}
return result;
]])
],
[gl_cv_func_hasmntopt_works=yes],
[gl_cv_func_hasmntopt_works=no],
[case "$host_os" in
# Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_hasmntopt_works="guessing yes" ;;
# Guess no on musl systems.
*-musl* | midipix*) gl_cv_func_hasmntopt_works="guessing no" ;;
*) gl_cv_func_hasmntopt_works="$gl_cross_guess_normal" ;;
esac
])
])
case "$gl_cv_func_hasmntopt_works" in
*yes) ;;
*) REPLACE_HASMNTOPT=1 ;;
esac
else
HAVE_HASMNTOPT=0
case "$gl_cv_onwards_func_hasmntopt" in
future*) REPLACE_HASMNTOPT=1 ;;
esac
fi
])
# Prerequisites of lib/hasmntopt.c.
AC_DEFUN([gl_PREREQ_HASMNTOPT],
[
:
])