[pacman-dev] [PATCH] Add large file support CFLAGS to pkgconfig file

Allan McRae allan at archlinux.org
Sat Nov 28 23:05:59 UTC 2015


Large file support is enabled by our configure script as required.  If anything
linking to libalpm does not also define large file support, there will be
differences in the size of off_t which are not caught until runtime.

Add the required CFLAGS to the pkg-config file so that users of libalpm know
what flags are required.

Signed-off-by: Allan McRae <allan at archlinux.org>
---

Tested with i686-Linux and x86_64-Linux.  At worst, on other systems some flags
will be missed, making the situation no different than today...

 configure.ac              | 9 +++++++++
 lib/libalpm/libalpm.pc.in | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 359d61b..60bb837 100644
--- a/configure.ac
+++ b/configure.ac
@@ -165,6 +165,15 @@ AC_ARG_ENABLE(git-version,
 # testing compilation against gpgme).
 AC_SYS_LARGEFILE
 
+# Record large file flags in pkgconfig file
+if test "$enable_largefile" != no; then
+	if test "$ac_cv_sys_file_offset_bits" != 'no'; then
+		LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
+	fi
+fi
+AC_SUBST(LFS_CFLAGS)
+
+
 # Checks for programs.
 AC_PROG_AWK
 AC_PROG_CC_C99
diff --git a/lib/libalpm/libalpm.pc.in b/lib/libalpm/libalpm.pc.in
index fdfc8be..e4be174 100644
--- a/lib/libalpm/libalpm.pc.in
+++ b/lib/libalpm/libalpm.pc.in
@@ -7,6 +7,6 @@ Name: libalpm
 Description: Arch Linux package management library
 URL: http://www.archlinux.org/pacman/
 Version: @LIB_VERSION@
-Cflags: -I${includedir}
+Cflags: -I${includedir} @LFS_CFLAGS@
 Libs: -L${libdir} -lalpm
 Libs.private: @LIBS@ @LIBARCHIVE_LIBS@ @LIBSSL_LIBS@ @LIBCURL_LIBS@ @GPGME_LIBS@
-- 
2.6.2


More information about the pacman-dev mailing list