From 86ae7dad3fc1cad3744663d0da8034625dc9ffb1 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 6 Apr 2017 13:48:32 +0200 Subject: [PATCH] Require automake 1.14 and autoconf 2.65 This allows to fix distclean properly, since we know that subdir-objects is used. When it is the case, it is not a good idea for a Makefile to use a source file which is under the control of another one. This could not be made to work work with old automake versions (<1.14). Therefore we refer directly to object files in Makefile.am instead of source files. The actually leads to less compilation in tex2lyx. Update the code here and there to remove compatibility hacks. Update documentation. Re-enable the layout test and fix the Length test, which was ovewriting memory in test_inPixels() because lyxrc did not had a correct layout. --- INSTALL | 4 +- autogen.sh | 12 ++--- configure.ac | 15 ++---- src/Makefile.am | 90 +++++++++++++++++++---------------- src/tests/dummy_functions.cpp | 67 ++++++++++++++++++++++++++ src/tex2lyx/Makefile.am | 50 +++++++++---------- 6 files changed, 154 insertions(+), 84 deletions(-) create mode 100644 src/tests/dummy_functions.cpp diff --git a/INSTALL b/INSTALL index 5e75f612b4..8d3b609c76 100644 --- a/INSTALL +++ b/INSTALL @@ -36,8 +36,8 @@ Note for Git checkouts ----------------------------- If you have checked this out from Git, you need to have: -* automake (supported versions are 1.8--1.15) -* autoconf (supported versions are 2.60--2.69) +* automake (supported versions are 1.14--1.15) +* autoconf (supported versions are 2.65--2.69) Then type "./autogen.sh" to build the needed configuration files and proceed as stated above/below. diff --git a/autogen.sh b/autogen.sh index b58c27bf8e..2cacc5c413 100755 --- a/autogen.sh +++ b/autogen.sh @@ -11,16 +11,16 @@ automake_version=`$AUTOMAKE --version 2>/dev/null | head -n 1` test "$automake_version" != "" && { echo "Using $automake_version" } || { - echo "LyX requires automake >= 1.8" + echo "LyX requires automake >= 1.14" exit 1 } case $automake_version in - *' '1.[8-9]*|*' '1.1[012345]*) + *' '1.1[45]*) ;; *) echo "This automake version is not supported by LyX." - echo "LyX only supports automake 1.8 to 1.15." + echo "LyX only supports automake 1.14 to 1.15." exit 1 ;; esac @@ -31,16 +31,16 @@ autoversion=`$AUTOCONF --version 2>/dev/null | head -n 1` test "$autoversion" != "" && { echo "Using $autoversion" } || { - echo "LyX requires autoconf >= 2.60" + echo "LyX requires autoconf >= 2.65" exit 1 } case $autoversion in - *' '2.60[ab]|*' '2.6[0-9]) + *' '2.6[5-9]) ;; *) echo "This autoconf version is not supported by LyX." - echo "LyX only supports autoconf 2.60-2.69." + echo "LyX only supports autoconf 2.65-2.69." exit 1 ;; esac diff --git a/configure.ac b/configure.ac index 694ddc48fb..5df8aa8111 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(LyX,2.3.0dev,[lyx-devel@lists.lyx.org],[lyx]) AC_PRESERVE_HELP_ORDER # Use ISO format only. The frontend needs to parse this AC_SUBST(LYX_DATE, ["2016-04-16"]) -AC_PREREQ(2.60) +AC_PREREQ(2.65) AC_CONFIG_SRCDIR(src/main.cpp) AC_CONFIG_HEADERS([config.h]) @@ -26,17 +26,12 @@ if test "${enable_maintainer_mode+set}" != set; then enable_maintainer_mode=$lyx_devel_version fi AM_MAINTAINER_MODE - -save_PACKAGE=$PACKAGE -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_SILENT_RULES([yes]) # Automake is pulling the historical V7 format. This tar format supports # file names only up to 99 characters. tar-ustar selects the ustar format defined # by POSIX 1003.1-1988. This format is believed to be old enough to be portable. -AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8 tar-ustar] LYX_OBJECTS_LAYOUT) -m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) +save_PACKAGE=$PACKAGE +AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8 tar-ustar subdir-objects]) PACKAGE=$save_PACKAGE # Allow to build some parts of the code as one big chunk @@ -72,7 +67,7 @@ LYX_PATH_PYTHON23([2.7.0], [3.3.0]) AM_PATH_PYTHON # Tools for creating libraries (note that we do not use libtool) -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl AM_PROG_AR requires automake 1.12 +AM_PROG_AR AC_PROG_RANLIB dnl Recent debian/ubuntu (at least) have built 'ar' so that deterministic mode is the default. dnl This means that it does not make sense to use the 'u' flag (default ARFLAGS is 'cru'). diff --git a/src/Makefile.am b/src/Makefile.am index 9576076d12..a0b2ebe2c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -705,13 +705,16 @@ endif EXTRA_DIST += \ tests/test_ExternalTransforms \ tests/test_ListingsCaption \ + tests/test_layout \ + tests/test_Length \ tests/regfiles/ExternalTransforms \ tests/regfiles/Length \ tests/regfiles/ListingsCaption \ - tests/test_layout \ - tests/test_Length + tests/dummy_functions.cpp \ + tests/boost.cpp -TESTS = tests/test_ExternalTransforms tests/test_Length tests/test_ListingsCaption +TESTS = tests/test_ExternalTransforms tests/test_ListingsCaption \ + tests/test_layout tests/test_Length alltests: check alltests-recursive @@ -737,58 +740,63 @@ if INSTALL_MACOSX ADD_FRAMEWORKS = -framework QtGui -framework QtCore -framework AppKit -framework ApplicationServices endif -check_layout_CPPFLAGS = $(AM_CPPFLAGS) -check_layout_LDADD = support/liblyxsupport.a CiteEnginesList.o $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ +TESTS_LIBS = support/liblyxsupport.a \ + $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ $(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) + +check_layout_CPPFLAGS = $(AM_CPPFLAGS) +check_layout_LDADD = $(check_layout_LYX_OBJS) $(TESTS_LIBS) check_layout_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_layout_SOURCES = \ - 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 \ - support/tests/dummy_functions.cpp \ - tests/check_layout.cpp \ - tests/boost.cpp + tests/check_layout.cpp +check_layout_LYX_OBJS = \ + insets/InsetLayout.o \ + CiteEnginesList.o \ + Color.o \ + Counters.o \ + Floating.o \ + FloatList.o \ + FontInfo.o \ + Layout.o \ + LayoutFile.o \ + Lexer.o \ + ModuleList.o \ + Spacing.o \ + TextClass.o \ + tests/dummy_functions.o \ + tests/boost.o check_ExternalTransforms_CPPFLAGS = $(AM_CPPFLAGS) -check_ExternalTransforms_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ - $(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) +check_ExternalTransforms_LDADD = $(check_ExternalTransforms_LYX_OBJS) $(TESTS_LIBS) check_ExternalTransforms_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_ExternalTransforms_SOURCES = \ - graphics/GraphicsParams.cpp \ - insets/ExternalTransforms.cpp \ - Length.cpp \ - lengthcommon.cpp \ - support/tests/dummy_functions.cpp \ - tests/check_ExternalTransforms.cpp \ - tests/boost.cpp + tests/check_ExternalTransforms.cpp +check_ExternalTransforms_LYX_OBJS = \ + tests/dummy_functions.o \ + tests/boost.o \ + graphics/GraphicsParams.o \ + insets/ExternalTransforms.o \ + Length.o \ + lengthcommon.o check_Length_CPPFLAGS = $(AM_CPPFLAGS) -check_Length_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ - $(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) +check_Length_LDADD = $(check_Length_LYX_OBJS) $(TESTS_LIBS) check_Length_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_Length_SOURCES = \ - Length.cpp \ - lengthcommon.cpp \ - support/tests/dummy_functions.cpp \ - tests/check_Length.cpp \ - tests/boost.cpp + tests/check_Length.cpp +check_Length_LYX_OBJS = \ + tests/dummy_functions.o \ + tests/boost.o \ + Length.o \ + lengthcommon.o check_ListingsCaption_CPPFLAGS = $(AM_CPPFLAGS) -check_ListingsCaption_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ - $(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) +check_ListingsCaption_LDADD = $(check_ListingsCaption_LYX_OBJS) $(TESTS_LIBS) check_ListingsCaption_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_ListingsCaption_SOURCES = \ - support/tests/dummy_functions.cpp \ - tests/check_ListingsCaption.cpp \ - tests/boost.cpp + tests/check_ListingsCaption.cpp +check_ListingsCaption_LYX_OBJS = \ + tests/dummy_functions.o \ + tests/boost.o .PHONY: alltests alltests-recursive updatetests diff --git a/src/tests/dummy_functions.cpp b/src/tests/dummy_functions.cpp new file mode 100644 index 0000000000..0384b6efa0 --- /dev/null +++ b/src/tests/dummy_functions.cpp @@ -0,0 +1,67 @@ +#include + +#include "Format.h" +#include "LyXRC.h" + +#include "support/Messages.h" + +using namespace std; + +namespace lyx { + // Dummy verbose support + bool verbose = false; + + // Dummy LyXRC support + LyXRC::LyXRC() {} + LyXRC 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; + } + + // Dummy formats support (needed by Lexer) + Formats & theFormats() + { + static Formats dummy_formats; + return dummy_formats; + } + + string alignmentToCSS(LyXAlignment) + { + return string(); + } + + // + // Dummy FontMetrics (needed by Length) + // + namespace frontend { + class FontMetrics { + int em() const { return 0; }; + }; + } + + class FontInfo; + + frontend::FontMetrics const & theFontMetrics(FontInfo const &) { + static frontend::FontMetrics dummy; + return dummy; + } +} diff --git a/src/tex2lyx/Makefile.am b/src/tex2lyx/Makefile.am index a4a5fdc65f..7089ea420c 100644 --- a/src/tex2lyx/Makefile.am +++ b/src/tex2lyx/Makefile.am @@ -81,33 +81,32 @@ alltests-recursive: tex2lyx updatetests: tex2lyx $(PYTHON) "$(srcdir)/test/runtests.py" ./tex2lyx "$(top_srcdir)/lib/scripts" "$(srcdir)/test" -LINKED_FILES = \ - ../Author.cpp \ - ../CiteEnginesList.cpp \ - ../Color.cpp \ - ../Counters.cpp \ - ../Encoding.cpp \ - ../FloatList.cpp \ - ../Floating.cpp \ - ../FontInfo.cpp \ - ../graphics/GraphicsParams.cpp \ - ../insets/ExternalTemplate.cpp \ - ../insets/ExternalTransforms.cpp \ - ../insets/InsetLayout.cpp \ - ../LaTeXPackages.cpp \ - ../Layout.cpp \ - ../LayoutFile.cpp \ - ../LayoutModuleList.cpp \ - ../Length.cpp \ - ../lengthcommon.cpp \ - ../Lexer.cpp \ - ../ModuleList.cpp \ - ../Spacing.cpp \ - ../TextClass.cpp \ - ../version.cpp +LYX_OBJS = \ + ../Author.o \ + ../CiteEnginesList.o \ + ../Color.o \ + ../Counters.o \ + ../Encoding.o \ + ../FloatList.o \ + ../Floating.o \ + ../FontInfo.o \ + ../graphics/GraphicsParams.o \ + ../insets/ExternalTemplate.o \ + ../insets/ExternalTransforms.o \ + ../insets/InsetLayout.o \ + ../LaTeXPackages.o \ + ../Layout.o \ + ../LayoutFile.o \ + ../LayoutModuleList.o \ + ../Length.o \ + ../lengthcommon.o \ + ../Lexer.o \ + ../ModuleList.o \ + ../Spacing.o \ + ../TextClass.o \ + ../version.o tex2lyx_SOURCES = \ - $(LINKED_FILES) \ boost.cpp \ Context.cpp \ Context.h \ @@ -123,6 +122,7 @@ tex2lyx_SOURCES = \ text.cpp tex2lyx_LDADD = \ + $(LYX_OBJS) \ $(top_builddir)/src/support/liblyxsupport.a \ $(LIBICONV) $(BOOST_LIBS) \ $(QT_LIB) $(QT_LDFLAGS) \