commit 330b4fbf5caddba022b1d86676c839ba31ecaa8e
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Sun Apr 20 20:20:25 2014 +0200

    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.

diff --git a/configure.ac b/configure.ac
index 1fe6d9d..1dcb8fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
 
diff --git a/src/Makefile.am b/src/Makefile.am
index ea5ca42..2a98643 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 2a8b39e..ce5b355 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -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()
 
diff --git a/src/tests/boost.cpp b/src/tests/boost.cpp
new file mode 100644
index 0000000..426263b
--- /dev/null
+++ b/src/tests/boost.cpp
@@ -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
diff --git a/src/tests/dummy_functions.cpp b/src/tests/dummy_functions.cpp
new file mode 100644
index 0000000..5a99081
--- /dev/null
+++ b/src/tests/dummy_functions.cpp
@@ -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();
+       }
+
+}

Reply via email to