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