summaryrefslogtreecommitdiff
path: root/src
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 /src
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
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am35
1 files changed, 28 insertions, 7 deletions
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