xref: /php-src/ext/bz2/config.m4 (revision dcdcb3cb)
1PHP_ARG_WITH([bz2],
2  [for BZip2 support],
3  [AS_HELP_STRING([[--with-bz2[=DIR]]],
4    [Include BZip2 support])])
5
6if test "$PHP_BZ2" != "no"; then
7  AS_IF([test -r $PHP_BZ2/include/bzlib.h], [BZIP_DIR=$PHP_BZ2], [
8    for i in /usr/local /usr; do
9      AS_IF([test -r $i/include/bzlib.h], [BZIP_DIR=$i; break;])
10    done
11  ])
12
13  AC_MSG_CHECKING([for BZip2])
14  AS_VAR_IF([BZIP_DIR],, [
15    AC_MSG_RESULT([bzlib.h not found])
16    AC_MSG_ERROR([Please reinstall the BZip2 library package])
17  ], [AC_MSG_RESULT([found in $BZIP_DIR])])
18
19  PHP_CHECK_LIBRARY([bz2], [BZ2_bzerror], [
20    PHP_ADD_INCLUDE([$BZIP_DIR/include])
21    PHP_ADD_LIBRARY_WITH_PATH([bz2],
22      [$BZIP_DIR/$PHP_LIBDIR],
23      [BZ2_SHARED_LIBADD])
24    AC_DEFINE([HAVE_BZ2], [1],
25      [Define to 1 if the PHP extension 'bz2' is available.])
26    ],
27    [AC_MSG_FAILURE([The bz2 extension requires libbz2 >= 1.0.0])],
28    [-L$BZIP_DIR/$PHP_LIBDIR])
29
30  PHP_NEW_EXTENSION([bz2], [bz2.c bz2_filter.c], [$ext_shared])
31  PHP_SUBST([BZ2_SHARED_LIBADD])
32fi
33