Skip to content

Commit fa05cfd

Browse files
author
Po Lu
committed
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.
1 parent 852d50e commit fa05cfd

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

configure.ac

+9-4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ if test "$XCONFIGURE" = "android"; then
4949
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=32"
5050
enable_largefile=no
5151
enable_year2038=no])
52+
# Gnulib should not attempt not to reimplement tzalloc, as strftime
53+
# attempts to link with symbols that are only present in the Gnulib
54+
# replacement.
55+
AS_IF([test "$ANDROID_SDK" -ge "35"],
56+
[gl_cv_onwards_func_tzalloc="future OS version"])
5257
fi
5358

5459
dnl Set emacs_config_options to the options of 'configure', quoted for the shell,
@@ -6341,10 +6346,10 @@ dnl posix_spawn. The chdir and setsid functionality is relatively
63416346
dnl recent, so we check for it specifically.
63426347
AC_CHECK_HEADERS([spawn.h])
63436348
AC_SUBST([HAVE_SPAWN_H])
6344-
AC_CHECK_FUNCS([posix_spawn \
6345-
posix_spawn_file_actions_addchdir \
6346-
posix_spawn_file_actions_addchdir_np \
6347-
posix_spawnattr_setflags])
6349+
gl_CHECK_FUNCS_ANDROID([posix_spawn], [#include <spawn.h>])
6350+
gl_CHECK_FUNCS_ANDROID([posix_spawn_file_actions_addchdir], [#include <spawn.h>])
6351+
gl_CHECK_FUNCS_ANDROID([posix_spawn_file_actions_addchdir_np], [#include <spawn.h>])
6352+
gl_CHECK_FUNCS_ANDROID([posix_spawnattr_setflags], [#include <spawn.h>])
63486353
AC_SUBST([HAVE_POSIX_SPAWN])
63496354
AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR])
63506355
AC_SUBST([HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP])

src/conf_post.h

+11
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,14 @@ extern int emacs_setenv_TZ (char const *);
395395
: S_ISCHR (mode) ? DT_CHR : S_ISFIFO (mode) ? DT_FIFO \
396396
: S_ISSOCK (mode) ? DT_SOCK : DT_UNKNOWN)
397397
#endif /* MSDOS */
398+
399+
#if defined __ANDROID__ && __ANDROID_API__ >= 35
400+
#define _GL_TIME_H
401+
#include <time.h>
402+
#undef _GL_TIME_H
403+
404+
/* Redefine tzalloc and tzfree so as not to conflict with their
405+
system-provided versions, which are incompatible. */
406+
#define tzalloc rpl_tzalloc
407+
#define tzfree rpl_tzfree
408+
#endif /* defined __ANDROID__ && __ANDROID_API__ >= 35 */

0 commit comments

Comments
 (0)