summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2017-10-16 09:28:30 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2017-10-16 09:28:30 +0200
commit26bc9bb629c49c0d5a8668a92c0c7b64626b65c7 (patch)
treebf04e8306be10882e2a02afc5d93b276396fb8fe
parent7c283feb273c2df98a4b948c8f3005ae5d84c984 (diff)
downloaduca-net-26bc9bb629c49c0d5a8668a92c0c7b64626b65c7.tar.gz
uca-net-26bc9bb629c49c0d5a8668a92c0c7b64626b65c7.tar.bz2
uca-net-26bc9bb629c49c0d5a8668a92c0c7b64626b65c7.tar.xz
uca-net-26bc9bb629c49c0d5a8668a92c0c7b64626b65c7.zip
Fix #7: use glib-unix.h only on UNIX-like OSes
-rw-r--r--CMakeLists.txt4
-rw-r--r--config.h.in1
-rw-r--r--meson.build1
-rw-r--r--ucad.c9
4 files changed, 14 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 480c91c..45120e4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,6 +27,10 @@ pkg_check_variable(libuca plugindir)
set(UCA_NET_DEFAULT_PORT 8989)
+if (UNIX)
+ set(HAVE_UNIX 1)
+endif ()
+
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
diff --git a/config.h.in b/config.h.in
index 43d9bb6..2b0b69c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1 +1,2 @@
+#cmakedefine HAVE_UNIX
#cmakedefine UCA_NET_DEFAULT_PORT ${UCA_NET_DEFAULT_PORT}
diff --git a/meson.build b/meson.build
index 9c81a5d..8dcd4db 100644
--- a/meson.build
+++ b/meson.build
@@ -7,6 +7,7 @@ plugindir = uca_dep.get_pkgconfig_variable('plugindir')
config = configuration_data()
config.set('UCA_NET_DEFAULT_PORT', get_option('default_port'))
+config.set('HAVE_UNIX', host_machine.system() != 'windows')
configure_file(
output: 'config.h',
diff --git a/ucad.c b/ucad.c
index 07e9157..8b2bd23 100644
--- a/ucad.c
+++ b/ucad.c
@@ -16,7 +16,6 @@
Franklin St, Fifth Floor, Boston, MA 02110, USA */
#include <glib-object.h>
-#include <glib-unix.h>
#include <gio/gio.h>
#include <string.h>
#include <signal.h>
@@ -25,6 +24,10 @@
#include "uca-net-protocol.h"
#include "config.h"
+#ifdef HAVE_UNIX
+#include <glib-unix.h>
+#endif
+
static GMainLoop *loop;
typedef void (*MessageHandler) (GSocketConnection *connection, UcaCamera *camera, gpointer message, GError **error);
@@ -428,7 +431,11 @@ serve (UcaCamera *camera, guint16 port, GError **error)
g_signal_connect (service, "run", G_CALLBACK (run_callback), camera);
loop = g_main_loop_new (NULL, TRUE);
+
+#ifdef HAVE_UNIX
g_unix_signal_add (SIGINT, (GSourceFunc) g_main_loop_quit, loop);
+#endif
+
g_main_loop_run (loop);
}