patches/Python-02-pycc.diff
changeset 6215 2653e6560475
child 6252 847e00ae80d8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/Python-02-pycc.diff	Mon Oct 31 03:22:11 2005 +0000
@@ -0,0 +1,109 @@
+--- /dev/null	2005-10-30 15:16:12.000000000 -0500
++++ python/pycc	2005-10-30 14:29:54.542131000 -0500
+@@ -0,0 +1,106 @@
++#!/bin/ksh
++#
++# Script for running the C/C++ compiler when building python modules
++#
++# CDDL HEADER START
++#
++# The contents of this file are subject to the terms of the
++# Common Development and Distribution License, Version 1.0 only
++# (the "License").  You may not use this file except in compliance
++# with the License.
++#
++# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
++# or http://www.opensolaris.org/os/licensing.
++# See the License for the specific language governing permissions
++# and limitations under the License.
++#
++# When distributing Covered Code, include this CDDL HEADER in each
++# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
++# If applicable, add the following below this CDDL HEADER, with the
++# fields enclosed by brackets "[]" replaced with your own identifying
++# information: Portions Copyright [yyyy] [name of copyright owner]
++#
++# CDDL HEADER END
++#
++#
++# Copyright 2004-2005 Sun Microsystems, Inc.  All rights reserved.
++# Use is subject to license terms.
++#
++
++MYNAME=`basename $0`
++
++# name of the compiler executable
++CCEXE='cc'
++# name of the GNU compiler executable
++GCCEXE='gcc'
++# name of the programming language
++CLANG='C'
++# name of the env variable for setting the compiler path
++CVAR='CC'
++
++if [ "x$MYNAME" = xpyCC ]; then
++    CCEXE='CC'
++    GCCEXE='g++'
++    CLANG='C++'
++    CC="$CXX"
++    CVAR='CXX'
++fi
++
++# check if the CC env variable is set
++if [ "x$CC" != x ]; then
++    # check if $CC exists
++    if [ ! -e "$CC" ]; then
++	echo "WARNING: pycc: $CC not found" 1>&2
++	CC=
++    else
++        # check if $CC is an executable
++	if [ ! -x "$CC" -o ! -f "$CC" ]; then
++	    echo "WARNING: pycc: $CC is not an executable" 1>&2
++	    CC=
++	fi
++    fi
++fi
++
++if [ "x$CC" == x ]; then
++    # Look for the Sun Studio compiler in the PATH
++    IFS=:
++    for dir in $PATH; do
++	if [ -x "$dir/$CCEXE" ]; then
++	    CC="$dir/$CCEXE"
++	    break
++	fi
++    done
++fi
++
++if [ "x$CC" == x ]; then
++    # Look for gcc in the PATH
++    IFS=:
++    for dir in $PATH; do
++	if [ -x "$dir/$GCCEXE" ]; then
++	    CC="$dir/$GCCEXE"
++	    break
++	fi
++    done
++fi
++
++if [ "x$CC" == x ]; then
++    # Check for Sun Studio in /opt/SUNWspro (default install location)
++    if [ -x /opt/SUNWspro/bin/$CCEXE ]; then
++	CC=/opt/SUNWspro/bin/$CCEXE
++    fi
++fi
++
++if [ "x$CC" == x ]; then
++    # Check for the GNU compiler in /usr/sfw/bin
++    if [ -x /usr/sfw/bin/$GCCEXE ]; then
++	CC=/usr/sfw/bin/$GCCEXE
++    fi
++fi
++
++if [ "x$CC" == x ]; then
++    # Cannot continue without a C compiler
++    echo "ERROR: no $CLANG compiler not found; update your PATH or set the $CVAR env variable" 1>&2
++    exit 1
++fi
++
++exec "$CC" "${@}"