Skip to content

Commit e595f5c

Browse files
committed
Migrate ext/zlib to use pkg-config
There are other extensions checking for zlib as well, not quite sure what to do there with regard to option names.
1 parent df850bf commit e595f5c

File tree

2 files changed

+9
-58
lines changed

2 files changed

+9
-58
lines changed

ext/curl/config.m4

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ if test "$PHP_CURL" != "no"; then
77
PKG_CHECK_MODULES([CURL], [libcurl >= 7.15.5])
88
PKG_CHECK_VAR([CURL_FEATURES], [libcurl], [supported_features])
99

10-
dnl common stuff (pkg-config / curl-config)
11-
1210
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
13-
PHP_EVAL_INCLINE($CURL_CFLAGS, CURL_SHARED_LIBADD)
11+
PHP_EVAL_INCLINE($CURL_CFLAGS)
1412

1513
AC_MSG_CHECKING([for SSL support in libcurl])
1614
case "$CURL_FEATURES" in

ext/zlib/config0.m4

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,16 @@
11
dnl config.m4 for extension zlib
22

33
PHP_ARG_WITH(zlib,for ZLIB support,
4-
[ --with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.2.0.4)])
4+
[ --with-zlib Include ZLIB support (requires zlib >= 1.2.0.4)])
55

6-
PHP_ARG_WITH(zlib-dir,if the location of ZLIB install directory is defined,
7-
[ --with-zlib-dir=<DIR> Define the location of zlib install directory], no, no)
6+
if test "$PHP_ZLIB" != "no"; then
7+
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0.4])
88

9-
if test "$PHP_ZLIB" != "no" || test "$PHP_ZLIB_DIR" != "no"; then
10-
PHP_NEW_EXTENSION(zlib, zlib.c zlib_fopen_wrapper.c zlib_filter.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
11-
PHP_SUBST(ZLIB_SHARED_LIBADD)
12-
13-
if test "$PHP_ZLIB" != "yes" -a "$PHP_ZLIB" != "no"; then
14-
if test -f $PHP_ZLIB/include/zlib/zlib.h; then
15-
ZLIB_DIR=$PHP_ZLIB
16-
ZLIB_INCDIR=$ZLIB_DIR/include/zlib
17-
elif test -f $PHP_ZLIB/include/zlib.h; then
18-
ZLIB_DIR=$PHP_ZLIB
19-
ZLIB_INCDIR=$ZLIB_DIR/include
20-
fi
21-
else
22-
for i in /usr/local /usr $PHP_ZLIB_DIR; do
23-
if test -f $i/include/zlib/zlib.h; then
24-
ZLIB_DIR=$i
25-
ZLIB_INCDIR=$i/include/zlib
26-
elif test -f $i/include/zlib.h; then
27-
ZLIB_DIR=$i
28-
ZLIB_INCDIR=$i/include
29-
fi
30-
done
31-
fi
32-
33-
if test -z "$ZLIB_DIR"; then
34-
AC_MSG_ERROR(Cannot find zlib)
35-
fi
36-
37-
case $ZLIB_DIR in
38-
/usr) ac_extra= ;;
39-
*) ac_extra=-L$ZLIB_DIR/$PHP_LIBDIR ;;
40-
esac
9+
PHP_EVAL_LIBLINE($ZLIB_LIBS, ZLIB_SHARED_LIBADD)
10+
PHP_EVAL_INCLINE($ZLIB_CFLAGS)
4111

42-
AC_MSG_CHECKING([for zlib version >= 1.2.0.4])
43-
ZLIB_VERSION=`$EGREP "define ZLIB_VERSION" $ZLIB_INCDIR/zlib.h | $SED -e 's/[[^0-9\.]]//g'`
44-
AC_MSG_RESULT([$ZLIB_VERSION])
45-
if test `echo $ZLIB_VERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print $1*1000000 + $2*10000 + $3*100 + $4}'` -lt 1020004; then
46-
AC_MSG_ERROR([zlib version greater or equal to 1.2.0.4 required])
47-
fi
48-
49-
PHP_CHECK_LIBRARY(z, gzgets, [
50-
AC_DEFINE(HAVE_ZLIB,1,[ ])
51-
],[
52-
AC_MSG_ERROR(ZLIB extension requires gzgets in zlib)
53-
],[
54-
$ac_extra
55-
])
56-
57-
PHP_ADD_LIBPATH($ZLIB_DIR/$PHP_LIBDIR, ZLIB_SHARED_LIBADD)
58-
59-
PHP_ZLIB_DIR=$ZLIB_DIR
60-
PHP_ADD_LIBRARY(z,, ZLIB_SHARED_LIBADD)
61-
PHP_ADD_INCLUDE($ZLIB_INCDIR)
12+
AC_DEFINE(HAVE_ZLIB,1,[ ])
6213

14+
PHP_NEW_EXTENSION(zlib, zlib.c zlib_fopen_wrapper.c zlib_filter.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
15+
PHP_SUBST(ZLIB_SHARED_LIBADD)
6316
fi

0 commit comments

Comments
 (0)