Only build bundled fts if system has a bad version that doesn't handle LFS

Older versions of glibc included an fts implementation that didn't have
Large File Support on 32-bit systems.  We worked that around by bundling
fts into rpm codebase.  Thanks to Mark Wielaard, glibc >= 2.23 has LFS
support in fts.

Unfortunately, we can't drop bundled fts because we have to support
build with other libcs which do not implement fts at all or their
implementations do not provide Large File Support.

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>

[pmatilai: Added comment to configure.ac as the test is rather subtle,
           thanks for Mark Wielaard for the explanation]
This commit is contained in:
Gleb Fotengauer-Malinovskiy 2017-03-23 21:21:26 +03:00 committed by Panu Matilainen
parent 418d1b69e1
commit 1eadabe445
3 changed files with 22 additions and 2 deletions

View File

@ -28,7 +28,16 @@
#include <rpm/rpmbase64.h>
#include "rpmio/rpmio_internal.h" /* XXX rpmioSlurp */
#include "misc/rpmfts.h"
#ifdef HAVE_FTS_H
# include <fts.h>
# define Fts_open fts_open
# define Fts_read fts_read
# define Fts_close fts_close
#else
# include "misc/rpmfts.h"
#endif
#include "lib/rpmfi_internal.h" /* XXX fi->apath */
#include "lib/rpmug.h"
#include "build/rpmbuild_internal.h"

View File

@ -717,6 +717,14 @@ AC_CHECK_FUNCS(
[mkstemp getcwd basename dirname realpath setenv unsetenv regcomp lchown utimes],
[], [AC_MSG_ERROR([function required by rpm])])
# This is fairly subtle: old non-LFS compatible FTS implementations have an
# explicit check against -D_FILE_OFFSET_BIT S == 64, which has been set
# by our call to AC_SYS_LARGEFILE for systems that need it. So the apparent
# existence check ends up testing for LFS compatibility as well.
AC_CHECK_HEADERS([fts.h])
AM_CONDITIONAL([USE_BUNDLED_FTS_KLUDGE], [test "$ac_cv_header_fts_h" = no])
AC_LIBOBJ(fnmatch)
dnl check if python is requested

View File

@ -10,5 +10,8 @@ EXTRA_DIST = \
noinst_LTLIBRARIES = libmisc.la
libmisc_la_SOURCES = fts.c rpmfts.h
libmisc_la_SOURCES =
if USE_BUNDLED_FTS_KLUDGE
libmisc_la_SOURCES += fts.c rpmfts.h
endif
libmisc_la_LIBADD = @LTLIBOBJS@