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