version: allow building with ancient libpsl

The psl_check_version_number() API was added in libpsl 0.11.0. CentOS 7
ships with version 0.7.0 which lacks this API. Revert to using the older
versioning API if we detect an old libpsl version.

Follow-up to 72bd88adde
Bug: https://curl.se/mail/archive-2024-02/0004.html
Reported-by: Scott Mutter
Closes #12872
This commit is contained in:
Peter Krefting 2024-02-02 23:22:32 +01:00 committed by Daniel Stenberg
parent 8050761e1a
commit 174c89ec3f
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -212,9 +212,15 @@ char *curl_version(void)
#ifdef USE_LIBPSL
{
#if defined(PSL_VERSION_MAJOR) && (PSL_VERSION_MAJOR > 0 || \
PSL_VERSION_MINOR >= 11)
int num = psl_check_version_number(0);
msnprintf(psl_version, sizeof(psl_version), "libpsl/%d.%d.%d",
num >> 16, (num >> 8) & 0xff, num & 0xff);
#else
msnprintf(psl_version, sizeof(psl_version), "libpsl/%s",
psl_get_version());
#endif
src[i++] = psl_version;
}
#endif