From b93ad6183ee5479178296ff9ec2db23774e6db03 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 12 Feb 2026 22:49:27 +0100 Subject: configure: Test libcjson Otherwise, compilation could fail because libcjson's header files and/or library cannot be found on the system. Additionally, -lcjson should not be hardcoded to the ldflags, as this is better handled by pkg-config(1). --- configure | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 79dcc1a..80518fa 100755 --- a/configure +++ b/configure @@ -7,7 +7,7 @@ prefix=$default_prefix default_CC='c99' # FILE_OFFSET_BITS=64 is required for large file support on 32-bit platforms. default_CFLAGS='-O1 -g -D_FILE_OFFSET_BITS=64 -Wall -MD' -default_LDFLAGS="-lcjson -lm" +default_LDFLAGS="-lm" CC=${CC:-$default_CC} CFLAGS=${CFLAGS:-"$default_CFLAGS $default_NPCFLAGS"} @@ -62,6 +62,16 @@ else exit 1 fi +if pkg-config libcjson +then + CFLAGS="$CFLAGS $(pkg-config --cflags libcjson)" + LDFLAGS="$LDFLAGS $(pkg-config --libs libcjson)" + USERGEN_LDFLAGS="$USERGEN_LDFLAGS $(pkg-config --libs libcjson)" +else + echo "Error: libcjson not found." >&2 + exit 1 +fi + if pkg-config dynstr then in_tree_dynstr=0 -- cgit v1.2.3