aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xagi/eagi-sphinx-test.c4
-rwxr-xr-xagi/eagi-test.c4
-rwxr-xr-xdb1-ast/hash/hash.c4
-rwxr-xr-xinclude/asterisk/channel.h4
-rwxr-xr-xinclude/asterisk/compat.h107
-rwxr-xr-xinclude/asterisk/endian.h4
-rwxr-xr-xinclude/asterisk/logger.h4
-rwxr-xr-xinclude/asterisk/strings.h20
-rwxr-xr-xinclude/asterisk/utils.h4
-rwxr-xr-xstrcompat.c4
-rwxr-xr-xutils/smsq.c2
11 files changed, 117 insertions, 44 deletions
diff --git a/agi/eagi-sphinx-test.c b/agi/eagi-sphinx-test.c
index 72bd93fd4..95c47c909 100755
--- a/agi/eagi-sphinx-test.c
+++ b/agi/eagi-sphinx-test.c
@@ -17,9 +17,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
-#ifdef SOLARIS
-#include <solaris-compat/compat.h>
-#endif
+#include <asterisk/compat.h>
#define AUDIO_FILENO (STDERR_FILENO + 1)
diff --git a/agi/eagi-test.c b/agi/eagi-test.c
index 360fd4222..5ba28f9c6 100755
--- a/agi/eagi-test.c
+++ b/agi/eagi-test.c
@@ -11,9 +11,7 @@
#include <errno.h>
#include <string.h>
#include <sys/select.h>
-#ifdef SOLARIS
-#include <solaris-compat/compat.h>
-#endif
+#include <asterisk/compat.h>
#define AUDIO_FILENO (STDERR_FILENO + 1)
diff --git a/db1-ast/hash/hash.c b/db1-ast/hash/hash.c
index 349af6c63..187cdca53 100755
--- a/db1-ast/hash/hash.c
+++ b/db1-ast/hash/hash.c
@@ -51,9 +51,7 @@ static char sccsid[] = "@(#)hash.c 8.9 (Berkeley) 6/16/94";
#include <assert.h>
#endif
-#ifdef SOLARIS
-#include <solaris-compat/compat.h>
-#endif
+#include "../include/asterisk/compat.h"
#include <db.h>
#include "hash.h"
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 49372b77b..cf45406a4 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -23,9 +23,7 @@
#ifndef _ASTERISK_CHANNEL_H
#define _ASTERISK_CHANNEL_H
-#ifdef SOLARIS
-#include <solaris-compat/compat.h>
-#endif
+#include "asterisk/compat.h"
#include "asterisk/frame.h"
#include "asterisk/sched.h"
#include "asterisk/chanvars.h"
diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h
new file mode 100755
index 000000000..8d40ab34b
--- /dev/null
+++ b/include/asterisk/compat.h
@@ -0,0 +1,107 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * General Definitions for Asterisk top level program
+ *
+ * Copyright (C) 1999-2005, Mark Spencer
+ *
+ * Mark Spencer <markster@digium.com>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+#ifndef _COMPAT_H
+#define _COMPAT_H
+
+#ifdef SOLARIS
+#define __BEGIN_DECLS
+#define __END_DECLS
+
+#ifndef __P
+#define __P(p) p
+#endif
+
+#include <alloca.h>
+#include <strings.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/stat.h>
+#include <signal.h>
+#include <netinet/in.h>
+
+#ifndef BYTE_ORDER
+#define LITTLE_ENDIAN 1234
+#define BIG_ENDIAN 4321
+
+#ifdef __sparc__
+#define BYTE_ORDER BIG_ENDIAN
+#else
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+#endif
+
+#ifndef __BYTE_ORDER
+#define __LITTLE_ENDIAN LITTLE_ENDIAN
+#define __BIG_ENDIAN BIG_ENDIAN
+#define __BYTE_ORDER BYTE_ORDER
+#endif
+
+#ifndef __BIT_TYPES_DEFINED__
+#define __BIT_TYPES_DEFINED__
+typedef unsigned char u_int8_t;
+typedef unsigned short u_int16_t;
+typedef unsigned int u_int32_t;
+#endif
+
+char* strsep(char** str, const char* delims);
+int setenv(const char *name, const char *value, int overwrite);
+int unsetenv(const char *name);
+#endif /* SOLARIS */
+
+#ifdef __CYGWIN__
+#define _WIN32_WINNT 0x0500
+#include <windows.h>
+#include <w32api/ws2tcpip.h>
+#endif /* __CYGWIN__ */
+
+#define HAVE_VASPRINTF
+#define HAVE_STRTOQ
+
+#ifdef __linux__
+#define HAVE_STRCASESTR
+#define HAVE_STRNDUP
+#define HAVE_STRNLEN
+#endif
+
+#ifdef SOLARIS
+#undef HAVE_VASPRINTF
+#undef HAVE_STRTOQ
+#endif
+
+#ifdef __CYGWIN__
+#undef HAVE_STRTOQ
+typedef unsigned long long uint64_t;
+#endif
+
+#ifndef HAVE_STRCASESTR
+char *strcasestr(const char *, const char *);
+#endif
+
+#ifndef HAVE_STRNDUP
+char *strndup(const char *, size_t);
+#endif
+
+#ifndef HAVE_STRNLEN
+size_t strnlen(const char *, size_t);
+#endif
+
+#ifndef HAVE_VASPRINTF
+int vasprintf(char **strp, const char *fmt, va_list ap);
+#endif
+
+#ifndef HAVE_STRTOQ
+uint64_t strtoq(const char *nptr, char **endptr, int base);
+#endif
+
+#endif
diff --git a/include/asterisk/endian.h b/include/asterisk/endian.h
index 49a5a8fdd..0dfa4b2a9 100755
--- a/include/asterisk/endian.h
+++ b/include/asterisk/endian.h
@@ -27,9 +27,7 @@
* Autodetect system endianess
*/
-#ifdef SOLARIS
-#include "solaris-compat/compat.h"
-#endif
+#include "asterisk/compat.h"
#ifndef __BYTE_ORDER
#ifdef __linux__
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 8751ba20c..de8268fd3 100755
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -25,9 +25,7 @@
#ifndef _ASTERISK_LOGGER_H
#define _ASTERISK_LOGGER_H
-#ifdef SOLARIS
-#include <solaris-compat/compat.h>
-#endif
+#include "asterisk/compat.h"
#include <stdarg.h>
diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index 651a576e9..37a5faccd 100755
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -28,6 +28,7 @@
#include "asterisk/inline_api.h"
#include "asterisk/compiler.h"
+#include "asterisk/compat.h"
static inline int ast_strlen_zero(const char *s)
{
@@ -209,25 +210,6 @@ struct ast_realloca {
(ra)->ptr; \
})
-#define HAVE_VASPRINTF
-#define HAVE_STRTOQ
-
-#ifdef __linux__
-#define HAVE_STRCASESTR
-#define HAVE_STRNDUP
-#define HAVE_STRNLEN
-#endif
-
-#ifdef SOLARIS
-#undef HAVE_VASPRINTF
-#undef HAVE_STRTOQ
-#endif
-
-#ifdef __CYGWIN__
-#undef HAVE_STRTOQ
-typedef unsigned long long uint64_t;
-#endif
-
#ifndef HAVE_STRCASESTR
char *strcasestr(const char *, const char *);
#endif
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 6d42b7a1c..2cefbacb3 100755
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -23,9 +23,7 @@
#ifndef _ASTERISK_UTILS_H
#define _ASTERISK_UTILS_H
-#ifdef SOLARIS
-#include <solaris-compat/compat.h>
-#endif
+#include "asterisk/compat.h"
#include <netinet/in.h>
#include <arpa/inet.h> /* we want to override inet_ntoa */
diff --git a/strcompat.c b/strcompat.c
index be79a595a..38615ac5d 100755
--- a/strcompat.c
+++ b/strcompat.c
@@ -3,9 +3,7 @@
#include <sys/types.h>
#include <stdio.h>
-#ifdef SOLARIS
-#include "solaris-compat/compat.h"
-#endif
+#include "asterisk/compat.h"
char* strsep(char** str, const char* delims)
{
diff --git a/utils/smsq.c b/utils/smsq.c
index 1463b6209..97968ee06 100755
--- a/utils/smsq.c
+++ b/utils/smsq.c
@@ -9,8 +9,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
+#include <asterisk/compat.h>
#ifdef SOLARIS
-#include <solaris-compat/compat.h>
#define POPT_ARGFLAG_SHOW_DEFAULT 0x00800000
#endif
#if !defined(POPT_ARGFLAG_SHOW_DEFAULT)