# po2tbl.sed.in are invalid on MSDOS.
s|po2tbl\.sed\.in|po2tblsed.in|g

# Additional editing of Makefiles
/ac_given_INSTALL=/,/^CEOF/ {
  s,\$LIBOBJS,pc.o &,
  /^CEOF$/ i\
# DJGPP specific Makefile changes.\
  /^aliaspath *	*=/s,:,";",g\
  /^lispdir *	*=/ c\\\\\
lispdir = \\$(prefix)/gnu/emacs/site-lisp\
  /TEXINPUTS=/s,:,";",g\
  /PATH=/s,:,";",g\
  s,\\.old\\.,_old.,g\
  s,po2tbl\\.sed\\.in,po2tblsed.in,g\
  s,\\.tab\\.c,_tab.c,g\
  s,\\.tab\\.h,_tab.h,g\
  s,Makefile\\.in\\.in,Makefile.in-in,g\
  s,Makefile\\.am\\.in,Makefile.am-in,g\
  s, *quotesys\\.o,,g\
  /^DEFAULT_EDITOR_PROGRAM *=/ s,=.*$,= edit.com,\
  /^cmp\\.o *: *cmp\\.c/ i\\\\\
pc.o: pc/pc.c\\\\\
	\\$(COMPILE) pc/pc.c -o \\$@\
\
  /^infodir *=/ a\\\\\
\\\\\
localedir = \\$(prefix)/share/locale\\\\\
\\\\\
CATALOGS = de.gmo en_UK.gmo es.gmo fr.gmo pl.gmo sv.gmo\
  /^installdirs *:/,/^$/ {\
    /mkinstalldirs /s,$, \\$(localedir),\
  }\
  /^all *:/ {\
    s,\\$(distfiles),catalogs,\
    a\\\\\
catalogs:\\\\\
	cd message ; make\
\
  }\
  /^install *:/ a\\\\\
	cd message; make install prefix=\\$(prefix) CATALOGS="\\$(CATALOGS)"
}

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

# The same as above but this time
# for configure scripts created with Autoconf 2.14a.
/^config_files="\\\\/,/^$/ {
  s|po/Makefile\.in|&:po/Makefile.in-in|
}
/# Handling of arguments./,/^$/ {
  s|po/Makefile\.in|&:po/Makefile.in-in|2
  s|config\.h|&:config.h-in|2
}

# 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,),,
  s,;  *then,`; then,
}

# DOS-style absolute file names should be supported as well
/\*) srcdir=/s,/\*,[\\\\/]* | [A-z]:[\\\\/]*,
/\$]\*) INSTALL=/s,\[/\$\]\*,[\\\\/$]* | [A-z]:[\\\\/]*,
/\$]\*) ac_rel_source=/s,\[/\$\]\*,[\\\\/$]* | [A-z]:[\\\\/]*,

# Switch the order of the two Sed commands, since DOS path names
# could include a colon
/ac_file_inputs=/s,\( -e "s%\^%\$ac_given_srcdir/%"\)\( -e "s%:% $ac_given_srcdir/%g"\),\2\1,

# 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.12
/ac_max_sed_cmds=[0-9]/ s,=.*$,=`sed -n "$=" conftest.subs`,
# This matches the configure script produced by Autoconf 2.14a
/ac_max_sed_lines=[0-9]/ s,=.*$,=`sed -n "$=" $ac_cs_root.subs `,

# Changes for configuring and compileing
# across partitions. This means that we will
# replace 'ln' by 'cp -pf'.
/set X `ls -Lt \$srcdir/ i\
   srcdir=`echo "$srcdir" | sed -e "s%^/dev/%%" -e "s%/%:/%"`
/# Make a symlink if possible; otherwise try a hard link./,/EOF/ {
  s,;.*then, 2>/dev/null || cp -pf \$srcdir/\$ac_source \$ac_dest&,
}

# Additional config.h editing.
/^.*rm -f \$ac_file$/ i\
    cat >> conftest.h <<\\DJGPPEOF\
\
/* DJGPP configuration */\
\
#include <errno.h>\
#ifndef EISDIR\
#define EISDIR EACCES\
#endif\
\
/* PC specific definitions */\
\
#include <io.h>\
#include <process.h>\
\
/* The PC tradition is that file names that differ only in case are the same,\
   and using `stricmp' is required for proper behavior with HPFS.\
   OS/2 does not strictly forbid case sensitive file systems like NFS,\
   but it's too painful to get this right, unfortunately.  */\
#define filename_cmp(a, b) stricmp (a, b)\
\
char *filename_lastdirchar (char const *);\
#define filename_lastdirchar (filename_lastdirchar)\
\
#define HAVE_FORK 0\
\
#define HAVE_SETMODE 1\
int setmode (int, int);\
\
#define TMPDIR_ENV "TEMP"\
DJGPPEOF
