Skip to content

Commit 54cf9a2

Browse files
committed
Use libenchant2 if available on Windows
This is basically the same as commit 3427545[1], but for Windows. [1] <http://git.php.net/?p=php-src.git;a=commitdiff;h=342754575237da912874f781a24eefe76434ce5a>
1 parent 3427545 commit 54cf9a2

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

ext/enchant/config.w32

+17-7
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ ARG_WITH("enchant", "Enchant Support", "no");
44

55
if (PHP_ENCHANT == "yes") {
66
if (CHECK_HEADER_ADD_INCLUDE("enchant.h", "CFLAGS_ENCHANT", PHP_ENCHANT+ ";" + PHP_PHP_BUILD + "\\include\\enchant") &&
7-
CHECK_HEADER_ADD_INCLUDE("glib.h", "CFLAGS_ENCHANT", PHP_ENCHANT+ ";" + PHP_PHP_BUILD + "\\include\\glib-2.0") &&
8-
CHECK_LIB("libenchant.lib", "enchant", PHP_ENCHANT) ) {
9-
EXTENSION("enchant", "enchant.c");
10-
AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
11-
AC_DEFINE('HAVE_ENCHANT_GET_VERSION', 1);
12-
AC_DEFINE('HAVE_ENCHANT_BROKER_SET_PARAM', 1);
13-
ADD_FLAG("CFLAG_ENCHANT", "/D _WIN32");
7+
CHECK_HEADER_ADD_INCLUDE("glib.h", "CFLAGS_ENCHANT", PHP_ENCHANT+ ";" + PHP_PHP_BUILD + "\\include\\glib-2.0")) {
8+
if (CHECK_LIB("libenchant2.lib", "enchant", PHP_ENCHANT)) {
9+
have_enchant = true;
10+
AC_DEFINE('HAVE_ENCHANT_BROKER_SET_PARAM', 0);
11+
} else if (CHECK_LIB("libenchant.lib", "enchant", PHP_ENCHANT)) {
12+
have_enchant = true;
13+
AC_DEFINE('HAVE_ENCHANT_BROKER_SET_PARAM', 1);
14+
} else {
15+
have_enchant = false;
16+
WARNING('Could not find libenchant.lib; skipping');
17+
}
18+
if (have_enchant) {
19+
EXTENSION("enchant", "enchant.c");
20+
AC_DEFINE('HAVE_ENCHANT', 1, 'Have Enchant support', false);
21+
AC_DEFINE('HAVE_ENCHANT_GET_VERSION', 1);
22+
ADD_FLAG("CFLAG_ENCHANT", "/D _WIN32");
23+
}
1424
} else {
1525
WARNING('Could not find enchant.h; skipping');
1626
}

win32/build/mkdist.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,13 @@ function extract_file_from_tarball($pkg, $filename, $dest_dir) /* {{{ */
335335
$ENCHANT_DLLS = array(
336336
array('', 'glib-2.dll'),
337337
array('', 'gmodule-2.dll'),
338-
array('lib/enchant', 'libenchant_myspell.dll'),
339-
array('lib/enchant', 'libenchant_ispell.dll'),
340338
);
339+
if (file_exists("$php_build_dir/bin/libenchant2.dll")) {
340+
$ENCHANT_DLLS[] = array('lib/enchant', 'libenchant2_hunspell.dll');
341+
} else {
342+
$ENCHANT_DLLS[] = array('lib/enchant', 'libenchant_myspell.dll');
343+
$ENCHANT_DLLS[] = array('lib/enchant', 'libenchant_ispell.dll');
344+
}
341345
foreach ($ENCHANT_DLLS as $dll) {
342346
$dest = "$dist_dir/$dll[0]";
343347
$filename = $dll[1];

0 commit comments

Comments
 (0)