]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix compilation on Android 35 and on Termux
authorPo Lu <luangruo@yahoo.com>
Tue, 6 May 2025 14:29:46 +0000 (22:29 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 08:53:22 +0000 (10:53 +0200)
* 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)

configure.ac
src/conf_post.h

index f4c11655b98f63c46671a5925562e8e99ebba8f2..fc165e6d35cd0c193b25955403f8069d78405284 100644 (file)
@@ -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 <spawn.h>])
+gl_CHECK_FUNCS_ANDROID([posix_spawn_file_actions_addchdir], [#include <spawn.h>])
+gl_CHECK_FUNCS_ANDROID([posix_spawn_file_actions_addchdir_np], [#include <spawn.h>])
+gl_CHECK_FUNCS_ANDROID([posix_spawnattr_setflags], [#include <spawn.h>])
 AC_SUBST([HAVE_POSIX_SPAWN])
 AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR])
 AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP])
index 6be76d5481ae1844d51c6878a05bf4319befb0f7..7b6c2bc933bab3946986ae6b7c3a501b883f37d9 100644 (file)
@@ -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 <time.h>
+#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 */