@@ -6,75 +6,47 @@ PHP_ARG_WITH(curl, for cURL support,
6
6
[ --with-curl[ =DIR] Include cURL support] )
7
7
8
8
if test "$PHP_CURL" != "no"; then
9
- if test -r $PHP_CURL/include/curl/easy.h; then
10
- CURL_DIR=$PHP_CURL
11
- else
12
- AC_MSG_CHECKING ( for cURL in default path )
13
- for i in /usr/local /usr; do
14
- if test -r $i/include/curl/easy.h; then
15
- CURL_DIR=$i
16
- AC_MSG_RESULT ( found in $i )
17
- break
18
- fi
19
- done
20
- if test -z "$CURL_DIR"; then
21
- AC_MSG_RESULT ( not found )
22
- if which dpkg-architecture>/dev/null; then
23
- AC_MSG_CHECKING ( for cURL in multiarch path )
24
- CURL_MULTIARCH_INCLUDE=/usr/include/$(dpkg-architecture -qDEB_HOST_MULTIARCH)
25
- if test -r $CURL_MULTIARCH_INCLUDE/curl/easy.h; then
26
- CURL_DIR=/usr
27
- AC_MSG_RESULT ( found in $CURL_MULTIARCH_INCLUDE )
28
- else
29
- AC_MSG_RESULT ( not found )
30
- fi
31
- fi
32
- fi
33
- fi
34
-
35
- if test -z "$CURL_DIR"; then
36
- AC_MSG_ERROR ( Could not find cURL , please reinstall the libcurl distribution -
37
- easy.h should be in <curl-dir>/include/curl/ )
9
+ if test -z "$PKG_CONFIG"; then
10
+ AC_PATH_PROG ( PKG_CONFIG , pkg-config , no )
38
11
fi
39
12
40
- CURL_CONFIG="curl-config"
41
- AC_MSG_CHECKING ( for cURL 7.10.5 or greater )
42
-
43
- if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then
44
- CURL_CONFIG=${CURL_DIR}/bin/curl-config
13
+ AC_MSG_CHECKING ( for libcurl.pc )
14
+ if test "$PHP_CURL" == "yes"; then
15
+ PKNAME=libcurl
16
+ AC_MSG_RESULT ( using default path )
17
+ elif test -r $PHP_CURL/$PHP_LIBDIR/pkgconfig/libcurl.pc; then
18
+ PKNAME=$PHP_CURL/$PHP_LIBDIR/pkgconfig/libcurl.pc
19
+ AC_MSG_RESULT ( using $PKNAME )
20
+ elif test -r $PHP_CURL/lib/pkgconfig/libcurl.pc; then
21
+ PKNAME=$PHP_CURL/lib/pkgconfig/libcurl.pc
22
+ AC_MSG_RESULT ( using $PKNAME )
45
23
else
46
- if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
47
- CURL_CONFIG=${CURL_DIR}/curl-config
48
- fi
24
+ AC_MSG_ERROR ( Could not find libcurl.pc )
49
25
fi
50
26
51
- curl_version_full=`$CURL_CONFIG --version`
52
- curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
53
- if test "$curl_version" -ge 7010005; then
27
+ AC_MSG_CHECKING ( for cURL 7.10.5 or greater )
28
+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --atleast-version 7.10.5 $PKNAME; then
29
+ curl_version_full=`$PKG_CONFIG --modversion $PKNAME`
54
30
AC_MSG_RESULT ( $curl_version_full )
55
- CURL_LIBS=`$CURL_CONFIG --libs`
56
31
else
57
32
AC_MSG_ERROR ( cURL version 7.10.5 or later is required to compile php with cURL support )
58
33
fi
59
34
60
- if test -z "$CURL_MULTIARCH_INCLUDE"; then
61
- PHP_ADD_INCLUDE($CURL_DIR/include)
62
- else
63
- PHP_ADD_INCLUDE($CURL_MULTIARCH_INCLUDE)
64
- fi
35
+ CURL_LIBS=`$PKG_CONFIG --libs $PKNAME`
36
+ CURL_INCL=`$PKG_CONFIG --cflags $PKNAME`
65
37
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
66
- PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR , CURL_SHARED_LIBADD)
38
+ PHP_EVAL_INCLINE($CURL_INCL , CURL_SHARED_LIBADD)
67
39
68
40
AC_MSG_CHECKING ( [ for SSL support in libcurl] )
69
- CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
70
- if test "$CURL_SSL" = "SSL "; then
41
+ CURL_SSL=`$PKG_CONFIG --variable=supported_features $PKNAME | $EGREP SSL`
42
+ if test -n "$CURL_SSL"; then
71
43
AC_MSG_RESULT ( [ yes] )
72
44
AC_DEFINE ( [ HAVE_CURL_SSL] , [ 1] , [ Have cURL with SSL support] )
73
45
74
46
save_CFLAGS="$CFLAGS"
75
- CFLAGS="`$CURL_CONFIG --cflags`"
76
- save_LDFLAGS="$LDFLAGS "
77
- LDFLAGS="`$CURL_CONFIG --libs`"
47
+ CFLAGS=$CURL_INCL
48
+ save_LDFLAGS="$CFLAGS "
49
+ LDFLAGS=$CURL_LIBS
78
50
79
51
AC_PROG_CPP
80
52
AC_MSG_CHECKING ( [ for openssl support in libcurl] )
@@ -145,21 +117,21 @@ int main(int argc, char *argv[])
145
117
] ,[
146
118
AC_MSG_ERROR ( There is something wrong. Please check config.log for more information. )
147
119
] ,[
148
- $CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
120
+ $CURL_LIBS
149
121
] )
150
122
151
123
PHP_CHECK_LIBRARY(curl,curl_easy_strerror,
152
124
[
153
125
AC_DEFINE ( HAVE_CURL_EASY_STRERROR ,1 ,[ ] )
154
126
] ,[ ] ,[
155
- $CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
127
+ $CURL_LIBS
156
128
] )
157
129
158
130
PHP_CHECK_LIBRARY(curl,curl_multi_strerror,
159
131
[
160
132
AC_DEFINE ( HAVE_CURL_MULTI_STRERROR ,1 ,[ ] )
161
133
] ,[ ] ,[
162
- $CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
134
+ $CURL_LIBS
163
135
] )
164
136
165
137
PHP_NEW_EXTENSION(curl, interface.c multi.c share.c curl_file.c, $ext_shared)
0 commit comments