@@ -7,6 +7,12 @@ PHP_ARG_WITH(libxlsxwriter, system libxlsxwriter,
77PHP_ARG_WITH(libxlsxio, system libxlsxio,
88[ --with-libxlsxio=DIR Use system libxlsxio] , no, no)
99
10+ PHP_ARG_WITH(openssl_md5, openssl MD5,
11+ [ --with-openssl-md5=DIR Use openssl MD5] , no, no)
12+
13+ PHP_ARG_WITH(bundled_md5, bundled MD5,
14+ [ --with-bundled-md5 Use bundled MD5] , no, no)
15+
1016PHP_ARG_ENABLE(reader, enable xlsx reader support,
1117[ --enable-reader Enable xlsx reader?] , yes, yes)
1218
@@ -37,9 +43,12 @@ if test "$PHP_XLSWRITER" != "no"; then
3743 library/libxlsxwriter/third_party/minizip/zip.c \
3844 "
3945
46+ md5_sources="
47+ library/libxlsxwriter/third_party/md5/md5.c \
48+ "
49+
4050 libxlsxwriter_sources="
4151 library/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c \
42- library/libxlsxwriter/third_party/md5/md5.c \
4352 library/libxlsxwriter/src/app.c \
4453 library/libxlsxwriter/src/chart.c \
4554 library/libxlsxwriter/src/chartsheet.c \
@@ -78,9 +87,44 @@ if test "$PHP_XLSWRITER" != "no"; then
7887 "
7988
8089 AC_MSG_CHECKING ( [ Check libxlsxwriter library] )
81- if test "$PHP_LIBXLSXWRITER" != "no"; then
8290
83- for i in $PHP_LIBXLSXWRITER /usr/local /usr; do
91+ if test "$PHP_OPENSSL_MD5" != "no"; then
92+ AC_MSG_RESULT ( [ use the openssl md5 library] )
93+ for i in $PHP_OPENSSL_MD5 /usr/local /usr /usr/local/opt; do
94+ if test -r $i/include/openssl/md5.h; then
95+ OPENSSL_DIR=$i
96+ AC_MSG_RESULT ( [ found in $i] )
97+ break
98+ fi
99+ done
100+
101+ if test -z "$OPENSSL_DIR"; then
102+ AC_MSG_ERROR ( [ openssl library not found] )
103+ else
104+ PHP_ADD_INCLUDE($OPENSSL_DIR/include)
105+
106+ PHP_CHECK_LIBRARY(crypto, MD5_Init,
107+ [
108+ PHP_ADD_LIBRARY_WITH_PATH(crypto, $OPENSSL_DIR/lib, XLSWRITER_SHARED_LIBADD)
109+ ] ,[
110+ AC_MSG_ERROR ( [ Wrong openssl MD5_Init not found] )
111+ ] ,[
112+ -L$OPENSSL_DIR/lib -lcrypto
113+ ] )
114+
115+ AC_DEFINE ( USE_OPENSSL_MD5 , 1 , [ use openssl md5 ] )
116+ fi
117+
118+ PHP_BUNDLED_MD5=no
119+ fi
120+
121+ if test "$PHP_BUNDLED_MD5" != "no"; then
122+ AC_MSG_RESULT ( [ use the bundled md5 library] )
123+ xls_writer_sources="$xls_writer_sources $md5_sources"
124+ fi
125+
126+ if test "$PHP_LIBXLSXWRITER" != "no"; then
127+ for i in $PHP_LIBXLSXWRITER /usr/local /usr /usr/local/opt; do
84128 if test -r $i/include/xlsxwriter.h; then
85129 XLSXWRITER_DIR=$i
86130 AC_MSG_RESULT ( [ found in $i] )
@@ -116,7 +160,7 @@ if test "$PHP_XLSWRITER" != "no"; then
116160 PHP_ADD_INCLUDE([ PHP_EXT_SRCDIR/library/libxlsxwriter/include] )
117161
118162 dnl see library/CMakeLists.txt
119- LIBOPT="-DNOCRYPT -DNOUNCRYPT"
163+ LIBOPT="$LIBOPT -DNOCRYPT -DNOUNCRYPT"
120164 fi
121165
122166 if test "$PHP_READER" = "yes"; then
0 commit comments