diff --git a/.gitignore b/.gitignore index b1fcb2215d14a61d83964a1755fc2a83e0040266..44cddd2c087efff5478fc0fbeb6b23ef4d29f486 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +example *~ *.a *.diff diff --git a/Makefile b/Makefile index cfb72dabb33a24cec73e709eaddf6be70fabad53..cd0abc6163ff8793022da95177af348c7878955f 100644 --- a/Makefile +++ b/Makefile @@ -327,6 +327,17 @@ endif ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),) @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCCLI_X) $(SRCCHK_X)), $(SRCPATH)/tools/msvsdepend.sh "$(CC)" "$(CFLAGS)" "$(SRC)" "$(SRC:$(SRCPATH)/%.c=%-10.o)" 1>> .depend;) endif +# ti compiler -ppd=filename will override file's content not append +# by default, ti compiler generates output in . not $(dir $(SRC)) so -fr is needed +# by default, ti compiler generates *.obj not *.o so -eo=o is needed +else ifeq ($(COMPILER),TI) + @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO) $(SRCEXAMPLE)), $(CC) $(CFLAGS) $(SRC) -eo=o -fr=$(dir $(SRC)) $(DEPMM)=.depend.orig && cat .depend.orig >> .depend;) +ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),) + @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCS_8) $(SRCCLI_X) $(SRCCHK_X)), $(CC) $(CFLAGS) $(SRC) -eo=o -fr=$(dir $(SRC)) $(DEPMM)=.depend.orig && sed 's/\.o:/-8&/' .depend.orig >> .depend;) +endif +ifneq ($(findstring HAVE_BITDEPTH10 1, $(CONFIG)),) + @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS_X) $(SRCCLI_X) $(SRCCHK_X)), $(CC) $(CFLAGS) $(SRC) -eo=o -fr=$(dir $(SRC)) $(DEPMM)=.depend.orig && 's/\.o:/-10&/' .depend.orig >> .depend;) +endif else @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO) $(SRCEXAMPLE)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;) ifneq ($(findstring HAVE_BITDEPTH8 1, $(CONFIG)),) diff --git a/common/osdep.c b/common/osdep.c index d22d190eb173aaaac26b66ec08a713cf4663a51b..ca1a8694be2a02f4bc34e3c8a7cf71a42243e627 100644 --- a/common/osdep.c +++ b/common/osdep.c @@ -31,8 +31,10 @@ #include <sys/types.h> #include <sys/timeb.h> #else +#ifndef SYS_NONE #include <sys/time.h> #endif +#endif #include <time.h> #if PTW32_STATIC_LIB @@ -50,6 +52,8 @@ int64_t x264_mdate( void ) struct timespec ts; clock_gettime( CLOCK_MONOTONIC, &ts ); return (int64_t)ts.tv_sec * 1000000 + (int64_t)ts.tv_nsec / 1000; +#elif SYS_NONE + return 0; #else struct timeval tv_date; gettimeofday( &tv_date, NULL ); diff --git a/common/osdep.h b/common/osdep.h index 2230121290ab8c756b8e1849695fad38aca819cb..35c797c39deb5972394329efa34d68ca474b256d 100644 --- a/common/osdep.h +++ b/common/osdep.h @@ -31,12 +31,14 @@ #define _LARGEFILE_SOURCE 1 #define _FILE_OFFSET_BITS 64 #include <stdio.h> -#include <sys/stat.h> #include <inttypes.h> #include <stdarg.h> #include <stdlib.h> #include "config.h" +#ifndef SYS_NONE +#include <sys/stat.h> +#endif #ifdef __INTEL_COMPILER #include <mathimf.h> @@ -205,6 +207,7 @@ static inline int x264_stat( const char *path, x264_struct_stat *buf ) /* mdate: return the current date in microsecond */ X264_API int64_t x264_mdate( void ); +#ifndef SYS_NONE #if defined(_WIN32) && !HAVE_WINRT static inline int x264_vfprintf( FILE *stream, const char *format, va_list arg ) { @@ -275,6 +278,13 @@ static inline int x264_is_regular_file( FILE *filehandle ) return 1; return S_ISREG( file_stat.st_mode ); } +#else +#define x264_vfprintf vfprintf +static inline int x264_is_regular_file( FILE *filehandle ) +{ + return 0; +} +#endif #define x264_glue3_expand(x,y,z) x##_##y##_##z #define x264_glue3(x,y,z) x264_glue3_expand(x,y,z) diff --git a/configure b/configure index e242e73cb926944e659cf56c7076bb6b63739527..de5ab5ed9c641c2faa37b55e07175a8e6c083c6a 100755 --- a/configure +++ b/configure @@ -96,6 +96,12 @@ cc_cflags() { [ "$arg" = -fomit-frame-pointer ] && arg= [ "$arg" = -s ] && arg= [ "$arg" = -fPIC ] && arg= + elif [ $compiler_style = TI ]; then + [ "$arg" = -ffast-math ] && arg= + [ "$arg" = -Wall ] && arg= + [ "$arg" = -s ] && arg= + [ "$arg" = -fPIC ] && arg= + [ "$arg" = -Werror ] && arg= else [ "$arg" = -ffast-math ] && arg= [ "$arg" = -Wall ] && arg= @@ -163,6 +169,8 @@ cc_check() { echo "int main (void) { $3 return 0; }" >> conftest.c if [ $compiler_style = MS ]; then cc_cmd="$CC conftest.c $(cc_cflags $CFLAGS $CFLAGSCLI $CHECK_CFLAGS $2) -link $(cl_ldflags $2 $LDFLAGSCLI $LDFLAGS)" + elif [ $compiler_style = TI ]; then + cc_cmd="$CC conftest.c $(cc_cflags $CFLAGS $CFLAGSCLI $CHECK_CFLAGS $2) -z $(cl_ldflags $LDFLAGSCLI $LDFLAGS) -o conftest" else cc_cmd="$CC conftest.c $CFLAGS $CFLAGSCLI $CHECK_CFLAGS $2 $LDFLAGSCLI $LDFLAGS -o conftest" fi @@ -194,6 +202,8 @@ cpp_check() { echo -e "#if !($3) \n#error $4 \n#endif " >> conftest.c if [ $compiler_style = MS ]; then cpp_cmd="$CC conftest.c $(cc_cflags $CFLAGS $2) -P" + elif [ $compiler_style = TI ]; then + cpp_cmd="$CC conftest.c $(cc_cflags $CFLAGS $2) -ppo" else cpp_cmd="$CC conftest.c $CFLAGS $2 -E -o conftest" fi @@ -584,6 +594,16 @@ host="${host#*-}" host_vendor="${host%%-*}" host_os="${host#*-}" +# tic6x only supports cl6x now +if [ $host_cpu = tic6x ]; then + CC=cl6x + AR=ar6x + RANLIB= + STRIP=strip6x + compiler=TI + compiler_style=TI +fi + trap 'rm -rf conftest*' EXIT # test for use of compilers that require specific handling @@ -729,6 +749,9 @@ case $host_os in *haiku*) SYS="HAIKU" ;; + *none*) + SYS="NONE" + ;; *) die "Unknown system $host, edit the configure" ;; @@ -869,6 +892,12 @@ case $host_cpu in alpha*) ARCH="ALPHA" ;; + tic6x) + ARCH="TIC6X" + # cl6x will call asm6x + AS="${AS-cl6x}" + AS_EXT=".sa" + ;; *) ARCH="$(echo $host_cpu | tr a-z A-Z)" ;; @@ -919,6 +948,8 @@ if [ $compiler_style = GNU ]; then elif ! cc_check '' '' 'for( int i = 0; i < 9; i++ );' ; then die "C99 compiler is needed for compilation." fi +elif cc_check '' --c99 'for( int i = 0; i < 9; i++ );' ; then + CFLAGS="$CFLAGS --c99" fi if [ $shared = yes ] ; then @@ -1480,6 +1511,12 @@ if [ $compiler_style = MS ]; then else CFLAGS="-DNDEBUG $CFLAGS" fi +elif [ $compiler_style = TI ]; then + HAVE_GETOPT_LONG=0 + DEPMM=-ppd + AR="$AR r " + LD="$CC -z -c -o " + LIBX264=libx264.a else # gcc/icc DEPMM="$DEPMM -g0" AR="$AR rc " @@ -1510,6 +1547,11 @@ elif [ $compiler = CL ]; then PROF_GEN_LD="-LTCG:PGINSTRUMENT" PROF_USE_CC="-GL" PROF_USE_LD="-LTCG:PGOPTIMIZE" +elif [ $compiler = TI ]; then + PROF_GEN_CC= + PROF_GEN_LD= + PROF_USE_CC= + PROF_USE_LD= else PROF_GEN_CC="-fprofile-generate" PROF_GEN_LD="-fprofile-generate" @@ -1561,6 +1603,8 @@ EOF if [ $compiler_style = MS ]; then echo 'CC_O=-Fo$@' >> config.mak +elif [ $compiler_style = TI ]; then + echo 'CC_O=-fe=$@' >> config.mak else echo 'CC_O=-o $@' >> config.mak fi