Update ROCm for multi-target support
[deliverable/binutils-gdb.git] / gdb / configure.ac
index 354bb7b4b68e2f8d2bea5499f0b2925203bac912..1d342f17526b2413e1da06efac3ab424221818dc 100644 (file)
@@ -1,5 +1,6 @@
 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
@@ -177,10 +178,6 @@ fi
 
 . $srcdir/configure.host
 
-# Add in the common host objects.
-. $srcdir/gdbsupport/common.host
-gdb_host_obs="$gdb_host_obs $common_host_obs"
-
 # Accumulate some settings from configure.tgt over all enabled targets
 
 TARGET_OBS=
@@ -252,6 +249,42 @@ if test x${all_targets} = xtrue; then
   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)
 
@@ -288,7 +321,7 @@ AS_HELP_STRING([--disable-gdbmi], [disable machine-interface (MI)]),
   esac],
   [enable_gdbmi=yes])
 if test x"$enable_gdbmi" = xyes; then
-  if test -d $srcdir/mi; then
+  if test -d "$srcdir/mi"; then
     CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)"
     CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)"
     CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)"
@@ -315,7 +348,7 @@ AS_HELP_STRING([--enable-gdbtk], [enable gdbtk graphical user interface (GUI)]),
     *)
       AC_MSG_ERROR([bad value $enableval for --enable-gdbtk]) ;;
   esac],
-  [if test -d $srcdir/gdbtk; then
+  [if test -d "$srcdir/gdbtk"; then
     enable_gdbtk=yes
   else
     enable_gdbtk=no
@@ -393,7 +426,7 @@ AC_CACHE_CHECK([for _etext], ac_cv_var__etext,
 extern char _etext;
 ],
 [free (&_etext);], ac_cv_var__etext=yes, ac_cv_var__etext=no)])
-if test $ac_cv_var__etext = yes; then
+if test "$ac_cv_var__etext" = yes; then
   AC_DEFINE(HAVE__ETEXT, 1,
             [Define to 1 if your system has the _etext variable. ])
 fi
@@ -403,12 +436,12 @@ AC_CACHE_CHECK([for etext], ac_cv_var_etext,
 extern char etext;
 ],
 [free (&etext);], ac_cv_var_etext=yes, ac_cv_var_etext=no)])
-if test $ac_cv_var_etext = yes; then
+if test "$ac_cv_var_etext" = yes; then
   AC_DEFINE(HAVE_ETEXT, 1,
             [Define to 1 if your system has the etext variable. ])
 fi
 if test "$enable_profiling" = yes ; then
-  if test $ac_cv_func_monstartup = no || test $ac_cv_func__mcleanup = no; then
+  if test "$ac_cv_func_monstartup" = no || test "$ac_cv_func__mcleanup" = no; then
     AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
   fi
   PROFILE_CFLAGS=-pg
@@ -419,7 +452,7 @@ if test "$enable_profiling" = yes ; then
     [AC_TRY_COMPILE([], [int x;], ac_cv_cc_supports_pg=yes,
      ac_cv_cc_supports_pg=no)])
 
-  if test $ac_cv_cc_supports_pg = no; then
+  if test "$ac_cv_cc_supports_pg" = no; then
     AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
   fi
 
@@ -538,7 +571,7 @@ fi
 # Check whether we should enable the TUI, but only do so if we really
 # can.
 if test x"$enable_tui" != xno; then
-  if test -d $srcdir/tui; then
+  if test -d "$srcdir/tui"; then
     if test "$curses_found" != no; then
       CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
       CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
@@ -560,7 +593,7 @@ fi
 
 case $host_os in
   cygwin*)
-    if test -d $srcdir/libtermcap; then
+    if test -d "$srcdir/libtermcap"; then
       LIBS="../libtermcap/libtermcap.a $LIBS"
       ac_cv_search_tgetent="../libtermcap/libtermcap.a"
     fi ;;
@@ -762,7 +795,7 @@ if test "${with_python}" = no; then
 else
   case "${with_python}" in
   [[\\/]]* | ?:[[\\/]]*)
-    if test -d ${with_python}; then
+    if test -d "${with_python}"; then
       # Assume the python binary is ${with_python}/bin/python.
       python_prog="${with_python}/bin/python"
       python_prefix=
@@ -798,7 +831,7 @@ else
     python_prefix=
     case "${with_python}" in
     yes | auto)
-      if test ${build} = ${host}; then
+      if test "${build}" = "${host}"; then
         AC_PATH_PROG(python_prog_path, python, missing)
         if test "${python_prog_path}" = missing; then
           python_prog=missing
@@ -1339,7 +1372,7 @@ else
   else
     exit (1);
 ], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
-if test $ac_cv_func_setpgrp_void = yes; then
+if test "$ac_cv_func_setpgrp_void" = yes; then
   AC_DEFINE(SETPGRP_VOID, 1)
 fi
 fi
