From 92f7c1bd48d2476a3acabb9a0594829d6c847761 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Tue, 5 Jan 2016 18:23:11 +0100 Subject: [PATCH] Set the MACOSX_DEPLOYMENT_TARGET on Mac OS X >= 10.9 in case that the MACOSX_DEPLOYMENT_TARGET used to compile Python was for an earlier version. This is needed to take into account a change in the name mangling by the gcc compiler when switching from version 10.8 to 10.9 of Mac OS X. This fixes #1607. --- configure.ac | 53 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 0ec7980..9baa98f 100644 --- a/configure.ac +++ b/configure.ac @@ -101,17 +101,19 @@ AC_CANONICAL_HOST # A special kluge was added for Mac OS X >=10.7. As Apple switched to clang # # we search from this version on for the clang compiler. # # # -# We also signal whether Mac OS X >=10.11 (El Capitan). # +# We also signal whether Mac OS X >=10.9 (Mavericks) and Mac OS X >=10.11 # +# (El Capitan). # ############################################################################# # Set default Mac OS X version flags osx_lion=no +osx_mavericks=no osx_el_capitan=no # Set default compiler lists cxx_list="g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++" cc_list="gcc cc cl.exe clang" -# Check if we have Mac OS X >= 10.7 and >= 10.11 +# Check if we have Mac OS X >= 10.7, >= 10.9 and >= 10.11 if test `uname -s` = "Darwin"; then version=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/' | sed -e 's/\.//g'` if [ test $version -ge 107 ]; then @@ -119,6 +121,9 @@ if test `uname -s` = "Darwin"; then cc_list="clang gcc cc cl.exe" osx_lion=yes fi + if [ test $version -ge 109 ]; then + osx_mavericks=yes + fi if [ test $version -ge 1011 ]; then osx_el_capitan=yes fi @@ -129,6 +134,12 @@ if [test "x$osx_lion" = "xyes"]; then else AC_MSG_RESULT(no) fi +AC_MSG_CHECKING([for Mac OS X >= 10.9]) +if [test "x$osx_mavericks" = "xyes"]; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi AC_MSG_CHECKING([for Mac OS X >= 10.11]) if [test "x$osx_el_capitan" = "xyes"]; then AC_MSG_RESULT(yes) @@ -867,19 +878,15 @@ else # If we have distutils then get python path from distutils ... if test -z "$ac_distutils_result"; then - if test ${PYTHON_VERSION} '<' 3; then - python_path=`$PYTHON -c "import distutils.sysconfig; \ - print distutils.sysconfig.get_python_inc();"` - else - python_path=`$PYTHON -c "import distutils.sysconfig; \ - print(distutils.sysconfig.get_python_inc());"` - fi + + # Get Python path + python_path=`$PYTHON -c "import distutils.sysconfig; \ + print(distutils.sysconfig.get_python_inc());"` if test -n "${python_path}"; then AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"]) python_path="-I$python_path" fi PYTHON_CPPFLAGS=$python_path - #CPPFLAGS="${CPPFLAGS} ${python_path}" AC_SUBST([PYTHON_CPPFLAGS]) # ... otherwise check for includes relative to exectuable (obsolete?) @@ -895,9 +902,29 @@ else fi - # Signal missing Python headers - if test "x$has_python_h" = "xno"; then - AC_MSG_WARN([No Python header file "Python.h" found. Please install appropriate Python development package.]) + # If we have Mavericks then get the MACOSX_DEPLOYMENT_TARGET from Python + # If the target is older then Mavericks then set the MACOSX_DEPLOYMENT_TARGET + # to this value as otherwise we get trouble with name mangling (that changed) + if [test "x$osx_mavericks" = "xyes"]; then + AC_MSG_CHECKING([Python MACOSX_DEPLOYMENT_TARGET]) + python_target=`$PYTHON -c "from distutils import sysconfig; \ + print(sysconfig.get_config_vars()[['MACOSX_DEPLOYMENT_TARGET']]);" 2> /dev/null` + python_compact_target=`echo $python_target | sed 's/\(10\.[[0-9]]*\).*/\1/' | sed -e 's/\.//g'` + case $python_compact_target in + (*[!0-9]*|'') + AC_MSG_RESULT(unknown) + ;; + (*) + AC_MSG_RESULT(${python_target}) + if [ test $python_compact_target -le 108 ]; then + CONFIGURE_MACOSX_DEPLOYMENT_TARGET="$python_target" + MACOSX_DEPLOYMENT_TARGET="$python_target" + export MACOSX_DEPLOYMENT_TARGET + EXPORT_MACOSX_DEPLOYMENT_TARGET='' + AC_MSG_NOTICE([set MACOSX_DEPLOYMENT_TARGET to ${python_target}]) + fi + ;; + esac fi fi -- libgit2 0.21.4