-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
251 lines (206 loc) · 7.71 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
dnl config.m4 for extension korean
dnl Comments in this file start with the string 'dnl'.
dnl Remove where necessary. This file will not work
dnl without editing.
dnl If your extension references something external, use with:
PHP_ARG_ENABLE(korean, whether to enable korean support,
[ --enable-korean Enable korean support])
if test "$PHP_KOREAN" != "no"; then
AC_DEFINE(HAVE_KOREAN,1,[ ])
OOPS_PARAMETER="$CFLAGS -Wall -Iext"
PHP_SUBST(CPPFLAGS)
AC_MSG_CHECKING(whether to enable gd functoin)
AC_ARG_ENABLE(korean-gd, [ --enable-korean-gd Enable external gd functoin [ default=buildin ] ],[
if test "$enable_korean_gd" != "no" ; then
AC_MSG_RESULT(external)
else
AC_MSG_RESULT(builtin)
fi ], [ AC_MSG_RESULT(builtin) ])
if test -z "$PHP_JPEG_DIR"; then
PHP_ARG_WITH(jpeg-dir, for the location of libjpeg,
[ --with-jpeg-dir[=DIR] Set the path to libjpeg install prefix.], "/usr", no)
fi
if test -z "$PHP_PNG_DIR"; then
PHP_ARG_WITH(png-dir, for the location of libpng,
[ --with-png-dir[=DIR] Set the path to libpng install prefix.], "/usr", no)
fi
if test -z "$PHP_ZLIB_DIR"; then
PHP_ARG_WITH(zlib-dir, for the location of libz,
[ --with-zlib-dir[=DIR] Set the path to libz install prefix.], "/usr", no)
fi
AC_DEFINE(KOEAN_GD, 1, [ ])
if test -z "$enable_korean_gd" ; then
enable_korean_gd=no
fi
if test -z "$with_png_dir"; then
with_png_dir=no
fi
if test -z "$with_zlib_dir"; then
with_zlib_dir=no
fi
if test "$with_libdir" != "$PHP_LIBDIR"; then
parch=`uname -m`
if test "$parch" == "x86_64"; then
if test -d /usr/lib64 || test -d /usr/local/lib64; then
PHP_LIBDIR="lib64"
fi
fi
fi
test -z "$PHP_LIBDIR" && PHP_LIBDIR="lib"
dnl In this case given --enable-korean-gd option
dnl
if test "$enable_korean_gd" != "no" ; then
if test "$enable_korean_gd" = "yes"; then
GD_SEARCH_PATHS="/usr/local /usr"
else
GD_SEARCH_PATHS=$enable_korean_gd
fi
for j in $GD_SEARCH_PATHS; do
for i in include include/gd1.3 include/gd include gd1.3 gd ""; do
test -f $j/$i/gd.h && KOREAN_INCLUDE=$j/$i
done
for i in $PHP_LIBDIR $PHP_LIBDIR/gd1.3 $PHP_LIBDIR/gd $PHP_LIBDIR gd1.3 gd ""; do
test -f $j/$i/libgd.$SHLIB_SUFFIX_NAME -o -f $j/$i/libgd.a && KOREAN_LIB=$j/$i
done
done
if test -n "$KOREAN_INCLUDE" -a -n "$KOREAN_LIB" ; then
PHP_ADD_LIBRARY_WITH_PATH(gd, $KOREAN_LIB, KOREAN_SHARED_LIBADD)
else
AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $GD_SEARCH_PATHS])
fi
PHP_CHECK_LIBRARY(gd, gdImageCreateTrueColor,[AC_DEFINE(HAVE_GD2, 1,[ ])],[],[ -L$KOREAN_LIB $KOREAN_SHARED_LIBADD ])
PHP_EXPAND_PATH($KOREAN_INCLUDE, KOREAN_INCLUDE)
PHP_ADD_INCLUDE($KOREAN_INCLUDE)
else
dnl
dnl In this case, don't be given --enable-korean-gd option.
dnl This case use built in gd library.
dnl
dnl case of static build
if test "$ext_shared" = "no"; then
if test "$PHP_GD" = "no"; then
include_gdlib="yes"
else
include_gdlib="no"
fi
dnl case of dynamic build
else
dnl if exists gd bundle library?
AC_MSG_CHECKING(check gd bundle library for korean extension)
if test "$PHP_GD" = "no"; then
AC_MSG_RESULT(needless)
elif test -d "ext/gd/libgd" ; then
pushd ext/korean > /dev/null 2>&1
if test ! -L "./libgd"; then
mv libgd needless.libgd
ln -sf ../gd/libgd ./libgd
AC_MSG_RESULT(link complete)
else
AC_MSG_RESULT(already linked)
fi
popd > /dev/null 2>&1
else
AC_MSG_RESULT(needless)
AC_DEFINE(HAVE_GD_BUNDLED,1,[ ])
fi
include_gdlib="yes"
fi
dnl JPEG Libaray Check
for i in $with_jpeg_dir /usr/local /usr; do
test -f $i/$PHP_LIBDIR/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/$PHP_LIBDIR/libjpeg.a && KR_JPEG_DIR=$i && break
done
if test -z "$KR_JPEG_DIR" ; then
AC_MSG_ERROR([libjpeg.(a|so) not found.])
fi
PHP_CHECK_LIBRARY(jpeg,jpeg_read_header,
[
PHP_ADD_INCLUDE($KR_JPEG_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(jpeg, $KR_JPEG_DIR/$PHP_LIBDIR, KOREAN_SHARED_LIBADD)
],[
AC_MSG_ERROR([Problem with libjpeg.(a|so). Please check config.log for more information.])
],[
-L$KR_JPEG_DIR/$PHP_LIBDIR
])
dnl PNG Libaray Check
for i in $with_png_dir /usr/local /usr; do
test -f $i/$PHP_LIBDIR/libpng.$SHLIB_SUFFIX_NAME -o -f $i/$PHP_LIBDIR/libpng.a && KR_PNG_DIR=$i && break
done
if test -z "$KR_PNG_DIR" ; then
AC_MSG_ERROR([libpng.(a|so) not found.])
fi
if test ! -f $KR_PNG_DIR/include/png.h; then
AC_MSG_ERROR([png.h not found.])
fi
if test ! -f $KR_PNG_DIR/include/png.h; then
AC_MSG_ERROR([png.h not found.])
fi
dnl ZLIB Libaray Check
if test "$PHP_ZLIB_DIR" = "no"; then
for i in /usr/local /usr $PHP_ZLIB_DIR; do
test -f $i/$PHP_LIBDIR/libz.$SHLIB_SUFFIX_NAME -o -f $i/$PHP_LIBDIR/libz.a && KR_ZLIB_DIR=$i && break
done
if test -z "$KR_ZLIB_DIR"; then
AC_MSG_ERROR([PNG support requires ZLIB. Use --with-zlib-dir=<DIR>])
fi
if test -z "$KR_ZLIB_DIR" ; then
AC_MSG_ERROR([libz.(a|so) not found.])
fi
if test ! -f $KR_ZLIB_DIR/include/png.h; then
AC_MSG_ERROR([zlib.h not found.])
fi
if test ! -f $KR_ZLIB_DIR/include/png.h; then
AC_MSG_ERROR([zlib.h not found.])
fi
else
KR_ZLIB_DIR=$PHP_ZLIB_DIR
if test -z "$KR_ZLIB_DIR" ; then
AC_MSG_ERROR([libz.(a|so) not found.])
fi
if test ! -f $KR_ZLIB_DIR/include/png.h; then
AC_MSG_ERROR([zlib.h not found.])
fi
if test ! -f $KR_ZLIB_DIR/include/png.h; then
AC_MSG_ERROR([zlib.h not found.])
fi
fi
PHP_CHECK_LIBRARY(png,png_write_image,
[
PHP_ADD_INCLUDE($KR_PNG_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(z, $KR_ZLIB_DIR/$PHP_LIBDIR, KOREAN_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(png, $KR_PNG_DIR/$PHP_LIBDIR, KOREAN_SHARED_LIBADD)
],[
AC_MSG_ERROR([Problem with libpng.(a|so) or libz.(a|so). Please check config.log for more information.])
],[
-L$KR_ZLIB_DIR/$PHP_LIBDIR -lz -L$KR_PNG_DIR/$PHP_LIBDIR
])
KR_MODULE_TYPE=builtin
if test "$include_gdlib" = "yes"; then
krextra_sources="libgd/gd.c libgd/gd_png.c libgd/gd_jpeg.c libgd/gd_gif_in.c libgd/gd_io.c \
libgd/gd_gif_out.c libgd/gd_io_file.c libgd/gd_ss.c libgd/gd_io_ss.c \
libgd/gdtables.c libgd/gdhelpers.c libgd/gd_io_dp.c libgd/gd_topal.c \
libgd/gd_security.c"
fi
dnl These are always available with bundled library
AC_DEFINE(KRGD_BUILTIN, 1, [ ])
AC_DEFINE(HAVE_GD2, 1, [ ])
AC_DEFINE(HAVE_LIBPNG, 1, [ ])
AC_DEFINE(HAVE_LIBJPEG, 1, [ ])
if test "$include_gdlib" = "yes"; then
KOREAN_LIB="./libgd"
KR_PARAMETER="$OOPS_PARAMETER -I./libgd"
PHP_ADD_BUILD_DIR(./libgd)
else
KR_PARAMETER="$OOPS_PARAMETER"
fi
dnl PHP_ADD_LIBRARY_WITH_PATH(gd, $KOREAN_LIB, KOREAN_SHARED_LIBADD)
PHP_EXPAND_PATH($KOREAN_INCLUDE, KOREAN_INCLUDE)
PHP_ADD_INCLUDE($KOREAN_INCLUDE)
PHP_SUBST(KR_PARAMETER)
fi
AC_DEFINE(HAVE_KRLIBGD,1,[ ])
PHP_SUBST(KOREAN_SHARED_LIBADD)
dnl if php version is under 4.2.x, use PHP_EXTENSION
dnl bug over php 4.2.x, use PHP_NEW_EXTENSION
dnl PHP_EXTENSION(korean, $ext_shared)
PHP_NEW_EXTENSION(korean, krcharset.c krerror.c krimage.c krmath.c krparse.c korean.c krcheck.c krfile.c krmail.c krnetwork.c krregex.c $krextra_sources, $ext_shared,, \\$(KR_PARAMETER))
fi