diff options
| author | Po Lu | 2023-02-22 10:57:33 +0800 |
|---|---|---|
| committer | Po Lu | 2023-02-22 11:01:44 +0800 |
| commit | 137bdaced6a7c39063cebb5f7c12195438495c52 (patch) | |
| tree | 16160cad2f99c6847b5d133b8b0826d5ca010e3e | |
| parent | a892c0487a6391e9d35296b2b4168318a7ca622f (diff) | |
| download | emacs-137bdaced6a7c39063cebb5f7c12195438495c52.tar.gz emacs-137bdaced6a7c39063cebb5f7c12195438495c52.zip | |
Update Android port
* INSTALL.android: Port to MIPS.
* configure.ac (modules): Default to ifavailable.
Write actual test for __attribute__((cleanup)).
* m4/ndk-build.m4: Recognize mips and mips64.
* src/emacs-module.c: Remove broken HAS_ATTRIBUTE test.
| -rw-r--r-- | INSTALL.android | 7 | ||||
| -rw-r--r-- | configure.ac | 78 | ||||
| -rw-r--r-- | m4/ndk-build.m4 | 6 | ||||
| -rw-r--r-- | src/emacs-module.c | 8 |
4 files changed, 71 insertions, 28 deletions
diff --git a/INSTALL.android b/INSTALL.android index 559058d321e..1b362fbb583 100644 --- a/INSTALL.android +++ b/INSTALL.android | |||
| @@ -40,13 +40,16 @@ Replacing the paths in the command line above with: | |||
| 40 | SDK. They must correspond to Android version 13 (API level 33) or | 40 | SDK. They must correspond to Android version 13 (API level 33) or |
| 41 | later. | 41 | later. |
| 42 | 42 | ||
| 43 | - the path to the C compiler in the Android NDK, for the machine you | 43 | - the path to the C compiler in the Android NDK, for the kind of CPU |
| 44 | are building Emacs to run on. | 44 | you are building Emacs to run on. |
| 45 | 45 | ||
| 46 | - the path to the directory in the Android SDK containing binaries | 46 | - the path to the directory in the Android SDK containing binaries |
| 47 | such as `aapt', `apksigner', and `d8'. These are used to build | 47 | such as `aapt', `apksigner', and `d8'. These are used to build |
| 48 | the application package. | 48 | the application package. |
| 49 | 49 | ||
| 50 | Where the type of CPU can either be `armeabi', `armv7*', `i686', | ||
| 51 | `x86_64', `mips', or `mips64'. | ||
| 52 | |||
| 50 | After the configuration process completes, you may run: | 53 | After the configuration process completes, you may run: |
| 51 | 54 | ||
| 52 | make all | 55 | make all |
diff --git a/configure.ac b/configure.ac index ce74f492c82..cb2b1370d58 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -548,7 +548,7 @@ OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support]) | |||
| 548 | OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support]) | 548 | OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support]) |
| 549 | OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support]) | 549 | OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support]) |
| 550 | OPTION_DEFAULT_ON([zlib],[don't compile with zlib decompression support]) | 550 | OPTION_DEFAULT_ON([zlib],[don't compile with zlib decompression support]) |
| 551 | OPTION_DEFAULT_ON([modules],[don't compile with dynamic modules support]) | 551 | OPTION_DEFAULT_IFAVAILABLE([modules],[don't compile with dynamic modules support]) |
| 552 | OPTION_DEFAULT_ON([threads],[don't compile with elisp threading support]) | 552 | OPTION_DEFAULT_ON([threads],[don't compile with elisp threading support]) |
| 553 | OPTION_DEFAULT_OFF([cygwin32-native-compilation],[use native compilation on 32-bit Cygwin]) | 553 | OPTION_DEFAULT_OFF([cygwin32-native-compilation],[use native compilation on 32-bit Cygwin]) |
| 554 | OPTION_DEFAULT_ON([xinput2],[don't use version 2 of the X Input Extension for input]) | 554 | OPTION_DEFAULT_ON([xinput2],[don't use version 2 of the X Input Extension for input]) |
| @@ -911,6 +911,8 @@ for your machine. For example: | |||
| 911 | ;; | 911 | ;; |
| 912 | *arm*v7a*) android_abi=armeabi-v7a | 912 | *arm*v7a*) android_abi=armeabi-v7a |
| 913 | ;; | 913 | ;; |
| 914 | *mips64*) android_abi=mips64 | ||
| 915 | ;; | ||
| 914 | *mips*) android_abi=mips | 916 | *mips*) android_abi=mips |
| 915 | ;; | 917 | ;; |
| 916 | *arm*) android_abi=armeabi | 918 | *arm*) android_abi=armeabi |
| @@ -4768,27 +4770,61 @@ if test $window_system = pgtk; then | |||
| 4768 | fi | 4770 | fi |
| 4769 | 4771 | ||
| 4770 | if test "${with_modules}" != "no"; then | 4772 | if test "${with_modules}" != "no"; then |
| 4771 | case $opsys in | 4773 | # __attribute__ ((cleanup)) is required for dynamic modules to |
| 4772 | gnu|gnu-linux) | 4774 | # work. |
| 4773 | LIBMODULES="-ldl" | 4775 | AC_CACHE_CHECK([for working __attribute__((cleanup))], |
| 4774 | HAVE_MODULES=yes | 4776 | [emacs_cv_attribute_cleanup], |
| 4775 | ;; | 4777 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
| 4776 | cygwin|mingw32|darwin) | 4778 | |
| 4777 | HAVE_MODULES=yes | 4779 | extern int exit (); |
| 4778 | ;; | 4780 | |
| 4779 | *) | 4781 | cleanup_func_1 (k) |
| 4780 | # BSD systems have dlopen in libc. | 4782 | int *k; |
| 4781 | AC_CHECK_FUNC([dlopen], [HAVE_MODULES=yes]) | 4783 | { |
| 4782 | ;; | 4784 | exit (*k - 100); |
| 4783 | esac | 4785 | } |
| 4784 | 4786 | ||
| 4785 | if test "${HAVE_MODULES}" = no; then | 4787 | cleanup_func () |
| 4786 | AC_MSG_ERROR([Dynamic modules are not supported on your system]) | 4788 | { |
| 4789 | int k __attribute__((cleanup (cleanup_func_1))) = 100; | ||
| 4790 | } | ||
| 4791 | |||
| 4792 | ]], [[cleanup_func (); return 1;]])], | ||
| 4793 | [emacs_cv_attribute_cleanup=yes], | ||
| 4794 | [emacs_cv_attribute_cleanup=no], | ||
| 4795 | [emacs_cv_attribute_cleanup="guessing yes"])]) | ||
| 4796 | |||
| 4797 | if test "$emacs_cv_attribute_cleanup" = "no"; then | ||
| 4798 | if test "${with_modules}" = "ifavailable"; then | ||
| 4799 | AC_MSG_WARN([your compiler does not support cleanup attributes, | ||
| 4800 | and as a result dynamic modules have been disabled]) | ||
| 4801 | else | ||
| 4802 | AC_MSG_ERROR([your compiler is missing the cleanup attribute | ||
| 4803 | required for dynamic modules to work]) | ||
| 4804 | fi | ||
| 4787 | else | 4805 | else |
| 4788 | SAVE_LIBS=$LIBS | 4806 | case $opsys in |
| 4789 | LIBS="$LIBS $LIBMODULES" | 4807 | gnu|gnu-linux) |
| 4790 | AC_CHECK_FUNCS([dladdr dlfunc]) | 4808 | LIBMODULES="-ldl" |
| 4791 | LIBS=$SAVE_LIBS | 4809 | HAVE_MODULES=yes |
| 4810 | ;; | ||
| 4811 | cygwin|mingw32|darwin) | ||
| 4812 | HAVE_MODULES=yes | ||
| 4813 | ;; | ||
| 4814 | *) | ||
| 4815 | # BSD systems have dlopen in libc. | ||
| 4816 | AC_CHECK_FUNC([dlopen], [HAVE_MODULES=yes]) | ||
| 4817 | ;; | ||
| 4818 | esac | ||
| 4819 | |||
| 4820 | if test "${HAVE_MODULES}" = no; then | ||
| 4821 | AC_MSG_ERROR([Dynamic modules are not supported on your system]) | ||
| 4822 | else | ||
| 4823 | SAVE_LIBS=$LIBS | ||
| 4824 | LIBS="$LIBS $LIBMODULES" | ||
| 4825 | AC_CHECK_FUNCS([dladdr dlfunc]) | ||
| 4826 | LIBS=$SAVE_LIBS | ||
| 4827 | fi | ||
| 4792 | fi | 4828 | fi |
| 4793 | fi | 4829 | fi |
| 4794 | 4830 | ||
diff --git a/m4/ndk-build.m4 b/m4/ndk-build.m4 index 876c980ebb5..e1e4115ffca 100644 --- a/m4/ndk-build.m4 +++ b/m4/ndk-build.m4 | |||
| @@ -66,6 +66,12 @@ case "$ndk_ABI" in | |||
| 66 | *x86* ) | 66 | *x86* ) |
| 67 | ndk_ARCH=x86 | 67 | ndk_ARCH=x86 |
| 68 | ;; | 68 | ;; |
| 69 | *mips64* ) | ||
| 70 | ndk_ARCH=mips64 | ||
| 71 | ;; | ||
| 72 | *mips* ) | ||
| 73 | ndk_ARCH=mips | ||
| 74 | ;; | ||
| 69 | * ) | 75 | * ) |
| 70 | AC_MSG_ERROR([Failed to determine Android device architecture]) | 76 | AC_MSG_ERROR([Failed to determine Android device architecture]) |
| 71 | ;; | 77 | ;; |
diff --git a/src/emacs-module.c b/src/emacs-module.c index d158e243139..d9e564771d0 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -246,10 +246,6 @@ module_decode_utf_8 (const char *str, ptrdiff_t len) | |||
| 246 | of `internal_condition_case' etc., and to avoid worrying about | 246 | of `internal_condition_case' etc., and to avoid worrying about |
| 247 | passing information to the handler functions. */ | 247 | passing information to the handler functions. */ |
| 248 | 248 | ||
| 249 | #if !HAS_ATTRIBUTE (cleanup) | ||
| 250 | #error "__attribute__ ((cleanup)) not supported by this compiler; try GCC" | ||
| 251 | #endif | ||
| 252 | |||
| 253 | /* Place this macro at the beginning of a function returning a number | 249 | /* Place this macro at the beginning of a function returning a number |
| 254 | or a pointer to handle non-local exits. The function must have an | 250 | or a pointer to handle non-local exits. The function must have an |
| 255 | ENV parameter. The function will return the specified value if a | 251 | ENV parameter. The function will return the specified value if a |
| @@ -258,7 +254,9 @@ module_decode_utf_8 (const char *str, ptrdiff_t len) | |||
| 258 | /* It is very important that pushing the handler doesn't itself raise | 254 | /* It is very important that pushing the handler doesn't itself raise |
| 259 | a signal. Install the cleanup only after the handler has been | 255 | a signal. Install the cleanup only after the handler has been |
| 260 | pushed. Use __attribute__ ((cleanup)) to avoid | 256 | pushed. Use __attribute__ ((cleanup)) to avoid |
| 261 | non-local-exit-prone manual cleanup. | 257 | non-local-exit-prone manual cleanup. This is an extension provided |
| 258 | by GCC and similar compilers; configure prevents module.c from | ||
| 259 | being compiled when it is not present. | ||
| 262 | 260 | ||
| 263 | The do-while forces uses of the macro to be followed by a semicolon. | 261 | The do-while forces uses of the macro to be followed by a semicolon. |
| 264 | This macro cannot enclose its entire body inside a do-while, as the | 262 | This macro cannot enclose its entire body inside a do-while, as the |