Skip to content

Commit 0655191

Browse files
hughmcmasterpetk
authored andcommitted
Use PKG_CHECK_MODULES to detect the Enchant library
1 parent 83bfbc2 commit 0655191

File tree

1 file changed

+13
-31
lines changed

1 file changed

+13
-31
lines changed

ext/enchant/config.m4

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,21 @@
11
PHP_ARG_WITH([enchant],
2-
[for ENCHANT support],
3-
[AS_HELP_STRING([[--with-enchant[=DIR]]],
4-
[Include enchant support. GNU Aspell version 1.1.3 or higher required.])])
2+
[whether to build with Enchant support],
3+
[AS_HELP_STRING([--with-enchant],
4+
[Include Enchant support])])
55

66
if test "$PHP_ENCHANT" != "no"; then
7-
PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
8-
if test "$PHP_ENCHANT" != "yes"; then
9-
ENCHANT_SEARCH_DIRS=$PHP_ENCHANT
10-
else
11-
ENCHANT_SEARCH_DIRS="/usr/local /usr"
12-
fi
13-
for i in $ENCHANT_SEARCH_DIRS; do
14-
if test -f $i/include/enchant/enchant.h; then
15-
ENCHANT_DIR=$i
16-
ENCHANT_INCDIR=$i/include/enchant
17-
elif test -f $i/include/enchant.h; then
18-
ENCHANT_DIR=$i
19-
ENCHANT_INCDIR=$i/include
20-
fi
21-
done
7+
PHP_NEW_EXTENSION(enchant, enchant.c, $ext_shared)
228

23-
if test -z "$ENCHANT_DIR"; then
24-
AC_MSG_ERROR(Cannot find enchant)
25-
fi
9+
PKG_CHECK_MODULES([ENCHANT], [enchant])
2610

27-
ENCHANT_LIBDIR=$ENCHANT_DIR/lib
11+
PHP_EVAL_INCLINE($ENCHANT_CFLAGS)
12+
PHP_EVAL_LIBLINE($ENCHANT_LIBS, ENCHANT_SHARED_LIBADD)
2813

29-
AC_DEFINE(HAVE_ENCHANT,1,[ ])
30-
PHP_SUBST(ENCHANT_SHARED_LIBADD)
31-
PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD)
32-
PHP_ADD_INCLUDE($ENCHANT_INCDIR)
33-
PHP_CHECK_LIBRARY(enchant, enchant_broker_set_param,
34-
[
35-
AC_DEFINE(HAVE_ENCHANT_BROKER_SET_PARAM, 1, [ ])
36-
AC_DEFINE(ENCHANT_VERSION_STRING, "1.5.x", [ ])
37-
], [], [ -L$ENCHANT_LIBDIR $ENCHANT_SHARED_LIBADD])
14+
AC_DEFINE(HAVE_ENCHANT, 1, [ ])
3815

16+
PHP_CHECK_LIBRARY(enchant, enchant_broker_set_param,
17+
[
18+
AC_DEFINE(HAVE_ENCHANT_BROKER_SET_PARAM, 1, [ ])
19+
AC_DEFINE(ENCHANT_VERSION_STRING, "1.5.x", [ ])
20+
])
3921
fi

0 commit comments

Comments
 (0)