Permalink
Browse files

cmd: rework header check for xfs/xqm.h

Building snap-confine on i386 fails on other operating systems with:

configure: WARNING: xfs/xqm.h: present but cannot be compiled
configure: WARNING: xfs/xqm.h:     check for missing prerequisite headers?
configure: WARNING: xfs/xqm.h: see the Autoconf documentation
configure: WARNING: xfs/xqm.h:     section "Present But Cannot Be Compiled"
configure: WARNING: xfs/xqm.h: proceeding with the compiler's result
[...]
checking for xfs/xqm.h... no
configure: error: xfs/xqm.h unavailable

The official autoconf documentation recommends using a proper include
check in the AC_CHECK_HEADERS macro.
  • Loading branch information...
1 parent 18af73b commit 26a1a4b695d608596c76ee84ee00e9ecf4188267 Simon Fels committed Mar 27, 2017
Showing with 8 additions and 1 deletion.
  1. +8 −1 cmd/configure.ac
View
@@ -22,7 +22,14 @@ AC_SYS_LARGEFILE
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/mount.h unistd.h])
AC_CHECK_HEADERS([sys/quota.h], [], [AC_MSG_ERROR(sys/quota.h unavailable)])
-AC_CHECK_HEADERS([xfs/xqm.h], [], [AC_MSG_ERROR(xfs/xqm.h unavailable)])
+
+# In order to allow a proper header check for xfs/xqm.h we need to
+# add -D_FILE_OFFSET_BITS=64 to CFLAGS on relevant platforms otherwise
+# the check will fail with an compiler error.
+OLD_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
+AC_CHECK_HEADERS([xfs/xqm.h], [], [AC_MSG_ERROR(xfs/xqm.h unavailable)])
+CFLAGS=$OLD_CFLAGS
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL

0 comments on commit 26a1a4b

Please sign in to comment.