diff --git a/Makefile b/Makefile index b83a7039ce..6dffd8cd41 100755 --- a/Makefile +++ b/Makefile @@ -301,6 +301,16 @@ OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \ utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \ netsock.o slinfactory.o ast_expr2.o ast_expr2f.o +ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),) + OBJS+= poll.o + ASTCFLAGS+=-DPOLLCOMPAT +endif + +ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/dlfcn.h),) + OBJS+= dhfcn.o + ASTCFLAGS+=-DDLFCNCOMPAT +endif + ifeq (${OSARCH},Linux) LIBS=-ldl -lpthread -lncurses -lm -lresolv #-lnjamd else @@ -311,7 +321,6 @@ ifeq (${OSARCH},Darwin) LIBS+=-lresolv ASTCFLAGS+=-D__Darwin__ AUDIO_LIBS=-framework CoreAudio - OBJS+=poll.o dlfcn.o ASTLINK=-Wl,-dynamic SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace else diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 4e9d2b39af..67b32b1b82 100755 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -31,7 +31,7 @@ #include #include -#if defined(__APPLE__) +#ifdef POLLCOMPAT #include "asterisk/poll-compat.h" #else #include diff --git a/include/asterisk/io.h b/include/asterisk/io.h index a9be35703b..8bda98a2ba 100755 --- a/include/asterisk/io.h +++ b/include/asterisk/io.h @@ -23,7 +23,7 @@ #ifndef _ASTERISK_IO_H #define _ASTERISK_IO_H -#ifdef __APPLE__ +#ifdef POLLCOMPAT #include "asterisk/poll-compat.h" #else #include /* For POLL* constants */ diff --git a/loader.c b/loader.c index 460c548a5c..0af47a8592 100755 --- a/loader.c +++ b/loader.c @@ -43,7 +43,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/enum.h" #include "asterisk/rtp.h" #include "asterisk/lock.h" -#ifdef __APPLE__ +#ifdef DLFCNCOMPAT #include "asterisk/dlfcn-compat.h" #else #include