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