Added wxUSE_CONSOLE_EVENTLOOP and wxUSE_SELECT/EPOLLDISPATCHER guards;

put checks for them in the new Unix-specific wx/unix/chkconf.h file


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-07-14 19:06:18 +00:00
parent ba51e75bb0
commit a187327964
28 changed files with 203 additions and 21 deletions

View File

@@ -582,6 +582,7 @@ ALL_PORTS_BASE_HEADERS = \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/unix/chkconf.h \
wx/unix/execute.h \
wx/unix/evtloop.h \
wx/unix/mimetype.h \
@@ -1844,6 +1845,7 @@ COND_TOOLKIT__BASE_MACOSX_HDR = \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/unix/chkconf.h \
wx/unix/execute.h \
wx/unix/evtloop.h \
wx/unix/mimetype.h \
@@ -1860,6 +1862,7 @@ COND_TOOLKIT_COCOA_BASE_MACOSX_HDR = \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/unix/chkconf.h \
wx/unix/execute.h \
wx/unix/evtloop.h \
wx/unix/mimetype.h \
@@ -1876,6 +1879,7 @@ COND_TOOLKIT_GTK_BASE_MACOSX_HDR = \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/unix/chkconf.h \
wx/unix/execute.h \
wx/unix/evtloop.h \
wx/unix/mimetype.h \
@@ -1896,6 +1900,7 @@ COND_TOOLKIT_MAC_BASE_MACOSX_HDR = \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/unix/chkconf.h \
wx/unix/evtloop.h \
wx/unix/stdpaths.h
@COND_TOOLKIT_MAC@BASE_MACOSX_HDR = $(COND_TOOLKIT_MAC_BASE_MACOSX_HDR)
@@ -1903,6 +1908,7 @@ COND_TOOLKIT_MOTIF_BASE_MACOSX_HDR = \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/unix/chkconf.h \
wx/unix/execute.h \
wx/unix/evtloop.h \
wx/unix/mimetype.h \
@@ -1919,6 +1925,7 @@ COND_TOOLKIT_X11_BASE_MACOSX_HDR = \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/unix/chkconf.h \
wx/unix/execute.h \
wx/unix/evtloop.h \
wx/unix/mimetype.h \
@@ -1946,6 +1953,7 @@ COND_PLATFORM_UNIX_1_BASE_PLATFORM_HDR = \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/unix/chkconf.h \
wx/unix/execute.h \
wx/unix/evtloop.h \
wx/unix/mimetype.h \

View File

@@ -76,6 +76,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/unix/app.h
wx/unix/apptbase.h
wx/unix/apptrait.h
wx/unix/chkconf.h
wx/unix/execute.h
wx/unix/evtloop.h
wx/unix/mimetype.h
@@ -224,6 +225,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/unix/app.h
wx/unix/apptbase.h
wx/unix/apptrait.h
wx/unix/chkconf.h
wx/unix/evtloop.h
wx/unix/stdpaths.h
</set>

View File

