xref: /PHP-8.3/ext/pspell/config.m4 (revision 96adc806)
1PHP_ARG_WITH([pspell],
2  [for PSPELL support],
3  [AS_HELP_STRING([[--with-pspell[=DIR]]],
4    [Include PSPELL support. GNU Aspell version 0.50.0 or higher required])])
5
6if test "$PHP_PSPELL" != "no"; then
7	dnl Add -Wno-strict-prototypes as depends on user libs
8	PHP_NEW_EXTENSION(pspell, pspell.c, $ext_shared, , "-Wno-strict-prototypes")
9	if test "$PHP_PSPELL" != "yes"; then
10	    PSPELL_SEARCH_DIRS=$PHP_PSPELL
11	else
12	    PSPELL_SEARCH_DIRS="/usr/local /usr"
13	fi
14	for i in $PSPELL_SEARCH_DIRS; do
15		if test -f $i/include/pspell/pspell.h; then
16			PSPELL_DIR=$i
17			PSPELL_INCDIR=$i/include/pspell
18		elif test -f $i/include/pspell.h; then
19			PSPELL_DIR=$i
20			PSPELL_INCDIR=$i/include
21		fi
22	done
23
24	if test -z "$PSPELL_DIR"; then
25		AC_MSG_ERROR(Cannot find pspell)
26	fi
27
28	PSPELL_LIBDIR=$PSPELL_DIR/$PHP_LIBDIR
29
30	PHP_ADD_LIBRARY_WITH_PATH(pspell, $PSPELL_LIBDIR, PSPELL_SHARED_LIBADD)
31
32	dnl Add -laspell to LIBS if it exists
33	PHP_CHECK_LIBRARY(aspell,new_aspell_config,
34	[
35		PHP_ADD_LIBRARY_WITH_PATH(aspell, $PSPELL_LIBDIR, PSPELL_SHARED_LIBADD)
36	], [], [
37		-L$PSPELL_LIBDIR
38	])
39
40	PHP_ADD_INCLUDE($PSPELL_INCDIR)
41	PHP_SUBST(PSPELL_SHARED_LIBADD)
42	AC_DEFINE(HAVE_PSPELL,1,[ ])
43fi
44