2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Use AC_FUNC_FSEEKO instead of AC_CHECK_FUNCS_ONCE([fseeko]).

This will define _LARGEFILE_SOURCE, if needed, to make the prototype
visible on older systems.
This commit is contained in:
Todd C. Miller
2021-08-20 10:59:52 -06:00
parent ad28b90c4d
commit 680fd4a629
3 changed files with 75 additions and 4 deletions

View File

@@ -310,7 +310,7 @@
/* Define to 1 if you have the `freezero' function. */
#undef HAVE_FREEZERO
/* Define to 1 if you have the `fseeko' function. */
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
/* Define to 1 if you have the `fstatat' function. */
@@ -1347,6 +1347,9 @@
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#undef _LARGEFILE_SOURCE
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES

71
configure vendored
View File

@@ -3246,7 +3246,6 @@ as_fn_append ac_func_c_list " nl_langinfo HAVE_NL_LANGINFO"
as_fn_append ac_func_c_list " faccessat HAVE_FACCESSAT"
as_fn_append ac_func_c_list " wordexp HAVE_WORDEXP"
as_fn_append ac_func_c_list " getauxval HAVE_GETAUXVAL"
as_fn_append ac_func_c_list " fseeko HAVE_FSEEKO"
as_fn_append ac_func_c_list " seteuid HAVE_SETEUID"
# Auxiliary files required by this configure script.
@@ -20875,6 +20874,75 @@ printf "%s\n" "#define HAVE_GETGROUPS 1" >>confdefs.h
esac
LIBS=$ac_save_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
printf %s "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
if test ${ac_cv_sys_largefile_source+y}
then :
printf %s "(cached) " >&6
else $as_nop
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h> /* for off_t */
#include <stdio.h>
int
main (void)
{
int (*fp) (FILE *, off_t, int) = fseeko;
return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_sys_largefile_source=no; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _LARGEFILE_SOURCE 1
#include <sys/types.h> /* for off_t */
#include <stdio.h>
int
main (void)
{
int (*fp) (FILE *, off_t, int) = fseeko;
return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_sys_largefile_source=1; break
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
ac_cv_sys_largefile_source=unknown
break
done
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
printf "%s\n" "$ac_cv_sys_largefile_source" >&6; }
case $ac_cv_sys_largefile_source in #(
no | unknown) ;;
*)
printf "%s\n" "#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source" >>confdefs.h
;;
esac
rm -rf conftest*
# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
# in glibc 2.1.3, but that breaks too many other things.
# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
if test $ac_cv_sys_largefile_source != unknown; then
printf "%s\n" "#define HAVE_FSEEKO 1" >>confdefs.h
fi
ac_func=
for ac_item in $ac_func_c_list
do
@@ -20896,7 +20964,6 @@ done
for ac_func in pread
do :
ac_fn_c_check_func "$LINENO" "pread" "ac_cv_func_pread"

View File

@@ -2541,7 +2541,8 @@ dnl
dnl Function checks
dnl
AC_FUNC_GETGROUPS
AC_CHECK_FUNCS_ONCE([fexecve fmemopen killpg nl_langinfo faccessat wordexp getauxval fseeko])
AC_FUNC_FSEEKO
AC_CHECK_FUNCS_ONCE([fexecve fmemopen killpg nl_langinfo faccessat wordexp getauxval])
AC_CHECK_FUNCS([pread], [
# pread/pwrite on 32-bit HP-UX 11.x may not support large files
case "$host_os" in