Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use pkg-config to detect libcurl on MinGW and Windows
  • Loading branch information
hmelder committed Aug 24, 2022
commit 05495a0206499609e68d2d7e5cd01c3d41ae54c3
22 changes: 15 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -13686,11 +13686,16 @@ if test "$with_curl" != ""; then
fi

HAVE_LIBCURL=0
SKIP_CURL_CONFIG=0
curl_all=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcurl" >&5
$as_echo_n "checking for libcurl... " >&6; }

if eval $CURL_CONFIG --version 2>/dev/null >/dev/null; then
case "$target_os" in
mingw*|windows) SKIP_CURL_CONFIG=1;;
esac

if eval $CURL_CONFIG --version 2>/dev/null >/dev/null && test "$SKIP_CURL_CONFIG" == "0"; then
curl_ver=`$CURL_CONFIG --version | sed -e "s/libcurl //g"`
curl_maj=`echo $curl_ver | sed -e "s/^\(.*\)\.\(.*\)\.\(.*\)$/\1/"`
curl_min=`echo $curl_ver | sed -e "s/^\(.*\)\.\(.*\)\.\(.*\)$/\2/"`
Expand Down Expand Up @@ -13726,12 +13731,6 @@ done
else
if test -n "$PKG_CONFIG"; then
if pkg-config --exists libcurl; then
HAVE_LIBCURL=1
CURLCFLAGS=`$PKG_CONFIG --cflags libcurl`
CURLLIBS=`$PKG_CONFIG --libs libcurl`
CFLAGS="$CFLAGS $CURLCFLAGS"
LIBS="$LIBS $CURLLIBS"

if $PKG_CONFIG --atleast-version 2.66.0 libcurl; then
for ac_header in curl/curl.h
do :
Expand All @@ -13748,13 +13747,22 @@ fi
done

if test "$curl_ok" = yes; then
HAVE_LIBCURL=1
CURLCFLAGS=`$PKG_CONFIG --cflags libcurl`
CURLLIBS=`$PKG_CONFIG --libs libcurl`
CFLAGS="$CFLAGS $CURLCFLAGS"
LIBS="$LIBS $CURLLIBS"
curl_all=yes
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: FAILED (version too old to use" >&5
$as_echo "FAILED (version too old to use" >&6; }
curl_all=no
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: FAILED (libcurl not found via pkg-config)" >&5
$as_echo "FAILED (libcurl not found via pkg-config)" >&6; }
curl_all=no
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: FAILED (curl-config and pkg-config not found)" >&5
Expand Down
21 changes: 14 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3623,10 +3623,15 @@ if test "$with_curl" != ""; then
fi

HAVE_LIBCURL=0
SKIP_CURL_CONFIG=0
curl_all=no
AC_MSG_CHECKING([for libcurl])

if eval $CURL_CONFIG --version 2>/dev/null >/dev/null; then
case "$target_os" in
mingw*|windows) SKIP_CURL_CONFIG=1;;
esac

if eval $CURL_CONFIG --version 2>/dev/null >/dev/null && test "$SKIP_CURL_CONFIG" == "0"; then
curl_ver=`$CURL_CONFIG --version | sed -e "s/libcurl //g"`
curl_maj=`echo $curl_ver | sed -e "s/^\(.*\)\.\(.*\)\.\(.*\)$/\1/"`
curl_min=`echo $curl_ver | sed -e "s/^\(.*\)\.\(.*\)\.\(.*\)$/\2/"`
Expand All @@ -3647,21 +3652,23 @@ if eval $CURL_CONFIG --version 2>/dev/null >/dev/null; then
else
if test -n "$PKG_CONFIG"; then
if pkg-config --exists libcurl; then
HAVE_LIBCURL=1
CURLCFLAGS=`$PKG_CONFIG --cflags libcurl`
CURLLIBS=`$PKG_CONFIG --libs libcurl`
CFLAGS="$CFLAGS $CURLCFLAGS"
LIBS="$LIBS $CURLLIBS"

if $PKG_CONFIG --atleast-version 2.66.0 libcurl; then
AC_CHECK_HEADERS(curl/curl.h, curl_ok=yes, curl_ok=no)
if test "$curl_ok" = yes; then
HAVE_LIBCURL=1
CURLCFLAGS=`$PKG_CONFIG --cflags libcurl`
CURLLIBS=`$PKG_CONFIG --libs libcurl`
CFLAGS="$CFLAGS $CURLCFLAGS"
LIBS="$LIBS $CURLLIBS"
curl_all=yes
fi
else
AC_MSG_RESULT([FAILED (version too old to use])
curl_all=no
fi
else
AC_MSG_RESULT([FAILED (libcurl not found via pkg-config)])
curl_all=no
fi
else
AC_MSG_RESULT([FAILED (curl-config and pkg-config not found)])
Expand Down