Fully enable compilation of LyX 1.4.x on Windows with MinGW/MinSYS.

Break compilation with MSVC. See accompanying mail on the lyx-devel list.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9895 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2005-05-02 13:35:30 +00:00
parent b52587a650
commit 201e5bdf70
25 changed files with 360 additions and 216 deletions

View File

@ -1,3 +1,12 @@
2005-05-02 Angus Leeming <leeming@lyx.org>
* autogen.sh (ACINCLUDE_FILES): remove [ap]spell.m4. Add spell.m4.
* configure.ac: remove explicit invocation of CHECK_WITH_ASPELL,
CHECK_WITH_PSPELL. Add new invocation of LYX_CHECK_SPELL_ENGINES.
Also check for select() and socket() system functions and use
these to decide whether to build the src/client sun-directory.
2005-03-11 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* configure.ac: remove hack when GNU gettext utilities are not

View File

@ -4,7 +4,7 @@ ACLOCAL="aclocal -I ${PWD}/m4"
AUTOHEADER="autoheader"
AUTOMAKE="automake -a -c --foreign"
AUTOCONF="autoconf"
ACINCLUDE_FILES="lyxinclude.m4 libtool.m4 xforms.m4 qt.m4 gtk--.m4 gnome--.m4 gnome.m4 aspell.m4 pspell.m4 cygwin.m4 pkg.m4"
ACINCLUDE_FILES="lyxinclude.m4 libtool.m4 xforms.m4 qt.m4 gtk--.m4 gnome--.m4 gnome.m4 spell.m4 cygwin.m4 pkg.m4"
# Discover what version of automake we are using.
automake_version=`$AUTOMAKE --version 2>/dev/null | head -n 1`

View File

@ -1,3 +1,9 @@
2005-05-02 Angus Leeming <leeming@lyx.org>
* aspell.m4, pspell.m4: removed.
* spell.m4: new. Incorporates the code in [ap]spell but also adds
a test for whether the ISpell-handling code should be compiled.
2005-04-22 Angus Leeming <leeming@lyx.org>
* qt.m4: Move the Qt-specific preprocessor flags out of the

View File

@ -1,30 +0,0 @@
# Macro to add for using aspell spellchecker libraries! -*- sh -*-
# Only checks for "new" aspell, > 0.50
AC_DEFUN([CHECK_WITH_ASPELL],
[
AC_ARG_WITH(aspell,
AC_HELP_STRING([--with-aspell],[use ASpell libraries]),
[
case "$withval" in
y*) USING_ASPELL="yes";;
*) USING_ASPELL="no";;
esac
],
[
USING_ASPELL="yes"
])
if test "$USING_ASPELL" = "yes" ; then
AC_CHECK_HEADERS(aspell.h aspell/aspell.h, USING_ASPELL="yes", USING_ASPELL="no")
AC_CHECK_LIB(aspell, new_aspell_config, LIBS="-laspell $LIBS"; USING_ASPELL="yes", USING_ASPELL="no")
if test "$USING_ASPELL" = "yes"; then
AC_DEFINE(USE_ASPELL, 1, [Define as 1 to use the aspell library])
lyx_flags="$lyx_flags use-aspell"
fi
fi
AC_MSG_CHECKING([whether to use aspell])
AC_MSG_RESULT($USING_ASPELL)
])

View File

