]> git.saurik.com Git - wxWidgets.git/blame - wxwin.m4
Implement SetBackground()
[wxWidgets.git] / wxwin.m4
CommitLineData
debc175a
VS
1dnl ---------------------------------------------------------------------------
2dnl Macros for wxWindows detection. Typically used in configure.in as:
3dnl
5ff72dc4
VZ
4dnl AC_ARG_ENABLE(...)
5dnl AC_ARG_WITH(...)
6dnl ...
7dnl AM_OPTIONS_WXCONFIG
8dnl ...
9dnl ...
10dnl AM_PATH_WXCONFIG(2.3.4, wxWin=1)
debc175a
VS
11dnl if test "$wxWin" != 1; then
12dnl AC_MSG_ERROR([
5ff72dc4
VZ
13dnl wxWindows must be installed on your system
14dnl but wx-config script couldn't be found.
15dnl
16dnl Please check that wx-config is in path, the directory
17dnl where wxWindows libraries are installed (returned by
18dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
19dnl equivalent variable and wxWindows version is 2.3.4 or above.
debc175a
VS
20dnl ])
21dnl fi
22dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
23dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
24dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
5ff72dc4 25dnl
debc175a
VS
26dnl LDFLAGS="$LDFLAGS $WX_LIBS"
27dnl ---------------------------------------------------------------------------
28
29dnl ---------------------------------------------------------------------------
30dnl AM_OPTIONS_WXCONFIG
31dnl
5ff72dc4
VZ
32dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and
33dnl --wx-config command line options
debc175a
VS
34dnl ---------------------------------------------------------------------------
35
36AC_DEFUN(AM_OPTIONS_WXCONFIG,
37[
5ff72dc4
VZ
38 AC_ARG_WITH(wxdir,
39 [ --with-wxdir=PATH Use uninstalled version of wxWindows in PATH],
40 [ wx_config_name="$withval/wx-config"
41 wx_config_args="--inplace"])
42 AC_ARG_WITH(wx-config,
43 [ --with-wx-config=CONFIG wx-config script to use (optional)],
44 wx_config_name="$withval" )
45 AC_ARG_WITH(wx-prefix,
46 [ --with-wx-prefix=PREFIX Prefix where wxWindows is installed (optional)],
47 wx_config_prefix="$withval", wx_config_prefix="")
48 AC_ARG_WITH(wx-exec-prefix,
49 [ --with-wx-exec-prefix=PREFIX
50 Exec prefix where wxWindows is installed (optional)],
51 wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
debc175a
VS
52])
53
54dnl ---------------------------------------------------------------------------
55dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
56dnl
57dnl Test for wxWindows, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
58dnl (the latter is for static linking against wxWindows). Set WX_CONFIG_NAME
59dnl environment variable to override the default name of the wx-config script
60dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this
61dnl case the macro won't even waste time on tests for its existence.
62dnl ---------------------------------------------------------------------------
63
64dnl
65dnl Get the cflags and libraries from the wx-config script
66dnl
67AC_DEFUN(AM_PATH_WXCONFIG,
68[
69 dnl do we have wx-config name: it can be wx-config or wxd-config or ...
70 if test x${WX_CONFIG_NAME+set} != xset ; then
71 WX_CONFIG_NAME=wx-config
72 fi
5ff72dc4 73
debc175a
VS
74 if test "x$wx_config_name" != x ; then
75 WX_CONFIG_NAME="$wx_config_name"
76 fi
77
78 dnl deal with optional prefixes
79 if test x$wx_config_exec_prefix != x ; then
80 wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
8e1aefe0 81 WX_LOOKUP_PATH="$wx_config_exec_prefix/bin"
debc175a
VS
82 fi
83 if test x$wx_config_prefix != x ; then
84 wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
8e1aefe0 85 WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
debc175a
VS
86 fi
87
8e1aefe0
VS
88 dnl don't search the PATH if WX_CONFIG_NAME is absolute filename
89 if test -x "$WX_CONFIG_NAME" ; then
90 AC_MSG_CHECKING(for wx-config)
91 WX_CONFIG_PATH="$WX_CONFIG_NAME"
92 AC_MSG_RESULT($WX_CONFIG_PATH)
93 else
94 AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH")
debc175a
VS
95 fi
96
97 if test "$WX_CONFIG_PATH" != "no" ; then
98 WX_VERSION=""
99 no_wx=""
100
101 min_wx_version=ifelse([$1], ,2.2.1,$1)
102 AC_MSG_CHECKING(for wxWindows version >= $min_wx_version)
103
104 WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args"
105
106 WX_VERSION=`$WX_CONFIG_WITH_ARGS --version`
107 wx_config_major_version=`echo $WX_VERSION | \
108 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
109 wx_config_minor_version=`echo $WX_VERSION | \
110 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
111 wx_config_micro_version=`echo $WX_VERSION | \
112 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
113
114 wx_requested_major_version=`echo $min_wx_version | \
115 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
116 wx_requested_minor_version=`echo $min_wx_version | \
117 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
118 wx_requested_micro_version=`echo $min_wx_version | \
119 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
120
121 wx_ver_ok=""
122 if test $wx_config_major_version -gt $wx_requested_major_version; then
123 wx_ver_ok=yes
124 else
125 if test $wx_config_major_version -eq $wx_requested_major_version; then
126 if test $wx_config_minor_version -gt $wx_requested_minor_version; then
127 wx_ver_ok=yes
128 else
129 if test $wx_config_minor_version -eq $wx_requested_minor_version; then
130 if test $wx_config_micro_version -ge $wx_requested_micro_version; then
131 wx_ver_ok=yes
132 fi
133 fi
134 fi
135 fi
136 fi
137
138 if test "x$wx_ver_ok" = x ; then
139 no_wx=yes
140 else
141 WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs`
142 WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs`
143
144 dnl starting with version 2.2.6 wx-config has --cppflags argument
145 wx_has_cppflags=""
146 if test $wx_config_major_version -gt 2; then
147 wx_has_cppflags=yes
148 else
149 if test $wx_config_major_version -eq 2; then
150 if test $wx_config_minor_version -gt 2; then
151 wx_has_cppflags=yes
152 else
153 if test $wx_config_minor_version -eq 2; then
154 if test $wx_config_micro_version -ge 6; then
155 wx_has_cppflags=yes
156 fi
157 fi
158 fi
159 fi
160 fi
161
162 if test "x$wx_has_cppflags" = x ; then
163 dnl no choice but to define all flags like CFLAGS
164 WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
165 WX_CPPFLAGS=$WX_CFLAGS
166 WX_CXXFLAGS=$WX_CFLAGS
167
168 WX_CFLAGS_ONLY=$WX_CFLAGS
169 WX_CXXFLAGS_ONLY=$WX_CFLAGS
170 else
171 dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
172 WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags`
173 WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags`
174 WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
175
176 WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
177 WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
178 fi
179 fi
180
181 if test "x$no_wx" = x ; then
182 AC_MSG_RESULT(yes (version $WX_VERSION))
183 ifelse([$2], , :, [$2])
184 else
185 if test "x$WX_VERSION" = x; then
5ff72dc4
VZ
186 dnl no wx-config at all
187 AC_MSG_RESULT(no)
debc175a 188 else
5ff72dc4 189 AC_MSG_RESULT(no (version $WX_VERSION is not new enough))
debc175a
VS
190 fi
191
192 WX_CFLAGS=""
193 WX_CPPFLAGS=""
194 WX_CXXFLAGS=""
195 WX_LIBS=""
196 WX_LIBS_STATIC=""
197 ifelse([$3], , :, [$3])
198 fi
199 fi
200
201 AC_SUBST(WX_CPPFLAGS)
202 AC_SUBST(WX_CFLAGS)
203 AC_SUBST(WX_CXXFLAGS)
204 AC_SUBST(WX_CFLAGS_ONLY)
205 AC_SUBST(WX_CXXFLAGS_ONLY)
206 AC_SUBST(WX_LIBS)
207 AC_SUBST(WX_LIBS_STATIC)
208 AC_SUBST(WX_VERSION)
209])