UPDATE: Autoconf change. Hopefully this is what Chris meant.
Signed-off-by: Jan Tulak <jtulak@xxxxxxxxxx>
---
configure.ac | 1 +
fsr/xfs_fsr.c | 6 +++---
include/builddefs.in | 4 ++++
m4/package_libcdev.m4 | 8 ++++++++
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 530650b..0aba90c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -115,6 +115,7 @@ AC_HAVE_FALLOCATE
AC_HAVE_FIEMAP
AC_HAVE_PREADV
AC_HAVE_SYNC_FILE_RANGE
+AC_HAVE_MNTENT
AC_HAVE_BLKID_TOPO
AC_HAVE_READDIR
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index b4ff136..4912b73 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -25,16 +25,16 @@
#include <fcntl.h>
#include <errno.h>
-#include <malloc.h>
-#include <mntent.h>
#include <syslog.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
-#include <sys/vfs.h>
#include <sys/statvfs.h>
#include <sys/xattr.h>
+#ifdef HAVE_MNTENT
+# include <mntent.h>
+#endif
#ifndef XFS_XFLAG_NODEFRAG
#define XFS_XFLAG_NODEFRAG 0x00002000 /* src dependancy, remove later */
diff --git a/include/builddefs.in b/include/builddefs.in
index c644a17..e522243 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -103,6 +103,7 @@ HAVE_FIEMAP = @have_fiemap@
HAVE_PREADV = @have_preadv@
HAVE_SYNC_FILE_RANGE = @have_sync_file_range@
HAVE_READDIR = @have_readdir@
+HAVE_MNTENT = @have_mntent@
GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
# -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-decl
@@ -130,6 +131,9 @@ PLDLIBS = -L/usr/local/lib -lintl
PCFLAGS = -I/usr/local/include $(GCCFLAGS)
DEPENDFLAGS = -D__FreeBSD__
endif
+ifeq ($(HAVE_MNTENT),yes)
+PCFLAGS+= -DHAVE_MNTENT
+endif
GCFLAGS = $(OPTIMIZER) $(DEBUG) \
-DVERSION=\"$(PKG_VERSION)\" -DLOCALEDIR=\"$(PKG_LOCALE_DIR)\" \
diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
index 919ae0a..75aa61e 100644
--- a/m4/package_libcdev.m4
+++ b/m4/package_libcdev.m4
@@ -202,3 +202,11 @@ AC_DEFUN([AC_HAVE_READDIR],
AC_SUBST(have_readdir)
])
+#
+# Check if there is mntent.h
+#
+AC_DEFUN([AC_HAVE_MNTENT],
+ [ AC_CHECK_HEADERS(mntent.h,
+ have_mntent=yes)
+ AC_SUBST(have_mntent)
+ ])
--
2.4.3
|