@@ -1360,7 +1393,7 @@ AC_CACHE_CHECK(
 #endif],
     gdb_cv_have_gnu_regex=yes,
     gdb_cv_have_gnu_regex=no)])
-if test $gdb_cv_have_gnu_regex = yes; then
+if test "$gdb_cv_have_gnu_regex" = yes; then
   gdb_use_included_regex=no
 fi
 
@@ -1385,7 +1418,7 @@ AC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp,
 #define _KMEMUSER
 #include <sys/lwp.h>], [struct lwp l;],
 gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
-if test $gdb_cv_struct_lwp = yes; then
+if test "$gdb_cv_struct_lwp" = yes; then
   AC_DEFINE(HAVE_STRUCT_LWP, 1,
             [Define to 1 if your system has struct lwp.])
 fi
@@ -1395,7 +1428,7 @@ AC_CACHE_CHECK([for struct reg in machine/reg.h], gdb_cv_struct_reg,
 [AC_TRY_COMPILE([#include <sys/types.h>
 #include <machine/reg.h>], [struct reg r;],
 gdb_cv_struct_reg=yes, gdb_cv_struct_reg=no)])
-if test $gdb_cv_struct_reg = yes; then
+if test "$gdb_cv_struct_reg" = yes; then
   AC_DEFINE(HAVE_STRUCT_REG, 1,
             [Define to 1 if your system has struct reg in <machine/reg.h>.])
 fi
@@ -1421,7 +1454,7 @@ AC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
                [gdb_cv_have_ptrace_getregs=yes],
                [gdb_cv_have_ptrace_getregs=no])])
 AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
-if test $gdb_cv_have_ptrace_getregs = yes; then
+if test "$gdb_cv_have_ptrace_getregs" = yes; then
   AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
   [Define if sys/ptrace.h defines the PTRACE_GETREGS request.])
 fi
@@ -1434,7 +1467,7 @@ AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
                [gdb_cv_have_ptrace_getfpxregs=yes],
                [gdb_cv_have_ptrace_getfpxregs=no])])
 AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
-if test $gdb_cv_have_ptrace_getfpxregs = yes; then
+if test "$gdb_cv_have_ptrace_getfpxregs" = yes; then
   AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
   [Define if sys/ptrace.h defines the PTRACE_GETFPXREGS request.])
 fi
@@ -1448,7 +1481,7 @@ AC_CACHE_VAL(gdb_cv_have_pt_getdbregs,
                [gdb_cv_have_pt_getdbregs=yes],
                [gdb_cv_have_pt_getdbregs=no])])
 AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
-if test $gdb_cv_have_pt_getdbregs = yes; then
+if test "$gdb_cv_have_pt_getdbregs" = yes; then
   AC_DEFINE(HAVE_PT_GETDBREGS, 1,
   [Define if sys/ptrace.h defines the PT_GETDBREGS request.])
 fi
@@ -1462,7 +1495,7 @@ AC_CACHE_VAL(gdb_cv_have_pt_getxmmregs,
                [gdb_cv_have_pt_getxmmregs=yes],
                [gdb_cv_have_pt_getxmmregs=no])])
 AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
-if test $gdb_cv_have_pt_getxmmregs = yes; then
+if test "$gdb_cv_have_pt_getxmmregs" = yes; then
   AC_DEFINE(HAVE_PT_GETXMMREGS, 1,
   [Define if sys/ptrace.h defines the PT_GETXMMREGS request.])
 fi
@@ -1498,7 +1531,7 @@ AC_CACHE_CHECK([for long long support in compiler], gdb_cv_c_long_long,
 [[switch (foo & 2) { case 0: return 1; }]])],
                                   gdb_cv_c_long_long=yes,
                                   gdb_cv_c_long_long=no)])
-if test $gdb_cv_c_long_long != yes; then
+if test "$gdb_cv_c_long_long" != yes; then
   # libdecnumber requires long long.
   AC_MSG_ERROR([Compiler must support long long for GDB.])
 fi
@@ -1519,7 +1552,7 @@ AC_CACHE_CHECK([for long long support in printf],
                               gdb_cv_printf_has_long_long=yes,
                               gdb_cv_printf_has_long_long=no,
                               gdb_cv_printf_has_long_long=no)])
-if test $gdb_cv_printf_has_long_long = yes; then
+if test "$gdb_cv_printf_has_long_long" = yes; then
   AC_DEFINE(PRINTF_HAS_LONG_LONG, 1,
             [Define to 1 if the "%ll" format works to print long longs.])
 fi
@@ -1538,7 +1571,7 @@ AC_CACHE_CHECK([for decfloat support in printf],
                               gdb_cv_printf_has_decfloat=yes,
                               gdb_cv_printf_has_decfloat=no,
                               gdb_cv_printf_has_decfloat=no)])
-if test $gdb_cv_printf_has_decfloat = yes; then
+if test "$gdb_cv_printf_has_decfloat" = yes; then
   AC_DEFINE(PRINTF_HAS_DECFLOAT, 1,
             [Define to 1 if the "%H, %D and %DD" formats work to print decfloats.])
 fi
