dect
/
asterisk
Archived
13
0
Fork 0
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6936 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
kpfleming 2005-11-01 21:53:30 +00:00
parent a68250b79b
commit 4d4023555b
26 changed files with 207 additions and 55 deletions

View File

@ -1,5 +1,7 @@
2005-11-01 Kevin P. Fleming <kpfleming@digium.com>
* many files: more Cygwin build system support (issue #4678)
* apps/app_parkandannounce.c (parkandannounce_exec): supply parent channel to ast_request_and_dial so channel variables can be inherited (issue #5564)
* include/asterisk/channel.h: add parent_channel field
* channel.c (__ast_request_and_dial): use parent_channel field to inherit variables into new channel

View File

@ -216,6 +216,7 @@ endif
INCLUDE+=-Iinclude -I../include
ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
ASTCFLAGS+=$(OPTIMIZE)
ASTOBJ=-o asterisk
ifeq ($(findstring BSD,${OSARCH}),BSD)
PROC=$(shell uname -m)
@ -263,6 +264,15 @@ ifeq (${OSARCH},SunOS)
INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
endif
ifeq ($(findstring CYGWIN,${OSARCH}),CYGWIN)
CYGLOADER=cygwin_a
OSARCH=CYGWIN
ASTOBJ=-shared -o asterisk.dll -Wl,--out-implib=libasterisk.dll.a -Wl,--export-all-symbols
ASTLINK=
LIBS+=-lpthread -lncurses -lm -lresolv
ASTSBINDIR=${MODULES_DIR}
endif
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/zaptel.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/pkg/include/zaptel.h),)
ASTCFLAGS+=-DZAPTEL_OPTIMIZATIONS
endif
@ -471,8 +481,11 @@ stdtime/libtime.a: FORCE
exit 1; \
fi
asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
$(CC) $(DEBUG) -o asterisk $(ASTLINK) $(OBJS) $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
cygwin_a:
$(MAKE) -C cygwin all
asterisk: ${CYGLOADER} editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
$(CC) $(DEBUG) ${ASTOBJ} $(ASTLINK) $(OBJS) $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
muted: muted.o
$(CC) $(AUDIO_LIBS) -o muted muted.o
@ -595,7 +608,9 @@ bininstall: all
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/system
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
$(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/
if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
if [ -f cygwin/asterisk.exe ]; then $(INSTALL) -m 755 cygwin/asterisk.exe $(DESTDIR)$(ASTSBINDIR)/; fi
if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
ln -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
$(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
$(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/

1
acl.c
View File

@ -68,6 +68,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/srv.h"
#include "asterisk/compat.h"
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
AST_MUTEX_DEFINE_STATIC(routeseq_lock);

View File

@ -22,7 +22,7 @@ APPS=app_dial.so app_playback.so app_voicemail.so app_directory.so app_mp3.so\
app_enumlookup.so app_transfer.so app_setcidnum.so app_cdr.so \
app_hasnewvoicemail.so app_sayunixtime.so app_cut.so app_read.so \
app_setcdruserfield.so app_random.so app_ices.so app_eval.so \
app_nbscat.so app_sendtext.so app_exec.so app_sms.so \
app_nbscat.so app_sendtext.so app_exec.so \
app_groupcount.so app_txtcidname.so app_controlplayback.so \
app_talkdetect.so app_alarmreceiver.so app_userevent.so app_verbose.so \
app_test.so app_forkcdr.so app_math.so app_realtime.so \
@ -63,7 +63,13 @@ ifneq ($(shell if [[ 0x`$(CROSS_COMPILE_BIN)curl-config --vernum` -ge 0x70907 ]]
endif
endif
ifeq (${OSARCH},CYGWIN)
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
CYGSOLIB=-L.. -L. -L../res -lasterisk.dll -lres_features.so -lres_adsi.so -lres_monitor.so
else
CFLAGS+=-fPIC
APPS+=app_sms.so
endif
#
# If you have UnixODBC you can use ODBC voicemail
@ -81,10 +87,10 @@ clean:
rm -f *.so *.o look .depend
%.so : %.o
$(CC) $(SOLINK) -o $@ $<
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
app_rpt.so : app_rpt.o
$(CC) $(SOLINK) -o $@ $< -ltonezone
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -ltonezone
install: all
for x in $(APPS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
@ -92,16 +98,16 @@ install: all
rm -f $(DESTDIR)$(MODULES_DIR)/app_qcall.so
app_curl.so: app_curl.o
$(CC) $(SOLINK) -o $@ $< $(CURLLIBS)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CURLLIBS)
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) $(SOLINK) -o $@ $< -L/usr/local/pgsql/lib -lpq
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -L/usr/local/pgsql/lib -lpq
app_sql_odbc.so: app_sql_odbc.o
$(CC) $(SOLINK) -o $@ $< -lodbc
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc
look: look.c
$(CC) -pipe -O6 -g look.c -o look -lncurses

View File

@ -132,7 +132,7 @@
#include <string.h>
#include <locale.h>
#include <ctype.h>
#ifndef SOLARIS
#if !defined(SOLARIS) && !defined(__CYGWIN__)
#include <err.h>
#else
#define quad_t int64_t

View File

@ -5,7 +5,7 @@
#include <string.h>
#include <locale.h>
#include <ctype.h>
#ifndef SOLARIS
#if !defined(SOLARIS) && !defined(__CYGWIN__)
#include <err.h>
#else
#define quad_t int64_t

View File

@ -18,7 +18,7 @@
#include <string.h>
#include <locale.h>
#include <ctype.h>
#ifndef SOLARIS
#if !defined(SOLARIS) && !defined(__CYGWIN__)
#include <err.h>
#else
#define quad_t int64_t

View File

@ -956,7 +956,7 @@ static yyconst yy_state_type yy_NUL_trans[33] =
#include <string.h>
#include <locale.h>
#include <ctype.h>
#ifndef SOLARIS
#if !defined(SOLARIS) && !defined(__CYGWIN__)
#include <err.h>
#else
#define quad_t int64_t

View File

@ -2048,6 +2048,8 @@ int main(int argc, char *argv[])
ast_verbose("[ Reading Master Configuration ]");
ast_readconfig();
#ifndef __CYGWIN__
if (!is_child_of_nonroot && ast_set_priority(option_highpriority)) {
exit(1);
}
@ -2083,6 +2085,8 @@ int main(int argc, char *argv[])
ast_verbose("Running as user '%s'\n", runuser);
}
#endif /* __CYGWIN__ */
term_init();
printf(term_end());
fflush(stdout);

View File

@ -13,7 +13,12 @@
MODS=cdr_csv.so cdr_manager.so cdr_custom.so
ifeq (${OSARCH},CYGWIN)
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
CYGSOLIB=-L.. -L. -lasterisk.dll
else
CFLAGS+=-fPIC
endif
ifeq ($(findstring BSD,${OSARCH}),BSD)
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
@ -110,23 +115,23 @@ clean:
rm -f *.so *.o .depend
%.so : %.o
$(CC) $(SOLINK) -o $@ $<
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
ifneq ($(wildcard .depend),)
include .depend
endif
cdr_odbc.so: cdr_odbc.o
$(CC) $(SOLINK) -o $@ $< -lodbc $(MLFLAGS)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc $(MLFLAGS)
cdr_tds.so: cdr_tds.o
$(CC) $(SOLINK) -o $@ $< -ltds $(MLFLAGS)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -ltds $(MLFLAGS)
cdr_pgsql.so: cdr_pgsql.o
$(CC) $(SOLINK) -o $@ $< -lpq -lz $(MLFLAGS)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lpq -lz $(MLFLAGS)
cdr_sqlite.so: cdr_sqlite.o
$(CC) $(SOLINK) -o $@ $< -lsqlite $(MLFLAGS)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lsqlite $(MLFLAGS)
depend: .depend

View File

@ -14,11 +14,11 @@
# the GNU General Public License
#
CHANNEL_LIBS=chan_modem.so chan_sip.so \
chan_modem_aopen.so \
chan_modem_bestdata.so \
chan_agent.so chan_mgcp.so chan_iax2.so \
chan_local.so chan_skinny.so chan_features.so
CHANNEL_LIBS=chan_sip.so chan_agent.so chan_mgcp.so chan_iax2.so chan_local.so chan_skinny.so chan_features.so
ifneq (${OSARCH},CYGWIN)
CHANNEL_LIBS+=chan_modem.so chan_modem_aopen.so chan_modem_bestdata.so
endif
ifeq ($(findstring BSD,${OSARCH}),BSD)
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
@ -35,6 +35,12 @@ ifeq (${OSARCH},Linux)
CHANH323LIB=-ldl
endif
ifeq (${OSARCH},CYGWIN)
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
CYGSOLIB=-L.. -L. -L../res -lasterisk.dll -lres_features.so
CYG_CHAN_AGENT=-lres_monitor.so
endif
ifeq ($(PROC),sparc64)
PROC=ultrasparc
CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
@ -53,7 +59,9 @@ endif
ifneq (${OSARCH},Darwin)
ifneq (${OSARCH},SunOS)
CHANNEL_LIBS+=chan_oss.so chan_modem_i4l.so
ifneq (${OSARCH},CYGWIN)
CHANNEL_LIBS+=chan_oss.so chan_modem_i4l.so
endif
endif
endif
@ -113,7 +121,10 @@ ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/vpbapi.h),)
endif
CFLAGS+=-DCRYPTO
ifneq ($(OSARCH),CYGWIN)
CFLAGS+=-fPIC
endif
CFLAGS+=#-DVOFRDUMPER
@ -140,7 +151,7 @@ clean:
rm -f busy.h ringtone.h gentone gentone-ulaw
%.so : %.o
$(CC) $(SOLINK) -o $@ $<
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} ${LIBS}
ifneq ($(wildcard .depend),)
include .depend
@ -180,7 +191,7 @@ chan_oss.so: chan_oss.o
endif
chan_iax2.so: chan_iax2.o iax2-parser.o iax2-provision.o
$(CC) $(SOLINK) -o $@ chan_iax2.o iax2-parser.o iax2-provision.o
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_iax2.o iax2-parser.o iax2-provision.o ${CYGSOLIB}
chan_zap.o: chan_zap.c
$(CC) -c $(CFLAGS) -o chan_zap.o chan_zap.c
@ -189,7 +200,10 @@ chan_zap.so: chan_zap.o
$(CC) $(SOLINK) -o $@ $< $(ZAPPRI) $(ZAPR2) -ltonezone
chan_sip.so: chan_sip.o
$(CC) $(SOLINK) -o $@ chan_sip.o
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_sip.o ${CYGSOLIB}
chan_agent.so: chan_agent.o
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_agent.o ${CYGSOLIB} ${CYG_CHAN_AGENT}
chan_alsa.o: $(ALSA_SRC)

