# Additional editing of Makefiles
/(echo[ 	]*':t/ a\
# DJGPP specific Makefile changes.\
  /^aliaspath *	*=/s,:,";",g;t t\
  /TEXINPUTS=/s,:,";",g;t t\
  /PATH=/s,:,";",g;t t\
  s,\\.deps,_deps,g;t t\
  s,\\.tab,_tab,g;t t\
  s,bootstrap\\.sh\\.in,bootstrap.sh-in,g;t t\
  s,Makefile\\.in\\.in,Makefile.in-in,g;t t\
  s,bug-regex,bregex,g;t t\
  /^install-info-am:/,/^$/ {\
    /@list=/ s,\\\$(INFO_DEPS),& sed.i,\
    /for *file/ s,\\\$(INFO_DEPS),& sed.i,\
    s,file-\\[0-9\\]\\[0-9\\],& \\$\\$file[0-9] \\$\\$file[0-9][0-9],\
  }\
  /sed/s,groupify\\.sed,\\$(srcdir)/&,\
  /^sed\\.1:/,/^$/ {\
    /HELP2MAN/ {\
      a\\\
	sed "/^\\\\.TH/ s/  (DJGPP port 2004-12-09 (r3))//" \\$(srcdir)/sed.1 > \\$(srcdir)/sed.tmp\\\
	mv  \\$(srcdir)/sed.tmp \\$(srcdir)/sed.1\
      s,sed\\.x,\\$(srcdir)/&,\
    }\
  }

# Makefile.in.in is renamed to Makefile.in-in...
/ac_config_files=/,/_ACEOF/ {
  s|po/Makefile\.in|&:po/Makefile.in-in|
}
/CONFIG_FILES=/ s|po/Makefile\.in|&:po/Makefile.in-in|2

# ...and bootstrap.sh.in is renamed to bootstrap.sh-in.
/ac_config_files=/,/_ACEOF/ {
  s|bootstrap\.sh|&:bootstrap.sh-in|
}
/CONFIG_FILES=/ s|bootstrap\.sh|&:bootstrap.sh-in|2

# We always use _deps and _libs instead of .deps and .libs, because
# the latter is an invalid name on 8+3 MS-DOS filesystem.  This makes
# the generated Makefiles good for every DJGPP installation, not only
# the one where the package was configured (which could happen to be
# a Windows box, where leading dots in file names are allowed).
s,\.deps,_deps,g
s,\.libs,_libs,g

# Replace (command) > /dev/null with `command > /dev/null`, since
# parenthesized commands always return zero status in the ported Bash,
# even if the named command doesn't exist
/if ([^|;]*null/{
  s,(,`,
  s,),,
  /null[ 	]*2>&1/ s,2>&1,&`,
  /null.*null/ s,null.*null,&`,
  /null.*null/ !{
    /null[ 	]*2>&1/ !s,null,&`,
  }
}

# DOS-style absolute file names should be supported as well
/\*) top_srcdir=/s,/\*,[\\\\/]* | ?:[\\\\/]*,

# Prevent the spliting of conftest.subs.
# The sed script: conftest.subs is split into 48 or 90 lines long files.
# This will produce sed scripts called conftest.s1, conftest.s2, etc.
# that will not work if conftest.subs contains a multi line sed command
# at line #90. In this case the first part of the sed command will be the
# last line of conftest.s1 and the rest of the command will be the first lines
# of conftest.s2. So both script will not work properly.
# This matches the configure script produced by Autoconf 2.54
/ac_max_sed_lines=[0-9]/ s,=.*$,=`sed -n "$=" $tmp/subs.sed`,

# The following two items are changes needed for configuring
# and compiling across partitions.
# 1) The given srcdir value is always translated from the
#    "x:" syntax into "/dev/x" syntax while we run configure.
/^[ 	]*-srcdir=\*.*$/ a\
    ac_optarg=`echo "$ac_optarg" | sed "s,^\\([A-Za-z]\\):,/dev/\\1,"`
/set X `ls -Lt \$srcdir/ i\
   if `echo $srcdir | grep "^/dev/" - > /dev/null`; then\
     srcdir=`echo "$srcdir" | sed -e "s%^/dev/%%" -e "s%/%:/%"`\
   fi

# Autoconf 2.52e generated configure scripts
# write absolute paths into Makefiles making
# them useless for DJGPP installations for which
# the package has not been configured for.
/MISSING=/,/^$/ {
  /^fi$/ a\
am_missing_run=`echo "$am_missing_run" | sed 's%/dev.*/sed-[0-9]\\.[-.0-9A-z]\\{1,\\}%${top_srcdir}%;s%.:.*/sed-[0-9]\\.[-.0-9A-z]\\{1,\\}%${top_srcdir}%'`
}
/^install_sh=/a\
install_sh=`echo "$install_sh" | sed 's%/dev.*/sed-[0-9]\\.[-.0-9A-z]\\{1,\\}%${top_srcdir}%;s%.:.*/sed-[0-9]\\.[-.0-9A-z]\\{1,\\}%${top_srcdir}%'`

# The following makes sure we are not going to remove a directory
# which is the cwd on its drive (DOS doesn't allow to remove such
# a directory).  The trick is to chdir to the root directory on
# temp directory's drive before removing $tmp.
/^ *trap 'exit_status=\$\?; rm -rf/s%rm -rf%cd $tmp; cd /; &%

# Add DJGPP version information.
# /^#define VERSION/ s/\$VERSION/&  (DJGPP port 2004-12-09 (r3))/
/^[ 	]*VERSION=/ {
  s/=/="/
  s/$/  (DJGPP port 2004-12-09 (r3))"/
}

# We need makeinfo to make the html formated docs.
/\$am_missing_run[ 	]*makeinfo/ s,\$am_missing_run,,
