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/tests/Makefile.am b/tests/Makefile.am
index f6cb938..ae51f89 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,6 @@
 SUBDIRS = \
 	legacy_mgcp \
+	mgcp_client \
 	$(NULL)
 
 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
diff --git a/tests/legacy_mgcp/Makefile.am b/tests/legacy_mgcp/Makefile.am
index e5f6888..f043124 100644
--- a/tests/legacy_mgcp/Makefile.am
+++ b/tests/legacy_mgcp/Makefile.am
@@ -20,13 +20,10 @@
 EXTRA_DIST = \
 	mgcp_test.ok \
 	mgcp_transcoding_test.ok \
-	mgcpgw_client_test.ok \
-	mgcpgw_client_test.err \
 	$(NULL)
 
 noinst_PROGRAMS = \
 	mgcp_test \
-	mgcpgw_client_test \
 	$(NULL)
 if BUILD_MGCP_TRANSCODING
 noinst_PROGRAMS += \
@@ -62,16 +59,3 @@
 	$(LIBRARY_GSM) \
 	-lm \
 	$(NULL)
-
-mgcpgw_client_test_SOURCES = \
-	mgcpgw_client_test.c \
-	$(NULL)
-
-mgcpgw_client_test_LDADD = \
-	$(top_builddir)/src/libosmo-legacy-mgcp/libosmo-legacy-mgcp.la \
-	$(LIBOSMOCORE_LIBS) \
-	$(LIBOSMOVTY_LIBS) \
-	$(LIBRARY_DL) \
-	$(LIBOSMONETIF_LIBS) \
-	$(LIBRARY_GSM) \
-	$(NULL)
diff --git a/tests/mgcp_client/Makefile.am b/tests/mgcp_client/Makefile.am
new file mode 100644
index 0000000..2253770
--- /dev/null
+++ b/tests/mgcp_client/Makefile.am
@@ -0,0 +1,38 @@
+AM_CPPFLAGS = \
+	$(all_includes) \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir) \
+	$(NULL)
+
+AM_CFLAGS = \
+	-Wall \
+	-ggdb3 \
+	$(LIBOSMOCORE_CFLAGS) \
+	$(LIBOSMONETIF_CFLAGS) \
+	$(COVERAGE_CFLAGS) \
+	$(NULL)
+
+AM_LDFLAGS = \
+	$(COVERAGE_LDFLAGS) \
+	$(NULL)
+
+EXTRA_DIST = \
+	mgcpgw_client_test.ok \
+	mgcpgw_client_test.err \
+	$(NULL)
+
+noinst_PROGRAMS = \
+	mgcpgw_client_test \
+	$(NULL)
+
+mgcpgw_client_test_SOURCES = \
+	mgcpgw_client_test.c \
+	$(NULL)
+
+mgcpgw_client_test_LDADD = \
+	$(top_builddir)/src/libosmo-mgcp-client/libosmo-mgcp-client.la \
+	$(LIBOSMOCORE_LIBS) \
+	$(LIBOSMOVTY_LIBS) \
+	$(LIBRARY_DL) \
+	$(LIBOSMONETIF_LIBS) \
+	$(NULL)
diff --git a/tests/legacy_mgcp/mgcpgw_client_test.c b/tests/mgcp_client/mgcpgw_client_test.c
similarity index 97%
rename from tests/legacy_mgcp/mgcpgw_client_test.c
rename to tests/mgcp_client/mgcpgw_client_test.c
index 51d5272..e90a4ed 100644
--- a/tests/legacy_mgcp/mgcpgw_client_test.c
+++ b/tests/mgcp_client/mgcpgw_client_test.c
@@ -23,8 +23,8 @@
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/application.h>
 #include <osmocom/legacy_mgcp/mgcp.h>
-#include <osmocom/legacy_mgcp/mgcpgw_client.h>
-#include <osmocom/legacy_mgcp/mgcpgw_client_internal.h>
+#include <osmocom/mgcp_client/mgcpgw_client.h>
+#include <osmocom/mgcp_client/mgcpgw_client_internal.h>
 
 void *ctx;
 
diff --git a/tests/legacy_mgcp/mgcpgw_client_test.err b/tests/mgcp_client/mgcpgw_client_test.err
similarity index 100%
rename from tests/legacy_mgcp/mgcpgw_client_test.err
rename to tests/mgcp_client/mgcpgw_client_test.err
diff --git a/tests/legacy_mgcp/mgcpgw_client_test.ok b/tests/mgcp_client/mgcpgw_client_test.ok
similarity index 100%
rename from tests/legacy_mgcp/mgcpgw_client_test.ok
rename to tests/mgcp_client/mgcpgw_client_test.ok
diff --git a/tests/testsuite.at b/tests/testsuite.at
index dd59f2c..37347b3 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -14,9 +14,9 @@
 AT_CHECK([$abs_top_builddir/tests/legacy_mgcp/mgcp_transcoding_test], [], [expout], [ignore])
 AT_CLEANUP
 
-AT_SETUP([legacy_mgcpgw_client])
-AT_KEYWORDS([legacy_mgcpgw_client])
-cat $abs_srcdir/legacy_mgcp/mgcpgw_client_test.ok > expout
-cat $abs_srcdir/legacy_mgcp/mgcpgw_client_test.err > experr
-AT_CHECK([$abs_top_builddir/tests/legacy_mgcp/mgcpgw_client_test], [], [expout], [experr])
+AT_SETUP([mgcpgw_client])
+AT_KEYWORDS([mgcpgw_client])
+cat $abs_srcdir/mgcp_client/mgcpgw_client_test.ok > expout
+cat $abs_srcdir/mgcp_client/mgcpgw_client_test.err > experr
+AT_CHECK([$abs_top_builddir/tests/mgcp_client/mgcpgw_client_test], [], [expout], [experr])
 AT_CLEANUP