Subject: Re: bin/3138: [dM] mkdep(1) always uses /usr/bin/gcc
To: None <netbsd-bugs@NetBSD.ORG>
From: der Mouse <mouse@Holo.Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 01/31/1997 18:47:55
Todd Vierling <tv@pobox.com> provided this patch, but directly to me,
not in a way that would attach it to this PR. It works for me.
*** mkdep.gcc.sh.dist Sat Jan 25 18:43:17 1997
--- mkdep.gcc.sh Sat Jan 25 18:48:29 1997
***************
*** 1,6 ****
#!/bin/sh -
#
! # $NetBSD: mkdep.gcc.sh,v 1.9 1994/12/23 07:34:59 jtc Exp $
#
# Copyright (c) 1991, 1993
# The Regents of the University of California. All rights reserved.
--- 1,6 ----
#!/bin/sh -
#
! # $NetBSD$
#
# Copyright (c) 1991, 1993
# The Regents of the University of California. All rights reserved.
***************
*** 36,48 ****
# @(#)mkdep.gcc.sh 8.1 (Berkeley) 6/6/93
#
- PATH=/bin:/usr/bin:/usr/ucb
- export PATH
-
D=.depend # default dependency file is .depend
append=0
pflag=
while :
do case "$1" in
# -a appends to the depend file
--- 36,56 ----
# @(#)mkdep.gcc.sh 8.1 (Berkeley) 6/6/93
#
D=.depend # default dependency file is .depend
append=0
pflag=
+ if [ "$CC" = "" ]; then
+ CC=`which cc`
+ if [ "$CC" = "" ]; then
+ CC=`which gcc`
+ if [ "$CC" = "" ]; then
+ echo "$0: can't find cc or gcc in \$PATH and \$CC not set"
+ exit 5
+ fi
+ fi
+ fi
+
while :
do case "$1" in
# -a appends to the depend file
***************
*** 75,83 ****
trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
if [ x$pflag = x ]; then
! gcc -M "$@" | sed -e 's; \./; ;g' > $TMP
else
! gcc -M "$@" | sed -e 's;\.o :; :;' -e 's; \./; ;g' > $TMP
fi
if [ $? != 0 ]; then
--- 83,91 ----
trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
if [ x$pflag = x ]; then
! $CC -M "$@" | sed -e 's; \./; ;g' > $TMP
else
! $CC -M "$@" | sed -e 's;\.o :; :;' -e 's; \./; ;g' > $TMP
fi
if [ $? != 0 ]; then
der Mouse
mouse@rodents.montreal.qc.ca
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B