Add OS/2 supports
Change-Id: I792d5236451905eb20a8ebe444ef5b2274e4f7a4
This commit is contained in:
parent
07c6eb18ad
commit
2dad8d65d9
@ -391,6 +391,7 @@ LDFLAGS = ${LDFLAGS}
|
|||||||
ASFLAGS = ${ASFLAGS}
|
ASFLAGS = ${ASFLAGS}
|
||||||
extralibs = ${extralibs}
|
extralibs = ${extralibs}
|
||||||
AS_SFX = ${AS_SFX:-.asm}
|
AS_SFX = ${AS_SFX:-.asm}
|
||||||
|
EXE_SFX = ${EXE_SFX}
|
||||||
RTCD_OPTIONS = ${RTCD_OPTIONS}
|
RTCD_OPTIONS = ${RTCD_OPTIONS}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -540,6 +541,7 @@ setup_gnu_toolchain() {
|
|||||||
STRIP=${STRIP:-${CROSS}strip}
|
STRIP=${STRIP:-${CROSS}strip}
|
||||||
NM=${NM:-${CROSS}nm}
|
NM=${NM:-${CROSS}nm}
|
||||||
AS_SFX=.s
|
AS_SFX=.s
|
||||||
|
EXE_SFX=
|
||||||
}
|
}
|
||||||
|
|
||||||
process_common_toolchain() {
|
process_common_toolchain() {
|
||||||
@ -593,6 +595,9 @@ process_common_toolchain() {
|
|||||||
*solaris2.10)
|
*solaris2.10)
|
||||||
tgt_os=solaris
|
tgt_os=solaris
|
||||||
;;
|
;;
|
||||||
|
*os2*)
|
||||||
|
tgt_os=os2
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then
|
if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then
|
||||||
@ -919,6 +924,9 @@ process_common_toolchain() {
|
|||||||
LD=${LD:-${CROSS}gcc}
|
LD=${LD:-${CROSS}gcc}
|
||||||
CROSS=${CROSS:-g}
|
CROSS=${CROSS:-g}
|
||||||
;;
|
;;
|
||||||
|
os2)
|
||||||
|
AS=${AS:-nasm}
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AS="${alt_as:-${AS:-auto}}"
|
AS="${alt_as:-${AS:-auto}}"
|
||||||
@ -989,6 +997,11 @@ process_common_toolchain() {
|
|||||||
# enabled icc && ! enabled pic && add_cflags -fno-pic -mdynamic-no-pic
|
# enabled icc && ! enabled pic && add_cflags -fno-pic -mdynamic-no-pic
|
||||||
enabled icc && ! enabled pic && add_cflags -fno-pic
|
enabled icc && ! enabled pic && add_cflags -fno-pic
|
||||||
;;
|
;;
|
||||||
|
os2)
|
||||||
|
add_asflags -f aout
|
||||||
|
enabled debug && add_asflags -g
|
||||||
|
EXE_SFX=.exe
|
||||||
|
;;
|
||||||
*) log "Warning: Unknown os $tgt_os while setting up $AS flags"
|
*) log "Warning: Unknown os $tgt_os while setting up $AS flags"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
1
configure
vendored
1
configure
vendored
@ -109,6 +109,7 @@ all_platforms="${all_platforms} x86-darwin9-icc"
|
|||||||
all_platforms="${all_platforms} x86-darwin10-gcc"
|
all_platforms="${all_platforms} x86-darwin10-gcc"
|
||||||
all_platforms="${all_platforms} x86-linux-gcc"
|
all_platforms="${all_platforms} x86-linux-gcc"
|
||||||
all_platforms="${all_platforms} x86-linux-icc"
|
all_platforms="${all_platforms} x86-linux-icc"
|
||||||
|
all_platforms="${all_platforms} x86-os2-gcc"
|
||||||
all_platforms="${all_platforms} x86-solaris-gcc"
|
all_platforms="${all_platforms} x86-solaris-gcc"
|
||||||
all_platforms="${all_platforms} x86-win32-gcc"
|
all_platforms="${all_platforms} x86-win32-gcc"
|
||||||
all_platforms="${all_platforms} x86-win32-vs7"
|
all_platforms="${all_platforms} x86-win32-vs7"
|
||||||
|
@ -168,12 +168,12 @@ $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_OBJS,BUILD_OBJS):=yes)
|
|||||||
# Create build/install dependencies for all examples. The common case
|
# Create build/install dependencies for all examples. The common case
|
||||||
# is handled here. The MSVS case is handled below.
|
# is handled here. The MSVS case is handled below.
|
||||||
NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
|
NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
|
||||||
DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=))
|
DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=$(EXE_SFX)))
|
||||||
INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=))
|
INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
|
||||||
DIST-SRCS-yes += $(ALL_SRCS)
|
DIST-SRCS-yes += $(ALL_SRCS)
|
||||||
INSTALL-SRCS-yes += $(UTIL_SRCS)
|
INSTALL-SRCS-yes += $(UTIL_SRCS)
|
||||||
OBJS-$(NOT_MSVS) += $(if $(BUILD_OBJS),$(call objs,$(ALL_SRCS)))
|
OBJS-$(NOT_MSVS) += $(if $(BUILD_OBJS),$(call objs,$(ALL_SRCS)))
|
||||||
BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=))
|
BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=$(EXE_SFX)))
|
||||||
|
|
||||||
|
|
||||||
# Instantiate linker template for all examples.
|
# Instantiate linker template for all examples.
|
||||||
@ -183,7 +183,7 @@ $(foreach bin,$(BINS-yes),\
|
|||||||
$(if $(BUILD_OBJS),$(eval $(bin):\
|
$(if $(BUILD_OBJS),$(eval $(bin):\
|
||||||
$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF)))\
|
$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF)))\
|
||||||
$(if $(BUILD_OBJS),$(eval $(call linker_template,$(bin),\
|
$(if $(BUILD_OBJS),$(eval $(call linker_template,$(bin),\
|
||||||
$(call objs,$($(notdir $(bin)).SRCS)) \
|
$(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
|
||||||
-l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
|
-l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
|
||||||
)))\
|
)))\
|
||||||
$(if $(LIPO_OBJS),$(eval $(call lipo_bin_template,$(bin))))\
|
$(if $(LIPO_OBJS),$(eval $(call lipo_bin_template,$(bin))))\
|
||||||
|
@ -9,15 +9,21 @@
|
|||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "tools_common.h"
|
#include "tools_common.h"
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(__OS2__)
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#ifdef __OS2__
|
||||||
|
#define _setmode setmode
|
||||||
|
#define _fileno fileno
|
||||||
|
#define _O_BINARY O_BINARY
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FILE* set_binary_mode(FILE *stream)
|
FILE* set_binary_mode(FILE *stream)
|
||||||
{
|
{
|
||||||
(void)stream;
|
(void)stream;
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(__OS2__)
|
||||||
_setmode(_fileno(stream), _O_BINARY);
|
_setmode(_fileno(stream), _O_BINARY);
|
||||||
#endif
|
#endif
|
||||||
return stream;
|
return stream;
|
||||||
|
@ -19,11 +19,15 @@
|
|||||||
#include "vp8/common/onyxc_int.h"
|
#include "vp8/common/onyxc_int.h"
|
||||||
|
|
||||||
#if CONFIG_MULTITHREAD
|
#if CONFIG_MULTITHREAD
|
||||||
#if HAVE_UNISTD_H
|
#if HAVE_UNISTD_H && !defined(__OS2__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
|
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
|
||||||
|
#elif defined(__OS2__)
|
||||||
|
#define INCL_DOS
|
||||||
|
#define INCL_DOSSPINLOCK
|
||||||
|
#include <os2.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -32,7 +36,7 @@ static int get_cpu_count()
|
|||||||
{
|
{
|
||||||
int core_count = 16;
|
int core_count = 16;
|
||||||
|
|
||||||
#if HAVE_UNISTD_H
|
#if HAVE_UNISTD_H && !defined(__OS2__)
|
||||||
#if defined(_SC_NPROCESSORS_ONLN)
|
#if defined(_SC_NPROCESSORS_ONLN)
|
||||||
core_count = sysconf(_SC_NPROCESSORS_ONLN);
|
core_count = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
#elif defined(_SC_NPROC_ONLN)
|
#elif defined(_SC_NPROC_ONLN)
|
||||||
@ -55,6 +59,21 @@ static int get_cpu_count()
|
|||||||
|
|
||||||
core_count = sysinfo.dwNumberOfProcessors;
|
core_count = sysinfo.dwNumberOfProcessors;
|
||||||
}
|
}
|
||||||
|
#elif defined(__OS2__)
|
||||||
|
{
|
||||||
|
ULONG proc_id;
|
||||||
|
ULONG status;
|
||||||
|
|
||||||
|
core_count = 0;
|
||||||
|
for (proc_id = 1; ; proc_id++)
|
||||||
|
{
|
||||||
|
if (DosGetProcessorStatus(proc_id, &status))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (status == PROC_ONLINE)
|
||||||
|
core_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
/* other platforms */
|
/* other platforms */
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,6 +33,29 @@
|
|||||||
#define pthread_getspecific(ts_key) TlsGetValue(ts_key)
|
#define pthread_getspecific(ts_key) TlsGetValue(ts_key)
|
||||||
#define pthread_setspecific(ts_key, value) TlsSetValue(ts_key, (void *)value)
|
#define pthread_setspecific(ts_key, value) TlsSetValue(ts_key, (void *)value)
|
||||||
#define pthread_self() GetCurrentThreadId()
|
#define pthread_self() GetCurrentThreadId()
|
||||||
|
|
||||||
|
#elif defined(__OS2__)
|
||||||
|
/* OS/2 */
|
||||||
|
#define INCL_DOS
|
||||||
|
#include <os2.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#define THREAD_FUNCTION void
|
||||||
|
#define THREAD_FUNCTION_RETURN void
|
||||||
|
#define THREAD_SPECIFIC_INDEX PULONG
|
||||||
|
#define pthread_t TID
|
||||||
|
#define pthread_attr_t ULONG
|
||||||
|
#define pthread_create(thhandle,attr,thfunc,tharg) \
|
||||||
|
((int)((*(thhandle)=_beginthread(thfunc,NULL,1024*1024,tharg))==-1))
|
||||||
|
#define pthread_join(thread, result) ((int)DosWaitThread(&(thread),0))
|
||||||
|
#define pthread_detach(thread) 0
|
||||||
|
#define thread_sleep(nms) DosSleep(nms)
|
||||||
|
#define pthread_cancel(thread) DosKillThread(thread)
|
||||||
|
#define ts_key_create(ts_key, destructor) \
|
||||||
|
DosAllocThreadLocalMemory(1, &(ts_key));
|
||||||
|
#define pthread_getspecific(ts_key) ((void *)(*(ts_key)))
|
||||||
|
#define pthread_setspecific(ts_key, value) (*(ts_key)=(ULONG)(value))
|
||||||
|
#define pthread_self() _gettid()
|
||||||
#else
|
#else
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <mach/mach_init.h>
|
#include <mach/mach_init.h>
|
||||||
@ -64,6 +87,76 @@
|
|||||||
#define sem_destroy(sem) if(*sem)((int)(CloseHandle(*sem))==TRUE)
|
#define sem_destroy(sem) if(*sem)((int)(CloseHandle(*sem))==TRUE)
|
||||||
#define thread_sleep(nms) Sleep(nms)
|
#define thread_sleep(nms) Sleep(nms)
|
||||||
|
|
||||||
|
#elif defined(__OS2__)
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
HEV event;
|
||||||
|
HMTX wait_mutex;
|
||||||
|
HMTX count_mutex;
|
||||||
|
int count;
|
||||||
|
} sem_t;
|
||||||
|
|
||||||
|
static inline int sem_init(sem_t *sem, int pshared, unsigned int value)
|
||||||
|
{
|
||||||
|
DosCreateEventSem(NULL, &sem->event, pshared ? DC_SEM_SHARED : 0,
|
||||||
|
value > 0 ? TRUE : FALSE);
|
||||||
|
DosCreateMutexSem(NULL, &sem->wait_mutex, 0, FALSE);
|
||||||
|
DosCreateMutexSem(NULL, &sem->count_mutex, 0, FALSE);
|
||||||
|
|
||||||
|
sem->count = value;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int sem_wait(sem_t * sem)
|
||||||
|
{
|
||||||
|
DosRequestMutexSem(sem->wait_mutex, -1);
|
||||||
|
|
||||||
|
DosWaitEventSem(sem->event, -1);
|
||||||
|
|
||||||
|
DosRequestMutexSem(sem->count_mutex, -1);
|
||||||
|
|
||||||
|
sem->count--;
|
||||||
|
if (sem->count == 0)
|
||||||
|
{
|
||||||
|
ULONG post_count;
|
||||||
|
|
||||||
|
DosResetEventSem(sem->event, &post_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
DosReleaseMutexSem(sem->count_mutex);
|
||||||
|
|
||||||
|
DosReleaseMutexSem(sem->wait_mutex);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int sem_post(sem_t * sem)
|
||||||
|
{
|
||||||
|
DosRequestMutexSem(sem->count_mutex, -1);
|
||||||
|
|
||||||
|
if (sem->count < 32768)
|
||||||
|
{
|
||||||
|
sem->count++;
|
||||||
|
DosPostEventSem(sem->event);
|
||||||
|
}
|
||||||
|
|
||||||
|
DosReleaseMutexSem(sem->count_mutex);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int sem_destroy(sem_t * sem)
|
||||||
|
{
|
||||||
|
DosCloseEventSem(sem->event);
|
||||||
|
DosCloseMutexSem(sem->wait_mutex);
|
||||||
|
DosCloseMutexSem(sem->count_mutex);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define thread_sleep(nms) DosSleep(nms)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
%define ABI_IS_32BIT 1
|
%define ABI_IS_32BIT 1
|
||||||
%elifidn __OUTPUT_FORMAT__,win32
|
%elifidn __OUTPUT_FORMAT__,win32
|
||||||
%define ABI_IS_32BIT 1
|
%define ABI_IS_32BIT 1
|
||||||
|
%elifidn __OUTPUT_FORMAT__,aout
|
||||||
|
%define ABI_IS_32BIT 1
|
||||||
%else
|
%else
|
||||||
%define ABI_IS_32BIT 0
|
%define ABI_IS_32BIT 0
|
||||||
%endif
|
%endif
|
||||||
@ -314,6 +316,8 @@
|
|||||||
%macro SECTION_RODATA 0
|
%macro SECTION_RODATA 0
|
||||||
section .text
|
section .text
|
||||||
%endmacro
|
%endmacro
|
||||||
|
%elifidn __OUTPUT_FORMAT__,aout
|
||||||
|
%define SECTION_RODATA section .data
|
||||||
%else
|
%else
|
||||||
%define SECTION_RODATA section .rodata
|
%define SECTION_RODATA section .rodata
|
||||||
%endif
|
%endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user