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