@@ -433,7 +433,7 @@ dnl - WX_ARG_WITHOUT/WX_ARG_DISABLE mirror WX_ARG_WITH/WX_ARG_ENABLE but
dnl should be used for the options which are enabled by default
dnl - WX_ARG_FEATURE is a version of WX_ARG_ENABLE which should be used for
dnl optional features, i.e. options which should be disabled if
dnl --disable-all_features is specified (WX_ARG_WITH/WX_ARG_SYS_WITH are
dnl --disable-all-features is specified (WX_ARG_WITH/WX_ARG_SYS_WITH are
dnl also affected by this)
dnl ---------------------------------------------------------------------------
@@ -451,7 +451,7 @@ if test "x$VENDOR" = "x"; then
VENDOR="custom"
fi
WX_ARG_DISABLE(all_features,[ --disable-all_features disable all optional features to build minimal library], wxUSE_ALL_FEATURES)
WX_ARG_DISABLE(all-features,[ --disable-all-features disable all optional features to build minimal library], wxUSE_ALL_FEATURES)
dnl ---------------------------------------------------------------------------
dnl port selection
@@ -576,6 +576,10 @@ WX_ARG_FEATURE(dataobj, [ --enable-dataobj use data object classes
WX_ARG_FEATURE(ipc, [ --enable-ipc use interprocess communication (wxSocket etc.)], wxUSE_IPC)
WX_ARG_FEATURE(baseevtloop, [ --enable-base-evtloop use event loop in console programs too], wxUSE_CONSOLE_EVENTLOOP)
WX_ARG_FEATURE(epoolloop, [ --enable-epool-loop use wxEpollDispatcher class (Linux only)], wxUSE_EPOLL_DISPATCHER)
WX_ARG_FEATURE(selectloop, [ --enable-select-loop use wxSelectDispatcher class], wxUSE_SELECT_DISPATCHER)
dnl please keep the settings below in alphabetical order
WX_ARG_FEATURE(apple_ieee, [ --enable-apple_ieee use the Apple IEEE codec], wxUSE_APPLE_IEEE)
WX_ARG_FEATURE(arcstream, [ --enable-arcstream use wxArchive streams], wxUSE_ARCHIVE_STREAMS)
@@ -1440,9 +1444,6 @@ if test "$USE_UNIX" = 1 ; then
AC_CHECK_HEADER([sys/select.h],,, [AC_INCLUDES_DEFAULT()])
fi
dnl defines HAVE_SYS_EPOLL_H - for epoll mainloop implementation in wxbase
AC_CHECK_HEADERS(sys/epoll.h)
dnl ---------------------------------------------------------------------------
dnl Checks for compiler characteristics
dnl ---------------------------------------------------------------------------
@@ -5693,6 +5694,29 @@ if test "$wxUSE_OBJC_UNIQUIFYING" = "yes"; then
AC_DEFINE(wxUSE_OBJC_UNIQUIFYING)
fi
dnl ---------------------------------------------------------------------------
dnl console event loop stuff
dnl ---------------------------------------------------------------------------
if test "$wxUSE_CONSOLE_EVENTLOOP" = "yes"; then
AC_DEFINE(wxUSE_CONSOLE_EVENTLOOP)
if test "$wxUSE_UNIX" = "yes"; then
if test "$wxUSE_SELECT_DISPATCHER" = "yes"; then
AC_DEFINE(wxUSE_SELECT_DISPATCHER);
fi
if test "$wxUSE_EPOLL_DISPATCHER" = "yes"; then
AC_CHECK_HEADERS(sys/epoll.h)
if test "$ac_cv_header_sys_epoll_h" = "yes"; then
AC_DEFINE(wxUSE_EPOLL_DISPATCHER)
else
AC_MSG_WARN([sys/epoll.h not available, wxEpollDispatcher disabled])
fi
fi
fi
fi
dnl ---------------------------------------------------------------------------
dnl time/date functions
dnl ---------------------------------------------------------------------------

View File

@@ -205,6 +205,10 @@ protected:
class WXDLLIMPEXP_BASE wxConsoleAppTraitsBase : public wxAppTraits
{
public:
#if !wxUSE_CONSOLE_EVENTLOOP
virtual wxEventLoopBase *CreateEventLoop() { return NULL; }
#endif // !wxUSE_CONSOLE_EVENTLOOP
#if wxUSE_LOG
virtual wxLog *CreateLogTarget();
#endif // wxUSE_LOG

View File

@@ -35,6 +35,10 @@
# include "wx/x11/chkconf.h"
#endif
#ifdef __UNIX__
# include "wx/unix/chkconf.h"
#endif
#ifdef __WXUNIVERSAL__
# include "wx/univ/chkconf.h"
#endif
@@ -83,6 +87,14 @@
please keep the options in alphabetical order!
*/
#ifndef wxUSE_CONSOLE_EVENTLOOP
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CONSOLE_EVENTLOOP must be defined."
# else
# define wxUSE_CONSOLE_EVENTLOOP 0
# endif
#endif /* !defined(wxUSE_CONSOLE_EVENTLOOP) */
#ifndef wxUSE_CRASHREPORT
/* this one is special: as currently it is Windows-only, don't force it
to be defined on other platforms */

View File

@@ -21,4 +21,13 @@
# error "wxFileConfig is required by wxDFB port"
#endif
#if wxUSE_SOCKETS && !wxUSE_SELECT_DISPATCHER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxSocket requires wxSelectDispatcher in wxDFB"
# else
# undef wxUSE_SELECT_DISPATCHER
# define wxUSE_SELECT_DISPATCHER 1
# endif
#endif
#endif /* _WX_DFB_CHKCONF_H_ */

View File

@@ -331,6 +331,16 @@
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_BASE64 1
// Set this to 1 to be able to use wxEventLoop even in console applications
// (i.e. using base library only, without GUI). This is mostly useful for
// processing socket events but is also necessary to use timers in console
// applications
//
// Default is 1.
//
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_CONSOLE_EVENTLOOP 1
// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level
// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions.
//

View File

@@ -330,6 +330,16 @@
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_BASE64 1
// Set this to 1 to be able to use wxEventLoop even in console applications
// (i.e. using base library only, without GUI). This is mostly useful for
// processing socket events but is also necessary to use timers in console
// applications
//
// Default is 1.
//
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_CONSOLE_EVENTLOOP 1
// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level
// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions.
//

View File

@@ -330,6 +330,16 @@
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_BASE64 1
// Set this to 1 to be able to use wxEventLoop even in console applications
// (i.e. using base library only, without GUI). This is mostly useful for
// processing socket events but is also necessary to use timers in console
// applications
//
// Default is 1.
//
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_CONSOLE_EVENTLOOP 1
// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level
// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions.
//

View File

@@ -330,6 +330,16 @@
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_BASE64 1
// Set this to 1 to be able to use wxEventLoop even in console applications
// (i.e. using base library only, without GUI). This is mostly useful for
// processing socket events but is also necessary to use timers in console
// applications
//
// Default is 1.
//
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_CONSOLE_EVENTLOOP 1
// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level
// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions.
//

View File

@@ -330,6 +330,16 @@
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_BASE64 1
// Set this to 1 to be able to use wxEventLoop even in console applications
// (i.e. using base library only, without GUI). This is mostly useful for
// processing socket events but is also necessary to use timers in console
// applications
//
// Default is 1.
//
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_CONSOLE_EVENTLOOP 1
// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level
// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions.
//

View File

@@ -330,6 +330,16 @@
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_BASE64 1
// Set this to 1 to be able to use wxEventLoop even in console applications
// (i.e. using base library only, without GUI). This is mostly useful for
// processing socket events but is also necessary to use timers in console
// applications
//
// Default is 1.
//
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_CONSOLE_EVENTLOOP 1
// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level
// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions.
//

View File

@@ -13,6 +13,8 @@
#include "wx/defs.h"
#if wxUSE_SELECT_DISPATCHER
#include <sys/types.h>
#include "wx/private/fdiodispatcher.h"
@@ -111,5 +113,6 @@ private:
int m_maxFD;
};
#endif // wxUSE_SELECT_DISPATCHER
#endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_

View File

@@ -326,6 +326,16 @@
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_BASE64 1
// Set this to 1 to be able to use wxEventLoop even in console applications
// (i.e. using base library only, without GUI). This is mostly useful for
// processing socket events but is also necessary to use timers in console
// applications
//
// Default is 1.
//
// Recommended setting: 1 (but can be safely disabled if you don't use it)
#define wxUSE_CONSOLE_EVENTLOOP 1
// Set wxUSE_(F)FILE to 1 to compile wx(F)File classes. wxFile uses low level
// POSIX functions for file access, wxFFile uses ANSI C stdio.h functions.
//

View File

@@ -19,7 +19,9 @@
class WXDLLEXPORT wxConsoleAppTraits : public wxConsoleAppTraitsBase
{
public:
#if wxUSE_CONSOLE_EVENTLOOP
virtual wxEventLoopBase *CreateEventLoop();
#endif // wxUSE_CONSOLE_EVENTLOOP
virtual bool CreateEndProcessPipe(wxExecuteData& execData);
virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd);
virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData);

22
include/wx/unix/chkconf.h Normal file
View File

@@ -0,0 +1,22 @@
/*
* Name: wx/unix/chkconf.h
* Purpose: Unix-specific config settings consistency checks
* Author: Vadim Zeitlin
* Created: 2007-07-14
* RCS-ID: $Id$
* Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org>
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#if wxUSE_CONSOLE_EVENTLOOP
# if !wxUSE_SELECT_DISPATCHER && !wxUSE_EPOLL_DISPATCHER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxSelect/EpollDispatcher needed for console event loop"
# else
# undef wxUSE_SELECT_DISPATCHER
# define wxUSE_SELECT_DISPATCHER 1
# endif
# endif
#endif /* wxUSE_CONSOLE_EVENTLOOP */

View File

@@ -11,6 +11,8 @@
#ifndef _WX_UNIX_EVTLOOP_H_
#define _WX_UNIX_EVTLOOP_H_
#if wxUSE_CONSOLE_EVENTLOOP
#include "wx/private/fdiodispatcher.h"
#include "wx/unix/pipe.h"
@@ -67,4 +69,6 @@ private:
DECLARE_NO_COPY_CLASS(wxConsoleEventLoop)
};
#endif // wxUSE_CONSOLE_EVENTLOOP
#endif // _WX_UNIX_EVTLOOP_H_

View File

@@ -13,7 +13,7 @@
#include "wx/defs.h"
#ifdef HAVE_SYS_EPOLL_H
#ifdef wxUSE_EPOLL_DISPATCHER
#include "wx/private/fdiodispatcher.h"
@@ -42,6 +42,6 @@ private:
int m_epollDescriptor;
};
#endif // HAVE_SYS_EPOLL_H
#endif // wxUSE_EPOLL_DISPATCHER
#endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_

