From c4b77b82decb757af0aff1b7420203fa0805b483 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 11 Mar 2023 17:42:24 +0800 Subject: [PATCH] Update Android port * configure.ac (HAVE_MAILUTILS, with_mailutils) (ANDROID_SDK_8_OR_EARLIER, XCONFIGURE): Fix POP and mailutils configuration on Android. * java/Makefile.in: * src/callproc.c (syms_of_callproc): Avoid using built-in movemail when --with-mailutils. --- configure.ac | 39 ++++++++++++++++++++++++++++----------- java/Makefile.in | 21 ++++++++++++++------- src/callproc.c | 5 ++++- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac index 56e293a6baa..74ff59c79e4 100644 --- a/configure.ac +++ b/configure.ac @@ -317,24 +317,31 @@ AC_ARG_WITH([mailutils], installed])], [], [with_mailutils=$with_features - if test "$with_mailutils" = yes; then - (movemail --version) >/dev/null 2>&1 || with_mailutils=no - fi]) -if test "$with_mailutils" = no; then - with_mailutils= -fi + AS_IF(["$with_mailutils" = yes], + [AS_IF([test "x$XCONFIGURE" != "xandroid"], + [(movemail --version) >/dev/null 2>&1 || with_mailutils=no], + [dnl don't check for movemail if cross-compiling. + with_mailutils=yes])])]) +AS_IF([test "$with_mailutils" = no], + [with_mailutils=]) + +AS_IF([test x"$with_mailutils" = xyes], + [AC_DEFINE([HAVE_MAILUTILS], [1], + [Define to 1 if Emacs was configured with mailutils])]) + AC_SUBST([with_mailutils]) AC_ARG_WITH([pop], [AS_HELP_STRING([--with-pop], [Support POP mail retrieval if Emacs movemail is used (not recommended, as Emacs movemail POP is insecure). This is the default only on - native MS-Windows.])], + native MS-Windows and Android.])], [], - [case $host in - *-mingw*) with_pop=yes;; - *) with_pop=no-by-default;; - esac]) + dnl Enable movemail POP support on Android as GNU Mailutils is + dnl normally unavailable on that platform. + [AS_CASE([$host], + [*-mingw*|*android*], [with_pop=yes], + [with_pop=no-by-default])]) if test "$with_pop" = yes; then AC_DEFINE([MAIL_USE_POP]) fi @@ -794,6 +801,9 @@ WARN_JAVAFLAGS= # Android. android_makefiles="lib/Makefile lib/gnulib.mk lib-src/Makefile src/Makefile" +# This is whether or not to package mailutils into the executable. +emacs_use_mailutils= + AC_ARG_VAR([JAVAC], [Java compiler path. Used for Android.]) AC_ARG_VAR([JARSIGNER], [Java package signer path. Used for Android.]) AC_ARG_VAR([APKSIGNER], [Android package signer path. Used for Android.]) @@ -1151,6 +1161,11 @@ package will likely install on older systems but crash on startup.]) passthrough="$passthrough --with-tree-sitter=$with_tree_sitter" passthrough="$passthrough --with-imagemagick=$with_imagemagick" passthrough="$passthrough --with-lcms2=$with_lcms2" + passthrough="$passthrough --with-mailutils=$with_mailutils" + passthrough="$passthrough --with-pop=$with_pop" + + AS_IF([test "x$with_mailutils" = "xyes"], [emacs_use_mailutils=yes]) + AC_SUBST([emacs_use_mailutils]) AS_IF([XCONFIGURE=android ANDROID_CC="$ANDROID_CC" \ ANDROID_SDK="$android_sdk" android_abi=$android_abi \ @@ -1230,6 +1245,8 @@ if test "$ANDROID" = "yes"; then with_tree_sitter=no with_imagemagick=no with_lcms2=no + with_mailutils=no + with_pop=no fi with_rsvg=no diff --git a/java/Makefile.in b/java/Makefile.in index 1a7852487ef..b5ab58fe576 100644 --- a/java/Makefile.in +++ b/java/Makefile.in @@ -23,6 +23,9 @@ srcdir = @srcdir@ builddir = @builddir@ version = @version@ +# Don't install movemail if mailutils are to be used. +emacs_use_mailutils = @emacs_use_mailutils@ + # This is the host lib-src and lib, not the cross compiler's lib-src. libsrc = ../lib-src EXEEXT = @EXEEXT@ @@ -114,15 +117,19 @@ APK_NAME := emacs-$(version)-$(ANDROID_MIN_SDK)-$(ANDROID_ABI).apk all: $(APK_NAME) # Binaries to cross-compile. -CROSS_SRC_BINS = $(top_builddir)/cross/src/android-emacs -CROSS_LIBSRC_BINS = $(top_builddir)/cross/lib-src/ctags \ - $(top_builddir)/cross/lib-src/hexl \ - $(top_builddir)/cross/lib-src/movemail \ - $(top_builddir)/cross/lib-src/ebrowse \ - $(top_builddir)/cross/lib-src/emacsclient \ - $(top_builddir)/cross/lib-src/etags +CROSS_SRC_BINS := $(top_builddir)/cross/src/android-emacs +CROSS_LIBSRC_BINS := $(top_builddir)/cross/lib-src/ctags \ + $(top_builddir)/cross/lib-src/hexl \ + $(top_builddir)/cross/lib-src/ebrowse \ + $(top_builddir)/cross/lib-src/emacsclient \ + $(top_builddir)/cross/lib-src/etags +CROSS_LIBSRC_BINS_MOVEMAIL := $(top_builddir)/cross/lib-src/movemail CROSS_BINS = $(CROSS_SRC_BINS) $(CROSS_LIBSRC_BINS) +ifneq ($(emacs_use_mailutils),yes) +CROSS_LIBSRC_BINS := $(CROSS_LIBSRC_BINS) $(CROSS_LIBSRC_BINS_MOVEMAIL) +endif + # Libraries to cross-compile. CROSS_LIBS = $(top_builddir)/cross/src/libemacs.so diff --git a/src/callproc.c b/src/callproc.c index 8d3519fdab2..a1811a3bb23 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -2178,7 +2178,10 @@ the system. */); Use this instead of calling `movemail' directly, as `movemail' may have been renamed to comply with executable naming restrictions on the system. */); -#if !defined HAVE_ANDROID || defined ANDROID_STUBIFY + /* Don't change the name of `movemail' if Emacs is being built to + use movemail from another source. */ +#if !defined HAVE_ANDROID || defined ANDROID_STUBIFY \ + || defined HAVE_MAILUTILS Vmovemail_program_name = build_pure_c_string ("movemail"); #else Vmovemail_program_name = build_pure_c_string ("libmovemail.so"); -- 2.39.2