Commit 92f7c1bd48d2476a3acabb9a0594829d6c847761
1 parent
7af7e0b5
Set the MACOSX_DEPLOYMENT_TARGET on Mac OS X >= 10.9 in case that the MACOSX_DEP…
…LOYMENT_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.
Showing
1 changed file
with
40 additions
and
13 deletions
configure.ac
| ... | ... | @@ -101,17 +101,19 @@ AC_CANONICAL_HOST |
| 101 | 101 | # A special kluge was added for Mac OS X >=10.7. As Apple switched to clang # |
| 102 | 102 | # we search from this version on for the clang compiler. # |
| 103 | 103 | # # |
| 104 | -# We also signal whether Mac OS X >=10.11 (El Capitan). # | |
| 104 | +# We also signal whether Mac OS X >=10.9 (Mavericks) and Mac OS X >=10.11 # | |
| 105 | +# (El Capitan). # | |
| 105 | 106 | ############################################################################# |
| 106 | 107 | # Set default Mac OS X version flags |
| 107 | 108 | osx_lion=no |
| 109 | +osx_mavericks=no | |
| 108 | 110 | osx_el_capitan=no |
| 109 | 111 | |
| 110 | 112 | # Set default compiler lists |
| 111 | 113 | cxx_list="g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++" |
| 112 | 114 | cc_list="gcc cc cl.exe clang" |
| 113 | 115 | |
| 114 | -# Check if we have Mac OS X >= 10.7 and >= 10.11 | |
| 116 | +# Check if we have Mac OS X >= 10.7, >= 10.9 and >= 10.11 | |
| 115 | 117 | if test `uname -s` = "Darwin"; then |
| 116 | 118 | version=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/' | sed -e 's/\.//g'` |
| 117 | 119 | if [ test $version -ge 107 ]; then |
| ... | ... | @@ -119,6 +121,9 @@ if test `uname -s` = "Darwin"; then |
| 119 | 121 | cc_list="clang gcc cc cl.exe" |
| 120 | 122 | osx_lion=yes |
| 121 | 123 | fi |
| 124 | + if [ test $version -ge 109 ]; then | |
| 125 | + osx_mavericks=yes | |
| 126 | + fi | |
| 122 | 127 | if [ test $version -ge 1011 ]; then |
| 123 | 128 | osx_el_capitan=yes |
| 124 | 129 | fi |
| ... | ... | @@ -129,6 +134,12 @@ if [test "x$osx_lion" = "xyes"]; then |
| 129 | 134 | else |
| 130 | 135 | AC_MSG_RESULT(no) |
| 131 | 136 | fi |
| 137 | +AC_MSG_CHECKING([for Mac OS X >= 10.9]) | |
| 138 | +if [test "x$osx_mavericks" = "xyes"]; then | |
| 139 | + AC_MSG_RESULT(yes) | |
| 140 | +else | |
| 141 | + AC_MSG_RESULT(no) | |
| 142 | +fi | |
| 132 | 143 | AC_MSG_CHECKING([for Mac OS X >= 10.11]) |
| 133 | 144 | if [test "x$osx_el_capitan" = "xyes"]; then |
| 134 | 145 | AC_MSG_RESULT(yes) |
| ... | ... | @@ -867,19 +878,15 @@ else |
| 867 | 878 | |
| 868 | 879 | # If we have distutils then get python path from distutils ... |
| 869 | 880 | if test -z "$ac_distutils_result"; then |
| 870 | - if test ${PYTHON_VERSION} '<' 3; then | |
| 871 | - python_path=`$PYTHON -c "import distutils.sysconfig; \ | |
| 872 | - print distutils.sysconfig.get_python_inc();"` | |
| 873 | - else | |
| 874 | - python_path=`$PYTHON -c "import distutils.sysconfig; \ | |
| 875 | - print(distutils.sysconfig.get_python_inc());"` | |
| 876 | - fi | |
| 881 | + | |
| 882 | + # Get Python path | |
| 883 | + python_path=`$PYTHON -c "import distutils.sysconfig; \ | |
| 884 | + print(distutils.sysconfig.get_python_inc());"` | |
| 877 | 885 | if test -n "${python_path}"; then |
| 878 | 886 | AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"]) |
| 879 | 887 | python_path="-I$python_path" |
| 880 | 888 | fi |
| 881 | 889 | PYTHON_CPPFLAGS=$python_path |
| 882 | - #CPPFLAGS="${CPPFLAGS} ${python_path}" | |
| 883 | 890 | AC_SUBST([PYTHON_CPPFLAGS]) |
| 884 | 891 | |
| 885 | 892 | # ... otherwise check for includes relative to exectuable (obsolete?) |
| ... | ... | @@ -895,9 +902,29 @@ else |
| 895 | 902 | |
| 896 | 903 | fi |
| 897 | 904 | |
| 898 | - # Signal missing Python headers | |
| 899 | - if test "x$has_python_h" = "xno"; then | |
| 900 | - AC_MSG_WARN([No Python header file "Python.h" found. Please install appropriate Python development package.]) | |
| 905 | + # If we have Mavericks then get the MACOSX_DEPLOYMENT_TARGET from Python | |
| 906 | + # If the target is older then Mavericks then set the MACOSX_DEPLOYMENT_TARGET | |
| 907 | + # to this value as otherwise we get trouble with name mangling (that changed) | |
| 908 | + if [test "x$osx_mavericks" = "xyes"]; then | |
| 909 | + AC_MSG_CHECKING([Python MACOSX_DEPLOYMENT_TARGET]) | |
| 910 | + python_target=`$PYTHON -c "from distutils import sysconfig; \ | |
| 911 | + print(sysconfig.get_config_vars()[['MACOSX_DEPLOYMENT_TARGET']]);" 2> /dev/null` | |
| 912 | + python_compact_target=`echo $python_target | sed 's/\(10\.[[0-9]]*\).*/\1/' | sed -e 's/\.//g'` | |
| 913 | + case $python_compact_target in | |
| 914 | + (*[!0-9]*|'') | |
| 915 | + AC_MSG_RESULT(unknown) | |
| 916 | + ;; | |
| 917 | + (*) | |
| 918 | + AC_MSG_RESULT(${python_target}) | |
| 919 | + if [ test $python_compact_target -le 108 ]; then | |
| 920 | + CONFIGURE_MACOSX_DEPLOYMENT_TARGET="$python_target" | |
| 921 | + MACOSX_DEPLOYMENT_TARGET="$python_target" | |
| 922 | + export MACOSX_DEPLOYMENT_TARGET | |
| 923 | + EXPORT_MACOSX_DEPLOYMENT_TARGET='' | |
| 924 | + AC_MSG_NOTICE([set MACOSX_DEPLOYMENT_TARGET to ${python_target}]) | |
| 925 | + fi | |
| 926 | + ;; | |
| 927 | + esac | |
| 901 | 928 | fi |
| 902 | 929 | |
| 903 | 930 | fi | ... | ... |