]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: replace configure check with PP condition (Android <21)
authorViktor Szakats <commit@vsz.me>
Tue, 31 Dec 2024 01:22:42 +0000 (02:22 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 1 Jan 2025 03:55:54 +0000 (04:55 +0100)
To make it build again with CMake + Android 20 and earlier.

8e345057761a8f796403923a96f2c8fd3edca647 synced `getpwuid_r()` detection
in cmake with autotools. It means cmake started detecting it with
Android <21 just like autotools, and thus cmake builds also need to
tackle the missing declaration with old Android SDK versions. Use a PP
solution, allowing to drop the autotools-specific on used before this
patch.

Follow-up to 8e345057761a8f796403923a96f2c8fd3edca647 #15164
Follow-up to 9c33813d835dde214c1a9449f789dd72ab3d9dc3 #2609
Ref: #2058
Closes #15871

.github/scripts/cmp-config.pl
configure.ac
lib/curl_setup.h

index 25f7701a8cc937c3624cfa244a9d346adb8b1c14..8a5246169ba0b6aedbe2796eae6cc684fcf94ae1 100755 (executable)
@@ -41,9 +41,6 @@ my %remove = (
     '#define GETHOSTNAME_TYPE_ARG2 size_t' => 1,
     '#define HAVE_BROTLI 1' => 1,
     '#define HAVE_BROTLI_DECODE_H 1' => 1,
-    '#define HAVE_DECL_GETPWUID_R 0' => 1,
-    '#define HAVE_DECL_GETPWUID_R 1' => 1,
-    '#define HAVE_DECL_GETPWUID_R_MISSING 1' => 1,
     '#define HAVE_DLFCN_H 1' => 1,
     '#define HAVE_GSSAPI_GSSAPI_KRB5_H 1' => 1,
     '#define HAVE_INTTYPES_H 1' => 1,
index f97a704682eafe678491086157b487d3e1a169b9..ecb58a924c477d1b746f48800d2e88251e251cc6 100644 (file)
@@ -4040,10 +4040,6 @@ case $host in
     ;;
 esac
 
-AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Set if getpwuid_r() declaration is missing")],
-        [[#include <pwd.h>
-          #include <sys/types.h>]])
-
 AC_CHECK_FUNCS([\
   eventfd \
   fnmatch \
index 18d52cc301c34f7d306f4dbd88d5900731d67339..2eba74e52f5d39d1f34224d6e4ce3da8f254fa7d 100644 (file)
@@ -927,7 +927,8 @@ endings either CRLF or LF so 't' is appropriate.
 #define STRCONST(x) x,sizeof(x)-1
 
 /* Some versions of the Android SDK is missing the declaration */
-#if defined(HAVE_GETPWUID_R) && defined(HAVE_DECL_GETPWUID_R_MISSING)
+#if defined(HAVE_GETPWUID_R) && \
+  defined(__ANDROID_API__) && (__ANDROID_API__ < 21)
 struct passwd;
 int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
                size_t buflen, struct passwd **result);