From: Antonio Ospite Date: Tue, 22 May 2012 14:21:25 +0000 (+0200) Subject: am7xxx-play: check if sigaction is available X-Git-Tag: v0.1.3~27 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/38fb8a1d547de6d09137d076baffa94505335f96?ds=sidebyside am7xxx-play: check if sigaction is available If sigaction is not available just stub out the set_signal_handler() function. --- diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7e7b455..e24442b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -32,6 +32,13 @@ if(BUILD_AM7XXX-PLAY) include_directories(${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}) include_directories(${FFMPEG_LIBSWSCALE_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_SOURCE) + check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION) + if (HAVE_SIGACTION) + add_definitions("-DHAVE_SIGACTION") + endif() + set(CMAKE_REQUIRED_DEFINITIONS) + # xcb is used to retrieve the full screen dimensions when using x11grab # as input format find_package(XCB) diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c index 49b5234..352ba2f 100644 --- a/examples/am7xxx-play.c +++ b/examples/am7xxx-play.c @@ -539,6 +539,7 @@ static void unset_run(int signo) run = 0; } +#ifdef HAVE_SIGACTION static int set_signal_handler(void (*signal_handler)(int)) { struct sigaction new_action; @@ -566,6 +567,15 @@ static int set_signal_handler(void (*signal_handler)(int)) out: return ret; } +#else +static int set_signal_handler(void (*signal_handler)(int)) +{ + (void)signal_handler; + fprintf(stderr, "set_signal_handler() not implemented, sigaction not available\n"); + return 0; +} +#endif + static void usage(char *name) {