xref: /aosp_15_r20/external/ltp/m4/ltp-numa.m4 (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Workerdnl SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Workerdnl Copyright (c) Cisco Systems Inc., 2009
3*49cdfc7eSAndroid Build Coastguard Workerdnl Copyright (c) 2017 Petr Vorel <[email protected]>
4*49cdfc7eSAndroid Build Coastguard Workerdnl Author: Ngie Cooper <[email protected]>
5*49cdfc7eSAndroid Build Coastguard Worker
6*49cdfc7eSAndroid Build Coastguard WorkerAC_DEFUN([LTP_CHECK_SYSCALL_NUMA], [
7*49cdfc7eSAndroid Build Coastguard Worker	AC_CHECK_LIB(numa, numa_available, [have_libnuma=yes])
8*49cdfc7eSAndroid Build Coastguard Worker	AC_CHECK_HEADERS([numa.h numaif.h], [], [have_numa_headers=no])
9*49cdfc7eSAndroid Build Coastguard Worker
10*49cdfc7eSAndroid Build Coastguard Worker	if test "x$have_numa_headers" != "xno"; then
11*49cdfc7eSAndroid Build Coastguard Worker		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
12*49cdfc7eSAndroid Build Coastguard Worker#include <numa.h>
13*49cdfc7eSAndroid Build Coastguard Worker		], [
14*49cdfc7eSAndroid Build Coastguard Worker#if LIBNUMA_API_VERSION < 2
15*49cdfc7eSAndroid Build Coastguard Worker# error Required numa headers >= 2
16*49cdfc7eSAndroid Build Coastguard Worker#endif
17*49cdfc7eSAndroid Build Coastguard Worker		])], [have_numa_headers_v2=yes])
18*49cdfc7eSAndroid Build Coastguard Worker	fi
19*49cdfc7eSAndroid Build Coastguard Worker
20*49cdfc7eSAndroid Build Coastguard Worker	if test "x$have_libnuma" = "xyes" -a "x$have_numa_headers" != "xno" -a "x$have_numa_headers_v2" = "xyes"; then
21*49cdfc7eSAndroid Build Coastguard Worker		AC_SUBST(NUMA_LIBS, "-lnuma")
22*49cdfc7eSAndroid Build Coastguard Worker		AC_DEFINE(HAVE_NUMA_V2, 1, [Define to 1 if you have libnuma and it's headers version >= 2 installed.])
23*49cdfc7eSAndroid Build Coastguard Worker	fi
24*49cdfc7eSAndroid Build Coastguard Worker])
25