# Configuration fragment for GAS.
-DupIfChange {srcdir}config:ho-mpw.h host.h
-
-echo '/* empty */' >'sys/file.h'
-echo '/* empty */' >'sys/resource.h'
-echo '/* empty */' >'sys/stat.h'
-echo '#include <time.h>' >'sys/time.h'
-echo '#include <types.h>' >'sys/types.h'
-
-Echo "#ifndef __va_list__" >varargs.h
-Echo "#define __va_list__" >>varargs.h
-Echo "typedef char *va_list;" >>varargs.h
-Echo "#endif" >>varargs.h
-Echo "#define va_dcl int va_alist;" >>varargs.h
-Echo "#define va_start(list) list = (char *) &va_alist" >>varargs.h
-Echo "#define va_end(list)" >>varargs.h
-Echo "#define va_arg(list,mode) ((mode *)(list += sizeof(mode)))[-1]" >>varargs.h
+Set target_arch `echo {target_canonical} | sed -e 's/-.*-.*//'`
+
+# The following works for many configurations, though not all.
+
+Set obj_format `echo {target_canonical} | sed -e 's/.*-.*-//'`
+
+Set bfd_gas no
+
+Set TDEFINES ""
+
+If "{target_canonical}" =~ /m68k-apple-macos/
+ Set obj_format "coff"
+ Set TDEFINES '-d M68KCOFF'
+Else If "{target_canonical}" =~ /ppc-apple-macos/
+ Set obj_format "xcoff"
+ Set bfd_gas yes
+Else If "{target_canonical}" =~ /i386-unknown-go32/
+ Set obj_format "coff"
+ Set TDEFINES '-d I386COFF'
+Else If "{target_canonical}" =~ /m68k-unknown-coff/
+ Set TDEFINES '-d M68KCOFF'
+Else If "{target_canonical}" =~ /mips-idt-ecoff/
+ Set bfd_gas yes
+ Set TDEFINES '-d TARGET_BYTES_BIG_ENDIAN'
+Else If "{target_canonical}" =~ /sh-hitachi-hms/
+ Set obj_format "coff"
+ forward-include "{srcroot}"opcodes:sh-opc.h 'opcodes/sh-opc.h'
+End If
+
+forward-include "{srcdir}"config:tc-{target_arch}.c targ-cpu.c
+forward-include "{srcdir}"config:tc-{target_arch}.h targ-cpu.h
+
+forward-include "{srcdir}"config:obj-{obj_format}.c obj-format.c
+forward-include "{srcdir}"config:obj-{obj_format}.h obj-format.h
+
+# Default emulation.
+
+forward-include "{srcdir}"config:te-generic.h targ-env.h
+
+# Special cases for float handling.
+
+If "{target_arch}" =~ /ns32k/
+ forward-include "{srcdir}"config:atof-ns32k.c atof-targ.c
+Else If "{target_arch}" =~ /tahoe/
+ forward-include "{srcdir}"config:atof-tahoe.c atof-targ.c
+Else If "{target_arch}" =~ /vax/
+ forward-include "{srcdir}"config:atof-vax.c atof-targ.c
+Else
+ # Use IEEE by default.
+ forward-include "{srcdir}"config:atof-ieee.c atof-targ.c
+End If
+
+Echo '# From mpw-config.in' > "{o}"mk.tmp
+
+Echo 'VERSION = ' `Search 'VERSION=' "{srcdir}"Makefile.in | sed -e 's/.*VERSION=\(.*\)/\1/'` >> "{o}"mk.tmp
+
+If "{bfd_gas}" =~ /yes/
+ Echo "HACK_O_RAMA = BFD_ASSEMBLER" >> "{o}"mk.tmp
+Else
+ Echo "HACK_O_RAMA = MANY_SEGMENTS" >> "{o}"mk.tmp
+End If
+
+Echo "TDEFINES = " {TDEFINES} >> "{o}"mk.tmp
+
+Echo '# End from mpw-config.in' >> "{o}"mk.tmp