diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2022-03-08 18:46:47 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2022-03-08 18:51:18 -0800 |
commit | 6e66d1f90a078099911c52b5ed00b7385d095957 (patch) | |
tree | 6e403964af2878229b4f3c2fd4951c9c98e2b625 /test/Makefile.in | |
parent | ec35e2621a945797cc4978ebf2e0fe0b0f436705 (diff) | |
download | emacs-6e66d1f90a078099911c52b5ed00b7385d095957.tar.gz |
Decouple mod-test.c from Gnulib
mod-test.c should not use Gnulib code, as that creates
unnecessary coupling between Emacs internals and this test module.
Also Gnulib code is compiled without -fPIC whereas mod-test.c
needs -fPIC and recompiling Gnulib with -fPIC would be too painful.
* src/Makefile.in (LIB_NANOSLEEP): New macro.
(LIBES): Use it.
* test/Makefile.in (REPLACE_FREE, FREE_SOURCE_0, FREE_SOURCE_0):
Remove. All uses removed.
(LIB_CLOCK_GETTIME, LIB_NANOSLEEP): New macros.
(MODULE_CFLAGS): Do not -I from lib as that would include Gnulib
modifications to standard .h files (e.g., "#define nanosleep
rpl_nanosleep") and we don’t want the Gnulib replacements.
Instead, for gmp.h (on platforms lacking <gmp.h>) simply '-I.'
with a suitable gmp.h.
(gmp.h): New rule to create a suitable gmp.h.
($(test_module)): Depend on config.h since the code uses config.h.
Depend on gmp.h if we need to create a suitable one.
If compiling mini-gmp.h, compile the original one and not
the Emacs-specific one, to lessen coupling with Emacs internals.
Link with LIB_CLOCK_GETTIME and LIB_NANOSLEEP.
(clean): Remove gmp.h.
* test/src/emacs-module-resources/mod-test.c: Don’t include timespec.h.
All uses of timespec.h APIs changed to use system-supplied APIs.
Change _Static_assert to plain assert, so that we needn’t rely
on Gnulib’s _Static_assert.
(timespec_le) [CLOCK_REALTIME]: New function.
Change use of timespec_cmp changed to use this instead.
(Fmod_test_sleep_until, Fmod_test_nanoseconds):
Define these functions and their Lisp names mod-test-sleep-until
and mod-test-nanoseconds only if CLOCK_REALTIME,
since they now won’t work on platforms lacking CLOCK_REALTIME.
(Fmod_test_nanoseconds): Just use _Static_assert since it
should work on all platforms.
* test/src/emacs-module-tests.el (mod-test-sleep-until)
(mod-test-nanoseconds, mod-test-double):
Skip test if the corresponding functione is not defined.
Diffstat (limited to 'test/Makefile.in')
-rw-r--r-- | test/Makefile.in | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index 79d3dcf92f8..3b6e116e65f 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -49,8 +49,6 @@ SEPCHAR = @SEPCHAR@ HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@ -REPLACE_FREE = @REPLACE_FREE@ - -include ${top_builddir}/src/verbose.mk # We never change directory before running Emacs, so a relative file @@ -265,27 +263,29 @@ endif GMP_H = @GMP_H@ LIBGMP = @LIBGMP@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_NANOSLEEP = @LIB_NANOSLEEP@ -MODULE_CFLAGS = -I../src -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib \ +MODULE_CFLAGS = $(and $(GMP_H),-I.) -I../src -I$(srcdir)/../src \ $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) +gmp.h: + echo '#include "$(srcdir)/../lib/mini-gmp.h"' >$@ + test_module = $(test_module_dir)/mod-test${SO} src/emacs-module-tests.log src/emacs-module-tests.elc: $(test_module) -FREE_SOURCE_0 = -FREE_SOURCE_1 = $(srcdir)/../lib/free.c - # In the compilation command, we can't use any object or archive file # as source because those are not compiled with -fPIC. Therefore we # use only source files. -$(test_module): $(test_module:${SO}=.c) ../src/emacs-module.h +$(test_module): $(test_module:${SO}=.c) ../src/emacs-module.h \ + ../src/config.h $(and $(GMP_H),gmp.h) $(AM_V_CCLD)${MKDIR_P} $(dir $@) $(AM_V_at)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \ -o $@ $< $(LIBGMP) \ - $(and $(GMP_H),$(srcdir)/../lib/mini-gmp-gnulib.c) \ - $(FREE_SOURCE_$(REPLACE_FREE)) \ - ../lib/libgnu.a + $(and $(GMP_H),$(srcdir)/../lib/mini-gmp.c) \ + $(LIB_CLOCK_GETTIME) $(LIB_NANOSLEEP) endif src/emacs-tests.log: ../lib-src/seccomp-filter.c @@ -345,7 +345,7 @@ clean: find . '(' -name '*.xml' -a ! -path '*resources*' ')' $(FIND_DELETE) rm -f ${srcdir}/lisp/gnus/mml-sec-resources/random_seed rm -f $(test_module_dir)/*.o $(test_module_dir)/*.so \ - $(test_module_dir)/*.dll + $(test_module_dir)/*.dll gmp.h bootstrap-clean: clean find $(srcdir) -name '*.elc' $(FIND_DELETE) |