Ticket #11280: trac_11280_xcode4unsupported.patch

File trac_11280_xcode4unsupported.patch, 35.2 KB (added by dimpase, 10 years ago)

export with --git to record file permissions

  • deleted file prereq-0.8-install

    # HG changeset patch
    # User Dmitrii Pasechnik <dimpase@gmail.com>
    # Date 1304703930 -28800
    # Node ID 134cfa38c45a617041fad20bbe22194cb1dcff1b
    # Parent  571cf65be6a6083bd1cc6068705cde2db3282af0
    moved!
    
    diff --git a/prereq-0.8-install b/prereq-0.8-install
    deleted file mode 100755
    + -  
    1 #!/bin/sh
    2 ###########################################
    3 ## Check for prerequisite programs
    4 ###########################################
    5 
    6 
    7 BUILD=build
    8 ROOT=`pwd`
    9 LOCAL="$ROOT/../local"
    10 TARGET=prereq-0.8
    11 
    12 cd $BUILD
    13 
    14 echo "Starting prerequisite check."
    15 echo "Machine: `uname -a`"
    16 
    17 if [ "$SAGE_PORT" = "" ]; then
    18     if [ `uname | sed -e 's/WIN.\+/WIN/'` = "CYGWIN" ]; then
    19         echo "Unfortunately, building SAGE on Cygwin is not currently supported,"
    20         echo "though we are actively working on supporting it.  If you would like"
    21         echo "to help with the porting effort, please post to"
    22         echo ""
    23         echo "   http://groups.google.com/group/sage-windows"
    24         echo ""
    25         echo "Also, see http://trac.sagemath.org/sage_trac/ticket/6743"
    26         echo "In the meantime, to run Sage on Windows, please use"
    27         echo "a virtualization solution instead, such as VirtualBox"
    28         echo ""
    29         echo "To get past this message, export the variable 'SAGE_PORT' to"
    30         echo "something non-empty."
    31         exit 1
    32     elif [ `uname` = "SunOS" ]; then
    33        if [ "x`uname -r`" = "x5.9" ] ||  [ "x`uname -r`" = "x5.8" ] || [ "x`uname -r`" = "x5.7" ] ||  [ "x`uname -r`" = "x5.6" ] ; then
    34           echo "Sage is not supported on any version of Solaris earlier than 10."
    35           echo "Sage has been tested on the first release of Solaris 10"
    36           echo "(03/2005) and works on that. Sage may or may not work with"
    37           echo "your version of Solaris."
    38           echo ""
    39           echo "More information can be found about Sage on Solaris"
    40           echo "on the Wiki at http://wiki.sagemath.org/solaris"
    41           echo ""
    42           echo "To get past this message, export the variable SAGE_PORT to"
    43           echo "something non-empty."
    44           exit 1
    45        fi
    46     elif [ "x`uname`" = "xHP-UX" ]; then
    47         echo "You are attempting to build Sage on HP's HP-UX operating system,"
    48         echo "which is not a supported platform for Sage yet though"
    49         echo "some work has been done on HP-UX. A port does not look to"
    50         echo "be particularly difficult. Some information can be"
    51         echo "found on the Sage Wiki at http://wiki.sagemath.org/HP-UX"
    52         echo ""
    53         echo "If you would like to help port Sage to HP-UX,"
    54         echo "please join the sage-devel discussion list - see"
    55         echo "http://groups.google.com/group/sage-devel"
    56         echo "The Sage community would also appreciate any patches you submit."
    57         echo ""
    58         echo "To get past this message, export the variable SAGE_PORT to"
    59         echo "something non-empty."
    60         exit 1
    61     elif [ "x`uname`" = "xAIX" ]; then
    62         echo "You are attempting to build Sage on IBM's AIX operating system,"
    63         echo "which is not a supported platform for Sage yet. Things may or"
    64         echo "may not work. If you would like to help port Sage to AIX,"
    65         echo "please join the sage-devel discussion list - see"
    66         echo "http://groups.google.com/group/sage-devel"
    67         echo "The Sage community would also appreciate any patches you submit."
    68         echo ""
    69         echo "To get past this message, export the variable SAGE_PORT to"
    70         echo "something non-empty."
    71         exit 1
    72     elif [ "x`uname`" = "xIRIX" ] ||  [ "x`uname`" = "xIRIX64"  ]; then
    73         echo "You are attempting to build Sage on SGI's IRIX operating system,"
    74         echo "which is not a supported platform for Sage yet. Things may or"
    75         echo "may not work. If you would like to help port Sage to IRIX,"
    76         echo "please join the sage-devel discussion list - see"
    77         echo "http://groups.google.com/group/sage-devel"
    78         echo "The Sage community would also appreciate any patches you submit."
    79         echo ""
    80         echo "To get past this message, export the variable SAGE_PORT to"
    81         echo "something non-empty."
    82         exit 1
    83     elif [ "x`uname`" = "xTru64" ]; then
    84         echo "You are attempting to build Sage on HP's Tru64 operating system,"
    85         echo "which is not a supported platform for Sage yet. Things may or"
    86         echo "may not work. If you would like to help port Sage to Tru64,"
    87         echo "please join the sage-devel discussion list - see"
    88         echo "http://groups.google.com/group/sage-devel"
    89         echo "The Sage community would also appreciate any patches you submit."
    90         echo ""
    91         echo "To get past this message, export the variable SAGE_PORT to"
    92         echo "something non-empty."
    93         exit 1
    94     elif [ "x`uname`" = "xFreeBSD" ]; then
    95         echo "You are attempting to build Sage on the FreeBSD operating system,"
    96         echo "which is not a supported platform for Sage yet, though"
    97         echo "developers are working on adding FreeBSD support. Things may or"
    98         echo "may not work. If you would like to help port Sage to FreeBSD,"
    99         echo "please join the sage-devel discussion list - see"
    100         echo "http://groups.google.com/group/sage-devel"
    101         echo "The Sage community would also appreciate any patches you submit."
    102         echo ""
    103         echo "To get past this message, export the variable SAGE_PORT to"
    104         echo "something non-empty."
    105         exit 1
    106     elif [ "x`uname`" != "xSunOS" ] && [ "x`uname`" != "xDarwin" ] && [ "x`uname`" != "xLinux" ]; then
    107         echo "You are attempting to build Sage on `uname`,"
    108         echo "which is not a supported platform for Sage yet. Things may or"
    109         echo "may not work. If you would like to help port Sage to `uname`,"
    110         echo "please join the sage-devel discussion list - see"
    111         echo "http://groups.google.com/group/sage-devel"
    112         echo "The Sage community would also appreciate any patches you submit."
    113         echo ""
    114         echo "To get past this message, export the variable SAGE_PORT to"
    115         echo "something non-empty."
    116         exit 1
    117     fi
    118 fi
    119 
    120 
    121 if [ "x`uname`" = "xSunOS" ] && [ "x`uname -r`" = "x5.9" ]; then
    122     echo "WARNING: Building Sage is not supported on Solaris 9"
    123     echo "but it might work, so the build will continue"
    124     echo "Solaris 9: copying work around stdint.h"
    125     cp $SAGE_ROOT/spkg/base/stdint.h_Solaris9 $SAGE_LOCAL/include/stdint.h
    126 fi
    127 
    128 if [ "x`uname`" = "xSunOS" ] && [ "x`uname -r`" = "x5.8" ]; then
    129     echo "WARNING: Building Sage is not supported on Solaris 8"
    130     echo "but it might work, so the build will continue"
    131     echo "Solaris 8: copying work around stdint.h"
    132     cp $SAGE_ROOT/spkg/base/stdint.h_Solaris9 $SAGE_LOCAL/include/stdint.h
    133 fi
    134 
    135 if [ "x`uname`" = "xDarwin" ] && [ "x$SAGE64" = "xyes" ]; then
    136     echo "64-bit OS X build"
    137     SAGE_OPT="-O2 -g -m64 " && export SAGE_OPT
    138 fi
    139 
    140 # From Kate Minola kate01123@gmail.com
    141 # On my powerpc-Darwin machine with csh as my shell, when I attempt
    142 # to build SAGE in the background (i.e., "make &") the build
    143 # stops when executing 'prereq-0.2-install'.  The reason is
    144 # that the line
    145 #     which $1 > /dev/null
    146 # issues a SIGTTOU signal (background process attempting to write
    147 # to tty).  Solution:
    148 trap '' TTOU
    149 
    150 # A reasonably sophisticated test is performed in a configure
    151 # script, which checks compilers exist, their version numbers,
    152 # the fact GNU and non-GNU compilers are not mixed etc.
    153 
    154 tar mxvf "../base/$TARGET.tar"
    155 cd "$TARGET"
    156 
    157 ./configure
    158 
    159 if [ $? -ne 0 ]; then
    160     echo " ERROR: You do not have all of the prerequisites needed"
    161     echo " to build Sage from source.  See the errors above."
    162     exit 1
    163 fi
    164 
    165 echo `pwd` | grep " "
    166 
    167 if [ $? -eq 0 ]; then
    168     echo ""
    169     echo "*********************************************************"
    170     echo ""
    171     echo " ERROR: Sage will (probably) not build correctly if there is a space"
    172     echo " in the path to the current directory."
    173     echo ""
    174     echo " Path = `pwd`"
    175     echo ""
    176     echo "*********************************************************"
    177     exit 1
    178 fi
    179 
    180 
    181 ###########################################################################
    182 # (OS X only)
    183 # Sage will probably not build at all if either Fink or MacPorts can be
    184 # found, and the error messages can be extremely confusing.  Even if it does
    185 # build, the product will probably be wrong.  This runs a basic check to
    186 # find them. Once the Sage build process is perfected, this won't be necessary.
    187 # dphilp 15/9/2008
    188 ###########################################################################
    189 
    190 if [ `uname` = "Darwin" ]; then
    191     echo "***************************************************"
    192     echo "***************************************************"
    193     echo "***************************************************"
    194     echo "WARNING: You are strongly advised to install Apple's latest XCode unless"
    195     echo "you already have it. You can download this from "
    196     echo "http://developer.apple.com/TOOLS/Xcode/"
    197     echo "***************************************************"
    198     echo "***************************************************"
    199     echo "***************************************************"
    200     SAGE_ABORT=no
    201     # Try to find ports automatically.
    202     PORTS_PATH=`which port`
    203     if [ -f "`which port`" ]; then
    204         echo "Found MacPorts in " $PORTS_PATH
    205         SAGE_ABORT="yes"; export SAGE_ABORT
    206     fi
    207 
    208     # Try to find fink automatically.
    209     FINK_PATH=`which fink`
    210     if [ -f "`which fink`" ]; then
    211         echo "Found Fink in " $FINK_PATH
    212         SAGE_ABORT="yes"; export SAGE_ABORT
    213     fi
    214 
    215     if [ "$SAGE_ABORT" = "yes" ]; then
    216         echo ""
    217         echo "*********************************************************"
    218         echo ""
    219         echo "Found either MacPorts or Fink in your PATH, which potentially wrecks the Sage build process."
    220         if [ "$SAGE_COMPILE_DESPITE_PORTS_AND_FINK" ]; then
    221             echo "Continuing because SAGE_COMPILE_DESPITE_PORTS_AND_FINK is set."
    222             echo ""
    223             echo "*********************************************************"
    224             echo ""
    225         else
    226             echo "You should make sure MacPorts and Fink cannot be found.  Either:"
    227             echo "(1) rename /opt/local and /sw, or"
    228             echo "(2) change PATH and DYLD_LIBRARY_PATH"
    229             echo "(Once Sage is built, you can restore them.)"
    230             echo ""
    231             echo "*********************************************************"
    232             echo ""
    233             exit 1
    234         fi
    235     fi
    236 fi
    237 
    238 # Solaris only
    239 # Sun's 'tar' and 'make' are unsuitable for building Sage.
    240 # So check on Solaris systems that the GNU versions are used.
    241 # One issue, which still remains and will make a build non-trivial
    242 # on Solaris is the fact that the first linker and assembler
    243 # in the path must be the ones used by gcc if the user is using gcc
    244 # to compile Sage. This is not addressed in this version of 'prereq'
    245 # but will in a later one.
    246 
    247 if [ `uname` = "SunOS" ] ; then
    248    if [ -z "`tar --version 2>&1 | grep GNU`" ] ; then
    249       echo ""
    250       echo "ERROR **********************************************"
    251       echo "ERROR **********************************************"
    252       echo "You MUST also use the GNU version of tar, as some parts"
    253       echo "of the Sage source code are compressed tar files, which"
    254       echo "were compressed with GNU tar. GNU tar does not produce"
    255       echo "POSIX compliant tar files unless called with the --posix"
    256       echo "option, so can not always be extracted with Sun's tar."
    257       echo ""
    258       echo ""
    259       echo "Therefore, to build Sage on Solaris you MUST have"
    260       echo "the GNU version of tar in your path before the Sun version"
    261       echo ""
    262       if [ -f "/usr/sfw/bin/gtar" ]  && [ -f "/usr/sfw/bin/gmake" ] ; then
    263           echo "There is a copy of GNU tar, but renamed to 'gtar' in"
    264           echo "the directory /usr/sfw/bin. It is suggested that you copy"
    265           echo "/usr/sfw/bin/gtar to a different directory, renaming it" 
    266           echo "'tar' instead of gtar. Then ensure that directory is in"
    267           echo "you path before /usr/bin, so whenever you type 'tar' you"
    268           echo "run the GNU version, and not the Sun version of tar."
    269           echo ""
    270           echo "Due to some GNUisms, the same applies with 'make'"
    271           echo ""
    272           echo "Executing something like"
    273           echo ""
    274           echo "$ mkdir \$HOME/bins-for-sage"
    275           echo "$ cp /usr/sfw/bin/gmake \$HOME/bins-for-sage/make"
    276           echo "$ cp /usr/sfw/bin/gtar \$HOME/bins-for-sage/tar"
    277           echo "$ export PATH=\$HOME/bins-for-sage:\$PATH"
    278           echo ""
    279           echo "will put the GNU versions of 'tar' and 'make' in your path"   
    280           echo "before the Sun versions"
    281           echo ""
    282           echo "If you type 'tar --version' it should be obvious whether"
    283           echo "the GNU version of 'tar' is first in your path or not"
    284           echo ""
    285           echo "If you type  'make --version' is should be obvious whether"
    286           echo "the GNU version of 'make' is first in your path or not"
    287           echo ""
    288       fi
    289       exit 1
    290    fi
    291    if [ -z "`make --version 2>&1 | grep GNU`" ] ; then
    292       echo "Due to numerous GNUisms, you MUST use the GNU version of 'make'"
    293       echo "to build Sage on Solaris - Sun's version will not work."
    294       echo ""
    295       if [ -f "/usr/sfw/bin/gtar" ]  && [ -f "/usr/sfw/bin/gmake" ] ; then
    296          echo "There is a copy of GNU 'make', but renamed to 'gmake' in"
    297          echo "the directory /usr/sfw/bin. It is suggested that you copy"
    298          echo "/usr/sfw/bin/gmake to a different directory, renaming it" 
    299          echo "'make' instead of gmake. Then ensure that directory is in"
    300          echo "you path before /usr/ccs/bin, so whenever you type 'make' you"
    301          echo "run the GNU version, and not the Sun version of make."
    302          echo ""
    303          echo "You MUST also use the GNU version of tar, as some parts"
    304          echo "of the Sage source code are compressed tar files, which"
    305          echo "were compressed with GNU tar. GNU tar does not produce"
    306          echo "POSIX compliant tar files unless called with the --posix"
    307          echo "option, so can not always be extracted with Sun's tar."
    308          echo ""
    309          echo "Executing something like"
    310          echo "$ mkdir \$HOME/bins-for-sage"
    311          echo "$ cp /usr/sfw/bin/gmake \$HOME/bins-for-sage/make"
    312          echo "$ cp /usr/sfw/bin/gtar \$HOME/bins-for-sage/tar"
    313          echo "$ export PATH=\$HOME/bins-for-sage:\$PATH"
    314          echo "will put the GNU versions of 'tar' and 'make' in your path"   
    315          echo "before the Sun versions"
    316          echo ""
    317          echo "If you type 'make --version' it should be obvious whether"
    318          echo "the GNU version of 'make' is first in your path or not"
    319          echo ""
    320          echo "If you type  'tar --version' is should be obvious whether"
    321          echo "the GNU version of 'tar' is first in your path or not"
    322          echo ""
    323       else
    324          echo "You can either compile GNU make from source, or it may be"
    325          echo "obtained from Blastwave or Sunfreeware.com"
    326          echo ""
    327          echo "On Open Solaris, some GNU tools can be found at /usr/gnu"
    328          echo "although at the time of writing, this directory did not contain"
    329          echo "make or tar, but you might try looking there."
    330       fi
    331       exit 1
    332    fi
    333 fi
    334 
    335 # Test for GNU versions of tar and make on AIX, HP-UX, IRIX and Tru64
    336 # Unlike on Solaris, no help is given about where to find the GNU
    337 # versions, as I've not used a sufficient number of these machines
    338 # to know where to find the GNU tools. The tests for operating system
    339 # are split across two lines, as it's unwise to make more than 4 test.
    340 # The split shown seemed the most natural, with making the
    341 # IRIX and IRIX64 tests on a line of their own. David Kirkby January 2010
    342 
    343 if [ -z "`tar --version 2>&1 | grep GNU`" ] ; then
    344    if [ "x`uname`" = "xHP-UX" ] ||  [ "x`uname`" = "xAIX" ] ||   [ "x`uname`" = "Tru64" ] ; then
    345        echo ""
    346        echo "You must use the GNU version of tar on `uname` Please"
    347        echo "ensure that a GNU version of tar is first in your path"
    348        exit 1
    349    elif [ "x`uname`" = "xIRIX" ] ||  [ "x`uname`" = "xIRIX64" ] ; then
    350        echo ""
    351        echo "You must use the GNU version of tar on IRIX. Please"
    352        echo "ensure that a GNU version of tar is first in your path"
    353        exit 1
    354    fi
    355 fi
    356 
    357 
    358 if [ -z "`make --version 2>&1 | grep GNU`" ] ; then
    359    if [ "x`uname`" = "xHP-UX" ] ||  [ "x`uname`" = "xAIX" ] ||   [ "x`uname`" = "xTru64" ] ; then
    360        echo ""
    361        echo "You must use the GNU version of make on `uname` Please"
    362        echo "ensure that a GNU version of make is first in your path"
    363        exit 1
    364    elif [ "x`uname`" = "xIRIX" ] ||  [ "x`uname`" = "xIRIX64" ] ; then
    365        echo ""
    366        echo "You must use the GNU version of make on IRIX. Please"
    367        echo "ensure that a GNU version of make is first in your path"
    368        exit 1
    369    fi
    370 fi
    371 
    372 
    373 touch $ROOT/installed/$TARGET
    374 
  • new file prereq-0.9-install

    diff --git a/prereq-0.9-install b/prereq-0.9-install
    new file mode 100755
    - +  
     1#!/bin/sh
     2###########################################
     3## Check for prerequisite programs
     4###########################################
     5
     6
     7BUILD=build
     8ROOT=`pwd`
     9LOCAL="$ROOT/../local"
     10TARGET=prereq-0.9
     11
     12cd $BUILD
     13
     14echo "Starting prerequisite check."
     15echo "Machine: `uname -a`"
     16
     17if [ "$SAGE_PORT" = "" ]; then
     18    if [ `uname | sed -e 's/WIN.\+/WIN/'` = "CYGWIN" ]; then
     19        echo "Unfortunately, building SAGE on Cygwin is not currently supported,"
     20        echo "though we are actively working on supporting it.  If you would like"
     21        echo "to help with the porting effort, please post to"
     22        echo ""
     23        echo "   http://groups.google.com/group/sage-windows"
     24        echo ""
     25        echo "Also, see http://trac.sagemath.org/sage_trac/ticket/6743"
     26        echo "In the meantime, to run Sage on Windows, please use"
     27        echo "a virtualization solution instead, such as VirtualBox"
     28        echo ""
     29        echo "To get past this message, export the variable 'SAGE_PORT' to"
     30        echo "something non-empty."
     31        exit 1
     32    elif [ `uname` = "SunOS" ]; then
     33       if [ "x`uname -r`" = "x5.9" ] ||  [ "x`uname -r`" = "x5.8" ] || [ "x`uname -r`" = "x5.7" ] ||  [ "x`uname -r`" = "x5.6" ] ; then
     34          echo "Sage is not supported on any version of Solaris earlier than 10."
     35          echo "Sage has been tested on the first release of Solaris 10"
     36          echo "(03/2005) and works on that. Sage may or may not work with"
     37          echo "your version of Solaris."
     38          echo ""
     39          echo "More information can be found about Sage on Solaris"
     40          echo "on the Wiki at http://wiki.sagemath.org/solaris"
     41          echo ""
     42          echo "To get past this message, export the variable SAGE_PORT to"
     43          echo "something non-empty."
     44          exit 1
     45       fi
     46    elif [ "x`uname`" = "xHP-UX" ]; then
     47        echo "You are attempting to build Sage on HP's HP-UX operating system,"
     48        echo "which is not a supported platform for Sage yet though"
     49        echo "some work has been done on HP-UX. A port does not look to"
     50        echo "be particularly difficult. Some information can be"
     51        echo "found on the Sage Wiki at http://wiki.sagemath.org/HP-UX"
     52        echo ""
     53        echo "If you would like to help port Sage to HP-UX,"
     54        echo "please join the sage-devel discussion list - see"
     55        echo "http://groups.google.com/group/sage-devel"
     56        echo "The Sage community would also appreciate any patches you submit."
     57        echo ""
     58        echo "To get past this message, export the variable SAGE_PORT to"
     59        echo "something non-empty."
     60        exit 1
     61    elif [ "x`uname`" = "xAIX" ]; then
     62        echo "You are attempting to build Sage on IBM's AIX operating system,"
     63        echo "which is not a supported platform for Sage yet. Things may or"
     64        echo "may not work. If you would like to help port Sage to AIX,"
     65        echo "please join the sage-devel discussion list - see"
     66        echo "http://groups.google.com/group/sage-devel"
     67        echo "The Sage community would also appreciate any patches you submit."
     68        echo ""
     69        echo "To get past this message, export the variable SAGE_PORT to"
     70        echo "something non-empty."
     71        exit 1
     72    elif [ "x`uname`" = "xIRIX" ] ||  [ "x`uname`" = "xIRIX64"  ]; then
     73        echo "You are attempting to build Sage on SGI's IRIX operating system,"
     74        echo "which is not a supported platform for Sage yet. Things may or"
     75        echo "may not work. If you would like to help port Sage to IRIX,"
     76        echo "please join the sage-devel discussion list - see"
     77        echo "http://groups.google.com/group/sage-devel"
     78        echo "The Sage community would also appreciate any patches you submit."
     79        echo ""
     80        echo "To get past this message, export the variable SAGE_PORT to"
     81        echo "something non-empty."
     82        exit 1
     83    elif [ "x`uname`" = "xTru64" ]; then
     84        echo "You are attempting to build Sage on HP's Tru64 operating system,"
     85        echo "which is not a supported platform for Sage yet. Things may or"
     86        echo "may not work. If you would like to help port Sage to Tru64,"
     87        echo "please join the sage-devel discussion list - see"
     88        echo "http://groups.google.com/group/sage-devel"
     89        echo "The Sage community would also appreciate any patches you submit."
     90        echo ""
     91        echo "To get past this message, export the variable SAGE_PORT to"
     92        echo "something non-empty."
     93        exit 1
     94    elif [ "x`uname`" = "xFreeBSD" ]; then
     95        echo "You are attempting to build Sage on the FreeBSD operating system,"
     96        echo "which is not a supported platform for Sage yet, though"
     97        echo "developers are working on adding FreeBSD support. Things may or"
     98        echo "may not work. If you would like to help port Sage to FreeBSD,"
     99        echo "please join the sage-devel discussion list - see"
     100        echo "http://groups.google.com/group/sage-devel"
     101        echo "The Sage community would also appreciate any patches you submit."
     102        echo ""
     103        echo "To get past this message, export the variable SAGE_PORT to"
     104        echo "something non-empty."
     105        exit 1
     106    elif [ "x`uname`" != "xSunOS" ] && [ "x`uname`" != "xDarwin" ] && [ "x`uname`" != "xLinux" ]; then
     107        echo "You are attempting to build Sage on `uname`,"
     108        echo "which is not a supported platform for Sage yet. Things may or"
     109        echo "may not work. If you would like to help port Sage to `uname`,"
     110        echo "please join the sage-devel discussion list - see"
     111        echo "http://groups.google.com/group/sage-devel"
     112        echo "The Sage community would also appreciate any patches you submit."
     113        echo ""
     114        echo "To get past this message, export the variable SAGE_PORT to"
     115        echo "something non-empty."
     116        exit 1
     117    fi
     118fi
     119
     120
     121if [ "x`uname`" = "xSunOS" ] && [ "x`uname -r`" = "x5.9" ]; then
     122    echo "WARNING: Building Sage is not supported on Solaris 9"
     123    echo "but it might work, so the build will continue"
     124    echo "Solaris 9: copying work around stdint.h"
     125    cp $SAGE_ROOT/spkg/base/stdint.h_Solaris9 $SAGE_LOCAL/include/stdint.h
     126fi
     127
     128if [ "x`uname`" = "xSunOS" ] && [ "x`uname -r`" = "x5.8" ]; then
     129    echo "WARNING: Building Sage is not supported on Solaris 8"
     130    echo "but it might work, so the build will continue"
     131    echo "Solaris 8: copying work around stdint.h"
     132    cp $SAGE_ROOT/spkg/base/stdint.h_Solaris9 $SAGE_LOCAL/include/stdint.h
     133fi
     134
     135if [ "x`uname`" = "xDarwin" ] && [ "x$SAGE64" = "xyes" ]; then
     136    echo "64-bit OS X build"
     137    SAGE_OPT="-O2 -g -m64 " && export SAGE_OPT
     138fi
     139
     140# From Kate Minola kate01123@gmail.com
     141# On my powerpc-Darwin machine with csh as my shell, when I attempt
     142# to build SAGE in the background (i.e., "make &") the build
     143# stops when executing 'prereq-0.2-install'.  The reason is
     144# that the line
     145#     which $1 > /dev/null
     146# issues a SIGTTOU signal (background process attempting to write
     147# to tty).  Solution:
     148trap '' TTOU
     149
     150# A reasonably sophisticated test is performed in a configure
     151# script, which checks compilers exist, their version numbers,
     152# the fact GNU and non-GNU compilers are not mixed etc.
     153
     154tar xvf "../base/$TARGET.tar"
     155cd "$TARGET"
     156
     157./configure
     158
     159if [ $? -ne 0 ]; then
     160    echo " ERROR: You do not have all of the prerequisites needed"
     161    echo " to build Sage from source.  See the errors above."
     162    exit 1
     163fi
     164
     165echo `pwd` | grep " "
     166
     167if [ $? -eq 0 ]; then
     168    echo ""
     169    echo "*********************************************************"
     170    echo ""
     171    echo " ERROR: Sage will (probably) not build correctly if there is a space"
     172    echo " in the path to the current directory."
     173    echo ""
     174    echo " Path = `pwd`"
     175    echo ""
     176    echo "*********************************************************"
     177    exit 1
     178fi
     179
     180
     181###########################################################################
     182# (OS X only)
     183# Sage will probably not build at all if either Fink or MacPorts can be
     184# found, and the error messages can be extremely confusing.  Even if it does
     185# build, the product will probably be wrong.  This runs a basic check to
     186# find them. Once the Sage build process is perfected, this won't be necessary.
     187# dphilp 15/9/2008
     188###########################################################################
     189
     190if [ `uname` = "Darwin" ]; then
     191    XCODE_VERS=`xcodebuild -version | grep Xcode | sed -e 's/[A-Za-z ]//g'`
     192    if [ -z $XCODE_VERS ]; then
     193        XCODE_VERS="2"
     194    fi
     195    XCODE_VERS_MAJOR=`echo $XCODE_VERS | cut '-d.' -f1`
     196    DARWIN_VERSION=`uname -r | cut '-d.' -f1`
     197    echo "***************************************************"
     198    echo "***************************************************"
     199    if [ $XCODE_VERS_MAJOR -gt 2 ]; then
     200        echo "You are using XCode version " $XCODE_VERS
     201        echo "WARNING: You are strongly advised to install Apple's latest XCode 3,"
     202        echo "unless you already have it. You can download this from "
     203        echo "http://developer.apple.com/xcode/"
     204        echo "Sage will NOT work with XCode 4!"
     205    fi
     206    if [ $XCODE_VERS_MAJOR -lt 3 ]; then
     207        echo "You are using XCode version 1 or 2"
     208        echo "WARNING: You are strongly advised to install the"
     209        echo "latest (although NOT XCode 4, which does not work with Sage)"
     210        echo "Apple's XCode for your platform, unless you already have it."
     211        if [ $DARWIN_VERSION -gt 9 ]; then
     212           echo "Probably you need XCode 3.2.6"
     213        elif [ $DARWIN_VERSION -lt 9 ]; then
     214           echo "Probably you need XCode 2.5"
     215        else
     216           echo "Probably you need XCode 3.1.4"
     217        fi
     218    fi
     219    echo "***************************************************"
     220    echo "***************************************************"
     221    if [ "$SAGE_PORT" = "" ] && [ $XCODE_VERS_MAJOR -gt 3 ]; then
     222        echo "You are attempting to build Sage using an unsupported XCode version."
     223        echo "Things may or may not work."
     224        echo "Please use the latest XCode 3, reinstalling it, if necessary."
     225        echo "If, however, you would like to help port Sage to the new XCode version,"
     226        echo "please join the sage-devel discussion list - see"
     227        echo "http://groups.google.com/group/sage-devel"
     228        echo "The Sage community would also appreciate any patches you submit."
     229        echo ""
     230        echo "To get past this message, export the variable SAGE_PORT to"
     231        echo "something non-empty."
     232        exit 1
     233    fi
     234    SAGE_ABORT=no
     235    # Try to find ports automatically.
     236    PORTS_PATH=`which port`
     237    if [ -f "`which port`" ]; then
     238        echo "Found MacPorts in " $PORTS_PATH
     239        SAGE_ABORT="yes"; export SAGE_ABORT
     240    fi
     241
     242    # Try to find fink automatically.
     243    FINK_PATH=`which fink`
     244    if [ -f "`which fink`" ]; then
     245        echo "Found Fink in " $FINK_PATH
     246        SAGE_ABORT="yes"; export SAGE_ABORT
     247    fi
     248
     249    if [ "$SAGE_ABORT" = "yes" ]; then
     250        echo ""
     251        echo "*********************************************************"
     252        echo ""
     253        echo "Found either MacPorts or Fink in your PATH, which potentially wrecks the Sage build process."
     254        if [ "$SAGE_COMPILE_DESPITE_PORTS_AND_FINK" ]; then
     255            echo "Continuing because SAGE_COMPILE_DESPITE_PORTS_AND_FINK is set."
     256            echo ""
     257            echo "*********************************************************"
     258            echo ""
     259        else
     260            echo "You should make sure MacPorts and Fink cannot be found.  Either:"
     261            echo "(1) rename /opt/local and /sw, or"
     262            echo "(2) change PATH and DYLD_LIBRARY_PATH"
     263            echo "(Once Sage is built, you can restore them.)"
     264            echo ""
     265            echo "*********************************************************"
     266            echo ""
     267            exit 1
     268        fi
     269    fi
     270fi
     271
     272# Solaris only
     273# Sun's 'tar' and 'make' are unsuitable for building Sage.
     274# So check on Solaris systems that the GNU versions are used.
     275# One issue, which still remains and will make a build non-trivial
     276# on Solaris is the fact that the first linker and assembler
     277# in the path must be the ones used by gcc if the user is using gcc
     278# to compile Sage. This is not addressed in this version of 'prereq'
     279# but will in a later one.
     280
     281if [ `uname` = "SunOS" ] ; then
     282   if [ -z "`tar --version 2>&1 | grep GNU`" ] ; then
     283      echo ""
     284      echo "ERROR **********************************************"
     285      echo "ERROR **********************************************"
     286      echo "You MUST also use the GNU version of tar, as some parts"
     287      echo "of the Sage source code are compressed tar files, which"
     288      echo "were compressed with GNU tar. GNU tar does not produce"
     289      echo "POSIX compliant tar files unless called with the --posix"
     290      echo "option, so can not always be extracted with Sun's tar."
     291      echo ""
     292      echo ""
     293      echo "Therefore, to build Sage on Solaris you MUST have"
     294      echo "the GNU version of tar in your path before the Sun version"
     295      echo ""
     296      if [ -f "/usr/sfw/bin/gtar" ]  && [ -f "/usr/sfw/bin/gmake" ] ; then
     297          echo "There is a copy of GNU tar, but renamed to 'gtar' in"
     298          echo "the directory /usr/sfw/bin. It is suggested that you copy"
     299          echo "/usr/sfw/bin/gtar to a different directory, renaming it" 
     300          echo "'tar' instead of gtar. Then ensure that directory is in"
     301          echo "you path before /usr/bin, so whenever you type 'tar' you"
     302          echo "run the GNU version, and not the Sun version of tar."
     303          echo ""
     304          echo "Due to some GNUisms, the same applies with 'make'"
     305          echo ""
     306          echo "Executing something like"
     307          echo ""
     308          echo "$ mkdir \$HOME/bins-for-sage"
     309          echo "$ cp /usr/sfw/bin/gmake \$HOME/bins-for-sage/make"
     310          echo "$ cp /usr/sfw/bin/gtar \$HOME/bins-for-sage/tar"
     311          echo "$ export PATH=\$HOME/bins-for-sage:\$PATH"
     312          echo ""
     313          echo "will put the GNU versions of 'tar' and 'make' in your path"   
     314          echo "before the Sun versions"
     315          echo ""
     316          echo "If you type 'tar --version' it should be obvious whether"
     317          echo "the GNU version of 'tar' is first in your path or not"
     318          echo ""
     319          echo "If you type  'make --version' is should be obvious whether"
     320          echo "the GNU version of 'make' is first in your path or not"
     321          echo ""
     322      fi
     323      exit 1
     324   fi
     325   if [ -z "`make --version 2>&1 | grep GNU`" ] ; then
     326      echo "Due to numerous GNUisms, you MUST use the GNU version of 'make'"
     327      echo "to build Sage on Solaris - Sun's version will not work."
     328      echo ""
     329      if [ -f "/usr/sfw/bin/gtar" ]  && [ -f "/usr/sfw/bin/gmake" ] ; then
     330         echo "There is a copy of GNU 'make', but renamed to 'gmake' in"
     331         echo "the directory /usr/sfw/bin. It is suggested that you copy"
     332         echo "/usr/sfw/bin/gmake to a different directory, renaming it" 
     333         echo "'make' instead of gmake. Then ensure that directory is in"
     334         echo "you path before /usr/ccs/bin, so whenever you type 'make' you"
     335         echo "run the GNU version, and not the Sun version of make."
     336         echo ""
     337         echo "You MUST also use the GNU version of tar, as some parts"
     338         echo "of the Sage source code are compressed tar files, which"
     339         echo "were compressed with GNU tar. GNU tar does not produce"
     340         echo "POSIX compliant tar files unless called with the --posix"
     341         echo "option, so can not always be extracted with Sun's tar."
     342         echo ""
     343         echo "Executing something like"
     344         echo "$ mkdir \$HOME/bins-for-sage"
     345         echo "$ cp /usr/sfw/bin/gmake \$HOME/bins-for-sage/make"
     346         echo "$ cp /usr/sfw/bin/gtar \$HOME/bins-for-sage/tar"
     347         echo "$ export PATH=\$HOME/bins-for-sage:\$PATH"
     348         echo "will put the GNU versions of 'tar' and 'make' in your path"   
     349         echo "before the Sun versions"
     350         echo ""
     351         echo "If you type 'make --version' it should be obvious whether"
     352         echo "the GNU version of 'make' is first in your path or not"
     353         echo ""
     354         echo "If you type  'tar --version' is should be obvious whether"
     355         echo "the GNU version of 'tar' is first in your path or not"
     356         echo ""
     357      else
     358         echo "You can either compile GNU make from source, or it may be"
     359         echo "obtained from Blastwave or Sunfreeware.com"
     360         echo ""
     361         echo "On Open Solaris, some GNU tools can be found at /usr/gnu"
     362         echo "although at the time of writing, this directory did not contain"
     363         echo "make or tar, but you might try looking there."
     364      fi
     365      exit 1
     366   fi
     367fi
     368
     369# Test for GNU versions of tar and make on AIX, HP-UX, IRIX and Tru64
     370# Unlike on Solaris, no help is given about where to find the GNU
     371# versions, as I've not used a sufficient number of these machines
     372# to know where to find the GNU tools. The tests for operating system
     373# are split across two lines, as it's unwise to make more than 4 test.
     374# The split shown seemed the most natural, with making the
     375# IRIX and IRIX64 tests on a line of their own. David Kirkby January 2010
     376
     377if [ -z "`tar --version 2>&1 | grep GNU`" ] ; then
     378   if [ "x`uname`" = "xHP-UX" ] ||  [ "x`uname`" = "xAIX" ] ||   [ "x`uname`" = "Tru64" ] ; then
     379       echo ""
     380       echo "You must use the GNU version of tar on `uname` Please"
     381       echo "ensure that a GNU version of tar is first in your path"
     382       exit 1
     383   elif [ "x`uname`" = "xIRIX" ] ||  [ "x`uname`" = "xIRIX64" ] ; then
     384       echo ""
     385       echo "You must use the GNU version of tar on IRIX. Please"
     386       echo "ensure that a GNU version of tar is first in your path"
     387       exit 1
     388   fi
     389fi
     390
     391
     392if [ -z "`make --version 2>&1 | grep GNU`" ] ; then
     393   if [ "x`uname`" = "xHP-UX" ] ||  [ "x`uname`" = "xAIX" ] ||   [ "x`uname`" = "xTru64" ] ; then
     394       echo ""
     395       echo "You must use the GNU version of make on `uname` Please"
     396       echo "ensure that a GNU version of make is first in your path"
     397       exit 1
     398   elif [ "x`uname`" = "xIRIX" ] ||  [ "x`uname`" = "xIRIX64" ] ; then
     399       echo ""
     400       echo "You must use the GNU version of make on IRIX. Please"
     401       echo "ensure that a GNU version of make is first in your path"
     402       exit 1
     403   fi
     404fi
     405
     406
     407touch $ROOT/installed/$TARGET
     408