Skip to content

Commit

Permalink
configure json-c
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Jun 7, 2022
1 parent 8e5b607 commit 1463145
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ YQ_ARG=''
CURL_LD='-lcurl'
CURL_CFLAGS=''
SED_ALIAS=''
JSON_C_CFLAGS=''
JSON_C_CFLAGS='-I/usr/include/json-c/'
JSON_C_LDFLAGS='-ljson-c'
HAVE_RECOMPILE_JSON_C=0

for arg in $@; do
if [ "--help" = $arg ]; then
Expand Down Expand Up @@ -43,6 +44,7 @@ EOF
cd -
JSON_C_CFLAGS='-I./json-c -I./json-c-build'
JSON_C_LDFLAGS='-L./json-c-build -ljson-c'
HAVE_RECOMPILE_JSON_C=1
elif [ "--yq-go" = $arg ]; then
YQ_ARG="-o json"
elif [ "--gnu-sed-alias" = $arg ]; then
Expand All @@ -58,6 +60,19 @@ EOF
fi
done

if [ $HAVE_RECOMPILE_JSON_C == 0 ]; then
pkg-config --help > /dev/null
if [ $? == 0 ]; then
JSON_C_CFLAGS=$(pkg-config --cflags json-c)
if [ $? -ne 0 ]; then
echo "[ERROR] json-c not found, you can use --compile-json-c" 1>&2
exit 1
fi
else
echo "[WARNING] pkg-config not found, use '-I/usr/include/json-c/' as default value"
fi
fi

echo JSON_SEARCH=$JSON_SEARCH > config.mk
echo YQ_ARG=$YQ_ARG >> config.mk
echo CURL_LD=$CURL_LD >> config.mk
Expand Down

0 comments on commit 1463145

Please sign in to comment.