When Damien tried to update gnome-python to 2.17.2 he found that
configure was hanging in a call to pycc.  I found that it was
running pycc --version in a fork bomb, because the configure
script set CC to pycc itself.  To avoid this situation, I've updated
pycc to check if the executable in CC/CXX is the same as itself
(using cmp) and if so, it ignores the value and prints a warning.
Also, to be able to override what the configure script thinks is
best for us, I introduced the PYCC_CC and PYCC_CXX environment
variables.  If set, these variables are used instead of CC/CXX.

Laca


--- SUNWPython-2.4.4/Python-2.4.4/pycc Mon Jan  8 13:56:51 2007
+++ pycc      Tue Jan  9 14:32:31 2007
@@ -38,6 +38,10 @@
 # name of the env variable for setting the compiler path
 CVAR='CC'
 
+if [ "x$PYCC_CC" != x ]; then
+    CC="$PYCC_CC"
+fi
+
 if [ "x$MYNAME" = xpyCC ]; then
     CCEXE='CC'
     GCCEXE='g++'
@@ -44,6 +48,9 @@
     CLANG='C++'
     CC="$CXX"
     CVAR='CXX'
+    if [ "x$PYCC_CXX" != x ]; then
+        CC="$PYCC_CXX"
+    fi
 fi
 
 SAVED_IFS="$IFS"
@@ -51,6 +58,15 @@
 
 # check if the CC env variable is set
 if [ "x$CC" != x ]; then
+    # verify that it doesn't point to this script
+    if /usr/bin/cmp -s "$CC" $0; then
+        echo "WARNING: "$CVAR" is set to this script; ignoring this value to 
avoid an infinite loop"
+       CC=
+    fi
+fi
+
+# check again if the CC env variable is set
+if [ "x$CC" != x ]; then
     case "$CC" in
        /* )
            # $CC is an absolute path name



Reply via email to