emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] Check for __attribute__ ((cleanup)) during configuration.


From: Philipp Stephani
Subject: [PATCH 2/2] Check for __attribute__ ((cleanup)) during configuration.
Date: Thu, 25 Apr 2019 15:46:09 +0200

It’s nicer to fail early if __attribute__ ((cleanup)) doesn’t work.

* configure.ac: Enable modules only if __attribute__ ((cleanup))
works.
---
 configure.ac | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/configure.ac b/configure.ac
index 1f87fe0383..7acd2cb6e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4422,6 +4422,18 @@ AC_DEFUN
 AC_SUBST([GMP_OBJ])
 
 ### Dynamic modules support
+AC_CACHE_CHECK(
+  [for __attribute__ ((cleanup))],
+  [emacs_cv_have_attribute_cleanup],
+  [AC_RUN_IFELSE(
+     [AC_LANG_PROGRAM(
+       [static int status = 1;
+        static void cleanup (int *p) { status = 0; }],
+       [{ __attribute__ ((cleanup (cleanup))) int v; }
+        return status;])],
+     [emacs_cv_have_attribute_cleanup=yes],
+     [emacs_cv_have_attribute_cleanup=no])])
+
 LIBMODULES=
 HAVE_MODULES=no
 MODULES_OBJ=
@@ -4449,6 +4461,12 @@ AC_DEFUN
     HAVE_MODULES=no
   fi
 
+  if test "${emacs_cv_have_attribute_cleanup}" != yes; then
+    # The module implementation currently requires
+    # __attribute__((cleanup)).
+    HAVE_MODULES=no
+  fi
+
   if test "${HAVE_MODULES}" = no; then
     AC_MSG_ERROR([Dynamic modules are not supported on your system])
   else
-- 
2.20.1 (Apple Git-117)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]