.EXPORT_ALL_VARIABLES:
+OSARCH=$(shell uname -s)
+
# Pentium Pro Optimize
-#PROC=i686
+PROC=i686
# Pentium Optimize
#PROC=i586
#PROC=k6
#PROC=ppc
+ifeq (${OSARCH},Linux)
PROC=$(shell uname -m)
+endif
######### More GSM codec optimization
######### Uncomment to enable MMXTM optimizations for x86 architecture CPU's
CFLAGS+=$(OPTIMIZE)
CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
CFLAGS+=$(shell if uname -m | grep -q ppc; then echo "-fsigned-char"; fi)
+ifeq (${OSARCH},OpenBSD)
+CFLAGS+=-pthread
+endif
LIBEDIT=editline/libedit.a
CFLAGS+= $(TRACE_FRAMES)
CFLAGS+=# -fomit-frame-pointer
SUBDIRS=res channels pbx apps codecs formats agi cdr astman
-LIBS=-ldl -lpthread -lncurses -lm #-lnjamd
+ifeq (${OSARCH},Linux)
+LIBS=-ldl
+endif
+LIBS+=-lpthread -lncurses -lm #-lnjamd
OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
translate.o file.o say.o pbx.o cli.o md5.o term.o \
ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
endif
asterisk: .version build.h editline/libedit.a db1-ast/libdb1.a $(OBJS)
- gcc -o asterisk -rdynamic $(OBJS) $(LIBS) $(LIBEDIT) db1-ast/libdb1.a
+ gcc $(DEBUG) -o asterisk -rdynamic $(OBJS) $(LIBS) $(LIBEDIT) db1-ast/libdb1.a
subdirs:
for x in $(SUBDIRS); do $(MAKE) -C $$x || exit 1 ; done
APPS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so" ; fi)
#APPS+=$(shell if [ -f /usr/include/zap.h ]; then echo "app_rpt.so" ; fi)
-CFLAGS+=
+CFLAGS+=-fPIC
all: $(APPS)
struct timeval tv = { 2, 0 }; /* Wait no more than 2 seconds */
FD_ZERO(&fds);
FD_SET(fd, &fds);
- res = select(fd + 1, &fds, NULL, NULL, &tv);
+ res = ast_select(fd + 1, &fds, NULL, NULL, &tv);
if (res < 1) {
ast_log(LOG_NOTICE, "Selected timed out/errored out with %d\n", res);
return -1;
max = con->fd;
if (con->p[0] > max)
max = con->p[0];
- res = select(max + 1, &rfds, NULL, NULL, NULL);
+ res = ast_select(max + 1, &rfds, NULL, NULL, NULL);
if (res < 0) {
ast_log(LOG_WARNING, "select returned < 0: %s\n", strerror(errno));
continue;
max = ast_consock;
if (STDIN_FILENO > max)
max = STDIN_FILENO;
- res = select(max+1, &rfds, NULL, NULL, NULL);
+ res = ast_select(max+1, &rfds, NULL, NULL, NULL);
if (res < 0) {
if (errno == EINTR)
continue;
} else {
/* Do nothing */
- select(0,NULL,NULL,NULL,NULL);
+ ast_select(0,NULL,NULL,NULL,NULL);
}
return 0;
}
MODS=cdr_csv.so
-CFLAGS+=
+CFLAGS+=-fPIC
#
# MySQL stuff... Autoconf anyone??
max = fds[x];
}
}
- if (*ms >= 0)
- res = select(max + 1, &rfds, NULL, &efds, &tv);
+ if (*ms >= 0)
+ res = ast_select(max + 1, &rfds, NULL, &efds, &tv);
else
- res = select(max + 1, &rfds, NULL, &efds, NULL);
+ res = ast_select(max + 1, &rfds, NULL, &efds, NULL);
if (res < 0) {
/* Simulate a timeout if we were interrupted */
if (fds[x] > max)
max = fds[x];
}
- if (*ms >= 0)
- res = select(max + 1, &rfds, NULL, &efds, &tv);
+ if (*ms >= 0)
+ res = ast_select(max + 1, &rfds, NULL, &efds, &tv);
else
- res = select(max + 1, &rfds, NULL, &efds, NULL);
+ res = ast_select(max + 1, &rfds, NULL, &efds, NULL);
if (res < 0) {
for (x=0;x<n;x++)
# the GNU General Public License
#
+OSARCH=$(shell uname -s)
+
CHANNEL_LIBS=chan_modem.so chan_iax.so chan_sip.so \
chan_modem_aopen.so chan_oss.so \
chan_modem_bestdata.so chan_modem_i4l.so \
ALSA_SRC+=$(shell [ -f alsa-monitor.h ] && echo "alsa-monitor.h")
CFLAGS+=-DCRYPTO
+CFLAGS+=-fPIC
CFLAGS+=#-DVOFRDUMPER
chan_oss.o: chan_oss.c busy.h ringtone.h
chan_iax2.so: chan_iax2.o iax2-parser.o
+ifeq (${OSARCH},Linux)
$(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o
+else
+ $(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o -lossaudio
+endif
chan_zap.o: $(CHANZAP)
$(CC) -c $(CFLAGS) -o chan_zap.o $(CHANZAP)
max = readdev;
}
#endif
- res = select(max + 1, &rfds, &wfds, NULL, NULL);
+ res = ast_select(max + 1, &rfds, &wfds, NULL, NULL);
if (res < 1) {
ast_log(LOG_WARNING, "select failed: %s\n", strerror(errno));
continue;
#endif
/* Wait indefinitely for something to happen */
pthread_testcancel();
- res = select(n + 1, &rfds, NULL, &efds, NULL);
+ res = ast_select(n + 1, &rfds, NULL, &efds, NULL);
pthread_testcancel();
/* Okay, select has finished. Let's see what happened. */
if (res < 1) {
if (sounddev > max)
max = sounddev;
}
- res = select(max + 1, &rfds, &wfds, NULL, NULL);
+ res = ast_select(max + 1, &rfds, &wfds, NULL, NULL);
if (res < 1) {
ast_log(LOG_WARNING, "select failed: %s\n", strerror(errno));
continue;
tv.tv_usec = 30000;
tv.tv_sec = 0;
}
- res = select(n + 1, &rfds, NULL, &efds, &tv);
+ res = ast_select(n + 1, &rfds, NULL, &efds, &tv);
} else {
- res = select(n + 1, &rfds, NULL, &efds, NULL);
+ res = ast_select(n + 1, &rfds, NULL, &efds, NULL);
tv.tv_usec = 0;
tv.tv_sec = 0;
tonepos = 0;
fd_set fds;
FD_ZERO(&fds);
FD_SET(p->s, &fds);
- select(p->s + 1, &fds, NULL, NULL, NULL);
+ ast_select(p->s + 1, &fds, NULL, NULL, NULL);
goto retry;
}
ast->blocking = 0;
ast_pthread_mutex_unlock(&monlock);
pthread_testcancel();
/* Wait indefinitely for something to happen */
- res = select(n + 1, &rfds, NULL, NULL, NULL);
+ res = ast_select(n + 1, &rfds, NULL, NULL, NULL);
pthread_testcancel();
/* Okay, select has finished. Let's see what happened. */
if (res < 0) {
FD_ZERO(&efds);
FD_SET(fd,&wfds);
FD_SET(fd,&efds);
- res = select(fd + 1,NULL,&wfds,&efds,NULL);
+ res = ast_select(fd + 1,NULL,&wfds,&efds,NULL);
if (!res) {
ast_log(LOG_DEBUG, "select (for write) ret. 0 on channel %d\n", p->channel);
continue;
/* Wait at least a second for something to happen */
tv.tv_sec = 1;
tv.tv_usec = 0;
- res = select(n + 1, &rfds, NULL, &efds, &tv);
+ res = ast_select(n + 1, &rfds, NULL, &efds, &tv);
pthread_testcancel();
/* Okay, select has finished. Let's see what happened. */
if (res < 0) {
pthread_mutex_unlock(&pri->lock);
e = NULL;
- res = select(pri->fd + 1, &rfds, NULL, &efds, &tv);
+ res = ast_select(pri->fd + 1, &rfds, NULL, &efds, &tv);
ast_pthread_mutex_lock(&pri->lock);
if (!res) {
FD_ZERO(&efds);
FD_SET(fd,&wfds);
FD_SET(fd,&efds);
- res = select(fd + 1,NULL,&wfds,&efds,NULL);
+ res = ast_select(fd + 1,NULL,&wfds,&efds,NULL);
if (!res) {
ast_log(LOG_DEBUG, "select (for write) ret. 0 on channel %d\n", p->channel);
continue;
FD_ZERO(&efds);
FD_SET(fd,&wfds);
FD_SET(fd,&efds);
- res = select(fd + 1,NULL,&wfds,&efds,NULL);
+ res = ast_select(fd + 1,NULL,&wfds,&efds,NULL);
if (!res) {
ast_log(LOG_DEBUG, "select (for write) ret. 0 on channel %d\n", p->channel);
continue;
/* Wait at least a second for something to happen */
tv.tv_sec = 1;
tv.tv_usec = 0;
- res = select(n + 1, &rfds, NULL, &efds, &tv);
+ res = ast_select(n + 1, &rfds, NULL, &efds, &tv);
pthread_testcancel();
/* Okay, select has finished. Let's see what happened. */
if (res < 0) {
pthread_mutex_unlock(&pri->lock);
e = NULL;
- res = select(pri->fd + 1, &rfds, NULL, &efds, &tv);
+ res = ast_select(pri->fd + 1, &rfds, NULL, &efds, &tv);
ast_pthread_mutex_lock(&pri->lock);
if (!res) {
FD_ZERO(&efds);
FD_SET(fd,&wfds);
FD_SET(fd,&efds);
- res = select(fd + 1,NULL,&wfds,&efds,NULL);
+ res = ast_select(fd + 1,NULL,&wfds,&efds,NULL);
if (!res) {
ast_log(LOG_DEBUG, "select (for write) ret. 0 on channel %d\n", p->channel);
continue;
MODG723+=$(shell [ -f g723.1b/coder2.c ] && echo "codec_g723_1b.so")
MODSPEEX=$(shell [ -f /usr/include/speex.h ] || [ -f /usr/local/include/speex.h ] && echo "codec_speex.so")
MODILBC=$(shell [ -f ilbc/iLBC_decode.h ] && echo "codec_ilbc.so")
-CFLAGS+=
+CFLAGS+=-fPIC
LIBG723=g723.1/libg723.a
LIBG723B=g723.1b/libg723b.a
# CCFLAGS = -c -O
CC = gcc -ansi -pedantic $(OPTIMIZE) -march=$(PROC) -fschedule-insns2 -fomit-frame-pointer
-CCFLAGS += -c -DNeedFunctionPrototypes=1 -finline-functions -funroll-loops
+CCFLAGS += -c -DNeedFunctionPrototypes=1 -finline-functions -funroll-loops -fPIC
LD = $(CC)
$(SRC)/code.c \
$(SRC)/debug.c \
$(SRC)/decode.c \
- $(SRC)/k6opt.s \
$(SRC)/long_term.c \
$(SRC)/lpc.c \
$(SRC)/preprocess.c \
$(SRC)/gsm_option.c \
$(SRC)/short_term.c \
$(SRC)/table.c
+ifneq (${OSARCH},OpenBSD)
+GSM_SOURCES+= $(SRC)/k6opt.s
+endif
TOAST_SOURCES = $(SRC)/toast.c \
$(SRC)/toast_lin.c \
$(SRC)/code.o \
$(SRC)/debug.o \
$(SRC)/decode.o \
- $(SRC)/k6opt.o \
$(SRC)/long_term.o \
$(SRC)/lpc.o \
$(SRC)/preprocess.o \
$(SRC)/gsm_option.o \
$(SRC)/short_term.o \
$(SRC)/table.o
+ifneq (${OSARCH},OpenBSD)
+GSM_OBJECTS+= $(SRC)/k6opt.o
+endif
TOAST_OBJECTS = $(SRC)/toast.o \
$(SRC)/toast_lin.o \
+CFLAGS+= -fPIC -O3
LIB=libilbc.a
OBJS= anaFilter.o iCBSearch.o packing.o \
#
WARNINGS = -Wall -Wno-comment -Wno-error
-CFLAGS = $(OPTIMIZE) -I$(LIB_TARGET_DIR) $(WARNINGS)
+CFLAGS = $(OPTIMIZE) -I$(LIB_TARGET_DIR) $(WARNINGS) -fPIC
#CFLAGS+= $(shell if uname -m | grep -q 86; then echo "-mpentium" ; fi)
#fix for PPC processors
#
# LMC section
-CFLAGS+= -I../include -Iinclude -O6 -funroll-loops -finline-functions -Wall -Wno-missing-prototypes -Wno-missing-declarations -g
+CFLAGS+= -I../include -Iinclude -O6 -funroll-loops -finline-functions -Wall -Wno-missing-prototypes -Wno-missing-declarations -g -fPIC
RANLIB=ranlib
# the XING decoder objs and dependencies:
/* Access method description structure. */
typedef struct __db {
DBTYPE type; /* Underlying db type. */
- int (*close) __PMT((struct __db *));
- int (*del) __PMT((const struct __db *, const DBT *, u_int));
- int (*get) __PMT((const struct __db *, const DBT *, DBT *, u_int));
- int (*put) __PMT((const struct __db *, DBT *, const DBT *, u_int));
- int (*seq) __PMT((const struct __db *, DBT *, DBT *, u_int));
- int (*sync) __PMT((const struct __db *, u_int));
+ int (*close) __P((struct __db *));
+ int (*del) __P((const struct __db *, const DBT *, u_int));
+ int (*get) __P((const struct __db *, const DBT *, DBT *, u_int));
+ int (*put) __P((const struct __db *, DBT *, const DBT *, u_int));
+ int (*seq) __P((const struct __db *, DBT *, DBT *, u_int));
+ int (*sync) __P((const struct __db *, u_int));
void *internal; /* Access method private. */
- int (*fd) __PMT((const struct __db *));
+ int (*fd) __P((const struct __db *));
} DB;
#define BTREEMAGIC 0x053162
int minkeypage; /* minimum keys per page */
u_int psize; /* page size */
int (*compare) /* comparison function */
- __PMT((const DBT *, const DBT *));
+ __P((const DBT *, const DBT *));
size_t (*prefix) /* prefix function */
- __PMT((const DBT *, const DBT *));
+ __P((const DBT *, const DBT *));
int lorder; /* byte order */
} BTREEINFO;
u_int nelem; /* number of elements */
u_int cachesize; /* bytes to cache */
u_int32_t /* hash function */
- (*hash) __PMT((const void *, size_t));
+ (*hash) __P((const void *, size_t));
int lorder; /* byte order */
} HASHINFO;
u_long pagesize; /* file page size */
int fd; /* file descriptor */
/* page in conversion routine */
- void (*pgin) __PMT((void *, pgno_t, void *));
+ void (*pgin) __P((void *, pgno_t, void *));
/* page out conversion routine */
- void (*pgout) __PMT((void *, pgno_t, void *));
+ void (*pgout) __P((void *, pgno_t, void *));
void *pgcookie; /* cookie for page in/out routines */
#ifdef STATISTICS
u_long cachehit;
ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+for ac_dir in ${GNUSYSTEM_AUX_DIR} $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
done
-cat > conftest.$ac_ext <<EOF
-#line 1470 "configure"
-#include "confdefs.h"
-#include <sys/cdefs.h>
-#ifdef __RCSID
- yes
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- CPPFLAGS="$CPPFLAGS '-D__RCSID(x)='"
-fi
-rm -f conftest*
-
-
-cat > conftest.$ac_ext <<EOF
-#line 1489 "configure"
-#include "confdefs.h"
-#include <sys/cdefs.h>
-#ifdef __COPYRIGHT
- yes
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- CPPFLAGS="$CPPFLAGS '-D__COPYRIGHT(x)='"
-fi
-rm -f conftest*
-
-
-cat > conftest.$ac_ext <<EOF
-#line 1508 "configure"
-#include "confdefs.h"
-#include <sys/cdefs.h>
-#ifdef __RENAME
- yes
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- CPPFLAGS="$CPPFLAGS '-D__RENAME(x)='"
-fi
-rm -f conftest*
-
-
-cat > conftest.$ac_ext <<EOF
-#line 1527 "configure"
-#include "confdefs.h"
-#include <sys/cdefs.h>
-#ifdef _DIAGASSERT
- yes
-#endif
-
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "yes" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- CPPFLAGS="$CPPFLAGS '-D_DIAGASSERT(x)='"
-fi
-rm -f conftest*
-
-
for ac_func in issetugid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1548: checking for $ac_func" >&5
+echo "configure:1472: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1553 "configure"
+#line 1477 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in strlcat
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1603: checking for $ac_func" >&5
+echo "configure:1527: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1608 "configure"
+#line 1532 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in strlcpy
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1659: checking for $ac_func" >&5
+echo "configure:1583: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1664 "configure"
+#line 1588 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in fgetln
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1715: checking for $ac_func" >&5
+echo "configure:1639: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1720 "configure"
+#line 1644 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in strvis
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1771: checking for $ac_func" >&5
+echo "configure:1695: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1776 "configure"
+#line 1700 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in strunvis
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1827: checking for $ac_func" >&5
+echo "configure:1751: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1832 "configure"
+#line 1756 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
done
+cat > conftest.$ac_ext <<EOF
+#line 1806 "configure"
+#include "confdefs.h"
+#include <sys/cdefs.h>
+#ifdef __RCSID
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ CPPFLAGS="$CPPFLAGS '-D__RCSID(x)='"
+fi
+rm -f conftest*
+
+
+cat > conftest.$ac_ext <<EOF
+#line 1825 "configure"
+#include "confdefs.h"
+#include <sys/cdefs.h>
+#ifdef __COPYRIGHT
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ CPPFLAGS="$CPPFLAGS '-D__COPYRIGHT(x)='"
+fi
+rm -f conftest*
+
+
+cat > conftest.$ac_ext <<EOF
+#line 1844 "configure"
+#include "confdefs.h"
+#include <sys/cdefs.h>
+#ifdef __RENAME
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ CPPFLAGS="$CPPFLAGS '-D__RENAME(x)='"
+fi
+rm -f conftest*
+
+
+cat > conftest.$ac_ext <<EOF
+#line 1863 "configure"
+#include "confdefs.h"
+#include <sys/cdefs.h>
+#ifdef _DIAGASSERT
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ CPPFLAGS="$CPPFLAGS '-D_DIAGASSERT(x)='"
+fi
+rm -f conftest*
+
+
# Check whether --enable-readline or --disable-readline was given.
if test "${enable_readline+set}" = set; then
enableval="$enable_readline"
AC_CHECK_HEADERS(sys/cdefs.h vis.h)
+AC_CHECK_FUNCS(issetugid)
+AC_CHECK_FUNCS(strlcat, , CCSRCS="$CCSRCS np/strlcat.c")
+AC_CHECK_FUNCS(strlcpy, , CCSRCS="$CCSRCS np/strlcpy.c")
+AC_CHECK_FUNCS(fgetln, , CCSRCS="$CCSRCS np/fgetln.c")
+AC_CHECK_FUNCS(strvis, , CCSRCS="$CCSRCS np/vis.c")
+AC_CHECK_FUNCS(strunvis, , CCSRCS="$CCSRCS np/unvis.c")
+
AC_EGREP_CPP(yes,
[#include <sys/cdefs.h>
#ifdef __RCSID
#endif
], , [CPPFLAGS="$CPPFLAGS '-D_DIAGASSERT(x)='"])
-AC_CHECK_FUNCS(issetugid)
-AC_CHECK_FUNCS(strlcat, , CCSRCS="$CCSRCS np/strlcat.c")
-AC_CHECK_FUNCS(strlcpy, , CCSRCS="$CCSRCS np/strlcpy.c")
-AC_CHECK_FUNCS(fgetln, , CCSRCS="$CCSRCS np/fgetln.c")
-AC_CHECK_FUNCS(strvis, , CCSRCS="$CCSRCS np/vis.c")
-AC_CHECK_FUNCS(strunvis, , CCSRCS="$CCSRCS np/unvis.c")
-
dnl Enable readline compatibility by default.
AC_ARG_ENABLE(readline, [ --disable-readline Disable readline compatibility],
if test "x$enable_readline" != "xyes" ; then
GSMLIB=../codecs/gsm/lib/libgsm.a
-CFLAGS+=
+CFLAGS+=-fPIC
all: $(FORMAT_LIBS)
/*! Stop servicing a channel for us... Returns -1 on error or if channel has been hungup */
int ast_autoservice_stop(struct ast_channel *chan);
+/* Misc. functions below */
+
+//! Waits for activity on a group of channels
+/*!
+ * \param nfds the maximum number of file descriptors in the sets
+ * \param rfds file descriptors to check for read availability
+ * \param wfds file descriptors to check for write availability
+ * \param efds file descriptors to check for exceptions (OOB data)
+ * \param tvp timeout while waiting for events
+ * This is the same as a standard select(), except it guarantees the
+ * behaviour where the passed struct timeval is updated with how much
+ * time was not slept while waiting for the specified events
+ */
+static inline int ast_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tvp)
+{
+#ifdef __linux__
+ return select(nfds, rfds, wfds, efds, tvp);
+#else
+ if (tvp) {
+ struct timeval tv, tvstart, tvend, tvlen;
+ int res;
+
+ tv = *tvp;
+ gettimeofday(&tvstart, NULL);
+ res = select(nfds, rfds, wfds, efds, tvp);
+ gettimeofday(&tvend, NULL);
+ timersub(&tvend, &tvstart, &tvlen);
+ timersub(&tv, &tvlen, tvp);
+ if (tvp->tv_sec < 0 || (tvp->tv_sec == 0 && tvp->tv_usec < 0)) {
+ tvp->tv_sec = 0;
+ tvp->tv_usec = 0;
+ }
+ return res;
+ }
+ else
+ return(nfds, rfds, wfds, efds, NULL);
+#endif
+}
+
#ifdef DO_CRASH
#define CRASH do { fprintf(stderr, "!! Forcing immediate crash a-la abort !!\n"); *((int *)0) = 0; } while(0)
#else
}
FD_ZERO(&fds);
FD_SET(s->fd, &fds);
- res = select(s->fd + 1, &fds, NULL, NULL, NULL);
+ res = ast_select(s->fd + 1, &fds, NULL, NULL, NULL);
if (res < 0) {
ast_log(LOG_WARNING, "Select returned error: %s\n", strerror(errno));
} else if (res > 0) {
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
-CFLAGS+=
+CFLAGS+=-fPIC
KDE_CONSOLE_OBJS=pbx_kdeconsole_main.o pbx_kdeconsole.o
#
# Work around buggy RedHat 9.0
#
-CFLAGS+=-DOPENSSL_NO_KRB5
+CFLAGS+=-DOPENSSL_NO_KRB5 -fPIC
all: $(MODS)
tv.tv_sec = ms / 1000;
tv.tv_usec = (ms % 1000) * 1000;
/* Wait for something to happen */
- select(max + 1, &rfds, NULL, &efds, (ms > -1) ? &tv : NULL);
+ ast_select(max + 1, &rfds, NULL, &efds, (ms > -1) ? &tv : NULL);
pthread_testcancel();
}
return NULL; /* Never reached */