more things are done by configure: checks for bool, whether overloading based

on size_t/int works or not (for wxString), the type of 3rd argument to
getsockaddr, absence of libXpm is not fatal (not tested), whether strings.h
exists


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-03-12 19:12:49 +00:00
parent 55b7bba191
commit 57493f9f85
9 changed files with 808 additions and 565 deletions

886
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -452,43 +452,40 @@ if test "$ac_cv_header_linux_joystick_h" = "yes"; then
fi
AC_SUBST(GTK_JOYSTICK)
dnl some systems (AIX) define some of string function in strings.h
AC_CHECK_HEADERS(strings.h)
dnl #######################
dnl # check for functions #
dnl #######################
dnl check for vprintf/vsprintf() which are GNU extensions
AC_FUNC_VPRINTF
dnl check for several standard functions we use if they are available
AC_CHECK_FUNCS(vsnprintf vfork)
dnl check for vsnprintf() - a safe version of vsprintf()
AC_CHECK_FUNCS(vsnprintf,
AC_DEFINE(HAVE_VSNPRINTF),
AC_MSG_WARN(unsafe function sprintf will be used instead of snprintf)
)
dnl check for vfork() (even if it's the same as fork() in modern Unices)
AC_CHECK_FUNCS(vfork)
POSIX4_LINK=
dnl check for usleep() and nanosleep() which is better in MT programs
dnl AC_CHECK_FUNCS(nanosleep, AC_DEFINE(HAVE_NANOSLEEP),
dnl [
dnl AC_CHECK_LIB(posix4, nanosleep,
dnl AC_DEFINE(HAVE_NANOSLEEP),
dnl AC_CHECK_FUNCS(usleep))
dnl ]
dnl )
AC_CHECK_FUNCS(nanosleep, AC_DEFINE(HAVE_NANOSLEEP),
[AC_CHECK_LIB(posix4, nanosleep, [
AC_DEFINE(HAVE_NANOSLEEP)
POSIX4_LINK="-lposix4" ],
[AC_CHECK_FUNCS(usleep, AC_DEFINE(HAVE_USLEEP),
AC_MSG_WARN(Sleep() function will not work)
)]
)]
)
AC_CHECK_FUNCS(nanosleep, AC_DEFINE(HAVE_NANOSLEEP), [
AC_CHECK_LIB(posix4, nanosleep, [
AC_DEFINE(HAVE_NANOSLEEP)
POSIX4_LINK="-lposix4"
], [
AC_CHECK_FUNCS(usleep,
AC_DEFINE(HAVE_USLEEP),
AC_MSG_WARN(Sleep() function will not work))
])
])
dnl check for uname (POSIX) and gethostname (BSD)
AC_CHECK_FUNCS(uname gethostname, break)
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_HEADERS(iostream)
if test "x$HAVE_IOSTREAM" = "x" ; then
AC_DEFINE(wxUSE_IOSTREAMH)
fi
AC_LANG_RESTORE
dnl defines HAVE_IOSTREAM
dnl ###################
dnl # checks typedefs #
dnl ###################
@@ -533,7 +530,6 @@ dnl defines HAVE_TZNAME if external array tzname is found
dnl ###################################
dnl # checks compiler characteristics #
dnl ###################################
dnl AC_C_CROSS
AC_C_CONST
dnl defines const to be empty if c-compiler does not support const fully
@@ -547,11 +543,12 @@ dnl defines HAVE_LONGDOUBLE if compiler supports long double
AC_C_BIGENDIAN
dnl defines WORDS_BIGENDIAN if system is big endian
AC_CHECK_SIZEOF(int *)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
dnl defines the size of certain types of variables in SIZEOF_???
dnl give some default values for cross-compiling
AC_CHECK_SIZEOF(int *, 4)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 0)
dnl defines the size of certain types of variables in SIZEOF_<TYPE>
dnl ######################
dnl # check C++ features #
@@ -560,15 +557,55 @@ dnl ######################
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
dnl check for iostream (as opposed to iostream.h) standard header
AC_CHECK_HEADERS(iostream)
if test "x$HAVE_IOSTREAM" = "x" ; then
AC_DEFINE(wxUSE_IOSTREAMH)
fi
dnl Check for existence of builtin 'bool' data type
dnl
dnl do nothing for cross-compilation - assume bool is not defined
AC_MSG_CHECKING(if C++ compiler supports bool)
AC_TRY_RUN([ int main() {bool b = true; return 0;} ],
AC_TRY_RUN([
int main()
{
bool b = true;
return 0;
}
],
AC_DEFINE(HAVE_BOOL) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no),
AC_MSG_RESULT(no assumed for cross-compilation))
dnl Check whether overloading on size_t/int parameter works
AC_MSG_CHECKING(if size_t and int are different types)
AC_TRY_RUN([
#include <stdlib.h>
void wxFoo(int i) { }
void wxFoo(size_t n) { }
int main()
{
int i;
size_t n;
wxFoo(0);
wxFoo(1);
wxFoo(0u);
wxFoo(i);
wxFoo(n);
return 0;
}
],
AC_DEFINE(wxUSE_SIZE_T_STRING_OPERATOR) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no),
AC_MSG_RESULT(no assumed for cross-compilation))
AC_LANG_RESTORE
dnl ############################
@@ -1100,49 +1137,60 @@ if test "$wxUSE_QT" = 1; then
fi
if test "$wxUSE_MOTIF" = 1; then
AC_MSG_CHECKING(for Motif/Lesstif includes)
AC_PATH_FIND_INCLUDES($SEARCH_INCLUDE,Xm/Xm.h)
if test "$ac_find_includes" != "" ; then
AC_MSG_RESULT(found $ac_find_includes)
AC_MSG_CHECKING(for Motif/Lesstif library)
AC_PATH_FIND_LIBRARIES($SEARCH_LIB,Xm)
if test "$ac_find_libraries" != "" ; then
AC_INCLUDE_PATH_EXIST($ac_find_includes,$CHECK_INCLUDE)
AC_LINK_PATH_EXIST($ac_find_libraries,$CHECK_LIB)
CHECK_LINK="$CHECK_LIB $ac_path_to_link"
CHECK_INCLUDE="$CHECK_INCLUDE $ac_path_to_include"
AC_MSG_RESULT(found at $ac_find_libraries)
AC_MSG_CHECKING(for Xt library)
AC_PATH_FIND_LIBRARIES($SEARCH_LIB,Xt)
if test "$ac_find_libraries" != "" ; then
AC_LINK_PATH_EXIST($ac_find_libraries,$CHECK_LIB)
CHECK_LINK="$CHECK_LIB $ac_path_to_link"
AC_MSG_RESULT(found at $ac_find_libraries)
AC_MSG_CHECKING(for Xpm library)
AC_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
if test "$ac_find_libraries" != "" ; then
AC_LINK_PATH_EXIST($ac_find_libraries,$CHECK_LIB)
CHECK_LINK="$CHECK_LIB $ac_path_to_link"
AC_MSG_RESULT(found at $ac_find_libraries)
else
AC_MSG_ERROR(no)
fi
else
AC_MSG_ERROR(no)
fi
else
AC_MSG_ERROR(no)
fi
else
AC_MSG_ERROR(no)
fi
AC_MSG_CHECKING(for Motif/Lesstif includes)
AC_PATH_FIND_INCLUDES($SEARCH_INCLUDE, Xm/Xm.h)
if test "$ac_find_includes" != "" ; then
AC_MSG_RESULT(found $ac_find_includes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(please set CFLAGS to contain the location of Xm/Xm.h)
fi
GUI_TK_LINK="-lXm -lXpm -lXmu -lXt -lX11 -lm"
GUI_TK_LIBRARY="$CHECK_LIB $GUI_TK_LINK"
TOOLKIT=MOTIF
TOOLKIT_DEF=__WXMOTIF__
WX_LINK=-lwx_motif2
MAKEINCLUDE=../motif.inc
AC_MSG_CHECKING(for Motif/Lesstif library)
AC_PATH_FIND_LIBRARIES($SEARCH_LIB, Xm)
if test "$ac_find_libraries" != "" ; then
AC_INCLUDE_PATH_EXIST($ac_find_includes, $CHECK_INCLUDE)
AC_LINK_PATH_EXIST($ac_find_libraries, $CHECK_LIB)
CHECK_LINK="$CHECK_LIB $ac_path_to_link"
CHECK_INCLUDE="$CHECK_INCLUDE $ac_path_to_include"
AC_MSG_RESULT(found at $ac_find_libraries)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(please set LDFLAGS to contain the location of libXm)
fi
AC_MSG_CHECKING(for Xt library)
AC_PATH_FIND_LIBRARIES($SEARCH_LIB,Xt)
if test "$ac_find_libraries" != "" ; then
AC_LINK_PATH_EXIST($ac_find_libraries,$CHECK_LIB)
CHECK_LINK="$CHECK_LIB $ac_path_to_link"
AC_MSG_RESULT(found at $ac_find_libraries)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR(please set LDFLAGS to contain the location of libXt)
fi
XPM_LINK=""
AC_MSG_CHECKING(for Xpm library)
AC_PATH_FIND_LIBRARIES($SEARCH_LIB,Xpm)
if test "$ac_find_libraries" != "" ; then
AC_LINK_PATH_EXIST($ac_find_libraries,$CHECK_LIB)
CHECK_LINK="$CHECK_LIB $ac_path_to_link"
XPM_LINK="-lXpm "
AC_DEFINE(wxHAVE_LIB_XPM)
AC_MSG_RESULT(found at $ac_find_libraries)
else
AC_MSG_RESULT(no)
AC_MSG_WARN(library will be compiled without support for images in XPM format)
fi
GUI_TK_LINK="-lXm " $XPM_LINK "-lXmu -lXt -lX11 -lm"
GUI_TK_LIBRARY="$CHECK_LIB $GUI_TK_LINK"
TOOLKIT=MOTIF
TOOLKIT_DEF=__WXMOTIF__
WX_LINK=-lwx_motif2
MAKEINCLUDE=../motif.inc
fi
if test "$TOOLKIT" = ""; then
@@ -1290,6 +1338,26 @@ if test "$wxUSE_SERIAL" = 1 ; then
AC_DEFINE_UNQUOTED(wxUSE_SERIAL,$wxUSE_SERIAL)
fi
dnl ------------------------------------------------------------------------
dnl wxSocket
dnl ------------------------------------------------------------------------
if test "$wxUSE_SOCKETS" = "1"; then
dnl determine the type of third argument for getsockname
AC_MSG_CHECKING(the type of the third argument of getsockname)
AC_TRY_COMPILE(
[#include <sys/socket.h>],
[size_t len; getsockname(0, NULL, &len);],
AC_DEFINE(SOCKLEN_T, size_t) AC_MSG_RESULT(size_t),
AC_TRY_COMPILE(
[#include <sys/socket.h>],
[int len; getsockname(0, NULL, &len);],
AC_DEFINE(SOCKLEN_T, int) AC_MSG_RESULT(int),
AC_MSG_RESULT(unknown)
)
)
fi
dnl ------------------------------------------------------------------------
dnl wxLibrary class
dnl ------------------------------------------------------------------------

View File

@@ -141,6 +141,14 @@
#error "No Target! Use -D[__WXMOTIF__|__WXGTK__|__WXMSW__|__WXMAC__|__WXQT__|__WXSTUBS__]"
#endif
// ============================================================================
// non portable C++ features
// ============================================================================
// ----------------------------------------------------------------------------
// check for native bool type and TRUE/FALSE constants
// ----------------------------------------------------------------------------
#if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXQT__) || defined(__WXSTUBS__)
// Bool is now obsolete, use bool instead
// typedef int Bool;
@@ -157,43 +165,35 @@
#endif
#endif // TRUE/FALSE
// VC++ 4.0 is 1000.
// Add more tests here for Windows compilers that already define bool
// (under Unix, configure tests for this)
#ifndef HAVE_BOOL
#if defined( __MWERKS__ )
#if (__MWERKS__ >= 0x1000) && !__option(bool)
#define HAVE_BOOL
#endif
#elif defined(__VISUALC__) && (__VISUALC__ == 1020)
// in VC++ 4.2 the bool keyword is reserved (hence can't be typedefed)
// but not implemented, so we must #define it
#define bool unsigned int
#elif defined(__VISUALC__) && (__VISUALC__ > 1020)
// VC++ supports bool since 4.2
#define HAVE_BOOL
#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x500)
// Borland 5.0+ supports bool
#define HAVE_BOOL
#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
// Watcom 11+ supports bool
#define HAVE_BOOL
#endif // compilers
#endif // HAVE_BOOL
// Add more tests here for compilers that don't already define bool.
#if defined( __MWERKS__ )
#if (__MWERKS__ < 0x1000) || !__option(bool)
typedef unsigned int bool;
#endif
#elif defined(__SC__)
#if !defined(HAVE_BOOL) && !defined(bool)
// NB: of course, this doesn't replace the standard type, because, for
// example, overloading based on bool/int parameter doesn't work and
// so should be avoided in portable programs
typedef unsigned int bool;
#elif defined(__SALFORDC__)
typedef unsigned int bool;
#elif defined(__VISUALC__) && (__VISUALC__ <= 1000)
typedef unsigned int bool;
#elif defined(__VISUALC__) && (__VISUALC__ == 1020)
#define bool unsigned int
#elif defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
typedef unsigned int bool;
#elif defined(__WATCOMC__)
#if (__WATCOMC__ < 1100)
typedef unsigned int bool;
#endif
#elif defined(__SUNCC__) || defined(__SUNPRO_CC)
#ifdef __SUNPRO_CC
// starting from version 5.0 Sun CC understands 'bool'
#if __SUNPRO_CC <= 0x0420
// If we use int, we get identically overloaded functions in config.cpp
typedef unsigned char bool;
#endif // Sun CC version
#else
#error "Unknown compiler: only Sun's CC and gcc are currently recognised."
#endif // Sun CC
#elif defined(__SGI_CC__)
// test is taken from SGI "C++ Programming Guide"
#ifndef _BOOL
typedef unsigned char bool;
#endif // _BOOL
#endif
#endif // bool
typedef unsigned char wxByte;
typedef short int WXTYPE;
@@ -201,9 +201,9 @@ typedef int wxWindowID;
// Macro to cut down on compiler warnings.
#if REMOVE_UNUSED_ARG
#define WXUNUSED(identifier) /* identifier */
#define WXUNUSED(identifier) /* identifier */
#else // stupid, broken compiler
#define WXUNUSED(identifier) identifier
#define WXUNUSED(identifier) identifier
#endif
/*
@@ -212,26 +212,6 @@ typedef int wxWindowID;
#ifdef __WXMSW__
/*
#ifdef __BORLANDC__
# ifdef WXMAKINGDLL
# define WXDLLEXPORT __export
# define WXDLLEXPORT_DATA(type) type __export
# define WXDLLEXPORT_CTORFN __export
# elif defined(WXUSINGDLL)
# define WXDLLEXPORT __import
# define WXDLLEXPORT_DATA(type) type __import
# define WXDLLEXPORT_CTORFN
# else
# define WXDLLEXPORT
# define WXDLLEXPORT_DATA(type) type
# define WXDLLEXPORT_CTORFN
# endif
#else
*/
// _declspec works in BC++ 5 and later, as well as VC++
#if defined(__VISUALC__) || defined(__BORLANDC__)
@@ -255,12 +235,11 @@ typedef int wxWindowID;
# define WXDLLEXPORT_CTORFN
#endif
#else
// Non-Windows
#else // !Windows
# define WXDLLEXPORT
# define WXDLLEXPORT_DATA(type) type
# define WXDLLEXPORT_CTORFN
#endif
#endif // Win/!Win
// For ostream, istream ofstream
#if defined(__BORLANDC__) && defined( _RTLDLL )
@@ -276,27 +255,6 @@ class WXDLLEXPORT wxEvent;
integer on success as failure indicator */
#define wxNOT_FOUND (-1)
// ----------------------------------------------------------------------------
// Error codes
// ----------------------------------------------------------------------------
#ifdef ERR_PARAM
#undef ERR_PARAM
#endif
/// Standard error codes
enum ErrCode
{
/// invalid parameter (in broad sense)
ERR_PARAM = (-4000),
/// no more data (iteration functions usually return this)
ERR_NODATA,
/// user cancelled the operation
ERR_CANCEL,
/// no error (the only non negative error code)
ERR_SUCCESS = 0
};
// ----------------------------------------------------------------------------
/** @name Very common macros */
// ----------------------------------------------------------------------------

View File

@@ -26,7 +26,7 @@
#include <limits.h>
#include <stdlib.h>
#ifdef __AIX__
#ifdef HAVE_STRINGS_H
#include <strings.h> // for strcasecmp()
#endif // AIX
@@ -320,8 +320,10 @@ public:
char& Last()
{ wxASSERT( !IsEmpty() ); CopyBeforeWrite(); return m_pchData[Len()-1]; }
// on Linux-Alpha and AIX this gives overload problems
#if !(defined(__ALPHA__) || defined(__AIX__))
// under Unix it is tested with configure, assume it works on other
// platforms (there might be overloading problems if size_t and int are
// the same type)
#if !defined(__UNIX__) || defined(wxUSE_SIZE_T_STRING_OPERATOR)
// operator version of GetChar
char operator[](size_t n) const
{ ASSERT_VALID_INDEX( n ); return m_pchData[n]; }

View File

@@ -79,7 +79,9 @@ public:
wxVariant();
wxVariant(double val, const wxString& name = g_szNul);
wxVariant(long val, const wxString& name = g_szNul);
#ifdef HAVE_BOOL
wxVariant(bool val, const wxString& name = g_szNul);
#endif
wxVariant(char val, const wxString& name = g_szNul);
wxVariant(const wxString& val, const wxString& name = g_szNul);
wxVariant(const char* val, const wxString& name = g_szNul); // Necessary or VC++ assumes bool!
@@ -114,9 +116,11 @@ public:
bool operator== (char value) const;
bool operator!= (char value) const;
void operator= (char value) ;
#ifdef HAVE_BOOL
bool operator== (bool value) const;
bool operator!= (bool value) const;
void operator= (bool value) ;
#endif
bool operator== (const wxString& value) const;
bool operator!= (const wxString& value) const;
void operator= (const wxString& value) ;

View File

@@ -72,6 +72,10 @@
* Have glibc2
*/
#define wxHAVE_GLIBC2 0
/*
* Use libXpm
*/
#define wxHAVE_LIB_XPM 0
/* ------------------------------------------------------------------------ */
/* GUI control options (always enabled in wxGTK) */
@@ -168,6 +172,13 @@
*/
#define wxUSE_WCSRTOMBS 0
/*
* On some platforms overloading on size_t/int doesn't work, yet we'd like
* to define both size_t and int version of wxString::operator[] because it
* should really be size_t, but a lot of old, broken code uses int indices.
*/
#define wxUSE_SIZE_T_STRING_OPERATOR 1
/* ------------------------------------------------------------------------ */
/* misc options */
/* ------------------------------------------------------------------------ */
@@ -353,6 +364,9 @@
Usually this is either `int' or `gid_t'. */
#undef GETGROUPS_T
/* The type of 3rd argument to getsockname() - usually size_t or int */
#undef SOCKLEN_T
/* Define if the `getloadavg' function needs to be run setuid or setgid. */
#undef GETLOADAVG_PRIVILEGED
@@ -374,6 +388,9 @@
/* Define if you have sched.h */
#undef HAVE_SCHED_H
/* Define if you have strings.h */
#undef HAVE_STRINGS_H
/* Define if you have vprintf() */
#undef HAVE_VPRINTF

View File

@@ -73,23 +73,24 @@ void wxMacProcessEvents() ;
#endif
#if defined(__WINDOWS__)
#include <winsock.h>
#include <winsock.h>
#endif // __WINDOWS__
#if defined(__UNIX__)
#ifdef VMS
#include <socket.h>
#else
#include <sys/socket.h>
#endif
#include <socket.h>
#else // !VMS
#include <sys/socket.h>
#endif // VMS/!VMS
#include <sys/ioctl.h>
#include <sys/time.h>
#include <unistd.h>
#ifdef sun
#include <sys/filio.h>
#include <sys/filio.h>
#endif
#endif // __UNIX__
@@ -98,30 +99,31 @@ void wxMacProcessEvents() ;
#include <errno.h>
#ifdef __VISUALC__
#include <io.h>
#include <io.h>
#endif
#if defined(__WXMOTIF__) || defined(__WXXT__)
#include <X11/Intrinsic.h>
#include <X11/Intrinsic.h>
/////////////////////////////
// Needs internal variables
/////////////////////////////
#ifdef __WXXT__
#define Uses_XtIntrinsic
#endif
#endif
/////////////////////////////
// Needs internal variables
/////////////////////////////
#ifdef __WXXT__
#define Uses_XtIntrinsic
#endif
#endif // Motif or Xt
#if defined(__WXGTK__)
#include <gtk/gtk.h>
#include <gtk/gtk.h>
#endif
/////////////////////////////////////////////////////////////////////////////
// wxSocket headers
/////////////////////////////////////////////////////////////////////////////
#include "wx/module.h"
#define WXSOCK_INTERNAL
#include "wx/sckaddr.h"
#include "wx/socket.h"
@@ -174,11 +176,11 @@ int PASCAL FAR __WSAFDIsSet(SOCKET fd, fd_set FAR *set)
#endif
#if defined(__WINDOWS__)
#define PROCESS_EVENTS() wxYield()
#define PROCESS_EVENTS() wxYield()
#elif defined(__WXXT__) || defined(__WXMOTIF__)
#define PROCESS_EVENTS() XtAppProcessEvent(wxAPP_CONTEXT, XtIMAll)
#define PROCESS_EVENTS() XtAppProcessEvent(wxAPP_CONTEXT, XtIMAll)
#elif defined(__WXGTK__)
#define PROCESS_EVENTS() gtk_main_iteration()
#define PROCESS_EVENTS() gtk_main_iteration()
#endif
/////////////////////////////////////////////////////////////////////////////
@@ -205,12 +207,12 @@ public:
// ClassInfos
// --------------------------------------------------------------
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxSocketBase, wxObject)
IMPLEMENT_CLASS(wxSocketServer, wxSocketBase)
IMPLEMENT_CLASS(wxSocketClient, wxSocketBase)
IMPLEMENT_CLASS(wxSocketHandler, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxSocketModule, wxModule)
IMPLEMENT_CLASS(wxSocketBase, wxObject)
IMPLEMENT_CLASS(wxSocketServer, wxSocketBase)
IMPLEMENT_CLASS(wxSocketClient, wxSocketBase)
IMPLEMENT_CLASS(wxSocketHandler, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxSocketModule, wxModule)
#endif
class wxSockWakeUp : public wxTimer
@@ -532,24 +534,14 @@ void wxSocketBase::Discard()
#undef MAX_BUFSIZE
}
// If what? Who seems to need unsigned int?
// BTW uint isn't even defined on wxMSW for VC++ for some reason. Even if it
// were, getpeername/getsockname don't take unsigned int*, they take int*.
//
// Under glibc 2.0.7, socketbits.h declares socklen_t to be unsigned int
// and it uses *socklen_t as the 3rd parameter. Robert.
// JACS - How can we detect this?
// Meanwhile, if your compiler complains about socklen_t,
// switch lines below.
#if wxHAVE_GLIBC2
# typedef socklen_t wxSOCKET_INT;
#elif defined(__AIX__)
# typedef size_t wxSOCKET_INT;
#else
# typedef int wxSOCKET_INT;
#endif
// this is normally defined by configure, but if it wasn't try to do it here
#ifndef SOCKLEN_T
#if wxHAVE_GLIBC2
typedef socklen_t SOCKLEN_T;
#else
typedef int SOCKET_INT;
#endif
#endif // SOCKLEN_T
// --------------------------------------------------------------
// wxSocketBase socket info functions
@@ -558,7 +550,7 @@ void wxSocketBase::Discard()
bool wxSocketBase::GetPeer(wxSockAddress& addr_man) const
{
struct sockaddr my_addr;
wxSOCKET_INT len_addr = sizeof(my_addr);
SOCKLEN_T len_addr = (SOCKLEN_T)sizeof(my_addr);
if (m_fd < 0)
return FALSE;
@@ -573,13 +565,12 @@ bool wxSocketBase::GetPeer(wxSockAddress& addr_man) const
bool wxSocketBase::GetLocal(wxSockAddress& addr_man) const
{
struct sockaddr my_addr;
wxSOCKET_INT len_addr = sizeof(my_addr);
SOCKLEN_T len_addr = (SOCKLEN_T)sizeof(my_addr);
if (m_fd < 0)
return FALSE;
if (getsockname(m_fd, (struct sockaddr *)&my_addr, &len_addr) < 0)
return FALSE;
addr_man.Disassemble(&my_addr, len_addr);

View File

@@ -104,25 +104,14 @@ extern const char WXDLLEXPORT *g_szNul = &g_strEmpty.dummy;
// always available), but it's unsafe because it doesn't check for buffer
// size - so give a warning
#define wxVsprintf(buffer,len,format,argptr) vsprintf(buffer,format, argptr)
#if defined(__VISUALC__)
#pragma message("Using sprintf() because no snprintf()-like function defined")
#elif defined(__GNUG__)
#warning "Using sprintf() because no snprintf()-like function defined"
#elif defined(__MWERKS__)
#warning "Using sprintf() because no snprintf()-like function defined"
#elif defined(__WATCOMC__)
// No warning
#elif defined(__BORLANDC__)
// No warning
#elif defined(__SUNCC__)
// nothing -- I don't know about "#warning" for Sun's CC
#elif defined(__DECCXX)
// nothing
#else
// change this to some analogue of '#warning' for your compiler
#error "Using sprintf() because no snprintf()-like function defined"
#endif //compiler
#if defined(__VISUALC__)
#pragma message("Using sprintf() because no snprintf()-like function defined")
#elif defined(__GNUG__) && !defined(__UNIX__)
#warning "Using sprintf() because no snprintf()-like function defined"
#elif defined(__MWERKS__)
#warning "Using sprintf() because no snprintf()-like function defined"
#endif //compiler
#endif // no vsnprintf
// ----------------------------------------------------------------------------

View File

@@ -457,6 +457,7 @@ bool wxVariantDataReal::Read(wxString& str)
return TRUE;
}
#ifdef HAVE_BOOL
/*
* wxVariantDataBool
*/
@@ -547,6 +548,7 @@ bool wxVariantDataBool::Read(wxString& str)
m_value = (atol((const char*) str) != 0);
return TRUE;
}
#endif // HAVE_BOOL
/*
* wxVariantDataChar
@@ -991,11 +993,13 @@ wxVariant::wxVariant(long val, const wxString& name)
m_name = name;
}
#ifdef HAVE_BOOL
wxVariant::wxVariant(bool val, const wxString& name)
{
m_data = new wxVariantDataBool(val);
m_name = name;
}
#endif
wxVariant::wxVariant(char val, const wxString& name)
{
@@ -1205,6 +1209,7 @@ void wxVariant::operator= (char value)
}
}
#ifdef HAVE_BOOL
bool wxVariant::operator== (bool value) const
{
bool thisValue;
@@ -1232,6 +1237,7 @@ void wxVariant::operator= (bool value)
m_data = new wxVariantDataBool(value);
}
}
#endif // HAVE_BOOL
bool wxVariant::operator== (const wxString& value) const
{