aboutsummaryrefslogtreecommitdiff
path: root/make.c
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-01-18 10:41:27 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-01-18 10:41:27 +0100
commit3e8cb32143a60069a3ae46d8331fe17e3760cb6b (patch)
tree261d20c68d0626bbec78f35aad900e167597767b /make.c
parent42fe824ea8255869a5b5df8be9703dfabefba11b (diff)
Use pkg-config to configure PCRE
Diffstat (limited to 'make.c')
-rw-r--r--make.c11
1 files 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);
}