]>
Commit | Line | Data |
---|---|---|
2a879853 | 1 | # aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- |
8168de4c | 2 | |
2a879853 | 3 | # Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 |
fe0895cf VS |
4 | # Free Software Foundation, Inc. |
5 | # This file is free software; the Free Software Foundation | |
6 | # gives unlimited permission to copy and/or distribute it, | |
7 | # with or without modifications, as long as this notice is preserved. | |
8168de4c | 8 | |
fe0895cf VS |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
11 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
12 | # PARTICULAR PURPOSE. | |
8168de4c | 13 | |
b040e242 VS |
14 | dnl --------------------------------------------------------------------------- |
15 | dnl | |
16 | dnl Macros for configure.in for wxWindows by Robert Roebling, Phil Blecker, | |
17 | dnl Vadim Zeitlin and Ron Lee | |
18 | dnl | |
19 | dnl This script is under the wxWindows licence. | |
20 | dnl | |
af8ebe8a | 21 | dnl Version: $Id$ |
b040e242 VS |
22 | dnl --------------------------------------------------------------------------- |
23 | ||
480ccd21 DE |
24 | dnl =========================================================================== |
25 | dnl macros to detect specialty compiler options | |
26 | dnl =========================================================================== | |
27 | ||
28 | dnl Figure out if we need to pass -ext o to compiler (MetroWerks) | |
29 | AC_DEFUN([AC_WX_METROWERKS_EXTO], | |
30 | [AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], wx_cv_[]_AC_LANG_ABBREV[]_exto, | |
31 | dnl First create an empty conf test | |
32 | [AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) | |
33 | dnl Now remove .o and .c.o or .cc.o | |
34 | rm -f conftest.$ac_objext conftest.$ac_ext.o | |
35 | dnl Now compile the test | |
36 | AS_IF([AC_TRY_EVAL(ac_compile)], | |
37 | dnl If the test succeeded look for conftest.c.o or conftest.cc.o | |
38 | [for ac_file in `(ls conftest.* 2>/dev/null)`; do | |
39 | case $ac_file in | |
40 | conftest.$ac_ext.o) | |
41 | wx_cv_[]_AC_LANG_ABBREV[]_exto="-ext o" | |
42 | ;; | |
43 | *) | |
44 | ;; | |
45 | esac | |
46 | done], | |
47 | [AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile]) | |
48 | ]) dnl AS_IF | |
49 | ||
50 | rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext | |
51 | ]) dnl AC_CACHE_CHECK | |
52 | ||
53 | if test "x$wx_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then | |
54 | if test "[]_AC_LANG_ABBREV[]" = "c"; then | |
55 | CFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS" | |
56 | fi | |
57 | if test "[]_AC_LANG_ABBREV[]" = "cxx"; then | |
58 | CXXFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS" | |
59 | fi | |
60 | fi | |
61 | ]) dnl AC_DEFUN | |
62 | ||
63 | ||
9273ffba DE |
64 | dnl Based on autoconf _AC_LANG_COMPILER_GNU |
65 | AC_DEFUN([_AC_WX_LANG_COMPILER_XLC], | |
66 | [AC_CACHE_CHECK([whether we are using the IBM xlC _AC_LANG compiler], | |
67 | [wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc], | |
68 | [AC_TRY_COMPILE([],[#ifndef __xlC__ | |
69 | choke me | |
70 | #endif | |
71 | ], | |
72 | [wx_compiler_xlc=yes], | |
73 | [wx_compiler_xlc=no]) | |
74 | wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc=$wx_compiler_xlc | |
75 | ]) | |
76 | ]) | |
77 | ||
78 | dnl Loosely based on autoconf AC_PROG_CC | |
79 | AC_DEFUN([AC_WX_PROG_XLCC], | |
80 | [AC_LANG_PUSH(C) | |
81 | _AC_WX_LANG_COMPILER_XLC | |
82 | XLCC=`test $wx_compiler_xlc = yes && echo yes` | |
83 | AC_LANG_POP(C) | |
84 | ]) | |
85 | ||
86 | dnl Loosely based on autoconf AC_PROG_CXX | |
87 | AC_DEFUN([AC_WX_PROG_XLCXX], | |
88 | [AC_LANG_PUSH(C++) | |
89 | _AC_WX_LANG_COMPILER_XLC | |
90 | XLCXX=`test $wx_compiler_xlc = yes && echo yes` | |
91 | AC_LANG_POP(C++) | |
92 | ]) | |
93 | ||
94 | ||
b040e242 VS |
95 | dnl =========================================================================== |
96 | dnl macros to find the a file in the list of include/lib paths | |
97 | dnl =========================================================================== | |
98 | ||
99 | dnl --------------------------------------------------------------------------- | |
100 | dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes | |
101 | dnl to the full name of the file that was found or leaves it empty if not found | |
102 | dnl --------------------------------------------------------------------------- | |
103 | AC_DEFUN([WX_PATH_FIND_INCLUDES], | |
104 | [ | |
105 | ac_find_includes= | |
2b5f62a0 | 106 | for ac_dir in $1 /usr/include; |
b040e242 VS |
107 | do |
108 | if test -f "$ac_dir/$2"; then | |
109 | ac_find_includes=$ac_dir | |
110 | break | |
111 | fi | |
112 | done | |
113 | ]) | |
114 | ||
115 | dnl --------------------------------------------------------------------------- | |
116 | dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries | |
117 | dnl to the full name of the file that was found or leaves it empty if not found | |
118 | dnl --------------------------------------------------------------------------- | |
119 | AC_DEFUN([WX_PATH_FIND_LIBRARIES], | |
120 | [ | |
121 | ac_find_libraries= | |
2b5f62a0 | 122 | for ac_dir in $1 /usr/lib; |
b040e242 VS |
123 | do |
124 | for ac_extension in a so sl dylib; do | |
125 | if test -f "$ac_dir/lib$2.$ac_extension"; then | |
126 | ac_find_libraries=$ac_dir | |
127 | break 2 | |
128 | fi | |
129 | done | |
130 | done | |
131 | ]) | |
132 | ||
133 | dnl --------------------------------------------------------------------------- | |
134 | dnl Path to include, already defined | |
135 | dnl --------------------------------------------------------------------------- | |
136 | AC_DEFUN([WX_INCLUDE_PATH_EXIST], | |
137 | [ | |
2b5f62a0 VZ |
138 | dnl never add -I/usr/include to the CPPFLAGS |
139 | if test "x$1" = "x/usr/include"; then | |
b040e242 VS |
140 | ac_path_to_include="" |
141 | else | |
2b5f62a0 VZ |
142 | echo "$2" | grep "\-I$1" > /dev/null |
143 | result=$? | |
144 | if test $result = 0; then | |
145 | ac_path_to_include="" | |
146 | else | |
147 | ac_path_to_include=" -I$1" | |
148 | fi | |
b040e242 VS |
149 | fi |
150 | ]) | |
151 | ||
152 | dnl --------------------------------------------------------------------------- | |
153 | dnl Path to link, already defined | |
154 | dnl --------------------------------------------------------------------------- | |
155 | AC_DEFUN([WX_LINK_PATH_EXIST], | |
156 | [ | |
157 | echo "$2" | grep "\-L$1" > /dev/null | |
158 | result=$? | |
159 | if test $result = 0; then | |
160 | ac_path_to_link="" | |
161 | else | |
162 | ac_path_to_link=" -L$1" | |
163 | fi | |
164 | ]) | |
165 | ||
166 | dnl =========================================================================== | |
167 | dnl C++ features test | |
168 | dnl =========================================================================== | |
169 | ||
170 | dnl --------------------------------------------------------------------------- | |
171 | dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header | |
172 | dnl or only the old <iostream.h> one - it may be generally assumed that if | |
173 | dnl <iostream> exists, the other "new" headers (without .h) exist too. | |
174 | dnl | |
c2218763 | 175 | dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false) |
b040e242 VS |
176 | dnl --------------------------------------------------------------------------- |
177 | ||
178 | AC_DEFUN([WX_CPP_NEW_HEADERS], | |
179 | [ | |
b040e242 VS |
180 | AC_LANG_SAVE |
181 | AC_LANG_CPLUSPLUS | |
182 | ||
183 | AC_CHECK_HEADERS(iostream) | |
184 | ||
185 | if test "$ac_cv_header_iostream" = "yes" ; then | |
186 | ifelse([$1], , :, [$1]) | |
187 | else | |
188 | ifelse([$2], , :, [$2]) | |
189 | fi | |
190 | ||
191 | AC_LANG_RESTORE | |
b040e242 VS |
192 | ]) |
193 | ||
194 | dnl --------------------------------------------------------------------------- | |
195 | dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type | |
196 | dnl | |
197 | dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool | |
198 | dnl --------------------------------------------------------------------------- | |
199 | ||
200 | AC_DEFUN([WX_CPP_BOOL], | |
201 | [ | |
202 | AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool, | |
203 | [ | |
204 | AC_LANG_SAVE | |
205 | AC_LANG_CPLUSPLUS | |
206 | ||
207 | AC_TRY_COMPILE( | |
208 | [ | |
209 | ], | |
210 | [ | |
211 | bool b = true; | |
212 | ||
213 | return 0; | |
214 | ], | |
215 | [ | |
216 | wx_cv_cpp_bool=yes | |
217 | ], | |
218 | [ | |
219 | wx_cv_cpp_bool=no | |
220 | ] | |
221 | ) | |
222 | ||
223 | AC_LANG_RESTORE | |
224 | ]) | |
225 | ||
226 | if test "$wx_cv_cpp_bool" = "yes"; then | |
227 | AC_DEFINE(HAVE_BOOL) | |
228 | fi | |
229 | ]) | |
230 | ||
986ecc86 VZ |
231 | dnl --------------------------------------------------------------------------- |
232 | dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit | |
233 | dnl keyword and defines HAVE_EXPLICIT if this is the case | |
234 | dnl --------------------------------------------------------------------------- | |
235 | ||
236 | AC_DEFUN([WX_CPP_EXPLICIT], | |
237 | [ | |
238 | AC_CACHE_CHECK([if C++ compiler supports the explicit keyword], | |
239 | wx_cv_explicit, | |
240 | [ | |
241 | AC_LANG_SAVE | |
242 | AC_LANG_CPLUSPLUS | |
243 | ||
244 | dnl do the test in 2 steps: first check that the compiler knows about the | |
245 | dnl explicit keyword at all and then verify that it really honours it | |
246 | AC_TRY_COMPILE( | |
247 | [ | |
248 | class Foo { public: explicit Foo(int) {} }; | |
249 | ], | |
250 | [ | |
251 | return 0; | |
252 | ], | |
253 | [ | |
254 | AC_TRY_COMPILE( | |
255 | [ | |
256 | class Foo { public: explicit Foo(int) {} }; | |
257 | static void TakeFoo(const Foo& foo) { } | |
258 | ], | |
259 | [ | |
260 | TakeFoo(17); | |
261 | return 0; | |
262 | ], | |
263 | wx_cv_explicit=no, | |
264 | wx_cv_explicit=yes | |
265 | ) | |
266 | ], | |
267 | wx_cv_explicit=no | |
268 | ) | |
269 | ||
270 | AC_LANG_RESTORE | |
271 | ]) | |
272 | ||
273 | if test "$wx_cv_explicit" = "yes"; then | |
274 | AC_DEFINE(HAVE_EXPLICIT) | |
275 | fi | |
276 | ]) | |
277 | ||
b040e242 VS |
278 | dnl --------------------------------------------------------------------------- |
279 | dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling | |
280 | dnl --------------------------------------------------------------------------- | |
281 | ||
282 | AC_DEFUN([WX_C_BIGENDIAN], | |
283 | [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian, | |
284 | [ac_cv_c_bigendian=unknown | |
285 | # See if sys/param.h defines the BYTE_ORDER macro. | |
286 | AC_TRY_COMPILE([#include <sys/types.h> | |
287 | #include <sys/param.h>], [ | |
288 | #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN | |
289 | bogus endian macros | |
290 | #endif], [# It does; now see whether it defined to BIG_ENDIAN or not. | |
291 | AC_TRY_COMPILE([#include <sys/types.h> | |
292 | #include <sys/param.h>], [ | |
293 | #if BYTE_ORDER != BIG_ENDIAN | |
294 | not big endian | |
295 | #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) | |
296 | if test $ac_cv_c_bigendian = unknown; then | |
297 | AC_TRY_RUN([main () { | |
298 | /* Are we little or big endian? From Harbison&Steele. */ | |
299 | union | |
300 | { | |
301 | long l; | |
302 | char c[sizeof (long)]; | |
303 | } u; | |
304 | u.l = 1; | |
305 | exit (u.c[sizeof (long) - 1] == 1); | |
306 | }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown]) | |
307 | fi]) | |
308 | if test $ac_cv_c_bigendian = unknown; then | |
309 | AC_MSG_WARN([Assuming little-endian target machine - this may be overriden by adding the line "ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}" to config.cache file]) | |
310 | fi | |
311 | if test $ac_cv_c_bigendian = yes; then | |
312 | AC_DEFINE(WORDS_BIGENDIAN) | |
313 | fi | |
314 | ]) | |
315 | ||
316 | dnl --------------------------------------------------------------------------- | |
317 | dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file | |
318 | dnl --------------------------------------------------------------------------- | |
319 | ||
320 | AC_DEFUN([WX_ARG_CACHE_INIT], | |
321 | [ | |
322 | wx_arg_cache_file="configarg.cache" | |
323 | echo "loading argument cache $wx_arg_cache_file" | |
324 | rm -f ${wx_arg_cache_file}.tmp | |
325 | touch ${wx_arg_cache_file}.tmp | |
326 | touch ${wx_arg_cache_file} | |
327 | ]) | |
328 | ||
329 | AC_DEFUN([WX_ARG_CACHE_FLUSH], | |
330 | [ | |
331 | echo "saving argument cache $wx_arg_cache_file" | |
332 | mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file} | |
333 | ]) | |
334 | ||
335 | dnl this macro checks for a three-valued command line --with argument: | |
336 | dnl possible arguments are 'yes', 'no', 'sys', or 'builtin' | |
337 | dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name) | |
338 | AC_DEFUN([WX_ARG_SYS_WITH], | |
339 | [ | |
340 | AC_MSG_CHECKING([for --with-$1]) | |
341 | no_cache=0 | |
342 | AC_ARG_WITH($1, [$2], | |
343 | [ | |
344 | if test "$withval" = yes; then | |
345 | ac_cv_use_$1='$3=yes' | |
346 | elif test "$withval" = no; then | |
347 | ac_cv_use_$1='$3=no' | |
348 | elif test "$withval" = sys; then | |
349 | ac_cv_use_$1='$3=sys' | |
350 | elif test "$withval" = builtin; then | |
351 | ac_cv_use_$1='$3=builtin' | |
352 | else | |
353 | AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin]) | |
354 | fi | |
355 | ], | |
356 | [ | |
357 | LINE=`grep "$3" ${wx_arg_cache_file}` | |
358 | if test "x$LINE" != x ; then | |
359 | eval "DEFAULT_$LINE" | |
360 | else | |
361 | no_cache=1 | |
362 | fi | |
363 | ||
364 | ac_cv_use_$1='$3='$DEFAULT_$3 | |
365 | ]) | |
366 | ||
367 | eval "$ac_cv_use_$1" | |
368 | if test "$no_cache" != 1; then | |
369 | echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp | |
370 | fi | |
371 | ||
372 | if test "$$3" = yes; then | |
373 | AC_MSG_RESULT(yes) | |
374 | elif test "$$3" = no; then | |
375 | AC_MSG_RESULT(no) | |
376 | elif test "$$3" = sys; then | |
377 | AC_MSG_RESULT([system version]) | |
378 | elif test "$$3" = builtin; then | |
379 | AC_MSG_RESULT([builtin version]) | |
380 | else | |
381 | AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin]) | |
382 | fi | |
383 | ]) | |
384 | ||
385 | dnl this macro checks for a command line argument and caches the result | |
386 | dnl usage: WX_ARG_WITH(option, helpmessage, variable-name) | |
387 | AC_DEFUN([WX_ARG_WITH], | |
388 | [ | |
389 | AC_MSG_CHECKING([for --with-$1]) | |
390 | no_cache=0 | |
391 | AC_ARG_WITH($1, [$2], | |
392 | [ | |
393 | if test "$withval" = yes; then | |
394 | ac_cv_use_$1='$3=yes' | |
395 | else | |
396 | ac_cv_use_$1='$3=no' | |
397 | fi | |
398 | ], | |
399 | [ | |
400 | LINE=`grep "$3" ${wx_arg_cache_file}` | |
401 | if test "x$LINE" != x ; then | |
402 | eval "DEFAULT_$LINE" | |
403 | else | |
404 | no_cache=1 | |
405 | fi | |
406 | ||
407 | ac_cv_use_$1='$3='$DEFAULT_$3 | |
408 | ]) | |
409 | ||
410 | eval "$ac_cv_use_$1" | |
411 | if test "$no_cache" != 1; then | |
412 | echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp | |
413 | fi | |
414 | ||
415 | if test "$$3" = yes; then | |
416 | AC_MSG_RESULT(yes) | |
417 | else | |
418 | AC_MSG_RESULT(no) | |
419 | fi | |
420 | ]) | |
421 | ||
422 | dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH | |
5005acfe | 423 | dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring) |
2b5f62a0 VZ |
424 | dnl |
425 | dnl enablestring is a hack and allows to show "checking for --disable-foo" | |
426 | dnl message when running configure instead of the default "checking for | |
427 | dnl --enable-foo" one whih is useful for the options enabled by default | |
b040e242 VS |
428 | AC_DEFUN([WX_ARG_ENABLE], |
429 | [ | |
5005acfe VZ |
430 | enablestring=$4 |
431 | AC_MSG_CHECKING([for --${enablestring:-enable}-$1]) | |
b040e242 VS |
432 | no_cache=0 |
433 | AC_ARG_ENABLE($1, [$2], | |
434 | [ | |
435 | if test "$enableval" = yes; then | |
436 | ac_cv_use_$1='$3=yes' | |
437 | else | |
438 | ac_cv_use_$1='$3=no' | |
439 | fi | |
440 | ], | |
441 | [ | |
442 | LINE=`grep "$3" ${wx_arg_cache_file}` | |
443 | if test "x$LINE" != x ; then | |
444 | eval "DEFAULT_$LINE" | |
445 | else | |
446 | no_cache=1 | |
447 | fi | |
448 | ||
449 | ac_cv_use_$1='$3='$DEFAULT_$3 | |
450 | ]) | |
451 | ||
452 | eval "$ac_cv_use_$1" | |
453 | if test "$no_cache" != 1; then | |
454 | echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp | |
455 | fi | |
456 | ||
457 | if test "$$3" = yes; then | |
458 | AC_MSG_RESULT(yes) | |
459 | else | |
460 | AC_MSG_RESULT(no) | |
461 | fi | |
462 | ]) | |
463 | ||
464 | ||
2b5f62a0 VZ |
465 | dnl =========================================================================== |
466 | dnl Linker features test | |
467 | dnl =========================================================================== | |
468 | ||
469 | dnl --------------------------------------------------------------------------- | |
470 | dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned | |
471 | dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use | |
472 | dnl version script file named versionfile | |
473 | dnl | |
474 | dnl call WX_VERSIONED_SYMBOLS(versionfile) | |
475 | dnl --------------------------------------------------------------------------- | |
476 | AC_DEFUN([WX_VERSIONED_SYMBOLS], | |
477 | [ | |
478 | found_versioning=no | |
479 | ||
b4eecb7e VS |
480 | dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards |
481 | dnl in the script. | |
482 | dnl dnl Check for known non-gcc cases: | |
483 | dnl case "${host}" in | |
484 | dnl *-*-solaris2* ) | |
485 | dnl if test "x$GCC" != "xyes" ; then | |
486 | dnl LDFLAGS_VERSIONING="-M $1" | |
487 | dnl found_versioning=yes | |
488 | dnl fi | |
489 | dnl ;; | |
490 | dnl esac | |
2b5f62a0 VZ |
491 | |
492 | dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC): | |
493 | if test $found_versioning = no ; then | |
494 | AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script, | |
495 | [ | |
496 | echo "VER_1 { *; };" >conftest.sym | |
497 | echo "int main() { return 0; }" >conftest.cpp | |
498 | ||
499 | if AC_TRY_COMMAND([ | |
500 | $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp | |
501 | -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then | |
502 | if test -s conftest.stderr ; then | |
503 | wx_cv_version_script=no | |
504 | else | |
505 | wx_cv_version_script=yes | |
506 | fi | |
507 | else | |
508 | wx_cv_version_script=no | |
509 | fi | |
510 | rm -f conftest.output conftest.stderr conftest.sym conftest.cpp | |
511 | ]) | |
512 | if test $wx_cv_version_script = yes ; then | |
513 | LDFLAGS_VERSIONING="-Wl,--version-script,$1" | |
514 | fi | |
515 | fi | |
516 | ]) | |
517 | ||
b040e242 VS |
518 | |
519 | dnl =========================================================================== | |
520 | dnl "3rd party" macros included here because they are not widely available | |
521 | dnl =========================================================================== | |
522 | ||
b040e242 VS |
523 | dnl --------------------------------------------------------------------------- |
524 | dnl test for availability of iconv() | |
525 | dnl --------------------------------------------------------------------------- | |
526 | ||
b040e242 VS |
527 | dnl From Bruno Haible. |
528 | ||
529 | AC_DEFUN([AM_ICONV], | |
530 | [ | |
531 | dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and | |
532 | dnl those with the standalone portable GNU libiconv installed). | |
533 | ||
534 | AC_ARG_WITH([libiconv-prefix], | |
535 | [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ | |
536 | for dir in `echo "$withval" | tr : ' '`; do | |
537 | if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi | |
538 | if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi | |
539 | done | |
540 | ]) | |
541 | ||
542 | AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ | |
543 | am_cv_func_iconv="no, consider installing GNU libiconv" | |
544 | am_cv_lib_iconv=no | |
545 | AC_TRY_LINK([#include <stdlib.h> | |
546 | #include <iconv.h>], | |
547 | [iconv_t cd = iconv_open("",""); | |
548 | iconv(cd,NULL,NULL,NULL,NULL); | |
549 | iconv_close(cd);], | |
550 | am_cv_func_iconv=yes) | |
551 | if test "$am_cv_func_iconv" != yes; then | |
552 | am_save_LIBS="$LIBS" | |
553 | LIBS="$LIBS -liconv" | |
554 | AC_TRY_LINK([#include <stdlib.h> | |
555 | #include <iconv.h>], | |
556 | [iconv_t cd = iconv_open("",""); | |
557 | iconv(cd,NULL,NULL,NULL,NULL); | |
558 | iconv_close(cd);], | |
559 | am_cv_lib_iconv=yes | |
560 | am_cv_func_iconv=yes) | |
561 | LIBS="$am_save_LIBS" | |
562 | fi | |
563 | ]) | |
564 | if test "$am_cv_func_iconv" = yes; then | |
565 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) | |
b7043674 | 566 | AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const, |
b040e242 VS |
567 | AC_TRY_COMPILE([ |
568 | #include <stdlib.h> | |
569 | #include <iconv.h> | |
570 | extern | |
571 | #ifdef __cplusplus | |
572 | "C" | |
573 | #endif | |
574 | #if defined(__STDC__) || defined(__cplusplus) | |
575 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | |
576 | #else | |
577 | size_t iconv(); | |
578 | #endif | |
b7043674 VZ |
579 | ], |
580 | [], | |
581 | wx_cv_func_iconv_const="no", | |
582 | wx_cv_func_iconv_const="yes" | |
583 | ) | |
584 | ) | |
585 | ||
586 | iconv_const= | |
1c405bb5 | 587 | if test "x$wx_cv_func_iconv_const" = "xyes"; then |
b7043674 VZ |
588 | iconv_const="const" |
589 | fi | |
590 | ||
591 | AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const, | |
b040e242 VS |
592 | [Define as const if the declaration of iconv() needs const.]) |
593 | fi | |
594 | LIBICONV= | |
595 | if test "$am_cv_lib_iconv" = yes; then | |
596 | LIBICONV="-liconv" | |
597 | fi | |
598 | AC_SUBST(LIBICONV) | |
599 | ]) | |
600 | ||
90dd450c VZ |
601 | dnl --------------------------------------------------------------------------- |
602 | dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x) | |
603 | dnl --------------------------------------------------------------------------- | |
604 | ||
605 | dnl WX_SYS_LARGEFILE_TEST | |
606 | dnl | |
607 | dnl NB: original autoconf test was checking if compiler supported 6 bit off_t | |
608 | dnl arithmetic properly but this failed miserably with gcc under Linux | |
609 | dnl whereas the system still supports 64 bit files, so now simply check | |
610 | dnl that off_t is big enough | |
611 | define(WX_SYS_LARGEFILE_TEST, | |
612 | [typedef struct { | |
613 | unsigned int field: sizeof(off_t) == 8; | |
614 | } wxlf; | |
615 | ]) | |
616 | ||
617 | ||
618 | dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR) | |
619 | define(WX_SYS_LARGEFILE_MACRO_VALUE, | |
620 | [ | |
621 | AC_CACHE_CHECK([for $1 value needed for large files], [$3], | |
622 | [ | |
623 | AC_TRY_COMPILE([#define $1 $2 | |
624 | #include <sys/types.h>], | |
625 | WX_SYS_LARGEFILE_TEST, | |
626 | [$3=$2], | |
627 | [$3=no]) | |
628 | ] | |
629 | ) | |
630 | ||
631 | if test "$$3" != no; then | |
5a5d3c08 | 632 | wx_largefile=yes |
90dd450c VZ |
633 | AC_DEFINE_UNQUOTED([$1], [$$3]) |
634 | fi | |
635 | ]) | |
636 | ||
637 | ||
638 | dnl AC_SYS_LARGEFILE | |
639 | dnl ---------------- | |
640 | dnl By default, many hosts won't let programs access large files; | |
641 | dnl one must use special compiler options to get large-file access to work. | |
642 | dnl For more details about this brain damage please see: | |
643 | dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html | |
644 | AC_DEFUN([AC_SYS_LARGEFILE], | |
645 | [AC_ARG_ENABLE(largefile, | |
646 | [ --disable-largefile omit support for large files]) | |
647 | if test "$enable_largefile" != no; then | |
648 | dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ... | |
649 | dnl _LARGE_FILES -- for AIX | |
5a5d3c08 | 650 | wx_largefile=no |
90dd450c VZ |
651 | WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits) |
652 | if test "x$wx_largefile" != "xyes"; then | |
653 | WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files) | |
654 | fi | |
655 | ||
5a5d3c08 | 656 | AC_MSG_CHECKING(if large file support is available) |
90dd450c VZ |
657 | if test "x$wx_largefile" = "xyes"; then |
658 | AC_DEFINE(HAVE_LARGEFILE_SUPPORT) | |
659 | fi | |
5a5d3c08 | 660 | AC_MSG_RESULT($wx_largefile) |
90dd450c VZ |
661 | fi |
662 | ]) | |
b040e242 | 663 | |
521196a2 MB |
664 | |
665 | dnl Available from the GNU Autoconf Macro Archive at: | |
666 | dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html | |
667 | dnl | |
668 | AC_DEFUN([AC_CXX_CONST_CAST], | |
669 | [AC_CACHE_CHECK(whether the compiler supports const_cast<>, | |
670 | ac_cv_cxx_const_cast, | |
671 | [AC_LANG_SAVE | |
672 | AC_LANG_CPLUSPLUS | |
673 | AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;], | |
674 | ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no) | |
675 | AC_LANG_RESTORE | |
676 | ]) | |
677 | if test "$ac_cv_cxx_const_cast" = yes; then | |
678 | AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>]) | |
679 | fi | |
680 | ]) | |
681 | ||
7714864e RL |
682 | dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_reinterpret_cast.html |
683 | AC_DEFUN([AC_CXX_REINTERPRET_CAST], | |
684 | [AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>, | |
685 | ac_cv_cxx_reinterpret_cast, | |
686 | [AC_LANG_SAVE | |
687 | AC_LANG_CPLUSPLUS | |
688 | AC_TRY_COMPILE([#include <typeinfo> | |
689 | class Base { public : Base () {} virtual void f () = 0;}; | |
690 | class Derived : public Base { public : Derived () {} virtual void f () {} }; | |
691 | class Unrelated { public : Unrelated () {} }; | |
692 | int g (Unrelated&) { return 0; }],[ | |
693 | Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);], | |
694 | ac_cv_cxx_reinterpret_cast=yes, ac_cv_cxx_reinterpret_cast=no) | |
695 | AC_LANG_RESTORE | |
696 | ]) | |
697 | if test "$ac_cv_cxx_reinterpret_cast" = yes; then | |
698 | AC_DEFINE(HAVE_REINTERPRET_CAST,, | |
699 | [define if the compiler supports reinterpret_cast<>]) | |
700 | fi | |
701 | ]) | |
702 | ||
ecfd48ca VZ |
703 | dnl and http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_static_cast.html |
704 | AC_DEFUN([AC_CXX_STATIC_CAST], | |
705 | [AC_CACHE_CHECK(whether the compiler supports static_cast<>, | |
706 | ac_cv_cxx_static_cast, | |
707 | [AC_LANG_SAVE | |
708 | AC_LANG_CPLUSPLUS | |
709 | AC_TRY_COMPILE([#include <typeinfo> | |
710 | class Base { public : Base () {} virtual void f () = 0; }; | |
711 | class Derived : public Base { public : Derived () {} virtual void f () {} }; | |
712 | int g (Derived&) { return 0; }],[ | |
713 | Derived d; Base& b = d; Derived& s = static_cast<Derived&> (b); return g (s);], | |
714 | ac_cv_cxx_static_cast=yes, ac_cv_cxx_static_cast=no) | |
715 | AC_LANG_RESTORE | |
716 | ]) | |
717 | if test "$ac_cv_cxx_static_cast" = yes; then | |
718 | AC_DEFINE(HAVE_STATIC_CAST,, [define if the compiler supports static_cast<>]) | |
719 | fi | |
720 | ]) | |
721 | ||
2e350179 VS |
722 | dnl --------------------------------------------------------------------------- |
723 | dnl Support macros for makefiles generated by BAKEFILE. | |
724 | dnl --------------------------------------------------------------------------- | |
b040e242 | 725 | |
2e350179 VS |
726 | dnl Lots of compiler & linker detection code contained here was taken from |
727 | dnl wxWindows configure.in script (see http://www.wxwindows.org) | |
3f345b47 | 728 | |
2e350179 VS |
729 | dnl Based on autoconf _AC_LANG_COMPILER_GNU |
730 | AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_MWERKS], | |
731 | [AC_CACHE_CHECK([whether we are using the Metrowerks _AC_LANG compiler], | |
732 | [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks], | |
733 | [AC_TRY_COMPILE([],[#ifndef __MWERKS__ | |
734 | choke me | |
735 | #endif | |
736 | ], | |
737 | [bakefile_compiler_mwerks=yes], | |
738 | [bakefile_compiler_mwerks=no]) | |
739 | bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks=$bakefile_compiler_mwerks | |
740 | ]) | |
741 | ]) | |
3f345b47 | 742 | |
2e350179 VS |
743 | dnl Loosely based on autoconf AC_PROG_CC |
744 | dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead. | |
745 | AC_DEFUN([AC_BAKEFILE_PROG_MWCC], | |
746 | [AC_LANG_PUSH(C) | |
747 | _AC_BAKEFILE_LANG_COMPILER_MWERKS | |
748 | MWCC=`test $bakefile_compiler_mwerks = yes && echo yes` | |
749 | AC_LANG_POP(C) | |
750 | ]) | |
9e691f46 | 751 | |
2e350179 VS |
752 | dnl Loosely based on autoconf AC_PROG_CXX |
753 | dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead. | |
754 | AC_DEFUN([AC_BAKEFILE_PROG_MWCXX], | |
755 | [AC_LANG_PUSH(C++) | |
756 | _AC_BAKEFILE_LANG_COMPILER_MWERKS | |
757 | MWCXX=`test $bakefile_compiler_mwerks = yes && echo yes` | |
758 | AC_LANG_POP(C++) | |
759 | ]) | |
9e691f46 | 760 | |
2e350179 VS |
761 | dnl --------------------------------------------------------------------------- |
762 | dnl AC_BAKEFILE_GNUMAKE | |
763 | dnl | |
764 | dnl Detects GNU make | |
765 | dnl --------------------------------------------------------------------------- | |
766 | ||
767 | AC_DEFUN([AC_BAKEFILE_GNUMAKE], | |
768 | [ | |
769 | dnl does make support "-include" (only GNU make does AFAIK)? | |
770 | AC_CACHE_CHECK([if make is GNU make], bakefile_cv_prog_makeisgnu, | |
771 | [ | |
772 | if ( ${SHELL-sh} -c "${MAKE-make} --version" 2> /dev/null | | |
773 | egrep -s GNU > /dev/null); then | |
774 | bakefile_cv_prog_makeisgnu="yes" | |
775 | else | |
776 | bakefile_cv_prog_makeisgnu="no" | |
777 | fi | |
778 | ]) | |
779 | ||
780 | if test "x$bakefile_cv_prog_makeisgnu" = "xyes"; then | |
781 | IF_GNU_MAKE="" | |
9e691f46 | 782 | else |
2e350179 | 783 | IF_GNU_MAKE="#" |
9e691f46 | 784 | fi |
2e350179 VS |
785 | AC_SUBST(IF_GNU_MAKE) |
786 | ]) | |
9e691f46 | 787 | |
2e350179 VS |
788 | dnl --------------------------------------------------------------------------- |
789 | dnl AC_BAKEFILE_PLATFORM | |
790 | dnl | |
791 | dnl Detects platform and sets PLATFORM_XXX variables accordingly | |
792 | dnl --------------------------------------------------------------------------- | |
9e691f46 | 793 | |
2e350179 VS |
794 | AC_DEFUN([AC_BAKEFILE_PLATFORM], |
795 | [ | |
796 | PLATFORM_UNIX=0 | |
797 | PLATFORM_WIN32=0 | |
798 | PLATFORM_MSDOS=0 | |
799 | PLATFORM_MAC=0 | |
800 | PLATFORM_MACOS=0 | |
801 | PLATFORM_MACOSX=0 | |
802 | PLATFORM_OS2=0 | |
803 | PLATFORM_BEOS=0 | |
9e691f46 | 804 | |
2e350179 VS |
805 | if test "x$BAKEFILE_FORCE_PLATFORM" = "x"; then |
806 | case "${BAKEFILE_HOST}" in | |
807 | *-*-cygwin* | *-*-mingw32* ) | |
808 | PLATFORM_WIN32=1 | |
809 | ;; | |
810 | *-pc-msdosdjgpp ) | |
811 | PLATFORM_MSDOS=1 | |
812 | ;; | |
813 | *-pc-os2_emx | *-pc-os2-emx ) | |
814 | PLATFORM_OS2=1 | |
815 | ;; | |
816 | powerpc-*-darwin* ) | |
817 | PLATFORM_MAC=1 | |
818 | PLATFORM_MACOSX=1 | |
819 | ;; | |
820 | *-*-beos* ) | |
821 | PLATFORM_BEOS=1 | |
822 | ;; | |
823 | powerpc-apple-macos* ) | |
824 | PLATFORM_MAC=1 | |
825 | PLATFORM_MACOS=1 | |
826 | ;; | |
827 | * ) | |
828 | PLATFORM_UNIX=1 | |
829 | ;; | |
830 | esac | |
9e691f46 | 831 | else |
2e350179 VS |
832 | case "$BAKEFILE_FORCE_PLATFORM" in |
833 | win32 ) | |
834 | PLATFORM_WIN32=1 | |
835 | ;; | |
836 | msdos ) | |
837 | PLATFORM_MSDOS=1 | |
838 | ;; | |
839 | os2 ) | |
840 | PLATFORM_OS2=1 | |
841 | ;; | |
842 | darwin ) | |
843 | PLATFORM_MAC=1 | |
844 | PLATFORM_MACOSX=1 | |
845 | ;; | |
846 | unix ) | |
847 | PLATFORM_UNIX=1 | |
848 | ;; | |
849 | beos ) | |
850 | PLATFORM_BEOS=1 | |
851 | ;; | |
852 | * ) | |
853 | AC_MSG_ERROR([Unknown platform: $BAKEFILE_FORCE_PLATFORM]) | |
854 | ;; | |
855 | esac | |
9e691f46 | 856 | fi |
8168de4c | 857 | |
2e350179 VS |
858 | AC_SUBST(PLATFORM_UNIX) |
859 | AC_SUBST(PLATFORM_WIN32) | |
860 | AC_SUBST(PLATFORM_MSDOS) | |
861 | AC_SUBST(PLATFORM_MAC) | |
862 | AC_SUBST(PLATFORM_MACOS) | |
863 | AC_SUBST(PLATFORM_MACOSX) | |
864 | AC_SUBST(PLATFORM_OS2) | |
865 | AC_SUBST(PLATFORM_BEOS) | |
866 | ]) | |
867 | ||
868 | ||
869 | dnl --------------------------------------------------------------------------- | |
870 | dnl AC_BAKEFILE_PLATFORM_SPECIFICS | |
8168de4c | 871 | dnl |
2e350179 VS |
872 | dnl Sets misc platform-specific settings |
873 | dnl --------------------------------------------------------------------------- | |
8168de4c | 874 | |
2e350179 VS |
875 | AC_DEFUN([AC_BAKEFILE_PLATFORM_SPECIFICS], |
876 | [ | |
877 | AC_ARG_ENABLE([omf], AS_HELP_STRING([--enable-omf], | |
878 | [use OMF object format (OS/2)]), | |
879 | [bk_os2_use_omf="$enableval"]) | |
880 | ||
881 | case "${BAKEFILE_HOST}" in | |
882 | *-*-darwin* ) | |
883 | dnl For Unix to MacOS X porting instructions, see: | |
884 | dnl http://fink.sourceforge.net/doc/porting/porting.html | |
885 | CFLAGS="$CFLAGS -fno-common" | |
886 | CXXFLAGS="$CXXFLAGS -fno-common" | |
887 | ;; | |
8168de4c | 888 | |
2e350179 VS |
889 | *-pc-os2_emx | *-pc-os2-emx ) |
890 | if test "x$bk_os2_use_omf" = "xyes" ; then | |
891 | AR=emxomfar | |
892 | RANLIB=: | |
893 | LDFLAGS="-Zomf $LDFLAGS" | |
894 | CFLAGS="-Zomf $CFLAGS" | |
895 | CXXFLAGS="-Zomf $CXXFLAGS" | |
896 | OS2_LIBEXT="lib" | |
897 | else | |
898 | OS2_LIBEXT="a" | |
899 | fi | |
900 | ;; | |
901 | ||
902 | i*86-*-beos* ) | |
903 | LDFLAGS="-L/boot/develop/lib/x86 $LDFLAGS" | |
904 | ;; | |
905 | esac | |
906 | ]) | |
8168de4c | 907 | |
2e350179 VS |
908 | dnl --------------------------------------------------------------------------- |
909 | dnl AC_BAKEFILE_SUFFIXES | |
910 | dnl | |
911 | dnl Detects shared various suffixes for shared libraries, libraries, programs, | |
912 | dnl plugins etc. | |
913 | dnl --------------------------------------------------------------------------- | |
fe0895cf | 914 | |
af8ebe8a | 915 | AC_DEFUN([AC_BAKEFILE_SUFFIXES], |
fe0895cf VS |
916 | [ |
917 | SO_SUFFIX="so" | |
131f235d | 918 | SO_SUFFIX_MODULE="so" |
fe0895cf | 919 | EXEEXT="" |
3fd9c298 DE |
920 | LIBPREFIX="lib" |
921 | LIBEXT=".a" | |
922 | DLLPREFIX="lib" | |
923 | DLLPREFIX_MODULE="" | |
924 | DLLIMP_SUFFIX="" | |
fe0895cf | 925 | |
f93ca9fd | 926 | case "${BAKEFILE_HOST}" in |
fe0895cf VS |
927 | *-hp-hpux* ) |
928 | SO_SUFFIX="sl" | |
131f235d | 929 | SO_SUFFIX_MODULE="sl" |
fe0895cf VS |
930 | ;; |
931 | *-*-aix* ) | |
932 | dnl quoting from | |
933 | dnl http://www-1.ibm.com/servers/esdd/articles/gnu.html: | |
934 | dnl Both archive libraries and shared libraries on AIX have an | |
935 | dnl .a extension. This will explain why you can't link with an | |
936 | dnl .so and why it works with the name changed to .a. | |
937 | SO_SUFFIX="a" | |
131f235d | 938 | SO_SUFFIX_MODULE="a" |
fe0895cf VS |
939 | ;; |
940 | *-*-cygwin* | *-*-mingw32* ) | |
941 | SO_SUFFIX="dll" | |
131f235d | 942 | SO_SUFFIX_MODULE="dll" |
3fd9c298 | 943 | DLLIMP_SUFFIX="dll.a" |
fe0895cf VS |
944 | EXEEXT=".exe" |
945 | DLLPREFIX="" | |
946 | ;; | |
4b1f6360 VS |
947 | *-pc-msdosdjgpp ) |
948 | EXEEXT=".exe" | |
949 | DLLPREFIX="" | |
950 | ;; | |
951 | *-pc-os2_emx | *-pc-os2-emx ) | |
11a20c3a SN |
952 | SO_SUFFIX="dll" |
953 | SO_SUFFIX_MODULE="dll" | |
3fd9c298 | 954 | DLLIMP_SUFFIX=$OS2_LIBEXT |
fe0895cf VS |
955 | EXEEXT=".exe" |
956 | DLLPREFIX="" | |
4b1f6360 | 957 | LIBPREFIX="" |
3fd9c298 | 958 | LIBEXT=".$OS2_LIBEXT" |
fe0895cf VS |
959 | ;; |
960 | powerpc-*-darwin* ) | |
961 | SO_SUFFIX="dylib" | |
131f235d | 962 | SO_SUFFIX_MODULE="bundle" |
fe0895cf VS |
963 | ;; |
964 | esac | |
965 | ||
3fd9c298 DE |
966 | if test "x$DLLIMP_SUFFIX" = "x" ; then |
967 | DLLIMP_SUFFIX="$SO_SUFFIX" | |
968 | fi | |
969 | ||
fe0895cf | 970 | AC_SUBST(SO_SUFFIX) |
131f235d | 971 | AC_SUBST(SO_SUFFIX_MODULE) |
3fd9c298 | 972 | AC_SUBST(DLLIMP_SUFFIX) |
fe0895cf | 973 | AC_SUBST(EXEEXT) |
4b1f6360 | 974 | AC_SUBST(LIBPREFIX) |
3fd9c298 | 975 | AC_SUBST(LIBEXT) |
fe0895cf | 976 | AC_SUBST(DLLPREFIX) |
131f235d | 977 | AC_SUBST(DLLPREFIX_MODULE) |
fe0895cf VS |
978 | ]) |
979 | ||
980 | ||
981 | dnl --------------------------------------------------------------------------- | |
982 | dnl AC_BAKEFILE_SHARED_LD | |
983 | dnl | |
984 | dnl Detects command for making shared libraries, substitutes SHARED_LD_CC | |
985 | dnl and SHARED_LD_CXX. | |
986 | dnl --------------------------------------------------------------------------- | |
987 | ||
af8ebe8a | 988 | AC_DEFUN([AC_BAKEFILE_SHARED_LD], |
fe0895cf | 989 | [ |
fe0895cf | 990 | dnl the extra compiler flags needed for compilation of shared library |
6ff53182 | 991 | PIC_FLAG="" |
fe0895cf VS |
992 | if test "x$GCC" = "xyes"; then |
993 | dnl the switch for gcc is the same under all platforms | |
994 | PIC_FLAG="-fPIC" | |
995 | fi | |
6ff53182 DE |
996 | |
997 | dnl Defaults for GCC and ELF .so shared libs: | |
998 | SHARED_LD_CC="\$(CC) -shared ${PIC_FLAG} -o" | |
999 | SHARED_LD_CXX="\$(CXX) -shared ${PIC_FLAG} -o" | |
fe0895cf | 1000 | |
f93ca9fd | 1001 | case "${BAKEFILE_HOST}" in |
fe0895cf VS |
1002 | *-hp-hpux* ) |
1003 | dnl default settings are good for gcc but not for the native HP-UX | |
6ff53182 | 1004 | if test "x$GCC" != "xyes"; then |
fe0895cf VS |
1005 | dnl no idea why it wants it, but it does |
1006 | LDFLAGS="$LDFLAGS -L/usr/lib" | |
1007 | ||
1008 | SHARED_LD_CC="${CC} -b -o" | |
1009 | SHARED_LD_CXX="${CXX} -b -o" | |
1010 | PIC_FLAG="+Z" | |
1011 | fi | |
1012 | ;; | |
1013 | ||
1014 | *-*-linux* ) | |
1015 | if test "x$GCC" != "xyes"; then | |
1016 | AC_CACHE_CHECK([for Intel compiler], bakefile_cv_prog_icc, | |
1017 | [ | |
1018 | AC_TRY_COMPILE([], | |
1019 | [ | |
1020 | #ifndef __INTEL_COMPILER | |
1021 | #error Not icc | |
1022 | #endif | |
1023 | ], | |
1024 | bakefile_cv_prog_icc=yes, | |
1025 | bakefile_cv_prog_icc=no | |
1026 | ) | |
1027 | ]) | |
1028 | if test "$bakefile_cv_prog_icc" = "yes"; then | |
1029 | PIC_FLAG="-KPIC" | |
1030 | fi | |
1031 | fi | |
1032 | ;; | |
1033 | ||
1034 | *-*-solaris2* ) | |
1035 | if test "x$GCC" != xyes ; then | |
1036 | SHARED_LD_CC="${CC} -G -o" | |
1037 | SHARED_LD_CXX="${CXX} -G -o" | |
1038 | PIC_FLAG="-KPIC" | |
1039 | fi | |
1040 | ;; | |
1041 | ||
1042 | *-*-darwin* ) | |
fe0895cf VS |
1043 | dnl Most apps benefit from being fully binded (its faster and static |
1044 | dnl variables initialized at startup work). | |
1045 | dnl This can be done either with the exe linker flag -Wl,-bind_at_load | |
1046 | dnl or with a double stage link in order to create a single module | |
1047 | dnl "-init _wxWindowsDylibInit" not useful with lazy linking solved | |
1048 | ||
2a879853 VS |
1049 | dnl If using newer dev tools then there is a -single_module flag that |
1050 | dnl we can use to do this, otherwise we'll need to use a helper | |
1051 | dnl script. Check the version of gcc to see which way we can go: | |
1052 | AC_CACHE_CHECK([for gcc 3.1 or later], wx_cv_gcc31, [ | |
1053 | AC_TRY_COMPILE([], | |
1054 | [ | |
1055 | #if (__GNUC__ < 3) || \ | |
1056 | ((__GNUC__ == 3) && (__GNUC_MINOR__ < 1)) | |
1057 | #error old gcc | |
1058 | #endif | |
1059 | ], | |
1060 | [ | |
1061 | wx_cv_gcc31=yes | |
1062 | ], | |
1063 | [ | |
1064 | wx_cv_gcc31=no | |
1065 | ] | |
1066 | ) | |
1067 | ]) | |
1068 | if test "$wx_cv_gcc31" = "no"; then | |
3fd9c298 | 1069 | AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH |
43948499 RD |
1070 | chmod +x shared-ld-sh |
1071 | ||
2a879853 | 1072 | dnl Use the shared-ld-sh helper script |
7f523214 VS |
1073 | SHARED_LD_CC="`pwd`/shared-ld-sh -dynamiclib -headerpad_max_install_names -o" |
1074 | SHARED_LD_MODULE_CC="`pwd`/shared-ld-sh -bundle -headerpad_max_install_names -o" | |
2a879853 VS |
1075 | SHARED_LD_CXX="$SHARED_LD_CC" |
1076 | SHARED_LD_MODULE_CXX="$SHARED_LD_MODULE_CC" | |
1077 | else | |
1078 | dnl Use the -single_module flag and let the linker do it for us | |
7f523214 VS |
1079 | SHARED_LD_CC="\${CC} -dynamiclib -single_module -headerpad_max_install_names -o" |
1080 | SHARED_LD_MODULE_CC="\${CC} -bundle -single_module -headerpad_max_install_names -o" | |
1081 | SHARED_LD_CXX="\${CXX} -dynamiclib -single_module -headerpad_max_install_names -o" | |
1082 | SHARED_LD_MODULE_CXX="\${CXX} -bundle -single_module -headerpad_max_install_names -o" | |
2a879853 VS |
1083 | fi |
1084 | ||
fe0895cf | 1085 | PIC_FLAG="-dynamic -fPIC" |
fe0895cf VS |
1086 | ;; |
1087 | ||
1088 | *-*-aix* ) | |
1089 | dnl default settings are ok for gcc | |
1090 | if test "x$GCC" != "xyes"; then | |
1091 | dnl the abs path below used to be hardcoded here so I guess it must | |
1092 | dnl be some sort of standard location under AIX? | |
1093 | AC_CHECK_PROG(AIX_CXX_LD, makeC++SharedLib, | |
1094 | makeC++SharedLib, /usr/lpp/xlC/bin/makeC++SharedLib) | |
1095 | dnl FIXME - what about makeCSharedLib? | |
1096 | SHARED_LD_CC="$AIX_CC_LD -p 0 -o" | |
1097 | SHARED_LD_CXX="$AIX_CXX_LD -p 0 -o" | |
1098 | fi | |
1099 | ;; | |
1100 | ||
1101 | *-*-beos* ) | |
1102 | dnl can't use gcc under BeOS for shared library creation because it | |
1103 | dnl complains about missing 'main' | |
6ff53182 DE |
1104 | SHARED_LD_CC="${LD} -nostart -o" |
1105 | SHARED_LD_CXX="${LD} -nostart -o" | |
fe0895cf VS |
1106 | ;; |
1107 | ||
1108 | *-*-irix* ) | |
1109 | dnl default settings are ok for gcc | |
1110 | if test "x$GCC" != "xyes"; then | |
1111 | PIC_FLAG="-KPIC" | |
1112 | fi | |
1113 | ;; | |
1114 | ||
1115 | *-*-cygwin* | *-*-mingw32* ) | |
1116 | PIC_FLAG="" | |
6ff53182 DE |
1117 | SHARED_LD_CC="\$(CC) -shared -o" |
1118 | SHARED_LD_CXX="\$(CXX) -shared -o" | |
fe0895cf | 1119 | ;; |
3fd9c298 | 1120 | |
11a20c3a | 1121 | *-pc-os2_emx | *-pc-os2-emx ) |
b1d22ded DE |
1122 | SHARED_LD_CC="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o" |
1123 | SHARED_LD_CXX="`pwd`/dllar.sh -libf INITINSTANCE -libf TERMINSTANCE -o" | |
11a20c3a | 1124 | PIC_FLAG="" |
3fd9c298 DE |
1125 | AC_BAKEFILE_CREATE_FILE_DLLAR_SH |
1126 | chmod +x dllar.sh | |
11a20c3a SN |
1127 | ;; |
1128 | ||
6ff53182 | 1129 | powerpc-apple-macos* | \ |
fe0895cf VS |
1130 | *-*-freebsd* | *-*-openbsd* | *-*-netbsd* | \ |
1131 | *-*-sunos4* | \ | |
1132 | *-*-osf* | \ | |
1133 | *-*-dgux5* | \ | |
d5fc095c | 1134 | *-*-sysv5* ) |
fe0895cf VS |
1135 | dnl defaults are ok |
1136 | ;; | |
1137 | ||
1138 | *) | |
f93ca9fd | 1139 | AC_MSG_ERROR(unknown system type $BAKEFILE_HOST.) |
fe0895cf VS |
1140 | esac |
1141 | ||
af8ebe8a VS |
1142 | if test "x$PIC_FLAG" != "x" ; then |
1143 | PIC_FLAG="$PIC_FLAG -DPIC" | |
1144 | fi | |
1145 | ||
131f235d VS |
1146 | if test "x$SHARED_LD_MODULE_CC" = "x" ; then |
1147 | SHARED_LD_MODULE_CC="$SHARED_LD_CC" | |
1148 | fi | |
1149 | if test "x$SHARED_LD_MODULE_CXX" = "x" ; then | |
239394fb | 1150 | SHARED_LD_MODULE_CXX="$SHARED_LD_CXX" |
131f235d VS |
1151 | fi |
1152 | ||
fe0895cf VS |
1153 | AC_SUBST(SHARED_LD_CC) |
1154 | AC_SUBST(SHARED_LD_CXX) | |
131f235d VS |
1155 | AC_SUBST(SHARED_LD_MODULE_CC) |
1156 | AC_SUBST(SHARED_LD_MODULE_CXX) | |
fe0895cf VS |
1157 | AC_SUBST(PIC_FLAG) |
1158 | ]) | |
1159 | ||
1160 | ||
1161 | dnl --------------------------------------------------------------------------- | |
1162 | dnl AC_BAKEFILE_SHARED_VERSIONS | |
1163 | dnl | |
1164 | dnl Detects linker options for attaching versions (sonames) to shared libs. | |
1165 | dnl --------------------------------------------------------------------------- | |
1166 | ||
af8ebe8a | 1167 | AC_DEFUN([AC_BAKEFILE_SHARED_VERSIONS], |
fe0895cf VS |
1168 | [ |
1169 | USE_SOVERSION=0 | |
1170 | USE_SOVERLINUX=0 | |
1171 | USE_SOVERSOLARIS=0 | |
1172 | USE_SOSYMLINKS=0 | |
1173 | USE_MACVERSION=0 | |
1174 | SONAME_FLAG= | |
1175 | ||
f93ca9fd | 1176 | case "${BAKEFILE_HOST}" in |
b1d22ded | 1177 | *-*-linux* | *-*-freebsd* ) |
5f652d0d VS |
1178 | SONAME_FLAG="-Wl,-soname," |
1179 | USE_SOVERSION=1 | |
1180 | USE_SOVERLINUX=1 | |
1181 | USE_SOSYMLINKS=1 | |
1182 | ;; | |
fe0895cf VS |
1183 | |
1184 | *-*-solaris2* ) | |
1185 | SONAME_FLAG="-h " | |
1186 | USE_SOVERSION=1 | |
1187 | USE_SOVERSOLARIS=1 | |
1188 | USE_SOSYMLINKS=1 | |
1189 | ;; | |
1190 | ||
1191 | *-*-darwin* ) | |
1192 | USE_MACVERSION=1 | |
1193 | USE_SOVERSION=1 | |
1194 | USE_SOSYMLINKS=1 | |
1195 | ;; | |
1196 | esac | |
1197 | ||
1198 | AC_SUBST(USE_SOVERSION) | |
1199 | AC_SUBST(USE_SOVERLINUX) | |
1200 | AC_SUBST(USE_SOVERSOLARIS) | |
1201 | AC_SUBST(USE_MACVERSION) | |
1202 | AC_SUBST(USE_SOSYMLINKS) | |
1203 | AC_SUBST(SONAME_FLAG) | |
1204 | ]) | |
1205 | ||
1206 | ||
2e350179 VS |
1207 | dnl --------------------------------------------------------------------------- |
1208 | dnl AC_BAKEFILE_DEPS | |
1209 | dnl | |
1210 | dnl Detects available C/C++ dependency tracking options | |
1211 | dnl --------------------------------------------------------------------------- | |
1212 | ||
1213 | AC_DEFUN([AC_BAKEFILE_DEPS], | |
1214 | [ | |
1215 | AC_MSG_CHECKING([for dependency tracking method]) | |
1216 | DEPS_TRACKING=0 | |
1217 | ||
1218 | if test "x$GCC" = "xyes"; then | |
1219 | DEPSMODE=gcc | |
1220 | DEPS_TRACKING=1 | |
1221 | case "${BAKEFILE_HOST}" in | |
1222 | powerpc-*-darwin* ) | |
1223 | dnl -cpp-precomp (the default) conflicts with -MMD option | |
1224 | dnl used by bk-deps (see also http://developer.apple.com/documentation/Darwin/Conceptual/PortingUnix/compiling/chapter_4_section_3.html) | |
1225 | DEPSFLAG_GCC="-no-cpp-precomp -MMD" | |
1226 | ;; | |
1227 | * ) | |
1228 | DEPSFLAG_GCC="-MMD" | |
1229 | ;; | |
1230 | esac | |
1231 | AC_MSG_RESULT([gcc]) | |
1232 | elif test "x$MWCC" = "xyes"; then | |
1233 | DEPSMODE=mwcc | |
1234 | DEPS_TRACKING=1 | |
1235 | DEPSFLAG_MWCC="-MM" | |
1236 | AC_MSG_RESULT([mwcc]) | |
1237 | else | |
1238 | AC_MSG_RESULT([none]) | |
1239 | fi | |
1240 | ||
1241 | if test $DEPS_TRACKING = 1 ; then | |
1242 | AC_BAKEFILE_CREATE_FILE_BK_DEPS | |
1243 | chmod +x bk-deps | |
1244 | fi | |
1245 | ||
1246 | AC_SUBST(DEPS_TRACKING) | |
1247 | ]) | |
1248 | ||
1249 | dnl --------------------------------------------------------------------------- | |
1250 | dnl AC_BAKEFILE_CHECK_BASIC_STUFF | |
1251 | dnl | |
1252 | dnl Checks for presence of basic programs, such as C and C++ compiler, "ranlib" | |
1253 | dnl or "install" | |
1254 | dnl --------------------------------------------------------------------------- | |
1255 | ||
1256 | AC_DEFUN([AC_BAKEFILE_CHECK_BASIC_STUFF], | |
1257 | [ | |
1258 | AC_PROG_RANLIB | |
1259 | AC_PROG_INSTALL | |
1260 | AC_PROG_LN_S | |
1261 | ||
1262 | AC_PROG_MAKE_SET | |
1263 | AC_SUBST(MAKE_SET) | |
1264 | ||
1265 | AC_CHECK_TOOL(AR, ar, ar) | |
1266 | AC_CHECK_TOOL(STRIP, strip, :) | |
1267 | AC_CHECK_TOOL(NM, nm, :) | |
1268 | ||
1269 | case ${BAKEFILE_HOST} in | |
1270 | *-hp-hpux* ) | |
1271 | dnl HP-UX install doesn't handle the "-d" switch so don't | |
1272 | dnl use it there | |
1273 | INSTALL_DIR="mkdir -p" | |
1274 | ;; | |
1275 | *) INSTALL_DIR="$INSTALL -d" | |
1276 | ;; | |
1277 | esac | |
1278 | AC_SUBST(INSTALL_DIR) | |
1279 | ||
1280 | LDFLAGS_GUI= | |
1281 | case ${BAKEFILE_HOST} in | |
1282 | *-*-cygwin* | *-*-mingw32* ) | |
1283 | LDFLAGS_GUI="-mwindows" | |
1284 | esac | |
1285 | AC_SUBST(LDFLAGS_GUI) | |
1286 | ]) | |
1287 | ||
1288 | ||
1289 | dnl --------------------------------------------------------------------------- | |
1290 | dnl AC_BAKEFILE_RES_COMPILERS | |
1291 | dnl | |
1292 | dnl Checks for presence of resource compilers for win32 or mac | |
1293 | dnl --------------------------------------------------------------------------- | |
1294 | ||
1295 | AC_DEFUN([AC_BAKEFILE_RES_COMPILERS], | |
1296 | [ | |
1297 | RESCOMP= | |
1298 | SETFILE= | |
1299 | ||
1300 | case ${BAKEFILE_HOST} in | |
1301 | *-*-cygwin* | *-*-mingw32* ) | |
1302 | dnl Check for win32 resources compiler: | |
1303 | if test "$build" != "$host" ; then | |
1304 | RESCOMP=$host_alias-windres | |
1305 | else | |
1306 | AC_CHECK_PROG(RESCOMP, windres, windres, windres) | |
1307 | fi | |
1308 | ;; | |
1309 | ||
1310 | *-*-darwin* | powerpc-apple-macos* ) | |
1311 | AC_CHECK_PROG(RESCOMP, Rez, Rez, /Developer/Tools/Rez) | |
1312 | AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile) | |
1313 | ;; | |
1314 | esac | |
1315 | ||
1316 | AC_SUBST(RESCOMP) | |
1317 | AC_SUBST(SETFILE) | |
1318 | ]) | |
1319 | ||
1320 | dnl --------------------------------------------------------------------------- | |
1321 | dnl AC_BAKEFILE_PRECOMP_HEADERS | |
1322 | dnl | |
1323 | dnl Check for precompiled headers support (GCC >= 3.4) | |
1324 | dnl --------------------------------------------------------------------------- | |
1325 | ||
1326 | AC_DEFUN([AC_BAKEFILE_PRECOMP_HEADERS], | |
1327 | [ | |
1328 | ||
1329 | AC_ARG_ENABLE([precomp-headers], | |
1330 | AS_HELP_STRING([--disable-precomp-headers], | |
1331 | [don't use precompiled headers even if compiler can]), | |
1332 | [bk_use_pch="$enableval"]) | |
1333 | ||
1334 | GCC_PCH=0 | |
1335 | ||
1336 | if test "x$bk_use_pch" = "x" -o "x$bk_use_pch" = "xyes" ; then | |
1337 | if test "x$GCC" = "xyes"; then | |
1338 | dnl test if we have gcc-3.4: | |
1339 | AC_MSG_CHECKING([if the compiler supports precompiled headers]) | |
1340 | AC_TRY_COMPILE([], | |
1341 | [ | |
1342 | #if !defined(__GNUC__) || !defined(__GNUC_MINOR__) | |
1343 | #error "no pch support" | |
1344 | #endif | |
1345 | #if (__GNUC__ < 3) | |
1346 | #error "no pch support" | |
1347 | #endif | |
1348 | #if (__GNUC__ == 3) && \ | |
1349 | ((!defined(__APPLE_CC__) && (__GNUC_MINOR__ < 4)) || \ | |
1350 | ( defined(__APPLE_CC__) && (__GNUC_MINOR__ < 3))) | |
1351 | #error "no pch support" | |
1352 | #endif | |
1353 | ], | |
1354 | [ | |
1355 | AC_MSG_RESULT([yes]) | |
1356 | GCC_PCH=1 | |
1357 | ], | |
1358 | [ | |
1359 | AC_MSG_RESULT([no]) | |
1360 | ]) | |
1361 | if test $GCC_PCH = 1 ; then | |
1362 | AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH | |
1363 | chmod +x bk-make-pch | |
1364 | fi | |
1365 | fi | |
1366 | fi | |
1367 | ||
1368 | AC_SUBST(GCC_PCH) | |
1369 | ]) | |
1370 | ||
1371 | ||
1372 | ||
1373 | dnl --------------------------------------------------------------------------- | |
1374 | dnl AC_BAKEFILE([autoconf_inc.m4 inclusion]) | |
1375 | dnl | |
1376 | dnl To be used in configure.in of any project using Bakefile-generated mks | |
1377 | dnl | |
1378 | dnl Behaviour can be modified by setting following variables: | |
1379 | dnl BAKEFILE_CHECK_BASICS set to "no" if you don't want bakefile to | |
1380 | dnl to perform check for basic tools like ranlib | |
1381 | dnl BAKEFILE_HOST set this to override host detection, defaults | |
1382 | dnl to ${host} | |
1383 | dnl BAKEFILE_FORCE_PLATFORM set to override platform detection | |
1384 | dnl | |
1385 | dnl Example usage: | |
1386 | dnl | |
1387 | dnl AC_BAKEFILE([FOO(autoconf_inc.m4)]) | |
1388 | dnl | |
1389 | dnl (replace FOO with m4_include above, aclocal would die otherwise) | |
1390 | dnl (yes, it's ugly, but thanks to a bug in aclocal, it's the only thing | |
1391 | dnl we can do...) | |
1392 | dnl --------------------------------------------------------------------------- | |
1393 | ||
1394 | AC_DEFUN([AC_BAKEFILE], | |
1395 | [ | |
1396 | AC_PREREQ(2.58) | |
1397 | ||
1398 | if test "x$BAKEFILE_HOST" = "x"; then | |
1399 | BAKEFILE_HOST="${host}" | |
1400 | fi | |
1401 | ||
1402 | if test "x$BAKEFILE_CHECK_BASICS" != "xno"; then | |
1403 | AC_BAKEFILE_CHECK_BASIC_STUFF | |
1404 | fi | |
1405 | AC_BAKEFILE_GNUMAKE | |
1406 | AC_BAKEFILE_PLATFORM | |
1407 | AC_BAKEFILE_PLATFORM_SPECIFICS | |
1408 | AC_BAKEFILE_SUFFIXES | |
1409 | AC_BAKEFILE_SHARED_LD | |
1410 | AC_BAKEFILE_SHARED_VERSIONS | |
1411 | AC_BAKEFILE_DEPS | |
1412 | AC_BAKEFILE_RES_COMPILERS | |
1413 | ||
94acd38e | 1414 | BAKEFILE_BAKEFILE_M4_VERSION="0.1.7" |
2e350179 VS |
1415 | |
1416 | dnl includes autoconf_inc.m4: | |
1417 | $1 | |
1418 | ||
1419 | if test "$BAKEFILE_BAKEFILE_M4_VERSION" != "$BAKEFILE_AUTOCONF_INC_M4_VERSION" ; then | |
1420 | AC_MSG_ERROR([Versions of Bakefile used to generate makefiles ($BAKEFILE_AUTOCONF_INC_M4_VERSION) and configure ($BAKEFILE_BAKEFILE_M4_VERSION) do not match.]) | |
1421 | fi | |
1422 | ]) | |
1423 | ||
1424 | ||
1425 | dnl --------------------------------------------------------------------------- | |
1426 | dnl Embedded copies of helper scripts follow: | |
1427 | dnl --------------------------------------------------------------------------- | |
1428 | ||
1429 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_DLLAR_SH], | |
1430 | [ | |
1431 | dnl ===================== dllar.sh begins here ===================== | |
1432 | dnl (Created by merge-scripts.py from dllar.sh | |
1433 | dnl file do not edit here!) | |
1434 | D='$' | |
1435 | cat <<EOF >dllar.sh | |
1436 | #!/bin/sh | |
1437 | # | |
1438 | # dllar - a tool to build both a .dll and an .a file | |
1439 | # from a set of object (.o) files for EMX/OS2. | |
1440 | # | |
1441 | # Written by Andrew Zabolotny, bit@freya.etu.ru | |
1442 | # Ported to Unix like shell by Stefan Neis, Stefan.Neis@t-online.de | |
1443 | # | |
1444 | # This script will accept a set of files on the command line. | |
1445 | # All the public symbols from the .o files will be exported into | |
1446 | # a .DEF file, then linker will be run (through gcc) against them to | |
1447 | # build a shared library consisting of all given .o files. All libraries | |
1448 | # (.a) will be first decompressed into component .o files then act as | |
1449 | # described above. You can optionally give a description (-d "description") | |
1450 | # which will be put into .DLL. To see the list of accepted options (as well | |
1451 | # as command-line format) simply run this program without options. The .DLL | |
1452 | # is built to be imported by name (there is no guarantee that new versions | |
1453 | # of the library you build will have same ordinals for same symbols). | |
1454 | # | |
1455 | # dllar is free software; you can redistribute it and/or modify | |
1456 | # it under the terms of the GNU General Public License as published by | |
1457 | # the Free Software Foundation; either version 2, or (at your option) | |
1458 | # any later version. | |
1459 | # | |
1460 | # dllar is distributed in the hope that it will be useful, | |
1461 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
1462 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
1463 | # GNU General Public License for more details. | |
1464 | # | |
1465 | # You should have received a copy of the GNU General Public License | |
1466 | # along with dllar; see the file COPYING. If not, write to the Free | |
1467 | # Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
1468 | # 02111-1307, USA. | |
1469 | ||
1470 | # To successfuly run this program you will need: | |
1471 | # - Current drive should have LFN support (HPFS, ext2, network, etc) | |
1472 | # (Sometimes dllar generates filenames which won't fit 8.3 scheme) | |
1473 | # - gcc | |
1474 | # (used to build the .dll) | |
1475 | # - emxexp | |
1476 | # (used to create .def file from .o files) | |
1477 | # - emximp | |
1478 | # (used to create .a file from .def file) | |
1479 | # - GNU text utilites (cat, sort, uniq) | |
1480 | # used to process emxexp output | |
1481 | # - GNU file utilities (mv, rm) | |
1482 | # - GNU sed | |
1483 | # - lxlite (optional, see flag below) | |
1484 | # (used for general .dll cleanup) | |
1485 | # | |
1486 | ||
1487 | flag_USE_LXLITE=1; | |
fe0895cf | 1488 | |
2e350179 VS |
1489 | # |
1490 | # helper functions | |
1491 | # basnam, variant of basename, which does _not_ remove the path, _iff_ | |
1492 | # second argument (suffix to remove) is given | |
1493 | basnam(){ | |
1494 | case ${D}# in | |
1495 | 1) | |
1496 | echo ${D}1 | sed 's/.*\\///' | sed 's/.*\\\\//' | |
1497 | ;; | |
1498 | 2) | |
1499 | echo ${D}1 | sed 's/'${D}2'${D}//' | |
1500 | ;; | |
1501 | *) | |
1502 | echo "error in basnam ${D}*" | |
1503 | exit 8 | |
1504 | ;; | |
1505 | esac | |
1506 | } | |
49b0a3aa | 1507 | |
2e350179 VS |
1508 | # Cleanup temporary files and output |
1509 | CleanUp() { | |
1510 | cd ${D}curDir | |
1511 | for i in ${D}inputFiles ; do | |
1512 | case ${D}i in | |
1513 | *!) | |
1514 | rm -rf \`basnam ${D}i !\` | |
3e5c3c83 | 1515 | ;; |
2e350179 | 1516 | *) |
3e5c3c83 VS |
1517 | ;; |
1518 | esac | |
2e350179 | 1519 | done |
49b0a3aa | 1520 | |
2e350179 VS |
1521 | # Kill result in case of failure as there is just to many stupid make/nmake |
1522 | # things out there which doesn't do this. | |
1523 | if @<:@ ${D}# -eq 0 @:>@; then | |
1524 | rm -f ${D}arcFile ${D}arcFile2 ${D}defFile ${D}dllFile | |
fe0895cf | 1525 | fi |
2e350179 | 1526 | } |
fe0895cf | 1527 | |
2e350179 VS |
1528 | # Print usage and exit script with rc=1. |
1529 | PrintHelp() { | |
1530 | echo 'Usage: dllar.sh @<:@-o@<:@utput@:>@ output_file@:>@ @<:@-i@<:@mport@:>@ importlib_name@:>@' | |
1531 | echo ' @<:@-name-mangler-script script.sh@:>@' | |
1532 | echo ' @<:@-d@<:@escription@:>@ "dll descrption"@:>@ @<:@-cc "CC"@:>@ @<:@-f@<:@lags@:>@ "CFLAGS"@:>@' | |
1533 | echo ' @<:@-ord@<:@inals@:>@@:>@ -ex@<:@clude@:>@ "symbol(s)"' | |
1534 | echo ' @<:@-libf@<:@lags@:>@ "{INIT|TERM}{GLOBAL|INSTANCE}"@:>@ @<:@-nocrt@<:@dll@:>@@:>@ @<:@-nolxl@<:@ite@:>@@:>@' | |
1535 | echo ' @<:@*.o@:>@ @<:@*.a@:>@' | |
1536 | echo '*> "output_file" should have no extension.' | |
1537 | echo ' If it has the .o, .a or .dll extension, it is automatically removed.' | |
1538 | echo ' The import library name is derived from this and is set to "name".a,' | |
1539 | echo ' unless overridden by -import' | |
1540 | echo '*> "importlib_name" should have no extension.' | |
1541 | echo ' If it has the .o, or .a extension, it is automatically removed.' | |
1542 | echo ' This name is used as the import library name and may be longer and' | |
1543 | echo ' more descriptive than the DLL name which has to follow the old ' | |
1544 | echo ' 8.3 convention of FAT.' | |
1545 | echo '*> "script.sh may be given to override the output_file name by a' | |
1546 | echo ' different name. It is mainly useful if the regular make process' | |
1547 | echo ' of some package does not take into account OS/2 restriction of' | |
1548 | echo ' DLL name lengths. It takes the importlib name as input and is' | |
1549 | echo ' supposed to procude a shorter name as output. The script should' | |
1550 | echo ' expect to get importlib_name without extension and should produce' | |
1551 | echo ' a (max.) 8 letter name without extension.' | |
1552 | echo '*> "cc" is used to use another GCC executable. (default: gcc.exe)' | |
1553 | echo '*> "flags" should be any set of valid GCC flags. (default: -s -Zcrtdll)' | |
1554 | echo ' These flags will be put at the start of GCC command line.' | |
1555 | echo '*> -ord@<:@inals@:>@ tells dllar to export entries by ordinals. Be careful.' | |
1556 | echo '*> -ex@<:@clude@:>@ defines symbols which will not be exported. You can define' | |
1557 | echo ' multiple symbols, for example -ex "myfunc yourfunc _GLOBAL*".' | |
1558 | echo ' If the last character of a symbol is "*", all symbols beginning' | |
1559 | echo ' with the prefix before "*" will be exclude, (see _GLOBAL* above).' | |
1560 | echo '*> -libf@<:@lags@:>@ can be used to add INITGLOBAL/INITINSTANCE and/or' | |
1561 | echo ' TERMGLOBAL/TERMINSTANCE flags to the dynamically-linked library.' | |
1562 | echo '*> -nocrt@<:@dll@:>@ switch will disable linking the library against emx''s' | |
1563 | echo ' C runtime DLLs.' | |
1564 | echo '*> -nolxl@<:@ite@:>@ switch will disable running lxlite on the resulting DLL.' | |
1565 | echo '*> All other switches (for example -L./ or -lmylib) will be passed' | |
1566 | echo ' unchanged to GCC at the end of command line.' | |
1567 | echo '*> If you create a DLL from a library and you do not specify -o,' | |
1568 | echo ' the basename for DLL and import library will be set to library name,' | |
1569 | echo ' the initial library will be renamed to 'name'_s.a (_s for static)' | |
1570 | echo ' i.e. "dllar gcc.a" will create gcc.dll and gcc.a, and the initial' | |
1571 | echo ' library will be renamed into gcc_s.a.' | |
1572 | echo '--------' | |
1573 | echo 'Example:' | |
1574 | echo ' dllar -o gcc290.dll libgcc.a -d "GNU C runtime library" -ord' | |
1575 | echo ' -ex "__main __ctordtor*" -libf "INITINSTANCE TERMINSTANCE"' | |
1576 | CleanUp | |
1577 | exit 1 | |
1578 | } | |
fe0895cf | 1579 | |
2e350179 VS |
1580 | # Execute a command. |
1581 | # If exit code of the commnad <> 0 CleanUp() is called and we'll exit the script. | |
1582 | # @Uses Whatever CleanUp() uses. | |
1583 | doCommand() { | |
1584 | echo "${D}*" | |
1585 | eval ${D}* | |
1586 | rcCmd=${D}? | |
fe0895cf | 1587 | |
2e350179 VS |
1588 | if @<:@ ${D}rcCmd -ne 0 @:>@; then |
1589 | echo "command failed, exit code="${D}rcCmd | |
1590 | CleanUp | |
1591 | exit ${D}rcCmd | |
1592 | fi | |
1593 | } | |
fe0895cf | 1594 | |
2e350179 VS |
1595 | # main routine |
1596 | # setup globals | |
1597 | cmdLine=${D}* | |
1598 | outFile="" | |
1599 | outimpFile="" | |
1600 | inputFiles="" | |
1601 | renameScript="" | |
1602 | description="" | |
1603 | CC=gcc.exe | |
1604 | CFLAGS="-s -Zcrtdll" | |
1605 | EXTRA_CFLAGS="" | |
1606 | EXPORT_BY_ORDINALS=0 | |
1607 | exclude_symbols="" | |
1608 | library_flags="" | |
1609 | curDir=\`pwd\` | |
1610 | curDirS=curDir | |
1611 | case ${D}curDirS in | |
1612 | */) | |
1613 | ;; | |
1614 | *) | |
1615 | curDirS=${D}{curDirS}"/" | |
1616 | ;; | |
1617 | esac | |
1618 | # Parse commandline | |
1619 | libsToLink=0 | |
1620 | omfLinking=0 | |
1621 | while @<:@ ${D}1 @:>@; do | |
1622 | case ${D}1 in | |
1623 | -ord*) | |
1624 | EXPORT_BY_ORDINALS=1; | |
1625 | ;; | |
1626 | -o*) | |
1627 | shift | |
1628 | outFile=${D}1 | |
1629 | ;; | |
1630 | -i*) | |
1631 | shift | |
1632 | outimpFile=${D}1 | |
1633 | ;; | |
1634 | -name-mangler-script) | |
1635 | shift | |
1636 | renameScript=${D}1 | |
1637 | ;; | |
1638 | -d*) | |
1639 | shift | |
1640 | description=${D}1 | |
1641 | ;; | |
1642 | -f*) | |
1643 | shift | |
1644 | CFLAGS=${D}1 | |
1645 | ;; | |
1646 | -c*) | |
1647 | shift | |
1648 | CC=${D}1 | |
1649 | ;; | |
1650 | -h*) | |
1651 | PrintHelp | |
1652 | ;; | |
1653 | -ex*) | |
1654 | shift | |
1655 | exclude_symbols=${D}{exclude_symbols}${D}1" " | |
1656 | ;; | |
1657 | -libf*) | |
1658 | shift | |
1659 | library_flags=${D}{library_flags}${D}1" " | |
1660 | ;; | |
1661 | -nocrt*) | |
1662 | CFLAGS="-s" | |
1663 | ;; | |
1664 | -nolxl*) | |
1665 | flag_USE_LXLITE=0 | |
1666 | ;; | |
1667 | -* | /*) | |
1668 | case ${D}1 in | |
1669 | -L* | -l*) | |
1670 | libsToLink=1 | |
fe0895cf | 1671 | ;; |
2e350179 VS |
1672 | -Zomf) |
1673 | omfLinking=1 | |
fe0895cf | 1674 | ;; |
2e350179 VS |
1675 | *) |
1676 | ;; | |
1677 | esac | |
1678 | EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1 | |
1679 | ;; | |
1680 | *.dll) | |
1681 | EXTRA_CFLAGS="${D}{EXTRA_CFLAGS} \`basnam ${D}1 .dll\`" | |
1682 | if @<:@ ${D}omfLinking -eq 1 @:>@; then | |
1683 | EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.lib" | |
1684 | else | |
1685 | EXTRA_CFLAGS="${D}{EXTRA_CFLAGS}.a" | |
1686 | fi | |
1687 | ;; | |
1688 | *) | |
1689 | found=0; | |
1690 | if @<:@ ${D}libsToLink -ne 0 @:>@; then | |
1691 | EXTRA_CFLAGS=${D}{EXTRA_CFLAGS}" "${D}1 | |
1692 | else | |
1693 | for file in ${D}1 ; do | |
1694 | if @<:@ -f ${D}file @:>@; then | |
1695 | inputFiles="${D}{inputFiles} ${D}file" | |
1696 | found=1 | |
1697 | fi | |
1698 | done | |
1699 | if @<:@ ${D}found -eq 0 @:>@; then | |
1700 | echo "ERROR: No file(s) found: "${D}1 | |
1701 | exit 8 | |
1702 | fi | |
1703 | fi | |
1704 | ;; | |
fe0895cf | 1705 | esac |
2e350179 VS |
1706 | shift |
1707 | done # iterate cmdline words | |
fe0895cf | 1708 | |
2e350179 VS |
1709 | # |
1710 | if @<:@ -z "${D}inputFiles" @:>@; then | |
1711 | echo "dllar: no input files" | |
1712 | PrintHelp | |
1713 | fi | |
fe0895cf | 1714 | |
2e350179 VS |
1715 | # Now extract all .o files from .a files |
1716 | newInputFiles="" | |
1717 | for file in ${D}inputFiles ; do | |
1718 | case ${D}file in | |
1719 | *.a | *.lib) | |
1720 | case ${D}file in | |
1721 | *.a) | |
1722 | suffix=".a" | |
1723 | AR="ar" | |
1724 | ;; | |
1725 | *.lib) | |
1726 | suffix=".lib" | |
1727 | AR="emxomfar" | |
1728 | EXTRA_CFLAGS="${D}EXTRA_CFLAGS -Zomf" | |
1729 | ;; | |
1730 | *) | |
1731 | ;; | |
1732 | esac | |
1733 | dirname=\`basnam ${D}file ${D}suffix\`"_%" | |
1734 | mkdir ${D}dirname | |
1735 | if @<:@ ${D}? -ne 0 @:>@; then | |
1736 | echo "Failed to create subdirectory ./${D}dirname" | |
1737 | CleanUp | |
1738 | exit 8; | |
1739 | fi | |
1740 | # Append '!' to indicate archive | |
1741 | newInputFiles="${D}newInputFiles ${D}{dirname}!" | |
1742 | doCommand "cd ${D}dirname; ${D}AR x ../${D}file" | |
1743 | cd ${D}curDir | |
1744 | found=0; | |
1745 | for subfile in ${D}dirname/*.o* ; do | |
1746 | if @<:@ -f ${D}subfile @:>@; then | |
1747 | found=1 | |
1748 | if @<:@ -s ${D}subfile @:>@; then | |
1749 | # FIXME: This should be: is file size > 32 byte, _not_ > 0! | |
1750 | newInputFiles="${D}newInputFiles ${D}subfile" | |
1751 | fi | |
fe0895cf | 1752 | fi |
2e350179 VS |
1753 | done |
1754 | if @<:@ ${D}found -eq 0 @:>@; then | |
1755 | echo "WARNING: there are no files in archive \\'${D}file\\'" | |
1756 | fi | |
1757 | ;; | |
1758 | *) | |
1759 | newInputFiles="${D}{newInputFiles} ${D}file" | |
fe0895cf VS |
1760 | ;; |
1761 | esac | |
2e350179 VS |
1762 | done |
1763 | inputFiles="${D}newInputFiles" | |
fe0895cf | 1764 | |
2e350179 VS |
1765 | # Output filename(s). |
1766 | do_backup=0; | |
1767 | if @<:@ -z ${D}outFile @:>@; then | |
1768 | do_backup=1; | |
1769 | set outFile ${D}inputFiles; outFile=${D}2 | |
1770 | fi | |
45842500 | 1771 | |
2e350179 VS |
1772 | # If it is an archive, remove the '!' and the '_%' suffixes |
1773 | case ${D}outFile in | |
1774 | *_%!) | |
1775 | outFile=\`basnam ${D}outFile _%!\` | |
1776 | ;; | |
1777 | *) | |
1778 | ;; | |
1779 | esac | |
1780 | case ${D}outFile in | |
1781 | *.dll) | |
1782 | outFile=\`basnam ${D}outFile .dll\` | |
1783 | ;; | |
1784 | *.DLL) | |
1785 | outFile=\`basnam ${D}outFile .DLL\` | |
1786 | ;; | |
1787 | *.o) | |
1788 | outFile=\`basnam ${D}outFile .o\` | |
1789 | ;; | |
1790 | *.obj) | |
1791 | outFile=\`basnam ${D}outFile .obj\` | |
1792 | ;; | |
1793 | *.a) | |
1794 | outFile=\`basnam ${D}outFile .a\` | |
1795 | ;; | |
1796 | *.lib) | |
1797 | outFile=\`basnam ${D}outFile .lib\` | |
1798 | ;; | |
1799 | *) | |
1800 | ;; | |
1801 | esac | |
1802 | case ${D}outimpFile in | |
1803 | *.a) | |
1804 | outimpFile=\`basnam ${D}outimpFile .a\` | |
1805 | ;; | |
1806 | *.lib) | |
1807 | outimpFile=\`basnam ${D}outimpFile .lib\` | |
1808 | ;; | |
1809 | *) | |
1810 | ;; | |
1811 | esac | |
1812 | if @<:@ -z ${D}outimpFile @:>@; then | |
1813 | outimpFile=${D}outFile | |
1814 | fi | |
1815 | defFile="${D}{outFile}.def" | |
1816 | arcFile="${D}{outimpFile}.a" | |
1817 | arcFile2="${D}{outimpFile}.lib" | |
45842500 | 1818 | |
2e350179 VS |
1819 | #create ${D}dllFile as something matching 8.3 restrictions, |
1820 | if @<:@ -z ${D}renameScript @:>@ ; then | |
1821 | dllFile="${D}outFile" | |
1822 | else | |
1823 | dllFile=\`${D}renameScript ${D}outimpFile\` | |
1824 | fi | |
45842500 | 1825 | |
2e350179 VS |
1826 | if @<:@ ${D}do_backup -ne 0 @:>@ ; then |
1827 | if @<:@ -f ${D}arcFile @:>@ ; then | |
1828 | doCommand "mv ${D}arcFile ${D}{outFile}_s.a" | |
1829 | fi | |
1830 | if @<:@ -f ${D}arcFile2 @:>@ ; then | |
1831 | doCommand "mv ${D}arcFile2 ${D}{outFile}_s.lib" | |
45842500 | 1832 | fi |
2e350179 | 1833 | fi |
45842500 | 1834 | |
2e350179 VS |
1835 | # Extract public symbols from all the object files. |
1836 | tmpdefFile=${D}{defFile}_% | |
1837 | rm -f ${D}tmpdefFile | |
1838 | for file in ${D}inputFiles ; do | |
1839 | case ${D}file in | |
1840 | *!) | |
1841 | ;; | |
1842 | *) | |
1843 | doCommand "emxexp -u ${D}file >> ${D}tmpdefFile" | |
1844 | ;; | |
1845 | esac | |
1846 | done | |
1847 | ||
1848 | # Create the def file. | |
1849 | rm -f ${D}defFile | |
1850 | echo "LIBRARY \`basnam ${D}dllFile\` ${D}library_flags" >> ${D}defFile | |
1851 | dllFile="${D}{dllFile}.dll" | |
1852 | if @<:@ ! -z ${D}description @:>@; then | |
1853 | echo "DESCRIPTION \\"${D}{description}\\"" >> ${D}defFile | |
1854 | fi | |
1855 | echo "EXPORTS" >> ${D}defFile | |
45842500 | 1856 | |
2e350179 VS |
1857 | doCommand "cat ${D}tmpdefFile | sort.exe | uniq.exe > ${D}{tmpdefFile}%" |
1858 | grep -v "^ *;" < ${D}{tmpdefFile}% | grep -v "^ *${D}" >${D}tmpdefFile | |
45842500 | 1859 | |
2e350179 VS |
1860 | # Checks if the export is ok or not. |
1861 | for word in ${D}exclude_symbols; do | |
1862 | grep -v ${D}word < ${D}tmpdefFile >${D}{tmpdefFile}% | |
1863 | mv ${D}{tmpdefFile}% ${D}tmpdefFile | |
1864 | done | |
45842500 | 1865 | |
fe0895cf | 1866 | |
2e350179 VS |
1867 | if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then |
1868 | sed "=" < ${D}tmpdefFile | \\ | |
1869 | sed ' | |
1870 | N | |
1871 | : loop | |
1872 | s/^\\(@<:@0-9@:>@\\+\\)\\(@<:@^;@:>@*\\)\\(;.*\\)\\?/\\2 @\\1 NONAME/ | |
1873 | t loop | |
1874 | ' > ${D}{tmpdefFile}% | |
1875 | grep -v "^ *${D}" < ${D}{tmpdefFile}% > ${D}tmpdefFile | |
1876 | else | |
1877 | rm -f ${D}{tmpdefFile}% | |
1878 | fi | |
1879 | cat ${D}tmpdefFile >> ${D}defFile | |
1880 | rm -f ${D}tmpdefFile | |
6ff53182 | 1881 | |
2e350179 VS |
1882 | # Do linking, create implib, and apply lxlite. |
1883 | gccCmdl=""; | |
1884 | for file in ${D}inputFiles ; do | |
1885 | case ${D}file in | |
1886 | *!) | |
1887 | ;; | |
1888 | *) | |
1889 | gccCmdl="${D}gccCmdl ${D}file" | |
1890 | ;; | |
1891 | esac | |
1892 | done | |
1893 | doCommand "${D}CC ${D}CFLAGS -Zdll -o ${D}dllFile ${D}defFile ${D}gccCmdl ${D}EXTRA_CFLAGS" | |
1894 | touch "${D}{outFile}.dll" | |
f93ca9fd | 1895 | |
2e350179 VS |
1896 | doCommand "emximp -o ${D}arcFile ${D}defFile" |
1897 | if @<:@ ${D}flag_USE_LXLITE -ne 0 @:>@; then | |
1898 | add_flags=""; | |
1899 | if @<:@ ${D}EXPORT_BY_ORDINALS -ne 0 @:>@; then | |
1900 | add_flags="-ynd" | |
fe0895cf | 1901 | fi |
2e350179 VS |
1902 | doCommand "lxlite -cs -t: -mrn -mln ${D}add_flags ${D}dllFile" |
1903 | fi | |
1904 | doCommand "emxomf -s -l ${D}arcFile" | |
fe0895cf | 1905 | |
2e350179 VS |
1906 | # Successful exit. |
1907 | CleanUp 1 | |
1908 | exit 0 | |
1909 | EOF | |
1910 | dnl ===================== dllar.sh ends here ===================== | |
fe0895cf | 1911 | ]) |
3fd9c298 | 1912 | |
2e350179 | 1913 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_DEPS], |
3fd9c298 | 1914 | [ |
2e350179 VS |
1915 | dnl ===================== bk-deps begins here ===================== |
1916 | dnl (Created by merge-scripts.py from bk-deps | |
8f98c6c0 | 1917 | dnl file do not edit here!) |
3fd9c298 | 1918 | D='$' |
2e350179 | 1919 | cat <<EOF >bk-deps |
3fd9c298 | 1920 | #!/bin/sh |
3fd9c298 | 1921 | |
2e350179 VS |
1922 | # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf |
1923 | # script. It is used to track C/C++ files dependencies in portable way. | |
3fd9c298 | 1924 | # |
2e350179 | 1925 | # Permission is given to use this file in any way. |
3fd9c298 | 1926 | |
2e350179 VS |
1927 | DEPSMODE=${DEPSMODE} |
1928 | DEPSDIR=.deps | |
1929 | DEPSFLAG_GCC="${DEPSFLAG_GCC}" | |
1930 | DEPSFLAG_MWCC="${DEPSFLAG_MWCC}" | |
3fd9c298 | 1931 | |
2e350179 | 1932 | mkdir -p ${D}DEPSDIR |
3fd9c298 | 1933 | |
2e350179 VS |
1934 | if test ${D}DEPSMODE = gcc ; then |
1935 | ${D}* ${D}{DEPSFLAG_GCC} | |
1936 | status=${D}? | |
1937 | if test ${D}{status} != 0 ; then | |
1938 | exit ${D}{status} | |
3fd9c298 | 1939 | fi |
2e350179 VS |
1940 | # move created file to the location we want it in: |
1941 | while test ${D}# -gt 0; do | |
1942 | case "${D}1" in | |
1943 | -o ) | |
1944 | shift | |
1945 | objfile=${D}1 | |
1946 | ;; | |
1947 | -* ) | |
1948 | ;; | |
1949 | * ) | |
1950 | srcfile=${D}1 | |
1951 | ;; | |
1952 | esac | |
1953 | shift | |
1954 | done | |
1955 | depfile=\`basename ${D}srcfile | sed -e 's/\\..*${D}/.d/g'\` | |
1956 | depobjname=\`echo ${D}depfile |sed -e 's/\\.d/.o/g'\` | |
1957 | if test -f ${D}depfile ; then | |
1958 | sed -e "s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d | |
1959 | rm -f ${D}depfile | |
1960 | else | |
1961 | depfile=\`basename ${D}objfile | sed -e 's/\\..*${D}/.d/g'\` | |
1962 | if test -f ${D}depfile ; then | |
1963 | sed -e "/^${D}objfile/!s,${D}depobjname:,${D}objfile:,g" ${D}depfile >${D}{DEPSDIR}/${D}{objfile}.d | |
1964 | rm -f ${D}depfile | |
1965 | fi | |
1966 | fi | |
1967 | exit 0 | |
1968 | elif test ${D}DEPSMODE = mwcc ; then | |
1969 | ${D}* | |
1970 | status=${D}? | |
1971 | if test ${D}{status} != 0 ; then | |
1972 | exit ${D}{status} | |
1973 | fi | |
1974 | # Run mwcc again with -MM and redirect into the dep file we want | |
1975 | # NOTE: We can't use shift here because we need ${D}* to be valid | |
1976 | prevarg= | |
1977 | for arg in ${D}* ; do | |
1978 | if test "${D}prevarg" = "-o"; then | |
1979 | objfile=${D}arg | |
1980 | else | |
1981 | case "${D}arg" in | |
1982 | -* ) | |
1983 | ;; | |
1984 | * ) | |
1985 | srcfile=${D}arg | |
1986 | ;; | |
1987 | esac | |
1988 | fi | |
1989 | prevarg="${D}arg" | |
1990 | done | |
1991 | ${D}* ${D}DEPSFLAG_MWCC >${D}{DEPSDIR}/${D}{objfile}.d | |
1992 | exit 0 | |
1993 | else | |
1994 | ${D}* | |
1995 | exit ${D}? | |
1996 | fi | |
1997 | EOF | |
1998 | dnl ===================== bk-deps ends here ===================== | |
1999 | ]) | |
3fd9c298 | 2000 | |
2e350179 VS |
2001 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_SHARED_LD_SH], |
2002 | [ | |
2003 | dnl ===================== shared-ld-sh begins here ===================== | |
2004 | dnl (Created by merge-scripts.py from shared-ld-sh | |
2005 | dnl file do not edit here!) | |
2006 | D='$' | |
2007 | cat <<EOF >shared-ld-sh | |
2008 | #!/bin/sh | |
2009 | #----------------------------------------------------------------------------- | |
2010 | #-- Name: distrib/mac/shared-ld-sh | |
2011 | #-- Purpose: Link a mach-o dynamic shared library for Darwin / Mac OS X | |
2012 | #-- Author: Gilles Depeyrot | |
2013 | #-- Copyright: (c) 2002 Gilles Depeyrot | |
2014 | #-- Licence: any use permitted | |
2015 | #----------------------------------------------------------------------------- | |
3fd9c298 | 2016 | |
2e350179 VS |
2017 | verbose=0 |
2018 | args="" | |
2019 | objects="" | |
2020 | linking_flag="-dynamiclib" | |
3fd9c298 | 2021 | |
2e350179 | 2022 | while test ${D}# -gt 0; do |
3fd9c298 | 2023 | case ${D}1 in |
2e350179 VS |
2024 | |
2025 | -v) | |
2026 | verbose=1 | |
3fd9c298 | 2027 | ;; |
2e350179 VS |
2028 | |
2029 | -o|-compatibility_version|-current_version|-framework|-undefined|-install_name) | |
2030 | # collect these options and values | |
2031 | args="${D}{args} ${D}1 ${D}2" | |
3fd9c298 | 2032 | shift |
3fd9c298 | 2033 | ;; |
2e350179 VS |
2034 | |
2035 | -l*|-L*|-flat_namespace|-headerpad_max_install_names) | |
2036 | # collect these options | |
2037 | args="${D}{args} ${D}1" | |
3fd9c298 | 2038 | ;; |
2e350179 VS |
2039 | |
2040 | -dynamiclib|-bundle) | |
2041 | linking_flag="${D}1" | |
3fd9c298 | 2042 | ;; |
2e350179 VS |
2043 | |
2044 | -*) | |
2045 | echo "shared-ld: unhandled option '${D}1'" | |
2046 | exit 1 | |
3fd9c298 | 2047 | ;; |
2e350179 VS |
2048 | |
2049 | *.o | *.a | *.dylib) | |
2050 | # collect object files | |
2051 | objects="${D}{objects} ${D}1" | |
3fd9c298 | 2052 | ;; |
2e350179 | 2053 | |
3fd9c298 | 2054 | *) |
2e350179 VS |
2055 | echo "shared-ld: unhandled argument '${D}1'" |
2056 | exit 1 | |
b1d22ded | 2057 | ;; |
2e350179 | 2058 | |
3fd9c298 DE |
2059 | esac |
2060 | shift | |
2e350179 VS |
2061 | done |
2062 | ||
2063 | # | |
2064 | # Link one module containing all the others | |
2065 | # | |
2066 | if test ${D}{verbose} = 1; then | |
2067 | echo "c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o" | |
2068 | fi | |
2069 | c++ -r -keep_private_externs -nostdlib ${D}{objects} -o master.${D}${D}.o | |
2070 | status=${D}? | |
2071 | if test ${D}{status} != 0; then | |
2072 | exit ${D}{status} | |
2073 | fi | |
2074 | ||
2075 | # | |
2076 | # Link the shared library from the single module created | |
2077 | # | |
2078 | if test ${D}{verbose} = 1; then | |
2079 | echo "cc ${D}{linking_flag} master.${D}${D}.o ${D}{args}" | |
2080 | fi | |
2081 | c++ ${D}{linking_flag} master.${D}${D}.o ${D}{args} | |
2082 | status=${D}? | |
2083 | if test ${D}{status} != 0; then | |
2084 | exit ${D}{status} | |
2085 | fi | |
2086 | ||
2087 | # | |
2088 | # Remove intermediate module | |
2089 | # | |
2090 | rm -f master.${D}${D}.o | |
2091 | ||
2092 | exit 0 | |
2093 | EOF | |
2094 | dnl ===================== shared-ld-sh ends here ===================== | |
2095 | ]) | |
2096 | ||
2097 | AC_DEFUN([AC_BAKEFILE_CREATE_FILE_BK_MAKE_PCH], | |
2098 | [ | |
2099 | dnl ===================== bk-make-pch begins here ===================== | |
2100 | dnl (Created by merge-scripts.py from bk-make-pch | |
2101 | dnl file do not edit here!) | |
2102 | D='$' | |
2103 | cat <<EOF >bk-make-pch | |
2104 | #!/bin/sh | |
3fd9c298 | 2105 | |
2e350179 VS |
2106 | # This script is part of Bakefile (http://bakefile.sourceforge.net) autoconf |
2107 | # script. It is used to generated precompiled headers. | |
3fd9c298 | 2108 | # |
2e350179 | 2109 | # Permission is given to use this file in any way. |
3fd9c298 | 2110 | |
2e350179 VS |
2111 | outfile="${D}{1}" |
2112 | header="${D}{2}" | |
2113 | shift | |
2114 | shift | |
2115 | ||
2116 | compiler= | |
2117 | headerfile= | |
2118 | while test ${D}{#} -gt 0; do | |
2119 | case "${D}{1}" in | |
2120 | -I* ) | |
2121 | incdir=\`echo ${D}{1} | sed -e 's/-I\\(.*\\)/\\1/g'\` | |
2122 | if test "x${D}{headerfile}" = "x" -a -f "${D}{incdir}/${D}{header}" ; then | |
2123 | headerfile="${D}{incdir}/${D}{header}" | |
3fd9c298 | 2124 | fi |
3fd9c298 DE |
2125 | ;; |
2126 | esac | |
2e350179 VS |
2127 | compiler="${D}{compiler} ${D}{1}" |
2128 | shift | |
3fd9c298 | 2129 | done |
3fd9c298 | 2130 | |
2e350179 VS |
2131 | if test "x${D}{headerfile}" = "x" ; then |
2132 | echo "error: can't find header ${D}{header} in include paths" >2 | |
2133 | else | |
2134 | if test -f ${D}{outfile} ; then | |
2135 | rm -f ${D}{outfile} | |
2136 | else | |
2137 | mkdir -p \`dirname ${D}{outfile}\` | |
2138 | fi | |
2139 | depsfile=".deps/\`echo ${D}{outfile} | tr '/.' '__'\`.d" | |
2140 | mkdir -p .deps | |
2141 | # can do this because gcc is >= 3.4: | |
2142 | ${D}{compiler} -o ${D}{outfile} -MMD -MF "${D}{depsfile}" "${D}{headerfile}" | |
2143 | exit ${D}{?} | |
3fd9c298 | 2144 | fi |
2e350179 VS |
2145 | EOF |
2146 | dnl ===================== bk-make-pch ends here ===================== | |
2147 | ]) | |
3fd9c298 | 2148 | |
2e350179 VS |
2149 | # Configure paths for GTK+ |
2150 | # Owen Taylor 1997-2001 | |
2151 | ||
2152 | dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) | |
2153 | dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, | |
2154 | dnl pass to pkg-config | |
2155 | dnl | |
2156 | AC_DEFUN([AM_PATH_GTK_2_0], | |
2157 | [dnl | |
2158 | dnl Get the cflags and libraries from pkg-config | |
2159 | dnl | |
2160 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], | |
2161 | , enable_gtktest=yes) | |
2162 | ||
2163 | pkg_config_args=gtk+-2.0 | |
2164 | for module in . $4 | |
2165 | do | |
2166 | case "$module" in | |
2167 | gthread) | |
2168 | pkg_config_args="$pkg_config_args gthread-2.0" | |
2169 | ;; | |
2170 | esac | |
2171 | done | |
2172 | ||
2173 | no_gtk="" | |
2174 | ||
2175 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | |
2176 | ||
2177 | if test x$PKG_CONFIG != xno ; then | |
2178 | if pkg-config --atleast-pkgconfig-version 0.7 ; then | |
2179 | : | |
2180 | else | |
2181 | echo "*** pkg-config too old; version 0.7 or better required." | |
2182 | no_gtk=yes | |
2183 | PKG_CONFIG=no | |
2184 | fi | |
2185 | else | |
2186 | no_gtk=yes | |
2187 | fi | |
2188 | ||
2189 | min_gtk_version=ifelse([$1], ,2.0.0,$1) | |
2190 | AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) | |
2191 | ||
2192 | if test x$PKG_CONFIG != xno ; then | |
2193 | ## don't try to run the test against uninstalled libtool libs | |
2194 | if $PKG_CONFIG --uninstalled $pkg_config_args; then | |
2195 | echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" | |
2196 | enable_gtktest=no | |
2197 | fi | |
2198 | ||
2199 | if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then | |
2200 | : | |
2201 | else | |
2202 | no_gtk=yes | |
2203 | fi | |
2204 | fi | |
2205 | ||
2206 | if test x"$no_gtk" = x ; then | |
2207 | GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` | |
2208 | GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` | |
2209 | gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
2210 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
2211 | gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
2212 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
2213 | gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
2214 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
2215 | if test "x$enable_gtktest" = "xyes" ; then | |
2216 | ac_save_CFLAGS="$CFLAGS" | |
2217 | ac_save_LIBS="$LIBS" | |
2218 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
2219 | LIBS="$GTK_LIBS $LIBS" | |
2220 | dnl | |
2221 | dnl Now check if the installed GTK+ is sufficiently new. (Also sanity | |
2222 | dnl checks the results of pkg-config to some extent) | |
2223 | dnl | |
2224 | rm -f conf.gtktest | |
2225 | AC_TRY_RUN([ | |
2226 | #include <gtk/gtk.h> | |
2227 | #include <stdio.h> | |
2228 | #include <stdlib.h> | |
2229 | ||
2230 | int | |
2231 | main () | |
2232 | { | |
2233 | int major, minor, micro; | |
2234 | char *tmp_version; | |
2235 | ||
2236 | system ("touch conf.gtktest"); | |
2237 | ||
2238 | /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
2239 | tmp_version = g_strdup("$min_gtk_version"); | |
2240 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
2241 | printf("%s, bad version string\n", "$min_gtk_version"); | |
2242 | exit(1); | |
2243 | } | |
2244 | ||
2245 | if ((gtk_major_version != $gtk_config_major_version) || | |
2246 | (gtk_minor_version != $gtk_config_minor_version) || | |
2247 | (gtk_micro_version != $gtk_config_micro_version)) | |
2248 | { | |
2249 | printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", | |
2250 | $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, | |
2251 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
2252 | printf ("*** was found! If pkg-config was correct, then it is best\n"); | |
2253 | printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); | |
2254 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | |
2255 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | |
2256 | printf("*** required on your system.\n"); | |
2257 | printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); | |
2258 | printf("*** to point to the correct configuration files\n"); | |
2259 | } | |
2260 | else if ((gtk_major_version != GTK_MAJOR_VERSION) || | |
2261 | (gtk_minor_version != GTK_MINOR_VERSION) || | |
2262 | (gtk_micro_version != GTK_MICRO_VERSION)) | |
2263 | { | |
2264 | printf("*** GTK+ header files (version %d.%d.%d) do not match\n", | |
2265 | GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | |
2266 | printf("*** library (version %d.%d.%d)\n", | |
2267 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
2268 | } | |
2269 | else | |
2270 | { | |
2271 | if ((gtk_major_version > major) || | |
2272 | ((gtk_major_version == major) && (gtk_minor_version > minor)) || | |
2273 | ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) | |
2274 | { | |
2275 | return 0; | |
2276 | } | |
2277 | else | |
2278 | { | |
2279 | printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", | |
2280 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
2281 | printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", | |
2282 | major, minor, micro); | |
2283 | printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); | |
2284 | printf("***\n"); | |
2285 | printf("*** If you have already installed a sufficiently new version, this error\n"); | |
2286 | printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); | |
2287 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); | |
2288 | printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); | |
2289 | printf("*** correct copy of pkg-config. (In this case, you will have to\n"); | |
2290 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | |
2291 | printf("*** so that the correct libraries are found at run-time))\n"); | |
2292 | } | |
2293 | } | |
2294 | return 1; | |
2295 | } | |
2296 | ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
2297 | CFLAGS="$ac_save_CFLAGS" | |
2298 | LIBS="$ac_save_LIBS" | |
2299 | fi | |
2300 | fi | |
2301 | if test "x$no_gtk" = x ; then | |
2302 | AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) | |
2303 | ifelse([$2], , :, [$2]) | |
2304 | else | |
2305 | AC_MSG_RESULT(no) | |
2306 | if test "$PKG_CONFIG" = "no" ; then | |
2307 | echo "*** A new enough version of pkg-config was not found." | |
2308 | echo "*** See http://pkgconfig.sourceforge.net" | |
2309 | else | |
2310 | if test -f conf.gtktest ; then | |
2311 | : | |
2312 | else | |
2313 | echo "*** Could not run GTK+ test program, checking why..." | |
2314 | ac_save_CFLAGS="$CFLAGS" | |
2315 | ac_save_LIBS="$LIBS" | |
2316 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
2317 | LIBS="$LIBS $GTK_LIBS" | |
2318 | AC_TRY_LINK([ | |
2319 | #include <gtk/gtk.h> | |
2320 | #include <stdio.h> | |
2321 | ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], | |
2322 | [ echo "*** The test program compiled, but did not run. This usually means" | |
2323 | echo "*** that the run-time linker is not finding GTK+ or finding the wrong" | |
2324 | echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" | |
2325 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
2326 | echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
2327 | echo "*** is required on your system" | |
2328 | echo "***" | |
2329 | echo "*** If you have an old version installed, it is best to remove it, although" | |
2330 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], | |
2331 | [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
2332 | echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."]) | |
2333 | CFLAGS="$ac_save_CFLAGS" | |
2334 | LIBS="$ac_save_LIBS" | |
2335 | fi | |
2336 | fi | |
2337 | GTK_CFLAGS="" | |
2338 | GTK_LIBS="" | |
2339 | ifelse([$3], , :, [$3]) | |
2340 | fi | |
2341 | AC_SUBST(GTK_CFLAGS) | |
2342 | AC_SUBST(GTK_LIBS) | |
2343 | rm -f conf.gtktest | |
2344 | ]) | |
b1d22ded | 2345 | |
2e350179 VS |
2346 | # Configure paths for GTK+ |
2347 | # Owen Taylor 97-11-3 | |
3fd9c298 | 2348 | |
2e350179 VS |
2349 | dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) |
2350 | dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS | |
2351 | dnl | |
2352 | AC_DEFUN(AM_PATH_GTK, | |
2353 | [dnl | |
2354 | dnl Get the cflags and libraries from the gtk-config script | |
2355 | dnl | |
2356 | AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], | |
2357 | gtk_config_prefix="$withval", gtk_config_prefix="") | |
2358 | AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], | |
2359 | gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") | |
2360 | AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], | |
2361 | , enable_gtktest=yes) | |
3fd9c298 | 2362 | |
2e350179 VS |
2363 | for module in . $4 |
2364 | do | |
2365 | case "$module" in | |
2366 | gthread) | |
2367 | gtk_config_args="$gtk_config_args gthread" | |
2368 | ;; | |
2369 | esac | |
2370 | done | |
3fd9c298 | 2371 | |
2e350179 VS |
2372 | if test x$gtk_config_exec_prefix != x ; then |
2373 | gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" | |
2374 | if test x${GTK_CONFIG+set} != xset ; then | |
2375 | GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config | |
2376 | fi | |
2377 | fi | |
2378 | if test x$gtk_config_prefix != x ; then | |
2379 | gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" | |
2380 | if test x${GTK_CONFIG+set} != xset ; then | |
2381 | GTK_CONFIG=$gtk_config_prefix/bin/gtk-config | |
2382 | fi | |
2383 | fi | |
3fd9c298 | 2384 | |
2e350179 VS |
2385 | AC_PATH_PROG(GTK_CONFIG, gtk-config, no) |
2386 | min_gtk_version=ifelse([$1], ,0.99.7,$1) | |
2387 | AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) | |
2388 | no_gtk="" | |
2389 | if test "$GTK_CONFIG" = "no" ; then | |
2390 | no_gtk=yes | |
2391 | else | |
2392 | GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` | |
2393 | GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` | |
2394 | gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
2395 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
2396 | gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
2397 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
2398 | gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
2399 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
2400 | if test "x$enable_gtktest" = "xyes" ; then | |
2401 | ac_save_CFLAGS="$CFLAGS" | |
2402 | ac_save_LIBS="$LIBS" | |
2403 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
2404 | LIBS="$GTK_LIBS $LIBS" | |
2405 | dnl | |
2406 | dnl Now check if the installed GTK is sufficiently new. (Also sanity | |
2407 | dnl checks the results of gtk-config to some extent | |
2408 | dnl | |
2409 | rm -f conf.gtktest | |
2410 | AC_TRY_RUN([ | |
2411 | #include <gtk/gtk.h> | |
2412 | #include <stdio.h> | |
2413 | #include <stdlib.h> | |
3fd9c298 | 2414 | |
2e350179 VS |
2415 | int |
2416 | main () | |
2417 | { | |
2418 | int major, minor, micro; | |
2419 | char *tmp_version; | |
3fd9c298 | 2420 | |
2e350179 | 2421 | system ("touch conf.gtktest"); |
3fd9c298 | 2422 | |
2e350179 VS |
2423 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
2424 | tmp_version = g_strdup("$min_gtk_version"); | |
2425 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
2426 | printf("%s, bad version string\n", "$min_gtk_version"); | |
2427 | exit(1); | |
2428 | } | |
3fd9c298 | 2429 | |
2e350179 VS |
2430 | if ((gtk_major_version != $gtk_config_major_version) || |
2431 | (gtk_minor_version != $gtk_config_minor_version) || | |
2432 | (gtk_micro_version != $gtk_config_micro_version)) | |
2433 | { | |
2434 | printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", | |
2435 | $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, | |
2436 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
2437 | printf ("*** was found! If gtk-config was correct, then it is best\n"); | |
2438 | printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); | |
2439 | printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | |
2440 | printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | |
2441 | printf("*** required on your system.\n"); | |
2442 | printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); | |
2443 | printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); | |
2444 | printf("*** before re-running configure\n"); | |
2445 | } | |
2446 | #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) | |
2447 | else if ((gtk_major_version != GTK_MAJOR_VERSION) || | |
2448 | (gtk_minor_version != GTK_MINOR_VERSION) || | |
2449 | (gtk_micro_version != GTK_MICRO_VERSION)) | |
2450 | { | |
2451 | printf("*** GTK+ header files (version %d.%d.%d) do not match\n", | |
2452 | GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | |
2453 | printf("*** library (version %d.%d.%d)\n", | |
2454 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
2455 | } | |
2456 | #endif /* defined (GTK_MAJOR_VERSION) ... */ | |
2457 | else | |
2458 | { | |
2459 | if ((gtk_major_version > major) || | |
2460 | ((gtk_major_version == major) && (gtk_minor_version > minor)) || | |
2461 | ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) | |
2462 | { | |
2463 | return 0; | |
2464 | } | |
2465 | else | |
2466 | { | |
2467 | printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", | |
2468 | gtk_major_version, gtk_minor_version, gtk_micro_version); | |
2469 | printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", | |
2470 | major, minor, micro); | |
2471 | printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); | |
2472 | printf("***\n"); | |
2473 | printf("*** If you have already installed a sufficiently new version, this error\n"); | |
2474 | printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); | |
2475 | printf("*** being found. The easiest way to fix this is to remove the old version\n"); | |
2476 | printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); | |
2477 | printf("*** correct copy of gtk-config. (In this case, you will have to\n"); | |
2478 | printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | |
2479 | printf("*** so that the correct libraries are found at run-time))\n"); | |
2480 | } | |
2481 | } | |
2482 | return 1; | |
2483 | } | |
2484 | ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
2485 | CFLAGS="$ac_save_CFLAGS" | |
2486 | LIBS="$ac_save_LIBS" | |
2487 | fi | |
2488 | fi | |
2489 | if test "x$no_gtk" = x ; then | |
2490 | AC_MSG_RESULT(yes) | |
2491 | ifelse([$2], , :, [$2]) | |
2492 | else | |
2493 | AC_MSG_RESULT(no) | |
2494 | if test "$GTK_CONFIG" = "no" ; then | |
2495 | echo "*** The gtk-config script installed by GTK could not be found" | |
2496 | echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" | |
2497 | echo "*** your path, or set the GTK_CONFIG environment variable to the" | |
2498 | echo "*** full path to gtk-config." | |
2499 | else | |
2500 | if test -f conf.gtktest ; then | |
2501 | : | |
2502 | else | |
2503 | echo "*** Could not run GTK test program, checking why..." | |
2504 | CFLAGS="$CFLAGS $GTK_CFLAGS" | |
2505 | LIBS="$LIBS $GTK_LIBS" | |
2506 | AC_TRY_LINK([ | |
2507 | #include <gtk/gtk.h> | |
2508 | #include <stdio.h> | |
2509 | ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], | |
2510 | [ echo "*** The test program compiled, but did not run. This usually means" | |
2511 | echo "*** that the run-time linker is not finding GTK or finding the wrong" | |
2512 | echo "*** version of GTK. If it is not finding GTK, you'll need to set your" | |
2513 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
2514 | echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
2515 | echo "*** is required on your system" | |
2516 | echo "***" | |
2517 | echo "*** If you have an old version installed, it is best to remove it, although" | |
2518 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" | |
2519 | echo "***" | |
2520 | echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that" | |
2521 | echo "*** came with the system with the command" | |
2522 | echo "***" | |
2523 | echo "*** rpm --erase --nodeps gtk gtk-devel" ], | |
2524 | [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
2525 | echo "*** exact error that occured. This usually means GTK was incorrectly installed" | |
2526 | echo "*** or that you have moved GTK since it was installed. In the latter case, you" | |
2527 | echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) | |
2528 | CFLAGS="$ac_save_CFLAGS" | |
2529 | LIBS="$ac_save_LIBS" | |
2530 | fi | |
2531 | fi | |
2532 | GTK_CFLAGS="" | |
2533 | GTK_LIBS="" | |
2534 | ifelse([$3], , :, [$3]) | |
2535 | fi | |
2536 | AC_SUBST(GTK_CFLAGS) | |
2537 | AC_SUBST(GTK_LIBS) | |
2538 | rm -f conf.gtktest | |
2539 | ]) | |
3fd9c298 | 2540 | |
3fd9c298 | 2541 | |
2e350179 VS |
2542 | dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) |
2543 | dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page | |
2544 | dnl also defines GSTUFF_PKG_ERRORS on error | |
2545 | AC_DEFUN(PKG_CHECK_MODULES, [ | |
2546 | succeeded=no | |
3fd9c298 | 2547 | |
2e350179 VS |
2548 | if test -z "$PKG_CONFIG"; then |
2549 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | |
2550 | fi | |
3fd9c298 | 2551 | |
2e350179 VS |
2552 | if test "$PKG_CONFIG" = "no" ; then |
2553 | echo "*** The pkg-config script could not be found. Make sure it is" | |
2554 | echo "*** in your path, or set the PKG_CONFIG environment variable" | |
2555 | echo "*** to the full path to pkg-config." | |
2556 | echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." | |
2557 | else | |
2558 | PKG_CONFIG_MIN_VERSION=0.9.0 | |
2559 | if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then | |
2560 | AC_MSG_CHECKING(for $2) | |
3fd9c298 | 2561 | |
2e350179 VS |
2562 | if $PKG_CONFIG --exists "$2" ; then |
2563 | AC_MSG_RESULT(yes) | |
2564 | succeeded=yes | |
3fd9c298 | 2565 | |
2e350179 VS |
2566 | AC_MSG_CHECKING($1_CFLAGS) |
2567 | $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` | |
2568 | AC_MSG_RESULT($$1_CFLAGS) | |
3fd9c298 | 2569 | |
2e350179 VS |
2570 | AC_MSG_CHECKING($1_LIBS) |
2571 | $1_LIBS=`$PKG_CONFIG --libs "$2"` | |
2572 | AC_MSG_RESULT($$1_LIBS) | |
8f98c6c0 | 2573 | else |
2e350179 VS |
2574 | $1_CFLAGS="" |
2575 | $1_LIBS="" | |
2576 | ## If we have a custom action on failure, don't print errors, but | |
2577 | ## do set a variable so people can do so. | |
2578 | $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` | |
2579 | ifelse([$4], ,echo $$1_PKG_ERRORS,) | |
8f98c6c0 | 2580 | fi |
3fd9c298 | 2581 | |
2e350179 VS |
2582 | AC_SUBST($1_CFLAGS) |
2583 | AC_SUBST($1_LIBS) | |
2584 | else | |
2585 | echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." | |
2586 | echo "*** See http://www.freedesktop.org/software/pkgconfig" | |
2587 | fi | |
2588 | fi | |
3fd9c298 | 2589 | |
2e350179 VS |
2590 | if test $succeeded = yes; then |
2591 | ifelse([$3], , :, [$3]) | |
2592 | else | |
2593 | ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) | |
2594 | fi | |
2595 | ]) | |
3fd9c298 | 2596 | |
3fd9c298 | 2597 | |
3fd9c298 | 2598 | |
2e350179 VS |
2599 | # Configure paths for SDL |
2600 | # Sam Lantinga 9/21/99 | |
2601 | # stolen from Manish Singh | |
2602 | # stolen back from Frank Belew | |
2603 | # stolen from Manish Singh | |
2604 | # Shamelessly stolen from Owen Taylor | |
3fd9c298 | 2605 | |
2e350179 VS |
2606 | dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) |
2607 | dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS | |
2608 | dnl | |
2609 | AC_DEFUN([AM_PATH_SDL], | |
2610 | [dnl | |
2611 | dnl Get the cflags and libraries from the sdl-config script | |
2612 | dnl | |
2613 | AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], | |
2614 | sdl_prefix="$withval", sdl_prefix="") | |
2615 | AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], | |
2616 | sdl_exec_prefix="$withval", sdl_exec_prefix="") | |
2617 | AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], | |
2618 | , enable_sdltest=yes) | |
3fd9c298 | 2619 | |
2e350179 VS |
2620 | if test x$sdl_exec_prefix != x ; then |
2621 | sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" | |
2622 | if test x${SDL_CONFIG+set} != xset ; then | |
2623 | SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config | |
2624 | fi | |
2625 | fi | |
2626 | if test x$sdl_prefix != x ; then | |
2627 | sdl_args="$sdl_args --prefix=$sdl_prefix" | |
2628 | if test x${SDL_CONFIG+set} != xset ; then | |
2629 | SDL_CONFIG=$sdl_prefix/bin/sdl-config | |
2630 | fi | |
2631 | fi | |
3fd9c298 | 2632 | |
2e350179 VS |
2633 | AC_REQUIRE([AC_CANONICAL_TARGET]) |
2634 | PATH="$prefix/bin:$prefix/usr/bin:$PATH" | |
2635 | AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) | |
2636 | min_sdl_version=ifelse([$1], ,0.11.0,$1) | |
2637 | AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) | |
2638 | no_sdl="" | |
2639 | if test "$SDL_CONFIG" = "no" ; then | |
2640 | no_sdl=yes | |
2641 | else | |
2642 | SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` | |
2643 | SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` | |
3fd9c298 | 2644 | |
2e350179 VS |
2645 | sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ |
2646 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
2647 | sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ | |
2648 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
2649 | sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ | |
2650 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
2651 | if test "x$enable_sdltest" = "xyes" ; then | |
2652 | ac_save_CFLAGS="$CFLAGS" | |
94acd38e | 2653 | ac_save_CXXFLAGS="$CXXFLAGS" |
2e350179 VS |
2654 | ac_save_LIBS="$LIBS" |
2655 | CFLAGS="$CFLAGS $SDL_CFLAGS" | |
94acd38e | 2656 | CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" |
2e350179 VS |
2657 | LIBS="$LIBS $SDL_LIBS" |
2658 | dnl | |
2659 | dnl Now check if the installed SDL is sufficiently new. (Also sanity | |
2660 | dnl checks the results of sdl-config to some extent | |
2661 | dnl | |
2662 | rm -f conf.sdltest | |
2663 | AC_TRY_RUN([ | |
2664 | #include <stdio.h> | |
2665 | #include <stdlib.h> | |
2666 | #include <string.h> | |
2667 | #include "SDL.h" | |
3fd9c298 | 2668 | |
2e350179 VS |
2669 | char* |
2670 | my_strdup (char *str) | |
2671 | { | |
2672 | char *new_str; | |
2673 | ||
2674 | if (str) | |
2675 | { | |
2676 | new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); | |
2677 | strcpy (new_str, str); | |
2678 | } | |
2679 | else | |
2680 | new_str = NULL; | |
2681 | ||
2682 | return new_str; | |
2683 | } | |
3fd9c298 | 2684 | |
2e350179 VS |
2685 | int main (int argc, char *argv[]) |
2686 | { | |
2687 | int major, minor, micro; | |
2688 | char *tmp_version; | |
3fd9c298 | 2689 | |
2e350179 VS |
2690 | /* This hangs on some systems (?) |
2691 | system ("touch conf.sdltest"); | |
2692 | */ | |
2693 | { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } | |
3fd9c298 | 2694 | |
2e350179 VS |
2695 | /* HP/UX 9 (%@#!) writes to sscanf strings */ |
2696 | tmp_version = my_strdup("$min_sdl_version"); | |
2697 | if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
2698 | printf("%s, bad version string\n", "$min_sdl_version"); | |
2699 | exit(1); | |
2700 | } | |
3fd9c298 | 2701 | |
2e350179 VS |
2702 | if (($sdl_major_version > major) || |
2703 | (($sdl_major_version == major) && ($sdl_minor_version > minor)) || | |
2704 | (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) | |
2705 | { | |
2706 | return 0; | |
2707 | } | |
2708 | else | |
2709 | { | |
2710 | printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); | |
2711 | printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); | |
2712 | printf("*** best to upgrade to the required version.\n"); | |
2713 | printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); | |
2714 | printf("*** to point to the correct copy of sdl-config, and remove the file\n"); | |
2715 | printf("*** config.cache before re-running configure\n"); | |
2716 | return 1; | |
2717 | } | |
2718 | } | |
fe0895cf | 2719 | |
2e350179 VS |
2720 | ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
2721 | CFLAGS="$ac_save_CFLAGS" | |
94acd38e | 2722 | CXXFLAGS="$ac_save_CXXFLAGS" |
2e350179 VS |
2723 | LIBS="$ac_save_LIBS" |
2724 | fi | |
2725 | fi | |
2726 | if test "x$no_sdl" = x ; then | |
2727 | AC_MSG_RESULT(yes) | |
2728 | ifelse([$2], , :, [$2]) | |
2729 | else | |
2730 | AC_MSG_RESULT(no) | |
2731 | if test "$SDL_CONFIG" = "no" ; then | |
2732 | echo "*** The sdl-config script installed by SDL could not be found" | |
2733 | echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" | |
2734 | echo "*** your path, or set the SDL_CONFIG environment variable to the" | |
2735 | echo "*** full path to sdl-config." | |
2736 | else | |
2737 | if test -f conf.sdltest ; then | |
2738 | : | |
2739 | else | |
2740 | echo "*** Could not run SDL test program, checking why..." | |
2741 | CFLAGS="$CFLAGS $SDL_CFLAGS" | |
94acd38e | 2742 | CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" |
2e350179 VS |
2743 | LIBS="$LIBS $SDL_LIBS" |
2744 | AC_TRY_LINK([ | |
2745 | #include <stdio.h> | |
2746 | #include "SDL.h" | |
6ff53182 | 2747 | |
2e350179 VS |
2748 | int main(int argc, char *argv[]) |
2749 | { return 0; } | |
2750 | #undef main | |
2751 | #define main K_and_R_C_main | |
2752 | ], [ return 0; ], | |
2753 | [ echo "*** The test program compiled, but did not run. This usually means" | |
2754 | echo "*** that the run-time linker is not finding SDL or finding the wrong" | |
2755 | echo "*** version of SDL. If it is not finding SDL, you'll need to set your" | |
2756 | echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
2757 | echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
2758 | echo "*** is required on your system" | |
2759 | echo "***" | |
2760 | echo "*** If you have an old version installed, it is best to remove it, although" | |
2761 | echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], | |
2762 | [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
2763 | echo "*** exact error that occured. This usually means SDL was incorrectly installed" | |
2764 | echo "*** or that you have moved SDL since it was installed. In the latter case, you" | |
2765 | echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) | |
2766 | CFLAGS="$ac_save_CFLAGS" | |
94acd38e | 2767 | CXXFLAGS="$ac_save_CXXFLAGS" |
2e350179 VS |
2768 | LIBS="$ac_save_LIBS" |
2769 | fi | |
2770 | fi | |
2771 | SDL_CFLAGS="" | |
2772 | SDL_LIBS="" | |
2773 | ifelse([$3], , :, [$3]) | |
2774 | fi | |
2775 | AC_SUBST(SDL_CFLAGS) | |
2776 | AC_SUBST(SDL_LIBS) | |
2777 | rm -f conf.sdltest | |
2778 | ]) | |
6ff53182 | 2779 | |
2e350179 VS |
2780 | dnl Perform a check for a GStreamer element using gst-inspect |
2781 | dnl Thomas Vander Stichele <thomas at apestaart dot org> | |
94acd38e | 2782 | dnl Last modification: 25/01/2005 |
6ff53182 | 2783 | |
2e350179 | 2784 | dnl AM_GST_ELEMENT_CHECK(ELEMENT-NAME, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) |
6ff53182 | 2785 | |
2e350179 VS |
2786 | AC_DEFUN([AM_GST_ELEMENT_CHECK], |
2787 | [ | |
94acd38e DE |
2788 | if test "x$GST_INSPECT" == "x"; then |
2789 | AC_CHECK_PROG(GST_INSPECT, gst-inspect, gst-inspect, []) | |
2790 | fi | |
2791 | ||
2e350179 VS |
2792 | if test "x$GST_INSPECT" != "x"; then |
2793 | AC_MSG_CHECKING(GStreamer element $1) | |
2794 | if [ $GST_INSPECT $1 > /dev/null 2> /dev/null ]; then | |
2795 | AC_MSG_RESULT(found.) | |
2796 | $2 | |
6ff53182 | 2797 | else |
2e350179 VS |
2798 | AC_MSG_RESULT(not found.) |
2799 | $3 | |
6ff53182 | 2800 | fi |
2e350179 | 2801 | fi |
6ff53182 | 2802 | ]) |
2e350179 | 2803 | |
670ec357 | 2804 | dnl |
af8ebe8a | 2805 | dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) |
670ec357 VS |
2806 | dnl |
2807 | AC_DEFUN(AM_PATH_CPPUNIT, | |
2808 | [ | |
2809 | ||
2810 | AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)], | |
2811 | cppunit_config_prefix="$withval", cppunit_config_prefix="") | |
2812 | AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)], | |
2813 | cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="") | |
2814 | ||
2815 | if test x$cppunit_config_exec_prefix != x ; then | |
2816 | cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix" | |
2817 | if test x${CPPUNIT_CONFIG+set} != xset ; then | |
2818 | CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config | |
2819 | fi | |
2820 | fi | |
2821 | if test x$cppunit_config_prefix != x ; then | |
2822 | cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix" | |
2823 | if test x${CPPUNIT_CONFIG+set} != xset ; then | |
2824 | CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config | |
2825 | fi | |
2826 | fi | |
2827 | ||
2828 | AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no) | |
2829 | cppunit_version_min=$1 | |
2830 | ||
2831 | AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min) | |
2832 | no_cppunit="" | |
2833 | if test "$CPPUNIT_CONFIG" = "no" ; then | |
2834 | no_cppunit=yes | |
2835 | else | |
2836 | CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags` | |
2837 | CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs` | |
2838 | cppunit_version=`$CPPUNIT_CONFIG --version` | |
2839 | ||
2840 | cppunit_major_version=`echo $cppunit_version | \ | |
2841 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
2842 | cppunit_minor_version=`echo $cppunit_version | \ | |
2843 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
2844 | cppunit_micro_version=`echo $cppunit_version | \ | |
2845 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
2846 | ||
2847 | cppunit_major_min=`echo $cppunit_version_min | \ | |
2848 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
2849 | cppunit_minor_min=`echo $cppunit_version_min | \ | |
2850 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
2851 | cppunit_micro_min=`echo $cppunit_version_min | \ | |
2852 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
2853 | ||
2854 | cppunit_version_proper=`expr \ | |
2855 | $cppunit_major_version \> $cppunit_major_min \| \ | |
2856 | $cppunit_major_version \= $cppunit_major_min \& \ | |
2857 | $cppunit_minor_version \> $cppunit_minor_min \| \ | |
2858 | $cppunit_major_version \= $cppunit_major_min \& \ | |
2859 | $cppunit_minor_version \= $cppunit_minor_min \& \ | |
2860 | $cppunit_micro_version \>= $cppunit_micro_min ` | |
2861 | ||
2862 | if test "$cppunit_version_proper" = "1" ; then | |
2863 | AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version]) | |
2864 | else | |
2865 | AC_MSG_RESULT(no) | |
2866 | no_cppunit=yes | |
2867 | fi | |
2868 | fi | |
2869 | ||
2870 | if test "x$no_cppunit" = x ; then | |
2871 | ifelse([$2], , :, [$2]) | |
2872 | else | |
2873 | CPPUNIT_CFLAGS="" | |
2874 | CPPUNIT_LIBS="" | |
2875 | ifelse([$3], , :, [$3]) | |
2876 | fi | |
2877 | ||
2878 | AC_SUBST(CPPUNIT_CFLAGS) | |
2879 | AC_SUBST(CPPUNIT_LIBS) | |
2880 | ]) | |
2881 | ||
2882 | ||
2883 | ||
2884 |