From c784745b0e118586be279ec0d73b855f3711739d Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Wed, 6 Jan 2016 01:08:38 +0100 Subject: [PATCH] Add Mavericks check to set MACOSX_DEPLOYMENT_TARGET if Python has been compiled for an older target. --- configure.ac | 51 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 417989d..8d2ec55 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Configuration for ctools - a set of tools for science analysis of CTA # # data # # ------------------------------------------------------------------------- # -# Copyright (C) 2011-2015 Juergen Knoedlseder # +# Copyright (C) 2011-2016 Juergen Knoedlseder # # ------------------------------------------------------------------------- # # # # This program is free software: you can redistribute it and/or modify # @@ -93,10 +93,12 @@ 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 @@ -111,6 +113,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 @@ -121,6 +126,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) @@ -633,21 +644,41 @@ 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 + 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]) + # 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='' + LIBS="${LIBS} -lstdc++" + AC_MSG_NOTICE([set MACOSX_DEPLOYMENT_TARGET to ${python_target}]) + fi + ;; + esac + fi + # ... otherwise check for includes relative to exectuable (obsolete?) else -- libgit2 0.21.4