diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ddf77d --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# Result of ./configure +.deps +config.h +config.log +config.status +m6809-run +stamp-h1 +Makefile +aclocal.m4 +autom4te.cache + +# Result of make +*.o + +# Result of emacs edits +*~ diff --git a/6809.c b/6809.c index 0c48f7b..dccd27f 100644 --- a/6809.c +++ b/6809.c @@ -19,10 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - - #include "6809.h" #include "monitor.h" +#include "command.h" #include unsigned X, Y, S, U, PC; @@ -52,14 +51,20 @@ unsigned int cc_changed = 0; unsigned *index_regs[4] = { &X, &Y, &U, &S }; -extern int dump_cycles_on_success; +int cwai_state = CWAI_STATE_IDLE; +extern int dump_cycles_on_success; extern int trace_enabled; -extern void irq (void); -extern void firq (void); - +void irq (void); +void firq (void); +/* Values of 'source' are arbitrary and can be assigned + per-machine. Machine is responsible for using the + corresponding values of 'source' in release_irq. + multicomp09 uses 0 for periodic timer interrupt + 1 for uart0 rx interrupt +*/ void request_irq (unsigned int source) { /* If the interrupt is not masked, generate @@ -68,15 +73,21 @@ void request_irq (unsigned int source) */ irqs_pending |= (1 << source); if (!(EFI & I_FLAG)) - irq (); + irq(); } +/* IRQ/FIQ are modelled as wire-OR from multiple hw + devices. A machine must call this to model a hw device + negating its contribution to IRQ. + An ISR should be designed to process all sources. If + it does not, the interrupt will re-fire immediately. +*/ void release_irq (unsigned int source) { irqs_pending &= ~(1 << source); } - +/* called with source=0 for periodic timer interrupt */ void request_firq (unsigned int source) { /* If the interrupt is not masked, generate @@ -85,32 +96,29 @@ void request_firq (unsigned int source) */ firqs_pending |= (1 << source); if (!(EFI & F_FLAG)) - firq (); + firq(); } +/* currently this is never called. Instead, irqs_pending is + always cleared in the ISR. That matches an ISR that processes + to completion +*/ void release_firq (unsigned int source) { firqs_pending &= ~(1 << source); } - - -static inline void -check_pc (void) +static inline void check_pc (void) { /* TODO */ } - -static inline void -check_stack (void) +static inline void check_stack (void) { /* TODO */ } - -void -sim_error (const char *format, ...) +void sim_error (const char *format, ...) { va_list ap; @@ -121,20 +129,18 @@ sim_error (const char *format, ...) if (debug_enabled) monitor_on = 1; - else + else { + keybuffering (1); exit (2); + } } - -unsigned long -get_cycles (void) +unsigned long get_cycles (void) { return total + cpu_period - cpu_clk; } - -void -sim_exit (uint8_t exit_code) +void sim_exit (uint8_t exit_code) { char *s; @@ -163,13 +169,11 @@ sim_exit (uint8_t exit_code) fclose (fp); } } - + keybuffering (1); exit (exit_code); } - -static inline void -change_pc (unsigned newPC) +static inline void change_pc (unsigned newPC) { #if 0 /* TODO - will let some RAM execute for trampolines */ @@ -177,6 +181,7 @@ change_pc (unsigned newPC) { fprintf (stderr, "m6809-run: invalid PC = %04X, previous was %s\n", newPC, monitor_addr_name (PC)); + keybuffering (1); exit (2); } @@ -186,20 +191,20 @@ change_pc (unsigned newPC) fprintf (stderr, "-> %s\n", monitor_addr_name (newPC)); } #endif - PC = newPC; + PC = newPC & 0xffff; /* [NAC HACK 2016Oct21] stop PC from going out of range. Crude. + why have I not seen this problem before? Did I introduce this + bug as a side-effect of another change? + */ } - -static inline unsigned -imm_byte (void) +static inline unsigned imm_byte (void) { unsigned val = read8 (PC); PC++; return val; } -static inline unsigned -imm_word (void) +static inline unsigned imm_word (void) { unsigned val = read16 (PC); PC += 2; @@ -208,8 +213,7 @@ imm_word (void) #define WRMEM(addr, data) write8 (addr, data) -static void -WRMEM16 (unsigned addr, unsigned data) +static void WRMEM16 (unsigned addr, unsigned data) { WRMEM (addr, data >> 8); cpu_clk--; @@ -218,8 +222,7 @@ WRMEM16 (unsigned addr, unsigned data) #define RDMEM(addr) read8 (addr) -static unsigned -RDMEM16 (unsigned addr) +static unsigned RDMEM16 (unsigned addr) { unsigned val = RDMEM (addr) << 8; cpu_clk--; @@ -230,29 +233,25 @@ RDMEM16 (unsigned addr) #define write_stack WRMEM #define read_stack RDMEM -static void -write_stack16 (unsigned addr, unsigned data) +static void write_stack16 (unsigned addr, unsigned data) { write_stack ((addr + 1) & 0xffff, data & 0xff); write_stack (addr, data >> 8); } -static unsigned -read_stack16 (unsigned addr) +static unsigned read_stack16 (unsigned addr) { return (read_stack (addr) << 8) | read_stack ((addr + 1) & 0xffff); } -static void -direct (void) +static void direct (void) { unsigned val = read8 (PC) | DP; PC++; ea = val; } -static void -indexed (void) /* note take 1 extra cycle */ +static void indexed (void) /* note take 1 extra cycle */ { unsigned post = imm_byte (); unsigned *R = index_regs[(post >> 5) & 0x3]; @@ -403,8 +402,7 @@ indexed (void) /* note take 1 extra cycle */ } } -static void -extended (void) +static void extended (void) { unsigned val = read16 (PC); PC += 2; @@ -413,216 +411,178 @@ extended (void) /* external register functions */ -unsigned -get_a (void) +unsigned get_a (void) { return A; } -unsigned -get_b (void) +unsigned get_b (void) { return B; } -unsigned -get_dp (void) +unsigned get_dp (void) { return DP >> 8; } -unsigned -get_x (void) +unsigned get_x (void) { return X; } -unsigned -get_y (void) +unsigned get_y (void) { return Y; } -unsigned -get_s (void) +unsigned get_s (void) { return S; } -unsigned -get_u (void) +unsigned get_u (void) { return U; } -unsigned -get_pc (void) +unsigned get_pc (void) { return PC & 0xffff; } -unsigned -get_d (void) +unsigned get_d (void) { return (A << 8) | B; } -unsigned -get_flags (void) +unsigned get_flags (void) { return EFI; } #ifdef H6309 -unsigned -get_e (void) +unsigned get_e (void) { return E; } -unsigned -get_f (void) +unsigned get_f (void) { return F; } -unsigned -get_w (void) +unsigned get_w (void) { return (E << 8) | F; } -unsigned -get_q (void) +unsigned get_q (void) { return (get_w () << 16) | get_d (); } -unsigned -get_v (void) +unsigned get_v (void) { return V; } -unsigned -get_zero (void) +unsigned get_zero (void) { return 0; } -unsigned -get_md (void) +unsigned get_md (void) { return MD; } #endif -void -set_a (unsigned val) +void set_a (unsigned val) { A = val & 0xff; } -void -set_b (unsigned val) +void set_b (unsigned val) { B = val & 0xff; } -void -set_dp (unsigned val) +void set_dp (unsigned val) { DP = (val & 0xff) << 8; } -void -set_x (unsigned val) +void set_x (unsigned val) { X = val & 0xffff; } -void -set_y (unsigned val) +void set_y (unsigned val) { Y = val & 0xffff; } -void -set_s (unsigned val) +void set_s (unsigned val) { S = val & 0xffff; check_stack (); } -void -set_u (unsigned val) +void set_u (unsigned val) { U = val & 0xffff; } -void -set_pc (unsigned val) +void set_pc (unsigned val) { PC = val & 0xffff; check_pc (); } -void -set_d (unsigned val) +void set_d (unsigned val) { A = (val >> 8) & 0xff; B = val & 0xff; } #ifdef H6309 -void -set_e (unsigned val) +void set_e (unsigned val) { E = val & 0xff; } -void -set_f (unsigned val) +void set_f (unsigned val) { F = val & 0xff; } -void -set_w (unsigned val) +void set_w (unsigned val) { E = (val >> 8) & 0xff; F = val & 0xff; } -void -set_q (unsigned val) +void set_q (unsigned val) { set_w ((val >> 16) & 0xffff); set_d (val & 0xffff); } -void -set_v (unsigned val) +void set_v (unsigned val) { V = val & 0xff; } -void -set_zero (unsigned val) -{ -} -void -set_md (unsigned val) +void set_md (unsigned val) { MD = val & 0xff; } #endif - /* handle condition code register */ -unsigned -get_cc (void) +unsigned get_cc (void) { unsigned res = EFI & (E_FLAG | F_FLAG | I_FLAG); @@ -640,8 +600,7 @@ get_cc (void) return res; } -void -set_cc (unsigned arg) +void set_cc (unsigned arg) { EFI = arg & (E_FLAG | F_FLAG | I_FLAG); H = (arg & H_FLAG ? 0x10 : 0); @@ -652,20 +611,17 @@ set_cc (unsigned arg) cc_changed = 1; } - -void -cc_modified (void) +void cc_modified (void) { /* Check for pending interrupts */ if (firqs_pending && !(EFI & F_FLAG)) - firq (); + firq(); else if (irqs_pending && !(EFI & I_FLAG)) - irq (); + irq(); cc_changed = 0; } -unsigned -get_reg (unsigned nro) +unsigned get_reg (unsigned nro) { unsigned val = 0xff; @@ -722,8 +678,7 @@ get_reg (unsigned nro) return val; } -void -set_reg (unsigned nro, unsigned val) +void set_reg (unsigned nro, unsigned val) { switch (nro) { @@ -781,8 +736,7 @@ set_reg (unsigned nro, unsigned val) /* 8-Bit Accumulator and Memory Instructions */ -static unsigned -adc (unsigned arg, unsigned val) +static unsigned adc (unsigned arg, unsigned val) { unsigned res = arg + val + (C != 0); @@ -793,8 +747,7 @@ adc (unsigned arg, unsigned val) return res; } -static unsigned -add (unsigned arg, unsigned val) +static unsigned add (unsigned arg, unsigned val) { unsigned res = arg + val; @@ -805,8 +758,7 @@ add (unsigned arg, unsigned val) return res; } -static unsigned -and (unsigned arg, unsigned val) +static unsigned and (unsigned arg, unsigned val) { unsigned res = arg & val; @@ -816,8 +768,7 @@ and (unsigned arg, unsigned val) return res; } -static unsigned -asl (unsigned arg) /* same as lsl */ +static unsigned asl (unsigned arg) /* same as lsl */ { unsigned res = arg << 1; @@ -829,8 +780,7 @@ asl (unsigned arg) /* same as lsl */ return res; } -static unsigned -asr (unsigned arg) +static unsigned asr (unsigned arg) { unsigned res = (INT8) arg; @@ -841,8 +791,7 @@ asr (unsigned arg) return res; } -static void -bit (unsigned arg, unsigned val) +static void bit (unsigned arg, unsigned val) { unsigned res = arg & val; @@ -850,8 +799,7 @@ bit (unsigned arg, unsigned val) OV = 0; } -static unsigned -clr (unsigned arg) +static unsigned clr (unsigned arg) { C = N = Z = OV = arg = 0; cpu_clk -= 2; @@ -859,8 +807,7 @@ clr (unsigned arg) return arg; } -static void -cmp (unsigned arg, unsigned val) +static void cmp (unsigned arg, unsigned val) { unsigned res = arg - val; @@ -869,8 +816,7 @@ cmp (unsigned arg, unsigned val) OV = (arg ^ val) & (arg ^ res); } -static unsigned -com (unsigned arg) +static unsigned com (unsigned arg) { unsigned res = arg ^ 0xff; @@ -882,8 +828,7 @@ com (unsigned arg) return res; } -static void -daa (void) +static void daa (void) { unsigned res = A; unsigned msn = res & 0xf0; @@ -903,8 +848,7 @@ daa (void) cpu_clk -= 2; } -static unsigned -dec (unsigned arg) +static unsigned dec (unsigned arg) { unsigned res = (arg - 1) & 0xff; @@ -915,8 +859,7 @@ dec (unsigned arg) return res; } -unsigned -eor (unsigned arg, unsigned val) +unsigned eor (unsigned arg, unsigned val) { unsigned res = arg ^ val; @@ -926,8 +869,7 @@ eor (unsigned arg, unsigned val) return res; } -static void -exg (void) +static void exg (void) { unsigned tmp1 = 0xff; unsigned tmp2 = 0xff; @@ -945,8 +887,7 @@ exg (void) cpu_clk -= 8; } -static unsigned -inc (unsigned arg) +static unsigned inc (unsigned arg) { unsigned res = (arg + 1) & 0xff; @@ -957,8 +898,7 @@ inc (unsigned arg) return res; } -static unsigned -ld (unsigned arg) +static unsigned ld (unsigned arg) { unsigned res = arg; @@ -968,8 +908,7 @@ ld (unsigned arg) return res; } -static unsigned -lsr (unsigned arg) +static unsigned lsr (unsigned arg) { unsigned res = arg >> 1; @@ -981,8 +920,7 @@ lsr (unsigned arg) return res; } -static void -mul (void) +static void mul (void) { unsigned res = (A * B) & 0xffff; @@ -993,8 +931,7 @@ mul (void) cpu_clk -= 11; } -static unsigned -neg (int arg) +static unsigned neg (int arg) { unsigned res = (-arg) & 0xff; @@ -1005,8 +942,7 @@ neg (int arg) return res; } -static unsigned -or (unsigned arg, unsigned val) +static unsigned or (unsigned arg, unsigned val) { unsigned res = arg | val; @@ -1016,8 +952,7 @@ or (unsigned arg, unsigned val) return res; } -static unsigned -rol (unsigned arg) +static unsigned rol (unsigned arg) { unsigned res = (arg << 1) + (C != 0); @@ -1029,8 +964,7 @@ rol (unsigned arg) return res; } -static unsigned -ror (unsigned arg) +static unsigned ror (unsigned arg) { unsigned res = arg; @@ -1043,8 +977,7 @@ ror (unsigned arg) return res; } -static unsigned -sbc (unsigned arg, unsigned val) +static unsigned sbc (unsigned arg, unsigned val) { unsigned res = arg - val - (C != 0); @@ -1055,8 +988,7 @@ sbc (unsigned arg, unsigned val) return res; } -static void -st (unsigned arg) +static void st (unsigned arg) { unsigned res = arg; @@ -1066,8 +998,7 @@ st (unsigned arg) WRMEM (ea, res); } -static unsigned -sub (unsigned arg, unsigned val) +static unsigned sub (unsigned arg, unsigned val) { unsigned res = arg - val; @@ -1078,8 +1009,7 @@ sub (unsigned arg, unsigned val) return res; } -static void -tst (unsigned arg) +static void tst (unsigned arg) { unsigned res = arg; @@ -1088,8 +1018,7 @@ tst (unsigned arg) cpu_clk -= 2; } -static void -tfr (void) +static void tfr (void) { unsigned tmp1 = 0xff; unsigned post = imm_byte (); @@ -1102,18 +1031,15 @@ tfr (void) cpu_clk -= 6; } - /* 16-Bit Accumulator Instructions */ -static void -abx (void) +static void abx (void) { X = (X + B) & 0xffff; cpu_clk -= 3; } -static void -addd (unsigned val) +static void addd (unsigned val) { unsigned arg = (A << 8) | B; unsigned res = arg + val; @@ -1125,8 +1051,7 @@ addd (unsigned val) B = res & 0xff; } -static void -cmp16 (unsigned arg, unsigned val) +static void cmp16 (unsigned arg, unsigned val) { unsigned res = arg - val; @@ -1136,8 +1061,7 @@ cmp16 (unsigned arg, unsigned val) OV = ((arg ^ val) & (arg ^ res)) >> 8; } -static void -ldd (unsigned arg) +static void ldd (unsigned arg) { unsigned res = arg; @@ -1147,8 +1071,7 @@ ldd (unsigned arg) OV = 0; } -static unsigned -ld16 (unsigned arg) +static unsigned ld16 (unsigned arg) { unsigned res = arg; @@ -1159,8 +1082,7 @@ ld16 (unsigned arg) return res; } -static void -sex (void) +static void sex (void) { unsigned res = B; @@ -1172,8 +1094,7 @@ sex (void) cpu_clk -= 2; } -static void -std (void) +static void std (void) { unsigned res = (A << 8) | B; @@ -1183,8 +1104,7 @@ std (void) WRMEM16 (ea, res); } -static void -st16 (unsigned arg) +static void st16 (unsigned arg) { unsigned res = arg; @@ -1194,8 +1114,7 @@ st16 (unsigned arg) WRMEM16 (ea, res); } -static void -subd (unsigned val) +static void subd (unsigned val) { unsigned arg = (A << 8) | B; unsigned res = arg - val; @@ -1209,8 +1128,7 @@ subd (unsigned val) /* stack instructions */ -static void -pshs (void) +static void pshs (void) { unsigned post = imm_byte (); @@ -1266,8 +1184,7 @@ pshs (void) } } -static void -pshu (void) +static void pshu (void) { unsigned post = imm_byte (); @@ -1323,8 +1240,7 @@ pshu (void) } } -static void -puls (void) +static void puls (void) { unsigned post = imm_byte (); @@ -1382,8 +1298,7 @@ puls (void) } } -static void -pulu (void) +static void pulu (void) { unsigned post = imm_byte (); @@ -1443,14 +1358,42 @@ pulu (void) /* Miscellaneous Instructions */ -static void -nop (void) +static void stack_machine_state(int full) +{ + if (full) { + cpu_clk -= 19; + EFI |= E_FLAG; + } + else { + cpu_clk -= 6; /* ?? */ + EFI &= ~E_FLAG; + } + S = (S - 2) & 0xffff; + write_stack16(S, PC & 0xffff); + if (full) { + S = (S - 2) & 0xffff; + write_stack16(S, U); + S = (S - 2) & 0xffff; + write_stack16(S, Y); + S = (S - 2) & 0xffff; + write_stack16(S, X); + S = (S - 1) & 0xffff; + write_stack(S, DP >> 8); + S = (S - 1) & 0xffff; + write_stack(S, B); + S = (S - 1) & 0xffff; + write_stack(S, A); + } + S = (S - 1) & 0xffff; + write_stack(S, get_cc()); +} + +static void nop (void) { cpu_clk -= 2; } -static void -jsr (void) +static void jsr (void) { S = (S - 2) & 0xffff; write_stack16 (S, PC & 0xffff); @@ -1458,8 +1401,7 @@ jsr (void) monitor_call (0); } -static void -rti (void) +static void rti (void) { monitor_return (); cpu_clk -= 6; @@ -1488,8 +1430,7 @@ rti (void) S = (S + 2) & 0xffff; } -static void -rts (void) +static void rts (void) { monitor_return (); cpu_clk -= 5; @@ -1498,171 +1439,123 @@ rts (void) S = (S + 2) & 0xffff; } -void -irq (void) +void irq (void) { - EFI |= E_FLAG; - S = (S - 2) & 0xffff; - write_stack16 (S, PC & 0xffff); - S = (S - 2) & 0xffff; - write_stack16 (S, U); - S = (S - 2) & 0xffff; - write_stack16 (S, Y); - S = (S - 2) & 0xffff; - write_stack16 (S, X); - S = (S - 1) & 0xffff; - write_stack (S, DP >> 8); - S = (S - 1) & 0xffff; - write_stack (S, B); - S = (S - 1) & 0xffff; - write_stack (S, A); - S = (S - 1) & 0xffff; - write_stack (S, get_cc ()); + if (cwai_state == CWAI_STATE_WAIT) { + /* In CWAI and machine state is already saved */ + cwai_state = CWAI_STATE_IDLE; + } + else { + stack_machine_state(1); + } EFI |= I_FLAG; - irq_start_time = get_cycles (); - change_pc (read16 (0xfff8)); -#if 1 - irqs_pending = 0; -#endif + irq_start_time = get_cycles(); + change_pc(read16(0xfff8)); } - -void -firq (void) +void firq (void) { - EFI &= ~E_FLAG; - S = (S - 2) & 0xffff; - write_stack16 (S, PC & 0xffff); - S = (S - 1) & 0xffff; - write_stack (S, get_cc ()); + if (cwai_state == CWAI_STATE_WAIT) { + /* In CWAI and machine state is already saved */ + cwai_state = CWAI_STATE_IDLE; + } + else { + stack_machine_state(0); + } EFI |= (I_FLAG | F_FLAG); - change_pc (read16 (0xfff6)); -#if 1 - firqs_pending = 0; -#endif + change_pc(read16(0xfff6)); } - -void -swi (void) +void swi (void) { - cpu_clk -= 19; - EFI |= E_FLAG; - S = (S - 2) & 0xffff; - write_stack16 (S, PC & 0xffff); - S = (S - 2) & 0xffff; - write_stack16 (S, U); - S = (S - 2) & 0xffff; - write_stack16 (S, Y); - S = (S - 2) & 0xffff; - write_stack16 (S, X); - S = (S - 1) & 0xffff; - write_stack (S, DP >> 8); - S = (S - 1) & 0xffff; - write_stack (S, B); - S = (S - 1) & 0xffff; - write_stack (S, A); - S = (S - 1) & 0xffff; - write_stack (S, get_cc ()); + stack_machine_state(1); EFI |= (I_FLAG | F_FLAG); change_pc (read16 (0xfffa)); } -void -swi2 (void) +void swi2 (void) { - cpu_clk -= 20; - EFI |= E_FLAG; - S = (S - 2) & 0xffff; - write_stack16 (S, PC & 0xffff); - S = (S - 2) & 0xffff; - write_stack16 (S, U); - S = (S - 2) & 0xffff; - write_stack16 (S, Y); - S = (S - 2) & 0xffff; - write_stack16 (S, X); - S = (S - 1) & 0xffff; - write_stack (S, DP >> 8); - S = (S - 1) & 0xffff; - write_stack (S, B); - S = (S - 1) & 0xffff; - write_stack (S, A); - S = (S - 1) & 0xffff; - write_stack (S, get_cc ()); + cpu_clk -= 1; + stack_machine_state(1); change_pc (read16 (0xfff4)); } -void -swi3 (void) +void swi3 (void) { - cpu_clk -= 20; - EFI |= E_FLAG; - S = (S - 2) & 0xffff; - write_stack16 (S, PC & 0xffff); - S = (S - 2) & 0xffff; - write_stack16 (S, U); - S = (S - 2) & 0xffff; - write_stack16 (S, Y); - S = (S - 2) & 0xffff; - write_stack16 (S, X); - S = (S - 1) & 0xffff; - write_stack (S, DP >> 8); - S = (S - 1) & 0xffff; - write_stack (S, B); - S = (S - 1) & 0xffff; - write_stack (S, A); - S = (S - 1) & 0xffff; - write_stack (S, get_cc ()); + cpu_clk -= 1; + stack_machine_state(1); change_pc (read16 (0xfff2)); } #ifdef H6309 -void -trap (void) +void trap (void) { - cpu_clk -= 20; - EFI |= E_FLAG; - S = (S - 2) & 0xffff; - write_stack16 (S, PC & 0xffff); - S = (S - 2) & 0xffff; - write_stack16 (S, U); - S = (S - 2) & 0xffff; - write_stack16 (S, Y); - S = (S - 2) & 0xffff; - write_stack16 (S, X); - S = (S - 1) & 0xffff; - write_stack (S, DP >> 8); - S = (S - 1) & 0xffff; - write_stack (S, B); - S = (S - 1) & 0xffff; - write_stack (S, A); - S = (S - 1) & 0xffff; - write_stack (S, get_cc ()); + cpu_clk -= 1; + stack_machine_state(1); change_pc (read16 (0xfff0)); } #endif -void -cwai (void) -{ - sim_error ("CWAI - not supported yet!"); +/* CWAI handling is controlled by a variable cwai_state and divided + into 3 parts: + - code here + - code in the main instruction loop + - code in irq() and firq() + + CWAI masks the CC then saves all of the user registers on the + hardware stack and waits for interrupt (so that the interrupt has lower + latency). + + [NAC HACK 2017Mar11] should abort main loop here when CWAI_STATE_WAIT + otherwise we're simply burning cycles to no benefit + [NAC HACK 2017Mar11] need to fix other bugs in main scheduler? + [NAC HACK 2017Mar11] why doesn't nitros L1 work now? Doesn't get any + I/O? Do I need to mock up a serial interrupt? I thought it was all + done on the timer? +*/ +void cwai (void) +{ + switch (cwai_state) { + case CWAI_STATE_IDLE: + /* PC has advanced to this CWAI instruction. Set flags, + stack machine state for when we take the interrupt; the + stacked PC points after the CWAI + */ + EFI &= (INT8) imm_byte (); + cpu_clk -= 1; + stack_machine_state(1); + + /* remember we're in CWAI, adjust PC to re-execute this instruction + */ + cwai_state = CWAI_STATE_WAIT; + change_pc (PC - 2); /* instruction + immediate */ + break; + case CWAI_STATE_WAIT: + /* Been here before. Still waiting for interrupt. Adjust PC so that + we will re-execute this instruction + */ + cpu_clk -= 1; /* [NAC HACK 2017Mar11] not correct.. */ + change_pc (PC - 1); /* instruction -- did not fetch immediate */ + break; + default: + sim_error ("invalid value of cwai_state %02X\n", cwai_state); + break; + } } -void -sync (void) +void sync (void) { cpu_clk -= 4; sim_error ("SYNC - not supported yet!"); } -static void -orcc (void) +static void orcc (void) { unsigned tmp = imm_byte (); @@ -1670,8 +1563,7 @@ orcc (void) cpu_clk -= 3; } -static void -andcc (void) +static void andcc (void) { unsigned tmp = imm_byte (); @@ -1696,15 +1588,13 @@ andcc (void) #define cond_GT() ((((N^OV) & 0x80) == 0) && (Z != 0)) #define cond_LE() ((((N^OV) & 0x80) != 0) || (Z == 0)) -static void -bra (void) +static void bra (void) { INT8 tmp = (INT8) imm_byte (); change_pc (PC + tmp); } -static void -branch (unsigned cond) +static void branch (unsigned cond) { if (cond) bra (); @@ -1714,15 +1604,13 @@ branch (unsigned cond) cpu_clk -= 3; } -static void -long_bra (void) +static void long_bra (void) { INT16 tmp = (INT16) imm_word (); change_pc (PC + tmp); } -static void -long_branch (unsigned cond) +static void long_branch (unsigned cond) { if (cond) { @@ -1736,8 +1624,7 @@ long_branch (unsigned cond) } } -static void -long_bsr (void) +static void long_bsr (void) { INT16 tmp = (INT16) imm_word (); ea = PC + tmp; @@ -1748,8 +1635,7 @@ long_bsr (void) monitor_call (0); } -static void -bsr (void) +static void bsr (void) { INT8 tmp = (INT8) imm_byte (); ea = PC + tmp; @@ -1760,10 +1646,8 @@ bsr (void) monitor_call (0); } - /* Execute 6809 code for a certain number of cycles. */ -int -cpu_execute (int cycles) +int cpu_execute (int cycles) { unsigned opcode; @@ -2464,7 +2348,7 @@ cpu_execute (int cycles) indexed (); cpu_clk += 1; PC = ea; - check_pc (); + check_pc (); monitor_call (FC_TAIL_CALL); break; /* JMP indexed */ case 0x6f: @@ -2539,7 +2423,7 @@ cpu_execute (int cycles) extended (); cpu_clk -= 4; PC = ea; - check_pc (); + check_pc (); monitor_call (FC_TAIL_CALL); break; /* JMP extended */ case 0x7f: @@ -3126,13 +3010,13 @@ cpu_execute (int cycles) default: cpu_clk -= 2; - sim_error ("invalid opcode '%02X'\n", opcode); - PC = iPC; + sim_error ("invalid opcode '%02X'\n", opcode); + PC = iPC; break; } if (cc_changed) - cc_modified (); + cc_modified (); } while (cpu_clk > 0); @@ -3142,17 +3026,39 @@ cpu_execute (int cycles) return cpu_period; } -void -cpu_reset (void) +void cpu_reset (void) { - X = Y = S = U = A = B = DP = 0; - H = N = OV = C = 0; - Z = 1; - EFI = F_FLAG | I_FLAG; + X = Y = S = U = A = B = DP = 0; + H = N = OV = C = 0; + Z = 1; + EFI = F_FLAG | I_FLAG; #ifdef H6309 - MD = E = F = V = 0; + MD = E = F = V = 0; #endif - change_pc (read16 (0xfffe)); - cpu_is_running (); + change_pc (read16 (0xfffe)); + cpu_is_running (); +} + +void print_regs (void) +{ + char flags[9] = " \0"; + if (get_cc() & C_FLAG) flags[0] = 'C'; + if (get_cc() & V_FLAG) flags[1] = 'V'; + if (get_cc() & Z_FLAG) flags[2] = 'Z'; + if (get_cc() & N_FLAG) flags[3] = 'N'; + if (get_cc() & I_FLAG) flags[4] = 'I'; + if (get_cc() & H_FLAG) flags[5] = 'H'; + if (get_cc() & F_FLAG) flags[6] = 'F'; + if (get_cc() & E_FLAG) flags[7] = 'E'; + + printf (" X: 0x%04X [X]: 0x%04X Y: 0x%04X [Y]: 0x%04X ", + get_x(), read16(get_x()), get_y(), read16(get_y()) ); + printf ("PC: 0x%04X [PC]: 0x%04X\n", + get_pc(), read16(get_pc()) ); + printf (" U: 0x%04X [U]: 0x%04X S: 0x%04X [S]: 0x%04X ", + get_u(), read16(get_u()), get_s(), read16(get_s()) ); + printf ("DP: 0x%02X\n", get_dp() ); + printf (" A: 0x%02X B: 0x%02X [D]: 0x%04X CC: %s\n", + get_a(), get_b(), read16(get_d()), flags ); } diff --git a/6809.h b/6809.h index 6d47908..4d4551e 100644 --- a/6809.h +++ b/6809.h @@ -63,6 +63,11 @@ typedef uint16_t target_addr_t; #define V_FLAG 0x02 #define C_FLAG 0x01 +/* For cwai state machine */ +#define CWAI_STATE_IDLE 0 +#define CWAI_STATE_WAIT 1 + + extern int debug_enabled; extern int need_flush; extern unsigned long total; @@ -135,9 +140,7 @@ extern void monitor_init (void); extern int monitor6809 (void); extern int dasm (char *, absolute_address_t); -extern int load_hex (const char *); -extern int load_s19 (const char *); -extern int load_bin (const char *,int); +extern int load_image (const char *); #define MAX_STRINGSPACE 32000 #define MAX_SYMBOL_HASH 1009 @@ -239,5 +242,13 @@ typedef struct #define MAX_THREADS 64 void command_irq_hook (unsigned long cycles); +unsigned long get_cycles (void); +void request_irq (unsigned int source); +void release_irq (unsigned int source); +void request_firq (unsigned int source); +void release_firq (unsigned int source); +void sim_error (const char *format, ...); +void sim_exit (uint8_t exit_code); +void print_regs (void); #endif /* M6809_H */ diff --git a/Makefile.am b/Makefile.am index 6b81467..52d68f7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ m6809_run_SOURCES = \ - 6809.c main.c monitor.c machine.c eon.c wpc.c \ + 6809.c main.c monitor.c machine.c eon.c wpc.c miscsbc.c \ symtab.c command.c fileio.c wpclib.c imux.c \ ioexpand.c mmu.c timer.c serial.c disk.c \ 6809.h config.h eon.h machine.h monitor.h wpclib.h diff --git a/Makefile.in b/Makefile.in index 1de4b0b..ed5251d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -35,7 +35,6 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -LIBOBJDIR = bin_PROGRAMS = m6809-run$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ @@ -54,10 +53,11 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_m6809_run_OBJECTS = 6809.$(OBJEXT) main.$(OBJEXT) monitor.$(OBJEXT) \ - machine.$(OBJEXT) eon.$(OBJEXT) wpc.$(OBJEXT) symtab.$(OBJEXT) \ - command.$(OBJEXT) fileio.$(OBJEXT) wpclib.$(OBJEXT) \ - imux.$(OBJEXT) ioexpand.$(OBJEXT) mmu.$(OBJEXT) \ - timer.$(OBJEXT) serial.$(OBJEXT) disk.$(OBJEXT) + machine.$(OBJEXT) eon.$(OBJEXT) wpc.$(OBJEXT) \ + miscsbc.$(OBJEXT) symtab.$(OBJEXT) command.$(OBJEXT) \ + fileio.$(OBJEXT) wpclib.$(OBJEXT) imux.$(OBJEXT) \ + ioexpand.$(OBJEXT) mmu.$(OBJEXT) timer.$(OBJEXT) \ + serial.$(OBJEXT) disk.$(OBJEXT) m6809_run_OBJECTS = $(am_m6809_run_OBJECTS) m6809_run_LDADD = $(LDADD) binSCRIPT_INSTALL = $(INSTALL_SCRIPT) @@ -121,6 +121,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ READLINE_LIBS = @READLINE_LIBS@ @@ -164,10 +165,10 @@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ m6809_run_SOURCES = \ - 6809.c main.c monitor.c machine.c eon.c wpc.c \ + 6809.c main.c monitor.c machine.c eon.c wpc.c miscsbc.c \ symtab.c command.c fileio.c wpclib.c imux.c \ ioexpand.c mmu.c timer.c serial.c disk.c \ - 6809.h config.h eon.h machine.h monitor.h wpclib.h + 6809.h config.h eon.h machine.h monitor.h os9syscalls.h wpclib.h bin_SCRIPTS = wpc-run all: config.h @@ -286,6 +287,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ioexpand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/machine.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miscsbc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serial.Po@am__quote@ @@ -386,7 +388,8 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + -find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ @@ -432,7 +435,7 @@ distcheck: dist *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) + chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) diff --git a/README b/README index 2ae16b0..9237649 100644 --- a/README +++ b/README @@ -2,18 +2,60 @@ This is a rewrite of Arto Salmi's 6809 simulator. Many changes have been made to it. This program remains licensed under the GNU General Public License. +----------------------------------------------------------------- +Build and install (on Linux) + +you will need make, gcc, aclocal, automake and probably some other +stuff. Then: + +> ./configure +> make + +There is one executable, m6809-run. You can install it +("make install") or simply reference it explicitly. + +To see configure options: + +> ./configure --help + +Enable readline libraries if you have them installed; this will +allow you to use command-line recall and other shortcuts at the +debugger command-line: + +> ./configure --enable-readline +> make + +----------------------------------------------------------------- +Build and install (on OS X) + +The build process is very similar to Linux, so the instructions +provided there apply to some degree to OS X as well. + +To automate the process of fetching and installing the +prerequisites, configuring, compiling and installing, a script +exists that does all the grunt work. + +MacPorts is required. Installing the prerequisites requires root +privileges, so you will be asked for your password. + +> ./build.osx.sh + +----------------------------------------------------------------- Input Files +----------------------------------------------------------------- Machines + The simulator now has the notion of different 'machines': which says what types of I/O devices are mapped into the 6809's address space and how they can be accessed. Adding support for a new machine is fairly easy. -There are 3 builtin machine types at present. The default, -called 'simple', assumes that you have a full 64KB of RAM, +There are 5 builtin machine types at present: + +* 'simple' - assumes that you have a full 64KB of RAM, minus some input/output functions mapped at $FF00 (see I/O below). If you compile a program with gcc6809 with no special linker option, you'll get an S-record file that is suitable for running @@ -27,76 +69,167 @@ gcc6809 also has a builtin notion of which addresses are used for text and data. The simple machine enforces this and will "fault" on invalid accesses. -The second machine is 'wpc', and is an emulation of the +* 'wpc' - an emulation of the Williams Pinball Controller which was the impetus for me working on the compiler in the first place. -The third machine, still in development, is called 'eon' +* 'eon' (and 'eon2') - still in development, is called 'eon' (for Eight-O-Nine). It is similar to simple but has some more advanced I/O capabilities, like a larger memory space that can be paged in/out, and a disk emulation for programs that wants to have persistence. -TODO : Would anyone be interested in a CoCo machine type? +* 'multicomp09' - see miscsbc.c for details + +* 'smii' - see miscsbc.c for details +* 'kipper1' - see miscsbc.c for details + +TODO : Would anyone be interested in a CoCo machine type? +----------------------------------------------------------------- Faults +----------------------------------------------------------------- +Command-line options + +Use -help to see the command-line options. + +----------------------------------------------------------------- Debugging -The simulator supports interactive debugging similar to that -provided by 'gdb'. + +The simulator supports interactive debugging, similar to that +provided by 'gdb', using the following commands: b - Set a breakpoint at the given address. + Set a breakpoint on EXECUTION at the given address. Eg: + break 0xf003 + - break next time + break 0xf000 ignore 4 + - ignore 4 times then break on 5th time + break 0x1200 if + break 0x1200 if $s==02:0x0043 + - break if the S register has the value shown. -bl - List all breakpoints. +wa + Set a watchpoint on WRITE to the given address. Eg: + wa 0xf003 + - break and report on each write to this address. + wa 0xf003 print + - on each write to this address report but do not stop + execution. + wa 0xf003 mask 0x10 + - break and report on each write to this address but + only if the write data ANDed with the mask value is + non-zero. + +rwa + Set a watchpoint on READ from the given address. See + examples above for 'wa'. + +awa + Set a watchpoint on ACCESS (read or write) at the given + address. See examples above for 'wa'. -c - Continue running. +bl + List all breakpoints/watchpoints. d Delete a breakpoint/watchpoint. -di - Add a display expression. The value of the expression - is display anytime the CPU breaks. +c + Continue execution. -h +di + Add a display expression. The value of the expression + is displayed any time that the CPU breaks. Eg: + di $d $x $y + - print current value of D X and Y registers each time + the CPU breaks. + +dump + Save machine-specific state information to a file, + typically named .dmp. The dump might be + in readable or in binary format. + +dumpi <1 | 0> + Turn instruction dump on or off. With no argument, report + the current instruction dump state (on or off). + With instruction dump off, the 'c', 'n', 's' commands + will report the last instruction that was executed before + control returned to the prompt. With instruction dump on, + those commands report each instruction as it is executed. + Instruction dump is OFF by default. + +h or ? Display help. l - List CPU instructions. + List (disassemble) CPU instructions. Default is to start + at the current value of the PC. me Measure the amount of time that a function named by takes. n - Continue until the next instruction is reached. - If the current instruction is a call, then - the debugger resumes after control returns. + Continue execution until the Next instruction is reached. + If the current instruction is a call, then the debugger + resumes after control returns. + +p [format] + Print the value of an expression. See 'Expressions' + below. Eg: + p/f + - f specifies format. See below. + p + - use the previous format. -p - Print the value of an expression. See "Expressions" below. + f is the display format (default x for hex). Options: + x X d u o a c s (match printf). + + TODO: the code supports /u (unit) as well, but the b w + options don't make any obvious difference to the output. + +pc + Set the CPU program counter to and list + (disassemble) CPU instructions at that address. q Quit the simulator. +regs + Display the current value of the CPU registers. + + re Reset the CPU/machine. -runfor - Continue but break after a certain period of (simulated) time. +restore + Restore machine state from a 'dump' file. NOT CURRENTLY + IMPLEMENTED. + +runfor [units] + Continue but break after a certain period of (simulated) + time. The time can be expressed in ms (default) or s. + The 'runfor' command cannot be nested; issuing a + 'runfor' cancels any 'runfor that is in progress. Eg: + runfor 100 ms + runfor 1 s + runfor 0 -- give 'bad time value' error, but still + cancels a 'runfor' in progress. -s - Step one CPU instruction. +s + Step for a certain number of CPU instructions (1 by + default). set - Sets the value of an internal variable or target memory. - See "Expressions" below for details on the syntax. +set var + Sets the value of a location in target memory or the + value of an internal variable. + See 'Expressions' below for details on the syntax. so Run a set of debugger commands from another file. @@ -105,26 +238,251 @@ so source (the file that called it, or the keyboard.) sym - Load a symbol table file. Currently, the only format - supported is an aslink map file. + Load a symbol table file named file.map -- Currently, + the only format supported is an lwlink map file. td - Dump the last 256 instructions that were executed. + Trace Dump. Display the last 256 instructions that were + executed. -wa - Add a watchpoint. The CPU will break when the - memory given by is modified. +vars + Show all program variables. -x - Examine target memory at the address given. +x [format] + Examine target memory at the address . Eg: + x/nfu addr + - nfu specifies number, format, unit respectively. See + below. + x/nfu + - continue from previous address, in new format. + x addr + - use previous format, continue from previous address. + x + - use previous format, continue from previous address. + n is the repeat count (default 1). It specifies how much + memory (counting by units u to display. Display is + formated multi-line if necessary. + f is the display format (default x for hex). Options: + x X d u o a s (match printf) and i (instructions). + u is the unit size (default b for byte). Options: + b (byte) w (word: 2 bytes) + + The addr can be specified as an expression. Eg: + x $pc + x $pc+8 ------------------------------------------------------------------ + - see 'Expressions' below. + +info + Describe machine, devices and address mapping. + + +Symbol Tables +============= + +Exec09 maintains variables, in 3 separate symbol tables: + +- The program table. This is loaded automatically at startup or + using the 'sym' command. The contents of this table is + displayed by the 'vars' command. + Entries in the program table are annotated onto 'list', 'step' + and 'x' output. + +- The auto table. The variables in this table are pre-defined. + The following variables refer to CPU registers: + pc a y u s d a b dp cc + The following variables refer to simulator state: + cycles - number of cycles since reset. + et - number of cycles elapsed since et was last inspected. + irqload - the average number of cycles spent in IRQ. + +- The internal table. Variables are added to this table + using the 'set var' command. + +The three groups of variables behave in different ways: + +Entries in the program table: + +- converted to absolute address values when they are loaded. +- cannot be modified. +- new entries cannot be created interactively +- return either an address (their value) or the data at + the addressed location, depending upon the context. + +Eg: consider a variable 'start' referring to address 0x200. +The byte at address 0x200 is 0xab. + +set start=5 -- changes the byte at address 0x200 + from 0xab to 0x05. +print start -- displays byte from location 0x200 +print &start -- displays 0x200 +break start -- breakpoint at 0x200 +list start -- list at 0x200 +examine start -- read/display memory at 0x200 + +Entries in the auto table: + +- can be modified +- new entries cannot be created interactively +- a print always returns the value +- a set always changes the value (no memory read/write) + +Entries in the internal table: + +- can be created interactivelt using 'set var' +- can be modified +- are not converted to absolute address values +- return either an address (their value) or the data at + the addressed location, depending upon the context. + +Eg: consider the creation of a variable 'fred' from a +pre-existing program variable 'start': + +set var fred=&start+2 + +'fred' can now be used in exactly the same way as the +examples above showed for 'start'. + + +Expressions +=========== + +Many of the debug commands accept an expression. An expression +is one or more numbers or variables, combined using operators. +Eg: $pc+8 + +Depending on the context, an expression might be an rvalue or +might be of the form lvalue=rvalue. In both cases, no +white-space is allowed: the expression is silently truncated +at the white-space, so that $pc + 8 is treated the same way +as $pc. + +The 'print' command evalutes and displays the value of an +rvalue and simultaneously creates an auto-table entry of the +form $ where increments for each successive command. +Eg: + +$1 = 0x12 +(dbg) print 2 + 4 +$2 = 0x02 +(dbg) print $1 +$3 = 0x12 + +The values of these auto-table entries ($1, $2, $3 etc.) are +static. Eg: + +(dbg) print $pc +$4 = 0xE012 +(dbg) step +02:0x0013 6EB1 JMP [,Y++] +(dbg) print $pc +$5 = 0xE013 +(dbg) print $4 +$6 = 0xE012 + +In this example, the 'print $4' returned the original value +calculated, not the value resulting from the update of pc. + +There are also two short-hand forms for referring to $ +values: + +$ refers to the most recent entry +$$n refers to the value from n entries ago. +$ is equivalent to $$0. + +Eg: + +(dbg) print 5 +$0 = 0x05 +(dbg) print 6 +$1 = 0x06 +(dbg) print 7 +$2 = 0x07 +(dbg) print 8 +$3 = 0x08 +(dbg) print $$2 +$4 = 0x06 +(dbg) print $ +$5 = 0x06 + +The 'print' command also accepts an expression of the form +lvalue=rvalue in which case it performs a memory store (like +'set') but also displays the value written. Eg: + +(dbg) print 0=0xab +$60 = 0x00ab +(dbg) x/4X 0 +01:0x0000 : 0xAB 0xE5 0x1D 0x5A + +The 'set' command can change memory and can create/change +entries in the internal symbol table. Eg: + +(dbg) x/4 0 +01:0x0000 : 0x00 0x00 0x00 0x00 +(dbg) set 0=0x12 +(dbg) set 3=0x1b +(dbg) x 0 +01:0x0000 : 0x12 0x00 0x00 0x1B +(dbg) set var fred=0x10000001 +(dbg) x 0 +01:0x0000 : 0x12 0x00 0x00 0x1B +(dbg) print fred +$0 = 0x00 +(dbg) set fred=0xab +(dbg) x 0 +01:0x0000 : 0x12 0xAB 0x00 0x1B +(dbg) print &fred +$1 = 0x10000001 + +If the lvalue is numeric, it is treated as an address and +the result is a byte write to target memory. If the lvalue +is a variable prefixed with '&' the result is an update to +the variable's value. + +Numbers are implicitly decimal. A leading 0 indicates an +octal number and a leading 0x indicates a hex number. + +The following operators are supported: + +unary +, unary -, +, -, *, / == != & + +Evaluation of expressions follows the usual rule that *, / bind +more tightly than +, - so that '4+3*7' evaluates to the same +result as '3*7+4'. + +The result of ==, != is 1 (true) or 0 (false). + +The '&' is an indirection operator. &4 is the contents of +address 4 in the target machine (however, this is of limited +use because only byte access is supported). + +The following expression errors are detected and reported: + +- bad operator in expression +- bad lvalue +- bad rvalue +- non-existent symbol +- non-existent auto symbol +- bad numeric literal +- unrecognised $symbol in assignment +- missing assignment + +However, the error-checking is not rigorous. In particular: + +- an expression is silently truncated at first white-space +- an unrecognised operator is silently ignored +- set 3+1=9 does a write to location 4, but you cannot use + arithmetic on the LHS with variables. +- an error in an assignment is reported but the assignment + may have happened (Eg, to the wrong location or with the + wrong value). +----------------------------------------------------------------- Original README text from Arto: -simple 6809 simulator under GPL licence +simple 6809 simulator under GPL licencel NOTE! this software is beta stage, and has bugs. To compile it you should have 32-bit ANSI C complier. diff --git a/build.osx.sh b/build.osx.sh new file mode 100755 index 0000000..6a6bd23 --- /dev/null +++ b/build.osx.sh @@ -0,0 +1,7 @@ +#!/bin/sh +sudo port install readline autoconf automake +automake --add-missing +autoreconf --force +./configure --enable-readline --enable-6309 --libdir=/opt/local/lib --prefix=/opt/gcc6809 +make +sudo make install diff --git a/command.c b/command.c index 03d6deb..0143997 100644 --- a/command.c +++ b/command.c @@ -1,13 +1,24 @@ +/* -*- c-file-style: "ellemtel" -*- */ #include "6809.h" #include "monitor.h" #include "machine.h" +#include "symtab.h" #include +#include +#include #ifdef HAVE_TERMIOS_H # include #else #error #endif +#ifdef HAVE_READLINE +# include +# include +# include +#endif + +struct termios old_tio, new_tio; typedef struct { @@ -74,8 +85,9 @@ unsigned int irq_cycle_tab[IRQ_CYCLE_COUNTS] = { 0, }; unsigned int irq_cycle_entry = 0; unsigned long irq_cycles = 0; -unsigned long eval (char *expr); -unsigned long eval_mem (char *expr, eval_mode_t mode); +unsigned long eval (char *expr, char *eflag); +unsigned long eval_mem (char *expr, eval_mode_t mode, char *eflag); +static int print_insn_long (absolute_address_t addr); extern int auto_break_insn_count; FILE *command_input; @@ -84,19 +96,17 @@ FILE *command_input; /******************** 6809 Functions **********************/ /**********************************************************/ - -void -print_addr (absolute_address_t addr) +void print_addr (absolute_address_t addr) { const char *name; print_device_name (addr >> 28); putchar (':'); - printf ("0x%04X", addr & 0xFFFFFF); + printf ("0x%04lX", addr & 0xFFFFFF); name = sym_lookup (&program_symtab, addr); if (name) - printf (" <%-16.16s>", name); + printf (" %-18.18s", name); else printf ("%-20.20s", ""); } @@ -106,120 +116,120 @@ print_addr (absolute_address_t addr) /*********************** Functions ************************/ /**********************************************************/ -void -syntax_error (const char *string) +void syntax_error (const char *string) { fprintf (stderr, "error: %s\n", string); } +void report_errors (const char eflag) +{ + if (eflag & 1) fprintf (stderr, "error: bad operator in expression\n"); + if (eflag & 2) fprintf (stderr, "error: bad lvalue in expression\n"); + if (eflag & 4) fprintf (stderr, "error: bad rvalue in expression\n"); + if (eflag & 8) fprintf (stderr, "error: non-existent symbol in expression\n"); + if (eflag & 0x10) fprintf (stderr, "error: non-existent $symbol in expression\n"); + if (eflag & 0x20) fprintf (stderr, "error: bad numeric literal\n"); + if (eflag & 0x40) fprintf (stderr, "error: unrecognised $symbol in assignment\n"); + if (eflag & 0x80) fprintf (stderr, "error: missing assignment\n"); +} -void -save_value (unsigned long val) +void save_value (unsigned long val) { historytab[history_count++ % MAX_HISTORY] = val; } - -unsigned long -eval_historical (unsigned int id) +unsigned long eval_historical (unsigned int id) { return historytab[id % MAX_HISTORY]; } - -void -assign_virtual (const char *name, unsigned long val) +void assign_virtual (const char *name, unsigned long val, char *eflag) { unsigned long v_val; - /* First check for a special variable with this name, and - * invoke its write handler. Otherwise, store to the - * user table. */ if (!sym_find (&auto_symtab, name, &v_val, 0)) { virtual_handler_t virtual = (virtual_handler_t)v_val; - virtual (&val, 1); + virtual (&val, 1); return; } - sym_set (&internal_symtab, name, val, 0); - - if (!strcmp (name, "thread_current")) + else if (!strcmp (name, "thread_current")) { printf ("Thread pointer initialized to "); print_addr (val); putchar ('\n'); thread_current = val; } + else + { + *eflag = *eflag | 0x40; /* not found */ + } } - -unsigned long -eval_virtual (const char *name) +unsigned long eval_virtual (const char *name, char *eflag) { - unsigned long val; + unsigned long val; - /* The name of the virtual is looked up in the global - * symbol table, which holds the pointer to a - * variable in simulator memory, or to a function - * that can compute the value on-the-fly. */ - if (!sym_find (&auto_symtab, name, &val, 0)) - { - virtual_handler_t virtual = (virtual_handler_t)val; - virtual (&val, 0); - } - else if (!sym_find (&internal_symtab, name, &val, 0)) + /* The name of the virtual is looked up in the auto + * symbol table, which holds a function that can + * compute the value on-the-fly. If not found there + * a value of 0 is returned along with an error flag. + */ + if (!sym_find (&auto_symtab, name, &val, 0)) { + virtual_handler_t virtual = (virtual_handler_t)val; + virtual (&val, 0); } else { - return 0; + *eflag = *eflag | 0x10; + val = 0; } - return val; + return val; } - -void -eval_assign (char *expr, unsigned long val) +void eval_assign (char *expr, unsigned long val, char *eflag) { - if (*expr == '$') - { - assign_virtual (expr+1, val); - } + if (*expr == '$') + { + assign_virtual (expr+1, val, eflag); + } else { - absolute_address_t dst = eval_mem (expr, LVALUE); - abs_write8 (dst, val); + absolute_address_t dst = eval_mem(expr, LVALUE, eflag); + + if (!*eflag) + abs_write8(dst, (U8) val); } } - -unsigned long -target_read (absolute_address_t addr, unsigned int size) +unsigned long target_read (absolute_address_t addr, unsigned int size) { - switch (size) - { - case 1: - return abs_read8 (addr); - case 2: - return abs_read16 (addr); - } + if (size == 1) + return abs_read8(addr); + else + return abs_read16(addr); } - -void -parse_format_flag (const char *flags, unsigned char *formatp) +/* Extract any valid format flags - ignore anything else + * allows format and size flags to be mingled but provides no way + * to detect and report unrecognised flags) + */ +void parse_format_flag (const char *flags, unsigned char *formatp) { while (*flags) { switch (*flags) { + case 'X': case 'x': case 'd': case 'u': case 'o': case 'a': case 's': + case 'c': *formatp = *flags; break; } @@ -227,9 +237,11 @@ parse_format_flag (const char *flags, unsigned char *formatp) } } - -void -parse_size_flag (const char *flags, unsigned int *sizep) +/* Extract any valid size flags - ignore anything else + * (allows format and size flags to be mingled but provides no way + * to detect and report unrecognised flags) + */ +void parse_size_flag (const char *flags, unsigned int *sizep) { while (*flags) { @@ -245,9 +257,7 @@ parse_size_flag (const char *flags, unsigned int *sizep) } } - -char * -match_binary (char *expr, const char *op, char **secondp) +char* match_binary (char *expr, const char *op, char **secondp) { char *p; p = strstr (expr, op); @@ -259,54 +269,51 @@ match_binary (char *expr, const char *op, char **secondp) return expr; } - -int -fold_comparisons (char *expr, unsigned long *value) +int fold_comparisons (char *expr, unsigned long *value, char *eflag) { char *p; if (match_binary (expr, "==", &p)) - *value = (eval (expr) == eval (p)); + *value = (eval (expr, eflag) == eval (p, eflag)); else if (match_binary (expr, "!=", &p)) - *value = (eval (expr) != eval (p)); + *value = (eval (expr, eflag) != eval (p, eflag)); else return 0; + return 1; } - -int -fold_binary (char *expr, const char op, unsigned long *valp) +int fold_binary (char *expr, const char op, unsigned long *valp, char *eflag) { - char *p; - unsigned long val1, val2; + char *p; + unsigned long val1, val2; - if ((p = strchr (expr, op)) == NULL) - return 0; + if ((p = strchr (expr, op)) == NULL) + return 0; /* If the operator is the first character of the expression, - * then it's really a unary and shouldn't match here. */ + * then it's really a unary and shouldn't match here. + */ if (p == expr) return 0; *p++ = '\0'; - val1 = eval (expr); - val2 = eval (p); + val1 = eval (expr, eflag); + val2 = eval (p, eflag); - switch (op) - { - case '+': *valp = val1 + val2; break; - case '-': *valp = val1 - val2; break; - case '*': *valp = val1 * val2; break; - case '/': *valp = val1 / val2; break; - } - return 1; + switch (op) + { + case '+': *valp = val1 + val2; break; + case '-': *valp = val1 - val2; break; + case '*': *valp = val1 * val2; break; + case '/': *valp = val1 / val2; break; + } + return 1; } -/** +/* * Evaluate a memory expression, as an lvalue or rvalue. */ -unsigned long -eval_mem (char *expr, eval_mode_t mode) +unsigned long eval_mem (char *expr, eval_mode_t mode, char *eflag) { char *p; unsigned long val; @@ -315,18 +322,21 @@ eval_mem (char *expr, eval_mode_t mode) if ((p = strchr (expr, ':')) != NULL) { *p++ = '\0'; - val = MAKE_ADDR (eval (expr), eval (p)); + val = MAKE_ADDR (eval (expr, eflag), eval (p, eflag)); } - else if (isalpha (*expr)) + else if (isalpha (*expr) || (*expr == '_')) { - if (sym_find (&program_symtab, expr, &val, 0)) + if (!sym_find (&program_symtab, expr, &val, 0)); + else if (!sym_find (&internal_symtab, expr, &val, 0)); + else + { val = 0; + *eflag = *eflag | 8; + } } else { - /* TODO - if expr is already in absolute form, - this explodes ! */ - val = to_absolute (eval (expr)); + val = to_absolute (eval (expr, eflag)); } /* If mode is RVALUE, then dereference it */ @@ -336,8 +346,7 @@ eval_mem (char *expr, eval_mode_t mode) return val; } - -/** +/* * Evaluate an expression, given as a string. * The return is the value (rvalue) of the expression. * @@ -345,66 +354,76 @@ eval_mem (char *expr, eval_mode_t mode) * - Support typecasts ( {TYPE}ADDR ) * */ -unsigned long -eval (char *expr) +unsigned long eval(char *expr, char *eflag) { char *p; unsigned long val; - if (fold_comparisons (expr, &val)); + if (fold_comparisons (expr, &val, eflag)); else if ((p = strchr (expr, '=')) != NULL) - { + { + /* Assignment. Change = to 0 to break the string in two. + * Remainder of eval is the LHS, p is the RHS + */ *p++ = '\0'; - val = eval (p); - eval_assign (expr, val); - } - else if (fold_binary (expr, '+', &val)); - else if (fold_binary (expr, '-', &val)); - else if (fold_binary (expr, '*', &val)); - else if (fold_binary (expr, '/', &val)); + val = eval (p, eflag); /* Evaluate RHS */ + eval_assign (expr, val, eflag); /* Evaluate LHS and assign RHS value */ + } + else if (fold_binary (expr, '+', &val, eflag)); + else if (fold_binary (expr, '-', &val, eflag)); + else if (fold_binary (expr, '*', &val, eflag)); + else if (fold_binary (expr, '/', &val, eflag)); else if (*expr == '$') { - if (expr[1] == '$') - val = eval_historical (history_count - strtoul (expr+2, NULL, 10)); - else if (isdigit (expr[1])) + if (expr[1] == '$') /* $$n */ + val = eval_historical (history_count-1 - strtoul (expr+2, NULL, 10)); + else if (isdigit (expr[1])) /* $n */ val = eval_historical (strtoul (expr+1, NULL, 10)); - else if (!expr[1]) - val = eval_historical (0); - else - val = eval_virtual (expr+1); + else if (!expr[1]) /* $ */ + val = eval_historical (history_count-1); + else /* variable from one of the symbol tables */ + val = eval_virtual (expr+1, eflag); } + /* For a symbol 'fred' 'print fred' and 'set fred=4' + * treat fred as an RVALUE so they read and write memory + * at the address associated with the value of fred. + * 'print &fred' and 'set &fred=4' display and change + * the value of the symbol fred. + */ else if (*expr == '&') { - val = eval_mem (expr+1, LVALUE); + val = eval_mem (expr+1, LVALUE, eflag); } - else if (isalpha (*expr)) + else if (isalpha (*expr) || (*expr == '_')) { - val = eval_mem (expr, RVALUE); + val = eval_mem (expr, RVALUE, eflag); } + /* Try to interpet it as a numeric literal */ else { - val = strtoul (expr, NULL, 0); + val = strtoul (expr, &p, 0); + if (expr==p) + { + *eflag = *eflag | 0x20; + } } return val; } - -void brk_enable (breakpoint_t *br, int flag) +void brk_enable(breakpoint_t *br, int flag) { - if (br->enabled != flag) - { - br->enabled = flag; - if (flag) - active_break_count++; - else - active_break_count--; - } + if (br->enabled != flag) + { + br->enabled = flag; + if (flag) + active_break_count++; + else + active_break_count--; + } } - -breakpoint_t * -brkalloc (void) +breakpoint_t* brkalloc (void) { unsigned int n; for (n = 0; n < MAX_BREAKS; n++) @@ -418,23 +437,20 @@ brkalloc (void) br->keep_running = 0; br->ignore_count = 0; br->temp = 0; + br->on_execute = 0; brk_enable (br, 1); return br; } - return NULL; + return NULL; } - -void -brkfree (breakpoint_t *br) +void brkfree (breakpoint_t *br) { brk_enable (br, 0); br->used = 0; } - -void -brkfree_temps (void) +void brkfree_temps (void) { unsigned int n; for (n = 0; n < MAX_BREAKS; n++) @@ -444,26 +460,21 @@ brkfree_temps (void) } } - -breakpoint_t * -brkfind_by_addr (absolute_address_t addr) +breakpoint_t* brkfind_by_addr (absolute_address_t addr) { unsigned int n; for (n = 0; n < MAX_BREAKS; n++) - if (breaktab[n].addr == addr) - return &breaktab[n]; - return NULL; + if (breaktab[n].addr == addr) + return &breaktab[n]; + return NULL; } -breakpoint_t * -brkfind_by_id (unsigned int id) +breakpoint_t* brkfind_by_id (unsigned int id) { - return &breaktab[id]; + return &breaktab[id]; } - -void -brkprint (breakpoint_t *brkpt) +void brkprint (breakpoint_t *brkpt) { if (!brkpt->used) return; @@ -492,35 +503,30 @@ brkprint (breakpoint_t *brkpt) if (brkpt->ignore_count) printf (", ignore %d times\n", brkpt->ignore_count); if (brkpt->write_mask) - printf (", mask %02X\n", brkpt->write_mask); + printf (", mask 0x%02X\n", brkpt->write_mask); putchar ('\n'); } - -display_t * -display_alloc (void) +display_t* display_alloc (void) { unsigned int n; - for (n = 0; n < MAX_DISPLAYS; n++) + for (n = 0; n < MAX_DISPLAYS; n++) { - display_t *ds = &displaytab[n]; - if (!ds->used) + display_t *ds = &displaytab[n]; + if (!ds->used) { ds->used = 1; return ds; } } + return NULL; } - -void -display_free (display_t *ds) +void display_free (display_t *ds) { } - -void -print_value (unsigned long val, datatype_t *typep) +void print_value (unsigned long val, datatype_t *typep) { char f[8]; @@ -530,6 +536,15 @@ print_value (unsigned long val, datatype_t *typep) print_addr (val); return; + case 'c': + { + char c; + c = val; + if ((c < 32) | (c > 126)) c = '.'; + putchar(c); + return; + } + case 's': { absolute_address_t addr = (absolute_address_t)val; @@ -547,91 +562,93 @@ print_value (unsigned long val, datatype_t *typep) break; } - if (typep->format == 'x') + if ((typep->format == 'x') | (typep->format == 'X')) { - printf ("0x"); + printf ("0x"); sprintf (f, "%%0%d%c", typep->size * 2, typep->format); } - else if (typep->format == 'o') + else if (typep->format == 'o') { - printf ("0"); + printf ("0"); sprintf (f, "%%%c", typep->format); } else sprintf (f, "%%%c", typep->format); + printf (f, val); } - -void -display_print (void) +void display_print (void) { + char eflag = 0; unsigned int n; char comma = '\0'; - for (n = 0; n < MAX_DISPLAYS; n++) - { - display_t *ds = &displaytab[n]; - if (ds->used) - { + for (n = 0; n < MAX_DISPLAYS; n++) + { + display_t *ds = &displaytab[n]; + if (ds->used) + { char expr[256]; strcpy (expr, ds->expr); printf ("%c %s = ", comma, expr); - print_value (eval (expr), &ds->type); + print_value (eval (expr, &eflag), &ds->type); comma = ','; - } - } + } + } if (comma) putchar ('\n'); + if (eflag) + report_errors(eflag); } - - -int -print_insn (absolute_address_t addr) +int print_insn (absolute_address_t addr) { - char buf[64]; - int size = dasm (buf, addr); - printf ("%s", buf); - return size; + char buf[64]; + int size = dasm (buf, addr); + printf ("%s", buf); + return size; } - -void -do_examine (void) +void do_examine (void) { unsigned int n; - unsigned int objs_per_line = 16; + unsigned int objs_per_line = 16; if (isdigit (*command_flags)) examine_repeat = strtoul (command_flags, &command_flags, 0); - if (*command_flags == 'i') - examine_type.format = *command_flags; - else + if (*command_flags == 'i') + examine_type.format = *command_flags; + else parse_format_flag (command_flags, &examine_type.format); + parse_size_flag (command_flags, &examine_type.size); - switch (examine_type.format) + switch (examine_type.format) { case 'i': - objs_per_line = 1; + objs_per_line = 1; break; case 'w': - objs_per_line = 8; + objs_per_line = 8; + break; + + case 'c': + objs_per_line = 32; break; } for (n = 0; n < examine_repeat; n++) { - if ((n % objs_per_line) == 0) - { - putchar ('\n'); - print_addr (examine_addr); - printf (": "); - } + if ((n % objs_per_line) == 0) + { + if (n > 0) putchar ('\n'); + print_addr (examine_addr); + printf (": "); + } switch (examine_type.format) { @@ -639,44 +656,53 @@ do_examine (void) break; case 'i': /* instruction */ - examine_addr += print_insn (examine_addr); + examine_addr += print_insn (examine_addr); break; default: print_value (target_read (examine_addr, examine_type.size), &examine_type); - putchar (' '); + if (examine_type.format != 'c') putchar (' '); examine_addr += examine_type.size; } } putchar ('\n'); } -void -do_print (char *expr) +void do_print (char *expr) { - unsigned long val = eval (expr); - printf ("$%d = ", history_count); + char eflag = 0; + unsigned long val = eval (expr, &eflag); parse_format_flag (command_flags, &print_type.format); parse_size_flag (command_flags, &print_type.size); - print_value (val, &print_type); - putchar ('\n'); - save_value (val); + + if (eflag) + report_errors(eflag); + else + { + printf ("$%d = ", history_count); + print_value (val, &print_type); + putchar ('\n'); + save_value (val); + } } -void -do_set (char *expr) +void do_set (char *expr) { - (void)eval (expr); + char eflag = 0; + + (void)eval (expr, &eflag); + /* too late to prevent an assignment, but at least report problems */ + if (eflag) + report_errors(eflag); } /* TODO - WPC */ #define THREAD_DATA_PC 3 #define THREAD_DATA_ROMBANK 9 -void -print_thread_data (absolute_address_t th) +void print_thread_data (absolute_address_t th) { U8 b; U16 w; @@ -690,21 +716,22 @@ print_thread_data (absolute_address_t th) pc = (b * 0x4000) + (w - 0x4000); pc = MAKE_ADDR (1, pc); print_addr (pc); - //printf ("{ <%04X,%02X>", w, b); } - -void -command_change_thread (void) +void command_change_thread (void) { - target_addr_t addr = target_read (thread_current, thread_id_size); + char eflag = 0; + target_addr_t addr = (target_addr_t) target_read(thread_current, thread_id_size); absolute_address_t th = to_absolute (addr); if (th == thread_id) return; thread_id = th; - if (machine->dump_thread && eval ("$thread_debug")) + /* TODO thread_debug does not exist by default + so this will return an error.. which we'll ignore. + */ + if (machine->dump_thread && eval ("$thread_debug", &eflag)) { if (addr) { @@ -721,141 +748,173 @@ command_change_thread (void) } } - -void -command_stack_push (unsigned int reason) +/* TODO command_stack and command_stack_* are unused */ +void command_stack_push (unsigned int reason) { cmdqueue_t *q = &command_stack[++command_stack_depth]; } - -void -command_stack_pop (void) +void command_stack_pop (void) { cmdqueue_t *q = &command_stack[command_stack_depth]; --command_stack_depth; } - -void -command_stack_add (const char *cmd) +void command_stack_add (const char *cmd) { cmdqueue_t *q = &command_stack[command_stack_depth]; } - -char * -getarg (void) +char* getarg (void) { return strtok (NULL, " \t\n"); } - /****************** Command Handlers ************************/ void cmd_print (void) { char *arg = getarg (); + if (arg) do_print (arg); else do_print ("$"); } - void cmd_set (void) { char *arg = getarg (); if (!strcmp (arg, "var")) - arg = getarg (); + { + /* this form allows the creation of entries + * in the user symbol table. + */ + char *p; + char eflag = 0; + unsigned long val; - if (arg) - do_set (arg); + arg = getarg (); + if ((p = strchr (arg, '=')) != NULL) + { + *p++ = '\0'; + val = eval (p, &eflag); /* Evaluate RHS */ + if (eflag) + report_errors(eflag); + else + sym_set (&internal_symtab, arg, val, 0); + } + else + { + report_errors(0x80); + } + } else - do_set ("$"); + { + /* this form is a memory write */ + if (arg) + do_set (arg); + } } - void cmd_examine (void) { + char eflag = 0; char *arg = getarg (); if (arg) - examine_addr = eval_mem (arg, LVALUE); - do_examine (); + examine_addr = eval_mem (arg, LVALUE, &eflag); + + if (eflag) + report_errors(eflag); + else + do_examine (); } void cmd_break (void) { + char eflag = 0; char *arg = getarg (); + if (!arg) return; - unsigned long val = eval_mem (arg, LVALUE); - breakpoint_t *br = brkalloc (); - br->addr = val; - br->on_execute = 1; - arg = getarg (); - if (!arg); - else if (!strcmp (arg, "if")) + unsigned long val = eval_mem (arg, LVALUE, &eflag); + + if (eflag) + report_errors(eflag); + else { - br->conditional = 1; + breakpoint_t *br = brkalloc (); + br->addr = val; + br->on_execute = 1; + arg = getarg (); - strcpy (br->condition, arg); - } - else if (!strcmp (arg, "ignore")) - { - br->ignore_count = atoi (getarg ()); - } + if (!arg); + else if (!strcmp (arg, "if")) + { + br->conditional = 1; + arg = getarg (); + strcpy (br->condition, arg); + } + else if (!strcmp (arg, "ignore")) + { + br->ignore_count = atoi (getarg ()); + } - brkprint (br); + brkprint (br); + } } - void cmd_watch1 (int on_read, int on_write) { - char *arg; + char eflag = 0; + char *arg = getarg (); - arg = getarg (); if (!arg) return; - absolute_address_t addr = eval_mem (arg, LVALUE); - breakpoint_t *br = brkalloc (); - br->addr = addr; - br->on_read = on_read; - br->on_write = on_write; - for (;;) + absolute_address_t addr = eval_mem (arg, LVALUE, &eflag); + + if (eflag) + report_errors(eflag); + else { - arg = getarg (); - if (!arg) - return; + breakpoint_t *br = brkalloc (); + br->addr = addr; + br->on_read = on_read; + br->on_write = on_write; - if (!strcmp (arg, "print")) - br->keep_running = 1; - else if (!strcmp (arg, "mask")) - { - arg = getarg (); - br->write_mask = strtoul (arg, NULL, 0); - } - else if (!strcmp (arg, "if")) + for (;;) { arg = getarg (); - br->conditional = 1; - strcpy (br->condition, arg); + if (!arg) + break; + + if (!strcmp (arg, "print")) + br->keep_running = 1; + else if (!strcmp (arg, "mask")) + { + arg = getarg (); + br->write_mask = strtoul (arg, NULL, 0); + } + else if (!strcmp (arg, "if")) + { + arg = getarg (); + br->conditional = 1; + strcpy (br->condition, arg); + } } - } - brkprint (br); + brkprint (br); + } } - void cmd_watch (void) { cmd_watch1 (0, 1); } - void cmd_rwatch (void) { cmd_watch1 (1, 0); @@ -866,7 +925,6 @@ void cmd_awatch (void) cmd_watch1 (1, 1); } - void cmd_break_list (void) { unsigned int n; @@ -876,7 +934,11 @@ void cmd_break_list (void) void cmd_step (void) { - auto_break_insn_count = 1; + char *arg = getarg (); + if (arg && (auto_break_insn_count = atoi(arg))); + else + auto_break_insn_count = 1; + exit_command_loop = 0; } @@ -894,7 +956,7 @@ void cmd_next (void) br->temp = 1; /* TODO - for conditional branches, should also set a - temp breakpoint at the branch target */ + temp breakpoint at the branch target */ exit_command_loop = 0; } @@ -917,7 +979,6 @@ void cmd_delete (void) if (!arg) { - int n; printf ("Deleting all breakpoints.\n"); for (id = 0; id < MAX_BREAKS; id++) { @@ -938,15 +999,15 @@ void cmd_delete (void) void cmd_list (void) { - char *arg; + char eflag = 0; + char *arg = getarg (); static absolute_address_t lastpc = 0; static absolute_address_t lastaddr = 0; absolute_address_t addr; int n; - arg = getarg (); if (arg) - addr = eval_mem (arg, LVALUE); + addr = eval_mem (arg, LVALUE, &eflag); else { addr = to_absolute (get_pc ()); @@ -956,18 +1017,19 @@ void cmd_list (void) lastaddr = lastpc = addr; } - for (n = 0; n < 10; n++) + if (eflag) + report_errors(eflag); + else { - print_addr (addr); - printf (" : "); - addr += print_insn (addr); - putchar ('\n'); - } + for (n = 0; n < 16; n++) + { + addr += print_insn_long(addr); + } - lastaddr = addr; + lastaddr = addr; + } } - void cmd_symbol_file (void) { char *arg = getarg (); @@ -975,9 +1037,9 @@ void cmd_symbol_file (void) load_map_file (arg); } - void cmd_display (void) { + char eflag = 0; char *arg; while ((arg = getarg ()) != NULL) @@ -987,10 +1049,14 @@ void cmd_display (void) ds->type = print_type; parse_format_flag (command_flags, &ds->type.format); parse_size_flag (command_flags, &ds->type.size); + if (eflag) + { + report_errors(eflag); + break; + } } } - int command_exec_file (const char *filename) { FILE *infile; @@ -1004,7 +1070,6 @@ int command_exec_file (const char *filename) return 1; } - void cmd_source (void) { char *arg = getarg (); @@ -1015,71 +1080,128 @@ void cmd_source (void) fprintf (stderr, "can't open %s\n", arg); } - void cmd_regs (void) { + print_regs(); } -void cmd_vars (void) +void cmd_pc(void) { - for_each_var (NULL); + char eflag = 0; + unsigned long val; + char* arg = getarg(); + + if (!arg) + return; + + val = eval_mem(arg, LVALUE, &eflag); + + if (eflag) + report_errors(eflag); + else + { + set_pc(val); + cmd_list(); + } } +void cmd_vars (void) +{ + struct symtab *symtab = &program_symtab; /* default */ + char* arg = getarg(); + if (arg && !strcmp(arg, "auto")) + { + symtab = &auto_symtab; + printf("Print auto\n"); + } + else if (arg && !strcmp(arg, "internal")) + { + symtab = &internal_symtab; + printf("Print internal\n"); + } + symtab_print (symtab); +} void cmd_runfor (void) { - char *arg = getarg (); + char eflag = 0; char *units; + char *arg = getarg (); + + if (!arg) + return; + unsigned long val = atoi (arg); + /* do the check here because, even if there is + an error with the new args, we will abandon + any previous runfor that's in progress + */ + if (stop_after_ms != 0) + printf ("Previous 'runfor' abandoned\n"); + units = getarg (); if (!units || !strcmp (units, "ms")) stop_after_ms = val; else if (!strcmp (units, "s")) stop_after_ms = val * 1000; - exit_command_loop = 0; -} + else + eflag = 1; + if (eflag) + fprintf (stderr, "error: bad time units\n"); + else if (val == 0) + fprintf (stderr, "error: bad time value\n"); + else + exit_command_loop = 0; +} void cmd_measure (void) { + char eflag = 0; absolute_address_t addr; target_addr_t retaddr = get_pc (); breakpoint_t *br; /* Get the address of the function to be measured. */ char *arg = getarg (); + if (!arg) return; - addr = eval_mem (arg, LVALUE); - printf ("Measuring "); - print_addr (addr); - printf (" back to "); - print_addr (to_absolute (retaddr)); - putchar ('\n'); - /* Push the current PC onto the stack for the - duration of the measurement. */ - set_s (get_s () - 2); - write16 (get_s (), retaddr); + addr = eval_mem (arg, LVALUE, &eflag); + if (eflag) + report_errors(eflag); + else + { + printf ("Measuring "); + print_addr (addr); + printf (" back to "); + print_addr (to_absolute (retaddr)); + putchar ('\n'); - /* Set a temp breakpoint at the current PC, so that - the measurement will halt. */ - br = brkalloc (); - br->addr = to_absolute (retaddr); - br->on_execute = 1; - br->temp = 1; + /* Push the current PC onto the stack for the + duration of the measurement. */ + set_s (get_s () - 2); + write16 (get_s (), retaddr); - /* Interrupts must be disabled for this to work ! */ - set_cc (get_cc () | 0x50); + /* Set a temp breakpoint at the current PC, so that + the measurement will halt. */ + br = brkalloc (); + br->addr = to_absolute (retaddr); + br->on_execute = 1; + br->temp = 1; - /* Change the PC to the function-under-test. */ - set_pc (addr); + /* Interrupts must be disabled for this to work ! */ + set_cc (get_cc () | 0x50); - /* Go! */ - exit_command_loop = 0; -} + /* Change the PC to the function-under-test. */ + set_pc (addr); + /* Go! */ + exit_command_loop = 0; + } +} void cmd_dump_insns (void) { @@ -1089,24 +1211,16 @@ void cmd_dump_insns (void) if (arg) dump_every_insn = strtoul (arg, NULL, 0); printf ("Instruction dump is %s\n", - dump_every_insn ? "on" : "off"); + dump_every_insn ? "on" : "off"); } - -void -cmd_trace_dump (void) +void cmd_trace_dump (void) { unsigned int off = (trace_offset + 1) % MAX_TRACE; do { target_addr_t pc = trace_buffer[off]; absolute_address_t addr = to_absolute (pc); - //const char *name = sym_lookup (&program_symtab, addr); - //printf ("%04X ", pc); - print_addr (addr); - putchar (':'); - print_insn (addr); - putchar ('\n'); - //putchar (name ? '\n' : ' '); + print_insn_long(addr); off = (off + 1) % MAX_TRACE; } while (off != trace_offset); fflush (stdout); @@ -1114,11 +1228,17 @@ cmd_trace_dump (void) void cmd_dump (void) { + dump_machine(); } - void cmd_restore (void) { + printf("not implemented\n"); +} + +void cmd_info (void) +{ + describe_machine(); } /****************** Parser ************************/ @@ -1127,77 +1247,80 @@ void cmd_help (void); struct command_name { - const char *prefix; - const char *name; - command_handler_t handler; - const char *help; + const char *prefix; + const char *name; + command_handler_t handler; + const char *help; } cmdtab[] = { { "p", "print", cmd_print, - "Print the value of an expression" }, + "Print the value of an expression" }, { "set", "set", cmd_set, - "Set an internal variable/target memory" }, + "Set an internal variable/target memory" }, { "x", "examine", cmd_examine, - "Examine raw memory" }, + "Examine raw memory" }, { "b", "break", cmd_break, - "Set a breakpoint" }, + "Set a breakpoint" }, { "bl", "blist", cmd_break_list, - "List all breakpoints" }, + "List all breakpoints/watchpoints" }, { "d", "delete", cmd_delete, - "Delete a breakpoint" }, + "Delete a breakpoint/watchpoint" }, { "s", "step", cmd_step, - "Step one instruction" }, + "Step one (or more) instructions" }, { "n", "next", cmd_next, - "Break at the next instruction" }, + "Break at the next instruction" }, { "c", "continue", cmd_continue, - "Continue the program" }, + "Continue the program" }, { "fg", "foreground", cmd_continue, NULL }, { "q", "quit", cmd_quit, - "Quit the simulator" }, + "Quit the simulator" }, { "re", "reset", cpu_reset, - "Reset the CPU" }, + "Reset the CPU" }, { "h", "help", cmd_help, - "Display this help" }, + "Display this help" }, { "wa", "watch", cmd_watch, - "Add a watchpoint on write" }, + "Add a watchpoint on write" }, { "rwa", "rwatch", cmd_rwatch, - "Add a watchpoint on read" }, + "Add a watchpoint on read" }, { "awa", "awatch", cmd_awatch, - "Add a watchpoint on read/write" }, + "Add a watchpoint on read/write" }, { "?", "?", cmd_help }, { "l", "list", cmd_list }, { "sym", "symbol-file", cmd_symbol_file, - "Open a symbol table file" }, + "Open a symbol table file" }, { "di", "display", cmd_display, - "Add a display expression" }, + "Add a display expression" }, { "so", "source", cmd_source, - "Run a command script" }, + "Run a command script" }, { "regs", "regs", cmd_regs, - "Show all CPU registers" }, + "Show all CPU registers" }, { "vars", "vars", cmd_vars, - "Show all program variables" }, + "Show all program variables" }, { "runfor", "runfor", cmd_runfor, - "Run for a certain amount of time" }, + "Run for a certain amount of time" }, { "me", "measure", cmd_measure, - "Measure time that a function takes" }, + "Measure time that a function takes" }, { "dumpi", "dumpi", cmd_dump_insns, - "Set dump-instruction flag" }, + "Set dump-instruction flag" }, { "td", "tracedump", cmd_trace_dump, - "Dump the trace buffer" }, + "Dump the trace buffer" }, { "dump", "du", cmd_dump, - "Dump contents of memory to a file" }, + "Dump contents of memory to a file" }, { "restore", "res", cmd_restore, - "Restore contents of memory from a file" }, + "Restore contents of memory from a file" }, + { "i", "info", cmd_info, + "Describe machine, devices and address mapping" }, + { "pc", "pc", cmd_pc, + "Set program counter" }, #if 0 { "cl", "clear", cmd_clear }, - { "i", "info", cmd_info }, { "co", "condition", cmd_condition }, { "tr", "trace", cmd_trace }, { "di", "disable", cmd_disable }, { "en", "enable", cmd_enable }, { "f", "file", cmd_file, - "Choose the program to be debugged" }, + "Choose the program to be debugged" }, { "exe", "exec-file", cmd_exec_file, - "Open an executable" }, + "Open an executable" }, #endif { NULL, NULL }, }; @@ -1209,13 +1332,12 @@ void cmd_help (void) { if (cn->help) printf ("%s (%s) - %s\n", - cn->name, cn->prefix, cn->help); + cn->name, cn->prefix, cn->help); cn++; } } -command_handler_t -command_lookup (const char *cmd) +command_handler_t command_lookup (const char *cmd) { struct command_name *cn; char *p; @@ -1243,26 +1365,46 @@ command_lookup (const char *cmd) return NULL; } - -void -print_current_insn (void) +static int print_insn_long (absolute_address_t addr) { - absolute_address_t addr = to_absolute (get_pc ()); - print_addr (addr); - printf (" : "); - print_insn (addr); - putchar ('\n'); + char buf[64]; + int i; + int size = dasm(buf, addr); + + const char* name; + + print_device_name(addr >> 28); + putchar(':'); + printf("0x%04lX ", addr & 0xFFFFFF); + + for (i = 0; i < size; i++) + printf("%02X", abs_read8(addr + i)); + + for (i = 0; i < 4 - size; i++) + printf(" "); + + name = sym_lookup(&program_symtab, addr); + if (name) + printf(" %-12.12s", name); + else + printf("%-14.14s", ""); + + printf("%s", buf); + putchar ('\n'); + return size; } +void print_current_insn (void) +{ + print_insn_long(to_absolute(get_pc())); +} -int -command_exec (FILE *infile) +int command_exec (FILE *infile) { char buffer[256]; static char prev_buffer[256]; char *cmd; command_handler_t handler; - int rc; do { errno = 0; @@ -1280,16 +1422,16 @@ command_exec (FILE *infile) else #endif { - if (infile == stdin) - printf ("(dbg) "); - fgets (buffer, 255, infile); - if (feof (infile)) - return -1; + if (infile == stdin) + printf ("(dbg) "); + fgets (buffer, 255, infile); + if (feof (infile)) + return -1; } } while (errno != 0); /* In terminal mode, a blank line means to execute - the previous command. */ + the previous command. */ if (buffer[0] == '\n') strcpy (buffer, prev_buffer); @@ -1314,28 +1456,62 @@ command_exec (FILE *infile) return 0; } +void keybuffering_defaults (void) +{ +#ifndef _MSC_VER + + /* get two copies of the terminal settings for stdin */ + tcgetattr(STDIN_FILENO,&old_tio); + tcgetattr(STDIN_FILENO,&new_tio); + + /* disable canonical mode (buffered i/o) and local echo */ + new_tio.c_lflag &=(~ICANON & ~ECHO); -void -keybuffering (int flag) +#endif +} + +void keybuffering (int flag) { - struct termios tio; +#ifndef _MSC_VER + if (flag) { + tcsetattr(STDIN_FILENO,TCSANOW,&old_tio); + } + else { + tcsetattr(STDIN_FILENO,TCSANOW,&new_tio); + } +#endif +} + - tcgetattr (0, &tio); - if (!flag) /* 0 = no buffering = not default */ - tio.c_lflag &= ~ICANON; - else /* 1 = buffering = default */ - tio.c_lflag |= ICANON; - tcsetattr (0, TCSANOW, &tio); +/* Non-blocking check for input character. If + * true, retrieve character using kbchar() + */ +int kbhit(void) +{ + struct timeval tv = { 0L, 0L }; + fd_set fds; + FD_ZERO(&fds); + FD_SET(0, &fds); + return select(1, &fds, NULL, NULL, &tv); } +int kbchar(void) +{ + int r; + unsigned char c; + if ((r = read(0, &c, sizeof(c))) < 0) { + return r; + } else { + return c; + } +} -int -command_loop (void) +int command_loop (void) { keybuffering (1); brkfree_temps (); -restart: + restart: if (command_input == stdin) { display_print (); @@ -1362,16 +1538,16 @@ command_loop (void) return (exit_command_loop); } - -void -breakpoint_hit (breakpoint_t *br) +void breakpoint_hit (breakpoint_t *br) { + /* TODO don't know how best to handle errors here. */ + char eflag = 0; /* unused */ if (br->threaded && (thread_id != br->tid)) return; if (br->conditional) { - if (eval (br->condition) == 0) + if (eval (br->condition, &eflag) == 0) return; } @@ -1384,66 +1560,58 @@ breakpoint_hit (breakpoint_t *br) monitor_on = !br->keep_running; } - -void -command_trace_insn (target_addr_t addr) +void command_trace_insn (target_addr_t addr) { trace_buffer[trace_offset++] = addr; trace_offset %= MAX_TRACE; } - -void -command_insn_hook (void) +void command_insn_hook (void) { target_addr_t pc; absolute_address_t abspc; - breakpoint_t *br; + breakpoint_t *br; pc = get_pc (); command_trace_insn (pc); - if (active_break_count == 0) - return; + if (active_break_count == 0) + return; - abspc = to_absolute (pc); - br = brkfind_by_addr (abspc); - if (br && br->enabled && br->on_execute) - { + abspc = to_absolute (pc); + br = brkfind_by_addr (abspc); + if (br && br->enabled && br->on_execute) + { breakpoint_hit (br); if (monitor_on == 0) return; if (br->temp) brkfree (br); else - printf ("Breakpoint %d reached.\n", br->id); - } + printf ("Breakpoint %d reached.\n", br->id); + } } - -void -command_read_hook (absolute_address_t addr) +void command_read_hook (absolute_address_t addr) { - breakpoint_t *br; + breakpoint_t *br; if (active_break_count == 0) return; br = brkfind_by_addr (addr); - if (br && br->enabled && br->on_read) + if (br && br->enabled && br->on_read) { - printf ("Watchpoint %d triggered. [", br->id); + printf ("Watchpoint %d triggered. [pc=0x%04X ", br->id, get_pc()); print_addr (addr); printf ("]\n"); breakpoint_hit (br); } } - -void -command_write_hook (absolute_address_t addr, U8 val) +void command_write_hook (absolute_address_t addr, U8 val) { - breakpoint_t *br; + breakpoint_t *br; if (active_break_count != 0) { @@ -1453,20 +1621,17 @@ command_write_hook (absolute_address_t addr, U8 val) if (br->write_mask) { int mask_ok = ((br->last_write & br->write_mask) != - (val & br->write_mask)); - + (val & br->write_mask)); br->last_write = val; if (!mask_ok) return; } breakpoint_hit (br); - if (monitor_on == 0) - return; - printf ("Watchpoint %d triggered. [", br->id); + + printf ("Watchpoint %d triggered. [pc=0x%04X ", br->id, get_pc()); print_addr (addr); - printf (" = 0x%02X", val); - printf ("]\n"); + printf (" = 0x%02X]\n", val); } } @@ -1478,9 +1643,7 @@ command_write_hook (absolute_address_t addr, U8 val) } } - -void -command_periodic (void) +void command_periodic (void) { if (stop_after_ms) { @@ -1494,50 +1657,72 @@ command_periodic (void) } } - void pc_virtual (unsigned long *val, int writep) { - writep ? set_pc (*val) : (*val = get_pc ()); + if (writep) set_pc (*val); + else *val = get_pc (); } void x_virtual (unsigned long *val, int writep) { - writep ? set_x (*val) : (*val = get_x ()); + if (writep) set_x (*val); + else *val = get_x (); } void y_virtual (unsigned long *val, int writep) { - writep ? set_y (*val) : (*val = get_y ()); + if (writep) + set_y (*val); + else *val = get_y (); } void u_virtual (unsigned long *val, int writep) { - writep ? set_u (*val) : (*val = get_u ()); + if (writep) + set_u (*val); + else + *val = get_u (); } void s_virtual (unsigned long *val, int writep) { - writep ? set_s (*val) : (*val = get_s ()); + if (writep) + set_s (*val); + else + *val = get_s (); } void d_virtual (unsigned long *val, int writep) { - writep ? set_d (*val) : (*val = get_d ()); + if (writep) + set_d (*val); + else + *val = get_d (); } void a_virtual (unsigned long *val, int writep) { - writep ? set_a (*val) : (*val = get_a ()); + if (writep) + set_a (*val); + else + *val = get_a (); } void b_virtual (unsigned long *val, int writep) { - writep ? set_b (*val) : (*val = get_b ()); + if (writep) + set_b (*val); + else + *val = get_b (); } void dp_virtual (unsigned long *val, int writep) { - writep ? set_dp (*val) : (*val = get_dp ()); + if (writep) + set_dp (*val); + else + *val = get_dp (); } void cc_virtual (unsigned long *val, int writep) { - writep ? set_cc (*val) : (*val = get_cc ()); + if (writep) + set_cc (*val); + else + *val = get_cc (); } void irq_load_virtual (unsigned long *val, int writep) { - if (!writep) + if (!writep) *val = irq_cycles / IRQ_CYCLE_COUNTS; } - void cycles_virtual (unsigned long *val, int writep) { if (!writep) *val = get_cycles (); } - void et_virtual (unsigned long *val, int writep) { static unsigned long last_cycles = 0; @@ -1546,14 +1731,12 @@ void et_virtual (unsigned long *val, int writep) last_cycles = get_cycles (); } - /** * Update the $irqload virtual register, which tracks the * average number of cycles spent in IRQ. This function * maintains a rolling history of IRQ_CYCLE_COUNTS entries. */ -void -command_exit_irq_hook (unsigned long cycles) +void command_exit_irq_hook (unsigned long cycles) { irq_cycles -= irq_cycle_tab[irq_cycle_entry]; irq_cycles += cycles; @@ -1561,12 +1744,8 @@ command_exit_irq_hook (unsigned long cycles) irq_cycle_entry = (irq_cycle_entry + 1) % IRQ_CYCLE_COUNTS; } - -void -command_init (void) +void command_init (void) { - int rc; - /* Install virtual registers. These are referenced in expressions * using a dollar-sign prefix (e.g. $pc). The value of the * symbol is a pointer to a function (e.g. pc_virtual) which @@ -1585,15 +1764,12 @@ command_init (void) sym_add (&auto_symtab, "et", (unsigned long)et_virtual, SYM_AUTO); sym_add (&auto_symtab, "irqload", (unsigned long)irq_load_virtual, SYM_AUTO); - examine_type.format = 'x'; + examine_type.format = 'X'; /* hex with upper-case A-F */ examine_type.size = 1; - print_type.format = 'x'; + print_type.format = 'X'; print_type.size = 1; command_input = stdin; (void)command_exec_file (".dbinit"); } - -/* vim: set ts=3: */ -/* vim: set expandtab: */ diff --git a/command.h b/command.h new file mode 100644 index 0000000..cac32ea --- /dev/null +++ b/command.h @@ -0,0 +1,17 @@ +#ifndef COMMAND_H +#define COMMAND_H + +void keybuffering (int flag); +void command_periodic (void); +void command_exit_irq_hook (unsigned long cycles); +void command_insn_hook (void); +void command_init (void); +void keybuffering_defaults (void); +void print_current_insn (void); +int command_loop (void); +void command_read_hook (absolute_address_t addr); +void command_write_hook (absolute_address_t addr, U8 val); +int kbhit(void); +int kbchar(void); + +#endif diff --git a/config.h.in b/config.h.in index 4e12524..24a1a64 100644 --- a/config.h.in +++ b/config.h.in @@ -100,6 +100,9 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION diff --git a/configure b/configure index a0fd58b..f189971 100755 --- a/configure +++ b/configure @@ -1,20 +1,22 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for m6809-run 0.92. +# Generated by GNU Autoconf 2.69 for m6809-run 0.92. # # Report bugs to . # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which @@ -22,23 +24,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - as_nl=' ' export as_nl @@ -46,7 +40,13 @@ export as_nl as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -57,7 +57,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in + case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -80,13 +80,6 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -96,15 +89,16 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +as_myself= +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -116,12 +110,16 @@ if test "x$as_myself" = x; then fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' @@ -133,7 +131,294 @@ export LC_ALL LANGUAGE=C export LANGUAGE -# Required to use basename. +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: brian@oddchange.com about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -147,8 +432,12 @@ else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ @@ -168,415 +457,111 @@ $as_echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit } -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac -if as_func_ret_success; then - : +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi else - exitcode=1 - echo positional parameters were not saved. + as_ln_s='cp -pR' fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - + test -d ./-p && rmdir ./-p + as_mkdir_p=false fi +as_test_x='test -x' +as_executable_p=as_fn_executable_p -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" -fi +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell bug-autoconf@gnu.org about your system, - echo including any error possibly output before this message. - echo This can help us improve future autoconf versions. - echo Configuration will now proceed without shell functions. -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - -exec 7<&0 &1 +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -591,7 +576,6 @@ cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='m6809-run' @@ -599,6 +583,7 @@ PACKAGE_TARNAME='m6809-run' PACKAGE_VERSION='0.92' PACKAGE_STRING='m6809-run 0.92' PACKAGE_BUGREPORT='brian@oddchange.com' +PACKAGE_URL='' ac_unique_file="6809.c" # Factoring default headers for most tests. @@ -710,6 +695,7 @@ bindir program_transform_name prefix exec_prefix +PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION @@ -796,8 +782,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -842,8 +829,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -869,8 +855,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1074,8 +1059,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1091,8 +1075,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1122,17 +1105,17 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { $as_echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1141,7 +1124,7 @@ Try \`$0 --help' for more information." >&2 $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1149,15 +1132,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { $as_echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 - { (exit 1); exit 1; }; } ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1180,8 +1161,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1195,8 +1175,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1211,11 +1189,9 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { $as_echo "$as_me: error: working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1254,13 +1230,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1300,7 +1274,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1372,7 +1346,7 @@ Some influential environment variables: LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor @@ -1443,73 +1417,482 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF m6809-run configure 0.92 -generated by GNU Autoconf 2.63 +generated by GNU Autoconf 2.69 -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by m6809-run $as_me 0.92, which was -generated by GNU Autoconf 2.63. Invocation command line was - $ $0 $@ +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## -_ACEOF -exec 5>>config.log +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () { -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` +} # ac_fn_c_try_compile -_ASUNAME +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" -done -IFS=$as_save_IFS + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -} >&5 +} # ac_fn_c_try_cpp -cat >&5 <<_ACEOF +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -## ----------- ## -## Core tests. ## -## ----------- ## +} # ac_fn_c_try_run +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> _ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } - -# Keep a trace of the command line. +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ---------------------------------- ## +## Report this to brian@oddchange.com ## +## ---------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_find_uintX_t LINENO BITS VAR +# ------------------------------------ +# Finds an unsigned integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_uintX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +$as_echo_n "checking for uint$2_t... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + case $ac_type in #( + uint$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no"; then : + +else + break +fi + done +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_find_uintX_t + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by m6809-run $as_me 0.92, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. @@ -1531,9 +1914,9 @@ do ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" + as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -1549,13 +1932,13 @@ do -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args '$ac_arg'" + as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -1567,11 +1950,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -1580,13 +1961,13 @@ _ASBOX case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) $as_unset $ac_var ;; + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -1605,11 +1986,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -1622,11 +2001,9 @@ _ASBOX echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -1640,11 +2017,9 @@ _ASBOX fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -1658,46 +2033,53 @@ _ASBOX exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h +$as_echo "/* confdefs.h */" > confdefs.h + # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -1708,19 +2090,23 @@ fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue - if test -r "$ac_site_file"; then - { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; @@ -1728,7 +2114,7 @@ $as_echo "$as_me: loading cache $cache_file" >&6;} esac fi else - { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -1743,11 +2129,11 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; @@ -1757,17 +2143,17 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac @@ -1779,43 +2165,20 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi - - - - - - - - - - - - - - - - - - - - - - - - +## -------------------- ## +## Main body of script. ## +## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1843,9 +2206,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do fi done if test -z "$ac_aux_dir"; then - { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -1871,10 +2232,10 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -1882,11 +2243,11 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -1894,7 +2255,7 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -1923,7 +2284,7 @@ case $as_dir/ in ;; esac -done + done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir @@ -1939,7 +2300,7 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -1950,7 +2311,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 @@ -1974,11 +2335,8 @@ if ( # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file @@ -1987,13 +2345,10 @@ then # Ok. : else - { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -$as_echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:$LINENO: result: yes" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" @@ -2014,7 +2369,7 @@ if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= - { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi @@ -2055,9 +2410,9 @@ for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then +if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -2068,24 +2423,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:$LINENO: result: $AWK" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2093,11 +2448,11 @@ fi test -n "$AWK" && break done -{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -2105,7 +2460,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -2115,11 +2470,11 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2136,9 +2491,7 @@ rmdir .tst 2>/dev/null # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi # test whether we have cygpath @@ -2191,9 +2544,9 @@ if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then +if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -2204,24 +2557,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2231,9 +2584,9 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -2244,24 +2597,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2270,7 +2623,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -2307,9 +2660,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2320,24 +2673,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2347,9 +2700,9 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2360,24 +2713,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2386,7 +2739,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -2400,9 +2753,9 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2413,24 +2766,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2440,9 +2793,9 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2454,18 +2807,18 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then @@ -2484,10 +2837,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2499,9 +2852,9 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2512,24 +2865,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2543,9 +2896,9 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2556,24 +2909,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -2586,7 +2939,7 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -2597,57 +2950,37 @@ fi fi -test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -V >&5") 2>&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2663,8 +2996,8 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: @@ -2680,17 +3013,17 @@ do done rm -f $ac_rmfiles -if { (ac_try="$ac_link_default" +if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -2707,7 +3040,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2726,84 +3059,41 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi - -{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -if test -z "$ac_file"; then - $as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } - fi - fi -fi -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } -if { (ac_try="$ac_link" +if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -2818,32 +3108,83 @@ for ac_file in conftest.exe conftest conftest.*; do esac done else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi - -rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2855,17 +3196,17 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" +if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -2878,31 +3219,23 @@ else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi - rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2916,37 +3249,16 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no + ac_compiler_gnu=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes @@ -2955,20 +3267,16 @@ else fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2979,35 +3287,11 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3018,36 +3302,12 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_compile "$LINENO"; then : - ac_c_werror_flag=$ac_save_c_werror_flag +else + ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -3058,42 +3318,17 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -3110,23 +3345,18 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3178,32 +3408,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done @@ -3214,17 +3421,19 @@ fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac +if test "x$ac_cv_prog_cc_c89" != xno; then : +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3243,7 +3452,7 @@ am__doit: .PHONY: am__doit END # If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= @@ -3271,12 +3480,12 @@ if test "$am__include" = "#"; then fi -{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then +if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi @@ -3299,9 +3508,9 @@ fi depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then +if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -3389,7 +3598,7 @@ else fi fi -{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type @@ -3414,14 +3623,14 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -3436,11 +3645,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -3449,78 +3654,34 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : break fi @@ -3532,7 +3693,7 @@ fi else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -3543,11 +3704,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -3556,87 +3713,40 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -3646,9 +3756,9 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -3659,10 +3769,10 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -3679,7 +3789,7 @@ case `"$ac_path_GREP" --version 2>&1` in $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` + as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" @@ -3694,26 +3804,24 @@ esac $ac_path_GREP_found && break 3 done done -done + done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -3727,10 +3835,10 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -3747,7 +3855,7 @@ case `"$ac_path_EGREP" --version 2>&1` in $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` + as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" @@ -3762,12 +3870,10 @@ esac $ac_path_EGREP_found && break 3 done done -done + done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP @@ -3775,21 +3881,17 @@ fi fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3804,48 +3906,23 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no + ac_cv_header_stdc=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : + $EGREP "memchr" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -3855,18 +3932,14 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : + $EGREP "free" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -3876,14 +3949,10 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : : else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3910,277 +3979,47 @@ main () return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) -ac_cv_header_stdc=no +else + ac_cv_header_stdc=no fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF +$as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF fi done - - - - - - - - for ac_header in netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h termios.h unistd.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ---------------------------------- ## -## Report this to brian@oddchange.com ## -## ---------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - -fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -4191,19 +4030,14 @@ done # Checks for typedefs, structures, and compiler characteristics. - - { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then +if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler @@ -4211,46 +4045,34 @@ cat >>conftest.$ac_ext <<_ACEOF typedef int dummy; _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless - # there are some -arch flags. Note that *ppc* also matches - # ppc64. This check is also rather less than ideal. - case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in #( - *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;; - esac -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -4268,30 +4090,9 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -4307,49 +4108,18 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_bigendian=no + ac_cv_c_bigendian=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -4364,30 +4134,9 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -4402,51 +4151,20 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_bigendian=no + ac_cv_c_bigendian=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; @@ -4472,24 +4190,7 @@ return use_ascii (foo) == use_ebcdic (foo); return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi @@ -4501,20 +4202,10 @@ $as_echo "$ac_try_echo") >&5 ac_cv_c_bigendian=unknown fi fi -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int @@ -4534,89 +4225,51 @@ main () return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_c_bigendian=yes + ac_cv_c_bigendian=yes fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) - cat >>confdefs.h <<\_ACEOF -#define WORDS_BIGENDIAN 1 -_ACEOF + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) -cat >>confdefs.h <<\_ACEOF -#define AC_APPLE_UNIVERSAL_BUILD 1 -_ACEOF +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) - { { $as_echo "$as_me:$LINENO: error: unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -$as_echo "$as_me: error: unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} - { (exit 1); exit 1; }; } ;; + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac -{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if test "${ac_cv_c_const+set}" = set; then +if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { -/* FIXME: Include the comments suggested by Paul. */ + #ifndef __cplusplus - /* Ultrix mips cc rejects this. */ + /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; - const charset cs; + const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; @@ -4633,8 +4286,9 @@ main () ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; @@ -4650,10 +4304,10 @@ main () iptr p = 0; ++p; } - { /* AIX XL C 1.02.0.0 rejects this saying + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; @@ -4666,56 +4320,29 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_const=no + ac_cv_c_const=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -cat >>confdefs.h <<\_ACEOF -#define const /**/ -_ACEOF +$as_echo "#define const /**/" >>confdefs.h fi -{ $as_echo "$as_me:$LINENO: checking for inline" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } -if test "${ac_cv_c_inline+set}" = set; then +if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; @@ -4724,41 +4351,17 @@ $ac_kw foo_t foo () {return 0; } #endif _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } - case $ac_cv_c_inline in inline | yes) ;; *) @@ -4774,16 +4377,12 @@ _ACEOF ;; esac -{ $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if test "${ac_cv_header_time+set}" = set; then +if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -4798,107 +4397,23 @@ return 0; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_time=no + ac_cv_header_time=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then -cat >>confdefs.h <<\_ACEOF -#define TIME_WITH_SYS_TIME 1 -_ACEOF +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi - - { $as_echo "$as_me:$LINENO: checking for uint16_t" >&5 -$as_echo_n "checking for uint16_t... " >&6; } -if test "${ac_cv_c_uint16_t+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_c_uint16_t=no - for ac_type in 'uint16_t' 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) -1 >> (16 - 1) == 1)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - case $ac_type in - uint16_t) ac_cv_c_uint16_t=yes ;; - *) ac_cv_c_uint16_t=$ac_type ;; -esac - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_uint16_t" != no && break - done -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint16_t" >&5 -$as_echo "$ac_cv_c_uint16_t" >&6; } - case $ac_cv_c_uint16_t in #( +ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" +case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) @@ -4909,75 +4424,12 @@ _ACEOF ;; esac - - { $as_echo "$as_me:$LINENO: checking for uint32_t" >&5 -$as_echo_n "checking for uint32_t... " >&6; } -if test "${ac_cv_c_uint32_t+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_c_uint32_t=no - for ac_type in 'uint32_t' 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) -1 >> (32 - 1) == 1)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - case $ac_type in - uint32_t) ac_cv_c_uint32_t=yes ;; - *) ac_cv_c_uint32_t=$ac_type ;; -esac - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_uint32_t" != no && break - done -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint32_t" >&5 -$as_echo "$ac_cv_c_uint32_t" >&6; } - case $ac_cv_c_uint32_t in #( +ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" +case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) -cat >>confdefs.h <<\_ACEOF -#define _UINT32_T 1 -_ACEOF +$as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF @@ -4986,75 +4438,12 @@ _ACEOF ;; esac - - { $as_echo "$as_me:$LINENO: checking for uint8_t" >&5 -$as_echo_n "checking for uint8_t... " >&6; } -if test "${ac_cv_c_uint8_t+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_c_uint8_t=no - for ac_type in 'uint8_t' 'unsigned int' 'unsigned long int' \ - 'unsigned long long int' 'unsigned short int' 'unsigned char'; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) -1 >> (8 - 1) == 1)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - case $ac_type in - uint8_t) ac_cv_c_uint8_t=yes ;; - *) ac_cv_c_uint8_t=$ac_type ;; -esac - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_uint8_t" != no && break - done -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint8_t" >&5 -$as_echo "$ac_cv_c_uint8_t" >&6; } - case $ac_cv_c_uint8_t in #( +ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" +case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) -cat >>confdefs.h <<\_ACEOF -#define _UINT8_T 1 -_ACEOF +$as_echo "#define _UINT8_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF @@ -5063,16 +4452,12 @@ _ACEOF ;; esac -{ $as_echo "$as_me:$LINENO: checking for working volatile" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 $as_echo_n "checking for working volatile... " >&6; } -if test "${ac_cv_c_volatile+set}" = set; then +if ${ac_cv_c_volatile+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -5086,210 +4471,44 @@ return !x && !y; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_volatile=yes else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_volatile=no + ac_cv_c_volatile=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5 $as_echo "$ac_cv_c_volatile" >&6; } if test $ac_cv_c_volatile = no; then -cat >>confdefs.h <<\_ACEOF -#define volatile /**/ -_ACEOF +$as_echo "#define volatile /**/" >>confdefs.h fi # Checks for library functions. - for ac_header in stdlib.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ---------------------------------- ## -## Report this to brian@oddchange.com ## -## ---------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - -fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +do : + ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_STDLIB_H 1 _ACEOF fi done -{ $as_echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then +if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include @@ -5305,55 +4524,24 @@ return ! malloc (0); return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_func_malloc_0_nonnull=no + ac_cv_func_malloc_0_nonnull=no fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then +if test $ac_cv_func_malloc_0_nonnull = yes; then : -cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 1 -_ACEOF +$as_echo "#define HAVE_MALLOC 1" >>confdefs.h else - cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 0 -_ACEOF + $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; @@ -5362,158 +4550,16 @@ _ACEOF esac -cat >>confdefs.h <<\_ACEOF -#define malloc rpl_malloc -_ACEOF +$as_echo "#define malloc rpl_malloc" >>confdefs.h fi - - - for ac_header in sys/select.h sys/socket.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ---------------------------------- ## -## Report this to brian@oddchange.com ## -## ---------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - -fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -5522,19 +4568,15 @@ fi done -{ $as_echo "$as_me:$LINENO: checking types of arguments for select" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5 $as_echo_n "checking types of arguments for select... " >&6; } -if test "${ac_cv_func_select_args+set}" = set; then +if ${ac_cv_func_select_args+:} false; then : $as_echo_n "(cached) " >&6 else for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_SELECT_H @@ -5554,41 +4596,18 @@ extern int select ($ac_arg1, return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done done done # Provide a safe default value. -: ${ac_cv_func_select_args='int,int *,struct timeval *'} +: "${ac_cv_func_select_args=int,int *,struct timeval *}" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5 $as_echo "$ac_cv_func_select_args" >&6; } ac_save_IFS=$IFS; IFS=',' set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` @@ -5611,16 +4630,12 @@ _ACEOF rm -f conftest* -{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } -if test "${ac_cv_type_signal+set}" = set; then +if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -5633,35 +4648,14 @@ return *(signal (0, 0)) (0) == 1; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_signal=void + ac_cv_type_signal=void fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF @@ -5669,301 +4663,30 @@ cat >>confdefs.h <<_ACEOF _ACEOF - for ac_func in vprintf -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - eval "$as_ac_var=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -{ $as_echo "$as_me:$LINENO: checking for _doprnt" >&5 -$as_echo_n "checking for _doprnt... " >&6; } -if test "${ac_cv_func__doprnt+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define _doprnt to an innocuous variant, in case declares _doprnt. - For example, HP-UX 11i declares gettimeofday. */ -#define _doprnt innocuous__doprnt - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef _doprnt - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char _doprnt (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub__doprnt || defined __stub____doprnt -choke me -#endif - -int -main () -{ -return _doprnt (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - ac_cv_func__doprnt=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func__doprnt=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 -$as_echo "$ac_cv_func__doprnt" >&6; } -if test "x$ac_cv_func__doprnt" = x""yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DOPRNT 1 -_ACEOF - -fi - -fi -done - - - - - - - - - -for ac_func in gettimeofday memset select strchr strstr strtoul socket -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} +do : + ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" +if test "x$ac_cv_func_vprintf" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VPRINTF 1 _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then - eval "$as_ac_var=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" +ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" +if test "x$ac_cv_func__doprnt" = xyes; then : + +$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h + fi -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +done + + +for ac_func in gettimeofday memset select strchr strstr strtoul socket +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -5973,7 +4696,7 @@ done # Check whether --enable-wpc was given. -if test "${enable_wpc+set}" = set; then +if test "${enable_wpc+set}" = set; then : enableval=$enable_wpc; wpc=$enableval else wpc=no @@ -5981,14 +4704,12 @@ fi if test $wpc = yes; then -cat >>confdefs.h <<\_ACEOF -#define CONFIG_WPC 1 -_ACEOF +$as_echo "#define CONFIG_WPC 1" >>confdefs.h fi # Check whether --enable-6309 was given. -if test "${enable_6309+set}" = set; then +if test "${enable_6309+set}" = set; then : enableval=$enable_6309; h6309=$enableval else h6309=no @@ -5996,14 +4717,12 @@ fi if test $h6309 = yes; then -cat >>confdefs.h <<\_ACEOF -#define H6309 1 -_ACEOF +$as_echo "#define H6309 1" >>confdefs.h fi # Check whether --enable-readline was given. -if test "${enable_readline+set}" = set; then +if test "${enable_readline+set}" = set; then : enableval=$enable_readline; rl_lib=$enableval else rl_lib=no @@ -6011,9 +4730,7 @@ fi if test $rl_lib = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_READLINE 1 -_ACEOF +$as_echo "#define HAVE_READLINE 1" >>confdefs.h READLINE_LIBS="-L/lib -lreadline" @@ -6048,13 +4765,13 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) $as_unset $ac_var ;; + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -6062,8 +4779,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" @@ -6085,12 +4802,23 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else - { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi @@ -6104,14 +4832,15 @@ DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -6119,28 +4848,23 @@ LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -6150,17 +4874,18 @@ cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which @@ -6168,23 +4893,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - as_nl=' ' export as_nl @@ -6192,7 +4909,13 @@ export as_nl as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -6203,7 +4926,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in + case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -6226,13 +4949,6 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -6242,15 +4958,16 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +as_myself= +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -6262,12 +4979,16 @@ if test "x$as_myself" = x; then fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' @@ -6279,7 +5000,89 @@ export LC_ALL LANGUAGE=C export LANGUAGE -# Required to use basename. +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -6293,8 +5096,12 @@ else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ @@ -6314,76 +5121,25 @@ $as_echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in +case `echo -n x` in #((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then @@ -6398,49 +5154,85 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -6450,13 +5242,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 -# Save the log message, to keep $[0] and so on meaningful, and to +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by m6809-run $as_me 0.92, which was -generated by GNU Autoconf 2.63. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -6488,13 +5286,15 @@ _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTION]... [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit + --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files @@ -6513,16 +5313,17 @@ $config_headers Configuration commands: $config_commands -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ m6809-run config.status 0.92 -configured by $0, generated by GNU Autoconf 2.63, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" -Copyright (C) 2008 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -6539,11 +5340,16 @@ ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -6557,27 +5363,29 @@ do ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; esac - CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" + as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - { $as_echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; };; + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ @@ -6585,11 +5393,10 @@ Try \`$0 --help' for more information." >&2 ac_cs_silent=: ;; # This is an error. - -*) { $as_echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" + *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac @@ -6606,7 +5413,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -6644,9 +5451,7 @@ do "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -6669,26 +5474,24 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || -{ - $as_echo "$as_me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -6696,7 +5499,13 @@ $debug || if test -n "$CONFIG_FILES"; then -ac_cr=' ' +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' @@ -6704,7 +5513,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -6713,24 +5522,18 @@ _ACEOF echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -6738,7 +5541,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -6752,7 +5555,7 @@ s/'"$ac_delim"'$// t delim :nl h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -6766,7 +5569,7 @@ s/.\{148\}// t nl :delim h -s/\(.\{148\}\).*/\1/ +s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p @@ -6786,7 +5589,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -6818,23 +5621,29 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 -$as_echo "$as_me: error: could not setup config files machinery" >&2;} - { (exit 1); exit 1; }; } +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi @@ -6846,7 +5655,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -6858,13 +5667,11 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -6949,9 +5756,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 -$as_echo "$as_me: error: could not setup config headers machinery" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -6964,9 +5769,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 -$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} - { (exit 1); exit 1; }; };; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -6985,7 +5788,7 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -6994,12 +5797,10 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;} [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - ac_file_inputs="$ac_file_inputs '$ac_f'" + as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't @@ -7010,7 +5811,7 @@ $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. @@ -7022,10 +5823,8 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -7053,47 +5852,7 @@ $as_echo X"$ac_file" | q } s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in @@ -7145,7 +5904,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= - ac_sed_dataroot=' /datarootdir/ { p @@ -7155,12 +5913,11 @@ ac_sed_dataroot=' /@docdir@/p /@infodir@/p /@localedir@/p -/@mandir@/p -' +/@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 @@ -7170,7 +5927,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; + s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF @@ -7197,27 +5954,24 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} +which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -7226,27 +5980,21 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 -$as_echo "$as_me: error: could not create -" >&2;} - { (exit 1); exit 1; }; } + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_stamp_count=1 @@ -7283,7 +6031,7 @@ $as_echo X"$ac_file" | s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -7367,47 +6115,7 @@ $as_echo X"$file" | q } s/.*/./; q'` - { as_dir=$dirpart/$fdir - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done @@ -7418,15 +6126,12 @@ done done # for ac_tag -{ (exit 0); exit 0; } +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -7447,10 +6152,10 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi diff --git a/configure.ac b/configure.ac index f56ddd5..81d4b9c 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,7 @@ AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CC +AC_PROG_CC_C99 # Checks for header files. AC_HEADER_STDC @@ -47,7 +48,7 @@ AC_ARG_ENABLE([readline], [rl_lib=$enableval], [rl_lib=no]) if test $rl_lib = yes; then AC_DEFINE(HAVE_READLINE, 1, [Use readline library]) - READLINE_LIBS="-L/lib -lreadline" + READLINE_LIBS="-lreadline" AC_SUBST(READLINE_LIBS) fi diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..3510ab0 --- /dev/null +++ b/depcomp @@ -0,0 +1,553 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2005-05-16.16 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +ia64hp) + # The "hp" stanza above does not work with HP's ia64 compilers, + # which have integrated preprocessors. The correct option to use + # with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + tmpdepfile=`echo "$object" | sed -e 's/\.o$/.d/'` + "$@" +Maked + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + # The object file name is correct already. + cat "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${; s/^ //; s/ \\*$//; s/$/:/; p; }' "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/disk.c b/disk.c index a9a9203..a597081 100644 --- a/disk.c +++ b/disk.c @@ -19,7 +19,10 @@ */ #include -#include "machine.h" +#include +#include +#include +#include "6809.h" #include "eon.h" /* The disk drive is emulated as follows: @@ -66,17 +69,17 @@ void disk_update (struct hw_device *dev) U8 disk_read (struct hw_device *dev, unsigned long addr) { - struct disk_priv *disk = (struct disk_priv *)dev->priv; + return 0; } void disk_write (struct hw_device *dev, unsigned long addr, U8 val) { struct disk_priv *disk = (struct disk_priv *)dev->priv; - + int retvar; switch (addr) { case DSK_ADDR: - disk->ram = disk->ramdev->priv + val * SECTOR_SIZE; + disk->ram = (char*) disk->ramdev->priv + val * SECTOR_SIZE; break; case DSK_SECTOR: disk->offset = val; /* high byte */ @@ -90,7 +93,8 @@ void disk_write (struct hw_device *dev, unsigned long addr, U8 val) case DSK_CTRL: if (val & DSK_READ) { - fread (disk->ram, SECTOR_SIZE, 1, disk->fp); + retvar = fread (disk->ram, SECTOR_SIZE, 1, disk->fp); + assert(retvar != -1); } else if (val & DSK_WRITE) { @@ -136,6 +140,7 @@ void disk_format (struct hw_device *dev) struct hw_class disk_class = { + .name = "disk", .readonly = 0, .reset = disk_reset, .read = disk_read, diff --git a/eon.c b/eon.c index 9406975..5ea5a38 100644 --- a/eon.c +++ b/eon.c @@ -1,23 +1,11 @@ - #include #include "machine.h" #include "eon.h" - -extern int system_running; - - -void eon_fault (unsigned int addr, unsigned char type) -{ - if (system_running) - { - sim_error (">>> Page fault: addr=%04X type=%02X PC=%04X\n", addr, type, get_pc ()); -#if 0 - fault_addr = addr; - fault_type = type; - irq (); -#endif - } -} +#include "mmu.h" +#include "ioexpand.h" +#include "serial.h" +#include "imux.h" +#include "timer.h" /** @@ -72,17 +60,17 @@ void eon2_init (const char *boot_rom_file) Each device is allocated only 8 bytes. */ iodev = ioexpand_create (); device_define (iodev, 0, 0xFF00, 128, MAP_READWRITE); - ioexpand_attach (iodev, 0, serial_create ()); - ioexpand_attach (iodev, 1, disk_create ("disk.bin", ram_dev)); - ioexpand_attach (iodev, 2, mmudev); - ioexpand_attach (iodev, 3, intdev = imux_create (1)); + ioexpand_attach (iodev, 0, 0, serial_create ()); + ioexpand_attach (iodev, 1, 0, disk_create ("disk.bin", ram_dev)); + ioexpand_attach (iodev, 2, 0, mmudev); + ioexpand_attach (iodev, 3, 0, intdev = imux_create (1)); /* 4 = config EEPROM */ /* 5 = video display */ /* 6 = battery-backed clock */ /* 7 = power control (reboot/off) */ /* 8 = periodic timer/oscillator */ /* 9 = hostfile (for debug only) */ - ioexpand_attach (iodev, 9, hostfile_create ("hostfile", O_RDWR)); + ioexpand_attach (iodev, 9, 0, hostfile_create ("hostfile", O_RDWR)); /* etc. up to device 15 */ /* May need to define an I/O _multiplexer_ to support more than 16 devices */ @@ -106,7 +94,7 @@ void simple_init (const char *boot_rom_file) struct machine eon_machine = { .name = "eon", - .fault = eon_fault, + .fault = fault, .init = eon_init, .periodic = 0, }; @@ -114,7 +102,7 @@ struct machine eon_machine = struct machine eon2_machine = { .name = "eon2", - .fault = eon_fault, + .fault = fault, .init = eon2_init, .periodic = 0, }; @@ -122,9 +110,7 @@ struct machine eon2_machine = struct machine simple_machine = { .name = "simple", - .fault = eon_fault, + .fault = fault, .init = simple_init, .periodic = 0, }; - - diff --git a/fileio.c b/fileio.c index ac0e681..21988b8 100644 --- a/fileio.c +++ b/fileio.c @@ -1,4 +1,3 @@ - #include "6809.h" void diff --git a/imux.c b/imux.c index 3b52584..90c5bdb 100644 --- a/imux.c +++ b/imux.c @@ -20,16 +20,11 @@ /* The interrupt multiplexer */ +#include #include "machine.h" #include "eon.h" - -struct imux -{ - unsigned int in_use; /* Bits for each int that are used */ - unsigned int enabled; /* Bits for each int that is enabled */ - unsigned int pending; /* Bits for each int that are active */ - unsigned int src; /* Source line back to CPU */ -}; +#include "6809.h" +#include "imux.h" /* @@ -54,7 +49,6 @@ void imux_refresh (struct imux *mux) } } - void imux_reset (struct hw_device *dev) { struct imux *mux = (struct imux *)dev->priv; @@ -78,7 +72,6 @@ U8 imux_read (struct hw_device *dev, unsigned long addr) return -1; } - void imux_write (struct hw_device *dev, unsigned long addr, U8 val) { struct imux *mux = (struct imux *)dev->priv; @@ -116,9 +109,9 @@ void imux_assert (struct hw_device *dev, unsigned int sig) imux_refresh (mux); } - struct hw_class imux_class = { + .name = "imux", .readonly = 0, .reset = imux_reset, .read = imux_read, @@ -131,5 +124,3 @@ struct hw_device *imux_create (unsigned int cpu_line) imux->src = cpu_line; return device_attach (&imux_class, BUS_MAP_SIZE, imux); } - - diff --git a/imux.h b/imux.h new file mode 100644 index 0000000..615f98e --- /dev/null +++ b/imux.h @@ -0,0 +1,57 @@ +/* + * Copyright 2009 by Brian Dominy + * + * This file is part of GCC6809. + * + * GCC6809 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GCC6809 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GCC6809; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* The interrupt multiplexer */ + +#ifndef IMUX_H +#define IMUX_H + +struct imux +{ + unsigned int in_use; /* Bits for each int that are used */ + unsigned int enabled; /* Bits for each int that is enabled */ + unsigned int pending; /* Bits for each int that are active */ + unsigned int src; /* Source line back to CPU */ +}; + + +/* + * Refresh the state of the interrupt line back to the CPU. + * src == 1 refers to IRQ, src == 2 for FIRQ. + */ +void imux_refresh (struct imux *mux); +void imux_reset (struct hw_device *dev); +U8 imux_read (struct hw_device *dev, unsigned long addr); +void imux_write (struct hw_device *dev, unsigned long addr, U8 val); + +/* + * Register an interrupt line with the multiplexer. + * This just tracks which ones are in use. + */ +void imux_register (struct hw_device *dev, unsigned int sig); + +/* + * Assert an edge-triggered interrupt line. + */ +void imux_assert (struct hw_device *dev, unsigned int sig); + +struct hw_device *imux_create (unsigned int cpu_line); + +#endif diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..4d4a951 --- /dev/null +++ b/install-sh @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2005-05-14.22 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/internals.txt b/internals.txt new file mode 100644 index 0000000..a08ff90 --- /dev/null +++ b/internals.txt @@ -0,0 +1,174 @@ +Introduction +------------ + +exec09 has several pre-defined "machines" and it is quite easy to +define new ones. + +The 6809 processor can access a 16-bit address space and defining a +machine involves defining what is in the address space. + +The address space is populated by a set of "devices". Consider the +imaginary machine foo. The machine is initialised by foo_init() and +that routine contains a series of calls to device_define(). + +Each device is an instance of a certain "class". There are pre-defined +classes for RAM, ROM, console-io and some others. + +Address decoding +---------------- + +The 16-bit address space is divided into regions of size +BUS_MAP_SIZE. This is 128 by default, meaning that the address space +is divided into 512 pieces each of which is described by a struct bus_map. + +There is an array (busmaps[]) of struct bus_map. For a particular +memory access, the array is indexed by the top 9 bits of the 16-bit +address. + +This description will start by considering the simple case, and move +on to describe ways to handle more complex situations. + +Ignore I/O for the moment and consider that our imaginary machine foos +is populated with RAM from 0-0x3ff and a ROM from 0xe000-0xfff. + +The machine initialisation, foo_init, will: + +- create, attach and initialise the RAM device +- create, attach and initialise the ROM device +- map the RAM device +- map the ROM device. + +Creating the device allocates storage to it. Attaching the device (to +the bus) assigns an ordinal number, "devid" to the device which is used +as its index in the device_table[]. The device_table stores hw_device +struct. + +Mapping the device involves populating entries in busmaps[]. After +reset, each entry in busmaps[] references a device of class +null_class. This is responsible for generating non-existent memory +exception in response to a read or write (this also means that the +address space read/write routines don't need to do any check of +address parameters or return values). + +Our 1kbyte RAM mapped at address 0 will occupy 1024/128=8 locations in +busmaps[]; busmaps[0]..busmaps[7] will each map to different offsets +in the same device. + +bus_map() (called by device_define()) stores the devid, offset and +flags in each of the busmaps[] entries. + +One of the final steps in machine initialisation is to make a copy of +busmaps[] into default_busmaps[]. During run-time, it is possible to +call bus_map() again to change the mapping of an address region or to +call bus_unmap() to restore the mapping of an address region to its +original start-up value. + +TODO bus_unmap is a bad name, and it is not used anywhere. + +TODO the null device is created automatically but not used +automatically. Instead, value 0xFF means unmapped. + +Special address decoding 1: windowing +------------------------------------- + +In the simple case, a device will be fully mapped into a region of the +16-bit CPU address space. However, this need not be the +case. device_define() takes arguments "offset", "addr", "len". This +allows a sub-set of a device (a window of size "len") to be exposed in +the CPU address space starting at address "addr". The CPU address +"addr" will correspond to offset "offset" from the start of storage +provided by the device. + +The intention here is that a machine will implement control registers +that can control the window (eg, an I/O device that supplies modified +value of "offset"). Each map entry (ie, each 128-byte region) has its +own independent value of "offset" and so there can be an arbitrary +remapping on 128-byte boundaries. + +Special address decoding 2: simple overlay +------------------------------------------ + +If you make multiple calls to device_define() with overlapping address +assignments, the later calls will overwrite the earlier ones. You can +take advantage of this to "carve a hole" in the address space of a +large device in order to insert a small device -- provided that device +occupies a multiple of 128 locations. For example, a ROM at the top +of the address space but with a device defined over the top of it to +carve a hole from 0xff00-0xff7f for I/O devices, but still providing +ROM at 0xff80-0xffff (for the exception vectors). In this case, simply +define the I/O device after the ROM device. + +Special address decoding 3: io expander +--------------------------------------- + +Sometimes, 128 locations (the default minimum resolution of address +space decode) is too coarse. One way to make efficient use of it is to +use a device of class ioexpand_class. This breaks a 128-byte region +into 16, 8-byte "slots" each of which can be associated with a +different device. + +It's also possible to map slots to ROM and RAM devices so that a +device can "carve a hole" of 8 bytes in a ROM or RAM. Look at the +definition of multicomp09 to see an example of this. + +TODO restriction: implementation in sparse_io only allows 1 busmap[] +entry, ie it is restricted to an address range of BUS_MAP_SIZE (128 +bytes). + +TODO code and add an example. + +TODO note that, using ioexpand, the ioexpander itself needs to have +permissive access. Is the access of the lower-level device honoured? +Access check seems to work in two ways: first the map access is +checked an then (maybe) the device iteself checks access. That seems a +bit messy. + +Image Loading +------------- + +When exec09 starts up, the memory is empty. You can use a command-line +argument to pre-load an image to memory. + +You can load an image in binary format, s-record format in intel-hex +format. The command-line default is to load an s-record file (TODO +there may be no way to specify a hex file currently even though all +the code is in place to allow it). + +s-record and intel-hex files contain addressing information and so +they can write to arbitrary (and potentially non-contiguous) regions +of address space. When data is loaded in one of these file formats: + +- it is loaded after the machine has been initialised +- it is written to memory byte-by-byte as though by the 6809 CPU + (the 16-bit address space is exactly as seen by the CPU). +- any attempt to write to non-existent or non-writeable memory will + result in an access violation being reported. + +To load a binary file it must be specified using the "-b" command-line +option. You can only load a binary file if your machine contains a ROM +device and (unless you have coded your machine specifically) you can +only load a single ROM device. + +Unlike an s-record or intel-hex file, a binary file is loaded as part +of machine initialisation and is loaded directly by the ROM +device. There are no access checks: the device is loaded even if it is +normally read-only. Since a binary file contains no addressing +information it is loaded to incrementing byte locations starting at +offset 0 in the ROM device; in fact, the ROM device is created to be +of the exact size needed to hold the binary image; this may be +smaller, larger or identical in size to the space assigned to the ROM +device in the machine's address space. + +TODO how does an s-rec file load to ROM if, as I stated above, the +normal access checks occur? (maybe it doesn't, since I did my "bug fix") + +TODO if, as I explained above, a ROM is exactly the size of its +binary, how can the ROM exist other than when pre-loaded from an image +(but I know that it can be loaded from srec..). + + + + +NEXT + +different/wider address spaces, why what for and how. diff --git a/ioexpand.c b/ioexpand.c index 25e99d3..27fb436 100644 --- a/ioexpand.c +++ b/ioexpand.c @@ -21,25 +21,21 @@ #include #include #include "machine.h" +#include "ioexpand.h" +#include "6809.h" -/* An I/O expander allows a single, 128-byte region to be shared among multiple -devices. It subdivides the region into 16 8-byte subdevices. It is needed -to work around the inability of the system bus to handle attaching devices -less than 128 bytes wide. */ -#define NR_IOEXPAND 16 -#define IO_WINDOW 8 - -struct ioexpand -{ - struct hw_device *ios[NR_IOEXPAND]; -}; +/* An I/O expander subdivides a single, 128-byte region into 16, 8-byte slots each +of which can hold a device. It is needed to work around the inability of the system +bus to handle attaching devices less than 128 bytes in size. +When mapping a slot, an offset can be applied to the underlying device. An example application is to make the I/O expander occupy fewer than 128 bytes by mapping one or more slots to a large underlying ROM. */ -void ioexpand_attach (struct hw_device *expander_dev, int slot, struct hw_device *io_dev) +void ioexpand_attach (struct hw_device *expander_dev, int slot, unsigned long offset, struct hw_device *io_dev) { struct ioexpand *iom = (struct ioexpand *)expander_dev->priv; iom->ios[slot] = io_dev; + iom->offset[slot] = offset; } void ioexpand_reset (struct hw_device *dev) @@ -56,23 +52,30 @@ void ioexpand_reset (struct hw_device *dev) U8 ioexpand_read (struct hw_device *dev, unsigned long addr) { struct ioexpand *iom = (struct ioexpand *)dev->priv; - dev = iom->ios[addr / IO_WINDOW]; + int slot = addr / IO_WINDOW; + dev = iom->ios[slot]; if (!dev) sim_error ("expander read from %04X has no backing device\n", addr); - return dev->class_ptr->read (dev, addr % IO_WINDOW); + + addr = (addr % IO_WINDOW) + iom->offset[slot]; + return dev->class_ptr->read (dev, addr); } void ioexpand_write (struct hw_device *dev, unsigned long addr, U8 val) { struct ioexpand *iom = (struct ioexpand *)dev->priv; - dev = iom->ios[addr / IO_WINDOW]; + int slot = addr / IO_WINDOW; + dev = iom->ios[slot]; if (!dev) sim_error ("expander write %02X to %04X has no backing device\n", val, addr); - dev->class_ptr->write (dev, addr % IO_WINDOW, val); + + addr = (addr % IO_WINDOW) + iom->offset[slot]; + dev->class_ptr->write (dev, addr, val); } struct hw_class ioexpand_class = { + .name = "ioexpand", .readonly = 0, .reset = ioexpand_reset, .read = ioexpand_read, @@ -83,7 +86,9 @@ struct hw_device *ioexpand_create (void) { int i; struct ioexpand *iom = malloc (sizeof (struct ioexpand)); - for (i=0; i < NR_IOEXPAND; i++) + for (i=0; i < NR_IOEXPAND; i++) { iom->ios[i] = NULL; + iom->offset[i] = 0; + } return device_attach (&ioexpand_class, BUS_MAP_SIZE, iom); } diff --git a/ioexpand.h b/ioexpand.h new file mode 100644 index 0000000..3ad0124 --- /dev/null +++ b/ioexpand.h @@ -0,0 +1,50 @@ +/* + * Copyright 2009 by Brian Dominy + * + * This file is part of GCC6809. + * + * GCC6809 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GCC6809 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GCC6809; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef IOEXPAND_H +#define IOEXPAND_H + +/* An I/O expander subdivides a single, 128-byte region into 16, 8-byte slots + each of which can hold a device. It is needed to work around the inability + of the system bus to handle attaching devices less than 128 bytes in size. + + When mapping a slot, an offset can be applied to the underlying device. An + example application is to make the I/O expander occupy fewer than 128 bytes + by mapping one or more slots to a large underlying ROM. + */ + + +#define NR_IOEXPAND 16 +#define IO_WINDOW 8 + +struct ioexpand +{ + struct hw_device *ios[NR_IOEXPAND]; + unsigned long offset[NR_IOEXPAND]; +}; + +struct hw_device *ioexpand_create (void); +void ioexpand_attach (struct hw_device *expander_dev, int slot, unsigned long offset, struct hw_device *io_dev); +void ioexpand_reset (struct hw_device *dev); +U8 ioexpand_read (struct hw_device *dev, unsigned long addr); +void ioexpand_write (struct hw_device *dev, unsigned long addr, U8 val); +struct hw_device *ioexpand_create (void); + +#endif diff --git a/machine.c b/machine.c index bfaafcc..2001a1f 100644 --- a/machine.c +++ b/machine.c @@ -18,11 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include #include #include "machine.h" +#include "command.h" +#include "monitor.h" #include "6809.h" #include "eon.h" @@ -30,9 +31,7 @@ #define MISSING 0xff #define mmu_device (device_table[0]) -extern void eon_init (const char *); -extern void wpc_init (const char *); - +extern FILE *log_file; struct machine *machine; unsigned int device_count = 0; @@ -48,21 +47,22 @@ U16 fault_addr; U8 fault_type; -int system_running = 0; - +/* set after CPU reset and never cleared; shows that + system initialisation has completed */ +int cpu_running = 0; void cpu_is_running (void) { - system_running = 1; + cpu_running = 1; } void do_fault (unsigned int addr, unsigned int type) { - if (system_running) + if (cpu_running) machine->fault (addr, type); } - +// nac never used. void exit_fault (unsigned int addr, unsigned int type) { monitor_on = debug_enabled; @@ -70,7 +70,6 @@ void exit_fault (unsigned int addr, unsigned int type) exit (1); } - /** * Attach a new device to the bus. Only called during init. */ @@ -86,8 +85,7 @@ struct hw_device *device_attach (struct hw_class *class_ptr, unsigned int size, /* Attach implies reset */ class_ptr->reset (dev); return dev; -}; - +} /** * Map a portion of a device into the CPU's address space. @@ -104,8 +102,8 @@ void bus_map (unsigned int addr, /* Warn if trying to map too much */ if (addr + len > MAX_CPU_ADDR) { - fprintf (stderr, "warning: mapping %04X bytes into %04X causes overflow\n", - len, addr); + fprintf(stderr, "warning: mapping %04X bytes into %04X causes overflow\n", + len, addr); } /* Round address and length to be multiples of the map unit size. */ @@ -140,13 +138,11 @@ void device_define (struct hw_device *dev, unsigned int flags) { /* Note: len must be a multiple of BUS_MAP_SIZE */ - bus_map (addr, dev->devid, offset, len, flags); + bus_map(addr, dev->devid, offset, len, flags); } - void bus_unmap (unsigned int addr, unsigned int len) { - struct bus_map *map; unsigned int start, count; /* Round address and length to be multiples of the map unit size. */ @@ -162,7 +158,6 @@ void bus_unmap (unsigned int addr, unsigned int len) sizeof (struct bus_map) * count); } - /** * Generate a page fault. ADDR says which address was accessed * incorrectly. TYPE says what kind of violation occurred. @@ -184,32 +179,69 @@ static struct hw_device *find_device (unsigned int addr, unsigned char id) return device_table[id]; } - -void -print_device_name (unsigned int devno) +void print_device_name (unsigned int devno) { - struct hw_device *dev = device_table[devno]; printf ("%02X", devno); } - -absolute_address_t -absolute_from_reladdr (unsigned int device, unsigned long reladdr) +absolute_address_t absolute_from_reladdr (unsigned int device, unsigned long reladdr) { return (device * 0x10000000L) + reladdr; } - U8 abs_read8 (absolute_address_t addr) { - unsigned int id = addr >> 28; - unsigned long phy_addr = addr & 0xFFFFFFF; - struct hw_device *dev = device_table[id]; + // nac come here on dbg examine. Core dump on access to nxm. + // nac what is "id" and how is it extracted from top 4 bits and + // why does this need addr to be 64 bits? + unsigned int id = addr >> 28; + unsigned long phy_addr = addr & 0xFFFFFFF; + // printf("In abs_read8 with address 0x%x, id 0x%x and phy_addr 0x%x\n",addr,id,phy_addr); + // nac BUG! should not be doing this directly: + // an attempt to access a non-existent location (a location whose device ID is FF) + // results in an attempt to access a non-existent value in the device_table. + // Actually it's doubly bad: there are 32 devices (max) but access to non-existent + // device seems to yield an ID of 0xf rather than 0xff which, based on the 28-bit + // shift, implies that the address was bad in the first place: it only had f instead of ff + // In any case, the table should not be indexed with f or ff becasue neither are valid + // devices. + // BUT! my "fix" below is bad; the fault gets reported 2ce and + // the data value gets reported as a 32-bit value instead of a U8 + // eg, if null_read is set up to return 0xab it returns 0xffffffab + // and if it's set up to return 0x3b it returns 0x3b -- ie, it is + // being sign extended. Not sure why, though, becasue it looks identical + // to the normal read; must be due to a path taken in the error handling? + // + // 2 scenarios: access to 0:0 ie direct access device 0 even though + // that device is not mapped into the bus anywhere. Currently does not + // report any error but does return 0xffffffff (sign extended). Not reporting an error + // is fine (I suppose) because the access is not really being checked + // -- it doesn't correspond to a CPU address. + // Other scenario is access to 0x7c80 in smii. This is a real CPU + // address but is mapped to a non-existent device. Currently get 2 + // errors reported: the first is due to an access through cpu_read8 + // and the error is a page fault, address 0x7c80 -- the error is + // triggered by a check of the map entry. The second is due + // to an access through abs_read8 and the error is a page fault, + // address 0xf000.0000 -- thinks it's device 0xff but truncated. + // For this one the data comes back as 0xffffffff (sign-extended). + // + // Maybe need to switch to using CPU addresses everywhere user-facing + // and allow device:offset addressing only on the command line? + // + // Another option that might help a fix is to switch to initialising + // the map with device 0 rather than with non-such-device. Then, + // no-such-device can be a more fatal error... + + // orig: -- core dumps!! + //struct hw_device *dev = device_table[id]; + // replacement: -- still not right. + struct hw_device *dev = find_device (addr, id); + struct hw_class *class_ptr = dev->class_ptr; return (*class_ptr->read) (dev, phy_addr); } - /** * Called by the CPU to read a byte. * This is the bottleneck in terms of performance. Consider @@ -225,7 +257,7 @@ U8 cpu_read8 (unsigned int addr) struct hw_class *class_ptr = dev->class_ptr; unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE; - if (system_running && !(map->flags & MAP_READABLE)) + if (cpu_running && !(map->flags & MAP_READABLE)) machine->fault (addr, FAULT_NOT_READABLE); command_read_hook (absolute_from_reladdr (map->devid, phy_addr)); return (*class_ptr->read) (dev, phy_addr); @@ -238,89 +270,171 @@ U16 cpu_read16 (unsigned int addr) struct hw_class *class_ptr = dev->class_ptr; unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE; - if (system_running && !(map->flags & MAP_READABLE)) + if (cpu_running && !(map->flags & MAP_READABLE)) do_fault (addr, FAULT_NOT_READABLE); command_read_hook (absolute_from_reladdr (map->devid, phy_addr)); return ((*class_ptr->read) (dev, phy_addr) << 8) | (*class_ptr->read) (dev, phy_addr+1); } - /** * Called by the CPU to write a byte. */ void cpu_write8 (unsigned int addr, U8 val) { + //printf("write 0x%04x<-0x%02x\n", addr, val); + //fprintf(log_file,"wr 0x%04x<-0x%02x\n", addr, val); struct bus_map *map = find_map (addr); struct hw_device *dev = find_device (addr, map->devid); struct hw_class *class_ptr = dev->class_ptr; unsigned long phy_addr = map->offset + addr % BUS_MAP_SIZE; - if (system_running && !(map->flags & MAP_WRITABLE)) + /* Unlike the read case, where we still return data on + an access error, ignore write data on access error. + The cpu_running check allows ROMs to be loaded at + startup (but maybe it would be better if ROM load + used absolute access so that this routine was not + used at all for that purpose) */ + if (!cpu_running || (map->flags & MAP_WRITABLE)) + { + (*class_ptr->write) (dev, phy_addr, val); + } + else if (map->flags & MAP_IGNOREWRITE) + { + /* silently ignore the write */ + } + else if (cpu_running) + { do_fault (addr, FAULT_NOT_WRITABLE); - (*class_ptr->write) (dev, phy_addr, val); - command_write_hook (absolute_from_reladdr (map->devid, phy_addr), val); + } + /* do this regardless (may trigger watchpoint) */ + command_write_hook (absolute_from_reladdr (map->devid, phy_addr), val); } void abs_write8 (absolute_address_t addr, U8 val) { - unsigned int id = addr >> 28; - unsigned long phy_addr = addr & 0xFFFFFFF; + unsigned int id = addr >> 28; + unsigned long phy_addr = addr & 0xFFFFFFF; struct hw_device *dev = device_table[id]; struct hw_class *class_ptr = dev->class_ptr; - class_ptr->write (dev, phy_addr, val); + class_ptr->write(dev, phy_addr, val); } - - -absolute_address_t -to_absolute (unsigned long cpuaddr) +absolute_address_t to_absolute (unsigned long cpuaddr) { + /* if it's greater than 0xffff, it's already absolute + and we cannot convert it again. If it's less than + 0x10000 it might already be absolute but it's safe + to convert it a second time. + */ + if (cpuaddr > 0xffff) return (absolute_address_t)cpuaddr; + struct bus_map *map = find_map (cpuaddr); - struct hw_device *dev = find_device (cpuaddr, map->devid); unsigned long phy_addr = map->offset + cpuaddr % BUS_MAP_SIZE; return absolute_from_reladdr (map->devid, phy_addr); } -void dump_machine (void) +// Dump machine (if supported) +void dump_machine(void) +{ + if (machine->dump) { + machine->dump(); + } + else { + printf("This machine does not provide a dump capability\n"); + } +} + +// Describe machine, devices and mapping. +void describe_machine (void) { + unsigned int devno; unsigned int mapno; - unsigned int n; + unsigned int prev_devid = -1; + unsigned int prev_offset = 0; + unsigned int prev_flags = 0; + unsigned int dot_dot = 0; + + /* machine */ + printf("Machine: %s\n", machine->name); + + /* devices */ + for (devno = 0; devno < device_count; devno++) + { + printf("Device %2d: %s\n",devno, device_table[devno]->class_ptr->name); + } + /* mapping */ for (mapno = 0; mapno < NUM_BUS_MAPS; mapno++) { struct bus_map *map = &busmaps[mapno]; - printf ("Map %d addr=%04X dev=%d offset=%04X size=%06X flags=%02X\n", - mapno, mapno * BUS_MAP_SIZE, map->devid, map->offset, - 0 /* device_table[map->devid]->size */, map->flags); + if ( (map->devid == prev_devid) && (map->flags == prev_flags) && + ((map->offset == prev_offset) || (map->devid == INVALID_DEVID)) ) + { + /* nothing interesting to report */ + if (! dot_dot) + { + printf("..\n"); + dot_dot = 1; + } + } + else + { + dot_dot = 0; + printf ("Map %3d: addr=%04X dev=%d offset=%04lX size=%06lX flags=%02X\n", + mapno, mapno * BUS_MAP_SIZE, map->devid, map->offset, + device_table[map->devid]->size, map->flags); + } + /* ready for next time */ + prev_devid = map->devid; + prev_offset = map->offset + BUS_MAP_SIZE; + prev_flags = map->flags; + } +} + +/********************************************************** + * Simple fault handler + **********************************************************/ +void fault (unsigned int addr, unsigned char type) +{ + if (cpu_running) + { + sim_error (">>> Page fault: addr=%04X type=%02X PC=%04X\n", addr, type, get_pc ()); #if 0 - for (n = 0; n < BUS_MAP_SIZE; n++) - printf ("%02X ", cpu_read8 (mapno * BUS_MAP_SIZE + n)); - printf ("\n"); + fault_addr = addr; + fault_type = type; + irq (); #endif } } - /**********************************************************/ void null_reset (struct hw_device *dev) { + (void) dev; // silence warning unused parameter } U8 null_read (struct hw_device *dev, unsigned long addr) { + (void) dev; // silence warning unused parameter + (void) addr; + return 0xFF; } void null_write (struct hw_device *dev, unsigned long addr, U8 val) { + (void) dev; // silence warning unused parameter + (void) addr; + (void) val; } struct hw_class null_class = { + .name = "null-device", .readonly = 0, .reset = null_reset, .read = null_read, @@ -332,7 +446,6 @@ struct hw_device *null_create (void) return device_attach (&null_class, 0, NULL); } - /**********************************************************/ void ram_reset (struct hw_device *dev) @@ -354,6 +467,7 @@ void ram_write (struct hw_device *dev, unsigned long addr, U8 val) struct hw_class ram_class = { + .name = "RAM", .readonly = 0, .reset = ram_reset, .read = ram_read, @@ -370,13 +484,13 @@ struct hw_device *ram_create (unsigned long size) struct hw_class rom_class = { + .name = "ROM", .readonly = 1, .reset = null_reset, .read = ram_read, .write = ram_write, }; - struct hw_device *rom_create (const char *filename, unsigned int maxsize) { FILE *fp; @@ -385,7 +499,7 @@ struct hw_device *rom_create (const char *filename, unsigned int maxsize) char *buf; if (filename) - { + { fp = file_open (NULL, filename, "rb"); if (!fp) return NULL; @@ -440,10 +554,12 @@ void console_write (struct hw_device *dev, unsigned long addr, U8 val) struct hw_class console_class = { + .name = "console", .readonly = 0, .reset = null_reset, .read = console_read, .write = console_write, + .update = NULL, }; struct hw_device *console_create (void) @@ -453,7 +569,6 @@ struct hw_device *console_create (void) /**********************************************************/ - U8 mmu_regs[MMU_PAGECOUNT][MMU_PAGEREGS]; U8 mmu_read (struct hw_device *dev, unsigned long addr) @@ -512,7 +627,7 @@ void mmu_reset_complete (struct hw_device *dev) { map = &busmaps[4 + page * (MMU_PAGESIZE / BUS_MAP_SIZE)]; mmu_regs[page][0] = map->devid; - mmu_regs[page][1] = map->offset / MMU_PAGESIZE; + mmu_regs[page][1] = (U8) (map->offset / MMU_PAGESIZE); mmu_regs[page][2] = map->flags & MAP_READWRITE; /* printf ("%02X %02X %02X\n", map->devid, map->offset / MMU_PAGESIZE, @@ -520,9 +635,9 @@ void mmu_reset_complete (struct hw_device *dev) } } - struct hw_class mmu_class = { + .name = "mmu", .readonly = 0, .reset = mmu_reset, .read = mmu_read, @@ -534,7 +649,6 @@ struct hw_device *mmu_create (void) return device_attach (&mmu_class, BUS_MAP_SIZE, NULL); } - /**********************************************************/ void machine_update (void) @@ -559,13 +673,15 @@ int machine_match (const char *machine_name, const char *boot_rom_file, struct m return 0; } - void machine_init (const char *machine_name, const char *boot_rom_file) { extern struct machine simple_machine; extern struct machine eon_machine; extern struct machine eon2_machine; extern struct machine wpc_machine; + extern struct machine smii_machine; + extern struct machine multicomp09_machine; + extern struct machine kipper1_machine; int i; /* Initialize CPU maps, so that no CPU addresses map to @@ -579,6 +695,9 @@ void machine_init (const char *machine_name, const char *boot_rom_file) else if (machine_match (machine_name, boot_rom_file, &eon_machine)); else if (machine_match (machine_name, boot_rom_file, &eon2_machine)); else if (machine_match (machine_name, boot_rom_file, &wpc_machine)); + else if (machine_match (machine_name, boot_rom_file, &smii_machine)); + else if (machine_match (machine_name, boot_rom_file, &multicomp09_machine)); + else if (machine_match (machine_name, boot_rom_file, &kipper1_machine)); else exit (1); /* Save the default busmap configuration, before the diff --git a/machine.h b/machine.h index 89b9358..8ced6a2 100644 --- a/machine.h +++ b/machine.h @@ -42,6 +42,10 @@ typedef unsigned long absolute_address_t; #define MAP_WRITABLE 0x2 #define MAP_READWRITE 0x3 +/* Usually, an attempt to write without MAP_WRITABLE will cause a fault. + This allows a write and the data silently ignored (no fault) */ +#define MAP_IGNOREWRITE 0x8 + /* A fixed map cannot be reprogrammed. Attempts to bus_map something differently will silently be ignored. */ @@ -88,6 +92,9 @@ a single "ROM" class and multiple ROM device objects. */ struct hw_class { + /* Descriptive */ + char *name; + /* Nonzero if the device is readonly */ int readonly; @@ -138,6 +145,8 @@ struct machine void (*fault) (unsigned int addr, unsigned char type); void (*dump_thread) (unsigned int thread_id); void (*periodic) (void); + void (*dump) (void); + void (*tick) (void); unsigned long cycles_per_sec; }; @@ -148,4 +157,32 @@ struct hw_device *rom_create (const char *filename, unsigned int maxsize); struct hw_device *console_create (void); struct hw_device *disk_create (const char *backing_file, struct hw_device *ram_dev); +void fault (unsigned int addr, unsigned char type); +U8 ram_read (struct hw_device *dev, unsigned long addr); +U8 cpu_read8 (unsigned int addr); +U16 cpu_read16 (unsigned int addr); +void cpu_write8 (unsigned int addr, U8 val); +U8 abs_read8 (absolute_address_t addr); +void abs_write8 (absolute_address_t addr, U8 val); +void cpu_is_running (void); +void machine_init (const char *machine_name, const char *boot_rom_file); +absolute_address_t to_absolute (unsigned long cpuaddr); +void dump_machine(void); +void describe_machine (void); +void machine_update (void); +void print_device_name (unsigned int devno); +void device_define (struct hw_device *dev, + unsigned long offset, + unsigned int addr, + unsigned int len, + unsigned int flags); +void bus_map (unsigned int addr, + unsigned int devid, + unsigned long offset, + unsigned int len, + unsigned int flags); +void bus_unmap (unsigned int addr, unsigned int len); +struct hw_device *mmu_create (void); +struct hw_device *null_create (void); + #endif /* _M6809_MACHINE_H */ diff --git a/main.c b/main.c index 01e06e2..8ffa5d9 100644 --- a/main.c +++ b/main.c @@ -21,11 +21,13 @@ #include +#include +#include #include "6809.h" - -enum -{ HEX, S19, BIN }; - +#include "command.h" +#include "symtab.h" +#include "machine.h" +#include "monitor.h" /* The total number of cycles that have executed */ unsigned long total = 0; @@ -33,13 +35,11 @@ unsigned long total = 0; /* The frequency of the emulated CPU, in megahertz */ unsigned int mhz = 1; -/* When nonzero, indicates that the IRQ should be triggered periodically, -every so many cycles. By default no periodic IRQ is generated. */ -unsigned int cycles_per_irq = 0; - -/* When nonzero, indicates that the FIRQ should be triggered periodically, -every so many cycles. By default no periodic FIRQ is generated. */ -unsigned int cycles_per_firq = 0; +/* When nonzero, indicates that the machine's tick routine should be + triggered periodically, every so many cycles. Typically this is + used by the machine to generate a timer interrupt. Off By default. +*/ +unsigned int cycles_per_tick = 0; /* Nonzero if debugging support is turned on */ int debug_enabled = 0; @@ -47,13 +47,16 @@ int debug_enabled = 0; /* Nonzero if tracing is enabled */ int trace_enabled = 0; +/* Nonzero if SWI2 should be reported with a postbyte */ +int os9call = 0; + /* When nonzero, causes the program to print the total number of cycles on a successful exit. */ int dump_cycles_on_success = 0; /* When nonzero, indicates the total number of cycles before an automated exit. This is to help speed through test cases that never finish. */ -unsigned long max_cycles = 500000000UL; +int max_cycles = INT_MAX; /* When nonzero, says that the state of the machine is persistent across runs of the simulator. */ @@ -63,7 +66,7 @@ int machine_persistent = 0; processor would run like. */ int machine_realtime = 0; -static int type = S19; +static int binary = 0; char *exename; @@ -136,8 +139,7 @@ idle_loop (void) if (total_ms_elapsed > 100) { total_ms_elapsed -= 100; - if (machine->periodic) - machine->periodic (); + if (machine->periodic) machine->periodic (); command_periodic (); } @@ -169,8 +171,8 @@ struct option const char *help; unsigned int can_negate : 1; unsigned int takes_arg : 1; - int *int_value; - int default_value; + int *int_value; + int default_value; /* value to set if option is present */ const char **string_value; int (*handler) (const char *arg); } option_table[] = { @@ -179,22 +181,22 @@ struct option { 'h', "help", NULL, NO_NEG, NO_ARG, NULL, 0, 0, do_help }, { 'b', "binary", "", - NO_NEG, NO_ARG, &type, BIN, NULL, NULL }, + NO_NEG, NO_ARG, &binary, 1, NULL, NULL }, { 'M', "mhz", "", NO_NEG, HAS_ARG }, { '-', "68a09", "Emulate the 68A09 variation (1.5Mhz)" }, { '-', "68b09", "Emulate the 68B09 variation (2Mhz)" }, { 'R', "realtime", "Limit simulation speed to match realtime", HAS_NEG, NO_ARG, &machine_realtime, 0, NULL, NULL }, - { 'I', "irqfreq", "Asserts an IRQ every so many cycles automatically", - NO_NEG, HAS_ARG, &cycles_per_irq, 0, NULL, NULL }, - { 'F', "firqfreq", "Asserts an FIRQ every so many cycles automatically", - NO_NEG, HAS_ARG, &cycles_per_firq, 0, NULL, NULL }, + { 'I', "tIckfreq", "Automatically calls the machine's tick every so many cycles", + NO_NEG, HAS_ARG, &cycles_per_tick, 0, NULL, NULL }, { 'C', "cycledump", "", HAS_NEG, NO_ARG, &dump_cycles_on_success, 1, NULL, NULL}, + { 'o', "os9call", "Treat SWI2 as an OS9/NitrOS9 system call and report postbyte", + HAS_NEG, NO_ARG, &os9call, 1, NULL, NULL}, { 't', "loadmap", "" }, { 'T', "trace", "", NO_NEG, NO_ARG, &trace_enabled, 1, NULL, NULL }, - { 'm', "maxcycles", "Sets maximum number of cycles to run", + { 'm', "maxcycles", "Set maximum number of cycles to run (0 to disable)", NO_NEG, HAS_ARG, &max_cycles, 0, NULL, NULL }, { 's', "machine", "Specify the machine (exact hardware) to emulate", NO_NEG, HAS_ARG, NULL, 0, &machine_name, NULL }, @@ -268,7 +270,9 @@ process_option (struct option *opt, const char *arg) else { if (arg) + { //printf (" Takes no argument but one given, ignored.\n"); + } if (opt->int_value) { @@ -290,7 +294,7 @@ process_option (struct option *opt, const char *arg) } -int +void process_plain_argument (const char *arg) { //printf ("plain argument '%s'\n", arg); @@ -299,7 +303,7 @@ process_plain_argument (const char *arg) } -int +void parse_args (int argc, char *argv[]) { int argn = 1; @@ -360,12 +364,7 @@ parse_args (int argc, char *argv[]) int main (int argc, char *argv[]) { - int off = 0; - int i, j, n; - int argn = 1; - unsigned int loops = 0; - - gettimeofday (&time_started, NULL); + gettimeofday (&time_started, NULL); exename = argv[0]; /* TODO - enable different options by default @@ -375,25 +374,18 @@ main (int argc, char *argv[]) sym_init (); - switch (type) + if (binary) { - case HEX: - if (prog_name && load_hex (prog_name)) - usage (); - break; - - case S19: - /* The machine loader cannot deal with S-record files. - So initialize the machine first, passing it a NULL - filename, then load the S-record file afterwards. */ - machine_init (machine_name, NULL); - if (prog_name && load_s19 (prog_name)) - usage (); - break; - - default: - machine_init (machine_name, prog_name); - break; + machine_init (machine_name, prog_name); + } + else + { + /* The machine loader cannot deal with image files, + so initialize the machine first, passing it a NULL + filename, then load the image file afterwards. */ + machine_init (machine_name, NULL); + if (prog_name && load_image (prog_name)) + usage (); } /* Try to load a map file */ @@ -402,44 +394,42 @@ main (int argc, char *argv[]) /* Enable debugging if no executable given yet. */ if (!prog_name) + { debug_enabled = 1; + } else + { /* OK, ready to run. Reset the CPU first. */ cpu_reset (); + } monitor_init (); command_init (); - keybuffering (0); + keybuffering_defaults (); + keybuffering (0); /* Now, iterate through the instructions. - * If no IRQs or FIRQs are enabled, we can just call cpu_execute() - * and let it run for a long time; otherwise, we need to come back - * here periodically and do the interrupt handling. */ + Without -I, we can just call cpu_execute() and let it run + for a long time; otherwise, we need to come back here + periodically and call the machine's ->tick() routine */ + //[NAC HACK 2017Mar30] need to schedule this properly instead of this one-or-the-other approach + //.. need to track the rate of each and work out who's next. for (cpu_quit = 1; cpu_quit != 0;) { - if ((cycles_per_irq == 0) && (cycles_per_firq == 0)) + /* Call each device that needs periodic processing. */ + machine_update (); + + if (cycles_per_tick == 0) { /* Simulate some CPU time, either 1ms worth or up to the - next possible IRQ */ + next possible tick */ total += cpu_execute (mhz * 1024); - /* Call each device that needs periodic processing. */ - machine_update (); } else { - total += cpu_execute (cycles_per_irq); - /* TODO - this assumes periodic interrupts (WPC) */ - request_irq (0); - { - /* TODO - FIRQ frequency not handled yet */ - static int firq_freq = 0; - if (++firq_freq == 8) - { - request_firq (0); - firq_freq = 0; - } - } + total += cpu_execute (cycles_per_tick); + if (machine->tick) machine->tick (); } idle_loop (); @@ -453,5 +443,6 @@ main (int argc, char *argv[]) } sim_exit (0); + keybuffering (1); return 0; } diff --git a/miscsbc.c b/miscsbc.c new file mode 100644 index 0000000..a2bd08d --- /dev/null +++ b/miscsbc.c @@ -0,0 +1,1117 @@ +#include +#include +#include "machine.h" +#include "6809.h" +#include "ioexpand.h" +#include "command.h" + +// for smii console +int smii_i_avail = 1; +int smii_o_busy = 0; + +// for multicomp09 Rx FIFO +#define CharFIFO_SIZE (8) +// for multicomp09 sdmapper: values most-recently written to these registers +#define MULTICOMP09_RAMMAX (0x80000) +// to match RTL, FRT_BLOCK must be 7 +#define FRT_BLOCK (7) +unsigned char mc_mmuadr = 0x00; +unsigned char mc_mmufrt = 0x00; // Magic flag for Fixed RAM Top +unsigned char mc_mmudat = 0x00; +unsigned char mc_timer = 0x00; +unsigned char mc_pblk[16]; // [7] is protect, [6:0] is physical block +unsigned char mc_sdlba2; // because we're doing maths on them +unsigned char mc_sdlba1; +unsigned char mc_sdlba0; +char mc_data[512]; +int mc_addr; +int mc_state; +int mc_poll; +int mc_dindex; +struct CharFIFO { + int wr; + int rd; + int empty; + char data[CharFIFO_SIZE]; +}; + +static struct CharFIFO uart0_rx_fifo; +static unsigned char uart0_wr_status; + +// multicomp devices +struct hw_device *mc_romdev, *mc_ramdev, *mc_iodev, *mc_consoledev, *mc_sdmapperdev; + +FILE *sd_file; +FILE *batch_file; +FILE *log_file; +FILE *dump_file; + +/******************************************************************** + * The Scroungemaster II machine, a platform + * for 6809 CamelForth. See + * Brad Rodriguez http://www.camelforth.com/page.php?6 + * and + * http://www.bradrodriguez.com/papers/impov3.htm + ********************************************************************/ + +// by inspection command read (should be address 0x7c02) comes in with addr=0x8d +// TODO no way to check for "char available" and so smii_i_busy is always true and +// console input is blocking. +U8 smii_console_read (struct hw_device *dev, unsigned long addr) +{ + unsigned char ch; + switch (addr) { + case 0x02: // SCCACMD + // on output make it seem busy for several polls + smii_o_busy = smii_o_busy == 0 ? 0 : (smii_o_busy + 1)%4; + // printf("02 smii_o_busy = %d return 0x%02x\n",smii_o_busy,(smii_i_avail & 1) | (smii_o_busy == 0 ? 4 : 0)); + return (smii_i_avail & 1) | (smii_o_busy == 0 ? 4 : 0); + case 0x03: // SCCADTA + if (batch_file && fread( &ch, 1, 1, batch_file)) { + } + else { + ch = getchar(); + } + // key conversions to make keyboard look DOS-like + if (ch == 127) ch = 8; //backspace + if (ch == 10) ch = 13; //cr + return ch; + default: + printf("In smii_console_read with addr=0x%08x\n", (unsigned int)addr); + return 0x42; + } +} + + +void smii_console_write (struct hw_device *dev, unsigned long addr, U8 val) +{ + switch (addr) { + case 0x00: + case 0x02: + // UART setup. Not emulated; just ignore it. + break; + case 0x03: // SCCADTA + if (smii_o_busy != 0) printf("Oops! Write to busy UART\n"); + smii_o_busy = 1; + putchar(val); + break; + default: + printf("In smii_console_write with addr=0x%08x val=0x%02x\n",(unsigned int)addr, val); + } +} + + +void smii_init (const char *boot_rom_file) +{ + struct hw_device *smii_console, *rom, *quiet; + + /* RAM from 0 to 7BFF */ + device_define ( ram_create (0x7C00), 0, + 0x0000, 0x7C00, MAP_READWRITE ); + + /* ROM from E000 to FFFF */ + rom = rom_create (boot_rom_file, 0x2000); + device_define (rom , 0, + 0xE000, 0x2000, MAP_READABLE); + + /* The address space 8000-DFFF provides aliases of the ROM + There is write-only mapping logic for 8 RAM pages and this + is usually accessed by writes to addresses 8000,9000..F000 + + The CamelForth image does writes to those addresses at + in order to initialise the mapping hardware, but makes + no further use of it. Since the model is strict, the ROM + is read-only and the write causes a trap. + + To avoid the trap, create 1-page dummy devices at each + location in order to silently ignore the writes. + + For locations that alias to ROM, change the attribute so + that writes are ignored. + */ + quiet = null_create(); + device_define(quiet, 0, 0x8000, BUS_MAP_SIZE, MAP_IGNOREWRITE); + device_define(quiet, 0, 0x9000, BUS_MAP_SIZE, MAP_IGNOREWRITE); + device_define(quiet, 0, 0xA000, BUS_MAP_SIZE, MAP_IGNOREWRITE); + device_define(quiet, 0, 0xB000, BUS_MAP_SIZE, MAP_IGNOREWRITE); + device_define(quiet, 0, 0xC000, BUS_MAP_SIZE, MAP_IGNOREWRITE); + device_define(quiet, 0, 0xD000, BUS_MAP_SIZE, MAP_IGNOREWRITE); + + device_define(rom, 0x0000, 0xE000, BUS_MAP_SIZE, MAP_IGNOREWRITE | MAP_READABLE); + device_define(rom, 0x1000, 0xF000, BUS_MAP_SIZE, MAP_IGNOREWRITE | MAP_READABLE); + + + /* Make debug output more informative */ + // ?? haven't seen this work yet.. + sym_add(&internal_symtab, "SCCACMD", to_absolute(0x7c02), 0); + sym_add(&internal_symtab, "SCCADTA", to_absolute(0x7c03), 0); + + /* I/O console at 7C00 + * SCCACMD at 0x7C02 + * SCCADTA at 0x7C03 + */ + + // flag inch_avail + // counter outch_busy init 0 + + // on read from SCCACMD if inch_avail set bit 0. If outch_busy=0 set bit 2. + // if outch_busy!=0, increment it module 4 (ie, it counts up to 4 then stops at 0) + // + // on read from SCCADTA expect inch_avail to be true else fatal error. Return char. + // + // on write to SCCADTA expect outch_busy=0 else fatal error, increment outch_busy (to 1) + + // need to mimic the hardware that is controlled like this: + // CODE KEY \ -- c get char from serial port + // 6 # ( D) PSHS, BEGIN, SCCACMD LDB, 1 # ANDB, NE UNTIL, + // SCCADTA LDB, CLRA, NEXT ;C + // + // CODE KEY? \ -- f return true if char waiting + // 6 # ( D) PSHS, CLRA, SCCACMD LDB, 1 # ANDB, + // NE IF, -1 # LDB, THEN, NEXT ;C + // + // CODE EMIT \ c -- output character to serial port + // BEGIN, SCCACMD LDA, 4 # ANDA, NE UNTIL, + // SCCADTA STB, 6 # ( D) PULS, NEXT ;C + + smii_console = console_create(); + smii_console->class_ptr->read = smii_console_read; + smii_console->class_ptr->write = smii_console_write; + + device_define ( smii_console, 0, + 0x7C00, BUS_MAP_SIZE, MAP_READWRITE ); + + + + /* If a file smii.bat exists, supply input from it until + it's exhausted. + */ + batch_file = file_open(NULL, "smii.bat", "rb"); +} + + +struct machine smii_machine = +{ + .name = "smii", + .fault = fault, + .init = smii_init +}; + + +/******************************************************************** + * The Multicomp 6809 machine + * This version has 3 serial ports, 56K RAM and 8K ROM, SDCARD i/f. + * GPIO, memory-mapper and timer interrupt. + * The I/O is all at 0xFFD0-0xFFDF + * See: + * Grant Searle http://searle.hostei.com/grant/Multicomp/index.html + * and: + * https://www.retrobrewcomputers.org/doku.php?id=boards:sbc:multicomp:cycloneii-c:start + * + ********************************************************************/ + +/* UART-style console. + Previously, the input FIFO was not modelled: + Data input is sort-of non-blocking: if you read the UART status + bit and it says RX Char Available, you can read the data register + and know that it will not stall. + However, if you read the data register and no character is + available (rude!) the input will block until you press a key. + Could have it work other than this.. reading the data register + could also call kbhit. When no character is available could + return 0xff or somesuch, which would more accurately model real behaviour. + + Now, the FIFO is modelled and so are UART Rx interrupts: + 1/ each read of status or data calls kbhit and puts a char + (if any) into the FIFO and then: + 1a/ print error message if FIFO overflow + 1b/ for status: char available = FIFO-not-empty + 1c/ for data: if FIFO-not-empty, pop and return oldest char else + print error message (application error) and return 0xff + 2/ register an .update routine for the console_class. The update + routine is called in the exec09 main loop on a periodic basis. + 3/ the update routine calls kbbit and puts a char (if any) into + the FIFO and then: + 3a/ print error message if FIFO overflow + 3b/ if UART interrupt enabled and FIFO-not-empty: call IRQ + 4/ IRQ ISR needs to understand that a UART IRQ arrived rather + than a timer IRQ. TBD how to handle that.. probably by modelling + the timer interrupt in a more complex way.. eg, by testing the mask + *or* by implementing a new mask bit for the UART IRQ. + 5/ on status write of 3 (reset), clear the FIFO. + + The result should work correctly for existing applications: + - polled I/O in FLEX and CamelForth and Cubix and MSBASIC + - timer-driven I/O in FUZIX (and can change FUZIX to allow + rx interrupts, if it does not already) + - lastly, it should allow NitrOS9 L1 to do terminal input + and therefore boot to the command prompt. + + offset 0,1 - 1st UART - virtual UART. Main console + offset 2,3 - 2nd UART + offset 4,5 - 3rd UART + offset 6,7 - GPIO unit + */ +U8 multicomp_console_rxpoll (void) +{ + unsigned char ch; + if (batch_file) { + // do not allow the batch file to create an overflow + if (uart0_rx_fifo.empty || (uart0_rx_fifo.rd != uart0_rx_fifo.wr)) { + fread( &ch, 1, 1, batch_file); + uart0_rx_fifo.empty = 0; + uart0_rx_fifo.data[uart0_rx_fifo.wr] = ch; + uart0_rx_fifo.wr = (uart0_rx_fifo.wr + 1) % CharFIFO_SIZE; + } + } + else { + if (kbhit()) { + ch = kbchar(); + if ((uart0_rx_fifo.wr == uart0_rx_fifo.rd) && (uart0_rx_fifo.empty == 0)) { + // discard newest char - the real hardware is not polite + // like this! Should really generate a receiver overrun. + printf("[uart0 error: rx FIFO overflow]\n"); + } + else { + uart0_rx_fifo.empty = 0; + uart0_rx_fifo.data[uart0_rx_fifo.wr] = ch; + uart0_rx_fifo.wr = (uart0_rx_fifo.wr + 1) % CharFIFO_SIZE; + } + } + } +} + + +U8 multicomp09_console_read (struct hw_device *dev, unsigned long addr) +{ + //printf("In console_read with addr=0x%08x pc=0x%04x\n", (unsigned int)addr, get_pc()); + unsigned char ch; + switch (addr) { + + case 0: /* UART0 status */ + // b7: interrupt + // b1: can accept Tx char + // b0: Rx char available + multicomp_console_rxpoll(); + if (uart0_rx_fifo.empty) { + return 2; + } + else { + return (uart0_wr_status & 0x80) | 3; + } + + case 1: /* UART0 data */ + multicomp_console_rxpoll(); + if (uart0_rx_fifo.empty) { + printf("[uart0 error: read from EMPTY data register]\n"); + return 0xff; + } + else { + ch = uart0_rx_fifo.data[uart0_rx_fifo.rd]; + uart0_rx_fifo.rd = (uart0_rx_fifo.rd + 1) % CharFIFO_SIZE; + if (uart0_rx_fifo.rd == uart0_rx_fifo.wr) { + uart0_rx_fifo.empty = 1; + release_irq(1); + } + // key conversions to make keyboard look DOS-like + if (ch == 127) return 8; // rubout->backspace + if (ch == 10) return 13; // LF->CR + return ch; + } + + case 2: /* UART1 status */ + // hardware supports bits [7], [1], [0] + printf("[uart1 stat rd addr=0x%08x]\n", (unsigned int)addr); + return 0x03; + + case 3: /* UART1 data */ + printf("[uart1 data rd addr=0x%08x]\n", (unsigned int)addr); + return 0x42; + + case 4: /* UART2 status */ + // hardware supports bits [7], [1], [0] + printf("[uart2 stat rd addr=0x%08x]\n", (unsigned int)addr); + return 0x03; + + case 5: /* UART2 data */ + printf("[uart2 data rd addr=0x%08x]\n", (unsigned int)addr); + return 0x42; + + /* GPIO (not modelled) ---------------*/ + case 6: + case 7: + printf("[gpio rd addr=0x%08x]\n", (unsigned int)addr); + return 0x42; + + /* Other (should be unreachable) -----*/ + default: + printf("ERROR in console_read with addr=0x%04x\n", (unsigned int)addr); + return 0x42; + } +} + +void multicomp09_console_write (struct hw_device *dev, unsigned long addr, U8 val) +{ + //printf("In console_write with addr=0x%08x val=0x%02x pc=0x%04x\n", (unsigned int)addr, val, get_pc()); + //fprintf(log_file,"%02x~%02x\n",(unsigned char)(addr&0xff),val); + switch (addr) { + + case 0: /* UART0 status */ + uart0_wr_status = val; + if (val==3) { /* master reset */ + uart0_rx_fifo.wr=0; + uart0_rx_fifo.wr=0; + uart0_rx_fifo.empty=1; + uart0_wr_status = 0; + release_irq(1); + printf("[uart0 reset]"); + } + else { + printf("[uart0 stat wr: PC=0x%04x, addr=0x%04x, wdata=0x%02x]\n", get_pc(), (unsigned int)addr, val); + } + break; + + case 1: /* UART0 data */ + putchar(val); + fflush(stdout); + break; + + case 2: /* UART1 status */ + if (val==3) { + printf("[uart1 reset]"); + } + else { + printf("[uart1 stat wr: PC=0x%04x, addr=0x%04x, wdata=0x%02x]\n", get_pc(), (unsigned int)addr, val); + } + break; + + case 3: /* UART1 data */ + printf("[uart1 data wr of 0x%02x]\n", val); + break; + + case 4: /* UART2 status */ + if (val==3) { + printf("[uart2 reset]"); + } + else { + printf("[uart2 stat wr: PC=0x%04x, addr=0x%04x, wdata=0x%02x]\n", get_pc(), (unsigned int)addr, val); + } + break; + + case 5: /* UART2 data */ + printf("[uart2 data wr of 0x%02x]\n", val); + break; + + /* GPIO (not modelled) ---------------*/ + case 6: + case 7: + printf("[gpio wr addr=0x%04x val=0x%02x]\n", (unsigned int)addr, val); + break; + + /* Other (should be unreachable) -----*/ + default: + printf("ERROR in console_write with addr=0x%04x val=0x%02x\n",(unsigned int)addr, val); + } +} + +void multicomp09_console_update (struct hw_device *dev) +{ + multicomp_console_rxpoll(); + if (uart0_rx_fifo.empty == 0 && (uart0_wr_status & 0x80)) { + request_irq(1); + } +} + +// given a physical block number (0-7) return the offset into physical memory +int mmu_offset(int blk) { + int tmp; + int idx; + if (mc_mmuadr & 0x20) { + // mmu enabled + // 0-7 if tr=0, 8-15 if tr=1 + idx = blk | ((mc_mmuadr & 0x40) >> 3); + tmp = mc_pblk[idx]; + return (tmp & 0x7f) << 13; + } + else { + return blk << 13; + } +} + +// given a physical block number (0-7) return the flags +int mmu_flags(int blk) { + int tmp; + int idx; + if (mc_mmuadr & 0x20) { + // mmu enabled + // 0-7 if tr=0, 8-15 if tr=1 + idx = blk | ((mc_mmuadr & 0x40) >> 3); + tmp = mc_pblk[idx]; + return (tmp >> 7) == 1 ? MAP_READABLE : MAP_READWRITE; + } + else { + return MAP_READWRITE; + } +} + + +/* SDCARD and memory mapper + FFDF SDCARD MMUDAT wo + FFDE SDCARD MMUADR wo + FFDD SDCARD TIMER rw + FFDC SDCARD SDLBA2 wo + FFDB SDCARD SDLBA1 wo + FFDA SDCARD SDLBA0 wo + FFD9 SDCARD SDCONTROL/SDSTATUS + FFD8 SDCARD SDDATA r/w + + Access using 32-bit address in which the low 9 bits are 0 (each sector is 512 bytes). The + address is set using the SDLBA registers like this: + + 31 30 29 28.27 26 25 24.23 22 21 20.19 18 17 16.15 14 13 12.11 10 09 08.07 06 05 04.03 02 01 00 + +------- SDLBA2 -----+------- SDLBA1 --------+------- SDLBA0 --------+ 0 0 0 0 0 0 0 0 0 + + SDSTATUS (RO) + b7 Write Data Byte can be accepted + b6 Read Data Byte available + b5 Block Busy + b4 Init Busy + b3 Unused. Read 0 + b2 Unused. Read 0 + b1 Unused. Read 0 + b0 Unused. Read 0 + + SDCONTROL (WO) + b7:0 0x00 Read block + 0x01 Write block + + + mc_state = 0 no card. Will never complete initialisation + 1 initialising. Will initialise after 16 polls + of status register (hokey but works!) + 2 idle. Read and Write commands allowed. + 3 in read. Takes 3 polls for each byte becomes + available. + 4 in write. Takes 3 polls before each byte + can be accepted. + error if too much data written or read or if command while + not idle. + */ + + +/* + op values are: + 0 remap memory using existing register values + 1 load new dat value then remap memory using existing register values + 2 load new adr value then remap memory using new values +*/ +// mc_mmuadr bits: +// 7 ROMDIS +// 6 TR +// 5 MMUEN +// 4 NMI +// 3:0 MAPSEL +// +void sdmapper_remap(int op, int val) +{ + int i; + + // Update appropriate mapping register if dat written + if (op == 1) { + mc_pblk[mc_mmuadr & 0xf] = val; + if (val > 0x3f) { + printf("Bad: write to mmu map register 0x%01x with data 0x%02x at pc=0x%04x\n",0xf & mc_mmuadr, val, get_pc()); + } + + // If the MMU is enabled and the data register that changed is part of the active mapping, report the mapping + if ( ((mc_mmuadr & 0x68) == 0x68) || ((mc_mmuadr & 0x68) == 0x20) ) { + fprintf(log_file,"INFO mmudat change on active mapping set: mmudat 0x%02x->0x%02x\n",mc_mmudat, val); + fprintf(log_file,"INFO mmuadr 0x%02x pc=0x%04x", mc_mmuadr, get_pc()); + for (i=0;i<16;i++) { + fprintf(log_file," %02d:0x%02x",i,mc_pblk[i]); + } + fprintf(log_file,"\n"); + fflush(NULL); + } + + mc_mmudat = val; + } + + + if (op == 2) { + if ( ((mc_mmuadr & 0xa0) == 0xa0) && ((val & 0xa0) == 0x20) ) { + // ROMDIS=1 and MMUEn=1 and wrote ROMDIS=0 and MMUEn=1 - cue to + // set FRT bit and IGNORE transition of ROMDIS + mc_mmufrt = 1; + val = val | 0x80; + fprintf(log_file,"INFO mmuadr 0x%02x->0x%02x frt=%1x pc=0x%04x\n", mc_mmuadr, val, mc_mmufrt, get_pc()); + } + if ( (val & 0x20) == 0x00 ) { + // MMUEn is disabled - cue to clear FRT bit + mc_mmufrt = 0; + fprintf(log_file,"INFO mmuadr 0x%02x->0x%02x frt=%1x pc=0x%04x\n", mc_mmuadr, val, mc_mmufrt, get_pc()); + } + + // If ROMDIS, TR or MMUEN have changed, report the mapping + if ((mc_mmuadr & 0x70) != (val & 0x70)) { + fprintf(log_file,"INFO mmuadr 0x%02x->0x%02x frt=%1x pc=0x%04x", mc_mmuadr, val, mc_mmufrt, get_pc()); + for (i=0;i<16;i++) { + fprintf(log_file," %02d:0x%02x",i,mc_pblk[i]); + } + fprintf(log_file,"\n"); + fflush(NULL); + } + + mc_mmuadr = val; + } + + + // now update mapping based on mc_mmuadr, mc_pblk[], mc_mmufrt + + //[NAC HACK 2015May06] Yeuch. Horrible how I have had to hardwire the device numbers. + //overall, it would be better if I could pick them in the first place. + // 0 null-device + // 1 RAM + // 2 ROM + // 3 CONSOLE + // 4 SDMAPPER + // 5 IOEXPAND + + + // addr dev offset len flags + + bus_map(0x0000, 1, mmu_offset(0), 0x2000, mmu_flags(0)); // block 0 + bus_map(0x2000, 1, mmu_offset(1), 0x2000, mmu_flags(1)); // block 1 + bus_map(0x4000, 1, mmu_offset(2), 0x2000, mmu_flags(2)); // .. + bus_map(0x6000, 1, mmu_offset(3), 0x2000, mmu_flags(3)); + bus_map(0x8000, 1, mmu_offset(4), 0x2000, mmu_flags(4)); + bus_map(0xA000, 1, mmu_offset(5), 0x2000, mmu_flags(5)); + bus_map(0xC000, 1, mmu_offset(6), 0x2000, mmu_flags(6)); // block 6 + + // Block 7 is cut up in pieces.. + + // 0xE000-0xFDFF (0x1E00 bytes) behaves as ROM or MMappable RAM + if (mc_mmuadr & 0x80) { + // ROM device disabled; map RAM. + bus_map(0xE000, 1, mmu_offset(7), 0x1E00, mmu_flags(7)); + } + else { + // ROM device, starting at offset 0 + bus_map(0xE000, 2, 0x0000, 0x1E00, MAP_READABLE); + } + + // The next 0x180 bytes is the first part of the Fixed RAM Top + // which behaves as ROM or MMappable RAM or RAM from a fixed block + if (mc_mmuadr & 0x80) { + // ROM device disabled; map 0x180 bytes of RAM + if (mc_mmufrt) { + // RAM from fixed block -- always allow read/write + bus_map(0xFE00, 1, 0x1E00 + (FRT_BLOCK << 13), 0x180, mmu_flags(7)); + } + else { + // RAM from block controlled by MMU + bus_map(0xFE00, 1, 0x1E00 + mmu_offset(7), 0x180, MAP_READWRITE); + } + } + else { + // ROM device, starting at offset 0x1E00 + bus_map(0xFE00, 2, 0x1E00, 0x180, MAP_READABLE); + } + + // The final 0x80 bytes at the very top of the address space is broken + // into 16 devices, each 8 bytes in size. Two of the devices correspond + // to addresses 0xFFDx -- the I/O devices. The remaining 14 slots act + // in the same way as Fixed RAM Top and each of them applies the same + // rules as the other FRT region above. + bus_map(0xFF80, 5, 0x0000, 128, MAP_READWRITE); // ioexpand + + for (i=0; i<16; i++) { + if (i==10) { + // 0xFFD0-0xFFD7 -- VDU/UART and GPIO + ioexpand_attach(mc_iodev, i, 0, mc_consoledev); + } + else if (i==11) { + // 0xFFD8-0xFFDF -- SDCARD and MemMapper + ioexpand_attach(mc_iodev, i, 0, mc_sdmapperdev); + } + else { + // Map to underlying memory. Access will have an address of 0x0-0xf + // so we need to apply an offset to get it to the right place. The + // offset is from the start of the underlying device (ROM or RAM) + // and has nothing to do with the actual bus address of the location. + // The access permissions are inherited from the underlying device, + // which is exactly what I want. + // [NAC HACK 2017Feb01] is the access permission correct for the + // write-protection flag on the MMU devices?? + if (mc_mmuadr & 0x80) { + // ROM device disabled; map 0x10 bytes of RAM + if (mc_mmufrt) { + // RAM from fixed block -- always allow read/write + ioexpand_attach(mc_iodev, i, (FRT_BLOCK << 13) + 0x1F80 + (i*8), mc_ramdev); + } + else { + // RAM from block controlled by MMU + ioexpand_attach(mc_iodev, i, mmu_offset(7) + 0x1F80 + (i*8), mc_ramdev); + } + } + else { + // ROM device, starting at offset 0x1F80 + ioexpand_attach(mc_iodev, i, 0x1F80 + (i*8), mc_romdev); + } + } + } +} + + +U8 sdmapper_read (struct hw_device *dev, unsigned long addr) +{ + //printf("INFO In sdmapper_read with addr=0x%08x, mc_state=%d, mc_poll=%d\n", addr, mc_state, mc_poll); + switch (addr) { + case 0: // SDDATA + switch (mc_state) { + case 0: case 1: case 2: + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0xff); + return 0xff; + case 3: // in read + if (mc_poll == 3) { + mc_poll = 0; + if (mc_dindex == 511) { + mc_state = 2; // final read then back to idle + } + if (mc_dindex < 512) { + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),mc_data[mc_dindex]); + return mc_data[mc_dindex++]; + } + else { + printf("ERROR attempt to read too much data from sd block\n"); + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0xff); + return 0xff; + } + } + else { + printf("ERROR attempt to read sd block when data not yet available\n"); + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0xff); + return 0xff; + } + case 4: // in write + printf("ERROR attempt to read sd data during write command\n"); + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0xff); + return 0xff; + } + break; // unreachable + case 1: // SDCONTROL + switch (mc_state) + { + case 0: // busy and always will remain so + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0x90); + return 0x90; + case 1: // count polls and initialise + mc_poll++; + if (mc_poll == 16) + mc_state = 2; + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0x90); + return 0x90; + case 2: // idle. + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0x80); + return 0x80; + case 3: // in read + if (mc_poll < 3) + mc_poll++; + if (mc_poll == 3) { + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0xe0); + return 0xe0; // data available + } + else { + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0xa0); + return 0xa0; // still waiting TODO maybe 20 + } + case 4: // in write + if (mc_poll < 3) + mc_poll++; + if (mc_poll == 3) { + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0xa0); + return 0xa0; // space available + } + else { + //fprintf(log_file,"%02x<%02x\n",(unsigned char)(addr&0xff),0x20); + return 0x20; // still waiting + } + } + break; // unreachable + case 5: // TIMER read + return mc_timer; + default: + // In general, it's an error to read back anything else. However, in the + // case of a CLR instruction the CPU does a read "modify" write (but + // ignores the read data. In this case, it's nice *not* to print this + // warning message. + // This is a hack because it only ignores CLR with extended addressing + // and, worse, it might cause a real problem to be missed because + // we guess/assume the start position of the previous op-code (would be + // cleaner if we tracker previous pc). + if (read8(get_pc()-3) != 0x7f) { + printf("INFO In sdmapper_read with addr=0x%04x\n", (unsigned int)addr); + } + } + return 0x42; // return default value +} + +// TODO expand RAM and implement mapper, protect and rom disable +void sdmapper_write (struct hw_device *dev, unsigned long addr, U8 val) +{ + int retvar; + //printf("INFO In sdmapper_write with addr=0x%08x, mc_state=%d mc_poll=%d mc_dindex=%d\n", addr, mc_state, mc_poll, mc_dindex); + //fprintf(log_file,"%02x>%02x\n",(unsigned char)(addr&0xff),val); + switch (addr) { + case 0: // SDDATA + switch (mc_state) { + case 0: case 1: case 2: case 3: + printf("ERROR attempt to write to sd data during sd block read\n"); + break; + case 4: // in write + if (mc_poll == 3) { + mc_poll = 0; + if (mc_dindex < 512) { + mc_data[mc_dindex++] = val; + if (mc_dindex == 512) { + // commit the data + if (fseek(sd_file, mc_addr, SEEK_SET)) { + printf("ERROR seek to sd offset address 0x%x for write failed\n", mc_addr); + } + else { + retvar = fwrite(mc_data, 512, 1, sd_file); + assert(retvar != -1); + } + mc_state = 2; // back to idle. + } + } + else { + printf("ERROR attempt to write too much data to sd block\n"); + } + } + else { + printf("ERROR attempt to write sd data when space not yet available\n"); + } + break; + } + break; + case 1: // SDCONTROL + switch (mc_state) { + case 0: + printf("ERROR attempt to write to sd control but no sd image file\n"); + break; + case 1: + printf("ERROR attempt to write to sd control but still initialising\n"); + break; + case 2: + // form address + mc_addr = ((0x7f & mc_sdlba2) << 25) | (mc_sdlba1 << 17) | (mc_sdlba0 << 9); + mc_poll = 0; + switch (val) { + case 0: // read command + mc_dindex = 0; + mc_state = 3; + if (fseek(sd_file, mc_addr, SEEK_SET)) { + printf("ERROR seek to sd offset address 0x%x for read failed\n", mc_addr); + for (mc_dindex = 0; mc_dindex < 512; mc_dindex++) { + mc_data[mc_dindex] = 0xff; + mc_dindex = 0; + } + } + else { + retvar = fread(mc_data, 512, 1, sd_file); + assert(retvar != -1); + } + break; + case 1: // write command + mc_dindex = 0; + mc_state = 4; + break; + default: + printf("ERROR unknown sd command 0x%02x\n", val); + break; + } + break; + case 3: + printf("ERROR attempt to write to sd control during sd block read\n"); + break; + case 4: + printf("ERROR attempt to write to sd control during sd block write\n"); + break; + } + case 2: // SDLBA0 + mc_sdlba0 = val; + break; + case 3: // SDLBA1 + mc_sdlba1 = val; + break; + case 4: // SDLBA2 + mc_sdlba2 = val; + break; + case 5: // TIMER write + // bit [1] is read/write, timer enable + // bit [7] is read, write-1-to-clear, interrupt. + + // Enable or disable + mc_timer = (mc_timer & 0xfd) | (val & 2); + + if (val & 0x80) { + release_irq(0); + mc_timer &= 0x7f; + } + + break; + case 6: // MMUADR + // ignore writes where bit(4) is set; this is the single-step/nmi control + // and it forces the other write data to be ignored + if ((val & 0x10) == 0) { + sdmapper_remap(2, val); + } + break; + case 7: // MMUDAT + sdmapper_remap(1, val); + break; + } +} + +void sdmapper_reset (struct hw_device *dev) +{ +} + +struct hw_class sdmapper_class = +{ + .name = "sdmapper", + .readonly = 0, + .reset = sdmapper_reset, + .read = sdmapper_read, + .write = sdmapper_write, +}; + +struct hw_device* sdmapper_create (void) +{ + return device_attach (&sdmapper_class, BUS_MAP_SIZE, NULL); +} + + + +/* Called periodically when exec09 is invoked with the -I option. + This can be used to model the hardware of a periodic timer and + (for example) invoke IRQ or FIQ as required by the hardware. + For multicomp09, model the timer interrupt: if the timer is enabled, + generate an IRQ. +*/ +void multicomp09_tick (void) +{ + if (mc_timer & 0x02) { + mc_timer |= 0x80; + request_irq(0); + } +} + +// [NAC HACK 2015May05] is it legal to have more than one instance of anything? +// eg 2 RAMs? I assumed it was but now I realise IT IS NOT! Yeuch. +// I assume the same restriction also applies to ROMs and RAMs +void multicomp09_init (const char *boot_rom_file) +{ + int i; + + /* Log file + */ + log_file = file_open(NULL, "multicomp09.log", "w+b"); + fprintf(log_file, "===Log file\n"); + + /* RAM is 512Kbytes. With MMU disabled low 64K is mapped linearly + otherwise, it is mapped in 8K chunks. Each chunk has a separate + write protect. + */ + mc_ramdev = ram_create(MULTICOMP09_RAMMAX); + + /* ROM is 8Kbytes. Usually sits from E000 to FFFF but can be disabled + by writing 0x80 to MMUADR + */ + mc_romdev = rom_create (boot_rom_file, 0x2000); + + /* I/O Devices - UARTs */ + mc_consoledev = console_create(); + mc_consoledev->class_ptr->read = multicomp09_console_read; + mc_consoledev->class_ptr->write = multicomp09_console_write; + mc_consoledev->class_ptr->update = multicomp09_console_update; + + /* I/O Devices - SD controller, MMapper, Timer */ + mc_sdmapperdev = sdmapper_create(); + + /* Address space for I/O devices at FFD0/FFDF + Use an ioexpand device at 0xFF80-0xFFFF. + This overlays the ROM mapping and creating it *after* + the ROM overwrites the ROM's mapping. + The ioexpand provides 16 slots of 8 bytes + Use some for the IO, map the others back to the ROM + In particular, need locations 0xFFF0-0xFFFF mapped + in order to provide the exception vectors. + */ + mc_iodev = ioexpand_create(); + + + /* Now map all the devices into the address space, in accordance + with the settings of the memory mapper. + */ + sdmapper_remap(0, 0); + + /* Initialise/reset the UART0 input FIFO and its status register*/ + uart0_rx_fifo.wr = 0; + uart0_rx_fifo.rd = 0; + uart0_rx_fifo.empty = 1; + uart0_wr_status = 0; + release_irq(1); + + /* If a file multicomp09.bat exists, supply input from it until + it's exhausted. + */ + batch_file = file_open(NULL, "multicomp09.bat", "rb"); + + /* If a file multicomp09_sd.img exists, open it. sdcard will + only transition to initialised state if file exists + */ + sd_file = file_open(NULL, "multicomp09_sd.img", "r+b"); + mc_poll = 0; + if (sd_file) + mc_state = 1; + else + mc_state = 0; +} + + +/* Dump just does a binary dump of the RAM space. Properly it should also dump + the memory mapper state. The dump is only intended to aid debug/analysis. To + be used for (eg) persistence there's lots more state that would be needed. +*/ +void multicomp09_dump (void) +{ + int i; + char byte; + dump_file = file_open(NULL, "multicomp09.dmp", "w+b"); + for (i=0; ibackspace + if (ch == 10) return 13; // LF->CR + return ch; + default: + printf("In console_read with addr=0x%08x\n", (unsigned int)addr); + return 0x42; + } +} + +void kipper1_console_write (struct hw_device *dev, unsigned long addr, U8 val) +{ + //printf("In console_write with addr=0x%08x val=0x%02x pc=0x%04x\n", (unsigned int)addr, val, get_pc()); + //fprintf(log_file,"%02x~%02x\n",(unsigned char)(addr&0xff),val); + switch (addr) { + case 0: + printf("In console_write with addr=0x%08x val=0x%02x\n",(unsigned int)addr, val); + break; + + case 1: + //if ((val != 0x0d) && (val != 0x20) && (val != 0x0a) && (val < '0')) { + // printf("Char 0x%02x", val); + //} + putchar(val); + break; + + default: + printf("In console_write with addr=0x%08x val=0x%02x\n",(unsigned int)addr, val); + } +} + + +void kipper1_init (const char *boot_rom_file) +{ + struct hw_device *kipper1_console, *rom; + + /* 32K RAM from 0000 to 7FFF */ + device_define ( ram_create (0x8000), 0, + 0x0000, 0x8000, MAP_READWRITE ); + + /* 16K ROM from C000 to FFFF */ + rom = rom_create (boot_rom_file, 0x4000); + device_define (rom , 0, + 0xC000, 0x4000, MAP_READABLE); + + /* I/O console at A000 + * SCCACMD at 0xA000 + * SCCADTA at 0xA001 + */ + + // flag inch_avail + // counter outch_busy init 0 + + // on read from SCCACMD if inch_avail set bit 0. If outch_busy=0 set bit 2. + // if outch_busy!=0, increment it module 4 (ie, it counts up to 4 then stops at 0) + // + // on read from SCCADTA expect inch_avail to be true else fatal error. Return char. + // + // on write to SCCADTA expect outch_busy=0 else fatal error, increment outch_busy (to 1) + + kipper1_console = console_create(); + kipper1_console->class_ptr->read = kipper1_console_read; + kipper1_console->class_ptr->write = kipper1_console_write; + + device_define ( kipper1_console, 0, + 0xA000, BUS_MAP_SIZE, MAP_READWRITE ); + + + + /* If a file kipper1.bat exists, supply input from it until + it's exhausted. + */ + batch_file = file_open(NULL, "kipper1.bat", "rb"); +} + + +struct machine kipper1_machine = +{ + .name = "kipper1", + .fault = fault, + .init = kipper1_init +}; diff --git a/missing b/missing new file mode 100755 index 0000000..894e786 --- /dev/null +++ b/missing @@ -0,0 +1,360 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2005-06-08.21 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/mmu.c b/mmu.c index ceed65e..bf03582 100644 --- a/mmu.c +++ b/mmu.c @@ -1,20 +1,6 @@ - #include #include "machine.h" - -#define SMR_PAGESIZE 4096 - -#define SMR_SLOTS 16 - -/* Small MMU register map */ -#define SMR_SLOT 0 /* Which slot is described by registers 8-9 */ -#define SMR_BASEL 1 /* The base page for lower 8 slots */ -#define SMR_BASEH 2 /* The base page for upper 8 slots */ -#define SMR_FAULTA 3 /* The faulting address */ -#define SMR_FAULTT 5 /* The fault type */ -#define SM_GLOBAL_REGS 6 -#define SMR_PAGE 6 /* Which 4KB page is mapped to the current slot */ -#define SMR_FLAGS 7 /* What are the page flags for this slot */ +#include "mmu.h" /* The 'small' MMU is an I/O device that allows remapping a window of a single device into a fixed region of the CPU. */ @@ -82,7 +68,6 @@ void small_mmu_write (struct hw_device *dev, unsigned long addr, U8 val) void small_mmu_reset (struct hw_device *dev) { unsigned int page; - struct small_mmu *mmu = (struct small_mmu *)dev->priv; for (page = 0; page < SMR_SLOTS; page++) { @@ -94,13 +79,14 @@ void small_mmu_reset (struct hw_device *dev) struct hw_class small_mmu_class = { + .name = "small_mmu", .readonly = 0, .reset = small_mmu_reset, .read = small_mmu_read, .write = small_mmu_write, }; -struct hw_device *small_mmu_create (struct hw_device *realdev) +struct hw_device* small_mmu_create (struct hw_device *realdev) { struct small_mmu *mmu = malloc (sizeof (struct small_mmu)); mmu->realdev = realdev; diff --git a/mmu.h b/mmu.h new file mode 100644 index 0000000..742a8b6 --- /dev/null +++ b/mmu.h @@ -0,0 +1,29 @@ +#ifndef MMU_H +#define MMU_H + +#define SMR_PAGESIZE 4096 + +#define SMR_SLOTS 16 + +/* Small MMU register map */ +#define SMR_SLOT 0 /* Which slot is described by registers 8-9 */ +#define SMR_BASEL 1 /* The base page for lower 8 slots */ +#define SMR_BASEH 2 /* The base page for upper 8 slots */ +#define SMR_FAULTA 3 /* The faulting address */ +#define SMR_FAULTT 5 /* The fault type */ +#define SM_GLOBAL_REGS 6 +#define SMR_PAGE 6 /* Which 4KB page is mapped to the current slot */ +#define SMR_FLAGS 7 /* What are the page flags for this slot */ + +/* The 'small' MMU is an I/O device that allows remapping a window of +a single device into a fixed region of the CPU. */ +struct small_mmu; +void small_mmu_update_slot (struct small_mmu *mmu, unsigned int slot); +void small_mmu_update_current (struct small_mmu *mmu); +void small_mmu_update_all (struct small_mmu *mmu); +U8 small_mmu_read (struct hw_device *dev, unsigned long addr); +void small_mmu_write (struct hw_device *dev, unsigned long addr, U8 val); +void small_mmu_reset (struct hw_device *dev); +struct hw_device* small_mmu_create (struct hw_device *realdev); + +#endif diff --git a/monitor.c b/monitor.c index 6e7aebb..6f92329 100644 --- a/monitor.c +++ b/monitor.c @@ -19,12 +19,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - -#include "6809.h" -#include "monitor.h" #include #include - +#include "6809.h" +#include "monitor.h" +#include "command.h" +#include "os9syscalls.h" /* The function call stack */ struct function_call fctab[MAX_FUNCTION_CALLS]; @@ -39,7 +39,6 @@ int monitor_on = 0; int dump_every_insn = 0; - enum addr_mode { _illegal, _implied, _imm_byte, _imm_word, _direct, _extended, @@ -888,29 +887,30 @@ char *off4[] = { "-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1" }; - /* Disassemble the current instruction. Returns the number of bytes that compose it. */ -int -dasm (char *buf, absolute_address_t opc) +int dasm (char *buf, absolute_address_t opc) { UINT8 op, am; char *op_str; absolute_address_t pc = opc; char R; int fetch1; /* the first (MSB) fetched byte, used in macro RDWORD */ + absolute_address_t tmp; - op = fetch8 (); + extern int os9call; - if (op == 0x10) + op = fetch8(); + + if (op == 0x10) /* prefix for PAGE2 opcodes */ { - op = fetch8 (); + op = fetch8(); am = codes10[op].mode; op = codes10[op].code; } - else if (op == 0x11) + else if (op == 0x11) /* prefix for PAGE3 opcodes */ { - op = fetch8 (); + op = fetch8(); am = codes11[op].mode; op = codes11[op].code; } @@ -921,7 +921,22 @@ dasm (char *buf, absolute_address_t opc) } op_str = (char *) mne[op]; - buf += sprintf (buf, "%-6.6s", op_str); + if ((op_str == "SWI2") && os9call) + { + op = fetch8(); + if(op < 0x91) + { + buf += sprintf (buf, "%-6.6s%s", "OS9", os9syscall[op]); + } + else + { + buf += sprintf (buf, "%-6.6s#$%2x", "OS9", op); + } + } + else + { + buf += sprintf (buf, "%-6.6s", op_str); + } switch (am) { @@ -1016,13 +1031,13 @@ dasm (char *buf, absolute_address_t opc) sprintf (buf, "[D,%c]", R); break; case 0x1C: - sprintf (buf, "[$%02X,PC]", fetch8 ()); + sprintf (buf, "[$%02X,PC]", fetch8()); break; case 0x1D: - sprintf (buf, "[$%04X,PC]", fetch16 ()); + sprintf (buf, "[$%04X,PC]", fetch16()); break; case 0x1F: - sprintf (buf, "[%s]", monitor_addr_name (fetch16 ())); + sprintf (buf, "[%s]", monitor_addr_name (fetch16())); break; default: sprintf (buf, "???"); @@ -1031,12 +1046,13 @@ dasm (char *buf, absolute_address_t opc) break; case _rel_byte: - fetch1 = ((INT8) fetch8 ()); + fetch1 = ((INT8) fetch8 ()); sprintf (buf, "%s", absolute_addr_name (fetch1 + pc)); break; case _rel_word: - sprintf (buf, "%s", absolute_addr_name (fetch16 () + pc)); + tmp = fetch16(); + sprintf (buf, "%s", absolute_addr_name (pc + tmp)); break; case _reg_post: @@ -1076,8 +1092,7 @@ dasm (char *buf, absolute_address_t opc) return pc - opc; } -int -sizeof_file (FILE * file) +int sizeof_file(FILE * file) { int size; @@ -1088,17 +1103,14 @@ sizeof_file (FILE * file) return size; } - -int -load_map_file (const char *name) +// nac it would be nice to have an intelligent map file reader.. +int load_map_file (const char *name) { FILE *fp; char map_filename[256]; char buf[256]; - char *value_ptr, *id_ptr; + char *tok_ptr, *value_ptr, *id_ptr; target_addr_t value; - char *file_ptr; - struct symbol *sym = NULL; /* Try appending the suffix 'map' to the name of the program. */ sprintf (map_filename, "%s.map", name); @@ -1111,7 +1123,7 @@ load_map_file (const char *name) if (s) { sprintf (s+1, "map"); - fp = file_open (NULL, map_filename, "r"); + fp = file_open(NULL, map_filename, "r"); } if (!fp) @@ -1128,62 +1140,64 @@ load_map_file (const char *name) if (feof (fp)) break; - value_ptr = buf; - if (!strncmp (value_ptr, "page", 4)) - { - unsigned char page = strtoul (value_ptr+4, NULL, 10); - if (!strcmp (machine->name, "wpc")) - wpc_set_rom_page (page); - sym = NULL; - continue; - } - - if (strncmp (value_ptr, " ", 6)) - continue; - - while (*value_ptr == ' ') - value_ptr++; - - value = strtoul (value_ptr, &id_ptr, 16); - if (id_ptr == value_ptr) - continue; - - while (*id_ptr == ' ') - id_ptr++; + tok_ptr = strtok (buf, " \t\n"); + if (0 != strcmp(tok_ptr, "Symbol:")) + continue; - id_ptr = strtok (id_ptr, " \t\n"); - if (((*id_ptr == 'l') || (*id_ptr == 's')) && (id_ptr[1] == '_')) - continue; - ++id_ptr; + id_ptr = strtok(NULL, " \t\n"); + // skip over filename + tok_ptr = strtok (NULL, " \t\n"); + // skip over "=" + tok_ptr = strtok (NULL, " \t\n"); + value_ptr = strtok (NULL, " \t\n"); + // get value as hex string + value = (target_addr_t) strtoul(value_ptr, NULL, 16); - file_ptr = strtok (NULL, " \t\n"); - - if (sym) - sym->ty.size = to_absolute (value) - sym->value; - sym = sym_add (&program_symtab, id_ptr, to_absolute (value), 0); /* file_ptr? */ + sym_add (&program_symtab, id_ptr, to_absolute (value), 0); } fclose (fp); return 0; } - -int -load_hex (const char *name) +/* Auto-detect image file type and load it. For this to work, + the machine must already be initialized. +*/ +int load_image (const char *name) { + unsigned int count, addr, type; FILE *fp; - int count, addr, type, data, checksum; - int done = 1; - int line = 0; - - fp = file_open (NULL, name, "r"); + fp = file_open(NULL, name, "r"); if (fp == NULL) { - printf ("failed to open hex record file %s.\n", name); + printf("failed to open image file %s.\n", name); return 1; } + if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) == 3) + { + rewind(fp); + return load_s19(fp); + } + else if (fscanf (fp, ":%2x%4x%2x", &count, &addr, &type) == 3) + { + rewind(fp); + return load_hex(fp); + } + else + { + printf ("unrecognised format in image file %s.\n", name); + return 1; + } +} + +int load_hex (FILE *fp) +{ + unsigned int count, addr, type, data, checksum; + int done = 1; + int line = 0; + while (done != 0) { line++; @@ -1193,7 +1207,6 @@ load_hex (const char *name) printf ("line %d: invalid hex record information.\n", line); break; } - checksum = count + (addr >> 8) + (addr & 0xff) + type; switch (type) @@ -1201,65 +1214,61 @@ load_hex (const char *name) case 0: for (; count != 0; count--, addr++, checksum += data) { - fscanf (fp, "%2x", &data); - write8 (addr, (UINT8) data); + if (fscanf(fp, "%2x", &data)) + { + write8(addr, (UINT8) data); + } + else + { + printf("line %d: hex record data inconsistent with count field.\n", line); + break; + } } checksum = (-checksum) & 0xff; - fscanf (fp, "%2x", &data); - if (data != checksum) + + if ( (fscanf(fp, "%2x", &data) != 1) || (data != checksum) ) { - printf ("line %d: invalid hex record checksum.\n", line); + printf("line %d: hex record checksum missing or invalid.\n", line); done = 0; break; } - (void) fgetc (fp); /* skip CR/LF/NULL */ + fscanf(fp, "%*[\r\n]"); /* skip any form of line ending */ break; case 1: checksum = (-checksum) & 0xff; - fscanf (fp, "%2x", &data); - if (data != checksum) - printf ("line %d: invalid hex record checksum \n", line); + + if ( (fscanf(fp, "%2x", &data) != 1) || (data != checksum) ) + printf("line %d: hex record checksum missing or invalid.\n", line); done = 0; break; case 2: default: - printf ("line %d: not supported hex type %d.\n", line, type); + printf("line %d: not supported hex type %d.\n", line, type); done = 0; break; } } - fclose (fp); + (void) fclose (fp); return 0; } - -int -load_s19 (const char *name) +int load_s19(FILE *fp) { - FILE *fp; - int count, addr, type, data, checksum; + unsigned int count, addr, type, data, checksum; int done = 1; int line = 0; - fp = file_open (NULL, name, "r"); - - if (fp == NULL) - { - printf ("failed to open S-record file %s.\n", name); - return 1; - } - while (done != 0) { line++; - if (fscanf (fp, "S%1x%2x%4x", &type, &count, &addr) != 3) + if (fscanf(fp, "S%1x%2x%4x", &type, &count, &addr) != 3) { - printf ("line %d: invalid S record information.\n", line); + printf("line %d: invalid S record information.\n", line); break; } @@ -1270,26 +1279,32 @@ load_s19 (const char *name) case 1: for (count -= 3; count != 0; count--, addr++, checksum += data) { - fscanf (fp, "%2x", &data); - write8 (addr, (UINT8) data); + if (fscanf (fp, "%2x", &data)) + { + write8 (addr, (UINT8) data); + } + else + { + printf ("line %d: S record data inconsistent with count field.\n", line); + break; + } } checksum = (~checksum) & 0xff; - fscanf (fp, "%2x", &data); - if (data != checksum) + + if ( (fscanf (fp, "%2x", &data) != 1) || (data != checksum) ) { - printf ("line %d: invalid S record checksum.\n", line); + printf ("line %d: S record checksum missing or invalid.\n", line); done = 0; break; } - (void) fgetc (fp); /* skip CR/LF/NULL */ + fscanf (fp, "%*[\r\n]"); /* skip any form of line ending */ break; case 9: checksum = (~checksum) & 0xff; - fscanf (fp, "%2x", &data); - if (data != checksum) - printf ("line %d: invalid S record checksum.\n", line); + if ( (fscanf (fp, "%2x", &data) != 1) || (data != checksum) ) + printf ("line %d: S record checksum missing or invalid.\n", line); done = 0; break; @@ -1300,14 +1315,11 @@ load_s19 (const char *name) } } - fclose (fp); + (void) fclose(fp); return 0; } - - -void -monitor_call (unsigned int flags) +void monitor_call (unsigned int flags) { #ifdef CALL_STACK if (current_function_call <= &fctab[MAX_FUNCTION_CALLS-1]) @@ -1326,9 +1338,7 @@ monitor_call (unsigned int flags) #endif } - -void -monitor_return (void) +void monitor_return (void) { #ifdef CALL_STACK if (current_function_call > &fctab[MAX_FUNCTION_CALLS-1]) @@ -1348,73 +1358,60 @@ monitor_return (void) #endif } - -const char * -absolute_addr_name (absolute_address_t addr) +const char* absolute_addr_name (absolute_address_t addr) { - static char buf[256], *bufptr; - const char *name; + static char buf[256], *bufptr; + const char *name; - bufptr = buf; + bufptr = buf; - bufptr += sprintf (bufptr, "%02X:0x%04X", addr >> 28, addr & 0xFFFFFF); + bufptr += sprintf (bufptr, "%02lX:0x%04lX", addr >> 28, addr & 0xFFFFFF); name = sym_lookup (&program_symtab, addr); if (name) - bufptr += sprintf (bufptr, " <%-16.16s>", name); - - return buf; + sprintf (bufptr, " <%-16.16s>", name); + return buf; } - -const char * -monitor_addr_name (target_addr_t target_addr) +const char* monitor_addr_name (target_addr_t target_addr) { - static char buf[256], *bufptr; - const char *name; - absolute_address_t addr = to_absolute (target_addr); + static char buf[256], *bufptr; + const char *name; + absolute_address_t addr = to_absolute (target_addr); - bufptr = buf; + bufptr = buf; - bufptr += sprintf (bufptr, "0x%04X", target_addr); + bufptr += sprintf (bufptr, "$%04X", target_addr); name = sym_lookup (&program_symtab, addr); if (name) - bufptr += sprintf (bufptr, " <%s>", name); + sprintf (bufptr, " <%s>", name); - return buf; + return buf; } - -static void -monitor_signal (int sigtype) +static void monitor_signal (int sigtype) { - (void) sigtype; - putchar ('\n'); - monitor_on = 1; + (void) sigtype; + putchar ('\n'); + monitor_on = 1; } - -void -monitor_init (void) +void monitor_init (void) { - int tmp; - extern int debug_enabled; - target_addr_t a; + extern int debug_enabled; - fctab[0].entry_point = read16 (0xfffe); - memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs)); - current_function_call = &fctab[0]; + fctab[0].entry_point = read16 (0xfffe); + memset (&fctab[0].entry_regs, 0, sizeof (struct cpu_regs)); + current_function_call = &fctab[0]; - auto_break_insn_count = 0; - monitor_on = debug_enabled; - signal (SIGINT, monitor_signal); + auto_break_insn_count = 0; + monitor_on = debug_enabled; + signal (SIGINT, monitor_signal); } - -int -check_break (void) +int check_break (void) { if (dump_every_insn) print_current_insn (); @@ -1425,9 +1422,7 @@ check_break (void) return 0; } - -void -monitor_backtrace (void) +void monitor_backtrace (void) { struct function_call *fc = current_function_call; while (fc >= &fctab[0]) { @@ -1436,8 +1431,7 @@ monitor_backtrace (void) } } -int -monitor6809 (void) +int monitor6809 (void) { int rc; diff --git a/monitor.h b/monitor.h index a93091c..c965fbd 100644 --- a/monitor.h +++ b/monitor.h @@ -1,4 +1,5 @@ - +#ifndef MONITOR_H +#define MONITOR_H #define S_NAMED 0x1 #define S_OFFSET 0x2 @@ -16,6 +17,7 @@ #define PROMPT_CYCLES 0x2 #define PROMPT_INSN 0x4 +#include "6809.h" struct cpu_regs { unsigned X, Y, S, U, PC; @@ -77,6 +79,12 @@ void monitor_call (unsigned int flags); void monitor_return (void); const char * monitor_addr_name (target_addr_t addr); const char * absolute_addr_name (unsigned long addr); +void monitor_backtrace (void); +const char* monitor_addr_name (target_addr_t target_addr); +int load_s19(FILE *fp); +int load_hex (FILE *fp); +int load_map_file (const char *name); +int sizeof_file(FILE * file); - +#endif diff --git a/os9syscalls.h b/os9syscalls.h new file mode 100644 index 0000000..33d1eb7 --- /dev/null +++ b/os9syscalls.h @@ -0,0 +1,200 @@ +/******************************************************************** +* os9.h - NitrOS-9 System Definitions +* +* $Id$ +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +*/ +/* ORG 0 */ +char *os9syscall[] = { +"F$Link", /* $00 Link to Module */ +"F$Load", /* $01 Load Module from File */ +"F$UnLink", /* $02 Unlink Module */ +"F$Fork", /* $03 Start New Process */ +"F$Wait", /* $04 Wait for Child Process to Die */ +"F$Chain", /* $05 Chain Process to New Module */ +"F$Exit", /* $06 Terminate Process */ +"F$Mem", /* $07 Set Memory Size */ +"F$Send", /* $08 Send Signal to Process */ +"F$Icpt", /* $09 Set Signal Intercept */ +"F$Sleep", /* $0A Suspend Process */ +"F$SSpd", /* $0B Suspend Process */ +"F$ID", /* $0C Return Process ID */ +"F$SPrior", /* $0D Set Process Priority */ +"F$SSWI", /* $0E Set Software Interrupt */ +"F$PErr", /* $0F Print Error */ +"F$PrsNam", /* $10 Parse Pathlist Name */ +"F$CmpNam", /* $11 Compare Two Names */ +"F$SchBit", /* $12 Search Bit Map */ +"F$AllBit", /* $13 Allocate in Bit Map */ +"F$DelBit", /* $14 Deallocate in Bit Map */ +"F$Time", /* $15 Get Current Time */ +"F$STime", /* $16 Set Current Time */ +"F$CRC", /* $17 Generate CRC ($17) */ + +/* IFGT Level-1 */ + + /* NitrOS-9 Level 2 system calls */ +"F$GPrDsc", /* $18 Get Process Descriptor copy ($18) */ +"F$GBlkMp", /* $19 Get System Block Map copy ($19) */ +"F$GModDr", /* $1A Get Module Directory copy ($1A) */ +"F$CpyMem", /* $1B Copy External Memory ($1B) */ +"F$SUser", /* $1C Set User ID number ($1C) */ +"F$UnLoad", /* $1D Unlink Module by name ($1D) */ +"F$Alarm", /* $1E Color Computer 3 Alarm Call ($1E) */ +"F$1F", /* $1F RMB 1 Reserved - For overlap of other systems ($1F) */ +"F$20", /* $20 RMB 1 Reserved - For overlap of other systems ($1F) */ +"F$NMLink", /* $21 Color Computer 3 Non-Mapping Link ($21) */ +"F$NMLoad", /* $22 Color Computer 3 Non-Mapping Load ($22) */ + +/* ELSE + +* NitrOS-9 Level 1 system call padding + RMB 11 + + ENDC +*/ + +"F$Debu", /* $23 Drop the system into the debugger ($23) */ +"F$24", /* $24 Dummy */ + +/* IFGT Level-1 + + ORG $25 */ +"F$TPS", /* $25 Return System's Ticks Per Second */ +"F$TimAlm", /* $26 CoCo individual process alarm call */ + +/* ENDC */ + + /* ORG $27 Beginning of System Reserved Calls */ +/* NitrOS-9 common system calls */ +"F$VIRQ", /* $27 Install/Delete Virtual IRQ */ +"F$SRqMem", /* $28 System Memory Request */ +"F$SRtMem", /* $29 System Memory Return */ +"F$IRQ", /* $2A Enter IRQ Polling Table */ +"F$IOQu", /* $2B Enter I/O Queue */ +"F$AProc", /* $2C Enter Active Process Queue */ +"F$NProc", /* $2D Start Next Process */ +"F$VModul", /* $2E Validate Module */ +"F$Find64", /* $2f Find Process/Path Descriptor */ +"F$All64", /* $30 Allocate Process/Path Descriptor */ +"F$Ret64", /* $31 Return Process/Path Descriptor */ +"F$SSvc", /* $32 Service Request Table Initialization */ +"F$IODel", /* $33 Delete I/O Module */ + + /* IFGT Level-1 */ + +"F$SLink", /* $34 System Link */ +"F$Boot", /* $35 Bootstrap System */ +"F$BtMem", /* $36 Bootstrap Memory Request */ +"F$GProcP", /* $37 Get Process ptr */ +"F$Move", /* $38 Move Data (low bound first) */ +"F$AllRAM", /* $39 Allocate RAM blocks */ +"F$AllImg", /* $3A Allocate Image RAM blocks */ +"F$DelImg", /* $3B Deallocate Image RAM blocks */ +"F$SetImg", /* $3C Set Process DAT Image */ +"F$FreeLB", /* $3D Get Free Low Block */ +"F$FreeHB", /* $3E Get Free High Block */ +"F$AllTsk", /* $3F Allocate Process Task number */ +"F$DelTsk", /* $40 Deallocate Process Task number */ +"F$SetTsk", /* $41 Set Process Task DAT registers */ +"F$ResTsk", /* $42 Reserve Task number */ +"F$RelTsk", /* $43 Release Task number */ +"F$DATLog", /* $44 Convert DAT Block/Offset to Logical */ +"F$DATTmp", /* $45 Make temporary DAT image (Obsolete) */ +"F$LDAXY", /* $46 Load A [X,[Y]] */ +"F$LDAXYP", /* $47 Load A [X+,[Y]] */ +"F$LDDDXY", /* $48 Load D [D+X,[Y]] */ +"F$LDABX", /* $49 Load A from 0,X in task B */ +"F$STABX", /* $4A Store A at 0,X in task B */ +"F$AllPrc", /* $4B Allocate Process Descriptor */ +"F$DelPrc", /* $4C Deallocate Process Descriptor */ +"F$ELink", /* $4D Link using Module Directory Entry */ +"F$FModul", /* $4E Find Module Directory Entry */ +"F$MapBlk", /* $4F Map Specific Block */ +"F$ClrBlk", /* $50 Clear Specific Block */ +"F$DelRAM", /* $51 Deallocate RAM blocks */ +"F$GCMDir", /* $52 Pack module directory */ +"F$AlHRAM", /* $53 Allocate HIGH RAM Blocks */ + +/* Alan DeKok additions */ +"F$ReBoot", /* $54 Reboot machine (reload OS9Boot) or drop to RSDOS */ +"F$CRCMod", /* $55 CRC mode, toggle or report current status */ +"F$XTime", /* $56 Get Extended time packet from RTC (fractions of second) */ +"F$VBlock", /* $57 Verify modules in a block of memory, add to module directory */ +"F$58", +"F$59", +"F$5A", +"F$5B", +"F$5C", +"F$5D", +"F$5E", +"F$5F", +"F$60", +"F$61", +"F$62", +"F$63", +"F$64", +"F$65", +"F$66", +"F$67", +"F$68", +"F$69", +"F$6A", +"F$6B", +"F$6C", +"F$6D", +"F$6E", +"F$6F", + + /* ENDC +* +* Numbers $70 through $7F are reserved for user definitions +* + ORG $70 + IFEQ Level-1 + RMB 16 Reserved for user definition + ELSE */ + +"F$RegDmp", /* $70 Ron Lammardo's debugging register dump */ +"F$NVRAM", /* $71 Non Volatile RAM (RTC battery backed static) read/write */ +"F$72", +"F$73", +"F$74", +"F$75", +"F$76", +"F$77", +"F$78", +"F$79", +"F$7A", +"F$7B", +"F$7C", +"F$7D", +"F$7E", +"F$7F", + + +/************************************** +* I/O Service Request Code Definitions +*/ +/* ORG $80 */ +"I$Attach", /* $80 Attach I/O Device */ +"I$Detach", /* $81 Detach I/O Device */ +"I$Dup", /* $82 Duplicate Path */ +"I$Create", /* $83 Create New File */ +"I$Open", /* $84 Open Existing File */ +"I$MakDir", /* $85 Make Directory File */ +"I$ChgDir", /* $86 Change Default Directory */ +"I$Delete", /* $87 Delete File */ +"I$Seek", /* $88 Change Current Position */ +"I$Read", /* $89 Read Data */ +"I$Write", /* $8A Write Data */ +"I$ReadLn", /* $8B Read Line of ASCII Data */ +"I$WritLn", /* $8C Write Line of ASCII Data */ +"I$GetStt", /* $8D Get Path Status */ +"I$SetStt", /* $8E Set Path Status */ +"I$Close", /* $8F Close Path */ +"I$DeletX", /* $90 Delete from current exec dir */ +}; diff --git a/serial.c b/serial.c index 80fa765..d68614a 100644 --- a/serial.c +++ b/serial.c @@ -20,35 +20,22 @@ #include #include +#include #include #include +#include #include +#include #include "machine.h" +#include "serial.h" /* Emulate a serial port. Basically this driver can be used for any byte-at-a-time input/output interface. */ -struct serial_port -{ - unsigned int ctrl; - unsigned int status; - int fin; - int fout; -}; - -/* The I/O registers exposed by this driver */ -#define SER_DATA 0 /* Data input/output */ -#define SER_CTL_STATUS 1 /* Control (write) and status (read) */ - #define SER_CTL_ASYNC 0x1 /* Enable async mode (more realistic) */ - #define SER_CTL_RESET 0x2 /* Reset device */ - - #define SER_STAT_READOK 0x1 - #define SER_STAT_WRITEOK 0x2 void serial_update (struct serial_port *port) { fd_set infds, outfds; struct timeval timeout; - int rc; FD_ZERO (&infds); FD_SET (port->fin, &infds); @@ -56,7 +43,7 @@ void serial_update (struct serial_port *port) FD_SET (port->fout, &outfds); timeout.tv_sec = 0; timeout.tv_usec = 0; - rc = select (2, &infds, &outfds, NULL, &timeout); + select (2, &infds, &outfds, NULL, &timeout); if (FD_ISSET (port->fin, &infds)) port->status |= SER_STAT_READOK; else @@ -70,6 +57,7 @@ void serial_update (struct serial_port *port) U8 serial_read (struct hw_device *dev, unsigned long addr) { struct serial_port *port = (struct serial_port *)dev->priv; + int retval; serial_update (port); switch (addr) { @@ -78,23 +66,29 @@ U8 serial_read (struct hw_device *dev, unsigned long addr) U8 val; if (!(port->status & SER_STAT_READOK)) return 0xFF; - read (port->fin, &val, 1); + retval = read (port->fin, &val, 1); + assert(retval != -1); return val; } case SER_CTL_STATUS: - return port->status; - } + return port->status; + default: + fprintf(stderr, "serial_read() from undefined addr\n"); + } + return 0x42; } void serial_write (struct hw_device *dev, unsigned long addr, U8 val) { struct serial_port *port = (struct serial_port *)dev->priv; + int retval; switch (addr) { case SER_DATA: { U8 v = val; - write (port->fout, &v, 1); + retval = write (port->fout, &v, 1); + assert(retval != -1); break; } case SER_CTL_STATUS: @@ -112,6 +106,7 @@ void serial_reset (struct hw_device *dev) struct hw_class serial_class = { + .name = "serial", .readonly = 0, .reset = serial_reset, .read = serial_read, @@ -120,8 +115,7 @@ struct hw_class serial_class = extern U8 null_read (struct hw_device *dev, unsigned long addr); - -struct hw_device *serial_create (void) +struct hw_device* serial_create (void) { struct serial_port *port = malloc (sizeof (struct serial_port)); port->fin = STDIN_FILENO; @@ -129,10 +123,9 @@ struct hw_device *serial_create (void) return device_attach (&serial_class, 4, port); } -struct hw_device *hostfile_create (const char *filename, int flags) +struct hw_device* hostfile_create (const char *filename, int flags) { struct serial_port *port = malloc (sizeof (struct serial_port)); - port->fin = port->fout = open (filename, O_CREAT | flags); + port->fin = port->fout = open(filename, O_CREAT | flags, S_IRUSR | S_IWUSR); return device_attach (&serial_class, 4, port); } - diff --git a/serial.h b/serial.h new file mode 100644 index 0000000..a3cc8f4 --- /dev/null +++ b/serial.h @@ -0,0 +1,51 @@ +/* + * Copyright 2009 by Brian Dominy + * + * This file is part of GCC6809. + * + * GCC6809 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GCC6809 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GCC6809; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SERIAL_H +#define SERIAL_H + +/* Emulate a serial port. Basically this driver can be used for any byte-at-a-time +input/output interface. */ +struct serial_port +{ + unsigned int ctrl; + unsigned int status; + int fin; + int fout; +}; + +/* The I/O registers exposed by this driver */ +#define SER_DATA 0 /* Data input/output */ +#define SER_CTL_STATUS 1 /* Control (write) and status (read) */ + #define SER_CTL_ASYNC 0x1 /* Enable async mode (more realistic) */ + #define SER_CTL_RESET 0x2 /* Reset device */ + + #define SER_STAT_READOK 0x1 + #define SER_STAT_WRITEOK 0x2 + +void serial_update (struct serial_port *port); +U8 serial_read (struct hw_device *dev, unsigned long addr); +void serial_write (struct hw_device *dev, unsigned long addr, U8 val); +void serial_reset (struct hw_device *dev); +extern U8 null_read (struct hw_device *dev, unsigned long addr); +struct hw_device* serial_create (void); +struct hw_device* hostfile_create (const char *filename, int flags); + +#endif diff --git a/symtab.c b/symtab.c index 0951329..edc4ee1 100644 --- a/symtab.c +++ b/symtab.c @@ -152,7 +152,7 @@ const char *sym_lookup (struct symtab *symtab, unsigned long value) return chain->name; chain = chain->value_chain; } - symtab = symtab->parent; + symtab = symtab->parent; /* [NAC HACK 26Jul2016] ->parent never used. Remove*/ } return NULL; } @@ -163,20 +163,20 @@ struct symbol *sym_add (struct symtab *symtab, { unsigned int hash; struct symbol *s, *chain; - - s = malloc (sizeof (struct symbol)); + + s = malloc (sizeof (struct symbol)); s->name = stringspace_copy (name); s->value = value; s->type = type; s->ty.format = 0; s->ty.size = 0; - - hash = sym_hash_name (name); + + hash = sym_hash_name (name); chain = symtab->syms_by_name[hash]; s->name_chain = chain; symtab->syms_by_name[hash] = s; - hash = sym_hash_value (value); + hash = sym_hash_value (value); chain = symtab->syms_by_value[hash]; s->value_chain = chain; symtab->syms_by_value[hash] = s; @@ -196,9 +196,9 @@ void sym_set (struct symtab *symtab, } -void for_each_var (void (*cb) (struct symbol *, unsigned int size)) +void symtab_print (struct symtab *symtab) { - struct symtab *symtab = &program_symtab; + // struct symtab *symtab = &program_symtab; absolute_address_t addr; const char *id; struct symbol *sym; diff --git a/symtab.h b/symtab.h new file mode 100644 index 0000000..a1aea4d --- /dev/null +++ b/symtab.h @@ -0,0 +1,29 @@ +/* + * Copyright 2008 by Brian Dominy + * + * This file is part of the Portable 6809 Simulator. + * + * The Simulator is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * The Simulator is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SYMTAB_H +#define SYMTAB_H + +#include "6809.h" + +void sym_init (void); +void symtab_print (struct symtab *symtab); + +#endif diff --git a/timer.c b/timer.c index 6d618a3..8011847 100644 --- a/timer.c +++ b/timer.c @@ -19,26 +19,13 @@ */ #include +#include #include "machine.h" +#include "6809.h" +#include "imux.h" +#include "timer.h" /* A hardware timer counts CPU cycles and can generate interrupts periodically. */ -struct hwtimer -{ - int count; /* The current value of the timer */ - unsigned int reload; /* Value to reload into the timer when it reaches zero */ - unsigned int resolution; /* Resolution of CPU registers (cycles/tick) */ - unsigned int flags; - unsigned long prev_cycles; - struct hw_device *int_dev; /* Which interrupt mux we use */ - unsigned int int_line; /* Which interrupt to signal */ -}; - -/* The I/O registers exposed by this driver */ -#define HWT_COUNT 0 /* The 8-bit timer counter */ -#define HWT_RELOAD 1 /* The 8-bit reload counter */ -#define HWT_FLAGS 2 /* Misc. flags */ - #define HWTF_INT 0x80 /* Generate interrupt at zero */ - /* * Called by the system to indicate that some number of CPU cycles have passed. @@ -103,6 +90,9 @@ U8 hwtimer_read (struct hw_device *dev, unsigned long addr) return timer->reload / timer->resolution; case HWT_FLAGS: return timer->flags; + default: + fprintf(stderr, "Read hwtimer from undefined addr\n"); + return 0x42; } } @@ -119,7 +109,7 @@ void hwtimer_write (struct hw_device *dev, unsigned long addr, U8 val) break; case HWT_FLAGS: timer->flags = val; - break; + break; } } @@ -143,6 +133,7 @@ void oscillator_reset (struct hw_device *dev) struct hw_class hwtimer_class = { + .name = "hwtimer", .readonly = 0, .reset = hwtimer_reset, .read = hwtimer_read, @@ -168,7 +159,7 @@ struct hw_class oscillator_class = .update = hwtimer_update, }; -struct hw_device *oscillator_create (struct hw_device *int_dev, unsigned int int_line) +struct hw_device *oscillator_create(struct hw_device *int_dev, unsigned int int_line) { struct hwtimer *timer = malloc (sizeof (struct hwtimer)); timer->reload = 2048; /* cycles per pulse */ diff --git a/timer.h b/timer.h new file mode 100644 index 0000000..8dd8dfd --- /dev/null +++ b/timer.h @@ -0,0 +1,56 @@ +/* + * Copyright 2009 by Brian Dominy + * + * This file is part of GCC6809. + * + * GCC6809 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GCC6809 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GCC6809; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef TIMER_H +#define TIMER_H + +/* A hardware timer counts CPU cycles and can generate interrupts periodically. */ +struct hwtimer +{ + int count; /* The current value of the timer */ + unsigned int reload; /* Value to reload into the timer when it reaches zero */ + unsigned int resolution; /* Resolution of CPU registers (cycles/tick) */ + unsigned int flags; + unsigned long prev_cycles; + struct hw_device *int_dev; /* Which interrupt mux we use */ + unsigned int int_line; /* Which interrupt to signal */ +}; + +/* The I/O registers exposed by this driver */ +#define HWT_COUNT 0 /* The 8-bit timer counter */ +#define HWT_RELOAD 1 /* The 8-bit reload counter */ +#define HWT_FLAGS 2 /* Misc. flags */ + #define HWTF_INT 0x80 /* Generate interrupt at zero */ + + +/* + * Called by the system to indicate that some number of CPU cycles have passed. + */ +void hwtimer_decrement (struct hwtimer *timer, unsigned int cycles); +void hwtimer_update (struct hw_device *dev); +U8 hwtimer_read (struct hw_device *dev, unsigned long addr); +void hwtimer_write (struct hw_device *dev, unsigned long addr, U8 val); +void hwtimer_reset (struct hw_device *dev); +void oscillator_reset (struct hw_device *dev); +struct hw_device *hwtimer_create (struct hw_device *int_dev, unsigned int int_line); +struct hw_device *oscillator_create(struct hw_device *int_dev, unsigned int int_line); + +#endif diff --git a/wpc.c b/wpc.c index 8abe817..87d3616 100644 --- a/wpc.c +++ b/wpc.c @@ -24,11 +24,13 @@ #else #error #endif +#include #include #include #include #include #include "wpclib.h" +#include "machine.h" #define WPC_RAM_BASE 0x0000 #define WPC_RAM_SIZE 0x2000 @@ -191,7 +193,6 @@ static U8 wpc_get_console_state (void) static U8 wpc_console_read (void) { - int rc; U8 c = 0; if (!wpc_console_inited) @@ -200,7 +201,7 @@ static U8 wpc_console_read (void) return 0; } - rc = read (0, &c, 1); + read (0, &c, 1); return c; } @@ -269,6 +270,8 @@ unsigned int wpc_read_switch_column (int col) void wpc_write_lamp (int num, int flag) { + (void) num; // silence warning unused parameter + (void) flag; } @@ -286,8 +289,7 @@ void wpc_dmd_set_visible (U8 val) { char *p; struct wpc_message msg; - int rc; - int i, n; + int i; static unsigned long last_firq_time = 0; unsigned long now; static int no_change_count = 0; @@ -333,7 +335,7 @@ void wpc_dmd_set_visible (U8 val) wpc_msg_init (CODE_DMD_PAGE, &msg); for (i=0; i < 3; i++) { - p = wpc->dmd_dev->priv + wpc->dmd_visibles[i] * 512; + p = (char*) wpc->dmd_dev->priv + wpc->dmd_visibles[i] * 512; msg.u.dmdpage.phases[i].page = wpc->dmd_visibles[i]; memcpy (&msg.u.dmdpage.phases[i].data, p, 512); } @@ -498,7 +500,6 @@ void wpc_update_ram (void) WPC_RAM_SIZE - size_writable, MAP_READABLE); } - void wpc_set_rom_page (unsigned char val) { bus_map (WPC_PAGED_REGION, 2, val * WPC_PAGED_SIZE, WPC_PAGED_SIZE, MAP_READABLE); @@ -588,7 +589,7 @@ void wpc_asic_write (struct hw_device *dev, unsigned long addr, U8 val) case WPC_SOL_FLASH1_OUTPUT: case WPC_SOL_LOWPOWER_OUTPUT: if (val != 0) - printf (">>> ASIC write %04X %02X\n", addr + WPC_ASIC_BASE, val); + printf (">>> ASIC write %04lX %02X\n", addr + WPC_ASIC_BASE, val); break; default: @@ -627,6 +628,7 @@ void wpc_asic_reset (struct hw_device *dev) struct hw_class wpc_asic_class = { + .name = "wpc_asic", .reset = wpc_asic_reset, .read = wpc_asic_read, .write = wpc_asic_write, @@ -647,10 +649,13 @@ struct hw_device *wpc_asic_create (void) void wpc_fault (unsigned int addr, unsigned char type) { + (void) addr; // silence warning unused parameter + (void) type; } void wpc_dump_thread (unsigned int thread_id) { + (void) thread_id; // silence warning unused parameter } void io_sym_add (const char *name, unsigned long cpuaddr) @@ -664,8 +669,6 @@ void io_sym_add (const char *name, unsigned long cpuaddr) void wpc_init (const char *boot_rom_file) { struct hw_device *dev; - int rc; - struct sockaddr_in myaddr; device_define ( dev = wpc_asic_create (), 0, WPC_ASIC_BASE, WPC_PAGED_REGION - WPC_ASIC_BASE, MAP_READWRITE); diff --git a/wpclib.c b/wpclib.c index 526c65e..2ea60f1 100644 --- a/wpclib.c +++ b/wpclib.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "wpclib.h" #define UDP_PORT 7400 @@ -58,7 +59,7 @@ int udp_socket_create (int port) return s; } -int udp_socket_send (int s, int dstport, const void *data, int len) +int udp_socket_send (int s, int dstport, const void *data, socklen_t len) { int rc; struct sockaddr_in to; @@ -75,11 +76,10 @@ int udp_socket_send (int s, int dstport, const void *data, int len) return rc; } -int udp_socket_receive (int s, int dstport, void *data, int len) +int udp_socket_receive (int s, int dstport, void *data, socklen_t len) { int rc; struct sockaddr_in from; - int fromlen; rc = recvfrom (s, data, len, 0, (struct sockaddr *)&from, &len); if ((rc < 0) && (errno != EAGAIN)) @@ -98,12 +98,6 @@ int wpc_msg_init (int code, struct wpc_message *msg) return 0; } -int wpc_msg_insert (struct wpc_message *msg, const void *p, int len) -{ - memcpy (msg->u.data + msg->len, p, len); - msg->len += len; -} - int wpc_msg_send (int s, int dstport, struct wpc_message *msg) { int rc = udp_socket_send (s, dstport, msg, msg->len + sizeof (struct wpc_message) - 1000); diff --git a/wpclib.h b/wpclib.h index 84c9316..6fc7985 100644 --- a/wpclib.h +++ b/wpclib.h @@ -3,8 +3,8 @@ #define _WPCLIB_H int udp_socket_create (int port); -int udp_socket_send (int s, int dstport, const void *data, int len); -int udp_socket_receive (int s, int dstport, void *data, int len); +int udp_socket_send (int s, int dstport, const void *data, socklen_t len); +int udp_socket_receive (int s, int dstport, void *data, socklen_t len); int udp_socket_close (int s); #define NUM_DMD_PHASES 3 @@ -33,7 +33,6 @@ struct wpc_message }; int wpc_msg_init (int code, struct wpc_message *msg); -int wpc_msg_insert (struct wpc_message *msg, const void *p, int len); int wpc_msg_send (int s, int dstport, struct wpc_message *msg); #define CODE_DMD_PAGE 0