dnl Check for headers
dnl ------------------------------------------------------------------------
-dnl defines HAVE_STDLIB_H
-AC_CHECK_HEADERS(stdlib.h)
-dnl defines HAVE_MALLOC_H
-AC_CHECK_HEADERS(malloc.h)
-dnl defines HAVE_UNISTD_H
-AC_CHECK_HEADERS(unistd.h)
-dnl defines HAVE_WCHAR_H
-AC_CHECK_HEADERS(wchar.h)
+AC_CHECK_HEADERS(stdlib.h fnmatch.h langinfo.h malloc.h unistd.h wchar.h)
dnl maybe wchar_t is in wcstr.h if we don't have wchar.h?
if test "$ac_cv_header_wchar_h" != "yes"; then
- dnl defines HAVE_WCSTR_H
AC_CHECK_HEADERS(wcstr.h)
fi
-dnl defines HAVE_FNMATCH_H
-AC_CHECK_HEADERS(fnmatch.h)
-
-dnl defines HAVE_LANGINFO_H (GNU libc locale parameters)
-AC_CHECK_HEADERS(langinfo.h)
-
case "${host}" in
*-pc-os2_emx | *-pc-os2-emx )
dnl Explicitly link -lintl if langinfo.h is available
CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit"
fi
+dnl the next few tests are all for C++ features and so need to be done using
+dnl C++ compiler
+AC_LANG_PUSH(C++)
+
dnl check for std::string or std::wstring
if test "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes"; then
if test "$wxUSE_UNICODE" = "yes"; then
char_type="char"
fi
- dnl check if <string> declares std::wstring
+ dnl check if <string> declares std::[w]string
AC_MSG_CHECKING([for $std_string in <string>])
AC_TRY_COMPILE([#include <string>],
[$std_string foo;],
])
fi
+dnl pop C++
+AC_LANG_POP()
+
dnl ---------------------------------------------------------------------------
dnl Define search path for includes and libraries: all headers and libs will be
dnl looked for in all directories of this path
AC_CACHE_CHECK([if expat.h is valid C++ header],
wx_cv_expat_is_not_broken,
[
+ AC_LANG_PUSH(C++)
AC_TRY_COMPILE([#include <expat.h>],[],
wx_cv_expat_is_not_broken=yes,
wx_cv_expat_is_not_broken=no
)
+ AC_LANG_POP()
]
)
if test "$wx_cv_expat_is_not_broken" = "yes" ; then
dnl check what exactly size_t is on this machine - this is necessary to avoid
dnl ambiguous overloads in several places, notably wx/string.h and wx/array.h
+AC_LANG_PUSH(C++) dnl tests below use overloaded functions and so need C++
AC_CACHE_CHECK([if size_t is unsigned int],
wx_cv_size_t_is_uint,
[
fi
fi
+AC_LANG_POP() dnl C++
+
dnl ---------------------------------------------------------------------------
dnl Checks for structures
dnl ---------------------------------------------------------------------------
if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes"; then
AC_CACHE_CHECK([for sa_handler type], wx_cv_type_sa_handler,
[
+ dnl C compiler happily compiles the code even if there is type mismatch
+ AC_LANG_PUSH(C++)
AC_TRY_COMPILE([#include <signal.h>],
[
extern void testSigHandler(int);
], [
wx_cv_type_sa_handler=void
])
+ AC_LANG_POP()
])
AC_DEFINE_UNQUOTED(wxTYPE_SA_HANDLER, $wx_cv_type_sa_handler)
if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then
AC_CACHE_CHECK([for backtrace() in <execinfo.h>], wx_cv_func_backtrace,
[
+ AC_LANG_PUSH(C++)
AC_TRY_COMPILE([#include <execinfo.h>],
[
void *trace[1];
wx_cv_func_backtrace=yes,
wx_cv_func_backtrace=no
)
+ AC_LANG_POP()
]
)
else
AC_CACHE_CHECK([for __cxa_demangle() in <cxxabi.h>], wx_cv_func_cxa_demangle,
[
+ AC_LANG_PUSH(C++)
AC_TRY_LINK([#include <cxxabi.h>],
[
int rc;
wx_cv_func_cxa_demangle=yes,
wx_cv_func_cxa_demangle=no
)
+ AC_LANG_POP()
]
)
if test "$wx_cv_func_statfs" = "yes"; then
dnl check whether we have its dcelaration too: some systems (AIX 4) lack it
AC_CACHE_CHECK(for statfs declaration, wx_cv_func_statfs_decl,
+ AC_LANG_PUSH(C++)
AC_TRY_COMPILE(
[
#if defined(__BSD__)
wx_cv_func_statfs_decl=yes,
wx_cv_func_statfs_decl=no
)
+ AC_LANG_POP()
)
if test "$wx_cv_func_statfs_decl" = "yes"; then
dnl for this check C++ compiler has to be used as passing incompatible
dnl pointers is just a warning and not an error in C
AC_CACHE_CHECK(for statvfs argument type, wx_cv_type_statvfs_t,
+ AC_LANG_PUSH(C++)
AC_TRY_COMPILE(
[
#include <sys/statvfs.h>
)
]
)
+ AC_LANG_POP()
)
if test "$wx_cv_type_statvfs_t" != "unknown"; then
if test "$wxUSE_DATETIME" = "yes"; then
dnl check for strptime and for its declaration as some systems lack it
+ dnl FIXME: use WX_CHECK_FUNCS instead
AC_CHECK_FUNCS(strptime)
if test "$ac_cv_func_strptime" = "yes"; then
AC_CACHE_CHECK([for strptime declaration], wx_cv_func_strptime_decl,
[
+ AC_LANG_PUSH(C++)
AC_TRY_COMPILE(
[
#include <time.h>
wx_cv_func_strptime_decl=yes,
wx_cv_func_strptime_decl=no
)
+ AC_LANG_POP()
]
)
fi
AC_CACHE_CHECK([what is the type of the third argument of getsockname],
wx_cv_type_getsockname3,
[
+ AC_LANG_PUSH(C++)
AC_TRY_COMPILE(
[
#include <sys/types.h>
CXXFLAGS="$CXXFLAGS_OLD"
]
)
+ AC_LANG_POP()
])
if test "$wx_cv_type_getsockname3" = "unknown"; then
if test "$USE_DARWIN" = 1; then
dnl check for a bug in the headers, some have bad setEventCallout
AC_MSG_CHECKING([headers have declarations needed for joystick support])
+ AC_LANG_PUSH(C++)
AC_TRY_COMPILE( [ #include <IOKit/hid/IOHIDLib.h> ],
[ IOHIDQueueInterface *qi = NULL;
IOHIDCallbackFunction cb = NULL;
qi->setEventCallout(NULL, cb, NULL, NULL); ],
[ wxUSE_JOYSTICK=yes ]
)
+ AC_LANG_POP()
AC_MSG_RESULT($wxUSE_JOYSTICK)
fi