]>
Commit | Line | Data |
---|---|---|
debc175a | 1 | dnl --------------------------------------------------------------------------- |
128c8706 | 2 | dnl Macros for wxWidgets detection. Typically used in configure.in as: |
debc175a | 3 | dnl |
5ff72dc4 VZ |
4 | dnl AC_ARG_ENABLE(...) |
5 | dnl AC_ARG_WITH(...) | |
6 | dnl ... | |
7 | dnl AM_OPTIONS_WXCONFIG | |
8 | dnl ... | |
9 | dnl ... | |
80f3a6b0 | 10 | dnl AM_PATH_WXCONFIG(2.6.0, wxWin=1) |
debc175a VS |
11 | dnl if test "$wxWin" != 1; then |
12 | dnl AC_MSG_ERROR([ | |
128c8706 | 13 | dnl wxWidgets must be installed on your system |
5ff72dc4 VZ |
14 | dnl but wx-config script couldn't be found. |
15 | dnl | |
16 | dnl Please check that wx-config is in path, the directory | |
128c8706 | 17 | dnl where wxWidgets libraries are installed (returned by |
5ff72dc4 | 18 | dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or |
128c8706 | 19 | dnl equivalent variable and wxWidgets version is 2.3.4 or above. |
debc175a VS |
20 | dnl ]) |
21 | dnl fi | |
22 | dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" | |
23 | dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" | |
24 | dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" | |
5ff72dc4 | 25 | dnl |
80f3a6b0 | 26 | dnl LIBS="$LIBS $WX_LIBS" |
debc175a VS |
27 | dnl --------------------------------------------------------------------------- |
28 | ||
29 | dnl --------------------------------------------------------------------------- | |
30 | dnl AM_OPTIONS_WXCONFIG | |
31 | dnl | |
5ff72dc4 VZ |
32 | dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and |
33 | dnl --wx-config command line options | |
debc175a VS |
34 | dnl --------------------------------------------------------------------------- |
35 | ||
79f8a0d8 | 36 | AC_DEFUN([AM_OPTIONS_WXCONFIG], |
debc175a | 37 | [ |
5ff72dc4 | 38 | AC_ARG_WITH(wxdir, |
128c8706 | 39 | [ --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH], |
5ff72dc4 VZ |
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, | |
128c8706 | 46 | [ --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)], |
5ff72dc4 VZ |
47 | wx_config_prefix="$withval", wx_config_prefix="") |
48 | AC_ARG_WITH(wx-exec-prefix, | |
49 | [ --with-wx-exec-prefix=PREFIX | |
128c8706 | 50 | Exec prefix where wxWidgets is installed (optional)], |
5ff72dc4 | 51 | wx_config_exec_prefix="$withval", wx_config_exec_prefix="") |
debc175a VS |
52 | ]) |
53 | ||
ed33d524 VS |
54 | dnl Helper macro for checking if wx version is at least $1.$2.$3, set's |
55 | dnl wx_ver_ok=yes if it is: | |
56 | AC_DEFUN([_WX_PRIVATE_CHECK_VERSION], | |
57 | [ | |
58 | wx_ver_ok="" | |
59 | if test "x$WX_VERSION" != x ; then | |
60 | if test $wx_config_major_version -gt $1; then | |
61 | wx_ver_ok=yes | |
62 | else | |
63 | if test $wx_config_major_version -eq $1; then | |
64 | if test $wx_config_minor_version -gt $2; then | |
65 | wx_ver_ok=yes | |
66 | else | |
67 | if test $wx_config_minor_version -eq $2; then | |
68 | if test $wx_config_micro_version -ge $3; then | |
69 | wx_ver_ok=yes | |
70 | fi | |
71 | fi | |
72 | fi | |
73 | fi | |
74 | fi | |
75 | fi | |
76 | ]) | |
77 | ||
debc175a | 78 | dnl --------------------------------------------------------------------------- |
c5be79d9 | 79 | dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND |
8708fa76 | 80 | dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]]) |
debc175a | 81 | dnl |
128c8706 VS |
82 | dnl Test for wxWidgets, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC |
83 | dnl (the latter is for static linking against wxWidgets). Set WX_CONFIG_NAME | |
debc175a VS |
84 | dnl environment variable to override the default name of the wx-config script |
85 | dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this | |
86 | dnl case the macro won't even waste time on tests for its existence. | |
c5be79d9 | 87 | dnl |
8708fa76 | 88 | dnl Optional WX-LIBS argument contains comma- or space-separated list of |
128c8706 | 89 | dnl wxWidgets libraries to link against (it may include contrib libraries). If |
8708fa76 | 90 | dnl it is not specified then WX_LIBS and WX_LIBS_STATIC will contain flags to |
128c8706 | 91 | dnl link with all of the core wxWidgets libraries. |
8708fa76 VS |
92 | dnl |
93 | dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config | |
94 | dnl invocation command in present. It can be used to fine-tune lookup of | |
95 | dnl best wxWidgets build available. | |
c5be79d9 VS |
96 | dnl |
97 | dnl Example use: | |
8708fa76 VS |
98 | dnl AM_PATH_WXCONFIG([2.6.0], [wxWin=1], [wxWin=0], [html,core,net] |
99 | dnl [--unicode --debug]) | |
debc175a VS |
100 | dnl --------------------------------------------------------------------------- |
101 | ||
102 | dnl | |
103 | dnl Get the cflags and libraries from the wx-config script | |
104 | dnl | |
79f8a0d8 | 105 | AC_DEFUN([AM_PATH_WXCONFIG], |
debc175a VS |
106 | [ |
107 | dnl do we have wx-config name: it can be wx-config or wxd-config or ... | |
108 | if test x${WX_CONFIG_NAME+set} != xset ; then | |
109 | WX_CONFIG_NAME=wx-config | |
110 | fi | |
5ff72dc4 | 111 | |
debc175a VS |
112 | if test "x$wx_config_name" != x ; then |
113 | WX_CONFIG_NAME="$wx_config_name" | |
114 | fi | |
115 | ||
116 | dnl deal with optional prefixes | |
117 | if test x$wx_config_exec_prefix != x ; then | |
118 | wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix" | |
8e1aefe0 | 119 | WX_LOOKUP_PATH="$wx_config_exec_prefix/bin" |
debc175a VS |
120 | fi |
121 | if test x$wx_config_prefix != x ; then | |
122 | wx_config_args="$wx_config_args --prefix=$wx_config_prefix" | |
8e1aefe0 | 123 | WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin" |
debc175a | 124 | fi |
48112931 VS |
125 | if test "$cross_compiling" = "yes"; then |
126 | wx_config_args="$wx_config_args --host=$host_alias" | |
127 | fi | |
debc175a | 128 | |
8e1aefe0 VS |
129 | dnl don't search the PATH if WX_CONFIG_NAME is absolute filename |
130 | if test -x "$WX_CONFIG_NAME" ; then | |
131 | AC_MSG_CHECKING(for wx-config) | |
132 | WX_CONFIG_PATH="$WX_CONFIG_NAME" | |
133 | AC_MSG_RESULT($WX_CONFIG_PATH) | |
134 | else | |
135 | AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH") | |
debc175a VS |
136 | fi |
137 | ||
138 | if test "$WX_CONFIG_PATH" != "no" ; then | |
139 | WX_VERSION="" | |
debc175a VS |
140 | |
141 | min_wx_version=ifelse([$1], ,2.2.1,$1) | |
8708fa76 | 142 | if test -z "$5" ; then |
128c8706 | 143 | AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version]) |
8708fa76 | 144 | else |
128c8706 | 145 | AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version ($5)]) |
8708fa76 | 146 | fi |
debc175a | 147 | |
8708fa76 | 148 | WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5 $4" |
debc175a | 149 | |
8708fa76 | 150 | WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null` |
debc175a VS |
151 | wx_config_major_version=`echo $WX_VERSION | \ |
152 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
153 | wx_config_minor_version=`echo $WX_VERSION | \ | |
154 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
155 | wx_config_micro_version=`echo $WX_VERSION | \ | |
156 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
157 | ||
158 | wx_requested_major_version=`echo $min_wx_version | \ | |
159 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
160 | wx_requested_minor_version=`echo $min_wx_version | \ | |
161 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
162 | wx_requested_micro_version=`echo $min_wx_version | \ | |
163 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
164 | ||
ed33d524 VS |
165 | _WX_PRIVATE_CHECK_VERSION([$wx_requested_major_version], |
166 | [$wx_requested_minor_version], | |
167 | [$wx_requested_micro_version]) | |
debc175a | 168 | |
3f45f8bf RL |
169 | if test -n "$wx_ver_ok"; then |
170 | ||
171 | AC_MSG_RESULT(yes (version $WX_VERSION)) | |
8708fa76 | 172 | WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs` |
3f45f8bf RL |
173 | |
174 | dnl is this even still appropriate? --static is a real option now | |
175 | dnl and WX_CONFIG_WITH_ARGS is likely to contain it if that is | |
176 | dnl what the user actually wants, making this redundant at best. | |
177 | dnl For now keep it in case anyone actually used it in the past. | |
128c8706 | 178 | AC_MSG_CHECKING([for wxWidgets static library]) |
a1d47842 VZ |
179 | WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs 2>/dev/null` |
180 | if test "x$WX_LIBS_STATIC" = "x"; then | |
181 | AC_MSG_RESULT(no) | |
182 | else | |
3f45f8bf RL |
183 | AC_MSG_RESULT(yes) |
184 | fi | |
debc175a VS |
185 | |
186 | dnl starting with version 2.2.6 wx-config has --cppflags argument | |
187 | wx_has_cppflags="" | |
188 | if test $wx_config_major_version -gt 2; then | |
189 | wx_has_cppflags=yes | |
190 | else | |
191 | if test $wx_config_major_version -eq 2; then | |
192 | if test $wx_config_minor_version -gt 2; then | |
193 | wx_has_cppflags=yes | |
194 | else | |
195 | if test $wx_config_minor_version -eq 2; then | |
196 | if test $wx_config_micro_version -ge 6; then | |
197 | wx_has_cppflags=yes | |
198 | fi | |
199 | fi | |
200 | fi | |
201 | fi | |
202 | fi | |
203 | ||
692ebda6 JS |
204 | dnl starting with version 2.7.0 wx-config has --rescomp option |
205 | wx_has_rescomp="" | |
206 | if test $wx_config_major_version -gt 2; then | |
207 | wx_has_rescomp=yes | |
208 | else | |
209 | if test $wx_config_major_version -eq 2; then | |
210 | if test $wx_config_minor_version -ge 7; then | |
211 | wx_has_rescomp=yes | |
212 | fi | |
213 | fi | |
214 | fi | |
215 | if test "x$wx_has_rescomp" = x ; then | |
216 | dnl cannot give any useful info for resource compiler | |
217 | WX_RESCOMP= | |
218 | else | |
219 | WX_RESCOMP=`$WX_CONFIG_WITH_ARGS --rescomp` | |
220 | fi | |
221 | ||
debc175a VS |
222 | if test "x$wx_has_cppflags" = x ; then |
223 | dnl no choice but to define all flags like CFLAGS | |
224 | WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags` | |
225 | WX_CPPFLAGS=$WX_CFLAGS | |
226 | WX_CXXFLAGS=$WX_CFLAGS | |
227 | ||
228 | WX_CFLAGS_ONLY=$WX_CFLAGS | |
229 | WX_CXXFLAGS_ONLY=$WX_CFLAGS | |
230 | else | |
231 | dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS | |
232 | WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags` | |
233 | WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags` | |
234 | WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags` | |
235 | ||
236 | WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"` | |
237 | WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"` | |
238 | fi | |
debc175a | 239 | |
3f45f8bf RL |
240 | ifelse([$2], , :, [$2]) |
241 | ||
debc175a | 242 | else |
3f45f8bf | 243 | |
debc175a | 244 | if test "x$WX_VERSION" = x; then |
5ff72dc4 VZ |
245 | dnl no wx-config at all |
246 | AC_MSG_RESULT(no) | |
debc175a | 247 | else |
5ff72dc4 | 248 | AC_MSG_RESULT(no (version $WX_VERSION is not new enough)) |
debc175a VS |
249 | fi |
250 | ||
251 | WX_CFLAGS="" | |
252 | WX_CPPFLAGS="" | |
253 | WX_CXXFLAGS="" | |
254 | WX_LIBS="" | |
255 | WX_LIBS_STATIC="" | |
692ebda6 | 256 | WX_RESCOMP="" |
debc175a | 257 | ifelse([$3], , :, [$3]) |
3f45f8bf | 258 | |
debc175a | 259 | fi |
80f3a6b0 JS |
260 | else |
261 | ||
262 | WX_CFLAGS="" | |
263 | WX_CPPFLAGS="" | |
264 | WX_CXXFLAGS="" | |
265 | WX_LIBS="" | |
266 | WX_LIBS_STATIC="" | |
692ebda6 JS |
267 | WX_RESCOMP="" |
268 | ||
80f3a6b0 JS |
269 | ifelse([$3], , :, [$3]) |
270 | ||
debc175a VS |
271 | fi |
272 | ||
273 | AC_SUBST(WX_CPPFLAGS) | |
274 | AC_SUBST(WX_CFLAGS) | |
275 | AC_SUBST(WX_CXXFLAGS) | |
276 | AC_SUBST(WX_CFLAGS_ONLY) | |
277 | AC_SUBST(WX_CXXFLAGS_ONLY) | |
278 | AC_SUBST(WX_LIBS) | |
279 | AC_SUBST(WX_LIBS_STATIC) | |
280 | AC_SUBST(WX_VERSION) | |
692ebda6 | 281 | AC_SUBST(WX_RESCOMP) |
debc175a | 282 | ]) |
ed33d524 VS |
283 | |
284 | dnl --------------------------------------------------------------------------- | |
285 | dnl Get information on the wxrc program for making C++, Python and xrs | |
286 | dnl resource files. | |
287 | dnl | |
288 | dnl AC_ARG_ENABLE(...) | |
289 | dnl AC_ARG_WITH(...) | |
290 | dnl ... | |
291 | dnl AM_OPTIONS_WXCONFIG | |
292 | dnl AM_OPTIONS_WXRC | |
293 | dnl ... | |
294 | dnl AM_PATH_WXCONFIG(2.6.0, wxWin=1) | |
295 | dnl if test "$wxWin" != 1; then | |
296 | dnl AC_MSG_ERROR([ | |
297 | dnl wxWidgets must be installed on your system | |
298 | dnl but wx-config script couldn't be found. | |
299 | dnl | |
300 | dnl Please check that wx-config is in path, the directory | |
301 | dnl where wxWidgets libraries are installed (returned by | |
302 | dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or | |
303 | dnl equivalent variable and wxWidgets version is 2.6.0 or above. | |
304 | dnl ]) | |
305 | dnl fi | |
306 | dnl | |
307 | dnl AM_PATH_WXRC([HAVE_WXRC=1], [HAVE_WXRC=0]) | |
308 | dnl if test "x$HAVE_WXRC" != x1; then | |
309 | dnl AC_MSG_ERROR([ | |
310 | dnl The wxrc program was not installed or not found. | |
311 | dnl | |
312 | dnl Please check the wxWidgets installation. | |
313 | dnl ]) | |
314 | dnl fi | |
315 | dnl | |
316 | dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS" | |
317 | dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY" | |
318 | dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY" | |
319 | dnl | |
320 | dnl LDFLAGS="$LDFLAGS $WX_LIBS" | |
321 | dnl --------------------------------------------------------------------------- | |
322 | ||
323 | ||
324 | ||
325 | dnl --------------------------------------------------------------------------- | |
326 | dnl AM_PATH_WXRC([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) | |
327 | dnl | |
328 | dnl Test for wxWidgets' wxrc program for creating either C++, Python or XRS | |
329 | dnl resources. The variable WXRC will be set and substituted in the configure | |
330 | dnl script and Makefiles. | |
331 | dnl | |
332 | dnl Example use: | |
333 | dnl AM_PATH_WXRC([wxrc=1], [wxrc=0]) | |
334 | dnl --------------------------------------------------------------------------- | |
335 | ||
336 | dnl | |
337 | dnl wxrc program from the wx-config script | |
338 | dnl | |
339 | AC_DEFUN([AM_PATH_WXRC], | |
340 | [ | |
341 | AC_ARG_VAR([WXRC], [Path to wxWidget's wxrc resource compiler]) | |
342 | ||
343 | if test "x$WX_CONFIG_NAME" = x; then | |
344 | AC_MSG_ERROR([The wxrc tests must run after wxWidgets test.]) | |
345 | else | |
346 | ||
347 | AC_MSG_CHECKING([for wxrc]) | |
348 | ||
349 | if test "x$WXRC" = x ; then | |
350 | dnl wx-config --utility is a new addition to wxWidgets: | |
351 | _WX_PRIVATE_CHECK_VERSION(2,5,3) | |
352 | if test -n "$wx_ver_ok"; then | |
353 | WXRC=`$WX_CONFIG_WITH_ARGS --utility=wxrc` | |
354 | fi | |
355 | fi | |
356 | ||
357 | if test "x$WXRC" = x ; then | |
358 | AC_MSG_RESULT([not found]) | |
359 | ifelse([$2], , :, [$2]) | |
360 | else | |
361 | AC_MSG_RESULT([$WXRC]) | |
362 | ifelse([$1], , :, [$1]) | |
363 | fi | |
364 | ||
365 | AC_SUBST(WXRC) | |
366 | fi | |
367 | ]) |