Skip to content

Commit

Permalink
curl-config: tidy up, optimize
Browse files Browse the repository at this point in the history
- optimize out `cppflag_curl_staticlib` variable.
- optimize out `CPPFLAG_CURL_STATICLIB` variable and simplify logic.
- lowercase local variable name `CURLLIBDIR`.

Closes curl#15810
  • Loading branch information
vszakats committed Dec 24, 2024
1 parent f5d0ba0 commit 415741e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions curl-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ prefix='@prefix@'
exec_prefix="@exec_prefix@"
# shellcheck disable=SC2034
includedir="@includedir@"
cppflag_curl_staticlib='@LIBCURL_PC_CFLAGS@'

usage()
{
Expand Down Expand Up @@ -142,28 +141,23 @@ while test "$#" -gt 0; do
;;

--cflags)
if test "X$cppflag_curl_staticlib" = 'X-DCURL_STATICLIB'; then
CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB '
else
CPPFLAG_CURL_STATICLIB=''
fi
if test "X@includedir@" = 'X/usr/include'; then
echo "${CPPFLAG_CURL_STATICLIB}"
echo '@LIBCURL_PC_CFLAGS@'
else
echo "${CPPFLAG_CURL_STATICLIB}-I@includedir@"
echo "@LIBCURL_PC_CFLAGS@ -I@includedir@"
fi
;;

--libs)
if test "X@libdir@" != 'X/usr/lib' -a "X@libdir@" != 'X/usr/lib64'; then
CURLLIBDIR="-L@libdir@ "
curllibdir="-L@libdir@ "
else
CURLLIBDIR=''
curllibdir=''
fi
if test 'X@ENABLE_SHARED@' = 'Xno'; then
echo "${CURLLIBDIR}-lcurl @LIBCURL_PC_LIBS_PRIVATE@"
echo "${curllibdir}-lcurl @LIBCURL_PC_LIBS_PRIVATE@"
else
echo "${CURLLIBDIR}-lcurl"
echo "${curllibdir}-lcurl"
fi
;;

Expand Down

0 comments on commit 415741e

Please sign in to comment.