[llvm-exegesis] Check for libpfm headers.

HAVE_LIBPFM is only defined if the libpfm headers are present.

llvm-svn: 329261
This commit is contained in:
Clement Courbet 2018-04-05 07:35:28 +00:00
parent c1b8b371a8
commit 9d7dd3b74c

View File

@ -87,7 +87,17 @@ if( NOT PURE_WINDOWS )
endif()
check_library_exists(dl dlopen "" HAVE_LIBDL)
check_library_exists(rt clock_gettime "" HAVE_LIBRT)
check_library_exists(pfm pfm_initialize "" HAVE_LIBPFM)
endif()
# Check for libpfm.
check_library_exists(pfm pfm_initialize "" HAVE_LIBPFM_INITIALIZE)
if(HAVE_LIBPFM_INITIALIZE)
check_include_file(perfmon/perf_event.h HAVE_PERFMON_PERF_EVENT_H)
check_include_file(perfmon/pfmlib.h HAVE_PERFMON_PFMLIB_H)
check_include_file(perfmon/pfmlib_perf_event.h HAVE_PERFMON_PFMLIB_PERF_EVENT_H)
if(HAVE_PERFMON_PERF_EVENT_H AND HAVE_PERFMON_PFMLIB_H AND HAVE_PERFMON_PFMLIB_PERF_EVENT_H)
set(HAVE_LIBPFM 1)
endif()
endif()
if(HAVE_LIBPTHREAD)