@ -1,29 +0,0 @@
# Macro to add for using pspell spellchecker libraries! -*- sh -*-
# @author@: Jürgen Vigna
AC_DEFUN([CHECK_WITH_PSPELL],
[
AC_ARG_WITH(pspell,
AC_HELP_STRING([--with-pspell],[use PSpell libraries]),
[
case "$withval" in
y*) USING_PSPELL="yes";;
*) USING_PSPELL="no";;
esac
],
[
USING_PSPELL="yes"
])
if test "$USING_PSPELL" = "yes" ; then
AC_CHECK_HEADERS(pspell/pspell.h, USING_PSPELL="yes", USING_PSPELL="no")
AC_CHECK_LIB(pspell, main, LIBS="-lpspell $LIBS"; USING_PSPELL="yes", USING_PSPELL="no")
if test "$USING_PSPELL" = "yes"; then
AC_DEFINE(USE_PSPELL, 1, [Define as 1 to use the pspell library])
lyx_flags="$lyx_flags use-pspell"
fi
fi
AC_MSG_CHECKING([whether to use pspell])
AC_MSG_RESULT($USING_PSPELL)
])

82
config/spell.m4 Normal file
View File

@ -0,0 +1,82 @@
# Macro to add for using aspell spellchecker libraries! -*- sh -*-
# Only checks for "new" aspell, > 0.50
AC_DEFUN([CHECK_WITH_ASPELL],
[
lyx_use_aspell=true
AC_ARG_WITH(aspell, AC_HELP_STRING([--with-aspell],[use ASpell libraries]))
test "$with_aspell" = "no" && lyx_use_aspell=false
if $lyx_use_aspell ; then
AC_CHECK_HEADERS(aspell.h aspell/aspell.h,
[lyx_use_aspell=true; break;],
[lyx_use_aspell=false])
AC_CHECK_LIB(aspell, new_aspell_config, LIBS="-laspell $LIBS", lyx_use_aspell=false)
AC_MSG_CHECKING([whether to use aspell])
if $lyx_use_aspell ; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_ASPELL, 1, [Define as 1 to use the aspell library])
lyx_flags="$lyx_flags use-aspell"
else
AC_MSG_RESULT(no)
fi
fi
])
# Macro to add for using pspell spellchecker libraries! -*- sh -*-
# @author@: Jürgen Vigna
AC_DEFUN([CHECK_WITH_PSPELL],
[
lyx_use_pspell=true
AC_ARG_WITH(pspell, AC_HELP_STRING([--with-pspell],[use PSpell libraries]))
test "$with_pspell" = "no" && lyx_use_pspell=false
if $lyx_use_pspell ; then
AC_CHECK_HEADERS(pspell/pspell.h,, lyx_use_pspell=false)
AC_CHECK_LIB(pspell, main, LIBS="-lpspell $LIBS", lyx_use_pspell=false)
AC_MSG_CHECKING([whether to use pspell])
if $lyx_use_pspell ; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_PSPELL, 1, [Define as 1 to use the pspell library])
lyx_flags="$lyx_flags use-pspell"
else
AC_MSG_RESULT(no)
fi
fi
])
### Check if we want spell libraries, prefer new aspell
AC_DEFUN([LYX_CHECK_SPELL_ENGINES],
[
lyx_use_aspell=false
lyx_use_pspell=false
lyx_use_ispell=false
dnl Prefer use of the aspell library over pspell.
CHECK_WITH_ASPELL
if $lyx_use_aspell ; then : ; else
CHECK_WITH_PSPELL
fi
dnl check for the ability to communicate through unix pipes
dnl with an external ispell process.
dnl Do this independent of the existence of the aspell, pspell libraries.
lyx_use_ispell=true
AC_LANG_PUSH(C)
AC_CHECK_FUNCS(select dup2,, [lyx_use_ispell=false])
AC_LANG_POP(C)
AC_MSG_CHECKING([whether to use ispell])
if $lyx_use_ispell ; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_ISPELL, 1, [Define as 1 to use an external ispell process for spell-checking])
lyx_flags="$lyx_flags use-ispell"
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(USE_ASPELL, $lyx_use_aspell)
AM_CONDITIONAL(USE_PSPELL, $lyx_use_pspell)
AM_CONDITIONAL(USE_ISPELL, $lyx_use_ispell)
])

View File

