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