From 213a4acfcc3f458be052dcef5a895e4fc81ecb39 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Wed, 30 Sep 2009 21:46:31 +0200 Subject: [PATCH] Clean Python and Ruby flags when macsdk is set Most importantly there are no explicit -I.. flags that break the --with-macsdk functionality. Also use -framework Ruby and include Ruby properly. --- src/configure | 19 ++++++++++++++++++- src/configure.in | 28 +++++++++++++++++++++++++++- src/if_python.c | 7 ++++++- src/if_ruby.c | 6 +++++- 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/src/configure b/src/configure index 2f7d32a7..d940525f 100755 --- a/src/configure +++ b/src/configure @@ -3745,6 +3745,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } + MACSDK="" CFLAGS="$save_cflags" LDFLAGS="$save_ldflags" fi @@ -5254,6 +5255,13 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ echo "${ECHO_T}no" >&6; } fi + if test -n "$MACSDK"; then + PYTHON_CFLAGS= + PYTHON_LIBS=-framework Python + PYTHON_CONFDIR= + PYTHON_GETPATH_CFLAGS= + fi + { echo "$as_me:$LINENO: checking if compile and link flags for Python are sane" >&5 echo $ECHO_N "checking if compile and link flags for Python are sane... $ECHO_C" >&6; } cflags_save=$CFLAGS @@ -5751,7 +5759,10 @@ echo "${ECHO_T}$rubyhdrdir" >&6; } librubyarg="$rubyhdrdir/$librubyarg" else rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG["libdir"])'` - if test -f "$rubylibdir/$librubyarg"; then + if test -d "/System/Library/Frameworks/Ruby.framework"; then + RUBY_LIBS="-framework Ruby" + librubyarg= + elif test -f "$rubylibdir/$librubyarg"; then librubyarg="$rubylibdir/$librubyarg" elif test "$librubyarg" = "libruby.a"; then librubyarg="-lruby" @@ -5773,6 +5784,12 @@ echo "${ECHO_T}$rubyhdrdir" >&6; } RUBY_SRC="if_ruby.c" RUBY_OBJ="objects/if_ruby.o" RUBY_PRO="if_ruby.pro" + + if test -n "$MACSDK"; then + RUBY_CFLAGS= + RUBY_LIBS="-framework Ruby" + fi + cat >>confdefs.h <<\_ACEOF #define FEAT_RUBY 1 _ACEOF diff --git a/src/configure.in b/src/configure.in index 65b6cccc..1c744fd9 100644 --- a/src/configure.in +++ b/src/configure.in @@ -133,6 +133,9 @@ if test "`(uname) 2>/dev/null`" = Darwin; then [ AC_MSG_RESULT([yes]) XCODEFLAGS="$XCODEFLAGS -sdk macosx$MACSDK MACOSX_DEPLOYMENT_TARGET=$MACSDK" ], [ AC_MSG_RESULT([no]) + dnl Important to clear MACSDK so later on in the script we can assume + dnl that no SDK was chosen if it is empty. + MACSDK="" CFLAGS="$save_cflags" LDFLAGS="$save_ldflags" ]) fi @@ -797,6 +800,16 @@ eof AC_MSG_RESULT(no) fi + dnl On Mac OS X, when an SDK has been explicitly chosen we can't rely + dnl on any of the search paths set above. The -framework flag does it + dnl all for us. + if test -n "$MACSDK"; then + PYTHON_CFLAGS= + PYTHON_LIBS=-framework Python + PYTHON_CONFDIR= + PYTHON_GETPATH_CFLAGS= + fi + dnl check that compiling a simple program still works with the flags dnl added for Python. AC_MSG_CHECKING([if compile and link flags for Python are sane]) @@ -984,7 +997,11 @@ if test "$enable_rubyinterp" = "yes"; then librubyarg="$rubyhdrdir/$librubyarg" else rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'` - if test -f "$rubylibdir/$librubyarg"; then + if test -d "/System/Library/Frameworks/Ruby.framework"; then + dnl On Mac OS X it is safer to just use the -framework flag + RUBY_LIBS="-framework Ruby" + librubyarg= + elif test -f "$rubylibdir/$librubyarg"; then librubyarg="$rubylibdir/$librubyarg" elif test "$librubyarg" = "libruby.a"; then dnl required on Mac OS 10.3 where libruby.a doesn't exist @@ -1010,6 +1027,15 @@ if test "$enable_rubyinterp" = "yes"; then RUBY_SRC="if_ruby.c" RUBY_OBJ="objects/if_ruby.o" RUBY_PRO="if_ruby.pro" + + dnl On Mac OS X, when an SDK has been explicitly chosen we can't rely + dnl on any of the search paths set above. The -framework flag does it + dnl all for us. + if test -n "$MACSDK"; then + RUBY_CFLAGS= + RUBY_LIBS="-framework Ruby" + fi + AC_DEFINE(FEAT_RUBY) else AC_MSG_RESULT(not found, disabling Ruby) diff --git a/src/if_python.c b/src/if_python.c index e483bfc8..a1707872 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -40,7 +40,12 @@ #define PY_SSIZE_T_CLEAN -#include +#ifdef FEAT_GUI_MACVIM +# include +#else +# include +#endif + #if defined(MACOS) && !defined(MACOS_X_UNIX) # include "macglue.h" # include diff --git a/src/if_ruby.c b/src/if_ruby.c index 0fed2c01..65639390 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -48,7 +48,11 @@ # endif #endif -#include +#ifdef FEAT_GUI_MACVIM +# include +#else +# include +#endif #undef EXTERN #undef _ -- 2.11.4.GIT