forked from wxphp/wxphp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.m4
83 lines (65 loc) · 3.54 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
PHP_ARG_WITH(wxwidgets,for wxWidgets support,
[ --with-wxwidgets[=DIR] enable wxWidgets extension (requires wxWidgets >= 2.9.3).])
PHP_ARG_ENABLE(wxwidgets-debug, whether to enable debugging support in wxPHP,
[ --enable-wxwidgets-debug
Enable debugging messages support in wxPHP], no, no)
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 Check whether to enable debugging messages
if test "$PHP_WXWIDGETS_DEBUG" != "no"; then
dnl Yes, so set the C macro
AC_DEFINE(USE_WXPHP_DEBUG,1,[Include debugging support in wxPHP])
fi
dnl Add additional includes directory
if test -n "$ext_srcdir"; then
PHP_WXWIDGETS_CFLAGS="-I$ext_srcdir/includes";
else
PHP_WXWIDGETS_CFLAGS="-Iincludes";
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, src/app.cpp src/references.cpp src/appmanagement.cpp src/cfg.cpp src/bookctrl.cpp src/dnd.cpp src/cmndlg.cpp src/containers.cpp src/ctrl.cpp src/data.cpp src/dc.cpp src/docview.cpp src/events.cpp src/file.cpp src/gdi.cpp src/grid.cpp src/html.cpp src/help.cpp src/logging.cpp src/managedwnd.cpp src/menus.cpp src/misc.cpp src/miscwnd.cpp src/media.cpp src/pickers.cpp src/printing.cpp src/ribbon.cpp src/richtext.cpp src/rtti.cpp src/stc.cpp src/streams.cpp src/threading.cpp src/validator.cpp src/vfs.cpp src/webview.cpp src/aui.cpp src/winlayout.cpp src/xml.cpp src/xrc.cpp src/dvc.cpp src/others.cpp src/functions.cpp wxwidgets.cpp, $ext_shared,,,1)
fi