diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-01-18 10:41:27 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-01-18 10:41:27 +0100 |
commit | 3e8cb32143a60069a3ae46d8331fe17e3760cb6b (patch) | |
tree | 261d20c68d0626bbec78f35aad900e167597767b | |
parent | 42fe824ea8255869a5b5df8be9703dfabefba11b (diff) |
Use pkg-config to configure PCRE
-rw-r--r-- | make.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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); } |