From: Po Lu Date: Tue, 6 May 2025 14:29:46 +0000 (+0800) Subject: Fix compilation on Android 35 and on Termux X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a341bb8e79349b6e0b57d281a9a387e52f4785f5;p=emacs.git Fix compilation on Android 35 and on Termux * configure.ac (gl_cv_onwards_func_tzalloc): Define to "future OS version" on Android API 35 and later. Detect posix_spawn* by means of gl_CHECK_FUNCS_ANDROID. * src/conf_post.h (tzalloc, tzfree): Define to non-conflicting names on Android 35 and later. (cherry picked from commit fa05cfd4455f2883d16992e5f1323a8945956987) --- diff --git a/configure.ac b/configure.ac index f4c11655b98..fc165e6d35c 100644 --- a/configure.ac +++ b/configure.ac @@ -49,6 +49,11 @@ if test "$XCONFIGURE" = "android"; then CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=32" enable_largefile=no enable_year2038=no]) + # Gnulib should not attempt not to reimplement tzalloc, as strftime + # attempts to link with symbols that are only present in the Gnulib + # replacement. + AS_IF([test "$ANDROID_SDK" -ge "35"], + [gl_cv_onwards_func_tzalloc="future OS version"]) fi dnl Set emacs_config_options to the options of 'configure', quoted for the shell, @@ -6374,10 +6379,10 @@ dnl posix_spawn. The chdir and setsid functionality is relatively dnl recent, so we check for it specifically. AC_CHECK_HEADERS([spawn.h]) AC_SUBST([HAVE_SPAWN_H]) -AC_CHECK_FUNCS([posix_spawn \ - posix_spawn_file_actions_addchdir \ - posix_spawn_file_actions_addchdir_np \ - posix_spawnattr_setflags]) +gl_CHECK_FUNCS_ANDROID([posix_spawn], [#include ]) +gl_CHECK_FUNCS_ANDROID([posix_spawn_file_actions_addchdir], [#include ]) +gl_CHECK_FUNCS_ANDROID([posix_spawn_file_actions_addchdir_np], [#include ]) +gl_CHECK_FUNCS_ANDROID([posix_spawnattr_setflags], [#include ]) AC_SUBST([HAVE_POSIX_SPAWN]) AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR]) AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP]) diff --git a/src/conf_post.h b/src/conf_post.h index 6be76d5481a..7b6c2bc933b 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -395,3 +395,14 @@ extern int emacs_setenv_TZ (char const *); : S_ISCHR (mode) ? DT_CHR : S_ISFIFO (mode) ? DT_FIFO \ : S_ISSOCK (mode) ? DT_SOCK : DT_UNKNOWN) #endif /* MSDOS */ + +#if defined __ANDROID__ && __ANDROID_API__ >= 35 +#define _GL_TIME_H +#include +#undef _GL_TIME_H + +/* Redefine tzalloc and tzfree so as not to conflict with their + system-provided versions, which are incompatible. */ +#define tzalloc rpl_tzalloc +#define tzfree rpl_tzfree +#endif /* defined __ANDROID__ && __ANDROID_API__ >= 35 */