separate libosmo-mgcp-client from mgcp server code

When osmo-mgw is built --with-mgcp-transcoding, linking the mgcp library
also requires linking libgsm, even though e.g. osmo-msc never use it.
Separate the MGCP client code from the MGCP server code to avoid this dep.

The mgcp client code does use some definitions from mgcp.h and mgcp_common.c.
For simplicity, link mgcp_common.c in both libosmo-legacy-mgcp as well as
libosmo-mgcp-client. That means it is not possible to link both
libosmo-legacy-mgcp and libosmo-mgcp-client in the same binary because of
duplicate symbols, but currently that is sufficient. (An alternative would be
code dup or yet another libosmo-mgcp-common library.)

Add libosmo-mgcp-client to debian packaging.

Related: OS#2488
Change-Id: I8e0b2d2a399b77086a36606f5e427271c6242df1
diff --git a/src/Makefile.am b/src/Makefile.am
index f47bc00..922bbda 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,6 +22,7 @@
 # Libraries
 SUBDIRS = \
 	libosmo-legacy-mgcp \
+	libosmo-mgcp-client \
 	$(NULL)
 
 # Programs
diff --git a/src/libosmo-legacy-mgcp/Makefile.am b/src/libosmo-legacy-mgcp/Makefile.am
index 42f25c0..32902b9 100644
--- a/src/libosmo-legacy-mgcp/Makefile.am
+++ b/src/libosmo-legacy-mgcp/Makefile.am
@@ -41,8 +41,6 @@
 	mgcp_vty.c \
 	mgcp_osmux.c \
 	mgcp_sdp.c \
-	mgcpgw_client.c \
-	mgcpgw_client_vty.c \
 	$(NULL)
 if BUILD_MGCP_TRANSCODING
 libosmo_legacy_mgcp_la_SOURCES += \
diff --git a/src/libosmo-mgcp-client/Makefile.am b/src/libosmo-mgcp-client/Makefile.am
new file mode 100644
index 0000000..02b9177
--- /dev/null
+++ b/src/libosmo-mgcp-client/Makefile.am
@@ -0,0 +1,37 @@
+AM_CPPFLAGS = \
+	$(all_includes) \
+	-I$(top_srcdir)/include \
+	-I$(top_builddir) \
+	$(NULL)
+
+AM_CFLAGS = \
+	-Wall \
+	$(LIBOSMOCORE_CFLAGS) \
+	$(LIBOSMOVTY_CFLAGS) \
+	$(LIBOSMONETIF_CFLAGS) \
+	$(COVERAGE_CFLAGS) \
+	$(NULL)
+
+AM_LDFLAGS = \
+	$(LIBOSMOCORE_LIBS) \
+	$(LIBOSMOGSM_LIBS) \
+	$(LIBOSMONETIF_LIBS) \
+	$(COVERAGE_LDFLAGS) \
+	$(NULL)
+
+# This is _NOT_ the library release version, it's an API version.
+# Please read Chapter 6 "Library interface versions" of the libtool
+# documentation before making any modification
+MGCP_CLIENT_LIBVERSION=1:0:0
+
+lib_LTLIBRARIES = \
+	libosmo-mgcp-client.la \
+	$(NULL)
+
+libosmo_mgcp_client_la_SOURCES = \
+	mgcpgw_client.c \
+	mgcpgw_client_vty.c \
+	../libosmo-legacy-mgcp/mgcp_common.c \
+	$(NULL)
+
+libosmo_mgcp_client_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(MGCP_CLIENT_LIBVERSION)
diff --git a/src/libosmo-legacy-mgcp/mgcpgw_client.c b/src/libosmo-mgcp-client/mgcpgw_client.c
similarity index 99%
rename from src/libosmo-legacy-mgcp/mgcpgw_client.c
rename to src/libosmo-mgcp-client/mgcpgw_client.c
index 810ba16..7ed4b07 100644
--- a/src/libosmo-legacy-mgcp/mgcpgw_client.c
+++ b/src/libosmo-mgcp-client/mgcpgw_client.c
@@ -24,10 +24,10 @@
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/logging.h>
 
-#include <osmocom/legacy_mgcp/mgcpgw_client.h>
 #include <osmocom/legacy_mgcp/mgcp.h>
 #include <osmocom/legacy_mgcp/mgcp_internal.h>
-#include <osmocom/legacy_mgcp/mgcpgw_client_internal.h>
+#include <osmocom/mgcp_client/mgcpgw_client.h>
+#include <osmocom/mgcp_client/mgcpgw_client_internal.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
diff --git a/src/libosmo-legacy-mgcp/mgcpgw_client_vty.c b/src/libosmo-mgcp-client/mgcpgw_client_vty.c
similarity index 98%
rename from src/libosmo-legacy-mgcp/mgcpgw_client_vty.c
rename to src/libosmo-mgcp-client/mgcpgw_client_vty.c
index d101ded..034c84c 100644
--- a/src/libosmo-legacy-mgcp/mgcpgw_client_vty.c
+++ b/src/libosmo-mgcp-client/mgcpgw_client_vty.c
@@ -28,7 +28,7 @@
 #include <osmocom/core/utils.h>
 
 #include <osmocom/legacy_mgcp/vty.h>
-#include <osmocom/legacy_mgcp/mgcpgw_client.h>
+#include <osmocom/mgcp_client/mgcpgw_client.h>
 
 #define MGCPGW_STR "MGCP gateway configuration for RTP streams\n"