forked from kiddivouchers/php-timecop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.m4
43 lines (34 loc) · 1.53 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
dnl $Id$
dnl config.m4 for extension timecop
dnl Comments in this file start with the string 'dnl'.
dnl Remove where necessary. This file will not work
dnl without editing.
dnl If your extension references something external, use with:
dnl PHP_ARG_WITH(timecop, for timecop support,
dnl Make sure that the comment is aligned:
dnl [ --with-timecop Include timecop support])
dnl Otherwise use enable:
PHP_ARG_ENABLE(timecop, whether to enable timecop support,
[ --enable-timecop Enable timecop support])
if test "$PHP_TIMECOP" != "no"; then
dnl Check PHP version:
AC_MSG_CHECKING(PHP version)
if test ! -z "$phpincludedir"; then
PHP_VERSION=`grep 'PHP_VERSION ' $phpincludedir/main/php_version.h | sed -e 's/.*"\([[0-9]]*\.[[0-9]]*\.[[0-9]]*.*\)".*/\1/g' 2>/dev/null`
elif test ! -z "$PHP_CONFIG"; then
PHP_VERSION=`$PHP_CONFIG --version 2>/dev/null`
fi
if test x"$PHP_VERSION" = "x"; then
AC_MSG_WARN([not found])
else
PHP_MAJOR_VERSION=`echo $PHP_VERSION | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/g' 2>/dev/null`
PHP_MINOR_VERSION=`echo $PHP_VERSION | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/g' 2>/dev/null`
PHP_RELEASE_VERSION=`echo $PHP_VERSION | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/g' 2>/dev/null`
AC_MSG_RESULT([$PHP_VERSION])
fi
if test "$PHP_MAJOR_VERSION" -eq 5; then
PHP_NEW_EXTENSION(timecop, timecop_php5.c tc_timeval.c, $ext_shared)
else
PHP_NEW_EXTENSION(timecop, timecop_php7.c tc_timeval.c, $ext_shared)
fi
fi