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.
This commit is contained in:
Jean-Marc Lasgouttes 2017-04-06 13:48:32 +02:00
parent 3bd49d1f75
commit 86ae7dad3f
6 changed files with 154 additions and 84 deletions

View File

@ -36,8 +36,8 @@ Note for Git checkouts
----------------------------- -----------------------------
If you have checked this out from Git, you need to have: If you have checked this out from Git, you need to have:
* automake (supported versions are 1.8--1.15) * automake (supported versions are 1.14--1.15)
* autoconf (supported versions are 2.60--2.69) * autoconf (supported versions are 2.65--2.69)
Then type "./autogen.sh" to build the needed configuration Then type "./autogen.sh" to build the needed configuration
files and proceed as stated above/below. files and proceed as stated above/below.

View File

@ -11,16 +11,16 @@ automake_version=`$AUTOMAKE --version 2>/dev/null | head -n 1`
test "$automake_version" != "" && { test "$automake_version" != "" && {
echo "Using $automake_version" echo "Using $automake_version"
} || { } || {
echo "LyX requires automake >= 1.8" echo "LyX requires automake >= 1.14"
exit 1 exit 1
} }
case $automake_version in case $automake_version in
*' '1.[8-9]*|*' '1.1[012345]*) *' '1.1[45]*)
;; ;;
*) *)
echo "This automake version is not supported by LyX." 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 exit 1
;; ;;
esac esac
@ -31,16 +31,16 @@ autoversion=`$AUTOCONF --version 2>/dev/null | head -n 1`
test "$autoversion" != "" && { test "$autoversion" != "" && {
echo "Using $autoversion" echo "Using $autoversion"
} || { } || {
echo "LyX requires autoconf >= 2.60" echo "LyX requires autoconf >= 2.65"
exit 1 exit 1
} }
case $autoversion in case $autoversion in
*' '2.60[ab]|*' '2.6[0-9]) *' '2.6[5-9])
;; ;;
*) *)
echo "This autoconf version is not supported by LyX." 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 exit 1
;; ;;
esac esac

View File

@ -4,7 +4,7 @@ AC_INIT(LyX,2.3.0dev,[lyx-devel@lists.lyx.org],[lyx])
AC_PRESERVE_HELP_ORDER AC_PRESERVE_HELP_ORDER
# Use ISO format only. The frontend needs to parse this # Use ISO format only. The frontend needs to parse this
AC_SUBST(LYX_DATE, ["2016-04-16"]) AC_SUBST(LYX_DATE, ["2016-04-16"])
AC_PREREQ(2.60) AC_PREREQ(2.65)
AC_CONFIG_SRCDIR(src/main.cpp) AC_CONFIG_SRCDIR(src/main.cpp)
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
@ -26,17 +26,12 @@ if test "${enable_maintainer_mode+set}" != set; then
enable_maintainer_mode=$lyx_devel_version enable_maintainer_mode=$lyx_devel_version
fi fi
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
AM_SILENT_RULES([yes])
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],))
# Automake is pulling the historical V7 format. This tar format supports # 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 # 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. # 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) save_PACKAGE=$PACKAGE
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8 tar-ustar subdir-objects])
PACKAGE=$save_PACKAGE PACKAGE=$save_PACKAGE
# Allow to build some parts of the code as one big chunk # 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 AM_PATH_PYTHON
# Tools for creating libraries (note that we do not use libtool) # 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 AC_PROG_RANLIB
dnl Recent debian/ubuntu (at least) have built 'ar' so that deterministic mode is the default. 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'). dnl This means that it does not make sense to use the 'u' flag (default ARFLAGS is 'cru').

View File

