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

Port to certain Android environments with no GUI

* configure.ac (USER_FULL_NAME): Define to
android_user_full_name only when a GUI system is being built.
Otherwise, set to pw->pw_gecos or NULL consistently with the
presence of pw->pw_gecos.

* src/editfns.c (Fuser_full_name): Adjust to match.  Accept NULL
values from USER_FULL_NAME.
This commit is contained in:
Po Lu 2024-05-17 19:21:05 +08:00
parent 6ca3a60db3
commit 1f08984a67
2 changed files with 14 additions and 12 deletions

View File

@ -2464,11 +2464,6 @@ AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
[The type of system you are compiling for; sets 'system-type'.])
AC_SUBST([SYSTEM_TYPE])
# Check for pw_gecos in struct passwd; this is known to be missing on
# Android.
AC_CHECK_MEMBERS([struct passwd.pw_gecos], [], [], [#include <pwd.h>])
pre_PKG_CONFIG_CFLAGS=$CFLAGS
pre_PKG_CONFIG_LIBS=$LIBS
@ -2754,6 +2749,17 @@ AC_SUBST([ANDROID_BUILD_CFLAGS])
AC_SUBST([ANDROID_SHARED_USER_ID])
AC_SUBST([ANDROID_SHARED_USER_NAME])
# Check for pw_gecos in struct passwd; this is known to be missing on
# Android.
AH_TEMPLATE([USER_FULL_NAME], [How to get a user's full name.])
AC_CHECK_MEMBERS([struct passwd.pw_gecos], [], [], [#include <pwd.h>])
AS_IF([test x"$REALLY_ANDROID" = "xyes"],
[AC_DEFINE([USER_FULL_NAME], [android_user_full_name (pw)])],
[AS_IF([test x"$ac_cv_member_struct_passwd_pw_gecos" = "xyes"],
[AC_DEFINE([USER_FULL_NAME], [pw->pw_gecos])],
[AC_DEFINE([USER_FULL_NAME], [NULL])])])
if test "${with_pgtk}" = "yes"; then
window_system=pgtk
fi
@ -6460,9 +6466,6 @@ AC_SUBST([SEPCHAR])
dnl Everybody supports this, except MS-DOS.
AC_DEFINE([subprocesses], [1], [Define to enable asynchronous subprocesses.])
AC_DEFINE([USER_FULL_NAME], [pw->pw_gecos], [How to get a user's full name.])
AC_DEFINE([DIRECTORY_SEP], ['/'],
[Character that separates directories in a file name.])

View File

@ -1247,11 +1247,10 @@ is in general a comma-separated list. */)
if (!pw)
return Qnil;
#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
p = android_user_full_name (pw);
#else
p = USER_FULL_NAME;
#endif
if (!p)
return Qnil;
/* Chop off everything after the first comma, since 'pw_gecos' is a
comma-separated list. */
q = strchr (p, ',');