Skip to content

Commit

Permalink
Trac #25208: Move configure-time checks for OSX/XCode compatibility t…
Browse files Browse the repository at this point in the history
…o a separate macro

Just a little further `configure.ac` cleanup.  This is a big chunk of
code that deserves to be centralized in one place if/when further
updates to it are needed.

URL: https://trac.sagemath.org/25208
Reported by: embray
Ticket author(s): Erik Bray
Reviewer(s): Frédéric Chapoton
  • Loading branch information
Release Manager authored and vbraun committed Aug 3, 2018
2 parents 081df3e + 13619ff commit 76e7245
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 66 deletions.
67 changes: 1 addition & 66 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -599,72 +599,7 @@ AS_IF([echo "$ac_pwd" |grep " " >/dev/null],
AC_MSG_ERROR([the path to the Sage root directory ($ac_pwd) contains a space. Sage will not build correctly in this case])
)


if test x`uname` = xDarwin; then
[
# Warning: xcodebuild does not seem to be maintained in Xcode 4.3
# or later, so do not rely on the variable XCODE_VERS with OS X
# 10.7 or later.
XCODE_VERS=`xcodebuild -version 2> /dev/null | grep Xcode | sed -e 's/[A-Za-z ]//g'`
if [ -z $XCODE_VERS ]; then
XCODE_VERS="2"
fi
XCODE_VERS_MAJOR=`echo $XCODE_VERS | cut '-d.' -f1`
DARWIN_VERSION=`uname -r | cut '-d.' -f1`
echo "***************************************************"
echo "***************************************************"
if [ $DARWIN_VERSION -gt 10 ]; then
echo "You are using OS X Lion (or later)."
echo "You are strongly advised to install Apple's latest Xcode"
echo "unless you already have it. You can install this using"
echo "the App Store. Also, make sure you install Xcode's"
echo "Command Line Tools -- see Sage's README.txt."
elif [ $XCODE_VERS_MAJOR -gt 2 ]; then
echo "You are using Xcode version $XCODE_VERS."
echo "You are strongly advised to install Apple's latest Xcode"
echo "unless you already have it. You can download this from"
echo "http://developer.apple.com/downloads/."
echo "If using Xcode 4.3 or later, make sure you install Xcode's"
echo "Command Line Tools -- see Sage's README.txt."
else
echo "You are using Xcode version 1 or 2"
echo "WARNING: You are strongly advised to install the"
echo "latest version of Apple's Xcode for your platform,"
echo "unless you already have it."
if [ $DARWIN_VERSION -eq 10 ]; then
echo "Probably you need Xcode 3.2.6"
elif [ $DARWIN_VERSION -eq 9 ]; then
echo "Probably you need Xcode 3.1.4"
elif [ $DARWIN_VERSION -lt 9 ]; then
echo "Probably you need Xcode 2.5"
fi
fi
]

###########################################################################
# (OS X only)
# Sage will probably not build at all if either Fink or MacPorts can be
# found, and the error messages can be extremely confusing. Even if it does
# build, the product will probably be wrong. This runs a basic check to
# find them. Once the Sage build process is perfected, this won't be necessary.
# dphilp 15/9/2008
###########################################################################
PORTS_PATH=`which port`
if test -f "$PORTS_PATH"; then
AC_MSG_ERROR([["found MacPorts in $PORTS_PATH. Either:
(1) rename /opt/local and /sw, or
(2) change PATH and DYLD_LIBRARY_PATH
(Once Sage is built, you can restore them.)]])
fi

FINK_PATH=`which fink`
if test -f "$FINK_PATH"; then
AC_MSG_ERROR([["found Fink in $FINK_PATH. Either:
(1) rename /opt/local and /sw, or
(2) change PATH and DYLD_LIBRARY_PATH
(Once Sage is built, you can restore them.)]])
fi
fi
SAGE_CHECK_OSX_SUPPORTED()

# if GCC needs to be installed GFORTRAN shouldn't be installed.
# if GCC is already installed GFORTRAN shouldn't be installed either.
Expand Down
70 changes: 70 additions & 0 deletions m4/sage_check_osx_supported.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
AC_DEFUN([SAGE_CHECK_OSX_SUPPORTED], [
AC_REQUIRE([AC_CANONICAL_HOST])
AS_CASE([$host],
[*-apple-darwin*], [
# Warning: xcodebuild does not seem to be maintained in Xcode 4.3
# or later, so do not rely on the variable XCODE_VERS with OS X
# 10.7 or later.
changequote(<,>)
XCODE_VERS=`xcodebuild -version 2> /dev/null | grep Xcode | sed -e 's/[A-Za-z ]//g'`
changequote([,])
if test -z $XCODE_VERS; then
XCODE_VERS="2"
fi
XCODE_VERS_MAJOR=`echo $XCODE_VERS | cut '-d.' -f1`
DARWIN_VERSION=`uname -r | cut '-d.' -f1`
echo "***************************************************"
echo "***************************************************"
if test $DARWIN_VERSION -gt 10; then
echo "You are using OS X Lion (or later)."
echo "You are strongly advised to install Apple's latest Xcode"
echo "unless you already have it. You can install this using"
echo "the App Store. Also, make sure you install Xcode's"
echo "Command Line Tools -- see Sage's README.txt."
elif test $XCODE_VERS_MAJOR -gt 2; then
echo "You are using Xcode version $XCODE_VERS."
echo "You are strongly advised to install Apple's latest Xcode"
echo "unless you already have it. You can download this from"
echo "http://developer.apple.com/downloads/."
echo "If using Xcode 4.3 or later, make sure you install Xcode's"
echo "Command Line Tools -- see Sage's README.txt."
else
echo "You are using Xcode version 1 or 2"
echo "WARNING: You are strongly advised to install the"
echo "latest version of Apple's Xcode for your platform,"
echo "unless you already have it."
if test $DARWIN_VERSION -eq 10; then
echo "Probably you need Xcode 3.2.6"
elif test $DARWIN_VERSION -eq 9; then
echo "Probably you need Xcode 3.1.4"
elif test $DARWIN_VERSION -lt 9; then
echo "Probably you need Xcode 2.5"
fi
fi
#######################################################################
# (OS X only)
# Sage will probably not build at all if either Fink or MacPorts can be
# found, and the error messages can be extremely confusing. Even if it
# does build, the product will probably be wrong. This runs a basic
# check to find them. Once the Sage build process is perfected, this
# won't be necessary.
# dphilp 15/9/2008
#######################################################################
PORTS_PATH=`which port`
if test -f "$PORTS_PATH"; then
AC_MSG_ERROR(["found MacPorts in $PORTS_PATH. Either:
(1) rename /opt/local and /sw, or
(2) change PATH and DYLD_LIBRARY_PATH
(Once Sage is built, you can restore them.)])
fi
FINK_PATH=`which fink`
if test -f "$FINK_PATH"; then
AC_MSG_ERROR(["found Fink in $FINK_PATH. Either:
(1) rename /opt/local and /sw, or
(2) change PATH and DYLD_LIBRARY_PATH
(Once Sage is built, you can restore them.)])
fi
])
])

0 comments on commit 76e7245

Please sign in to comment.