aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-02-12 22:49:27 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2026-02-13 07:55:08 +0100
commitb93ad6183ee5479178296ff9ec2db23774e6db03 (patch)
tree63488fd7e51410e73897c17ddfe23e7db357ea90
parent712c762bec81ef56d83f2a7ab05f7dba1ecf9021 (diff)
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).
-rwxr-xr-xconfigure12
1 files changed, 11 insertions, 1 deletions
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