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