From d6523202af29bc289247430fa90e6913ce59c543 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 1 Mar 2019 10:56:26 +0100 Subject: [PATCH] Configure: do not export OS_VERSION_{MAJOR,MINOR} * this is only used for macOS so use built-in defines instead * the version is still used for some feature check in configure itself --- configure.ac | 10 +++++----- src/audio/capture/coreaudio.c | 7 ++++--- src/audio/playback/coreaudio.cpp | 7 ++++--- src/gl_context.h | 6 +++++- src/mac_gl_common.m | 7 ++++--- src/video_display/quicktime.c | 7 ++++--- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 8aa08720c..8112770da 100644 --- a/configure.ac +++ b/configure.ac @@ -175,9 +175,6 @@ then OBJS="$OBJS src/utils/autorelease_pool.o" fi -AC_DEFINE_UNQUOTED([OS_VERSION_MAJOR], $os_version_major, [OS kernel major version]) -AC_DEFINE_UNQUOTED([OS_VERSION_MINOR], $os_version_minor, [OS kernel minor version]) - LINKER=$CXX AC_SUBST(LINKER) @@ -236,7 +233,9 @@ AH_BOTTOM([ * so supplying a fake one (Macs allocate always aligned pointers * to a 16 byte boundry. */ -#if defined HAVE_MACOSX && OS_VERSION_MAJOR <= 9 +#if defined HAVE_MACOSX +#include +#ifndef __MAC_10_9 #include #include #ifndef POSIX_MEMALIGN @@ -251,7 +250,8 @@ static inline int posix_memalign(void **memptr, size_t alignment, size_t size) return 0; } #endif // POSIX_MEMALIGN -#endif // defined HAVE_MACOSX && OS_VERSION_MAJOR <= 9 +#endif // !defined __MAC_10_9 +#endif // defined HAVE_MACOSX #undef MIN #define MIN(a,b) (((a)<(b))?(a):(b)) diff --git a/src/audio/capture/coreaudio.c b/src/audio/capture/coreaudio.c index 1a0e1f661..635801bb7 100644 --- a/src/audio/capture/coreaudio.c +++ b/src/audio/capture/coreaudio.c @@ -42,6 +42,7 @@ #ifdef HAVE_COREAUDIO +#include #include #include #include @@ -64,7 +65,7 @@ #define MODULE_NAME "[CoreAudio] " struct state_ca_capture { -#if OS_VERSION_MAJOR <= 9 +#ifndef __MAC_10_9 ComponentInstance #else AudioComponentInstance @@ -246,7 +247,7 @@ static void * audio_cap_ca_init(const char *cfg) } struct state_ca_capture *s; OSErr ret = noErr; -#if OS_VERSION_MAJOR <= 9 +#ifndef __MAC_10_9 Component comp; ComponentDescription desc; #else @@ -326,7 +327,7 @@ static void * audio_cap_ca_init(const char *cfg) desc.componentFlags = 0; desc.componentFlagsMask = 0; -#if OS_VERSION_MAJOR > 9 +#ifdef __MAC_10_9 comp = AudioComponentFindNext(NULL, &desc); if(!comp) { fprintf(stderr, "Error finding AUHAL component.\n"); diff --git a/src/audio/playback/coreaudio.cpp b/src/audio/playback/coreaudio.cpp index ad36d987a..d7f3b0d68 100644 --- a/src/audio/playback/coreaudio.cpp +++ b/src/audio/playback/coreaudio.cpp @@ -40,6 +40,7 @@ #ifdef HAVE_COREAUDIO #include +#include #include #include #include @@ -64,7 +65,7 @@ using std::cout; #define CA_DIS_AD_B "ca-disable-adaptive-buf" struct state_ca_playback { -#if OS_VERSION_MAJOR <= 9 +#ifndef __MAC_10_9 ComponentInstance #else AudioComponentInstance @@ -297,7 +298,7 @@ static void * audio_play_ca_init(const char *cfg) { struct state_ca_playback *s; OSErr ret = noErr; -#if OS_VERSION_MAJOR <= 9 +#ifndef __MAC_10_9 Component comp; ComponentDescription comp_desc; #else @@ -325,7 +326,7 @@ static void * audio_play_ca_init(const char *cfg) comp_desc.componentFlags = 0; comp_desc.componentFlagsMask = 0; -#if OS_VERSION_MAJOR <= 9 +#ifndef __MAC_10_9 comp = FindNextComponent(NULL, &comp_desc); if(!comp) goto error; ret = OpenAComponent(comp, &s->auHALComponentInstance); diff --git a/src/gl_context.h b/src/gl_context.h index 348509ae2..2071b6883 100644 --- a/src/gl_context.h +++ b/src/gl_context.h @@ -13,11 +13,15 @@ #include #endif /* HAVE_LINUX */ +#ifdef HAVE_MACOSX +#include +#endif + #ifdef __cplusplus extern "C" { #endif // __cplusplus -#if defined HAVE_MACOSX && OS_VERSION_MAJOR < 11 +#if defined HAVE_MACOSX && ! defined__MAC_10_11 #define glGenFramebuffers glGenFramebuffersEXT #define glBindFramebuffer glBindFramebufferEXT #define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT diff --git a/src/mac_gl_common.m b/src/mac_gl_common.m index 7370d8b04..870fd0d4f 100644 --- a/src/mac_gl_common.m +++ b/src/mac_gl_common.m @@ -51,6 +51,7 @@ #include "mac_gl_common.h" +#include #import #include #include @@ -59,7 +60,7 @@ #include -#if OS_VERSION_MAJOR < 11 +#ifndef __MAC_10_11 #warning "You are compling on pre-10.7 Mac OS X version. Core OpenGL 3.2 profile won't work" #warning "in case you'll try to use this binary with Lion or higher (only legacy OpenGL)." #endif @@ -113,7 +114,7 @@ void *mac_gl_init(mac_opengl_version_t ogl_version) mac_version_major = get_mac_kernel_version_major(); if(ogl_version == MAC_GL_PROFILE_3_2) { /* Lion or later */ -#if OS_VERSION_MAJOR >= 11 +#ifdef __MAC_10_11 if(mac_version_major < 11) { fprintf(stderr, "[Mac OpenGL] Unable to activate OpenGL 3.2 for pre-Lion Macs.\n"); return NULL; @@ -126,7 +127,7 @@ void *mac_gl_init(mac_opengl_version_t ogl_version) return NULL; #endif } else if(ogl_version == MAC_GL_PROFILE_LEGACY) { -#if OS_VERSION_MAJOR >= 11 +#ifdef __MAC_10_11 if(mac_version_major >= 11) { attrs[0] = kCGLPFAOpenGLProfile; attrs[1] = kCGLOGLPVersion_Legacy; // kCGLOGLPVersion_Legacy; diff --git a/src/video_display/quicktime.c b/src/video_display/quicktime.c index 221d5b210..118828468 100644 --- a/src/video_display/quicktime.c +++ b/src/video_display/quicktime.c @@ -55,6 +55,7 @@ #include "tv.h" #include "video.h" +#include "Availability.h" #ifdef HAVE_MACOSX #include #include @@ -214,7 +215,7 @@ const quicktime_mode_t quicktime_modes[] = { /* for audio see TN2091 (among others) */ struct state_quicktime { ComponentInstance videoDisplayComponentInstance[MAX_DEVICES]; -#if OS_VERSION_MAJOR <= 9 +#ifndef __MAC_10_9 ComponentInstance #else AudioComponentInstance @@ -807,7 +808,7 @@ static void *display_quicktime_init(struct module *parent, const char *fmt, unsi static void display_quicktime_audio_init(struct state_quicktime *s) { OSErr ret = noErr; -#if OS_VERSION_MAJOR <= 9 +#ifndef __MAC_10_9 Component comp; ComponentDescription desc; #else @@ -830,7 +831,7 @@ static void display_quicktime_audio_init(struct state_quicktime *s) desc.componentFlags = 0; desc.componentFlagsMask = 0; -#if OS_VERSION_MAJOR <= 9 +#ifndef __MAC_10_9 comp = FindNextComponent(NULL, &desc); if(!comp) goto audio_error; ret = OpenAComponent(comp, &s->auHALComponentInstance);