This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: fixproto failures on SGI IRIX 6.x
- To: law at cygnus dot com
- Subject: Re: fixproto failures on SGI IRIX 6.x
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 17 May 1999 07:25:24 -0300
- Cc: Horst von Brand <vonbrand at inf dot utfsm dot cl>, egcs-patches at cygnus dot com
- References: <3311.926934739@upchuck.cygnus.com>
On May 17, 1999, Jeffrey A Law <law@upchuck.cygnus.com> wrote:
> In message <oremkg2ill.fsf@lua.lbi.dcc.unicamp.br>you write:
>> Or just use mkinstalldirs, since it lives in the same directory.
>> Jeff, ok to install the attached patch?
> I think we agreed that mkinstalldirs is the right solution, but I
> don't think you can depend on $0 being a fully qualified pathname (I
> think we've already fixed bugs in this area).
> I think we need to pass the location of mkinstalldirs in as an argument.
How about passing it in the environment, like in the attached patch?
This will also try to use `mkdir -p' if it works. Ok to install?
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists
Index: gcc/ChangeLog
from Alexandre Oliva <oliva@dcc.unicamp.br>
* Makefile.in (stmp-fixproto): Pass location of mkinstalldirs to
fixproto.
* fixproto: Avoid unportable constructs such as `basename' and
`mkdir -p'. Use mkinstalldirs from the environment if `mkdir -p'
fails.
Index: gcc/Makefile.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/Makefile.in,v
retrieving revision 1.263
diff -u -r1.263 Makefile.in
--- gcc/Makefile.in 1999/04/29 15:38:02 1.263
+++ gcc/Makefile.in 1999/05/17 10:24:39
@@ -2244,6 +2244,8 @@
else \
: This line works around a 'make' bug in BSDI 1.1.; \
FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
+ mkinstalldirs="$(SHELL) $(srcdir)/mkinstalldirs"; \
+ export mkinstalldirs; \
if [ -d $(SYSTEM_HEADER_DIR) ] ; then \
$(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
else true; fi; \
Index: gcc/fixproto
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/fixproto,v
retrieving revision 1.7
diff -u -r1.7 fixproto
--- gcc/fixproto 1999/05/11 23:45:59 1.7
+++ gcc/fixproto 1999/05/17 10:24:39
@@ -54,12 +54,27 @@
# Ron Guilmette (rfg@netcom.com) (original idea and code)
# Per Bothner (bothner@cygnus.com) (major re-write)
-progname=$0
-progname=`basename $progname`
+dirname=`echo "$0" | sed 's,^[^/]*$,.,;s,//*[^/]*$,,'`
+progname=`echo "$0" | sed 's,.*/,,'`
original_dir=`pwd`
FIX_HEADER=${FIX_HEADER-$original_dir/fix-header}
DEFINES="-D__STDC__=0 -D__cplusplus ${FIXPROTO_DEFINES}"
+if mkdir -p . 2> /dev/null; then
+ # Great, mkdir accepts -p
+ mkinstalldirs="mkdir -p"
+else
+ # We expect mkinstalldirs to be passed in the environment.
+ # If it is not, assume it is in the directory that contains this script.
+ mkinstalldirs=${mkinstalldirs-"/bin/sh $dirname/mkinstalldirs"}
+ if $mkinstalldirs . 2> /dev/null; then
+ :
+ else
+ # But, in case of failure, fallback to plain mkdir, and hope it works
+ mkinstalldirs=mkdir
+ fi
+fi
+
if [ `echo $1 | wc -w` = 0 ] ; then
echo $progname\: usage\: $progname target-dir \[ source-dir \.\.\. \]
exit 1
@@ -94,7 +109,7 @@
if [ \! -d $abs_target_dir ] ; then
echo $progname\: creating directory $rel_target_dir
- mkdir -p $abs_target_dir
+ $mkinstalldirs $abs_target_dir
fi
echo $progname\: populating \`$rel_target_dir\'
@@ -175,7 +190,7 @@
abs_target_subdir=${abs_target_dir}/${rel_source_subdir}
if [ \! -d $abs_target_subdir ] ; then
- if mkdir -p $abs_target_subdir ; then
+ if $mkinstalldirs $abs_target_subdir ; then
subdirs_made="$abs_target_subdir $subdirs_made"
fi
fi
@@ -202,7 +217,7 @@
# Create the dir where this file will go when fixed.
xxdir=`echo ./$file | sed -e 's|/[^/]*$||'`
if [ \! -d $abs_target_subdir/$xxdir ] ; then
- if mkdir -p $abs_target_subdir/$xxdir ; then
+ if $mkinstalldirs $abs_target_subdir/$xxdir ; then
subdirs_made="$abs_target_subdir/$xxdir $subdirs_made"
fi
fi