+2016-11-23 Mark Wielaard <mjw@redhat.com>
+
+ * configure.ac: Add test for bad fts.h. Add -DBAD_FTS=1 to CFLAGS
+ if necessary.
+
2016-11-02 Mark Wielaard <mjw@redhat.com>
* configure.ac: Add check for whether gcc accepts
dnl whether functions and headers are available, whether they work, etc.
AC_SYS_LARGEFILE
+dnl Older glibc had a broken fts that didn't work with Large File Systems.
+dnl We want the version that can handler LFS, but include workaround if we
+dnl get a bad one. Add define to CFLAGS (not AC_DEFINE it) since we need to
+dnl check it before including config.h (which might define _FILE_OFFSET_BITS).
+AC_CACHE_CHECK([whether fts.h is bad when included (with LFS)], ac_cv_bad_fts,
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <fts.h>]])],
+ ac_cv_bad_fts=no, ac_cv_bad_fts=yes)])
+AS_IF([test "x$ac_cv_bad_fts" = "xyes"], [CFLAGS="$CFLAGS -DBAD_FTS=1"])
+
dnl enable debugging of branch prediction.
AC_ARG_ENABLE([debugpred],
AS_HELP_STRING([--enable-debugpred],[build binaries with support to debug branch prediction]),
-2015-10-11 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
+2016-11-23 Mark Wielaard <mjw@redhat.com>
+
+ * linux-kernel-modules.c: Only include fts.h early if BAD_FTS is
+ defined.
+
+2016-10-11 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
* core-file.c: Remove sys/param.h.
* dwfl_segment_report_module.c: Likewise. Add system.h include.
the GNU Lesser General Public License along with this program. If
not, see <http://www.gnu.org/licenses/>. */
-/* We include this before config.h because it can't handle _FILE_OFFSET_BITS.
+/* In case we have a bad fts we include this before config.h because it
+ can't handle _FILE_OFFSET_BITS.
Everything we need here is fine if its declarations just come first. */
-
-#include <fts.h>
+#ifdef BAD_FTS
+ #include <fts.h>
+#endif
#include <config.h>
#include <fcntl.h>
#include <unistd.h>
-/* Since fts.h is included before config.h, its indirect inclusions may not
+/* If fts.h is included before config.h, its indirect inclusions may not
give us the right LFS aliases of these functions, so map them manually. */
-#ifdef _FILE_OFFSET_BITS
-#define open open64
-#define fopen fopen64
+#ifdef BAD_FTS
+ #ifdef _FILE_OFFSET_BITS
+ #define open open64
+ #define fopen fopen64
+ #endif
+#else
+ #include <fts.h>
#endif