@@ -1552,7 +1585,7 @@ AC_CACHE_CHECK([for long double support in compiler], gdb_cv_c_long_double,
                [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[long double foo;]])],
                                   gdb_cv_c_long_double=yes,
                                   gdb_cv_c_long_double=no)])
-if test $gdb_cv_c_long_double = yes; then
+if test "$gdb_cv_c_long_double" = yes; then
   AC_DEFINE(HAVE_LONG_DOUBLE, 1,
            [Define to 1 if the compiler supports long double.])
 fi
@@ -1569,7 +1602,7 @@ AC_CACHE_CHECK([for long double support in printf],
                               gdb_cv_printf_has_long_double=yes,
                               gdb_cv_printf_has_long_double=no,
                               gdb_cv_printf_has_long_double=no)])
-if test $gdb_cv_printf_has_long_double = yes; then
+if test "$gdb_cv_printf_has_long_double" = yes; then
   AC_DEFINE(PRINTF_HAS_LONG_DOUBLE, 1,
             [Define to 1 if the "%Lg" format works to print long doubles.])
 fi
@@ -1587,7 +1620,7 @@ AC_CACHE_CHECK([for long double support in scanf],
                               gdb_cv_scanf_has_long_double=yes,
                               gdb_cv_scanf_has_long_double=no,
                               gdb_cv_scanf_has_long_double=no)])
-if test $gdb_cv_scanf_has_long_double = yes; then
+if test "$gdb_cv_scanf_has_long_double" = yes; then
   AC_DEFINE(SCANF_HAS_LONG_DOUBLE, 1,
             [Define to 1 if the "%Lg" format works to scan long doubles.])
 fi
@@ -1670,7 +1703,7 @@ dnl
 dnl Note that we only want this if we are both native (host == target),
 dnl and not doing a canadian cross build (build == host).
 
-if test ${build} = ${host} -a ${host} = ${target} ; then
+if test "${build}" = "${host}" -a "${host}" = "${target}" ; then
    case ${host_os} in
    aix*)
       AC_MSG_CHECKING(for AiX thread debugging library)
@@ -1682,7 +1715,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then
                                    gdb_cv_have_aix_thread_debug=yes,
                                    gdb_cv_have_aix_thread_debug=no)])
       AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
-      if test $gdb_cv_have_aix_thread_debug = yes; then
+      if test "$gdb_cv_have_aix_thread_debug" = yes; then
          CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
          CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
          LIBS="$LIBS -lpthdebug"
@@ -1822,7 +1855,7 @@ AC_SUBST(SER_HARDWIRE)
 
 # libreadline needs libuser32.a in a cygwin environment
 WIN32LIBS=
-if test x$gdb_cv_os_cygwin = xyes; then
+if test x"$gdb_cv_os_cygwin" = xyes; then
     WIN32LIBS="-luser32"
     case "${target}" in
        *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
@@ -1846,7 +1879,7 @@ AC_SUBST(WIN32LIBS)
 # Add ELF support to GDB, but only if BFD includes ELF support.
 GDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_elf,
                  [bfd_get_elf_phdr_upper_bound (NULL)], elf-bfd.h)
-if test $gdb_cv_var_elf = yes; then
+if test "$gdb_cv_var_elf" = yes; then
   CONFIG_OBS="$CONFIG_OBS elfread.o stap-probe.o dtrace-probe.o"
   AC_DEFINE(HAVE_ELF, 1,
            [Define if ELF support should be included.])
@@ -1859,7 +1892,7 @@ fi
 # Add macho support to GDB, but only if BFD includes it.
 GDB_AC_CHECK_BFD([for Mach-O support in BFD], gdb_cv_var_macho,
                  [bfd_mach_o_lookup_command (NULL, 0, NULL)], mach-o.h)
-if test $gdb_cv_var_macho = yes; then
+if test "$gdb_cv_var_macho" = yes; then
   CONFIG_OBS="$CONFIG_OBS machoread.o"
 fi
 
@@ -1867,7 +1900,7 @@ fi
 CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
 
 # If building on ELF, look for lzma support for embedded compressed debug info.
-if test $gdb_cv_var_elf = yes; then
+if test "$gdb_cv_var_elf" = yes; then
   AC_ARG_WITH(lzma,
     AS_HELP_STRING([--with-lzma], [support lzma compression (auto/yes/no)]),
     [], [with_lzma=auto])
@@ -1996,7 +2029,7 @@ if test "${enable_gdbtk}" = "yes"; then
        CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk"
        CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk"
 
-       if test x$gdb_cv_os_cygwin = xyes; then
+       if test x"$gdb_cv_os_cygwin" = xyes; then
          WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
          WIN32LDAPP="-Wl,--subsystem,console"
          CONFIG_OBS="${CONFIG_OBS} gdbres.o"
This page took 0.029333 seconds and 4 git commands to generate.