dnl Autoconf configure script for GDB, the GNU debugger.
-dnl Copyright (C) 1995-2019 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2020 Free Software Foundation, Inc.
+dnl Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
dnl
dnl This file is part of GDB.
dnl
fi
fi
+# ROCm dbgapi support.
+
+AC_ARG_WITH(rocm-dbgapi,
+AS_HELP_STRING([--with-rocm-dbgapi=PATH],
+ [specify prefix directory for installed ROCm-dbgapi package]),,
+ [with_rocm_dbgapi=/opt/rocm])
+
+save_CPPFLAGS=${CPPFLAGS}
+CPPFLAGS="${CPPFLAGS} -I$with_rocm_dbgapi/include"
+AC_CHECK_HEADERS(amd-dbgapi.h)
+CPPFLAGS=${save_CPPFLAGS}
+
+save_LIBS=${LIBS}
+save_LDFLAGS=${LDFLAGS}
+LDFLAGS="${LDFLAGS} -L$with_rocm_dbgapi/lib"
+AC_CHECK_LIB(rocm-dbgapi,amd_dbgapi_initialize)
+LDFLAGS=${save_LDFLAGS}
+LIBS=${save_LIBS}
+
+if test x"$ac_cv_header_amd_dbgapi_h" = xyes \
+ -a x"$ac_cv_lib_rocm_dbgapi_amd_dbgapi_initialize" = xyes; then
+
+ if test x"$require_rocm_dbgapi" = xyes -o x"$all_targets" = xtrue; then
+ TARGET_OBS="$TARGET_OBS amdgcn-rocm-tdep.o rocm-tdep.o solib-rocm.o"
+ fi
+
+ CPPFLAGS="${CPPFLAGS} -I$with_rocm_dbgapi/include"
+ ROCM_DBGAPI_LIBS="-L$with_rocm_dbgapi/lib -lrocm-dbgapi"
+ AC_SUBST(ROCM_DBGAPI_LIBS)
+else
+ if test x"$require_rocm_dbgapi" = xyes; then
+ AC_MSG_ERROR([amdgcn*-*-* requires rocm-dbgapi to be installed, or use \
+--with-rocm-dbgapi=PATH])
+ fi
+fi
+
AC_SUBST(TARGET_OBS)
AC_SUBST(HAVE_NATIVE_GCORE_TARGET)