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