View File

@@ -14,10 +14,18 @@
#ifndef _WX_X11_CHKCONF_H_
#define _WX_X11_CHKCONF_H_
/* wxPalette is always needed */
#if !wxUSE_PALETTE
# error "wxX11 requires wxUSE_PALETTE=1"
#endif
#if wxUSE_SOCKETS && !wxUSE_SELECT_DISPATCHER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxSocket requires wxSelectDispatcher in wxX11"
# else
# undef wxUSE_SELECT_DISPATCHER
# define wxUSE_SELECT_DISPATCHER 1
# endif
#endif
#endif /* _WX_X11_CHKCONF_H_ */

View File

@@ -217,6 +217,8 @@
#define wxUSE_BASE64 0
#define wxUSE_CONSOLE_EVENTLOOP 0
#define wxUSE_FILE 0
#define wxUSE_FFILE 0
@@ -544,6 +546,12 @@
/* --- end common options --- */
/*
* Unix-specific options
*/
#define wxUSE_SELECT_DISPATCHER 0
#define wxUSE_EPOLL_DISPATCHER 0
/* for some features we don't have dedicated configure switches, so just choose
* the common values automatically */
#if (defined(__WIN32__) && !defined(__WXUNIVERSAL__)) || defined(__WXPM__)

View File

