lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
diff --git a/lib/Kconfig b/lib/Kconfig
index 38051cc..52d4b27 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -299,6 +299,9 @@
 	  the size is too small then the message which says the amount of early
 	  data being coped will the the same as the
 
+config CIRCBUF
+	bool "Enable circular buffer support"
+
 source lib/dhry/Kconfig
 
 menu "Security support"
diff --git a/lib/Makefile b/lib/Makefile
index 7950e84..f223892 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -29,7 +29,13 @@
 obj-y += charset.o
 endif
 endif
-obj-$(CONFIG_USB_TTY) += circbuf.o
+
+ifdef CONFIG_USB_TTY
+obj-y += circbuf.o
+else
+obj-$(CONFIG_CIRCBUF) += circbuf.o
+endif
+
 obj-y += crc8.o
 obj-y += crc16.o
 obj-$(CONFIG_ERRNO_STR) += errno_str.o