@ -132,12 +132,6 @@ AC_LIBTOOL_WIN32_DLL
#AM_PROG_LIBTOOL
LYX_PROG_LIBTOOL
### Check if we want spell libraries, prefer new aspell
CHECK_WITH_ASPELL
if test "$USING_ASPELL" != "yes"; then
CHECK_WITH_PSPELL
fi
### Check for some Cygwin-specific details.
CHECK_WITH_CYGWIN
@ -291,6 +285,15 @@ AC_LANG_PUSH(C)
AC_CHECK_FUNCS(mkfifo mkstemp mktemp lstat readlink)
AC_LANG_POP(C)
LYX_CHECK_SPELL_ENGINES
lyx_client_subdir=true
AC_LANG_PUSH(C)
AC_CHECK_FUNCS(select socket,, [lyx_client_subdir=false])
AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
AC_LANG_POP(C)
AC_FUNC_SELECT_ARGTYPES
### Some information on what just happened

View File

@ -1,3 +1,7 @@
2005-05-02 Angus Leeming <leeming@lyx.org>
* po/POTFILES.in: src/SpellBase.C now contains a translatable string.
2005-04-28 Michael Schmitt <michael.schmitt@teststep.org>
* Makefile.in.in: remove duplicate lines

View File

@ -6,6 +6,7 @@ src/CutAndPaste.C
src/LColor.C
src/LaTeX.C
src/MenuBackend.C
src/SpellBase.C
src/buffer.C
src/buffer_funcs.C
src/bufferlist.C

View File

@ -1,3 +1,20 @@
2005-05-02 Angus Leeming <leeming@lyx.org>
* lyx_cb.C: artificially define fork() on Windows as a no-op failing
function so that suto-saving works, albeit in a blocking manner.
* Makefile.am: make compilation of the client sub directory, of
apsellC, aspell_local.h, pspell.[Ch] and ispell.[Ch] dependent
on conditionals set at configure time.
* SpellBase.[Ch]: no longer an abstract base class. Instead,
it can be compiled in its own right but has no-op functionality.
* aspell.C, pspell.C: remove preprocessor guards. The files should
be compiled only if the necessary functionality exists.
* lyxserver.C, lyxsocket.C: disable on Windows.
2005-05-01 Martin Vermeer <martin.vermeer@hut.fi>
* text.C (leftMargin): Fix the parindent use bug (1764)

View File

@ -4,7 +4,11 @@ DISTCLEANFILES += config.h libintl.h version.C stamp-version version.C-tmp
MAINTAINERCLEANFILES += $(srcdir)/config.h.in
SUBDIRS = mathed insets graphics support frontends . client tex2lyx
if BUILD_CLIENT_SUBDIR
CLIENT = client
endif
SUBDIRS = mathed insets graphics support frontends . $(CLIENT) tex2lyx
EXTRA_DIST = config.h.in stamp-h.in version.C.in \
Sectioning.h \
@ -51,6 +55,18 @@ BUILT_SOURCES = version.C
AM_CPPFLAGS = $(PCH_FLAGS) $(BOOST_INCLUDES)
if USE_ASPELL
ASPELL = aspell.C aspell_local.h
endif
if USE_PSPELL
PSPELL = pspell.C pspell.h
endif
if USE_ISPELL
ISPELL = ispell.C ispell.h
endif
lyx_SOURCES = \
Bidi.C \
Bidi.h \
@ -101,8 +117,6 @@ lyx_SOURCES = \
ToolbarBackend.C \
ToolbarBackend.h \
WordLangTuple.h \
aspell.C \
aspell_local.h \
author.C \
author.h \
boost.C \
@ -241,11 +255,8 @@ lyx_SOURCES = \
paragraph_pimpl.h \
pariterator.C \
pariterator.h \
$(ASPELL) $(PSPELL) $(ISPELL) SpellBase.C \
SpellBase.h \
ispell.C \
ispell.h \
pspell.C \
pspell.h \
rowpainter.C \
rowpainter.h \
sgml.C \

