summaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2019-12-25 15:41:39 +0100
committerPhilipp Stephani <phst@google.com>2019-12-25 15:42:20 +0100
commit28268e47d844215b11f9a731d2bedb58bee0b343 (patch)
tree320b5f1b359451f8ad7dc60da56d2b221c371b84 /test/src
parent7c5d6a2afc6c23a7fff8456f506ee2aa2d37a3b9 (diff)
downloademacs-28268e47d844215b11f9a731d2bedb58bee0b343.tar.gz
Support .dylib suffix for modules on macOS (Bug#36226).
On macOS, shared libraries typically have the suffix .dylib. This commit switches the module suffix to .dylib on Darwin to account for that. To also support the .so suffix, introduce the concept of a secondary module suffix. * configure.ac: Switch MODULES_SUFFIX to .dylib for Darwin, introduce MODULES_SECONDARY_SUFFIX. * src/lread.c (Fload, syms_of_lread): Also use MODULES_SECONDARY_SUFFIX if defined. * test/src/emacs-module-tests.el (module-darwin-secondary-suffix): New unit test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/emacs-module-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 18766081c0a..322500ff604 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -384,4 +384,22 @@ Interactively, you can try hitting \\[keyboard-quit] to quit."
(ert-info ((format "input: %d" input))
(should (= (mod-test-double input) (* 2 input))))))
+(ert-deftest module-darwin-secondary-suffix ()
+ "Check that on Darwin, both .so and .dylib suffixes work.
+See Bug#36226."
+ (skip-unless (eq system-type 'darwin))
+ (should (member ".dylib" load-suffixes))
+ (should (member ".so" load-suffixes))
+ ;; Preserve the old `load-history'. This is needed for some of the
+ ;; other unit tests that indirectly rely on `load-history'.
+ (let ((load-history load-history)
+ (dylib (concat mod-test-file ".dylib"))
+ (so (concat mod-test-file ".so")))
+ (should (file-regular-p dylib))
+ (should-not (file-exists-p so))
+ (add-name-to-file dylib so)
+ (unwind-protect
+ (load so nil nil :nosuffix :must-suffix)
+ (delete-file so))))
+
;;; emacs-module-tests.el ends here