aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/Makefile.in2
-rwxr-xr-xgcc/fixproto25
3 files changed, 28 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4c79d84..1308fab 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
Mon May 17 23:56:39 1999 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.
+
* fixinc/fixincl.c: Remove #error, it is not portable.
Mon May 17 23:50:41 1999 Marc Espie <espie@cvs.openbsd.org>
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 9d1ebdd..36e9261 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2244,6 +2244,8 @@ stmp-fixproto: fixhdr.ready fixproto stmp-headers
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; \
diff --git a/gcc/fixproto b/gcc/fixproto
index 03c8fdd..9e02211 100755
--- a/gcc/fixproto
+++ b/gcc/fixproto
@@ -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 @@ fi
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 @@ for code in ALL STD ; do
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 @@ for code in ALL STD ; do
# 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