49
src/SpellBase.C Normal file
View File

@ -0,0 +1,49 @@
/**
* \file SpellBase.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author unknown
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "SpellBase.h"
#include "gettext.h"
using std::string;
bool SpellBase::alive()
{
return false;
}
SpellBase::Result SpellBase::check(WordLangTuple const &)
{
return UNKNOWN_WORD;
}
void SpellBase::insert(WordLangTuple const &)
{}
void SpellBase::accept(WordLangTuple const &)
{}
string const SpellBase::nextMiss()
{
return string();
}
string const SpellBase::error()
{
return _("Native OS API not yet supported.");
}

View File

@ -20,6 +20,7 @@ class WordLangTuple;
/**
* Base class of all spell checker implementations.
* The class can be instantiated but will have no functionality.
*/
class SpellBase {
public:
@ -43,23 +44,22 @@ public:
virtual ~SpellBase() {}
/// return true if the spellchecker instance still exists
virtual bool alive() = 0;
virtual bool alive();
/// check the given word of the given lang code and return the result
virtual enum Result check(WordLangTuple const &) = 0;
virtual enum Result check(WordLangTuple const &);
/// insert the given word into the personal dictionary
virtual void insert(WordLangTuple const &) = 0;
virtual void insert(WordLangTuple const &);
/// accept the given word temporarily
virtual void accept(WordLangTuple const &) = 0;
virtual void accept(WordLangTuple const &);
/// return the next near miss after a SUGGESTED_WORDS result
virtual std::string const nextMiss() = 0;
virtual std::string const nextMiss();
/// give an error message on messy exit
virtual std::string const error() = 0;
virtual std::string const error();
};
#endif // SPELL_BASE_H

View File

@ -11,8 +11,6 @@
#include <config.h>
#ifdef USE_ASPELL
#include "debug.h"
#include <aspell.h>
@ -144,5 +142,3 @@ string const ASpell::error()
return (err ? err : "");
}
#endif // USE_ASPELL

View File

@ -75,4 +75,4 @@ private:
AspellCanHaveError * spell_error_object;
};
#endif // ASPELL_H
#endif // LYX_ASPELL_H

View File

@ -1,3 +1,8 @@
2005-05-02 Angus Leeming <leeming@lyx.org>
* ControlSpellchecker.C: clean-up the creation of the wrappers to
the different possible spelling engines.
2005-04-29 Martin Vermeer <martin.vermeer@hut.fi>
* ControlCharacter.h (getLFun):Trivial bug fix

View File

@ -23,13 +23,16 @@
#include "lyxrc.h"
#include "paragraph.h"
#include "ispell.h"
#ifdef USE_PSPELL
# include "pspell.h"
#else
#ifdef USE_ASPELL
#if defined(USE_ASPELL)
# include "aspell_local.h"
#elif defined(USE_PSPELL)
# include "pspell.h"
#endif
#if defined(USE_ISPELL)
# include "ispell.h"
#else
# include "SpellBase.h"
#endif
#include "support/textutils.h"
@ -68,19 +71,22 @@ SpellBase * getSpeller(BufferParams const & bp)
? lyxrc.isp_alt_lang
: bp.language->code();
#ifdef USE_ASPELL
#if defined(USE_ASPELL)
if (lyxrc.use_spell_lib)
return new ASpell(bp, lang);
#endif
#ifdef USE_PSPELL
#elif defined(USE_PSPELL)
if (lyxrc.use_spell_lib)
return new PSpell(bp, lang);
#endif
#if defined(USE_ISPELL)
lang = (lyxrc.isp_use_alt_lang) ?
lyxrc.isp_alt_lang : bp.language->lang();
return new ISpell(bp, lang);
#else
return new SpellBase;
#endif
}
} // namespace anon
@ -91,6 +97,8 @@ bool ControlSpellchecker::initialiseParams(std::string const &)
lyxerr[Debug::GUI] << "Spellchecker::initialiseParams" << endl;
speller_.reset(getSpeller(kernel().buffer().params()));
if (!speller_.get())
return false;
// reset values to initial
oldval_ = 0;

