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