From d8a12f5167b8edc01300fb4b1fc4c64350d19387 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 22 Sep 2011 14:38:24 +0100 Subject: [PATCH] Fix libproxy build. Signed-off-by: David Woodhouse --- configure.ac | 22 ++++++++++++++-------- main.c | 6 +++--- openconnect-internal.h | 4 ++-- openconnect.html | 3 ++- ssl.c | 2 +- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 00f0bec..5302727 100644 --- a/configure.ac +++ b/configure.ac @@ -43,14 +43,20 @@ AC_PROG_LIBTOOL PKG_CHECK_MODULES(LIBXML2, libxml-2.0) PKG_CHECK_MODULES(ZLIB, zlib) -libproxy_hdr=no -AC_CHECK_HEADER([libproxy.h], - [libproxy_hdr='"libproxy.h"'], - [AC_CHECK_HEADER([proxy.h], - [libproxy_hdr='"libproxy.h"'])]) -if (test "$libproxy_hdr" != "no"); then - AC_DEFINE([LIBPROXY_HDR], $libproxy_hdr) - PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0, AC_SUBST(LIBPROXY_PC, libproxy-1.0), dummy=yes) +PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0, + [AC_SUBST(LIBPROXY_PC, libproxy-1.0) + AC_DEFINE([LIBPROXY_HDR], ["proxy.h"]) + libproxy_pkg=yes], + libproxy_pkg=no) +dnl Libproxy *can* exist without a .pc file, and its header may be called +dnl libproxy.h in that case. +if (test "$libproxy_pkg" = "no"); then + AC_CHECK_HEADER([proxy.h], + [AC_DEFINE([LIBPROXY_HDR], ["proxy.h"]) + AC_SUBST([LIBPROXY_LIBS], [-lproxy])], + [AC_CHECK_HEADER([libproxy.h], + [AC_DEFINE([LIBPROXY_HDR], ["libproxy.h"]) + AC_SUBST([LIBPROXY_LIBS], [-lproxy])])]) fi AC_CHECK_HEADER([if_tun.h], diff --git a/main.c b/main.c index 4ef81b6..2637007 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ #include #include #include -#ifdef OPENCONNECT_LIBPROXY +#ifdef LIBPROXY_HDR #include LIBPROXY_HDR #endif @@ -167,7 +167,7 @@ static void usage(void) printf(" -P, --proxy=URL Set proxy server\n"); printf(" --no-proxy Disable proxy\n"); printf(" --libproxy Use libproxy to automatically configure proxy\n"); -#ifndef OPENCONNECT_LIBPROXY +#ifndef LIBPROXY_HDR printf(" (NOTE: libproxy disabled in this build)\n"); #endif printf(" -q, --quiet Less output\n"); @@ -476,7 +476,7 @@ int main(int argc, char **argv) vpninfo->progress = write_progress; if (autoproxy) { -#ifdef OPENCONNECT_LIBPROXY +#ifdef LIBPROXY_HDR vpninfo->proxy_factory = px_proxy_factory_new(); #else fprintf(stderr, "This version of openconnect was built without libproxy support\n"); diff --git a/openconnect-internal.h b/openconnect-internal.h index fe22c67..1a660a0 100644 --- a/openconnect-internal.h +++ b/openconnect-internal.h @@ -36,7 +36,7 @@ #include #include #include -#ifdef OPENCONNECT_LIBPROXY +#ifdef LIBPROXY_HDR #include LIBPROXY_HDR #endif @@ -97,7 +97,7 @@ struct openconnect_info { char *csd_scriptname; -#ifdef OPENCONNECT_LIBPROXY +#ifdef LIBPROXY_HDR pxProxyFactory *proxy_factory; #endif char *proxy_type; diff --git a/openconnect.html b/openconnect.html index 6290ba0..c308b91 100644 --- a/openconnect.html +++ b/openconnect.html @@ -184,6 +184,7 @@ For full changelog entries including the latest development, see
  • OpenConnect HEAD
    • Fix build on Debian systems where dtls1_stop_timer() is not available.
    • +
    • Fix libproxy detection.
    • Enable a useful set of compiler warnings by default.
    • Fix various minor compiler warnings.

    @@ -507,6 +508,6 @@ An openconnect dwmw2@infradead.org> -Last modified: Thu Sep 15 23:17:44 BST 2011 +Last modified: Thu Sep 22 14:39:12 BST 2011 diff --git a/ssl.c b/ssl.c index 74fb76f..84c5778 100644 --- a/ssl.c +++ b/ssl.c @@ -888,7 +888,7 @@ int openconnect_open_https(struct openconnect_info *vpninfo) this way than if we pass NULL to getaddrinfo() and then try to fill in the numeric value into different types of returned sockaddr_in{6,}. */ -#ifdef OPENCONNECT_LIBPROXY +#ifdef LIBPROXY_HDR if (vpninfo->proxy_factory) { char *url; char **proxies; -- 2.7.4