# Process this file with autoconf to produce a configure script.
# File: components/nvml/configure.in
AC_INIT
AC_ARG_WITH(nvml_dir,
[ --with-nvml-dir=<path> Specify prefix to nvml libraries and headers ],
[nvml_dir=$withval])
AC_ARG_WITH(nvml_incdir,
[ --with-nvml-incdir=<path> Specify directory of nvml header files (nvml.h) in a specific location ],
[nvml_incdir=$withval])
AC_ARG_WITH(nvml_libdir,
[ --with-nvml-libdir=<path> Specify directory of nvml library (libnvidia-ml.so) in a specific location ],
[nvml_libdir=$withval])
nvml_dotest=0
if test "x$nvml_dir" != "x"; then
nvml_incdir="$nvml_dir/include"
nvml_libdir="$nvml_dir/lib64"
nvml_dotest=1
else
if test "x$nvml_libdir" != "x"; then
LIBS="-L$nvml_libdir"
nvml_dotest=1
fi
if test "x$nvml_incdir" != "x"; then
CPPFLAGS="-I$nvml_incdir"
nvml_dotest=1
fi
fi
CFLAGS="$CFLAGS -I$nvml_incdir"
AC_CHECK_HEADER( [nvml.h], [], [AC_MSG_ERROR([NVML component: nvml.h not found: use configure flags to set the path ])], )
LDFLAGS="$LDFLAGS -L$nvml_libdir -Wl,-rpath,$nvml_libdir"
AC_CHECK_LIB( [nvidia-ml], [nvmlInit], [], [AC_MSG_ERROR([NVML component: libnvidia-ml.so not found: use configure flags to set the path])] )
NVML_INCDIR=$nvml_incdir
NVML_LIBDIR=$nvml_libdir
AC_ARG_WITH(cuda-dir,
[--with-cuda-dir=<path> Specify path to cuda root directory],
[ CUDA_DIR=$withval
LDFLAGS="$LDFLAGS -L$withval/lib64 -Wl,-rpath,$withval/lib64"
AC_CHECK_LIB( [cudart], [cudaMalloc], [], [AC_MSG_ERROR([CUDA cudart library not found!])])],
[ AC_MSG_ERROR([Component requires path to cuda library.])])
AC_CONFIG_FILES([Makefile.nvml])
AC_SUBST(NVML_INCDIR)
AC_SUBST(NVML_LIBDIR)
AC_SUBST(CUDA_DIR)
AC_OUTPUT