diff --git a/test cases/linuxlike/1 pkg-config/prog-checkver.c b/test cases/linuxlike/1 pkg-config/prog-checkver.c index fe705d45d..14d574642 100644 --- a/test cases/linuxlike/1 pkg-config/prog-checkver.c +++ b/test cases/linuxlike/1 pkg-config/prog-checkver.c @@ -4,6 +4,12 @@ #include static bool check_version(const char *zlib_ver, const char *found_zlib) { + if (zlib_ver == found_zlib) + return true; + + if (strcmp(zlib_ver, found_zlib) == 0) + return true; + #ifdef ZLIBNG_VERSION const char *ptr = strstr(zlib_ver, found_zlib); @@ -16,14 +22,11 @@ static bool check_version(const char *zlib_ver, const char *found_zlib) { * that FOUND_ZLIB is the start of ZLIB_VERSION, so compare the rest. */ ptr += strlen(found_zlib); - if (strcmp(ptr, ".zlib-ng") != 0) - return false; -#else - if (strcmp(zlib_ver, found_zlib) != 0) - return false; + if (strcmp(ptr, ".zlib-ng") == 0) + return true; #endif - return true; + return false; } int main(void) { @@ -31,7 +34,7 @@ int main(void) { if (!check_version(ZLIB_VERSION, FOUND_ZLIB)) { printf("Meson found '%s' but zlib is '%s'\n", FOUND_ZLIB, ZLIB_VERSION); #ifdef ZLIBNG_VERSION - puts("Note that in the case of zlib-ng, a version suffix of .zlib-ng is expected\n"); + puts("Note that in the case of zlib-ng, a version suffix of .zlib-ng is expected"); #endif return 2; } diff --git a/test cases/linuxlike/13 cmake dependency/prog-checkver.c b/test cases/linuxlike/13 cmake dependency/prog-checkver.c index fe705d45d..14d574642 100644 --- a/test cases/linuxlike/13 cmake dependency/prog-checkver.c +++ b/test cases/linuxlike/13 cmake dependency/prog-checkver.c @@ -4,6 +4,12 @@ #include static bool check_version(const char *zlib_ver, const char *found_zlib) { + if (zlib_ver == found_zlib) + return true; + + if (strcmp(zlib_ver, found_zlib) == 0) + return true; + #ifdef ZLIBNG_VERSION const char *ptr = strstr(zlib_ver, found_zlib); @@ -16,14 +22,11 @@ static bool check_version(const char *zlib_ver, const char *found_zlib) { * that FOUND_ZLIB is the start of ZLIB_VERSION, so compare the rest. */ ptr += strlen(found_zlib); - if (strcmp(ptr, ".zlib-ng") != 0) - return false; -#else - if (strcmp(zlib_ver, found_zlib) != 0) - return false; + if (strcmp(ptr, ".zlib-ng") == 0) + return true; #endif - return true; + return false; } int main(void) { @@ -31,7 +34,7 @@ int main(void) { if (!check_version(ZLIB_VERSION, FOUND_ZLIB)) { printf("Meson found '%s' but zlib is '%s'\n", FOUND_ZLIB, ZLIB_VERSION); #ifdef ZLIBNG_VERSION - puts("Note that in the case of zlib-ng, a version suffix of .zlib-ng is expected\n"); + puts("Note that in the case of zlib-ng, a version suffix of .zlib-ng is expected"); #endif return 2; }