This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Wrap gnulib fts_.h in fts.h


For some reason gnulib calls the headers fts_.h. We need to wrap it into
an actual fts.h to make it available.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 ChangeLog          |  4 ++++
 configure.ac       | 18 +++++++++++-------
 libgnu/ChangeLog   |  5 +++++
 libgnu/Makefile.am |  9 ++++++++-
 libgnu/fts.in.h    | 34 ++++++++++++++++++++++++++++++++++
 5 files changed, 62 insertions(+), 8 deletions(-)
 create mode 100644 libgnu/fts.in.h

diff --git a/ChangeLog b/ChangeLog
index 30b3884..da4d288 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* configure.ac: Check for fts.h before testing for BAD_FTS.
+
+2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* configure.ac: Check for stdio_ext.h.
 
 2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
diff --git a/configure.ac b/configure.ac
index 2488bbc..f04a6c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -302,13 +302,17 @@ dnl tests, because the choice of the file model can (in principle) affect
 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)])
+AC_CHECK_HEADER(fts.h)
+AM_CONDITIONAL(HAVE_FTS_H, [test "x$ac_cv_header_fts_h" = "xyes"])
+if test "x$ac_cv_header_fts_h" = "xyes"; then
+  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)])
+fi
 AS_IF([test "x$ac_cv_bad_fts" = "xyes"], [CFLAGS="$CFLAGS -DBAD_FTS=1"])
 
 # See if we can add -D_FORTIFY_SOURCE=2. Don't do it if it is already
diff --git a/libgnu/ChangeLog b/libgnu/ChangeLog
index 2cbc87f..d6ada7c 100644
--- a/libgnu/ChangeLog
+++ b/libgnu/ChangeLog
@@ -1,5 +1,10 @@
 2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* Makefile.am: If fts.h is unavailable, use our own.
+	* fts.in.h: New file.
+
+2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* Makefile.am: If stdio_ext.h is unavailable, use our own.
 	* stdio_ext.in.h: New file.
 
diff --git a/libgnu/Makefile.am b/libgnu/Makefile.am
index ca1a078..21f9c5f 100644
--- a/libgnu/Makefile.am
+++ b/libgnu/Makefile.am
@@ -36,7 +36,7 @@ MOSTLYCLEANFILES =
 MOSTLYCLEANDIRS =
 BUILT_SOURCES =
 EXTRA_DIST = endian.in.h byteswap.in.h sys_mman.win32.h mman_win32.c sysconf_win32.c ar.in.h \
-             features.in.h stdio_ext.in.h
+             features.in.h stdio_ext.in.h fts.in.h
 CLEANFILES =
 SUFFIXES =
 
@@ -68,6 +68,13 @@ BUILT_SOURCES += features.h
 MOSTLYCLEANFILES += features.h
 endif
 
+if !HAVE_FTS_H
+fts.h: fts.in.h
+	$(AM_V_GEN)rm -f $@ && cat $< > $@
+BUILT_SOURCES += fts.h
+MOSTLYCLEANFILES += fts.h
+endif
+
 if !HAVE_SYS_MMAN_H
 if USE_WIN32_MMAN
 sys/mman.h: sys_mman.win32.h
diff --git a/libgnu/fts.in.h b/libgnu/fts.in.h
new file mode 100644
index 0000000..2fc57d1
--- /dev/null
+++ b/libgnu/fts.in.h
@@ -0,0 +1,34 @@
+/* Wrap fts_.h under real name
+   Copyright (C) 2017 The Qt Company Ltd
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _FTS_REAL_H
+#define _FTS_REAL_H 1
+
+#include "fts_.h"
+
+#endif /* fts.h */
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]