Skip to content

Commit 170c8d6

Browse files
bodedogalbxela
authored andcommitted
[configure] [nvml] added option to specify nvml header directory path
Description: when compiling with "--enable-nvml" flag we checked for nvml.h only in default locations. added "--with-nvml-include-dir=DIR" flag to allow users specifying non-defualt locations where nvml.h might have been installed.
1 parent b0d179f commit 170c8d6

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

configure.ac

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,26 @@ AC_ARG_ENABLE(nvml,
396396
[enable_nvml="$default_en_nvml"]
397397
)
398398
AC_MSG_RESULT($enable_nvml)
399-
if test "x$enable_nvml" = "xyes"; then
400-
AC_CHECK_HEADER(nvml.h, [], [AC_MSG_ERROR([cannot find nvml.h, please check you nvidia driver installation.])])
401-
AC_CHECK_LIB([nvidia-ml], [nvmlInit_v2], [], [AC_MSG_ERROR([libnvidia-ml not found, please check you nvidia driver installation.])])
399+
400+
if test "$enable_nvml" = "yes"; then
401+
AC_ARG_WITH([nvml-include-dir], AS_HELP_STRING([--with-nvml-include-dir=DIR], [use nvml from the specified DIR]),
402+
[
403+
nvml_dir="$withval"
404+
AC_MSG_NOTICE([Using nvml from $nvml_dir])
405+
CXXFLAGS="$CXXFLAGS -I$nvml_dir"
406+
CFLAGS="$CFLAGS -I$nvml_dir"
407+
],
408+
[
409+
AC_MSG_NOTICE([Looking for nvml headers])
410+
PKG_CHECK_MODULES([nvml], [nvidia-ml], [],
411+
[
412+
AC_MSG_NOTICE([Looking for nvml headers and libraries in default include paths])
413+
AC_CHECK_HEADERS([nvml.h], [], [AC_MSG_ERROR([cannot find nvml.h in default include paths, please check you nvidia driver installation or use --with-nvml-include-dir=DIR to specify the correct directory path of nvml.h.])])
414+
AC_CHECK_LIB([nvidia-ml], [nvmlInit_v2], [], [AC_MSG_ERROR([libnvidia-ml not found in default library paths, please check you nvidia driver installation])])
415+
]
416+
)
417+
]
418+
)
402419
CXXFLAGS="$CXXFLAGS -DENABLE_NVML"
403420
CFLAGS="$CFLAGS -DENABLE_NVML"
404421
fi

0 commit comments

Comments
 (0)