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