-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.m4
66 lines (51 loc) · 2.39 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
61
62
63
64
65
66
PHP_ARG_WITH(wxwidgets,for wxWidgets support,
[ --with-wxwidgets[=DIR] enable wxWidgets extension (requires wxWidgets >= 2.9.3).])
PHP_ARG_ENABLE(wxwidgets-monolithic, whether to link to monolithic build of wxWidgets,
[ --enable-wxwidgets-monolithic
Link to monolithic build of wxWidgets], no, no)
if test "$PHP_WXWIDGETS" != "no"; then
dnl Instruct the PHP build system to use a C++ compiler
PHP_REQUIRE_CXX()
dnl Default wx-config command
WXCONFIG_PATH=wx-config
dnl Check for the installation path of wx-config
AC_MSG_CHECKING([for wx-config existance and wxWidgets version >= 2.9.x])
for directory in "$PHP_WXWIDGETS" "$PHP_WXWIDGETS/bin" /usr /usr/bin /usr/local /usr/local/bin; do
if test -e "$directory/wx-config"; then
wxwidgets_version=`$directory/wx-config --version`
version_check=`echo $wxwidgets_version | grep "2.9" && echo $wxwidgets_version | grep "3.[0-9]"`
if test -n "$version_check"; then
WXCONFIG_PATH="$directory/wx-config"
AC_MSG_RESULT([version $wxwidgets_version found])
break
fi
fi
done
dnl Show error if wxWidgets was not found
if test ! -e $WXCONFIG_PATH; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([A matching wxWidgets installation was not found])
fi
dnl Retreive and store wxWidgets compiler flags
WXWIDGETS_CONFIG_FLAGS=`$WXCONFIG_PATH --cxxflags`
dnl Append wx-config flags to wxphp compiler flags
PHP_WXWIDGETS_CFLAGS="$PHP_WXWIDGETS_CFLAGS $WXWIDGETS_CONFIG_FLAGS"
dnl Retreive and store wxWidgets library flags
if test "$PHP_WXWIDGETS_MONOLITHIC" != "no"; then
PHP_WXWIDGETS_LIBS=`$WXCONFIG_PATH --libs`
else
PHP_WXWIDGETS_LIBS=`$WXCONFIG_PATH --libs all`
fi
dnl Append wxWidgets flags to the compiler flags and suppress warning flags
CXXFLAGS="$CXXFLAGS $PHP_WXWIDGETS_CFLAGS"
dnl Add header search paths to the PHP build system
PHP_EVAL_INCLINE($PHP_WXWIDGETS_CFLAGS)
dnl Add libraries and or library search paths to the PHP build system
PHP_EVAL_LIBLINE($PHP_WXWIDGETS_LIBS, WXWIDGETS_SHARED_LIBADD)
dnl Adds variable with value into Makefile for example CC = gcc
PHP_SUBST(WXWIDGETS_SHARED_LIBADD)
dnl Link the C++ standard library
PHP_ADD_LIBRARY(stdc++, 1 , WXWIDGETS_SHARED_LIBADD)
dnl PHP_NEW_EXTENSION(extname, sources [, shared [, sapi_class [, extra-cflags [, cxx [, zend_ext]]]]])
PHP_NEW_EXTENSION(wxwidgets, wx_wrap.cpp, $ext_shared,,,1)
fi