View File

@ -11,6 +11,11 @@
# the GNU General Public License
#
ifeq (${OSARCH},CYGWIN)
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
CYGSOLIB=-L.. -L. -lasterisk.dll
endif
ifneq ($(wildcard g723.1/coder.c),)
MODG723=codec_g723_1.so
LIBG723=g723.1/libg723.a
@ -92,28 +97,28 @@ $(LIBILBC):
$(MAKE) -C ilbc all
$(MODILBC): codec_ilbc.o $(LIBILBC)
$(CC) $(SOLINK) -o $@ $< $(LIBILBC)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(LIBILBC)
codec_g723_1.so : codec_g723_1.o $(LIBG723)
$(CC) $(SOLINK) -o $@ $< $(LIBG723)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(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) $(SOLINK) -o $@ $< $(LIBG723B) -lm
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(LIBG723B) -lm
codec_gsm.so: codec_gsm.o $(LIBGSMT)
$(CC) $(SOLINK) -o $@ $< $(LIBGSM)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(LIBGSM)
$(MODSPEEX): codec_speex.o
$(CC) $(SOLINK) -o $@ $< $(LIBSPEEX)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(LIBSPEEX)
codec_lpc10.so: codec_lpc10.o $(LIBLPC10)
$(CC) $(SOLINK) -o $@ $< $(LIBLPC10) -lm
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(LIBLPC10) -lm
%.so : %.o
$(CC) $(SOLINK) -o $@ $<
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
ifneq ($(wildcard .depend),)
include .depend