@@ -19,7 +19,7 @@
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_SOCKETS
#if wxUSE_SOCKETS && wxUSE_SELECT_DISPATCHER
#include "wx/private/gsocketiohandler.h"
#include "wx/unix/private.h"

View File

@@ -19,6 +19,8 @@
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_SELECT_DISPATCHER
#include "wx/private/selectdispatcher.h"
#include "wx/module.h"
#include "wx/timer.h"
@@ -290,3 +292,4 @@ private:
IMPLEMENT_DYNAMIC_CLASS(wxSelectDispatcherModule, wxModule)
#endif // wxUSE_SELECT_DISPATCHER

View File

@@ -95,8 +95,11 @@ wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer)
#endif // wxUSE_TIMER
#if wxUSE_CONSOLE_EVENTLOOP
wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop()
{
return new wxEventLoop();
}
#endif // wxUSE_CONSOLE_EVENTLOOP

View File

@@ -19,7 +19,7 @@
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef HAVE_SYS_EPOLL_H
#ifdef wxUSE_EPOLL_DISPATCHER
#include "wx/unix/private/epolldispatcher.h"
#include "wx/unix/private.h"
@@ -210,4 +210,4 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxEpollDispatcherModule, wxModule)
#endif // HAVE_SYS_EPOLL_H
#endif // wxUSE_EPOLL_DISPATCHER

View File

@@ -19,7 +19,7 @@
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/evtloop.h"
#if wxUSE_CONSOLE_EVENTLOOP
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -27,6 +27,7 @@
#endif
#include <errno.h>
#include "wx/evtloop.h"
#include "wx/thread.h"
#include "wx/module.h"
#include "wx/unix/private/timer.h"
@@ -35,10 +36,6 @@
#define TRACE_EVENTS _T("events")
//this code should not be compiled when GUI is defined
//(monolithic build issue)
#if !wxUSE_GUI
// ===========================================================================
// wxEventLoop::PipeIOHandler implementation
// ===========================================================================
@@ -128,13 +125,13 @@ wxConsoleEventLoop::wxConsoleEventLoop()
return;
}
#ifdef HAVE_SYS_EPOLL_H
#ifdef wxUSE_EPOLL_DISPATCHER
m_dispatcher = wxEpollDispatcher::Get();
if ( !m_dispatcher )
#endif // HAVE_SYS_EPOLL_H
{
#endif // wxUSE_EPOLL_DISPATCHER
#if wxUSE_SELECT_DISPATCHER
m_dispatcher = wxSelectDispatcher::Get();
}
#endif // wxUSE_WCHAR_T
wxCHECK_RET( m_dispatcher, _T("failed to create IO dispatcher") );
@@ -194,4 +191,4 @@ void wxConsoleEventLoop::OnNextIteration()
wxTheApp->CheckSignal();
}
#endif // !wxUSE_GUI
#endif // wxUSE_CONSOLE_EVENTLOOP

View File

@@ -334,6 +334,7 @@ wx/zstream.h
wx/unix/app.h
wx/unix/apptbase.h
wx/unix/apptrait.h
wx/unix/chkconf.h
wx/unix/execute.h
wx/unix/evtloop.h
wx/unix/mimetype.h

View File

@@ -237,6 +237,7 @@ wx/zstream.h
wx/unix/app.h
wx/unix/apptbase.h
wx/unix/apptrait.h
wx/unix/chkconf.h
wx/unix/execute.h
wx/unix/evtloop.h
wx/unix/mimetype.h

View File

@@ -262,6 +262,7 @@ wx/zstream.h
wx/unix/app.h
wx/unix/apptbase.h
wx/unix/apptrait.h
wx/unix/chkconf.h
wx/unix/execute.h
wx/unix/evtloop.h
wx/unix/mimetype.h