summaryrefslogtreecommitdiff
path: root/gcc/fixproto
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-05-17 23:07:40 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1999-05-17 23:07:40 +0000
commite555525ab250ad350d79d8e9a8d70db83f43f4c9 (patch)
treee646352b1a9e17b3208c431f4b4dc9842b44affb /gcc/fixproto
parent864b558e68fd2ea41b203a5ba565226281ef54c0 (diff)
downloadgcc-e555525ab250ad350d79d8e9a8d70db83f43f4c9.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26983 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fixproto')
-rwxr-xr-xgcc/fixproto25
1 files changed, 20 insertions, 5 deletions
diff --git a/gcc/fixproto b/gcc/fixproto
index 03c8fddb435..9e022113ea0 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