View File

@ -36,6 +36,7 @@ WAV49 = -DWAV49
######### which support MMX instructions. This should be newer pentiums,
######### ppro's, etc, as well as the AMD K6 and K7. The compile will
######### probably require gcc.
PROC=$(shell uname -m)
ifneq (${OSARCH},Darwin)
ifneq (${OSARCH},SunOS)
@ -90,7 +91,11 @@ PG =
# CCFLAGS = -c -O
CC ?= gcc
CCFLAGS += -c -DNeedFunctionPrototypes=1 -funroll-loops -fPIC $(OPTIMIZE)
CCFLAGS += -c -DNeedFunctionPrototypes=1 -funroll-loops $(OPTIMIZE)
ifneq ($(findstring CYGWIN,${OSARCH}),CYGWIN)
CCFLAGS += -fPIC
endif
LD = $(CC)

View File

@ -33,7 +33,7 @@
#include <sys/stat.h>
#define AST_INCLUDE_GLOB 1
#ifdef AST_INCLUDE_GLOB
#ifdef __Darwin__
#if defined(__Darwin__) || defined(__CYGWIN__)
#define GLOB_ABORTED GLOB_ABEND
#endif
# include <glob.h>
@ -693,7 +693,11 @@ int config_text_file_save(const char *configfile, const struct ast_config *cfg,
}
time(&t);
ast_copy_string(date, ctime(&t), sizeof(date));
#ifdef __CYGWIN__
if ((f = fopen(fn, "w+"))) {
#else
if ((f = fopen(fn, "w"))) {
#endif
if ((option_verbose > 1) && !option_debug)
ast_verbose( VERBOSE_PREFIX_2 "Saving '%s': ", fn);
fprintf(f, ";!\n");

6
cygwin/Makefile Executable file
View File

@ -0,0 +1,6 @@
OBJS=cygloader.o
all: $(OBJS)
$(OBJS) : %.o: %.c
$(CC) $< -o asterisk.exe
clean:
rm -f asterisk.exe

33
cygwin/cygloader.c Executable file
View File

@ -0,0 +1,33 @@
#include <unistd.h>
#include <dlfcn.h>
#include <stdio.h>
#define OK 0
#define MODULE_NOT_FOUND 1
#define INVALID_NUMBER_ARGUMENTS 2
int main(int argc, char **argv) {
/* Asterisk entry point */
char* error = NULL;
int (*ast_main)(int argc, char **argv);
void *handle = dlopen ("asterisk.dll", RTLD_GLOBAL);
if (handle == NULL) {
fputs (dlerror(), stderr);
fputs ("\r\n", stderr);
return MODULE_NOT_FOUND;
}
printf("\r\nAsterisk module loaded successfully");
ast_main = dlsym(handle, "main");
if ((error = dlerror()) != NULL) {
fputs("Asterisk main not found", stderr);
fputs(error, stderr);
exit(1);
}
printf("\r\nAsterisk entry point found");
/* run asterisk main */
(*ast_main)(argc, argv);
dlclose(handle);
printf("\r\nAsterisk stopped");
return OK;
}

4
db.c
View File

@ -53,6 +53,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/manager.h"
#include "db1-ast/include/db.h"
#ifdef __CYGWIN__
#define dbopen __dbopen
#endif
static DB *astdb;
AST_MUTEX_DEFINE_STATIC(dblock);

View File

@ -35,25 +35,29 @@ endif
GSMLIB=../codecs/gsm/lib/libgsm.a
ifeq (${OSARCH},CYGWIN)
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
CYGSOLIB=-L.. -L. -lasterisk.dll
else
CFLAGS+=-fPIC
endif
all: depend $(FORMAT_LIBS)
clean:
rm -f *.so *.o .depend
%.so : %.o
$(CC) $(SOLINK) -o $@ $<
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
ifneq ($(wildcard .depend),)
include .depend
endif
format_mp3.so : format_mp3.o
$(CC) $(SOLINK) -o $@ $< -lm
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lm
format_ogg_vorbis.so : format_ogg_vorbis.o
$(CC) $(SOLINK) -o $@ $< -logg -lvorbis -lvorbisenc -lm
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -logg -lvorbis -lvorbisenc -lm
install: all
for x in $(FORMAT_LIBS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done

View File

@ -33,7 +33,12 @@ FUNC_SOURCES=$(BUILTINS:.o=.c)
FUNC_STRUCTS=$(shell grep 'struct ast_custom_function' $(FUNC_SOURCES) | awk '{print $$3};')
ifeq (${OSARCH},CYGWIN)
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
CYGSOLIB=-L.. -L. -lasterisk.dll
else
CFLAGS+=-fPIC
endif
ifeq ($(findstring BSD,${OSARCH}),BSD)
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
@ -45,7 +50,7 @@ clean:
rm -f *.so *.o .depend pbx_functions.h
%.so : %.o
$(CC) $(SOLINK) -o $@ $<
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
#$(BUILTINS) : CFLAGS += -DBUILTIN_FUNC
@ -59,7 +64,7 @@ pbx_functions.h: $(FUNC_SOURCES)
pbx_functions.o: pbx_functions.h
pbx_functions.so: pbx_functions.o #$(BUILTINS)
$(CC) $(SOLINK) -o $@ $<
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
install: all
for x in $(FUNCS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done

View File

@ -63,8 +63,12 @@ int unsetenv(const char *name);
#ifdef __CYGWIN__
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <w32api/ws2tcpip.h>
#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif
#endif /* __CYGWIN__ */
#define HAVE_VASPRINTF

View File

@ -41,6 +41,10 @@
0x20 } }
#endif
#ifdef __CYGWIN__
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#endif
#ifdef BSD
#ifdef __GNUC__
#define AST_MUTEX_INIT_W_CONSTRUCTORS

View File

@ -28,7 +28,13 @@ GTK_LIBS=`${CROSS_COMPILE_BIN}gtk-config --libs gthread`
MOC=$(QTDIR)/bin/moc
KDE_FLAGS=-I$(KDEDIR)/include -I$(KDEDIR)/include/kde -I$(QTDIR)/include
KDE_LIBS=-L$(KDEDIR)/lib -L$(QTDIR)/lib -lqt -lkdecore -lkdeui
ifeq (${OSARCH},CYGWIN)
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
CYGSOLIB=-L.. -L. -L../res -lasterisk.dll
else
CFLAGS+=-fPIC
endif
KDE_CONSOLE_OBJS=pbx_kdeconsole_main.o pbx_kdeconsole.o
@ -53,13 +59,13 @@ pbx_kdeconsole.so: $(KDE_CONSOLE_OBJS)
$(CC) $(SOLINK) -o $@ $(KDE_CONSOLE_OBJS) $(KDE_LIBS)
pbx_dundi.so: dundi-parser.o pbx_dundi.o
$(CC) $(SOLINK) -o $@ pbx_dundi.o dundi-parser.o -lz
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} pbx_dundi.o dundi-parser.o -lz ${CYGSOLIB}
%.moc : %.h
$(MOC) $< -o $@
%.so : %.o
$(CC) $(SOLINK) -o $@ $<
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
ifneq ($(wildcard .depend),)
include .depend

View File

@ -11,8 +11,7 @@
# the GNU General Public License
#
MODS=res_adsi.so res_features.so res_musiconhold.so res_indications.so res_monitor.so \
res_agi.so
MODS=res_indications.so res_monitor.so res_adsi.so res_agi.so res_features.so
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/odbcinst.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/odbcinst.h),)
ifneq (${OSARCH},FreeBSD)
@ -41,6 +40,15 @@ ifeq ($(findstring BSD,${OSARCH}),BSD)
CFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
endif
ifeq (${OSARCH},CYGWIN)
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
CYGSOLIB=-L.. -L. -lasterisk.dll
CYG_RES_CONFIG_ODBC_LIB=-lres_odbc.so
CYG_RES_FEATURES_LIB=-lres_adsi.so -lres_monitor.so
else
MODS+=res_musiconhold.so
endif
CRYPTO_LIBS=-lssl -lcrypto
CFLAGS+=
@ -52,7 +60,11 @@ endif
#
# Work around buggy RedHat 9.0
#
ifeq (${OSARCH},CYGWIN)
CFLAGS+=-DOPENSSL_NO_KRB5
else
CFLAGS+=-DOPENSSL_NO_KRB5 -fPIC
endif
all: depend $(MODS)
@ -63,19 +75,25 @@ install: all
for x in $(MODS); do $(INSTALL) -m 755 $$x $(DESTDIR)$(MODULES_DIR) ; done
res_crypto.so: res_crypto.o
$(CC) $(SOLINK) -o $@ $< $(CRYPTO_LIBS)
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CRYPTO_LIBS)
clean:
rm -f *.so *.o .depend
res_odbc.so: res_odbc.o
$(CC) $(SOLINK) -o $@ $< -lodbc
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lodbc
res_osp.so: res_osp.o $(OSPLIB)
$(CC) $(SOLINK) -o $@ $^
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(OSPLIB)
%.so : %.o
$(CC) $(SOLINK) -o $@ $<
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
res_features.so: res_features.o
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} ${CYG_RES_FEATURES_LIB}
res_config_odbc.so: res_config_odbc.o
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} ${CYG_RES_CONFIG_ODBC_LIB}
ifneq ($(wildcard .depend),)
include .depend