@ -705,13 +705,16 @@ endif
EXTRA_DIST += \ EXTRA_DIST += \
tests/test_ExternalTransforms \ tests/test_ExternalTransforms \
tests/test_ListingsCaption \ tests/test_ListingsCaption \
tests/test_layout \
tests/test_Length \
tests/regfiles/ExternalTransforms \ tests/regfiles/ExternalTransforms \
tests/regfiles/Length \ tests/regfiles/Length \
tests/regfiles/ListingsCaption \ tests/regfiles/ListingsCaption \
tests/test_layout \ tests/dummy_functions.cpp \
tests/test_Length 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 alltests: check alltests-recursive
@ -737,58 +740,63 @@ if INSTALL_MACOSX
ADD_FRAMEWORKS = -framework QtGui -framework QtCore -framework AppKit -framework ApplicationServices ADD_FRAMEWORKS = -framework QtGui -framework QtCore -framework AppKit -framework ApplicationServices
endif endif
check_layout_CPPFLAGS = $(AM_CPPFLAGS) TESTS_LIBS = support/liblyxsupport.a \
check_layout_LDADD = support/liblyxsupport.a CiteEnginesList.o $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ $(LIBICONV) $(BOOST_LIBS) @LIBS@ \
$(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI) $(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_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
check_layout_SOURCES = \ check_layout_SOURCES = \
insets/InsetLayout.cpp \ tests/check_layout.cpp
Color.cpp \ check_layout_LYX_OBJS = \
Counters.cpp \ insets/InsetLayout.o \
Floating.cpp \ CiteEnginesList.o \
FloatList.cpp \ Color.o \
FontInfo.cpp \ Counters.o \
Layout.cpp \ Floating.o \
LayoutFile.cpp \ FloatList.o \
Lexer.cpp \ FontInfo.o \
ModuleList.cpp \ Layout.o \
Spacing.cpp \ LayoutFile.o \
TextClass.cpp \ Lexer.o \
support/tests/dummy_functions.cpp \ ModuleList.o \
tests/check_layout.cpp \ Spacing.o \
tests/boost.cpp TextClass.o \
tests/dummy_functions.o \
tests/boost.o
check_ExternalTransforms_CPPFLAGS = $(AM_CPPFLAGS) check_ExternalTransforms_CPPFLAGS = $(AM_CPPFLAGS)
check_ExternalTransforms_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ check_ExternalTransforms_LDADD = $(check_ExternalTransforms_LYX_OBJS) $(TESTS_LIBS)
$(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
check_ExternalTransforms_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_ExternalTransforms_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
check_ExternalTransforms_SOURCES = \ check_ExternalTransforms_SOURCES = \
graphics/GraphicsParams.cpp \ tests/check_ExternalTransforms.cpp
insets/ExternalTransforms.cpp \ check_ExternalTransforms_LYX_OBJS = \
Length.cpp \ tests/dummy_functions.o \
lengthcommon.cpp \ tests/boost.o \
support/tests/dummy_functions.cpp \ graphics/GraphicsParams.o \
tests/check_ExternalTransforms.cpp \ insets/ExternalTransforms.o \
tests/boost.cpp Length.o \
lengthcommon.o
check_Length_CPPFLAGS = $(AM_CPPFLAGS) check_Length_CPPFLAGS = $(AM_CPPFLAGS)
check_Length_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ check_Length_LDADD = $(check_Length_LYX_OBJS) $(TESTS_LIBS)
$(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
check_Length_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_Length_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
check_Length_SOURCES = \ check_Length_SOURCES = \
Length.cpp \ tests/check_Length.cpp
lengthcommon.cpp \ check_Length_LYX_OBJS = \
support/tests/dummy_functions.cpp \ tests/dummy_functions.o \
tests/check_Length.cpp \ tests/boost.o \
tests/boost.cpp Length.o \
lengthcommon.o
check_ListingsCaption_CPPFLAGS = $(AM_CPPFLAGS) check_ListingsCaption_CPPFLAGS = $(AM_CPPFLAGS)
check_ListingsCaption_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ \ check_ListingsCaption_LDADD = $(check_ListingsCaption_LYX_OBJS) $(TESTS_LIBS)
$(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
check_ListingsCaption_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS) check_ListingsCaption_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
check_ListingsCaption_SOURCES = \ check_ListingsCaption_SOURCES = \
support/tests/dummy_functions.cpp \ tests/check_ListingsCaption.cpp
tests/check_ListingsCaption.cpp \ check_ListingsCaption_LYX_OBJS = \
tests/boost.cpp tests/dummy_functions.o \
tests/boost.o
.PHONY: alltests alltests-recursive updatetests .PHONY: alltests alltests-recursive updatetests

View File

@ -0,0 +1,67 @@
#include <config.h>
#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;
}
}

View File

@ -81,33 +81,32 @@ alltests-recursive: tex2lyx
updatetests: tex2lyx updatetests: tex2lyx
$(PYTHON) "$(srcdir)/test/runtests.py" ./tex2lyx "$(top_srcdir)/lib/scripts" "$(srcdir)/test" $(PYTHON) "$(srcdir)/test/runtests.py" ./tex2lyx "$(top_srcdir)/lib/scripts" "$(srcdir)/test"
LINKED_FILES = \ LYX_OBJS = \
../Author.cpp \ ../Author.o \
../CiteEnginesList.cpp \ ../CiteEnginesList.o \
../Color.cpp \ ../Color.o \
../Counters.cpp \ ../Counters.o \
../Encoding.cpp \ ../Encoding.o \
../FloatList.cpp \ ../FloatList.o \
../Floating.cpp \ ../Floating.o \
../FontInfo.cpp \ ../FontInfo.o \
../graphics/GraphicsParams.cpp \ ../graphics/GraphicsParams.o \
../insets/ExternalTemplate.cpp \ ../insets/ExternalTemplate.o \
../insets/ExternalTransforms.cpp \ ../insets/ExternalTransforms.o \
../insets/InsetLayout.cpp \ ../insets/InsetLayout.o \
../LaTeXPackages.cpp \ ../LaTeXPackages.o \
../Layout.cpp \ ../Layout.o \
../LayoutFile.cpp \ ../LayoutFile.o \
../LayoutModuleList.cpp \ ../LayoutModuleList.o \
../Length.cpp \ ../Length.o \
../lengthcommon.cpp \ ../lengthcommon.o \
../Lexer.cpp \ ../Lexer.o \
../ModuleList.cpp \ ../ModuleList.o \
../Spacing.cpp \ ../Spacing.o \
../TextClass.cpp \ ../TextClass.o \
../version.cpp ../version.o
tex2lyx_SOURCES = \ tex2lyx_SOURCES = \
$(LINKED_FILES) \
boost.cpp \ boost.cpp \
Context.cpp \ Context.cpp \
Context.h \ Context.h \
@ -123,6 +122,7 @@ tex2lyx_SOURCES = \
text.cpp text.cpp
tex2lyx_LDADD = \ tex2lyx_LDADD = \
$(LYX_OBJS) \
$(top_builddir)/src/support/liblyxsupport.a \ $(top_builddir)/src/support/liblyxsupport.a \
$(LIBICONV) $(BOOST_LIBS) \ $(LIBICONV) $(BOOST_LIBS) \
$(QT_LIB) $(QT_LDFLAGS) \ $(QT_LIB) $(QT_LDFLAGS) \