Use subdir-objects for automake 1.14 or newer

This option is going to be mandatory starting with automake 2.0.
LyX is able to use this since version 2.1, but it turns out that it is
badly implemented in versions of automake older than 1.14.

We rely on some (undocumented) symbol to detect automake 1.14 and
use the subdirs-objects option in this case.

For more details, see:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg181023.html

Making everything work with autotools required making a copy of two
files from support/tests. It seems that we should not point to source files
that are handled by another Makefile.am.
This commit is contained in:
Jean-Marc Lasgouttes 2014-04-20 20:20:25 +02:00 committed by Richard Heck
parent f83aab43e5
commit 6c8a775c73
5 changed files with 82 additions and 4 deletions

View File

@ -27,7 +27,11 @@ fi
AM_MAINTAINER_MODE
save_PACKAGE=$PACKAGE
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8])
dnl The test for _AM_PROG_CC_C_O intends to test for automake 1.14 or newer,
dnl which are the versions where subdir-objects can beused.
dnl see: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg181023.html
m4_define([LYX_OBJECTS_LAYOUT], m4_ifdef([_AM_PROG_CC_C_O],[subdir-objects],))
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8] LYX_OBJECTS_LAYOUT)
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
PACKAGE=$save_PACKAGE

View File

@ -708,7 +708,7 @@ check_layout_SOURCES = \
Spacing.cpp \
TextClass.cpp \
tests/check_layout.cpp \
support/tests/boost.cpp \
support/tests/dummy_functions.cpp
tests/boost.cpp \
tests/dummy_functions.cpp
.PHONY: alltests alltests-recursive updatetests

View File

@ -8,7 +8,7 @@ set(check_layout_SOURCES)
foreach(_f insets/InsetLayout.cpp Color.cpp Counters.cpp Floating.cpp
FloatList.cpp FontInfo.cpp Layout.cpp LayoutFile.cpp Lexer.cpp
ModuleList.cpp Spacing.cpp TextClass.cpp tests/check_layout.cpp
support/tests/boost.cpp support/tests/dummy_functions.cpp)
tests/boost.cpp tests/dummy_functions.cpp)
list(APPEND check_layout_SOURCES "${TOP_SRC_DIR}/src/${_f}")
endforeach()

36
src/tests/boost.cpp Normal file
View File

@ -0,0 +1,36 @@
/**
* \file boost.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "support/lassert.h"
#include <cstdlib>
#include <exception>
using namespace std;
namespace boost {
#ifndef BOOST_NO_EXCEPTIONS
void throw_exception(exception const & /*e*/)
{
LASSERT(false, /**/);
}
#endif
void assertion_failed(char const * /*expr*/, char const * /*function*/,
char const * /*file*/, long /*line*/)
{
::abort();
}
} // namespace boost

View File

@ -0,0 +1,38 @@
#include <config.h>
#include "../Messages.h"
using namespace std;
namespace lyx {
// Dummy LyXRC support
class LyXRC { string icon_set; } lyxrc;
// Dummy LyXAlignment support
enum LyXAlignment {
DUMMY
};
// Keep the linker happy on Windows
void lyx_exit(int) {}
// Dummy language support
Messages const & getGuiMessages()
{
static Messages lyx_messages;
return lyx_messages;
}
Messages const & getMessages(string const &)
{
static Messages lyx_messages;
return lyx_messages;
}
string alignmentToCSS(LyXAlignment)
{
return string();
}
}