[config] configure.ac checks required features, updated porting

Added a real config.rpath
Fixed build date calc for BSD
Require some needed headers at configure time
Correctly check libav functions using pkg-config flags
Made checks for some Linux features available on other ports
Fixed porting issue with antlr dep files
Added default HOST_NAME_MAX if not defined
Added missing libav header
This commit is contained in:
Scott Shambarger
2016-12-29 16:14:22 -08:00
parent bcf7324c0a
commit 8ead7ea3b8
9 changed files with 765 additions and 87 deletions

View File

@@ -170,7 +170,7 @@ EXTRA_DIST = \
# ANTLR dependency files (bypass circular dependency of .g on .tokens)
%.u: %.g
$(AM_V_GEN)$(ANTLR) -depend -fo . $< > $@
$(AM_V_at)sed -n -e '/^.*\.g[ ]*:\(.*\)/ { s//\1/;h;d }' -e '/\.tokens.*:/ { p;d }' -e '/:/ { G;s/\n/ /;p }' $@ > $@-t
$(AM_V_at)sed -n -e '/^.*\.g[ ]*:\(.*\)/ { s//\1/;h;d; }' -e '/\.tokens.*:/ { p;d; }' -e '/:/ { G;s/\n/ /;p; }' $@ > $@-t
$(AM_V_at)mv $@-t $@
-include $(ANTLR_DEPS)

View File

@@ -183,11 +183,11 @@ commands_base_new(struct event_base *evbase, command_exit_cb exit_cb)
return NULL;
}
# if defined(__linux__)
#ifdef HAVE_PIPE2
ret = pipe2(cmdbase->command_pipe, O_CLOEXEC);
# else
#else
ret = pipe(cmdbase->command_pipe);
# endif
#endif
if (ret < 0)
{
DPRINTF(E_LOG, L_MAIN, "Could not create command pipe: %s\n", strerror(errno));

View File

@@ -25,9 +25,7 @@
#include <string.h>
#include <time.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>

View File

@@ -37,7 +37,7 @@
#include <grp.h>
#include <stdint.h>
#if defined(__linux__)
#ifdef HAVE_SIGNALFD
# include <sys/signalfd.h>
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <sys/time.h>
@@ -334,7 +334,7 @@ register_services(char *ffid, int no_rsp, int no_daap, int mdns_no_mpd)
}
#if defined(__linux__)
#ifdef HAVE_SIGNALFD
static void
signal_signalfd_cb(int fd, short event, void *arg)
{
@@ -813,7 +813,7 @@ main(int argc, char **argv)
/* Register this CNAME with mDNS for OAuth */
mdns_cname("forked-daapd.local");
#if defined(__linux__)
#ifdef HAVE_SIGNALFD
/* Set up signal fd */
sigfd = signalfd(-1, &sigs, SFD_NONBLOCK | SFD_CLOEXEC);
if (sigfd < 0)

View File

@@ -630,6 +630,11 @@ entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_U
}
}
#ifndef HOST_NAME_MAX
/* some systems want programs to query this, just define a reasonable limit */
#define HOST_NAME_MAX 64
#endif
static int
create_group_entry(struct mdns_group_entry *ge, int commit)
{

View File

@@ -35,7 +35,7 @@
# include <pthread_np.h>
#endif
#if defined(__linux__)
#ifdef HAVE_TIMERFD
# include <sys/timerfd.h>
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <signal.h>
@@ -193,7 +193,7 @@ static char shuffle;
static char consume;
/* Playback timer */
#if defined(__linux__)
#ifdef HAVE_TIMERFD
static int pb_timer_fd;
#else
timer_t pb_timer;
@@ -389,7 +389,7 @@ pb_timer_start(void)
tick.it_interval = tick_interval;
tick.it_value = tick_interval;
#if defined(__linux__)
#ifdef HAVE_TIMERFD
ret = timerfd_settime(pb_timer_fd, 0, &tick, NULL);
#else
ret = timer_settime(pb_timer, 0, &tick, NULL);
@@ -412,7 +412,7 @@ pb_timer_stop(void)
memset(&tick, 0, sizeof(struct itimerspec));
#if defined(__linux__)
#ifdef HAVE_TIMERFD
ret = timerfd_settime(pb_timer_fd, 0, &tick, NULL);
#else
ret = timer_settime(pb_timer, 0, &tick, NULL);
@@ -1451,7 +1451,7 @@ player_playback_cb(int fd, short what, void *arg)
// Check if we missed any timer expirations
overrun = 0;
#if defined(__linux__)
#ifdef HAVE_TIMERFD
ret = read(fd, &overrun, sizeof(overrun));
if (ret <= 0)
DPRINTF(E_LOG, L_PLAYER, "Error reading timer\n");
@@ -1463,7 +1463,7 @@ player_playback_cb(int fd, short what, void *arg)
DPRINTF(E_LOG, L_PLAYER, "Error getting timer overrun\n");
else
overrun = ret;
#endif /* __linux__ */
#endif /* HAVE_TIMERFD */
// The reason we get behind the playback timer may be that we are playing a
// network stream OR that the source is slow to open OR some interruption.
@@ -3479,7 +3479,7 @@ player_init(void)
tick_interval.tv_nsec = interval;
// Create the playback timer
#if defined(__linux__)
#ifdef HAVE_TIMERFD
pb_timer_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
ret = pb_timer_fd;
#else
@@ -3512,7 +3512,7 @@ player_init(void)
goto evbase_fail;
}
#if defined(__linux__)
#ifdef HAVE_TIMERFD
pb_timer_ev = event_new(evbase_player, pb_timer_fd, EV_READ | EV_PERSIST, player_playback_cb, NULL);
#else
pb_timer_ev = event_new(evbase_player, SIGALRM, EV_SIGNAL | EV_PERSIST, player_playback_cb, NULL);
@@ -3557,7 +3557,7 @@ player_init(void)
evbase_fail:
evbuffer_free(audio_buf);
audio_fail:
#if defined(__linux__)
#ifdef HAVE_TIMERFD
close(pb_timer_fd);
#else
timer_delete(pb_timer);
@@ -3586,7 +3586,7 @@ player_deinit(void)
free(history);
pb_timer_stop();
#if defined(__linux__)
#ifdef HAVE_TIMERFD
close(pb_timer_fd);
#else
timer_delete(pb_timer);

View File

@@ -32,6 +32,7 @@
#include <libavutil/opt.h>
#include <libavutil/time.h>
#include <libavutil/pixdesc.h>
#include <libavutil/channel_layout.h>
#ifdef HAVE_LIBAVFILTER
# include <libavfilter/avcodec.h>