check default library directories in WX_PATH_FIND_LIBRARIES; do *not* add default...
[wxWidgets.git] / acinclude.m4
1 dnl ---------------------------------------------------------------------------
2 dnl
3 dnl Macros for configure.in for wxWindows by Robert Roebling, Phil Blecker,
4 dnl Vadim Zeitlin and Ron Lee
5 dnl
6 dnl This script is under the wxWindows licence.
7 dnl
8 dnl Version: $Id$
9 dnl ---------------------------------------------------------------------------
10
11
12 dnl ===========================================================================
13 dnl Objective-C(++) related macros
14 dnl ===========================================================================
15 m4_define([AC_WX_LANG_OBJECTIVEC],
16 [AC_LANG(C)
17 ac_ext=m
18 ])
19
20 m4_define([AC_WX_LANG_OBJECTIVECPLUSPLUS],
21 [AC_LANG(C++)
22 ac_ext=mm
23 ])
24
25 dnl ===========================================================================
26 dnl macros to find the a file in the list of include/lib paths
27 dnl ===========================================================================
28
29 dnl ---------------------------------------------------------------------------
30 dnl call WX_PATH_FIND_INCLUDES(search path, header name), sets ac_find_includes
31 dnl to the full name of the file that was found or leaves it empty if not found
32 dnl ---------------------------------------------------------------------------
33 AC_DEFUN([WX_PATH_FIND_INCLUDES],
34 [
35 ac_find_includes=
36 for ac_dir in $1 /usr/include;
37   do
38     if test -f "$ac_dir/$2"; then
39       ac_find_includes=$ac_dir
40       break
41     fi
42   done
43 ])
44
45 dnl ---------------------------------------------------------------------------
46 dnl WX_PATH_FIND_LIBRARIES helper
47 dnl ---------------------------------------------------------------------------
48 AC_DEFUN([WX_PATH_FIND_LIBRARIES_IN_PATH],
49 [
50   ac_find_libraries=
51   for ac_dir in $1;
52   do
53     for ac_extension in a so sl dylib dll.a; do
54       if test -f "$ac_dir/lib$2.$ac_extension"; then
55         ac_find_libraries=$ac_dir
56         break 2
57       fi
58     done
59   done
60 ])
61
62 dnl ---------------------------------------------------------------------------
63 dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries
64 dnl to the full name of the file that was found or leaves it empty if not found
65 dnl ---------------------------------------------------------------------------
66 AC_DEFUN([WX_PATH_FIND_LIBRARIES],
67 [
68   dnl check in default locations first:
69   dnl   - /usr/lib: standard
70   dnl   - /usr/lib32: n32 ABI on IRIX
71   dnl   - /usr/lib64: n64 ABI on IRIX
72   dnl   - /usr/lib/64: 64 bit ABI on Solaris and Linux x86-64
73   WX_PATH_FIND_LIBRARIES_IN_PATH([/usr/lib /usr/lib32 /usr/lib/64 /usr/lib64], $2)
74   if test "$ac_find_libraries" != "" ; then
75     ac_find_libraries="default location"
76   else
77     WX_PATH_FIND_LIBRARIES_IN_PATH($1, $2)
78   fi
79 ])
80
81 dnl ---------------------------------------------------------------------------
82 dnl Path to include, already defined
83 dnl ---------------------------------------------------------------------------
84 AC_DEFUN([WX_INCLUDE_PATH_EXIST],
85 [
86   dnl never add -I/usr/include to the CPPFLAGS
87   if test "x$1" = "x/usr/include"; then
88     ac_path_to_include=""
89   else
90     echo "$2" | grep "\-I$1" > /dev/null
91     result=$?
92     if test $result = 0; then
93       ac_path_to_include=""
94     else
95       ac_path_to_include=" -I$1"
96     fi
97   fi
98 ])
99
100 dnl ---------------------------------------------------------------------------
101 dnl Usage: WX_LINK_PATH_EXIST(path, libpath)
102 dnl
103 dnl Set ac_path_to_link to nothing if path is already in libpath of to -Lpath
104 dnl if it is not, so that libpath can be set to "$libpath$ac_path_to_link"
105 dnl after calling this function
106 dnl ---------------------------------------------------------------------------
107 AC_DEFUN([WX_LINK_PATH_EXIST],
108 [
109   dnl never add -L/usr/libXXX explicitely to libpath
110   if test "$1" = "default location"; then
111     ac_path_to_link=""
112   else
113     echo "$2" | grep "\-L$1" > /dev/null
114     result=$?
115     if test $result = 0; then
116       ac_path_to_link=""
117     else
118       ac_path_to_link=" -L$1"
119     fi
120   fi
121 ])
122
123 dnl ===========================================================================
124 dnl C++ features test
125 dnl ===========================================================================
126
127 dnl ---------------------------------------------------------------------------
128 dnl WX_CPP_NEW_HEADERS checks whether the compiler has "new" <iostream> header
129 dnl or only the old <iostream.h> one - it may be generally assumed that if
130 dnl <iostream> exists, the other "new" headers (without .h) exist too.
131 dnl
132 dnl call WX_CPP_NEW_HEADERS(actiof-if-true, action-if-false)
133 dnl ---------------------------------------------------------------------------
134
135 AC_DEFUN([WX_CPP_NEW_HEADERS],
136 [
137     AC_LANG_SAVE
138     AC_LANG_CPLUSPLUS
139
140     AC_CHECK_HEADERS(iostream)
141
142     if test "$ac_cv_header_iostream" = "yes" ; then
143       ifelse([$1], , :, [$1])
144     else
145       ifelse([$2], , :, [$2])
146     fi
147
148     AC_LANG_RESTORE
149 ])
150
151 dnl ---------------------------------------------------------------------------
152 dnl WX_CPP_BOOL checks whether the C++ compiler has a built in bool type
153 dnl
154 dnl call WX_CPP_BOOL - will define HAVE_BOOL if the compiler supports bool
155 dnl ---------------------------------------------------------------------------
156
157 AC_DEFUN([WX_CPP_BOOL],
158 [
159   AC_CACHE_CHECK([if C++ compiler supports bool], wx_cv_cpp_bool,
160   [
161     AC_LANG_SAVE
162     AC_LANG_CPLUSPLUS
163
164     AC_TRY_COMPILE(
165       [
166       ],
167       [
168         bool b = true;
169
170         return 0;
171       ],
172       [
173         wx_cv_cpp_bool=yes
174       ],
175       [
176         wx_cv_cpp_bool=no
177       ]
178     )
179
180     AC_LANG_RESTORE
181   ])
182
183   if test "$wx_cv_cpp_bool" = "yes"; then
184     AC_DEFINE(HAVE_BOOL)
185   fi
186 ])
187
188 dnl ---------------------------------------------------------------------------
189 dnl WX_CPP_EXPLICIT checks whether the C++ compiler support the explicit
190 dnl keyword and defines HAVE_EXPLICIT if this is the case
191 dnl ---------------------------------------------------------------------------
192
193 AC_DEFUN([WX_CPP_EXPLICIT],
194 [
195   AC_CACHE_CHECK([if C++ compiler supports the explicit keyword],
196                  wx_cv_explicit,
197   [
198     AC_LANG_SAVE
199     AC_LANG_CPLUSPLUS
200
201     dnl do the test in 2 steps: first check that the compiler knows about the
202     dnl explicit keyword at all and then verify that it really honours it
203     AC_TRY_COMPILE(
204       [
205         class Foo { public: explicit Foo(int) {} };
206       ],
207       [
208         return 0;
209       ],
210       [
211         AC_TRY_COMPILE(
212             [
213                 class Foo { public: explicit Foo(int) {} };
214                 static void TakeFoo(const Foo& foo) { }
215             ],
216             [
217                 TakeFoo(17);
218                 return 0;
219             ],
220             wx_cv_explicit=no,
221             wx_cv_explicit=yes
222         )
223       ],
224       wx_cv_explicit=no
225     )
226
227     AC_LANG_RESTORE
228   ])
229
230   if test "$wx_cv_explicit" = "yes"; then
231     AC_DEFINE(HAVE_EXPLICIT)
232   fi
233 ])
234
235 dnl ---------------------------------------------------------------------------
236 dnl a slightly better AC_C_BIGENDIAN macro which allows cross-compiling
237 dnl ---------------------------------------------------------------------------
238
239 AC_DEFUN([WX_C_BIGENDIAN],
240 [AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian,
241 [ac_cv_c_bigendian=unknown
242 # See if sys/param.h defines the BYTE_ORDER macro.
243 AC_TRY_COMPILE([#include <sys/types.h>
244 #include <sys/param.h>], [
245 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
246  bogus endian macros
247 #endif], [# It does; now see whether it defined to BIG_ENDIAN or not.
248 AC_TRY_COMPILE([#include <sys/types.h>
249 #include <sys/param.h>], [
250 #if BYTE_ORDER != BIG_ENDIAN
251  not big endian
252 #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)])
253 if test $ac_cv_c_bigendian = unknown; then
254 AC_TRY_RUN([main () {
255   /* Are we little or big endian?  From Harbison&Steele.  */
256   union
257   {
258     long l;
259     char c[sizeof (long)];
260   } u;
261   u.l = 1;
262   exit (u.c[sizeof (long) - 1] == 1);
263 }], [ac_cv_c_bigendian=no], [ac_cv_c_bigendian=yes], [ac_cv_c_bigendian=unknown])
264 fi])
265 if test $ac_cv_c_bigendian = unknown; then
266   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])
267 fi
268 if test $ac_cv_c_bigendian = yes; then
269   AC_DEFINE(WORDS_BIGENDIAN)
270 fi
271 ])
272
273 dnl ---------------------------------------------------------------------------
274 dnl override AC_ARG_ENABLE/WITH to cache the results in .cache file
275 dnl ---------------------------------------------------------------------------
276
277 AC_DEFUN([WX_ARG_CACHE_INIT],
278         [
279           wx_arg_cache_file="configarg.cache"
280           echo "loading argument cache $wx_arg_cache_file"
281           rm -f ${wx_arg_cache_file}.tmp
282           touch ${wx_arg_cache_file}.tmp
283           touch ${wx_arg_cache_file}
284         ])
285
286 AC_DEFUN([WX_ARG_CACHE_FLUSH],
287         [
288           echo "saving argument cache $wx_arg_cache_file"
289           mv ${wx_arg_cache_file}.tmp ${wx_arg_cache_file}
290         ])
291
292 dnl this macro checks for a three-valued command line --with argument:
293 dnl   possible arguments are 'yes', 'no', 'sys', or 'builtin'
294 dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
295 AC_DEFUN([WX_ARG_SYS_WITH],
296         [
297           AC_MSG_CHECKING([for --with-$1])
298           no_cache=0
299           AC_ARG_WITH($1, [$2],
300                       [
301                         if test "$withval" = yes; then
302                           ac_cv_use_$1='$3=yes'
303                         elif test "$withval" = no; then
304                           ac_cv_use_$1='$3=no'
305                         elif test "$withval" = sys; then
306                           ac_cv_use_$1='$3=sys'
307                         elif test "$withval" = builtin; then
308                           ac_cv_use_$1='$3=builtin'
309                         else
310                           AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
311                         fi
312                       ],
313                       [
314                         LINE=`grep "$3" ${wx_arg_cache_file}`
315                         if test "x$LINE" != x ; then
316                           eval "DEFAULT_$LINE"
317                         else
318                           no_cache=1
319                         fi
320
321                         ac_cv_use_$1='$3='$DEFAULT_$3
322                       ])
323
324           eval "$ac_cv_use_$1"
325           if test "$no_cache" != 1; then
326             echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
327           fi
328
329           if test "$$3" = yes; then
330             AC_MSG_RESULT(yes)
331           elif test "$$3" = no; then
332             AC_MSG_RESULT(no)
333           elif test "$$3" = sys; then
334             AC_MSG_RESULT([system version])
335           elif test "$$3" = builtin; then
336             AC_MSG_RESULT([builtin version])
337           else
338             AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
339           fi
340         ])
341
342 dnl this macro checks for a command line argument and caches the result
343 dnl usage: WX_ARG_WITH(option, helpmessage, variable-name)
344 AC_DEFUN([WX_ARG_WITH],
345         [
346           AC_MSG_CHECKING([for --with-$1])
347           no_cache=0
348           AC_ARG_WITH($1, [$2],
349                       [
350                         if test "$withval" = yes; then
351                           ac_cv_use_$1='$3=yes'
352                         else
353                           ac_cv_use_$1='$3=no'
354                         fi
355                       ],
356                       [
357                         LINE=`grep "$3" ${wx_arg_cache_file}`
358                         if test "x$LINE" != x ; then
359                           eval "DEFAULT_$LINE"
360                         else
361                           no_cache=1
362                         fi
363
364                         ac_cv_use_$1='$3='$DEFAULT_$3
365                       ])
366
367           eval "$ac_cv_use_$1"
368           if test "$no_cache" != 1; then
369             echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
370           fi
371
372           if test "$$3" = yes; then
373             AC_MSG_RESULT(yes)
374           else
375             AC_MSG_RESULT(no)
376           fi
377         ])
378
379 dnl like WX_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH
380 dnl usage: WX_ARG_ENABLE(option, helpmessage, variable-name, enablestring)
381 dnl
382 dnl enablestring is a hack and allows to show "checking for --disable-foo"
383 dnl message when running configure instead of the default "checking for
384 dnl --enable-foo" one whih is useful for the options enabled by default
385 AC_DEFUN([WX_ARG_ENABLE],
386         [
387           enablestring=$4
388           AC_MSG_CHECKING([for --${enablestring:-enable}-$1])
389           no_cache=0
390           AC_ARG_ENABLE($1, [$2],
391                         [
392                           if test "$enableval" = yes; then
393                             ac_cv_use_$1='$3=yes'
394                           else
395                             ac_cv_use_$1='$3=no'
396                           fi
397                         ],
398                         [
399                           LINE=`grep "$3" ${wx_arg_cache_file}`
400                           if test "x$LINE" != x ; then
401                             eval "DEFAULT_$LINE"
402                           else
403                             no_cache=1
404                           fi
405
406                           ac_cv_use_$1='$3='$DEFAULT_$3
407                         ])
408
409           eval "$ac_cv_use_$1"
410           if test "$no_cache" != 1; then
411             echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp
412           fi
413
414           if test "$$3" = yes; then
415             AC_MSG_RESULT(yes)
416           else
417             AC_MSG_RESULT(no)
418           fi
419         ])
420
421
422 dnl ===========================================================================
423 dnl Linker features test
424 dnl ===========================================================================
425
426 dnl ---------------------------------------------------------------------------
427 dnl WX_VERSIONED_SYMBOLS checks whether the linker can create versioned
428 dnl symbols. If it can, sets LDFLAGS_VERSIONING to $CXX flags needed to use
429 dnl version script file named versionfile
430 dnl
431 dnl call WX_VERSIONED_SYMBOLS(versionfile)
432 dnl ---------------------------------------------------------------------------
433 AC_DEFUN([WX_VERSIONED_SYMBOLS],
434 [
435   found_versioning=no
436
437   dnl FIXME - doesn't work, Solaris linker doesn't accept wildcards
438   dnl         in the script.
439   dnl dnl Check for known non-gcc cases:
440   dnl case "${host}" in
441   dnl   *-*-solaris2* )
442   dnl     if test "x$GCC" != "xyes" ; then
443   dnl         LDFLAGS_VERSIONING="-M $1"
444   dnl         found_versioning=yes
445   dnl     fi
446   dnl   ;;
447   dnl esac
448   
449   dnl Generic check for GCC or GCC-like behaviour (Intel C++, GCC):
450   if test $found_versioning = no ; then
451       AC_CACHE_CHECK([if the linker accepts --version-script], wx_cv_version_script,
452       [
453         echo "VER_1 { *; };" >conftest.sym
454         echo "int main() { return 0; }" >conftest.cpp
455   
456         if AC_TRY_COMMAND([
457                 $CXX -o conftest.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
458                 -Wl,--version-script,conftest.sym >/dev/null 2>conftest.stderr]) ; then
459           if test -s conftest.stderr ; then
460               wx_cv_version_script=no
461           else
462               wx_cv_version_script=yes
463           fi
464         else
465           wx_cv_version_script=no
466         fi
467
468         dnl There's a problem in some old linkers with --version-script that
469         dnl can cause linking to fail when you have objects with vtables in
470         dnl libs 3 deep.  This is known to happen in netbsd and openbsd with
471         dnl ld 2.11.2.
472         dnl 
473         dnl To test for this we need to make some shared libs and
474         dnl unfortunately we can't be sure of the right way to do that. If the
475         dnl first two compiles don't succeed then it looks like the test isn't
476         dnl working and the result is ignored, but if OTOH the first two
477         dnl succeed but the third does not then the bug has been detected and
478         dnl the --version-script flag is dropped.
479         if test $wx_cv_version_script = yes
480         then
481           echo "struct B { virtual ~B() { } }; \
482                 struct D : public B { }; \
483                 void F() { D d; }" > conftest.cpp
484
485           if AC_TRY_COMMAND([
486                 $CXX -shared -fPIC -o conftest1.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
487                 -Wl,--version-script,conftest.sym >/dev/null 2>/dev/null]) &&
488              AC_TRY_COMMAND([
489                 $CXX -shared -fPIC -o conftest2.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
490                 -Wl,--version-script,conftest.sym conftest1.output >/dev/null 2>/dev/null])
491           then
492             if AC_TRY_COMMAND([
493                   $CXX -shared -fPIC -o conftest3.output $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.cpp
494                   -Wl,--version-script,conftest.sym conftest2.output conftest1.output >/dev/null 2>/dev/null])
495             then
496               wx_cv_version_script=yes
497             else
498               wx_cv_version_script=no
499             fi
500           fi
501         fi
502
503         rm -f conftest.output conftest.stderr conftest.sym conftest.cpp
504         rm -f conftest1.output conftest2.output conftest3.output
505       ])
506       if test $wx_cv_version_script = yes ; then
507         LDFLAGS_VERSIONING="-Wl,--version-script,$1"
508       fi
509   fi
510 ])
511
512
513 dnl ===========================================================================
514 dnl "3rd party" macros included here because they are not widely available
515 dnl ===========================================================================
516
517 dnl ---------------------------------------------------------------------------
518 dnl test for availability of iconv()
519 dnl ---------------------------------------------------------------------------
520
521 dnl From Bruno Haible.
522
523 AC_DEFUN([AM_ICONV],
524 [
525   dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
526   dnl those with the standalone portable GNU libiconv installed).
527
528   AC_ARG_WITH([libiconv-prefix],
529 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
530     for dir in `echo "$withval" | tr : ' '`; do
531       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
532       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
533     done
534    ])
535
536   AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
537     am_cv_func_iconv="no, consider installing GNU libiconv"
538     am_cv_lib_iconv=no
539     AC_TRY_LINK([#include <stdlib.h>
540 #include <iconv.h>],
541       [iconv_t cd = iconv_open("","");
542        iconv(cd,NULL,NULL,NULL,NULL);
543        iconv_close(cd);],
544       am_cv_func_iconv=yes)
545     if test "$am_cv_func_iconv" != yes; then
546       am_save_LIBS="$LIBS"
547       LIBS="$LIBS -liconv"
548       AC_TRY_LINK([#include <stdlib.h>
549 #include <iconv.h>],
550         [iconv_t cd = iconv_open("","");
551          iconv(cd,NULL,NULL,NULL,NULL);
552          iconv_close(cd);],
553         am_cv_lib_iconv=yes
554         am_cv_func_iconv=yes)
555       LIBS="$am_save_LIBS"
556     fi
557   ])
558   if test "$am_cv_func_iconv" = yes; then
559     AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
560     AC_CACHE_CHECK([if iconv needs const], wx_cv_func_iconv_const,
561       AC_TRY_COMPILE([
562 #include <stdlib.h>
563 #include <iconv.h>
564 extern
565 #ifdef __cplusplus
566 "C"
567 #endif
568 #if defined(__STDC__) || defined(__cplusplus)
569 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
570 #else
571 size_t iconv();
572 #endif
573         ],
574         [],
575         wx_cv_func_iconv_const="no",
576         wx_cv_func_iconv_const="yes"
577       )
578     )
579
580     iconv_const=
581     if test "x$wx_cv_func_iconv_const" = "xyes"; then
582         iconv_const="const"
583     fi
584
585     AC_DEFINE_UNQUOTED(ICONV_CONST, $iconv_const,
586       [Define as const if the declaration of iconv() needs const.])
587   fi
588   LIBICONV=
589   if test "$am_cv_lib_iconv" = yes; then
590     LIBICONV="-liconv"
591   fi
592   AC_SUBST(LIBICONV)
593 ])
594
595 dnl ---------------------------------------------------------------------------
596 dnl AC_SYS_LARGEFILE (partly based on the code from autoconf 2.5x)
597 dnl ---------------------------------------------------------------------------
598
599 dnl WX_SYS_LARGEFILE_TEST
600 dnl
601 dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
602 dnl     arithmetic properly but this failed miserably with gcc under Linux
603 dnl     whereas the system still supports 64 bit files, so now simply check
604 dnl     that off_t is big enough
605 define(WX_SYS_LARGEFILE_TEST,
606 [typedef struct {
607     unsigned int field: sizeof(off_t) == 8;
608 } wxlf;
609 ])
610
611
612 dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
613 define(WX_SYS_LARGEFILE_MACRO_VALUE,
614 [
615     AC_CACHE_CHECK([for $1 value needed for large files], [$3],
616         [
617           AC_TRY_COMPILE([#define $1 $2
618                           #include <sys/types.h>],
619                          WX_SYS_LARGEFILE_TEST,
620                          [$3=$2],
621                          [$3=no])
622         ]
623     )
624
625     if test "$$3" != no; then
626         wx_largefile=yes
627         AC_DEFINE_UNQUOTED([$1], [$$3])
628     fi
629 ])
630
631
632 dnl AC_SYS_LARGEFILE
633 dnl ----------------
634 dnl By default, many hosts won't let programs access large files;
635 dnl one must use special compiler options to get large-file access to work.
636 dnl For more details about this brain damage please see:
637 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
638 AC_DEFUN([AC_SYS_LARGEFILE],
639 [AC_ARG_ENABLE(largefile,
640                [  --disable-largefile     omit support for large files])
641 if test "$enable_largefile" != no; then
642     dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
643     dnl _LARGE_FILES -- for AIX
644     wx_largefile=no
645     WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits)
646     if test "x$wx_largefile" != "xyes"; then
647         WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files)
648     fi
649
650     AC_MSG_CHECKING(if large file support is available)
651     if test "x$wx_largefile" = "xyes"; then
652         AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
653     fi
654     AC_MSG_RESULT($wx_largefile)
655 fi
656 ])
657
658
659 dnl Available from the GNU Autoconf Macro Archive at:
660 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_const_cast.html
661 dnl
662 AC_DEFUN([AC_CXX_CONST_CAST],
663 [AC_CACHE_CHECK(whether the compiler supports const_cast<>,
664 ac_cv_cxx_const_cast,
665 [AC_LANG_SAVE
666  AC_LANG_CPLUSPLUS
667  AC_TRY_COMPILE(,[int x = 0;const int& y = x;int& z = const_cast<int&>(y);return z;],
668  ac_cv_cxx_const_cast=yes, ac_cv_cxx_const_cast=no)
669  AC_LANG_RESTORE
670 ])
671 if test "$ac_cv_cxx_const_cast" = yes; then
672   AC_DEFINE(HAVE_CONST_CAST,,[define if the compiler supports const_cast<>])
673 fi
674 ])
675
676 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_reinterpret_cast.html
677 AC_DEFUN([AC_CXX_REINTERPRET_CAST],
678 [AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>,
679 ac_cv_cxx_reinterpret_cast,
680 [AC_LANG_SAVE
681  AC_LANG_CPLUSPLUS
682  AC_TRY_COMPILE([#include <typeinfo>
683 class Base { public : Base () {} virtual void f () = 0;};
684 class Derived : public Base { public : Derived () {} virtual void f () {} };
685 class Unrelated { public : Unrelated () {} };
686 int g (Unrelated&) { return 0; }],[
687 Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);],
688  ac_cv_cxx_reinterpret_cast=yes, ac_cv_cxx_reinterpret_cast=no)
689  AC_LANG_RESTORE
690 ])
691 if test "$ac_cv_cxx_reinterpret_cast" = yes; then
692   AC_DEFINE(HAVE_REINTERPRET_CAST,,
693             [define if the compiler supports reinterpret_cast<>])
694 fi
695 ])
696
697 dnl and http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_static_cast.html
698 AC_DEFUN([AC_CXX_STATIC_CAST],
699 [AC_CACHE_CHECK(whether the compiler supports static_cast<>,
700 ac_cv_cxx_static_cast,
701 [AC_LANG_SAVE
702  AC_LANG_CPLUSPLUS
703  AC_TRY_COMPILE([#include <typeinfo>
704 class Base { public : Base () {} virtual void f () = 0; };
705 class Derived : public Base { public : Derived () {} virtual void f () {} };
706 int g (Derived&) { return 0; }],[
707 Derived d; Base& b = d; Derived& s = static_cast<Derived&> (b); return g (s);],
708  ac_cv_cxx_static_cast=yes, ac_cv_cxx_static_cast=no)
709  AC_LANG_RESTORE
710 ])
711 if test "$ac_cv_cxx_static_cast" = yes; then
712   AC_DEFINE(HAVE_STATIC_CAST,, [define if the compiler supports static_cast<>])
713 fi
714 ])
715
716 dnl http://autoconf-archive.cryp.to/ac_cxx_dynamic_cast.html
717 AC_DEFUN([AC_CXX_DYNAMIC_CAST],
718 [AC_CACHE_CHECK(whether the compiler supports dynamic_cast<>,
719 ac_cv_cxx_dynamic_cast,
720 [AC_LANG_SAVE
721  AC_LANG_CPLUSPLUS
722  AC_TRY_COMPILE([#include <typeinfo>
723 class Base { public : Base () {} virtual void f () = 0;};
724 class Derived : public Base { public : Derived () {} virtual void f () {} };],[
725 Derived d; Base& b=d; return dynamic_cast<Derived*>(&b) ? 0 : 1;],
726  ac_cv_cxx_dynamic_cast=yes, ac_cv_cxx_dynamic_cast=no)
727  AC_LANG_RESTORE
728 ])
729 if test "$ac_cv_cxx_dynamic_cast" = yes; then
730   AC_DEFINE(HAVE_DYNAMIC_CAST,,[define if the compiler supports dynamic_cast<>])
731 fi
732 ])
733