forked from viest/php-ext-xlswriter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
233 lines (198 loc) · 7.98 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
PHP_ARG_WITH(xlswriter, xlswriter support,
[ --with-xlswriter Include xlswriter support], yes)
PHP_ARG_WITH(libxlsxwriter, system libxlsxwriter,
[ --with-libxlsxwriter=DIR Use system libxlsxwriter], no, no)
PHP_ARG_WITH(libxlsxio, system libxlsxio,
[ --with-libxlsxio=DIR Use system libxlsxio], no, no)
PHP_ARG_WITH(openssl, openssl MD5,
[ --with-openssl=DIR Use openssl MD5], no, no)
PHP_ARG_ENABLE(reader, enable xlsx reader support,
[ --enable-reader Enable xlsx reader?], yes, yes)
if test "$PHP_XLSWRITER" != "no"; then
xls_writer_sources="
xlswriter.c \
kernel/chart.c \
kernel/common.c \
kernel/excel.c \
kernel/exception.c \
kernel/format.c \
kernel/help.c \
kernel/resource.c \
kernel/rich_string.c \
kernel/validation.c \
kernel/write.c \
"
xls_read_sources="
kernel/read.c \
kernel/csv.c \
"
minizip_sources="
library/libxlsxwriter/third_party/minizip/ioapi.c \
library/libxlsxwriter/third_party/minizip/mztools.c \
library/libxlsxwriter/third_party/minizip/unzip.c \
library/libxlsxwriter/third_party/minizip/zip.c \
"
md5_sources="
library/libxlsxwriter/third_party/md5/md5.c \
"
libxlsxwriter_sources="
library/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c \
library/libxlsxwriter/src/app.c \
library/libxlsxwriter/src/chart.c \
library/libxlsxwriter/src/chartsheet.c \
library/libxlsxwriter/src/comment.c \
library/libxlsxwriter/src/content_types.c \
library/libxlsxwriter/src/core.c \
library/libxlsxwriter/src/custom.c \
library/libxlsxwriter/src/drawing.c \
library/libxlsxwriter/src/format.c \
library/libxlsxwriter/src/hash_table.c \
library/libxlsxwriter/src/metadata.c \
library/libxlsxwriter/src/packager.c \
library/libxlsxwriter/src/relationships.c \
library/libxlsxwriter/src/shared_strings.c \
library/libxlsxwriter/src/styles.c \
library/libxlsxwriter/src/theme.c \
library/libxlsxwriter/src/utility.c \
library/libxlsxwriter/src/vml.c \
library/libxlsxwriter/src/workbook.c \
library/libxlsxwriter/src/worksheet.c \
library/libxlsxwriter/src/xmlwriter.c \
"
libexpat="
library/libexpat/expat/lib/loadlibrary.c \
library/libexpat/expat/lib/xmlparse.c \
library/libexpat/expat/lib/xmlrole.c \
library/libexpat/expat/lib/xmltok.c \
library/libexpat/expat/lib/xmltok_impl.c \
library/libexpat/expat/lib/xmltok_ns.c \
"
libxlsxio="
library/libxlsxio/lib/xlsxio_read.c \
library/libxlsxio/lib/xlsxio_read_sharedstrings.c \
"
AC_MSG_CHECKING([Check libxlsxwriter library])
if test "$PHP_OPENSSL" != "no"; then
AC_MSG_RESULT([use the openssl md5 library])
for i in $PHP_OPENSSL /usr/local /usr /usr/local/opt; do
if test -r $i/include/openssl/md5.h; then
OPENSSL_DIR=$i
AC_MSG_RESULT([found in $i])
break
fi
done
if test -z "$OPENSSL_DIR"; then
PHP_SETUP_OPENSSL(XLSWRITER_SHARED_LIBADD,
[
AC_DEFINE(USE_OPENSSL_MD5, 1, [ use openssl md5 ])
], [
AC_MSG_ERROR([openssl library not found])
])
else
PHP_ADD_INCLUDE($OPENSSL_DIR/include)
PHP_CHECK_LIBRARY(crypto, MD5_Init,
[
PHP_ADD_LIBRARY_WITH_PATH(crypto, $OPENSSL_DIR/lib, XLSWRITER_SHARED_LIBADD)
],[
AC_MSG_ERROR([Wrong openssl MD5_Init not found])
],[
-L$OPENSSL_DIR/lib -lcrypto
])
AC_DEFINE(USE_OPENSSL_MD5, 1, [ use openssl md5 ])
fi
else
AC_MSG_RESULT([use the bundled md5 library])
xls_writer_sources="$xls_writer_sources $md5_sources"
fi
if test "$PHP_LIBXLSXWRITER" != "no"; then
for i in $PHP_LIBXLSXWRITER /usr/local /usr /usr/local/opt; do
if test -r $i/include/xlsxwriter.h; then
XLSXWRITER_DIR=$i
AC_MSG_RESULT([found in $i])
break
fi
done
if test -z "$XLSXWRITER_DIR"; then
AC_MSG_ERROR([libxlsxwriter library not found])
else
PHP_ADD_INCLUDE($XLSXWRITER_DIR/include)
PHP_CHECK_LIBRARY(xlsxwriter, lxw_worksheet_find_cell_in_row,
[
PHP_ADD_LIBRARY_WITH_PATH(xlsxwriter, $i/$PHP_LIBDIR, XLSWRITER_SHARED_LIBADD)
],[
AC_MSG_ERROR([Wrong libxlsxwriter version or library not found, 0.9.3 required])
],[
-L$XLSXWRITER_DIR/$PHP_LIBDIR -lm
])
PHP_CHECK_LIBRARY(xlsxwriter, lxw_fopen,
[
AC_DEFINE(HAVE_LXW_OPEN, 1, [ lxw_fopen available in 0.8.8 ])
],[
],[
-L$XLSXWRITER_DIR/$PHP_LIBDIR -lm
])
fi
AC_DEFINE(HAVE_LIBXLSXWRITER, 1, [ use system libxlsxwriter ])
else
AC_MSG_RESULT([use the bundled library])
xls_writer_sources="$xls_writer_sources $libxlsxwriter_sources"
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/library/libxlsxwriter/include])
dnl see library/CMakeLists.txt
LIBOPT="$LIBOPT -DNOCRYPT -DNOUNCRYPT"
fi
if test "$PHP_READER" = "yes"; then
AC_MSG_CHECKING([Check libxlsxwriter library])
if test "$PHP_LIBXLSXIO" != "no"; then
for i in $PHP_LIBXLSXIO /usr/local /usr; do
if test -r $i/include/xlsxio_read.h; then
XLSXIO_DIR=$i
AC_MSG_RESULT([found in $i])
break
fi
done
if test -z "$XLSXIO_DIR"; then
AC_MSG_ERROR([libxlsxio library not found])
else
PHP_ADD_INCLUDE($XLSXIO_DIR/include)
PHP_CHECK_LIBRARY(xlsxio_read, xlsxioread_sheet_open,
[
PHP_ADD_LIBRARY_WITH_PATH(xlsxio_read, $i/$PHP_LIBDIR, XLSWRITER_SHARED_LIBADD)
],[
AC_MSG_ERROR([Wrong libxlsxio version or library not found])
],[
-L$XLSXWRITER_DIR/$PHP_LIBDIR -lm
])
fi
AC_DEFINE(HAVE_LIBXLSXIO, 1, [ use system libxlsxwriter ])
else
AC_MSG_RESULT([use the bundled library])
xls_writer_sources="$xls_writer_sources $libexpat"
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/library/libexpat/expat/lib])
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libexpat/expat/lib])
LIBOPT="$LIBOPT -DXML_POOR_ENTROPY"
xls_writer_sources="$xls_writer_sources $libxlsxio"
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/library/libxlsxio/include])
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxio/lib])
LIBOPT="$LIBOPT -DUSE_MINIZIP"
fi
xls_writer_sources="$xls_writer_sources $xls_read_sources"
AC_DEFINE(ENABLE_READER, 1, [enable reader])
fi
if test "$PHP_LIBXLSXIO" = "no" || test "$PHP_LIBXLSXWRITER" = "no"; then
xls_writer_sources="$xls_writer_sources $minizip_sources"
fi
if test -z "$PHP_DEBUG"; then
AC_ARG_ENABLE(debug, [--enable-debug compile with debugging system], [PHP_DEBUG=$enableval],[PHP_DEBUG=no])
fi
PHP_SUBST(XLSWRITER_SHARED_LIBADD)
PHP_NEW_EXTENSION(xlswriter, $xls_writer_sources, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $LIBOPT)
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR])
PHP_ADD_INCLUDE([PHP_EXT_SRCDIR/include])
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/kernel])
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxwriter/src])
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxwriter/third_party/minizip])
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxwriter/third_party/tmpfileplus])
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxwriter/third_party/md5])
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libexpat/expat/lib])
PHP_ADD_BUILD_DIR([PHP_EXT_BUILDDIR/library/libxlsxio/lib])
fi