xref: /PHP-8.0/ext/bz2/config.m4 (revision 75fb7486)
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  if test -r $PHP_BZ2/include/bzlib.h; then
8    BZIP_DIR=$PHP_BZ2
9  else
10    AC_MSG_CHECKING(for BZip2 in default path)
11    for i in /usr/local /usr; do
12      if test -r $i/include/bzlib.h; then
13        BZIP_DIR=$i
14        AC_MSG_RESULT(found in $i)
15        break
16      fi
17    done
18  fi
19
20  if test -z "$BZIP_DIR"; then
21    AC_MSG_RESULT(not found)
22    AC_MSG_ERROR(Please reinstall the BZip2 distribution)
23  fi
24
25  PHP_CHECK_LIBRARY(bz2, BZ2_bzerror,
26  [
27    PHP_ADD_INCLUDE($BZIP_DIR/include)
28    PHP_ADD_LIBRARY_WITH_PATH(bz2, $BZIP_DIR/$PHP_LIBDIR, BZ2_SHARED_LIBADD)
29    AC_DEFINE(HAVE_BZ2,1,[ ])
30  ], [
31    AC_MSG_ERROR(bz2 module requires libbz2 >= 1.0.0)
32  ], [
33    -L$BZIP_DIR/$PHP_LIBDIR
34  ])
35
36  PHP_NEW_EXTENSION(bz2, bz2.c bz2_filter.c, $ext_shared)
37  PHP_SUBST(BZ2_SHARED_LIBADD)
38fi
39