mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
Make it build and run on MacOS X
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1673 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
12
Makefile
12
Makefile
@@ -95,7 +95,6 @@ ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
|
||||
ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
|
||||
ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
|
||||
|
||||
|
||||
MODULES_DIR=$(ASTLIBDIR)/modules
|
||||
AGI_DIR=$(ASTVARLIBDIR)/agi-bin
|
||||
|
||||
@@ -158,6 +157,15 @@ OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
|
||||
cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \
|
||||
dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
|
||||
astmm.o enum.o srv.o dns.o
|
||||
ifeq (${OSARCH},Darwin)
|
||||
OBJS+=poll.o dlfcn.o
|
||||
ASTLINK=-Wl,-dynamic
|
||||
SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
|
||||
else
|
||||
ASTLINK=-Wl,-E
|
||||
SOLINK=-shared -Xlinker -x
|
||||
endif
|
||||
|
||||
CC=gcc
|
||||
INSTALL=install
|
||||
|
||||
@@ -224,7 +232,7 @@ stdtime/libtime.a: FORCE
|
||||
fi
|
||||
|
||||
asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
|
||||
$(CC) $(DEBUG) -o asterisk -Wl,-E $(OBJS) $(LIBS) $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a
|
||||
$(CC) $(DEBUG) -o asterisk $(ASTLINK) $(OBJS) $(LIBS) $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a
|
||||
|
||||
subdirs:
|
||||
for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done
|
||||
|
@@ -15,7 +15,7 @@ USE_MYSQL_VM_INTERFACE=0
|
||||
USE_POSTGRES_VM_INTERFACE=0
|
||||
|
||||
#APPS=app_dial.so app_playback.so app_directory.so app_intercom.so app_mp3.so
|
||||
APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_intercom.so app_mp3.so \
|
||||
APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_mp3.so\
|
||||
app_system.so app_echo.so app_record.so app_image.so app_url.so app_disa.so \
|
||||
app_agi.so app_qcall.so app_adsiprog.so app_getcpeid.so app_milliwatt.so \
|
||||
app_zapateller.so app_datetime.so app_setcallerid.so app_festival.so \
|
||||
@@ -26,6 +26,10 @@ APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_intercom.
|
||||
app_enumlookup.so app_voicemail2.so app_transfer.so app_setcidnum.so app_cdr.so \
|
||||
app_hasnewvoicemail.so app_sayunixtime.so app_cut.so
|
||||
|
||||
ifneq (${OSARCH},Darwin)
|
||||
APPS+=app_intercom.so
|
||||
endif
|
||||
|
||||
#APPS+=app_sql_postgres.so
|
||||
#APPS+=app_sql_odbc.so
|
||||
|
||||
@@ -44,10 +48,10 @@ clean:
|
||||
rm -f *.so *.o look .depend
|
||||
|
||||
%.so : %.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $<
|
||||
$(CC) $(SOLINK) -o $@ $<
|
||||
|
||||
app_rpt.so : app_rpt.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< -ltonezone
|
||||
$(CC) $(SOLINK) -o $@ $< -ltonezone
|
||||
|
||||
install: all
|
||||
for x in $(APPS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
|
||||
@@ -56,16 +60,16 @@ app_todd.o: app_todd.c
|
||||
gcc -pipe -O6 -g -Iinclude -I../include -D_REENTRANT -march=i586 -DDO_CRASH -c -o app_todd.o app_todd.c
|
||||
|
||||
app_todd.so: app_todd.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< -L/usr/local/ssl/lib -lssl -lcrypto
|
||||
$(CC) $(SOLINK) -o $@ $< -L/usr/local/ssl/lib -lssl -lcrypto
|
||||
|
||||
app_voicemail2.so : app_voicemail2.o
|
||||
ifeq ($(USE_MYSQL_VM_INTERFACE),1)
|
||||
$(CC) -shared -Xlinker -x -o $@ $(MLFLAGS) $< -lmysqlclient -lz
|
||||
$(CC) $(SOLINK) -o $@ $(MLFLAGS) $< -lmysqlclient -lz
|
||||
else
|
||||
ifeq ($(USE_POSTGRES_VM_INTERFACE),1)
|
||||
$(CC) -shared -Xlinker -x -o $@ $(MLFLAGS) $< -lpq
|
||||
$(CC) $(SOLINK) -o $@ $(MLFLAGS) $< -lpq
|
||||
else
|
||||
$(CC) -shared -Xlinker -x -o $@ $(MLFLAGS) $<
|
||||
$(CC) $(SOLINK) -o $@ $(MLFLAGS) $<
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -73,10 +77,10 @@ app_sql_postgres.o: app_sql_postgres.c
|
||||
$(CC) -pipe -I/usr/local/pgsql/include $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
|
||||
|
||||
app_sql_postgres.so: app_sql_postgres.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< -L/usr/local/pgsql/lib -lpq
|
||||
$(CC) $(SOLINK) -o $@ $< -L/usr/local/pgsql/lib -lpq
|
||||
|
||||
app_sql_odbc.so: app_sql_odbc.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< -lodbc
|
||||
$(CC) $(SOLINK) -o $@ $< -lodbc
|
||||
|
||||
look: look.c
|
||||
gcc -pipe -O6 -g look.c -o look -lncurses
|
||||
|
@@ -40,14 +40,14 @@ clean:
|
||||
rm -f *.so *.o .depend
|
||||
|
||||
%.so : %.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $<
|
||||
$(CC) $(SOLINK) -o $@ $<
|
||||
|
||||
ifneq ($(wildcard .depend),)
|
||||
include .depend
|
||||
endif
|
||||
|
||||
cdr_pgsql.so: cdr_pgsql.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< -lpq -lz $(MLFLAGS)
|
||||
$(CC) $(SOLINK) -o $@ $< -lpq -lz $(MLFLAGS)
|
||||
|
||||
depend: .depend
|
||||
|
||||
|
@@ -14,7 +14,7 @@
|
||||
OSARCH=$(shell uname -s)
|
||||
|
||||
CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \
|
||||
chan_modem_aopen.so chan_oss.so \
|
||||
chan_modem_aopen.so \
|
||||
chan_modem_bestdata.so chan_modem_i4l.so \
|
||||
chan_agent.so chan_mgcp.so chan_iax2.so \
|
||||
chan_local.so chan_skinny.so
|
||||
@@ -24,6 +24,10 @@ CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \
|
||||
#
|
||||
#CHANNEL_LIBS+=chan_vofr
|
||||
|
||||
ifneq (${OSARCH},Darwin)
|
||||
CHANNEL_LIBS+=chan_oss.so
|
||||
endif
|
||||
|
||||
CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
|
||||
CHANNEL_LIBS+=$(shell [ -f h323/libchanh323.a ] && echo chan_h323.so)
|
||||
|
||||
@@ -71,7 +75,7 @@ clean:
|
||||
rm -f busy.h ringtone.h gentone gentone-ulaw
|
||||
|
||||
%.so : %.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $<
|
||||
$(CC) $(SOLINK) -o $@ $<
|
||||
|
||||
ifneq ($(wildcard .depend),)
|
||||
include .depend
|
||||
@@ -93,35 +97,35 @@ chan_oss.o: chan_oss.c busy.h ringtone.h
|
||||
|
||||
ifeq (${OSARCH},OpenBSD)
|
||||
chan_oss.so: chan_oss.o
|
||||
$(CC) -shared -Xlinker -x -o $@ chan_oss.o -lossaudio
|
||||
$(CC) $(SOLINK) -o $@ chan_oss.o -lossaudio
|
||||
endif
|
||||
|
||||
chan_iax2.so: chan_iax2.o iax2-parser.o
|
||||
$(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o
|
||||
$(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o
|
||||
|
||||
chan_zap.o: $(CHANZAP)
|
||||
$(CC) -c $(CFLAGS) -o chan_zap.o $(CHANZAP)
|
||||
|
||||
chan_zap.so: chan_zap.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< $(ZAPPRI) $(ZAPR2) -ltonezone $(ZAPLIB)
|
||||
$(CC) $(SOLINK) -o $@ $< $(ZAPPRI) $(ZAPR2) -ltonezone $(ZAPLIB)
|
||||
|
||||
chan_alsa.o: $(ALSA_SRC)
|
||||
|
||||
|
||||
chan_alsa.so: chan_alsa.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< -lasound -lm -ldl
|
||||
$(CC) $(SOLINK) -o $@ $< -lasound -lm -ldl
|
||||
|
||||
chan_nbs.so: chan_nbs.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< -lnbs
|
||||
$(CC) $(SOLINK) -o $@ $< -lnbs
|
||||
|
||||
chan_vpb.o: chan_vpb.c
|
||||
$(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
|
||||
|
||||
chan_vpb.so: chan_vpb.o
|
||||
$(CXX) -shared -Xlinker -x -o $@ $< -lvpb -lpthread -lm -ldl
|
||||
$(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
|
||||
|
||||
chan_h323.so: chan_h323.o h323/libchanh323.a
|
||||
$(CC) -shared -Xlinker -x -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib -lpt_linux_x86_r -L$(OPENH323DIR)/lib -lh323_linux_x86_r -L/usr/lib -lpthread -ldl -lcrypto -lssl -lexpat
|
||||
$(CC) $(SOLINK) -o $@ $< h323/libchanh323.a -L$(PWLIBDIR)/lib -lpt_linux_x86_r -L$(OPENH323DIR)/lib -lh323_linux_x86_r -L/usr/lib -lpthread -ldl -lcrypto -lssl -lexpat
|
||||
|
||||
|
||||
#chan_modem.so : chan_modem.o
|
||||
|
@@ -68,31 +68,31 @@ $(LIBILBC):
|
||||
$(MAKE) -C ilbc all
|
||||
|
||||
codec_ilbc.so: codec_ilbc.o $(LIBILBC)
|
||||
$(CC) -shared -Xlinker -x -o $@ $< $(LIBILBC)
|
||||
$(CC) $(SOLINK) -o $@ $< $(LIBILBC)
|
||||
|
||||
codec_g723_1.so : codec_g723_1.o $(LIBG723)
|
||||
$(CC) -shared -Xlinker -x -o $@ $< $(LIBG723)
|
||||
$(CC) $(SOLINK) -o $@ $< $(LIBG723)
|
||||
|
||||
codec_g723_1b.o : codec_g723_1.c
|
||||
$(CC) -c -o $@ $(CFLAGS) -DANNEX_B -Dsingle $<
|
||||
|
||||
codec_g723_1b.so : codec_g723_1b.o $(LIBG723B)
|
||||
$(CC) -shared -Xlinker -x -o $@ $< $(LIBG723B) -lm
|
||||
$(CC) $(SOLINK) -o $@ $< $(LIBG723B) -lm
|
||||
|
||||
codec_gsm.so: codec_gsm.o $(LIBGSMT)
|
||||
$(CC) -shared -Xlinker -x -o $@ $< $(LIBGSM)
|
||||
$(CC) $(SOLINK) -o $@ $< $(LIBGSM)
|
||||
|
||||
codec_speex.so: codec_speex.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< $(LIBSPEEX)
|
||||
$(CC) $(SOLINK) -o $@ $< $(LIBSPEEX)
|
||||
|
||||
codec_lpc10.so: codec_lpc10.o $(LIBLPC10)
|
||||
$(CC) -shared -Xlinker -x -o $@ $< $(LIBLPC10) -lm
|
||||
$(CC) $(SOLINK) -o $@ $< $(LIBLPC10) -lm
|
||||
|
||||
codec_mp3_d.so: codec_mp3_d.o $(LIBMP3)
|
||||
$(CC) -lm -shared -Xlinker -x -o $@ $< $(LIBMP3)
|
||||
$(CC) -lm $(SOLINK) -o $@ $< $(LIBMP3)
|
||||
|
||||
%.so : %.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $<
|
||||
$(CC) $(SOLINK) -o $@ $<
|
||||
|
||||
include .depend
|
||||
|
||||
|
@@ -26,9 +26,11 @@ CFLAGS = $(OPTIMIZE) -I$(LIB_TARGET_DIR) $(WARNINGS) -fPIC
|
||||
#CFLAGS+= $(shell if uname -m | grep -q 86; then echo "-mpentium" ; fi)
|
||||
|
||||
#fix for PPC processors
|
||||
ifneq ($(OSARCH),Darwin)
|
||||
ifneq ($(PROC),ppc)
|
||||
CFLAGS+= -march=$(PROC)
|
||||
endif
|
||||
endif
|
||||
|
||||
LIB = $(LIB_TARGET_DIR)/liblpc10.a
|
||||
|
||||
|
@@ -1,8 +1,11 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.16 2003/04/23 19:13:35 markster
|
||||
More OpenBSD patches
|
||||
Revision 1.17 2003/10/26 18:50:49 markster
|
||||
Make it build and run on MacOS X
|
||||
|
||||
Revision 1.3 2003/10/26 18:50:49 markster
|
||||
Make it build and run on MacOS X
|
||||
|
||||
Revision 1.2 2003/04/23 19:13:35 markster
|
||||
More OpenBSD patches
|
||||
@@ -49,6 +52,10 @@ typedef int INT16;
|
||||
typedef long INT32;
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
typedef short INT16;
|
||||
typedef int INT32;
|
||||
#endif
|
||||
|
||||
|
||||
/* The initial values for every member of this structure is 0, except
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#
|
||||
# LMC section
|
||||
|
||||
CFLAGS+= -I../include -Iinclude -O3 -march=$(PROC) -funroll-loops -Wall -Wno-missing-prototypes -Wno-missing-declarations -g -fPIC
|
||||
CFLAGS+= -I../include -Iinclude -O3 -funroll-loops -Wall -Wno-missing-prototypes -Wno-missing-declarations -g -fPIC
|
||||
|
||||
RANLIB=ranlib
|
||||
|
||||
# the XING decoder objs and dependencies:
|
||||
|
@@ -75,9 +75,11 @@ dbopen(fname, flags, mode, type, openinfo)
|
||||
return (NULL);
|
||||
}
|
||||
#undef dbopen
|
||||
#ifndef __APPLE__
|
||||
#define weak_alias(original, alias) \
|
||||
asm (".weak " #alias "\n" #alias " = " #original);
|
||||
weak_alias (__dbopen, dbopen)
|
||||
#endif
|
||||
|
||||
static int
|
||||
__dberr __P((void))
|
||||
|
@@ -51,7 +51,7 @@
|
||||
|
||||
#ifndef __BIT_TYPES_DEFINED__
|
||||
#define __BIT_TYPES_DEFINED__
|
||||
#ifndef __FreeBSD__
|
||||
#if (!defined(__FreeBSD__) && !defined(__APPLE__))
|
||||
typedef __signed char int8_t;
|
||||
typedef unsigned char u_int8_t;
|
||||
typedef short int16_t;
|
||||
|
@@ -316,6 +316,8 @@ mpool_sync(mp)
|
||||
#undef mpool_put
|
||||
#undef mpool_close
|
||||
#undef mpool_sync
|
||||
|
||||
#ifndef __APPLE__
|
||||
#define weak_alias(original, alias) \
|
||||
asm (".weak " #alias "\n" #alias " = " #original);
|
||||
weak_alias (__mpool_open, mpool_open)
|
||||
@@ -325,6 +327,7 @@ weak_alias (__mpool_get, mpool_get)
|
||||
weak_alias (__mpool_put, mpool_put)
|
||||
weak_alias (__mpool_close, mpool_close)
|
||||
weak_alias (__mpool_sync, mpool_sync)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* mpool_bkt
|
||||
|
4
dns.c
4
dns.c
@@ -178,10 +178,12 @@ int ast_search_dns(void *context,
|
||||
else
|
||||
ret = 1;
|
||||
}
|
||||
#ifdef __Linux__
|
||||
#if defined(__Linux__)
|
||||
res_nclose(&srvstate);
|
||||
#else
|
||||
#ifndef __APPLE__
|
||||
res_close();
|
||||
#endif
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
5
enum.c
5
enum.c
@@ -30,6 +30,11 @@
|
||||
#include <asterisk/channel.h>
|
||||
#include <asterisk/config.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#undef T_NAPTR
|
||||
#define T_NAPTR 35
|
||||
#endif
|
||||
|
||||
#define TOPLEV "e164.arpa."
|
||||
|
||||
static struct enum_search {
|
||||
|
@@ -30,14 +30,14 @@ clean:
|
||||
rm -f *.so *.o .depend
|
||||
|
||||
%.so : %.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $<
|
||||
$(CC) $(SOLINK) -o $@ $<
|
||||
|
||||
ifneq ($(wildcard .depend),)
|
||||
include .depend
|
||||
endif
|
||||
|
||||
format_mp3.so : format_mp3.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< -lm
|
||||
$(CC) $(SOLINK) -o $@ $< -lm
|
||||
|
||||
install: all
|
||||
for x in $(FORMAT_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
|
||||
|
77
include/asterisk/dlfcn-compat.h
Executable file
77
include/asterisk/dlfcn-compat.h
Executable file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
Copyright (c) 2002 Jorge Acereda <jacereda@users.sourceforge.net> &
|
||||
Peter O'Gorman <ogorman@users.sourceforge.net>
|
||||
|
||||
Portions may be copyright others, see the AUTHORS file included with this
|
||||
distribution.
|
||||
|
||||
Maintained by Peter O'Gorman <ogorman@users.sourceforge.net>
|
||||
|
||||
Bug Reports and other queries should go to <ogorman@users.sourceforge.net>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _DLFCN_H_
|
||||
#define _DLFCN_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined (__GNUC__) && __GNUC__ > 3
|
||||
#define dl_restrict __restrict
|
||||
#else
|
||||
#define dl_restrict
|
||||
#endif
|
||||
/*
|
||||
* Structure filled in by dladdr().
|
||||
*/
|
||||
|
||||
typedef struct dl_info {
|
||||
const char *dli_fname; /* Pathname of shared object */
|
||||
void *dli_fbase; /* Base address of shared object */
|
||||
const char *dli_sname; /* Name of nearest symbol */
|
||||
void *dli_saddr; /* Address of nearest symbol */
|
||||
} Dl_info;
|
||||
|
||||
extern void * dlopen(const char *path, int mode);
|
||||
extern void * dlsym(void * dl_restrict handle, const char * dl_restrict symbol);
|
||||
extern const char * dlerror(void);
|
||||
extern int dlclose(void * handle);
|
||||
extern int dladdr(const void * dl_restrict, Dl_info * dl_restrict);
|
||||
|
||||
#define RTLD_LAZY 0x1
|
||||
#define RTLD_NOW 0x2
|
||||
#define RTLD_LOCAL 0x4
|
||||
#define RTLD_GLOBAL 0x8
|
||||
#define RTLD_NOLOAD 0x10
|
||||
#define RTLD_NODELETE 0x80
|
||||
|
||||
/*
|
||||
* Special handle arguments for dlsym().
|
||||
*/
|
||||
#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */
|
||||
#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _DLFCN_H_ */
|
@@ -14,7 +14,11 @@
|
||||
#ifndef _IO_H
|
||||
#define _IO_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <asterisk/poll-compat.h>
|
||||
#else
|
||||
#include <sys/poll.h> /* For POLL* constants */
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
|
101
include/asterisk/poll-compat.h
Executable file
101
include/asterisk/poll-compat.h
Executable file
@@ -0,0 +1,101 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
$Id$
|
||||
|
||||
NAME
|
||||
|
||||
poll - select(2)-based poll() emulation function for BSD systems.
|
||||
|
||||
SYNOPSIS
|
||||
#include "poll.h"
|
||||
|
||||
struct pollfd
|
||||
{
|
||||
int fd;
|
||||
short events;
|
||||
short revents;
|
||||
}
|
||||
|
||||
int poll (struct pollfd *pArray, unsigned long n_fds, int timeout)
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
This file, and the accompanying "poll.c", implement the System V
|
||||
poll(2) system call for BSD systems (which typically do not provide
|
||||
poll()). Poll() provides a method for multiplexing input and output
|
||||
on multiple open file descriptors; in traditional BSD systems, that
|
||||
capability is provided by select(). While the semantics of select()
|
||||
differ from those of poll(), poll() can be readily emulated in terms
|
||||
of select() -- which is how this function is implemented.
|
||||
|
||||
REFERENCES
|
||||
Stevens, W. Richard. Unix Network Programming. Prentice-Hall, 1990.
|
||||
|
||||
NOTES
|
||||
1. This software requires an ANSI C compiler.
|
||||
|
||||
LICENSE
|
||||
|
||||
This software is released under the following license:
|
||||
|
||||
Copyright (c) 1995-2002 Brian M. Clapper
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms are
|
||||
permitted provided that: (1) source distributions retain
|
||||
this entire copyright notice and comment; (2) modifications
|
||||
made to the software are prominently mentioned, and a copy
|
||||
of the original software (or a pointer to its location) are
|
||||
included; and (3) distributions including binaries display
|
||||
the following acknowledgement: "This product includes
|
||||
software developed by Brian M. Clapper <bmc@clapper.org>"
|
||||
in the documentation or other materials provided with the
|
||||
distribution. The name of the author may not be used to
|
||||
endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE.
|
||||
|
||||
Effectively, this means you can do what you want with the software
|
||||
except remove this notice or take advantage of the author's name.
|
||||
If you modify the software and redistribute your modified version,
|
||||
you must indicate that your version is a modification of the
|
||||
original, and you must provide either a pointer to or a copy of the
|
||||
original.
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _POLL_EMUL_H_
|
||||
#define _POLL_EMUL_H_
|
||||
|
||||
#define POLLIN 0x01
|
||||
#define POLLPRI 0x02
|
||||
#define POLLOUT 0x04
|
||||
#define POLLERR 0x08
|
||||
#define POLLHUP 0x10
|
||||
#define POLLNVAL 0x20
|
||||
|
||||
struct pollfd
|
||||
{
|
||||
int fd;
|
||||
short events;
|
||||
short revents;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if (__STDC__ > 0) || defined(__cplusplus)
|
||||
extern int poll (struct pollfd *pArray, unsigned long n_fds, int timeout);
|
||||
#else
|
||||
extern int poll();
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _POLL_EMUL_H_ */
|
1
io.c
1
io.c
@@ -12,7 +12,6 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/poll.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <termios.h>
|
||||
|
4
loader.c
4
loader.c
@@ -25,7 +25,11 @@
|
||||
#include <asterisk/manager.h>
|
||||
#include <asterisk/enum.h>
|
||||
#include <asterisk/rtp.h>
|
||||
#ifdef __APPLE__
|
||||
#include <asterisk/dlfcn-compat.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#include <asterisk/md5.h>
|
||||
#include <pthread.h>
|
||||
#include "asterisk.h"
|
||||
|
@@ -40,7 +40,7 @@ pbx_gtkconsole.o: pbx_gtkconsole.c
|
||||
$(CC) $(CFLAGS) $(GTK_FLAGS) -c -o $@ $<
|
||||
|
||||
pbx_gtkconsole.so: pbx_gtkconsole.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< $(GTK_LIBS)
|
||||
$(CC) $(SOLINK) -o $@ $< $(GTK_LIBS)
|
||||
|
||||
pbx_kdeconsole.o: pbx_kdeconsole.cc pbx_kdeconsole.moc
|
||||
$(CXX) $(CFLAGS) $(KDE_FLAGS) -c -o $@ $<
|
||||
@@ -49,13 +49,13 @@ pbx_kdeconsole_main.o: pbx_kdeconsole_main.cc pbx_kdeconsole.h
|
||||
$(CXX) $(CFLAGS) $(KDE_FLAGS) -c -o $@ $<
|
||||
|
||||
pbx_kdeconsole.so: $(KDE_CONSOLE_OBJS)
|
||||
$(CC) -shared -Xlinker -x -o $@ $(KDE_CONSOLE_OBJS) $(KDE_LIBS)
|
||||
$(CC) $(SOLINK) -o $@ $(KDE_CONSOLE_OBJS) $(KDE_LIBS)
|
||||
|
||||
%.moc : %.h
|
||||
$(MOC) $< -o $@
|
||||
|
||||
%.so : %.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $<
|
||||
$(CC) $(SOLINK) -o $@ $<
|
||||
|
||||
ifneq ($(wildcard .depend),)
|
||||
include .depend
|
||||
|
@@ -28,13 +28,13 @@ install: all
|
||||
for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
|
||||
|
||||
res_crypto.so: res_crypto.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $< $(CRYPTO_LIBS)
|
||||
$(CC) $(SOLINK) -o $@ $< $(CRYPTO_LIBS)
|
||||
|
||||
clean:
|
||||
rm -f *.so *.o .depend
|
||||
|
||||
%.so : %.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $<
|
||||
$(CC) $(SOLINK) -o $@ $<
|
||||
|
||||
ifneq ($(wildcard .depend),)
|
||||
include .depend
|
||||
|
5
srv.c
5
srv.c
@@ -25,6 +25,11 @@
|
||||
#include <asterisk/dns.h>
|
||||
#include <asterisk/options.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#undef T_SRV
|
||||
#define T_SRV 33
|
||||
#endif
|
||||
|
||||
struct srv {
|
||||
unsigned short priority;
|
||||
unsigned short weight;
|
||||
|
@@ -1187,7 +1187,7 @@ register struct tm * const tmp;
|
||||
#endif /* defined TM_GMTOFF */
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
ctime(timep)
|
||||
const time_t * const timep;
|
||||
{
|
||||
@@ -1200,7 +1200,7 @@ const time_t * const timep;
|
||||
return asctime(localtime(timep));
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
ctime_r(timep, buf)
|
||||
const time_t * const timep;
|
||||
char *buf;
|
||||
|
Reference in New Issue
Block a user