Skip to content

Commit 247fbf4

Browse files
committed
config.m4 openssl md5
1 parent 0c9db51 commit 247fbf4

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

config.m4

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ PHP_ARG_WITH(libxlsxwriter, system libxlsxwriter,
77
PHP_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+
1016
PHP_ARG_ENABLE(reader, enable xlsx reader support,
1117
[ --enable-reader Enable xlsx reader?], yes, yes)
1218

13-
PHP_ARG_ENABLE(md5, MD5 support,
14-
[ --enable-md5 Use third party MD5?], no, no)
15-
1619
if test "$PHP_XLSWRITER" != "no"; then
1720
xls_writer_sources="
1821
xlswriter.c \
@@ -85,13 +88,43 @@ if test "$PHP_XLSWRITER" != "no"; then
8588

8689
AC_MSG_CHECKING([Check libxlsxwriter library])
8790

88-
if test "$PHP_MD5" != "no"; then
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
89122
AC_MSG_RESULT([use the bundled md5 library])
90123
xls_writer_sources="$xls_writer_sources $md5_sources"
91124
fi
92125

93126
if test "$PHP_LIBXLSXWRITER" != "no"; then
94-
for i in $PHP_LIBXLSXWRITER /usr/local /usr; do
127+
for i in $PHP_LIBXLSXWRITER /usr/local /usr /usr/local/opt; do
95128
if test -r $i/include/xlsxwriter.h; then
96129
XLSXWRITER_DIR=$i
97130
AC_MSG_RESULT([found in $i])
@@ -127,7 +160,7 @@ if test "$PHP_XLSWRITER" != "no"; then
127160
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/library/libxlsxwriter/include])
128161

129162
dnl see library/CMakeLists.txt
130-
LIBOPT="-DNOCRYPT -DNOUNCRYPT"
163+
LIBOPT="$LIBOPT -DNOCRYPT -DNOUNCRYPT"
131164
fi
132165

133166
if test "$PHP_READER" = "yes"; then

0 commit comments

Comments
 (0)