View File

@ -44,6 +44,10 @@
#include "support/path.h"
#include "support/systemcall.h"
#ifdef _WIN32
# define fork() -1
#endif
#include <boost/shared_ptr.hpp>
#include <boost/filesystem/operations.hpp>

View File

@ -75,13 +75,39 @@ using std::endl;
using std::string;
// provide an empty mkfifo() if we do not have one. This disables the
// lyxserver.
#ifndef HAVE_MKFIFO
int mkfifo(char const * __path, mode_t __mode) {
return 0;
#if !defined (HAVE_MKFIFO)
// We provide a stub class that disables the lyxserver.
void LyXComm::openConnection()
{}
void LyXComm::closeConnection()
{}
int LyXComm::startPipe(string const & filename, bool write)
{
return -1;
}
#endif
void LyXComm::endPipe(int & fd, string const & filename, bool write)
{}
void LyXComm::emergencyCleanup()
{}
void LyXComm::read_ready()
{}
void LyXComm::send(string const & msg)
{}
#else // defined (HAVE_MKFIFO)
void LyXComm::openConnection()
@ -355,6 +381,8 @@ void LyXComm::send(string const & msg)
#endif
}
#endif // defined (HAVE_MKFIFO)
string const LyXComm::inPipeName() const
{

View File

@ -14,8 +14,66 @@
#include <config.h>
#include <config.h>
#include "lyxsocket.h"
#if !(defined(HAVE_READ) && defined(HAVE_WRITE) && defined(HAVE_CLOSE))
// We provide stub classes to disables the sockets.
LyXServerSocket::LyXServerSocket(LyXFunc *, std::string const &)
{}
LyXServerSocket::~LyXServerSocket()
{}
std::string const & LyXServerSocket::address() const
{
return address_;
}
void LyXServerSocket::serverCallback()
{}
void LyXServerSocket::dataCallback(int)
{}
void LyXServerSocket::writeln(std::string const &)
{}
LyXDataSocket::LyXDataSocket(int)
{}
LyXDataSocket::~LyXDataSocket()
{}
bool LyXDataSocket::connected() const
{
return false;
}
bool LyXDataSocket::readln(std::string &)
{
return false;
}
void LyXDataSocket::writeln(std::string const &)
{}
#else // defined(HAVE_READ) && defined(HAVE_WRITE) && defined(HAVE_CLOSE)
#include "debug.h"
#include "funcrequest.h"
#include "LyXAction.h"
@ -270,3 +328,5 @@ void LyXDataSocket::writeln(string const & line)
connected_ = false;
}
}
#endif // defined(HAVE_READ) && defined(HAVE_WRITE) && defined(HAVE_CLOSE)

View File

@ -11,8 +11,6 @@
#include <config.h>
#ifdef USE_PSPELL
#include "debug.h"
#define USE_ORIGINAL_MANAGER_FUNCS 1
@ -155,5 +153,3 @@ string const PSpell::error()
return err;
return "";
}
#endif // USE_PSPELL

View File

@ -75,4 +75,4 @@ private:
PspellCanHaveError * spell_error_object;
};
#endif // PSPELL_H
#endif // LYX_PSPELL_H

View File

@ -1,3 +1,9 @@
2005-05-02 Angus Leeming <leeming@lyx.org>
* socktool.C (listen, accept): provide stub versions for Windows.
* os_win32.h: removed.
2005-04-29 Angus Leeming <leeming@lyx.org>
* os_win32.C (init): Merge changes from Asger's win32_kludge.diff

View File

