# po2tbl.sed.in is invalid on MSDOS
s|po2tbl\.sed\.in|po2tbl-sed.in|g

# AC_CONFIG_LINKS fails if the source and destination are on
# different file systems and symlinks don't work.
#/^ *ln \$srcdir/s%||%|| cp -pf $srcdir/$ac_source $ac_dest ||%
s,ln -s,cp -pf,g

# We always use _deps instead of .deps, 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

# 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 /; &%

# Additional editing of configure and Makefiles for DJGPP

/(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,po2tbl\\.sed\\.in,po2tbl-sed.in,g;t t\
  s,config\\.h\\.in,config.h-in,g;t t\
  s,\\.env-warn,_env-warn,g;t t\
  s,Makefile\\.in\\.in,Makefile.in-in,g;t t\
  s,Makefile\\.am\\.in,Makefile.am-in,g;t t\
  s,jm-winsz\\\([12]\\\)\\.m4,jm\\\1-winsz.m4,g;t t\
  s,missing-,miss-,g;t t\
  s,basic-0-,bas-0-,g;t t\
  s,date2sec-\\\([01]\\\)\\.\\\([XOE]\\\),d2sec-\\\1.\\\2,g;t t\
  s,date2sec-0a\\.\\\([XOE]\\\),d2sec-0a.\\\1,g;t t\
  s,relative-\\\([12]\\\)\\.\\\([XOE]\\\),relat-\\\1.\\\2,g;t t\
  s,\\\(SUBDIRS.*\\\)stty\\\(.*\\\),\\\1\\\2,g;t t\
  s,NN-strne-\\\([12]\\\)\\.\\\([XOE]\\\),NN\\\1-strne.\\\2,g;t t\
  s,N-strne-\\\([12]\\\)\\.\\\([XOE]\\\),N\\\1-strne.\\\2,g;t t\
  s,NN-streq-\\\([12]\\\)\\.\\\([XOE]\\\),NN\\\1q-stre.\\\2,g;t t\
  s,N-streq-\\\([12]\\\)\\.\\\([XOE]\\\),N\\\1q-stre.\\\2,g;t t\
  s,\\.prev-version,_prev-version,g;t t\
  s,\\\$@-t,t-\\\$@,g;t t\
  s,\\\(chown root \\\$(installed_su)\\\)\\\([^.]\\\),\\\1.exe\\\2,g;t t\
  s,\\\(chmod \\\$(setuid_root_mode) \\\$(installed_su)\\\)$,\\\1.exe,g;t t

# Makefile.in.in is renamed to Makefile.in-in...
/^ *ac_config_files=/,/^EOF/ {
  s|po/Makefile\.in$|po/Makefile.in:po/Makefile.in-in|
}

# ...and config.h.in into config.h-in
/^ *ac_config_headers=/,/^EOF/ {
  s|config\.h"$|config.h:config.h-in"|
}

# We don't need stty.
s/\(OPTIONAL_BIN_PROGS=.*\)stty\(.*MAN=.*\)stty.1\(.*\)/\1\2\3/g

# The following two items are changes needed for configuring
# and compiling across partitions.
# 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

# We want only the DJGPP installer to be used.
s/test \$jm_cv_func_unlink_busy_text = no/test yes = no/g
