From e26ea2f072a3702efcd1a3ee93ed58ab049977d5 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 15 Sep 2009 17:51:15 +0000 Subject: Fix some FreeBSD compatibility issues in -tools Part of issue #15877. Reported by: Max Khon Patches: dahdi-tools.diff uploaded by Max Khon (license 884) git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@7134 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- Makefile | 11 +++++++---- dahdi_monitor.c | 4 ++++ tonezone.c | 8 ++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 588393a..16cac51 100644 --- a/Makefile +++ b/Makefile @@ -230,12 +230,14 @@ ifneq (,$(BINS)) install -m 644 $(MAN_PAGES) $(DESTDIR)$(MAN_DIR)/ endif ifeq (,$(wildcard $(DESTDIR)$(CONFIG_FILE))) - $(INSTALL) -D -m 644 system.conf.sample $(DESTDIR)$(CONFIG_FILE) + $(INSTALL) -d $(DESTDIR)$(CONFIG_DIR) + $(INSTALL) -m 644 system.conf.sample $(DESTDIR)$(CONFIG_FILE) endif install-libs: libs - $(INSTALL) -D -m 755 $(LTZ_A) $(DESTDIR)$(LIB_DIR)/$(LTZ_A) - $(INSTALL) -D -m 755 $(LTZ_SO) $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) + $(INSTALL) -d -m 755 $(DESTDIR)/$(LIB_DIR) + $(INSTALL) -m 755 $(LTZ_A) $(DESTDIR)$(LIB_DIR)/ + $(INSTALL) -m 755 $(LTZ_SO) $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) ifeq (,$(DESTDIR)) if [ `id -u` = 0 ]; then \ /sbin/ldconfig || : ;\ @@ -260,7 +262,8 @@ ifneq (no,$(USE_SELINUX)) /sbin/restorecon -v $(DESTDIR)$(LIB_DIR)/$(LTZ_SO) endif endif - $(INSTALL) -D -m 644 tonezone.h $(DESTDIR)$(INC_DIR)/tonezone.h + $(INSTALL) -d -m 755 $(DESTDIR)/$(INC_DIR) + $(INSTALL) -m 644 tonezone.h $(DESTDIR)$(INC_DIR)/ install-utils-subdirs: @for dir in $(SUBDIRS_UTILS); do \ diff --git a/dahdi_monitor.c b/dahdi_monitor.c index ce900d6..98a2f72 100644 --- a/dahdi_monitor.c +++ b/dahdi_monitor.c @@ -42,7 +42,11 @@ #include "dahdi_tools_version.h" #include "wavformat.h" +#if defined(__FreeBSD__) +#include +#else #include +#endif /* * defines for file handle numbers diff --git a/tonezone.c b/tonezone.c index 5895851..afdec99 100644 --- a/tonezone.c +++ b/tonezone.c @@ -52,6 +52,10 @@ # define PRINT_DEBUG(x, ...) #endif +#ifndef ENODATA +#define ENODATA EINVAL +#endif + struct tone_zone *tone_zone_find(char *country) { struct tone_zone *z; @@ -431,7 +435,11 @@ int tone_zone_register_zone(int fd, struct tone_zone *z) dump_tone_zone(h, MAX_SIZE - space); #endif +#if defined(__FreeBSD__) + if ((res = ioctl(fd, DAHDI_LOADZONE, &h))) { +#else if ((res = ioctl(fd, DAHDI_LOADZONE, h))) { +#endif fprintf(stderr, "ioctl(DAHDI_LOADZONE) failed: %s\n", strerror(errno)); return res; } -- cgit v1.2.3