]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
CMake: Sync tuklib_cpucores.cmake with tuklib_cpucores.m4.
authorLasse Collin <lasse.collin@tukaani.org>
Mon, 31 Oct 2022 09:49:47 +0000 (11:49 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 11 Nov 2022 11:41:43 +0000 (13:41 +0200)
This was forgotten from commit 2611c4d90535652d3eb7ef4a026a6691276fab43.

cmake/tuklib_cpucores.cmake

index 743d56b37cb50696e492fe2b0d3ae722a7d746b2..ea16e427912b9df2fd95025c22c2a6a1045c8a1c 100644 (file)
@@ -89,7 +89,12 @@ function(tuklib_cpucores_internal_check)
             #include <sys/sysctl.h>
             int main(void)
             {
+            #ifdef HW_NCPUONLINE
+                /* This is preferred on OpenBSD, see tuklib_cpucores.c. */
+                int name[2] = { CTL_HW, HW_NCPUONLINE };
+            #else
                 int name[2] = { CTL_HW, HW_NCPU };
+            #endif
                 int cpus;
                 size_t cpus_size = sizeof(cpus);
                 sysctl(name, 2, &cpus, &cpus_size, NULL, 0);