From 165c889c5d8fd9a3f57472964c9f6388944df727 Mon Sep 17 00:00:00 2001 From: crs Date: Sat, 1 May 2004 10:12:06 +0000 Subject: [PATCH] Fixes to compile on solaris 9 using g++. --- acinclude.m4 | 5 +++-- configure.in | 6 ++---- lib/arch/CArchNetworkBSD.cpp | 13 +++++++++++++ lib/platform/CXWindowsScreenSaver.cpp | 1 + 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 6492e615..d368949b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -515,12 +515,13 @@ else fi ])dnl ACX_PTHREAD -dnl enable maximum compiler warnings +dnl enable maximum compiler warnings. must ignore unknown pragmas to +dnl build on solaris. dnl we only know how to do this for g++ AC_DEFUN([ACX_CXX_WARNINGS], [ AC_MSG_CHECKING([for C++ compiler warning flags]) if test "$GXX" = "yes"; then - acx_cxx_warnings="-Wall" + acx_cxx_warnings="-Wall -Wno-unknown-pragmas" fi if test -n "$acx_cxx_warnings"; then CXXFLAGS="$CXXFLAGS $acx_cxx_warnings" diff --git a/configure.in b/configure.in index 3be75a98..e6fcbbe6 100644 --- a/configure.in +++ b/configure.in @@ -35,19 +35,17 @@ case $host in *-*-mingw32* | *-*-windows*) acx_host_arch="WIN32" acx_host_winapi="MSWINDOWS" - ARCH_CFLAGS="$ARCH_CFLAGS -DSYSAPI_WIN32=1 -DWINAPI_MSWINDOWS=1" ;; *-*-darwin*) acx_host_arch="UNIX" acx_host_winapi="CARBON" - ARCH_CFLAGS="$ARCH_CFLAGS -DSYSAPI_UNIX=1 -DWINAPI_CARBON=1" ;; *) acx_host_arch="UNIX" acx_host_winapi="XWINDOWS" - ARCH_CFLAGS="$ARCH_CFLAGS -DSYSAPI_UNIX=1 -DWINAPI_XWINDOWS=1" ;; esac +ARCH_CFLAGS="$ARCH_CFLAGS -DSYSAPI_$acx_host_arch=1 -DWINAPI_$acx_host_winapi=1" AM_CONDITIONAL(WIN32, test x$acx_host_arch = xWIN32) AM_CONDITIONAL(UNIX, test x$acx_host_arch = xUNIX) AM_CONDITIONAL(MSWINDOWS, test x$acx_host_winapi = xMSWINDOWS) @@ -85,7 +83,7 @@ ACX_CHECK_INET_ATON dnl checks for header files AC_HEADER_STDC -AC_CHECK_HEADERS([unistd.h sys/time.h sys/types.h wchar.h]) +AC_CHECK_HEADERS([unistd.h sys/time.h sys/types.h wchar.h alloca.h]) AC_CHECK_HEADERS([sys/socket.h sys/select.h]) AC_CHECK_HEADERS([istream ostream sstream]) AC_HEADER_TIME diff --git a/lib/arch/CArchNetworkBSD.cpp b/lib/arch/CArchNetworkBSD.cpp index d8845801..27be0fea 100644 --- a/lib/arch/CArchNetworkBSD.cpp +++ b/lib/arch/CArchNetworkBSD.cpp @@ -34,6 +34,9 @@ #if HAVE_POLL # include +# if HAVE_ALLOCA_H +# include +# endif #else # if HAVE_SYS_SELECT_H # include @@ -43,6 +46,13 @@ # endif #endif +#if HAVE_ALLOCA_H +# define freea(x_) +#else +# define alloca(x_) malloc(x_) +# define freea(x_) free(x_) +#endif + static const int s_family[] = { PF_UNSPEC, PF_INET @@ -327,8 +337,10 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) if (errno == EINTR) { // interrupted system call ARCH->testCancelThread(); + freea(pfd); return 0; } + freea(pfd); throwError(errno); } @@ -349,6 +361,7 @@ CArchNetworkBSD::pollSocket(CPollEntry pe[], int num, double timeout) } } + freea(pfd); return n; } diff --git a/lib/platform/CXWindowsScreenSaver.cpp b/lib/platform/CXWindowsScreenSaver.cpp index 44c7c0b8..0b69f08f 100644 --- a/lib/platform/CXWindowsScreenSaver.cpp +++ b/lib/platform/CXWindowsScreenSaver.cpp @@ -27,6 +27,7 @@ #endif #if defined(HAVE_X11_EXTENSIONS_DPMS_H) extern "C" { +# include # include } #endif