-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.m4
55 lines (42 loc) · 1.51 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
PHP_ARG_WITH(ftdi, whether to enable ftdi support,
[ --with-ftdi[=DIR] Enable ftdi support. DIR is the prefix to libftdi installation directory.], yes)
if test "$PHP_FTDI" != "no"; then
dnl Get PHP version depending on shared/static build
AC_MSG_CHECKING([PHP version is at least 5.2.0])
if test -z "${PHP_VERSION_ID}"; then
if test -z "${PHP_CONFIG}"; then
AC_MSG_ERROR([php-config not found])
fi
PHP_FTDI_FOUND_VERNUM=`${PHP_CONFIG} --vernum`;
PHP_FTDI_FOUND_VERSION=`${PHP_CONFIG} --version`
else
PHP_FTDI_FOUND_VERNUM="${PHP_VERSION_ID}"
PHP_FTDI_FOUND_VERSION="${PHP_VERSION}"
fi
if test "$PHP_FTDI_FOUND_VERNUM" -ge "50200"; then
AC_MSG_RESULT(yes. found $PHP_FTDI_FOUND_VERSION)
else
AC_MSG_ERROR(no. found $PHP_FTDI_FOUND_VERSION)
fi
AC_MSG_CHECKING([for ftdi.h header])
for i in $PHP_FTDI /usr/local /usr;
do
test -r $i/include/ftdi.h && FTDI_PREFIX=$i && FTDI_INC_DIR=$i/include/ && FTDI_OK=1
done
if test "$FTDI_OK" != "1"; then
AC_MSG_ERROR([Unable to find ftdi.h])
fi
AC_MSG_RESULT([found in $FTDI_INC_DIR])
AC_MSG_CHECKING([for libftdi shared libraries])
PHP_CHECK_LIBRARY(ftdi, ftdi_init, [
PHP_ADD_LIBRARY_WITH_PATH(ftdi, $FTDI_PREFIX/lib, FTDI_SHARED_LIBADD)
PHP_ADD_INCLUDE($FTDI_INC_DIR)
],[
AC_MSG_ERROR([not found. Make sure that libftdi is installed])
],[
FTDI_SHARED_LIBADD -lftdi
])
PHP_NEW_EXTENSION(ftdi, ftdi.c, $ext_shared)
AC_DEFINE(HAVE_FTDI,1,[ ])
PHP_SUBST(FTDI_SHARED_LIBADD)
fi