summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-01-25 14:46:21 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-01-25 14:46:21 +0000
commit7cfc16edbf7b7d0cc0ca6fd8228a8c57eb419473 (patch)
treebfed8c3d86ad2b8a79c24a69bd1efcedec51325b
parent5c08712e7b1f7589fee1f659b50af3abf8c7fcab (diff)
downloadmpfr-7cfc16edbf7b7d0cc0ca6fd8228a8c57eb419473.tar.gz
* Added check-exported-symbols make rule to check that MPFR does not
define symbols with a GMP reserved prefix. * For the check-gmp-symbols and check-exported-symbols make rules, if the library is not $(top_builddir)/src/.libs/libmpfr.so, these rules do nothing instead of potentially failing. * doc/README.dev, "To make a release": mention "make check-gmp-symbols" and "make check-exported-symbols". (merged changesets r12111-12114 from the trunk) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@12125 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--Makefile.am11
-rw-r--r--doc/README.dev7
-rw-r--r--src/Makefile.am35
3 files changed, 43 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am
index 90e568569..5ce6d5049 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -49,9 +49,14 @@ dist-hook:
cd $(srcdir)/doc && ./check-typography
# Check that MPFR does not use GMP internal symbols. Of course, do not run
-# this rule if you use --with-gmp-build or --enable-gmp-internals. This
-# test does nothing if --disable-shared has been used.
+# this rule if you use --with-gmp-build or --enable-gmp-internals.
+# This test does nothing if no libmpfr.so is generated.
check-gmp-symbols:
cd src && $(MAKE) check-gmp-symbols
-.PHONY: check-gmp-symbols
+# Check that MPFR does not define symbols with a GMP reserved prefix.
+# This test does nothing if no libmpfr.so is generated.
+check-exported-symbols:
+ cd src && $(MAKE) check-exported-symbols
+
+.PHONY: check-gmp-symbols check-exported-symbols
diff --git a/doc/README.dev b/doc/README.dev
index 517db5c11..a50299b08 100644
--- a/doc/README.dev
+++ b/doc/README.dev
@@ -335,6 +335,13 @@ To make a release (for the MPFR team):
--enable-debug-prediction, run "timings-mpfr 100", and check that
the output contains no WARNING.
+ For various platforms and compilers, check that:
+ * [make check-gmp-symbols]
+ MPFR does not use GMP internal symbols (unless --with-gmp-build
+ or --enable-gmp-internals has been used);
+ * [make check-exported-symbols]
+ MPFR does not define symbols with a GMP reserved prefix.
+
7) For the release itself (not the release candidates), if no problems
have been found, create a tag with:
svn cp .../mpfr/branches/x.y .../mpfr/tags/x.y.z
diff --git a/src/Makefile.am b/src/Makefile.am
index ff1133173..d9e89108d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -98,9 +98,15 @@ $(srcdir)/get_patches.c: $(top_srcdir)/PATCHES $(top_srcdir)/tools/get_patches.s
# what has been changed by "patch".
#CLEANFILES = get_patches.c
+# For check-gmp-symbols
GMPC = $(top_builddir)/src/gmp.c
GMPI = $(top_builddir)/src/gmp.i
+# For check-gmp-symbols and check-exported-symbols (if the library does
+# not have this name, e.g. on some platforms or when the shared library
+# is disabled, these rules do nothing).
+LIBMPFRSO = $(top_builddir)/src/.libs/libmpfr.so
+
# Check that MPFR does not use GMP internal symbols. Of course, do not run
# this rule if you use --with-gmp-build or --enable-gmp-internals. This
# test does nothing if --disable-shared has been used.
@@ -108,11 +114,10 @@ GMPI = $(top_builddir)/src/gmp.i
# because the latter is not supported by all compilers (at least under
# MS Windows).
check-gmp-symbols: $(LTLIBRARIES)
- printf "#include <%s.h>\n" stdarg stdio gmp > $(GMPC)
- $(COMPILE) -E $(GMPC) > $(GMPI)
- libmpfrso=$(top_builddir)/src/.libs/libmpfr.so; \
- if [ -f "$$libmpfrso" ]; then \
- internals=`$(NM) -u "$$libmpfrso" | \
+ if [ -f "$(LIBMPFRSO)" ]; then \
+ printf "#include <%s.h>\n" stdarg stdio gmp > $(GMPC) && \
+ $(COMPILE) -E $(GMPC) > $(GMPI) || exit 1; \
+ internals=`$(NM) -u "$(LIBMPFRSO)" | \
$(SED) -n 's/^ *U \(__gmp.*\)/\1/p' | \
while read s; \
do \
@@ -122,9 +127,25 @@ check-gmp-symbols: $(LTLIBRARIES)
echo "Internal GMP symbols:" $$internals; \
exit 1; \
fi; \
+ rm $(GMPC) $(GMPI); \
+ fi
+
+# Check that MPFR does not define symbols with a GMP reserved prefix.
+# For instance, with r11968, and
+# ./configure --with-gmp-build=... CC=tcc
+# the symbol __gmpn_clz_tab is defined, which is wrong.
+# Note: the "grep -v '@plt$$'" below is for tcc.
+check-exported-symbols: $(LTLIBRARIES)
+ if [ -f "$(LIBMPFRSO)" ]; then \
+ gsymbols=`$(NM) -gP "$(LIBMPFRSO)" | perl -ne \
+ '/^(__gmp[a-z]?_[_0-9A-Za-z]*) +[A-TV-Z]/ and print " $$1"' | \
+ grep -v '@plt$$'`; \
+ if [ -n "$$gsymbols" ]; then \
+ echo "MPFR defines symbols with a GMP reserved prefix:$$gsymbols"; \
+ exit 1; \
+ fi; \
fi
- rm $(GMPC) $(GMPI)
CLEANFILES = $(GMPC) $(GMPI)
-.PHONY: check-gmp-symbols
+.PHONY: check-gmp-symbols check-exported-symbols