cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] Add supported_features and supported_protocol to pkg-config file

From: Keith Mok <ek9852_at_gmail.com>
Date: Tue, 02 Sep 2008 17:01:27 +0800

Hi all,

This patch add supported_features and supported_protocol variables to
libcurl.pc.
So application can use pkg-config ---variable=xxx to retrieve the
supported feature of the installed package.
Although there is a program curl-config to retrieve these settings, but
when cross-compiling, curl-config often refer to the host machine
configuration instead of the target machine.

Using pkg-config approach is more cross-compile friendly.

Comments welcome.

============ cut here ================================================
Index: configure.ac
===================================================================
RCS file: /cvsroot/curl/curl/configure.ac,v
retrieving revision 1.335
diff -u -r1.335 configure.ac
--- configure.ac 26 Aug 2008 16:46:46 -0000 1.335
+++ configure.ac 2 Sep 2008 08:42:27 -0000
@@ -2546,6 +2546,79 @@

 AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)

+dnl
+dnl For keeping supported features and protocols also in pkg-config file
+dnl since it is more cross-compile friendly than curl-config
+dnl
+if test "x$USE_SSLEAY" = "x1"; then
+ SUPPORT_FEATURES="$SUPPORT_FEATURES SSL "
+ NTLM=1 # OpenSSL implies NTLM
+elif test -n "$SSL_ENABLED"; then
+ SUPPORT_FEATURES="$SUPPORT_FEATURES SSL "
+fi
+if test "@KRB4_ENABLED@" = "x1"; then
+ SUPPORT_FEATURES="$SUPPORT_FEATURES KRB4 "
+fi
+if test "x$IPV6_ENABLED" = "x1"; then
+ SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6 "
+fi
+if test "x$HAVE_LIBZ" = "x1"; then
+ SUPPORT_FEATURES="$SUPPORT_FEATURES libz "
+fi
+if test "x$HAVE_ARES" = "x1"; then
+ SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS "
+fi
+if test "x$IDN_ENABLED" = "x1"; then
+ SUPPORT_FEATURES="$SUPPORT_FEATURES IDN "
+fi
+if test "x$USE_WINDOWS_SSPI" = "x1"; then
+ SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI "
+ NTLM=1
+fi
+if test "x$NTLM" = "x1"; then
+ SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM "
+fi
+
+AC_SUBST(SUPPORT_FEATURES)
+
+dnl For supported protocols in pkg-config file
+if test "x$CURL_DISABLE_HTTP" != "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP "
+ if test "x$SSL_ENABLED" = "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS "
+ fi
+fi
+if test "x$CURL_DISABLE_FTP" != "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP "
+ if test "x$SSL_ENABLED" = "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS "
+ fi
+fi
+if test "x$CURL_DISABLE_FILE" != "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE "
+fi
+if test "x$CURL_DISABLE_TELNET" != "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET "
+fi
+if test "x$CURL_DISABLE_LDAP" != "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP "
+fi
+if test "x$CURL_DISABLE_LDAPS" != "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS "
+fi
+if test "x$CURL_DISABLE_DICT" != "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT "
+fi
+if test "x$CURL_DISABLE_TFTP" != "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP "
+fi
+if test "x$USE_LIBSSH2" = "x1"; then
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP "
+ SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP "
+fi
+
+AC_SUBST(SUPPORT_PROTOCOLS)
+
 AC_CONFIG_FILES([Makefile \
            docs/Makefile \
            docs/examples/Makefile \
Index: libcurl.pc.in
===================================================================
RCS file: /cvsroot/curl/curl/libcurl.pc.in,v
retrieving revision 1.3
diff -u -r1.3 libcurl.pc.in
--- libcurl.pc.in 17 Feb 2007 17:55:19 -0000 1.3
+++ libcurl.pc.in 2 Sep 2008 08:42:27 -0000
@@ -28,6 +28,8 @@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
 includedir=@includedir@
+supported_protocols="@SUPPORT_PROTOCOLS@"
+supported_features="@SUPPORT_FEATURES@"

 Name: libcurl
 URL: http://curl.haxx.se/
Received on 2008-09-02