View File

@ -9,9 +9,11 @@
*/
/* Stuff moved from Makefile.inc to reduce clutter */
#ifndef __CYGWIN__
#ifndef TM_GMTOFF
#define TM_GMTOFF tm_gmtoff
#define TM_ZONE tm_zone
#endif
#define STD_INSPIRED 1
#define PCTS 1
#define HAVE_LONG_DOUBLE 1

View File

@ -44,6 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/logger.h"
#include "asterisk/md5.h"
#include "asterisk/options.h"
#include "asterisk/compat.h"
#define AST_API_MODULE /* ensure that inlinable API functions will be built in this module if required */
#include "asterisk/strings.h"
@ -57,7 +58,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
static char base64[64];
static char b2a[256];
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined( __NetBSD__ ) || defined(__APPLE__)
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined( __NetBSD__ ) || defined(__APPLE__) || defined(__CYGWIN__)
/* duh? ERANGE value copied from web... */
#define ERANGE 34
@ -741,10 +742,14 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
#endif /* !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) */
#ifndef HAVE_STRTOQ
#ifndef LONG_MIN
#define LONG_MIN (-9223372036854775807L-1L)
/* min value of a "long int" */
#endif
#ifndef LONG_MAX
#define LONG_MAX 9223372036854775807L
/* max value of a "long int" */
#endif
/*
* Convert a string to a quad integer.

View File

@ -31,7 +31,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__Darwin__)
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__Darwin__) || defined(__CYGWIN__)
#include <netinet/in.h>
#endif
#include <sys/time.h>