diff --git a/configure b/configure
index d5fc7920ee1f158c17fbbc7e78c9777d38ca719f..65d7078dbe7e59f6b5836607b6ce962e1eebe44a 100755
--- a/configure
+++ b/configure
@@ -9199,7 +9199,7 @@ fi
 extra_host_libiberty_configure_flags=
 extra_host_zlib_configure_flags=
 case " $configdirs " in
-  *" lto-plugin "* | *" libcc1 "*)
+  *" lto-plugin "* | *" libcc1 "* | *" gdbserver "*)
     # When these are to be built as shared libraries, the same applies to
     # libiberty.
     extra_host_libiberty_configure_flags=--enable-shared
diff --git a/configure.ac b/configure.ac
index dcea067759d11f9cdb6cccfb5626992e4b90fc42..371def9b42122953255ca8a10c8ce93e590abf81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2454,7 +2454,7 @@ fi
 extra_host_libiberty_configure_flags=
 extra_host_zlib_configure_flags=
 case " $configdirs " in
-  *" lto-plugin "* | *" libcc1 "*)
+  *" lto-plugin "* | *" libcc1 "* | *" gdbserver "*)
     # When these are to be built as shared libraries, the same applies to
     # libiberty.
     extra_host_libiberty_configure_flags=--enable-shared