summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Fotengauer-Malinovskiy <glebfm@altlinux.org>2017-03-23 21:21:26 +0300
committerPanu Matilainen <pmatilai@redhat.com>2017-03-24 12:42:40 +0200
commit1eadabe4453ef32eb6c3bc837094e1ca998affcc (patch)
tree26f2616d7f2884a4537f7c2c7578a92880caf566
parent418d1b69e1ab36d3faba6dd2dfb7758aa63cd557 (diff)
downloadrpm-1eadabe4453ef32eb6c3bc837094e1ca998affcc.tar.gz
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]
-rw-r--r--build/files.c11
-rw-r--r--configure.ac8
-rw-r--r--misc/Makefile.am5
3 files changed, 22 insertions, 2 deletions
diff --git a/build/files.c b/build/files.c
index 07b42d9d3..f58569e3e 100644
--- a/build/files.c
+++ b/build/files.c
@@ -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"
diff --git a/configure.ac b/configure.ac
index bdcb741fc..d3dda0023 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/misc/Makefile.am b/misc/Makefile.am
index 31d264e1d..beb9beec8 100644
--- a/misc/Makefile.am
+++ b/misc/Makefile.am
@@ -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@