Fix configure wxWebRequest detection and warning logic

Only use wxUSE_WEBREQUEST_{URLSESSION,WINHTTP} under the platforms where
they make sense.

Turn wxUSE_WEBREQUEST off if no backends are available and warn about
it, even under MSW/macOS platforms where this wasn't done previously.
This commit is contained in:
Vadim Zeitlin
2020-12-13 16:20:48 +01:00
parent 181be127a5
commit c6b83194f1
2 changed files with 26 additions and 34 deletions

31
configure vendored
View File

@@ -23011,7 +23011,7 @@ if test "$wxUSE_LIBMSPACK" != "no"; then
fi
if test "$wxUSE_LIBCURL" != "no"; then
if test "$wxUSE_WEBREQUEST" = "yes" -a "$wxUSE_LIBCURL" != "no"; then
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBCURL" >&5
@@ -23092,18 +23092,8 @@ $as_echo "yes" >&6; }
CXXFLAGS="$LIBCURL_CFLAGS $CXXFLAGS"
LIBS="$LIBCURL_LIBS $LIBS"
$as_echo "#define wxUSE_WEBREQUEST_LIBCURL 1" >>confdefs.h
fi
if test "$wxUSE_LIBCURL" = "no"; then
if test "$USE_WIN32" != 1 -a "$USE_DARWIN" != 1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libcurl not found, wxWebRequest won't be available" >&5
$as_echo "$as_me: WARNING: libcurl not found, wxWebRequest won't be available" >&2;}
wxUSE_WEBREQUEST=no
fi
fi
fi
@@ -36124,25 +36114,32 @@ if test "$wxUSE_FS_INET" = "yes"; then
fi
if test "$wxUSE_WEBREQUEST" = "yes"; then
$as_echo "#define wxUSE_WEBREQUEST 1" >>confdefs.h
if test "$wxUSE_LIBCURL" = "yes"; then
$as_echo "#define wxUSE_WEBREQUEST_CURL 1" >>confdefs.h
have_webrequest_backend=1
fi
if test "$wxUSE_URLSESSION" = "yes"; then
if test "$USE_DARWIN" = 1 -a "$wxUSE_URLSESSION" = "yes"; then
$as_echo "#define wxUSE_WEBREQUEST_URLSESSION 1" >>confdefs.h
have_webrequest_backend=1
fi
if test "$wxUSE_WINHTTP" = "yes"; then
if test "$USE_WIN32" = 1 -a "$wxUSE_WINHTTP" = "yes"; then
$as_echo "#define wxUSE_WEBREQUEST_WINHTTP 1" >>confdefs.h
have_webrequest_backend=1
fi
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS webrequest"
if test "$have_webrequest_backend" = 1; then
$as_echo "#define wxUSE_WEBREQUEST 1" >>confdefs.h
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS webrequest"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling wxWebRequest because no backends are available" >&5
$as_echo "$as_me: WARNING: Disabling wxWebRequest because no backends are available" >&2;}
fi
fi

View File

@@ -2945,28 +2945,17 @@ dnl ------------------------------------------------------------------------
dnl Check for libcurl
dnl ------------------------------------------------------------------------
if test "$wxUSE_LIBCURL" != "no"; then
if test "$wxUSE_WEBREQUEST" = "yes" -a "$wxUSE_LIBCURL" != "no"; then
PKG_CHECK_MODULES(LIBCURL, [libcurl],
[
CXXFLAGS="$LIBCURL_CFLAGS $CXXFLAGS"
LIBS="$LIBCURL_LIBS $LIBS"
AC_DEFINE(wxUSE_WEBREQUEST_LIBCURL)
],
[
wxUSE_LIBCURL=no
AC_MSG_RESULT([not found])
]
)
if test "$wxUSE_LIBCURL" = "no"; then
dnl Under these platforms we have other, always available, backends for
dnl wxWebRequest, but under the others (i.e. generic Unix) libcurl is
dnl the only way to implement wxWebRequest.
if test "$USE_WIN32" != 1 -a "$USE_DARWIN" != 1; then
AC_MSG_WARN([libcurl not found, wxWebRequest won't be available])
wxUSE_WEBREQUEST=no
fi
fi
fi
dnl ----------------------------------------------------------------
@@ -6610,21 +6599,27 @@ if test "$wxUSE_FS_INET" = "yes"; then
fi
if test "$wxUSE_WEBREQUEST" = "yes"; then
AC_DEFINE(wxUSE_WEBREQUEST)
if test "$wxUSE_LIBCURL" = "yes"; then
AC_DEFINE(wxUSE_WEBREQUEST_CURL)
have_webrequest_backend=1
fi
if test "$wxUSE_URLSESSION" = "yes"; then
if test "$USE_DARWIN" = 1 -a "$wxUSE_URLSESSION" = "yes"; then
AC_DEFINE(wxUSE_WEBREQUEST_URLSESSION)
have_webrequest_backend=1
fi
if test "$wxUSE_WINHTTP" = "yes"; then
if test "$USE_WIN32" = 1 -a "$wxUSE_WINHTTP" = "yes"; then
AC_DEFINE(wxUSE_WEBREQUEST_WINHTTP)
have_webrequest_backend=1
fi
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS webrequest"
if test "$have_webrequest_backend" = 1; then
AC_DEFINE(wxUSE_WEBREQUEST)
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS webrequest"
else
AC_MSG_WARN([Disabling wxWebRequest because no backends are available])
fi
fi
dnl ---------------------------------------------------------------------------