Commit 698406aaf142 added the hwloc library as a dependency. hwloc 1.x, the original implementation, is not sufficient for our needs and causes build errors like
dlls/ntdll/unix/system.c: In function ‘traverse_hwloc_topology’: dlls/ntdll/unix/system.c:1406:10: error: ‘HWLOC_OBJ_L1CACHE’ undeclared (first use in this function); did you mean ‘HWLOC_OBJ_CACHE’?
So tighten our checks and not only look out for hwloc.h and libhwloc, but also HWLOC_OBJ_L1CACHE in the former as an indication we are dealing with a sufficiently new version.
This addresses https://gitlab.winehq.org/wine/wine/-/merge_requests/7339#note_118432
From: Gerald Pfeifer gerald@pfeifer.com
Commit 698406aaf142 added the hwloc library as a dependency. hwloc 1.x, the original implementation, is not sufficient for our needs and causes build errors like
dlls/ntdll/unix/system.c: In function ‘traverse_hwloc_topology’: dlls/ntdll/unix/system.c:1406:10: error: ‘HWLOC_OBJ_L1CACHE’ undeclared (first use in this function); did you mean ‘HWLOC_OBJ_CACHE’?
So tighten our checks and not only look out for hwloc.h and libhwloc, but also HWLOC_OBJ_L1CACHE in the former as an indication we are dealing with a sufficiently new version.
This addresses https://gitlab.winehq.org/wine/wine/-/merge_requests/7339#note_118432 --- configure.ac | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac index a7f00402498..5a31274d36a 100644 --- a/configure.ac +++ b/configure.ac @@ -1526,10 +1526,13 @@ then freebsd*) WINE_PACKAGE_FLAGS(HWLOC,[hwloc],,,, [AC_CHECK_HEADER([hwloc.h], - [AC_CHECK_LIB(hwloc,hwloc_topology_init, - [AC_DEFINE(HAVE_LIBHWLOC, 1, [Define to 1 if you have the 'hwloc' library (-lhwloc).])], + [AC_CHECK_DECL(HWLOC_OBJ_L1CACHE, + [AC_CHECK_LIB(hwloc,hwloc_topology_init, + [AC_DEFINE(HAVE_LIBHWLOC, 1, [Define to 1 if you have the 'hwloc' library (-lhwloc).])], + [HWLOC_LIBS=""], + [$HWLOC_LIBS])], [HWLOC_LIBS=""], - [$HWLOC_LIBS])], + [#include "hwloc.h"])], [HWLOC_LIBS=""])]) WINE_NOTICE_WITH(hwloc,[test "$ac_cv_lib_hwloc_hwloc_topology_init" != "yes"], [hwloc ${notice_platform}development files not found, detailed CPU info on FreeBSD won't be supported.])
Alexandre Julliard (@julliard) commented about configure.ac:
freebsd*) WINE_PACKAGE_FLAGS(HWLOC,[hwloc],,,, [AC_CHECK_HEADER([hwloc.h],
[AC_CHECK_LIB(hwloc,hwloc_topology_init,[AC_DEFINE(HAVE_LIBHWLOC, 1, [Define to 1 if you have the 'hwloc' library (-lhwloc).])],
[AC_CHECK_DECL(HWLOC_OBJ_L1CACHE,[AC_CHECK_LIB(hwloc,hwloc_topology_init,[AC_DEFINE(HAVE_LIBHWLOC, 1, [Define to 1 if you have the 'hwloc' library (-lhwloc).])],
A better way is to use AC_LINK_IFELSE with a sample program, instead of 3 separate checks.