forked from layershifter/gumbo-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
60 lines (51 loc) · 1.37 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
dnl #
dnl # Flags for compilation
dnl #
CFLAGS="$CFLAGS -std=c99"
dnl #
dnl # Extension config
dnl #
PHP_ARG_WITH(gumbo, for gumbo support,
[ --with-gumbo[[=DIR]] Include gumbo support])
if test "$PHP_GUMBO" != "no"; then
dnl #
dnl # Testing for gumbo support
dnl #
SEARCH_PATH="/usr/local /usr"
SEARCH_FOR="/include/gumbo.h"
if test -r $PHP_GUMBO/$SEARCH_FOR; then
GUMBO_DIR=$PHP_GUMBO
else
AC_MSG_CHECKING([for gumbo files in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
GUMBO_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
fi
PHP_ADD_INCLUDE($GUMBO_DIR/include)
PHP_CHECK_LIBRARY(gumbo, gumbo_destroy_output,
[
PHP_ADD_LIBRARY_WITH_PATH(gumbo, $GUMBO_DIR/lib, GUMBO_SHARED_LIBADD)
],[
AC_MSG_ERROR([wrong version of gumbo of it's not found])
], [
-L$GUMBO_DIR/lib -lm
])
dnl #
dnl # Checks for php-libxml support
dnl #
if test "$PHP_LIBXML" = "no"; then
AC_MSG_ERROR([Gumbo extension requires LIBXML extension])
else
PHP_SETUP_LIBXML(GUMBO_SHARED_LIBADD, [
PHP_NEW_EXTENSION(gumbo, src/gumbo.c src/parser.c, $ext_shared)
PHP_ADD_BUILD_DIR([$ext_builddir/src/])
PHP_ADD_EXTENSION_DEP(dom, libxml)
PHP_SUBST(GUMBO_SHARED_LIBADD)
], [
AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.])
])
fi
fi