# 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,\\.new\\.,_new.,g;t t\
  s,\\.old\\.,_old.,g;t t\
  s,\\.tab\\.,_tab.,g;t t\
  s,Makefile\\.in\\.in,Makefile.in-in,g;t t\
  s,Makefile\\.am\\.in,Makefile.am-in,g;t t\
  s,(MAKEINFOFLAGS),& --no-split,\
  /^install-info-am:/,/^$/ {\
    /@list=/ s,\\\$(INFO_DEPS),& bison.i,\
    /@for *file/ s,\\\$(INFO_DEPS),& bison.i,\
    s,file-\\[0-9\\]\\[0-9\\],& \\$\\$file[0-9] \\$\\$file[0-9][0-9],\
  }\
  /^\\.y\\.c:/,/^$/ {\
    /\\\$(YACCCOMPILE)/ {\
      a\\\
	-@test -f y.tab.c && mv -f y.tab.c y_tab.c\\\
	-@test -f y.tab.h && mv -f y.tab.h y_tab.h\
    }\
  }

# 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

# 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
/^rmdir[ 	]*\.tst/ i\
am__leading_dot=_

# 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 subs.sed.
# The sed script: subs.sed is split into 48 lines long files.
# This will produce sed scripts called subs-$ac_sed_frag.sed, where
# $ac_sed_frag is some unique number. This will not work if the splited
# sed script contains a multiple line sed command at line #48. In this
# case the first part of the multiple line sed command will be written
# at the end of one particular subs-$ac_sed_frag.sed and the rest of the
# sed command will be written at the begining of the next subs-$ac_sed_frag.sed
# making both sed script useless.
# This matches the configure script produced by Autoconf 2.57
/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 and bison.in
# 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.*/bison-[0-9]\\{1,1\\}[-.0-9A-z]*%${top_srcdir}%'`
}
/^install_sh=/a\
install_sh=`echo "$install_sh" | sed 's%/dev.*/bison-[0-9]\\{1,1\\}[-.0-9A-z]*%${top_srcdir}%'`
/tests\/atconfig/,/^ATEOF$/ {
/abs_builddir=/ c\
abs_builddir='../../.'
# /at_srcdir=/ c\
# at_srcdir='../../.'
/abs_srcdir=/ c\
abs_srcdir='../../.'
# /at_top_srcdir=/ c\
# at_top_srcdir='../../..'
/abs_top_srcdir=/ c\
abs_top_srcdir='../../..'
# /at_top_builddir=/ c\
# at_top_builddir='../../../'
/abs_top_builddir=/ c\
abs_top_builddir='../../../'
}
 
# Add DJGPP version information.
# /^#define VERSION/ s/\$VERSION/&  (DJGPP port 2004-12-06 (r2))/
/^[ 	]*VERSION=/ {
  s/=/="/
  s/$/  (DJGPP port 2004-12-06 (r2))"/
}

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

# The path to the FORTRAN compiler and libraries
# shall contain no absolute path reference so it
# will be good for all djgpp installations.
/^FLIBS="\$ac_cv_flibs"/ i\
ac_djgpp_path=`echo "$DJDIR" | sed 's%\\\\\\%/%g' | tr $as_cr_LETTERS $as_cr_letters`\
ac_cv_flibs=`echo "$ac_cv_flibs" | sed "s%-L$ac_djgpp_path%-L/dev/env/DJDIR%g"`

# Check for g++.
/for/ s/g++/& gpp/

/@abs_top_srcdir@/ a\
s,@at_top_srcdir@,$ac_top_srcdir,;t t
/@abs_top_builddir@/ a\
s,@at_top_builddir@,$ac_top_srcdir,;t t
