if test "x$ac_cv_sys_file_offset_bits" = "x64"; then
WX_LARGEFILE_FLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES"
- dnl we get "Large Files (ILP32) not supported in strict ANSI mode."
- dnl #error from HP standard headers without this
- if test "$USE_HPUX" = 1; then
- CPPFLAGS="$CPPFLAGS -D__STDC_EXT__"
+ dnl We get "Large Files (ILP32) not supported in strict ANSI mode."
+ dnl #error from HP standard headers unless __STDC_EXT__ is defined.
+ dnl The compiler should define it automatically, but some old g++
+ dnl versions don't define it, so test and add it if necessary. AFAIK
+ dnl the problem only affects the C++ compiler so it is added to
+ dnl CXXFLAGS only.
+ if test "$USE_HPUX" = 1 -a "$GXX" = "yes"; then
+ AC_CACHE_CHECK(
+ [if -D__STDC_EXT__ is required],
+ wx_cv_STDC_EXT_required,
+ [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE(
+ [],
+ [
+ #ifndef __STDC_EXT__
+ choke me
+ #endif
+ ],
+ wx_cv_STDC_EXT_required=no,
+ wx_cv_STDC_EXT_required=yes
+ )
+ AC_LANG_RESTORE
+ ]
+ )
+ if test "x$wx_cv_STDC_EXT_required" = "xyes"; then
+ CXXFLAGS="$CXXFLAGS -D__STDC_EXT__"
+ fi
fi
else
WX_LARGEFILE_FLAGS="-D_LARGE_FILES"
AC_TRY_COMPILE([#include <features.h>],
[
#if (__GLIBC__ < 2) || (__GLIBC_MINOR__ < 1)
- #error not glibc2.1
+ not glibc 2.1
#endif
],
[
],
[
#if !GTK_CHECK_VERSION(2,4,0)
- #error "Not GTK+ 2.4"
+ Not GTK+ 2.4
#endif
],
[
],
[
#if XmVersion < 2000
- #error "Not Motif 2"
+ Not Motif 2
#endif
],
[
],
[
#if !defined(LesstifVersion) || LesstifVersion <= 0
- #error "Not Lesstif"
+ Not Lesstif
#endif
],
[
dnl check for vsnprintf() -- a safe version of vsprintf())
dnl
-dnl the trouble here is that on some systems (notable HP-UX) this function is
+dnl the trouble here is that on some systems (e.g HP-UX 10) this function is
dnl present in libc but not in the system headers and so AC_CHECK_FUNCS (which,
dnl stupidly, provides a dummy function declaration inside its extension)
dnl succeeds, even with C++ compiler, but the compilation of wxWidgets fails
dnl
dnl so we first check if the function is in the library
-AC_CHECK_FUNCS(vsnprintf)
+AC_CHECK_FUNCS(snprintf vsnprintf)
if test "$ac_cv_func_vsnprintf" = "yes"; then
dnl yes it is -- now check if it is in the headers
AC_CACHE_CHECK([for vsnprintf declaration], wx_cv_func_vsnprintf_decl,
[
+ dnl our troubles are not over: HP-UX 11 prototypes vsnprintf() as
+ dnl taking "char *" and not "const char *" while Metrowerks does
+ dnl provide a correct vsnprintf declaration but in C++ mode it's
+ dnl always in std namespace and so we have to bring it in scope
AC_TRY_COMPILE(
[
#include <stdio.h>
#include <stdarg.h>
+ #ifdef __MSL__
+ #if __MSL__ >= 0x6000
+ namespace std {}
+ using namespace std;
+ #endif
+ #endif
],
[
char *buf;
va_list ap;
- vsnprintf(buf, 10u, "%s", ap);
+ const char *fmt = "%s";
+ vsnprintf(buf, 10u, fmt, ap);
],
wx_cv_func_vsnprintf_decl=yes,
- [
- dnl Metrowerks does provide a vsnprintf declaration
- dnl but in C++ mode it's always in std namespace.
- dnl FIXME: Do we have any UNIX C++ compilers that would
- dnl fail this test if using namespace std; was
- dnl simply always included?
- AC_TRY_COMPILE(
- [
- #include <stdio.h>
- #include <stdarg.h>
- using namespace std;
- ],
- [
- char *buf;
- va_list ap;
- vsnprintf(buf, 10u, "%s", ap);
- ],
- wx_cv_func_vsnprintf_decl=yes,
- wx_cv_func_vsnprintf_decl=no
- )
- ]
+ wx_cv_func_vsnprintf_decl=no
)
]
)
fi
fi
+dnl the same as above but for snprintf() now: it's not present in at least AIX
+dnl 4.2 headers
+if test "$ac_cv_func_snprintf" = "yes"; then
+ AC_CACHE_CHECK([for snprintf declaration], wx_cv_func_snprintf_decl,
+ [
+ AC_TRY_COMPILE(
+ [
+ #include <stdio.h>
+ #include <stdarg.h>
+ #ifdef __MSL__
+ #if __MSL__ >= 0x6000
+ namespace std {}
+ using namespace std;
+ #endif
+ #endif
+ ],
+ [
+ char *buf;
+ const char *fmt = "%s";
+ snprintf(buf, 10u, fmt, "wx");
+ ],
+ wx_cv_func_snprintf_decl=yes,
+ wx_cv_func_snprintf_decl=no
+ )
+ ]
+ )
+
+ if test "$wx_cv_func_snprintf_decl" = "yes"; then
+ AC_DEFINE(HAVE_SNPRINTF_DECL)
+ fi
+fi
+
if test "$wxUSE_UNICODE" = yes; then
dnl also look if we have wide char IO functions
AC_CHECK_FUNCS(wputc wputchar putws fputws wprintf vswprintf)
AC_TRY_COMPILE(
[
#if defined(__BSD__)
- #include <sys/param.h>
- #include <sys/mount.h>
+ #include <sys/param.h>
+ #include <sys/mount.h>
#else
- #include <sys/vfs.h>
+ #include <sys/vfs.h>
#endif
],
[
l += fs.f_blocks;
l += fs.f_bavail;
],
- [
- wx_cv_func_statfs=yes
- ],
- [
- wx_cv_func_statfs=no
- ]
+ wx_cv_func_statfs=yes,
+ wx_cv_func_statfs=no
)
)
if test "$wx_cv_func_statfs" = "yes"; then
+ dnl check whether we have its dcelaration too: some systems (AIX 4) lack it
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_CACHE_CHECK(for statfs declaration, wx_cv_func_statfs_decl,
+ AC_TRY_COMPILE(
+ [
+ #if defined(__BSD__)
+ #include <sys/param.h>
+ #include <sys/mount.h>
+ #else
+ #include <sys/vfs.h>
+ #endif
+ ],
+ [
+ struct statfs fs;
+ statfs("", &fs);
+ ],
+ wx_cv_func_statfs_decl=yes,
+ wx_cv_func_statfs_decl=no
+ )
+ )
+ AC_LANG_RESTORE
+
+ if test "$wx_cv_func_statfs_decl" = "yes"; then
+ AC_DEFINE(HAVE_STATFS_DECL)
+ fi
+
wx_cv_type_statvfs_t="struct statfs"
AC_DEFINE(HAVE_STATFS)
else
THREAD_OPTS="pthreads"
;;
*-hp-hpux* )
- dnl HP-UX aCC only gives a warning, not an error about
- dnl -pthread but it doesn't work and we have to use -lpthread
- dnl there
- if test "x$GCC" != "xyes"; then
+ if test "x$GCC" = "xyes"; then
+ dnl g++ versions before 3.3.2 don't support -pthread.
+ $CXX -dumpspecs | grep 'pthread:' >/dev/null ||
+ THREAD_OPTS=""
+ else
+ dnl HP-UX aCC only gives a warning, not an error about
+ dnl -pthread but it doesn't work and we have to use
+ dnl -lpthread there
THREAD_OPTS=""
fi
;;
AC_MSG_CHECKING([if this GCC version is >= 4.0 and needs -DNO_GCC_PRAGMA])
AC_TRY_COMPILE([],
[#if (__GNUC__ < 4)
- #error "Not GCC 4.0 or greater"
+ Not GCC 4.0 or greater
#endif
],
[GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
AC_MSG_CHECKING([if this MinGW version needs -DNO_GCC_PRAGMA])
AC_TRY_COMPILE([],
[#if !(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
- #error "Not GCC 3.2 or greater"
+ Not GCC 3.2 or greater
#endif
],
[GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"
AC_MSG_CHECKING([if this gcc version needs -DNO_GCC_PRAGMA])
AC_TRY_COMPILE([],
[#if !(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
- #error "Not GCC 3.2 or greater"
+ Not GCC 3.2 or greater
#endif
],
[GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA"