aboutsummaryrefslogtreecommitdiff
path: root/libpkgconf/buildfile
diff options
context:
space:
mode:
Diffstat (limited to 'libpkgconf/buildfile')
-rw-r--r--libpkgconf/buildfile31
1 files changed, 26 insertions, 5 deletions
diff --git a/libpkgconf/buildfile b/libpkgconf/buildfile
index c344ec7..a2f9427 100644
--- a/libpkgconf/buildfile
+++ b/libpkgconf/buildfile
@@ -16,6 +16,9 @@ else
#
h{version}: in{version} $src_root/file{manifest}
+tclass = $c.target.class
+tsys = $c.target.system
+
# Define the PKG_DEFAULT_PATH, SYSTEM_INCLUDEDIR and SYSTEM_LIBDIR macros.
# The whole idea feels utterly broken (hello cross-compilation) so we will
# just do bare minimum and wait and see.
@@ -23,7 +26,7 @@ h{version}: in{version} $src_root/file{manifest}
# @@ We should probably allow to configure these macros via configuration
# variables config.pkgconfig.pkg_default_path and alike.
#
-if ($c.target.class == "windows")
+if ($tclass == "windows")
{
inc_dirs = ""
lib_dirs = ""
@@ -55,17 +58,17 @@ c.poptions += -DPKG_DEFAULT_PATH=\"$def_dirs\" \
# Disable warnings.
#
-if ($c.target.system == "win32-msvc")
+if ($tsys == "win32-msvc")
c.coptions += /wd4996 /wd4267
-if ($c.target.class == "windows")
+if ($tclass == "windows")
{
# See libpkgconf/libpkgconf-api.h for details.
#
objs{*}: c.poptions += -DLIBPKGCONF_EXPORT
obja{*}: c.poptions += -DPKGCONFIG_IS_STATIC
- if ($c.target.system == "mingw32")
+ if ($tsys == "mingw32")
c.libs += -ladvapi32
else
c.libs += advapi32.lib
@@ -81,8 +84,26 @@ liba{pkgconf}: cc.export.poptions += -DPKGCONFIG_IS_STATIC
# -std=c9x option (is implied by c.std=99 in root.build) and define _GNU_SOURCE
# for the source files that require such deviations.
#
-if ($c.target.class != "windows")
+# We will also re-enable definitions of POSIX macros (specifically PATH_MAX)
+# that are disabled by -std=c9x.
+#
+if ($tclass != "windows")
+{
+ # On FreeBSD and MacOS -D_POSIX_C_SOURCE disables declarations of strndup(),
+ # strlcpy() and alike, that are not POSIX. Not very consistent given that
+ # they are also not C99. Luckily, -std=c9x doesn't disable PATH_MAX on these
+ # OSes, so we just don't define the macro for them.
+ #
+ # @@ It all becomes a bit hairy. Should we just undefine the corresponding
+ # HAVE_* macros in config.h, so the custom function implementations are
+ # picked up? Alternatively, can we stop specifying the C standard and
+ # defining _POSIX_C_SOURCE macro altogether?
+ #
+ if ($tclass != "bsd" && $tclass != "macos")
+ c.poptions += -D_POSIX_C_SOURCE=200112L
+
obj{client fragment path pkg queue tuple}: c.poptions += -D_GNU_SOURCE
+}
# Install into the pkgconf/libpkgconf/ subdirectory of, say, /usr/include/.
# Also make sure Cflags is properly set in .pc files to pkgconfig/.