From 3736bbc56bd4cf5b0326a2d14a370f11e58ead83 Mon Sep 17 00:00:00 2001 From: Matt Messier Date: Tue, 8 May 2007 00:03:41 -0400 Subject: RIP: AC_OPTIMIZATIONS -- Removed m4/optimizations.m4, and along with it, AC_OPTIMIZATIONS. -- Stripped down, cleaned up, and merged the former together with other compiler characteristic checks. -- Do not set any optimization flags into CFLAGS. Update all Makefile.am's with proper AM_CFLAGS, AM_CPPFLAGS, AM_LDFLAGS, etc. to set up optimization flags, usually from DEFAULT_OCFLAGS. -- Start cleaning up CFLAGS/CPPFLAGS stuff in Makefile.am's all over the place. -- Correct a number of places where CFLAGS itself was being mangled in Makefile to on-the-fly adjust optimizations to work around compiler bugs. This stuff is now done correctly. -- The run of automake from autogen.sh is now clean of warnings. -- Cleaned out some (now) dead macros from m4/_xine.m4 -- Mac OS X intel builds out-of-the-box now -- dropped optimization on post/deinterlace/plugins/kdetv-greedyh to O1_CFLAGS. -- OBJCFLAGS is now getting set correctly everywhere that it needs to be -- Various other miscellaneous cleanups all over --- lib/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/Makefile.am b/lib/Makefile.am index 36b695bc8..c6462037e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,5 +1,7 @@ include $(top_srcdir)/misc/Makefile.common +AM_CFLAGS = $(DEFAULT_OCFLAGS) + EXTRA_DIST = Makefile.common noinst_LTLIBRARIES = libxineposix.la -- cgit v1.2.3 From 171e2f880e22241465808dd758e64415c1972aaf Mon Sep 17 00:00:00 2001 From: Matt Messier Date: Thu, 17 May 2007 17:21:39 -0400 Subject: Mac OS X universal binary build cleanups --- lib/os_internal.h | 89 +++++++++++++++++++++++-------------------------------- 1 file changed, 37 insertions(+), 52 deletions(-) (limited to 'lib') diff --git a/lib/os_internal.h b/lib/os_internal.h index e461b5581..49b9330e5 100644 --- a/lib/os_internal.h +++ b/lib/os_internal.h @@ -8,72 +8,57 @@ */ #if defined(__APPLE__) && defined(XINE_MACOSX_UNIVERSAL_BINARY) -#if !defined(__ppc__) && !defined(__ppc64__) && !defined(__i386__) && !defined(__x86_64__) +/* __ppc__, __ppc64__, __i386__, __x86_64__ are interesting arch macros */ +#if defined(__ppc__) || defined(__ppc64__) +#define ARCH_PPC +#if defined(__ppc64__) +#define HOST_ARCH "darwin/powerpc64" +#else +#define HOST_ARCH "darwin/powerpc" +#endif +#elif defined(__i386__) || defined(__x86_64__) +#define ARCH_X86 +#define BITFIELD_LSBF +#define HAVE_MMX +#if defined(__x86_64__) +#define ARCH_X86_64 +#define HOST_ARCH "darwin/x86_64" +#elif defined(__i386__) +#define ARCH_X86_32 +#define HOST_ARCH "darwin/x86_32" +#else #error unrecognized/unsupported CPU type building for Apple Darwin #endif +#endif -/* First get rid of anything that initial configure might have set */ -#undef ARCH_PPC -#undef ARCH_X86 -#undef ARCH_X86_32 -#undef ARCH_X86_64 -#undef BITFIELD_LSBF -#undef ENABLE_ALTIVEC -#undef FPM_64BIT -#undef FPM_DEFAULT -#undef FPM_INTEL -#undef FPM_PPC -#undef HAVE_MMX -#undef HOST_ARCH -#undef HOST_DARWIN +/* See /Developer/SDKs/MacOSX10.4u.sdk/usr/include/machine/limits.h */ +#if SIZEOF_INT != 4 #undef SIZEOF_INT -#undef SIZEOF_LONG -#undef SIZEOF_LONG_LONG -#undef WORDS_BIGENDIAN +#define SIZEOF_INT 4 +#endif -#define HOST_DARWIN 1 +#if defined(__LP64__) && SIZEOF_LONG != 8 +#undef SIZEOF_LONG +#define SIZEOF_LONG 8 +#elif !defined(__LP64__) && SIZEOF_LONG != 4 +#undef SIZEOF_LONG +#define SIZEOF_LONG 4 +#endif /* WORDS_BIGENDIAN (replaces AC_C_BIGENDIAN autoconf test at compile time) */ #include #if BYTE_ORDER == BIG_ENDIAN #define WORDS_BIGENDIAN 1 +#else +#undef WORDS_BIGENDIAN #endif -/* __ppc__, __ppc64__, __i386__, __x86_64__ are interesting arch macros */ -#if defined(__ppc__) -#define ARCH_PPC -#define FPM_PPC 1 -#define HOST_ARCH "darwin/powerpc" -#define SIZEOF_INT 4 -#define SIZEOF_LONG 4 -#define SIZEOF_LONG_LONG 8 -#elif defined(__ppc64__) -#define ARCH_PPC +#if defined(__LP64__) #define FPM_64BIT 1 -#define SIZEOF_INT 4 -#define SIZEOF_LONG 8 -#define SIZEOF_LONG_LONG 8 -#define HOST_ARCH "darwin/powerpc64" -#elif defined(__i386__) -#define ARCH_X86 -#define ARCH_X86_32 -#define BITFIELD_LSBF +#elif defined(__ppc__) || defined(__ppc64__) +#define FPM_PPC 1 +#elif defined(__i386__) || defined(__x86_64__) #define FPM_INTEL 1 -#define HAVE_MMX -#define HOST_ARCH "darwin/i386" -#define SIZEOF_INT 4 -#define SIZEOF_LONG 4 -#define SIZEOF_LONG_LONG 8 -#elif defined(__x86_64__) -#define ARCH_X86 -#define ARCH_X86_64 -#define BITFIELD_LSBF -#define FPM_64BIT 1 -#define HAVE_MMX -#define HOST_ARCH "darwin/x64_64" -#define SIZEOF_INT 4 -#define SIZEOF_LONG 8 -#define SIZEOF_LONG_LONG 8 #endif #endif /* __APPLE__ */ -- cgit v1.2.3 From b9cedf245ca748915c739f9c9d14457cdf956a56 Mon Sep 17 00:00:00 2001 From: Matt Messier Date: Fri, 18 May 2007 12:39:25 -0400 Subject: Work around missing pthread_mutex_timedlock() as necessary --- lib/os_internal.h | 9 ++++++++- lib/timedlock.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 lib/timedlock.c (limited to 'lib') diff --git a/lib/os_internal.h b/lib/os_internal.h index 49b9330e5..b618b3952 100644 --- a/lib/os_internal.h +++ b/lib/os_internal.h @@ -79,7 +79,7 @@ #endif #include - +#include #if defined(WIN32) || defined(__CYGWIN__) # define XINE_PATH_SEPARATOR_STRING ";" @@ -193,6 +193,13 @@ int xine_private_vasprintf(char **string, const char *format, va_list ap) XINE_F char *xine_private_strndup(const char *s, size_t n); #endif +/* replacement of pthread_mutex_timedlock */ +#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK +#define HAVE_PTHREAD_MUTEX_TIMEDLOCK +#define pthread_mutex_timedlock(M, T) xine_private_pthread_mutex_timedlock((M), (T)) +int xine_private_pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abs_timeout); +#endif + /* handle non-standard function names */ #if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF) # define HAVE_SNPRINTF diff --git a/lib/timedlock.c b/lib/timedlock.c new file mode 100644 index 000000000..997ef6235 --- /dev/null +++ b/lib/timedlock.c @@ -0,0 +1,33 @@ +#include "config.h" + +#include + +#define _x_min(a, b) ((a) < (b) ? (a) : (b)) + +int xine_private_pthread_mutex_timedlock(pthread_mutex_t *mutex, + const struct timespec *abs_timeout) +{ + int pthread_rc; + struct timespec remaining, slept, ts; + + remaining = *abs_timeout; + while ((pthread_rc = pthread_mutex_trylock(mutex)) == EBUSY) { + ts.tv_sec = 0; + ts.tv_nsec = (remaining.tv_sec > 0 ? 10000000 + : _x_min(remaining.tv_nsec, 10000000)); + nanosleep(&ts, &slept); + ts.tv_nsec -= slept.tv_nsec; + if (ts.tv_nsec <= remaining.tv_nsec) { + remaining.tv_nsec -= ts.tv_nsec; + } + else { + remaining.tv_sec--; + remaining.tv_nsec = (1000000 - (ts.tv_nsec - remaining.tv_nsec)); + } + if (remaining.tv_sec < 0 || (!remaining.tv_sec && remaining.tv_nsec <= 0)) { + return ETIMEDOUT; + } + } + + return pthread_rc; +} -- cgit v1.2.3 From b5b003ebba912f0047ed41696a6efcad6d4eedb9 Mon Sep 17 00:00:00 2001 From: Matt Messier Date: Fri, 18 May 2007 18:58:47 -0400 Subject: Add back accidentally removed #undef of HOST_ARCH for universal builds --- lib/os_internal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/os_internal.h b/lib/os_internal.h index b618b3952..1e536b9fa 100644 --- a/lib/os_internal.h +++ b/lib/os_internal.h @@ -9,6 +9,7 @@ #if defined(__APPLE__) && defined(XINE_MACOSX_UNIVERSAL_BINARY) /* __ppc__, __ppc64__, __i386__, __x86_64__ are interesting arch macros */ +#undef HOST_ARCH #if defined(__ppc__) || defined(__ppc64__) #define ARCH_PPC #if defined(__ppc64__) -- cgit v1.2.3