File: curlpp.m4

package info (click to toggle)
curlpp 0.8.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 768 kB
  • sloc: cpp: 4,796; sh: 64; makefile: 3
file content (152 lines) | stat: -rw-r--r-- 5,427 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
#                       [ACTION-IF-YES], [ACTION-IF-NO])
# ----------------------------------------------------------
#      David Shaw <dshaw@jabberwocky.com>   Jun-21-2005
#
# Checks for libcurl.  DEFAULT-ACTION is the string yes or no to
# specify whether to default to --with-libcurl or --without-libcurl.
# If not supplied, DEFAULT-ACTION is yes.  MINIMUM-VERSION is the
# minimum version of libcurl to accept.  Pass the version as a regular
# version number like 7.10.1. If not supplied, any version is
# accepted.  ACTION-IF-YES is a list of shell commands to run if
# libcurl was successfully found and passed the various tests.
# ACTION-IF-NO is a list of shell commands that are run otherwise.
# Note that using --without-libcurl does run ACTION-IF-NO.
#
# This macro defines HAVE_LIBCURL if a working libcurl setup is found,
# and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary values.
# Other useful defines are LIBCURL_FEATURE_xxx where xxx are the
# various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
# where yyy are the various protocols supported by libcurl.  Both xxx
# and yyy are capitalized.  See the list of AH_TEMPLATEs at the top of
# the macro for the complete list of possible defines.  Shell
# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also
# defined to 'yes' for those features and protocols that were found.
# Note that xxx and yyy keep the same capitalization as in the
# curl-config list (e.g. it's "HTTP" and not "http").
#
# Users may override the detected values by doing something like:
# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure
#
# For the sake of sanity, this macro assumes that any libcurl that is
# found is after version 7.7.2, the first version that included the
# curl-config script.  Note that it is very important for people
# packaging binary versions of libcurl to include this script!
# Without curl-config, we can only guess what protocols are available.

AC_DEFUN([CURLPP_CHECK_CONFIG],
[
  LIBCURL_CHECK_CONFIG

  if test x"$LIBCURL" != "x" ; then

  AC_ARG_WITH(curlpp,
     AC_HELP_STRING([--with-curlpp=DIR],[look for the curlpp library in DIR]),
     [_curlpp_with=$withval],[_curlpp_with=ifelse([$1],,[yes],[$1])])

  if test "$_curlpp_with" != "no" ; then

     AC_PROG_AWK

     _curlpp_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"

     _curlpp_try_link=yes

     if test -d "$_curlpp_with" ; then
        CPPFLAGS="${CPPFLAGS} -I$withval/include"
        LDFLAGS="${LDFLAGS} -L$withval/lib"
     fi

     AC_PATH_PROG([_curlpp_config],[curlpp-config])

     if test x$_curlpp_config != "x" ; then
        AC_CACHE_CHECK([for the version of curlpp],
	   [curlpp_cv_lib_curlpp_version],
           [curlpp_cv_lib_curlpp_version=`$_curlpp_config --version | $AWK '{print $[]2}'`])

	_curlpp_version=`echo $curlpp_cv_lib_curlpp_version | $_curlpp_version_parse`
	_curlpp_wanted=`echo ifelse([$2],,[0],[$2]) | $_curlpp_version_parse`

        if test $_curlpp_wanted -gt 0 ; then
	   AC_CACHE_CHECK([for curlpp >= version $2],
	      [curlpp_cv_lib_version_ok],
              [
   	      if test $_curlpp_version -ge $_curlpp_wanted ; then
	         curlpp_cv_lib_version_ok=yes
      	      else
	         curlpp_cv_lib_version_ok=no
  	      fi
              ])
        fi

	if test $_curlpp_wanted -eq 0 || test x$curlpp_cv_lib_version_ok = xyes ; then
           if test x"$CURLPP_CPPFLAGS" = "x" ; then
              CURLPP_CPPFLAGS=`$_curlpp_config --cflags`
           fi
           if test x"$CURLPP" = "x" ; then
              CURLPP=`$_curlpp_config --libs`
           fi
	else
           _curlpp_try_link=no
	fi

	unset _curlpp_wanted
     fi

     if test $_curlpp_try_link = yes ; then

        # we didn't find curl-config, so let's see if the user-supplied
        # link line (or failing that, "-lcurl") is enough.
        CURLPP=${CURLPP-"-lcurl"}

        AC_CACHE_CHECK([whether curlpp is usable],
           [curlpp_cv_lib_curlpp_usable],
           [
           _curlpp_save_cppflags=$CPPFLAGS
           CPPFLAGS="$CPPFLAGS $CURLPP_CPPFLAGS"
           _libcurl_save_libs=$LIBS
           LIBS="$LIBS $CURLPP"

           AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curlpp/cURLpp.hpp>],[
/* Try and use a few common options to force a failure if we are
   missing symbols or can't link. */
int x;	
cURLpp::initialize();
]),curlpp_cv_lib_curlpp_usable=yes,curlpp_cv_lib_curlpp_usable=no)

           CPPFLAGS=$_curlpp_save_cppflags
           LIBS=$_curlpp_save_libs
           unset _curlpp_save_cppflags
           unset _curlpp_save_libs
           ])

        if test $curlpp_cv_lib_curlpp_usable = yes ; then

           AC_DEFINE(HAVE_CURLPP,1,
             [Define to 1 if you have a functional curlpp library.])
           AC_SUBST(CURLPP_CPPFLAGS)
           AC_SUBST(CURLPP)
        fi
     fi

     unset _curlpp_try_link
     unset _curlpp_version_parse
     unset _curlpp_config
     unset _curlpp_feature
     unset _curlpp_features
     unset _curlpp_protocol
     unset _curlpp_protocols
     unset _curlpp_version
  fi

  if test x$_curlpp_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
     # This is the IF-NO path
     ifelse([$4],,:,[$4])
  else
     # This is the IF-YES path
     ifelse([$3],,:,[$3])
  fi

  unset _curlpp_with
  fi
])dnl