diff options
| author | Po Lu | 2023-05-02 08:16:00 +0800 |
|---|---|---|
| committer | Po Lu | 2023-05-02 08:16:00 +0800 |
| commit | 5a58a6bc477f290ee0b8a6111e92df56ff538719 (patch) | |
| tree | 216f697e7ad5d12361a799c6dbcc6b7e860e9a19 /exec | |
| parent | 86b7ed619c7d7da035915b8c75b427ed66801123 (diff) | |
| download | emacs-5a58a6bc477f290ee0b8a6111e92df56ff538719.tar.gz emacs-5a58a6bc477f290ee0b8a6111e92df56ff538719.zip | |
Port Android port to older Android systems
* exec/config.h.in: Autoheader.
* exec/configure.ac: Check for declarations of stpcpy and
stpncpy.
* exec/exec.c (stpcpy, stpncpy): Use replacements if
declarations are not present; this happens when a new Android
NDK is building for an old version of Android.
Diffstat (limited to 'exec')
| -rw-r--r-- | exec/config.h.in | 8 | ||||
| -rw-r--r-- | exec/configure.ac | 1 | ||||
| -rw-r--r-- | exec/exec.c | 10 |
3 files changed, 14 insertions, 5 deletions
diff --git a/exec/config.h.in b/exec/config.h.in index c276ff3f1f7..d8c225b631d 100644 --- a/exec/config.h.in +++ b/exec/config.h.in | |||
| @@ -38,6 +38,14 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 38 | /* Define to number of the `exec' system call. */ | 38 | /* Define to number of the `exec' system call. */ |
| 39 | #undef EXEC_SYSCALL | 39 | #undef EXEC_SYSCALL |
| 40 | 40 | ||
| 41 | /* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't. | ||
| 42 | */ | ||
| 43 | #undef HAVE_DECL_STPCPY | ||
| 44 | |||
| 45 | /* Define to 1 if you have the declaration of `stpncpy', and to 0 if you | ||
| 46 | don't. */ | ||
| 47 | #undef HAVE_DECL_STPNCPY | ||
| 48 | |||
| 41 | /* Define to 1 if you have the `getpagesize' function. */ | 49 | /* Define to 1 if you have the `getpagesize' function. */ |
| 42 | #undef HAVE_GETPAGESIZE | 50 | #undef HAVE_GETPAGESIZE |
| 43 | 51 | ||
diff --git a/exec/configure.ac b/exec/configure.ac index 9b4bcebe34e..f3eef60173c 100644 --- a/exec/configure.ac +++ b/exec/configure.ac | |||
| @@ -55,6 +55,7 @@ AC_TYPE_PID_T | |||
| 55 | 55 | ||
| 56 | AC_HEADER_STDBOOL | 56 | AC_HEADER_STDBOOL |
| 57 | AC_CHECK_FUNCS([getpagesize stpcpy stpncpy]) | 57 | AC_CHECK_FUNCS([getpagesize stpcpy stpncpy]) |
| 58 | AC_CHECK_DECLS([stpcpy, stpncpy]) | ||
| 58 | 59 | ||
| 59 | AH_BOTTOM([ | 60 | AH_BOTTOM([ |
| 60 | #ifdef HAVE_STDBOOL_H | 61 | #ifdef HAVE_STDBOOL_H |
diff --git a/exec/exec.c b/exec/exec.c index df8c9430236..7f2cc75338b 100644 --- a/exec/exec.c +++ b/exec/exec.c | |||
| @@ -50,7 +50,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 50 | 50 | ||
| 51 | /* Define replacements for required string functions. */ | 51 | /* Define replacements for required string functions. */ |
| 52 | 52 | ||
| 53 | #ifndef HAVE_STPCPY | 53 | #if !defined HAVE_STPCPY || !defined HAVE_DECL_STPCPY |
| 54 | 54 | ||
| 55 | /* Copy SRC to DEST, returning the address of the terminating '\0' in | 55 | /* Copy SRC to DEST, returning the address of the terminating '\0' in |
| 56 | DEST. */ | 56 | DEST. */ |
| @@ -72,14 +72,14 @@ rpl_stpcpy (char *dest, const char *src) | |||
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | #define stpcpy rpl_stpcpy | 74 | #define stpcpy rpl_stpcpy |
| 75 | #endif /* !HAVE_STPCPY */ | 75 | #endif /* !defined HAVE_STPCPY || !defined HAVE_DECL_STPCPY */ |
| 76 | 76 | ||
| 77 | #ifndef HAVE_STPNCPY | 77 | #if !defined HAVE_STPNCPY || !defined HAVE_DECL_STPNCPY |
| 78 | 78 | ||
| 79 | /* Copy no more than N bytes of SRC to DST, returning a pointer past | 79 | /* Copy no more than N bytes of SRC to DST, returning a pointer past |
| 80 | the last non-NUL byte written into DST. */ | 80 | the last non-NUL byte written into DST. */ |
| 81 | 81 | ||
| 82 | char * | 82 | static char * |
| 83 | rpl_stpncpy (char *dest, const char *src, size_t n) | 83 | rpl_stpncpy (char *dest, const char *src, size_t n) |
| 84 | { | 84 | { |
| 85 | char c, *s; | 85 | char c, *s; |
| @@ -140,7 +140,7 @@ rpl_stpncpy (char *dest, const char *src, size_t n) | |||
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | #define stpncpy rpl_stpncpy | 142 | #define stpncpy rpl_stpncpy |
| 143 | #endif /* !HAVE_STPNCPY */ | 143 | #endif /* !defined HAVE_STPNCPY || !defined HAVE_DECL_STPNCPY */ |
| 144 | 144 | ||
| 145 | 145 | ||
| 146 | 146 | ||