1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

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.
This commit is contained in:
Po Lu 2023-02-22 10:57:33 +08:00
parent a892c0487a
commit 137bdaced6
4 changed files with 70 additions and 27 deletions

View File

@ -40,13 +40,16 @@ Replacing the paths in the command line above with:
SDK. They must correspond to Android version 13 (API level 33) or
later.
- the path to the C compiler in the Android NDK, for the machine you
are building Emacs to run on.
- the path to the C compiler in the Android NDK, for the kind of CPU
you are building Emacs to run on.
- the path to the directory in the Android SDK containing binaries
such as `aapt', `apksigner', and `d8'. These are used to build
the application package.
Where the type of CPU can either be `armeabi', `armv7*', `i686',
`x86_64', `mips', or `mips64'.
After the configuration process completes, you may run:
make all

View File

@ -548,7 +548,7 @@ OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support])
OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support])
OPTION_DEFAULT_ON([zlib],[don't compile with zlib decompression support])
OPTION_DEFAULT_ON([modules],[don't compile with dynamic modules support])
OPTION_DEFAULT_IFAVAILABLE([modules],[don't compile with dynamic modules support])
OPTION_DEFAULT_ON([threads],[don't compile with elisp threading support])
OPTION_DEFAULT_OFF([cygwin32-native-compilation],[use native compilation on 32-bit Cygwin])
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:
;;
*arm*v7a*) android_abi=armeabi-v7a
;;
*mips64*) android_abi=mips64
;;
*mips*) android_abi=mips
;;
*arm*) android_abi=armeabi
@ -4768,27 +4770,61 @@ if test $window_system = pgtk; then
fi
if test "${with_modules}" != "no"; then
case $opsys in
gnu|gnu-linux)
LIBMODULES="-ldl"
HAVE_MODULES=yes
;;
cygwin|mingw32|darwin)
HAVE_MODULES=yes
;;
*)
# BSD systems have dlopen in libc.
AC_CHECK_FUNC([dlopen], [HAVE_MODULES=yes])
;;
esac
# __attribute__ ((cleanup)) is required for dynamic modules to
# work.
AC_CACHE_CHECK([for working __attribute__((cleanup))],
[emacs_cv_attribute_cleanup],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
if test "${HAVE_MODULES}" = no; then
AC_MSG_ERROR([Dynamic modules are not supported on your system])
extern int exit ();
cleanup_func_1 (k)
int *k;
{
exit (*k - 100);
}
cleanup_func ()
{
int k __attribute__((cleanup (cleanup_func_1))) = 100;
}
]], [[cleanup_func (); return 1;]])],
[emacs_cv_attribute_cleanup=yes],
[emacs_cv_attribute_cleanup=no],
[emacs_cv_attribute_cleanup="guessing yes"])])
if test "$emacs_cv_attribute_cleanup" = "no"; then
if test "${with_modules}" = "ifavailable"; then
AC_MSG_WARN([your compiler does not support cleanup attributes,
and as a result dynamic modules have been disabled])
else
AC_MSG_ERROR([your compiler is missing the cleanup attribute
required for dynamic modules to work])
fi
else
SAVE_LIBS=$LIBS
LIBS="$LIBS $LIBMODULES"
AC_CHECK_FUNCS([dladdr dlfunc])
LIBS=$SAVE_LIBS
case $opsys in
gnu|gnu-linux)
LIBMODULES="-ldl"
HAVE_MODULES=yes
;;
cygwin|mingw32|darwin)
HAVE_MODULES=yes
;;
*)
# BSD systems have dlopen in libc.
AC_CHECK_FUNC([dlopen], [HAVE_MODULES=yes])
;;
esac
if test "${HAVE_MODULES}" = no; then
AC_MSG_ERROR([Dynamic modules are not supported on your system])
else
SAVE_LIBS=$LIBS
LIBS="$LIBS $LIBMODULES"
AC_CHECK_FUNCS([dladdr dlfunc])
LIBS=$SAVE_LIBS
fi
fi
fi

View File

@ -66,6 +66,12 @@ case "$ndk_ABI" in
*x86* )
ndk_ARCH=x86
;;
*mips64* )
ndk_ARCH=mips64
;;
*mips* )
ndk_ARCH=mips
;;
* )
AC_MSG_ERROR([Failed to determine Android device architecture])
;;

View File

@ -246,10 +246,6 @@ module_decode_utf_8 (const char *str, ptrdiff_t len)
of `internal_condition_case' etc., and to avoid worrying about
passing information to the handler functions. */
#if !HAS_ATTRIBUTE (cleanup)
#error "__attribute__ ((cleanup)) not supported by this compiler; try GCC"
#endif
/* Place this macro at the beginning of a function returning a number
or a pointer to handle non-local exits. The function must have an
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)
/* It is very important that pushing the handler doesn't itself raise
a signal. Install the cleanup only after the handler has been
pushed. Use __attribute__ ((cleanup)) to avoid
non-local-exit-prone manual cleanup.
non-local-exit-prone manual cleanup. This is an extension provided
by GCC and similar compilers; configure prevents module.c from
being compiled when it is not present.
The do-while forces uses of the macro to be followed by a semicolon.
This macro cannot enclose its entire body inside a do-while, as the