Commit c784745b0e118586be279ec0d73b855f3711739d
1 parent
1ae952bd
Add Mavericks check to set MACOSX_DEPLOYMENT_TARGET if Python has been compiled for an older target.
Showing
1 changed file
with
41 additions
and
10 deletions
configure.ac
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # Configuration for ctools - a set of tools for science analysis of CTA # | 2 | # Configuration for ctools - a set of tools for science analysis of CTA # |
| 3 | # data # | 3 | # data # |
| 4 | # ------------------------------------------------------------------------- # | 4 | # ------------------------------------------------------------------------- # |
| 5 | -# Copyright (C) 2011-2015 Juergen Knoedlseder # | 5 | +# Copyright (C) 2011-2016 Juergen Knoedlseder # |
| 6 | # ------------------------------------------------------------------------- # | 6 | # ------------------------------------------------------------------------- # |
| 7 | # # | 7 | # # |
| 8 | # This program is free software: you can redistribute it and/or modify # | 8 | # This program is free software: you can redistribute it and/or modify # |
| @@ -93,10 +93,12 @@ AC_CANONICAL_HOST | @@ -93,10 +93,12 @@ AC_CANONICAL_HOST | ||
| 93 | # A special kluge was added for Mac OS X >=10.7. As Apple switched to clang # | 93 | # A special kluge was added for Mac OS X >=10.7. As Apple switched to clang # |
| 94 | # we search from this version on for the clang compiler. # | 94 | # we search from this version on for the clang compiler. # |
| 95 | # # | 95 | # # |
| 96 | -# We also signal whether Mac OS X >=10.11 (El Capitan). # | 96 | +# We also signal whether Mac OS X >=10.9 (Mavericks) and Mac OS X >=10.11 # |
| 97 | +# (El Capitan). # | ||
| 97 | ############################################################################# | 98 | ############################################################################# |
| 98 | # Set default Mac OS X version flags | 99 | # Set default Mac OS X version flags |
| 99 | osx_lion=no | 100 | osx_lion=no |
| 101 | +osx_mavericks=no | ||
| 100 | osx_el_capitan=no | 102 | osx_el_capitan=no |
| 101 | 103 | ||
| 102 | # Set default compiler lists | 104 | # Set default compiler lists |
| @@ -111,6 +113,9 @@ if test `uname -s` = "Darwin"; then | @@ -111,6 +113,9 @@ if test `uname -s` = "Darwin"; then | ||
| 111 | cc_list="clang gcc cc cl.exe" | 113 | cc_list="clang gcc cc cl.exe" |
| 112 | osx_lion=yes | 114 | osx_lion=yes |
| 113 | fi | 115 | fi |
| 116 | + if [ test $version -ge 109 ]; then | ||
| 117 | + osx_mavericks=yes | ||
| 118 | + fi | ||
| 114 | if [ test $version -ge 1011 ]; then | 119 | if [ test $version -ge 1011 ]; then |
| 115 | osx_el_capitan=yes | 120 | osx_el_capitan=yes |
| 116 | fi | 121 | fi |
| @@ -121,6 +126,12 @@ if [test "x$osx_lion" = "xyes"]; then | @@ -121,6 +126,12 @@ if [test "x$osx_lion" = "xyes"]; then | ||
| 121 | else | 126 | else |
| 122 | AC_MSG_RESULT(no) | 127 | AC_MSG_RESULT(no) |
| 123 | fi | 128 | fi |
| 129 | +AC_MSG_CHECKING([for Mac OS X >= 10.9]) | ||
| 130 | +if [test "x$osx_mavericks" = "xyes"]; then | ||
| 131 | + AC_MSG_RESULT(yes) | ||
| 132 | +else | ||
| 133 | + AC_MSG_RESULT(no) | ||
| 134 | +fi | ||
| 124 | AC_MSG_CHECKING([for Mac OS X >= 10.11]) | 135 | AC_MSG_CHECKING([for Mac OS X >= 10.11]) |
| 125 | if [test "x$osx_el_capitan" = "xyes"]; then | 136 | if [test "x$osx_el_capitan" = "xyes"]; then |
| 126 | AC_MSG_RESULT(yes) | 137 | AC_MSG_RESULT(yes) |
| @@ -633,21 +644,41 @@ else | @@ -633,21 +644,41 @@ else | ||
| 633 | 644 | ||
| 634 | # If we have distutils then get python path from distutils ... | 645 | # If we have distutils then get python path from distutils ... |
| 635 | if test -z "$ac_distutils_result"; then | 646 | if test -z "$ac_distutils_result"; then |
| 636 | - if test ${PYTHON_VERSION} '<' 3; then | ||
| 637 | - python_path=`$PYTHON -c "import distutils.sysconfig; \ | ||
| 638 | - print distutils.sysconfig.get_python_inc();"` | ||
| 639 | - else | ||
| 640 | - python_path=`$PYTHON -c "import distutils.sysconfig; \ | ||
| 641 | - print(distutils.sysconfig.get_python_inc());"` | ||
| 642 | - fi | 647 | + python_path=`$PYTHON -c "import distutils.sysconfig; \ |
| 648 | + print(distutils.sysconfig.get_python_inc());"` | ||
| 643 | if test -n "${python_path}"; then | 649 | if test -n "${python_path}"; then |
| 644 | AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"]) | 650 | AC_CHECK_HEADERS($python_path/Python.h, [has_python_h="yes"], [has_python_h="no"]) |
| 645 | python_path="-I$python_path" | 651 | python_path="-I$python_path" |
| 646 | fi | 652 | fi |
| 647 | PYTHON_CPPFLAGS=$python_path | 653 | PYTHON_CPPFLAGS=$python_path |
| 648 | - CPPFLAGS="${CPPFLAGS} ${python_path}" | ||
| 649 | AC_SUBST([PYTHON_CPPFLAGS]) | 654 | AC_SUBST([PYTHON_CPPFLAGS]) |
| 650 | 655 | ||
| 656 | + # If we have Mavericks then get the MACOSX_DEPLOYMENT_TARGET from Python | ||
| 657 | + # If the target is older then Mavericks then set the MACOSX_DEPLOYMENT_TARGET | ||
| 658 | + # to this value as otherwise we get trouble with name mangling (that changed) | ||
| 659 | + if [test "x$osx_mavericks" = "xyes"]; then | ||
| 660 | + AC_MSG_CHECKING([Python MACOSX_DEPLOYMENT_TARGET]) | ||
| 661 | + python_target=`$PYTHON -c "from distutils import sysconfig; \ | ||
| 662 | + print(sysconfig.get_config_vars()[['MACOSX_DEPLOYMENT_TARGET']]);" 2> /dev/null` | ||
| 663 | + python_compact_target=`echo $python_target | sed 's/\(10\.[[0-9]]*\).*/\1/' | sed -e 's/\.//g'` | ||
| 664 | + case $python_compact_target in | ||
| 665 | + (*[!0-9]*|'') | ||
| 666 | + AC_MSG_RESULT(unknown) | ||
| 667 | + ;; | ||
| 668 | + (*) | ||
| 669 | + AC_MSG_RESULT(${python_target}) | ||
| 670 | + if [ test $python_compact_target -le 108 ]; then | ||
| 671 | + CONFIGURE_MACOSX_DEPLOYMENT_TARGET="$python_target" | ||
| 672 | + MACOSX_DEPLOYMENT_TARGET="$python_target" | ||
| 673 | + export MACOSX_DEPLOYMENT_TARGET | ||
| 674 | + EXPORT_MACOSX_DEPLOYMENT_TARGET='' | ||
| 675 | + LIBS="${LIBS} -lstdc++" | ||
| 676 | + AC_MSG_NOTICE([set MACOSX_DEPLOYMENT_TARGET to ${python_target}]) | ||
| 677 | + fi | ||
| 678 | + ;; | ||
| 679 | + esac | ||
| 680 | + fi | ||
| 681 | + | ||
| 651 | # ... otherwise check for includes relative to exectuable (obsolete?) | 682 | # ... otherwise check for includes relative to exectuable (obsolete?) |
| 652 | else | 683 | else |
| 653 | 684 |