@ -1,109 +0,0 @@
// os_win32.h copyright "Ruurd A. Reitsma" <R.A.Reitsma@wbmt.tudelft.nl>
#ifndef _OS_WIN32_H_
#define _OS_WIN32_H_
//Avoid zillions of windows includes
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
// Avoid some very annoying macros from MFC
# undef max
# undef min
#if defined( __SGI_STL_PORT )
namespace std {
// These overloads prevent ambiguity errors when signed and unsigned integers are compared.
inline long min(long x, long y) {return std::min(x, y);}
inline long max(long x, long y) {return std::max(x, y);}
}
#else // defined( __SGI_STL_PORT )
namespace std {
// These overloads prevent ambiguity errors when int, long and unsigned int and int are compared.
inline int min(int x, int y) { return x < y ? x : y; }
inline int max(int x, int y) { return x > y ? x : y; }
inline unsigned int min(unsigned int x, unsigned int y) { return x < y ? x : y; }
inline unsigned int max(unsigned int x, unsigned int y) { return x > y ? x : y; }
inline long min(long x, long y) { return x < y ? x : y; }
inline long max(long x, long y) { return x > y ? x : y; }
inline long min(int x, long y) { return x < y ? x : y; }
inline long max(int x, long y) { return x > y ? x : y; }
inline long min(long x, int y) { return x < y ? x : y; }
inline long max(long x, int y) { return x > y ? x : y; }
inline unsigned long min(unsigned long x, unsigned long y) { return x < y ? x : y; }
inline unsigned long max(unsigned long x, unsigned long y) { return x > y ? x : y; }
inline double min(double x, double y) { return x < y ? x : y; }
inline double max(double x, double y) { return x > y ? x : y; }
}
#endif // defined( __SGI_STL_PORT )
#ifdef __cplusplus
extern "C" {
#endif
//fcntl.h
#define FD_CLOEXEC 1 /* posix */
#define F_DUPFD 0 /* Duplicate fildes */
#define F_GETFD 1 /* Get fildes flags (close on exec) */
#define F_SETFD 2 /* Set fildes flags (close on exec) */
#define F_GETFL 3 /* Get file flags */
#define F_SETFL 4 /* Set file flags */
#define O_NONBLOCK 0x4000
inline int fcntl (int, int, ...) {return -1;}
//unistd.h
inline int fork () {return -1;}
#define pipe(a) _pipe(a,0,0)
//sys/wait.h
#define waitpid(a,b,c) cwait(b,a,c)
#define WNOHANG 1
#define WUNTRACED 2
#define WIFEXITED(a) 0
#define WEXITSTATUS(a) 0
#define WIFSIGNALED(a) 0
#define WTERMSIG(a) 0
#define WIFSTOPPED(a) 0
#define WSTOPSIG(a) 0
//sys/types.h
#define fd_set int
//sys/select.h
//#define select(a,b,c,d,e) -1
#define FD_ZERO(a)
#define FD_SET(a,b)
#define FD_ISSET(fd, set) 0
#ifndef __MINGW32__ //already defined in mingw headers
#define _S_IFBLK 0x3000
#define S_IFIFO _S_IFIFO
#define S_IFBLK _S_IFBLK
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define popen(a,b) _popen(a,b)
#define pclose(a) _pclose(a)
#endif //!__MINGW32
#ifdef __cplusplus
}
#endif
#endif //_OS_WIN32_H_

View File

@ -11,6 +11,31 @@
#include <config.h>
#include "support/socktools.h"
#if !defined (HAVE_SOCKET)
// We provide stubs because we don't (yet?) support the native OS API.
namespace lyx {
namespace support {
namespace socktools {
int listen(std::string const &, int)
{
return -1;
}
int accept(int)
{
return -1;
}
} // namespace socktools
} // namespace support
} // namespace lyx
#else // defined (HAVE_SOCKET)
#include "support/lyxlib.h"
#include "debug.h"
@ -137,3 +162,5 @@ int accept(int sd)
} // namespace socktools
} // namespace support
} // namespace lyx
#endif // defined (HAVE_SOCKET)