@@ -18,6 +18,11 @@ PHP_ARG_ENABLE([bsdiff],
1818 [ Enable bsdiff support] ) ] ,
1919 [ no] )
2020
21+ PHP_ARG_WITH([ bz2] ,
22+ [ to specify installation directory of BZip2] ,
23+ [ AS_HELP_STRING ( [ [ --with-bz2=DIR] ] ,
24+ [ Specify installation directory of BZip2] ) ] )
25+
2126if test "$PHP_BSDIFF" != "no"; then
2227 dnl Write more examples of tests here...
2328
@@ -62,30 +67,37 @@ if test "$PHP_BSDIFF" != "no"; then
6267 dnl LIBNAME=BSDIFF # you may want to change this
6368 dnl LIBSYMBOL=BSDIFF # you most likely want to change this
6469
65- dnl If you need to check for a particular library function (e.g. a conditional
66- dnl or version-dependent feature) and you are using pkg-config:
67- dnl PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL,
68- dnl [
69- dnl AC_DEFINE(HAVE_BSDIFF_FEATURE, 1, [ ])
70- dnl ],[
71- dnl AC_MSG_ERROR([FEATURE not supported by your bsdiff library.])
72- dnl ], [
73- dnl $LIBFOO_LIBS
74- dnl ])
75-
76- dnl If you need to check for a particular library function (e.g. a conditional
77- dnl or version-dependent feature) and you are not using pkg-config:
78- dnl PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL,
79- dnl [
80- dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $BSDIFF_DIR/$PHP_LIBDIR, BSDIFF_SHARED_LIBADD)
81- dnl AC_DEFINE(HAVE_BSDIFF_FEATURE, 1, [ ])
82- dnl ],[
83- dnl AC_MSG_ERROR([FEATURE not supported by your bsdiff library.])
84- dnl ],[
85- dnl -L$BSDIFF_DIR/$PHP_LIBDIR -lm
86- dnl ])
87- dnl
88- dnl PHP_SUBST(BSDIFF_SHARED_LIBADD)
70+ if test "$PHP_BZ2" != "no"; then
71+ if test -r $PHP_BZ2/include/bzlib.h; then
72+ BZIP_DIR=$PHP_BZ2
73+ else
74+ AC_MSG_CHECKING ( for BZip2 in default path )
75+ for i in /usr/local /usr; do
76+ if test -r $i/include/bzlib.h; then
77+ BZIP_DIR=$i
78+ AC_MSG_RESULT ( found in $i )
79+ break
80+ fi
81+ done
82+ fi
83+
84+ if test -z "$BZIP_DIR"; then
85+ AC_MSG_RESULT ( not found )
86+ AC_MSG_ERROR ( Please reinstall the BZip2 distribution )
87+ fi
88+
89+ PHP_CHECK_LIBRARY(bz2, BZ2_bzWriteOpen,
90+ [
91+ PHP_ADD_INCLUDE($BZIP_DIR/include)
92+ PHP_ADD_LIBRARY_WITH_PATH(bz2, $BZIP_DIR/$PHP_LIBDIR, BSDIFF_SHARED_LIBADD)
93+ AC_DEFINE ( HAVE_BZ2 ,1 ,[ ] )
94+ ] , [
95+ AC_MSG_ERROR ( php-bsdiff requires libbz2 >= 1.0.0 )
96+ ] , [
97+ -L$BZIP_DIR/$PHP_LIBDIR
98+ ] )
99+ PHP_SUBST(BSDIFF_SHARED_LIBADD)
100+ fi
89101
90102 dnl In case of no dependencies
91103 AC_DEFINE ( HAVE_BSDIFF , 1 , [ Have bsdiff support ] )
0 commit comments