cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Keith Mok <ek9852_at_gmail.com>
Date: Tue, 02 Sep 2008 18:21:28 +0800

Agree.

Please find the patch as per comments.

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 10:14:22 -0000
@@ -2546,6 +2546,78 @@
 
 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 frient than curl-config
+dnl
+
+if test "x$USE_SSLEAY" = "x1"; then
+ SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
+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"
+fi
+if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "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: curl-config.in
===================================================================
RCS file: /cvsroot/curl/curl/curl-config.in,v
retrieving revision 1.32
diff -u -r1.32 curl-config.in
--- curl-config.in 10 Jan 2008 22:14:02 -0000 1.32
+++ curl-config.in 2 Sep 2008 10:14:22 -0000
@@ -80,71 +80,15 @@
     ;;
 
     --feature|--features)
- if test "@USE_SSLEAY@" = "1"; then
- echo "SSL"
- NTLM=1 # OpenSSL implies NTLM
- elif test -n "@SSL_ENABLED@"; then
- echo "SSL"
- fi
- if test "@KRB4_ENABLED@" = "1"; then
- echo "KRB4"
- fi
- if test "@IPV6_ENABLED@" = "1"; then
- echo "IPv6"
- fi
- if test "@HAVE_LIBZ@" = "1"; then
- echo "libz"
- fi
- if test "@HAVE_ARES@" = "1"; then
- echo "AsynchDNS"
- fi
- if test "@IDN_ENABLED@" = "1"; then
- echo "IDN"
- fi
- if test "@USE_WINDOWS_SSPI@" = "1"; then
- echo "SSPI"
- NTLM=1
- fi
- if test "$NTLM" = "1"; then
- echo "NTLM"
- fi
+ for feature in @SUPPORT_FEATURES@; do
+ echo $feature;
+ done
     ;;
 
     --protocols)
- if test "@CURL_DISABLE_HTTP@" != "1"; then
- echo "HTTP"
- if test "@SSL_ENABLED@" = "1"; then
- echo "HTTPS"
- fi
- fi
- if test "@CURL_DISABLE_FTP@" != "1"; then
- echo "FTP"
- if test "@SSL_ENABLED@" = "1"; then
- echo "FTPS"
- fi
- fi
- if test "@CURL_DISABLE_FILE@" != "1"; then
- echo "FILE"
- fi
- if test "@CURL_DISABLE_TELNET@" != "1"; then
- echo "TELNET"
- fi
- if test "@CURL_DISABLE_LDAP@" != "1"; then
- echo "LDAP"
- fi
- if test "@CURL_DISABLE_LDAPS@" != "1"; then
- echo "LDAPS"
- fi
- if test "@CURL_DISABLE_DICT@" != "1"; then
- echo "DICT"
- fi
- if test "@CURL_DISABLE_TFTP@" != "1"; then
- echo "TFTP"
- fi
- if test "@USE_LIBSSH2@" = "1"; then
- echo "SCP"
- echo "SFTP"
- fi
+ for protocol in @SUPPORT_PROTOCOLS@; do
+ echo $protocol;
+ done
     ;;
     --version)
     echo libcurl @VERSION@
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 10:14:22 -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