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