From 3e8cb32143a60069a3ae46d8331fe17e3760cb6b Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Thu, 18 Jan 2024 10:41:27 +0100 Subject: Use pkg-config to configure PCRE --- make.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/make.c b/make.c index d56967c..55216e6 100644 --- a/make.c +++ b/make.c @@ -91,8 +91,15 @@ main(int argc, char **argv) cmdaddv(&c, cc.buf, cc.len); cmdaddv(&c, cflags.buf, cflags.len); cmdadd(&c, buf); - if (!Pflag) - cmdadd(&c, "-DGRAB_DO_PCRE=1", "-lpcre2-posix"); + if (!Pflag) { + struct strv pc = {0}; + cmdadd(&c, "-DGRAB_DO_PCRE=1"); + if (pcquery(&pc, "libpcre2-posix", PKGC_CFLAGS | PKGC_LIBS)) + cmdaddv(&c, pc.buf, pc.len); + else + cmdadd(&c, "-lpcre2-posix"); + strvfree(&pc); + } cmdadd(&c, "-o", i == 0 ? "grab" : "git-grab", "src/grab.c"); cmdprc(c); } -- cgit v1.2.3