(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:TMP) op: assign_op.Equal rhs: { (braced_var_sub token: (Token id:Id.VSub_Name val:TMP span_id:42) suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {(Id.Lit_Slash /) (tmp)} ) ) } spids: [40] ) ] ) (C {(readonly)} {(TMP)}) (command.ShFunction name: log body: (command.BraceGroup children: [ (command.Simple words: [{(echo)} {(DQ ($ Id.VSub_Number '$0') (': ') ($ Id.VSub_At '$@'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'1>&' span_id:74) fd: 1 arg_word: {(2)} ) ] ) ] ) ) (command.ShFunction name: die body: (command.BraceGroup children: [ (command.Simple words: [{(echo)} {(DQ ($ Id.VSub_Number '$0') (' ERROR: ') ($ Id.VSub_At '$@'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'1>&' span_id:95) fd: 1 arg_word: {(2)} ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:99) arg_word: {(1)} ) ] ) ) (command.ShFunction name: show_help body: (command.BraceGroup children: [ (command.Simple words: [{(cat)}] redirects: [ (redir.HereDoc op: (Token id:Id.Redir_DLess val:'<<' span_id:115) fd: -1 here_begin: {(EOF)} here_end_span_id: 127 stdin_parts: [ ('Usage: ./configure [OPTION]\n') ('\n') ('Detects system settings before a build of Oil.\n') ('\n') (' --prefix Prefix for the bin/ directory [/usr/local]\n') (' --with-readline Fail unless readline is available.\n') (" --without-readline Don't compile with readline, even if it's available.\n") ("\t\t The shell won't have any interactive features.\n") ] ) ] ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FLAG_prefix) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:/usr/local span_id:142))} spids: [140] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FLAG_with_readline) op: assign_op.Equal rhs: {(SQ )} spids: [145] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FLAG_without_readline) op: assign_op.Equal rhs: {(SQ )} spids: [152] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:160) cond: [ (command.Sentence child: (C {(true)}) terminator: (Token id:Id.Op_Semi val:';' span_id:163) ) ] body: (command.DoGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_Number '$1'))} arms: [ (case_arm pat_list: [{(SQ )}] action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:182) ) ] spids: [177 179 185 -1] ) (case_arm pat_list: [{(--help)}] action: [ (C {(show_help)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:199) arg_word: {(0)} ) ] spids: [188 189 204 -1] ) (case_arm pat_list: [{(--with-readline)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FLAG_with_readline) op: assign_op.Equal rhs: {(1)} spids: [212] ) ] ) ] spids: [208 209 216 -1] ) (case_arm pat_list: [{(--without-readline)}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FLAG_without_readline) op: assign_op.Equal rhs: {(1)} spids: [224] ) ] ) ] spids: [220 221 228 -1] ) (case_arm pat_list: [{(--prefix) (Id.Lit_Equals '=') (Id.Lit_Star '*')}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FLAG_prefix) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:247) command_list: (command.CommandList children: [ (C {(expr)} {(DQ ($ Id.VSub_Number '$1'))} {(Id.Lit_Other ':')} { (SQ (Token id: Id.Lit_Chars val: '--prefix=\\(.*\\)' span_id: 257 ) ) } ) ] ) ) } spids: [246] ) ] ) ] spids: [240 243 262 -1] ) (case_arm pat_list: [{(--prefix)}] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {($ Id.VSub_Pound '$#')} {(-eq)} {(1)}) terminator: (Token id:Id.Op_Semi val:';' span_id:278) ) ] action: [(C {(die)} {(DQ ('--prefix requires an argument'))})] spids: [269 280] ) ] ) (C {(shift)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FLAG_prefix) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [296] ) ] ) ] spids: [265 266 300 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [(C {(die)} {(DQ ("Invalid argument '") ($ Id.VSub_Number '$1') ("'"))})] spids: [303 304 316 -1] ) ] ) (C {(shift)}) ] ) ) (command.ShFunction name: cc_quiet body: (command.BraceGroup children: [ (command.Simple words: [{(cc)} {(DQ ($ Id.VSub_At '$@'))} {(-o)} {(/dev/null)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:350) fd: -1 arg_word: {(/dev/null)} ) (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'2>&' span_id:353) fd: 2 arg_word: {(1)} ) ] ) ] ) ) (command.ShFunction name: cc_or_die body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [{(cc)} {(DQ ($ Id.VSub_At '$@'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:376) fd: -1 arg_word: {($ Id.VSub_DollarName '$TMP') (/cc.log)} ) (redir.Redir op: (Token id:Id.Redir_GreatAnd val:'2>&' span_id:380) fd: 2 arg_word: {(1)} ) ] ) ] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:382) ) ] action: [ (C {(log)} {(DQ ("Error running 'cc ") ($ Id.VSub_At '$@') ("':"))}) (C {(cat)} {($ Id.VSub_DollarName '$TMP') (/cc.log)}) (C {(die)} {(DQ ('Fatal compile error running feature test'))}) ] spids: [366 384] ) ] ) ] ) ) (command.ShFunction name: cc_statement body: (command.BraceGroup children: [ (C {(local)} {(Id.Lit_VarLike 'pp_var=') (DQ ($ Id.VSub_Number '$1'))}) (C {(local)} {(Id.Lit_VarLike 'prog=') (DQ ($ Id.VSub_Number '$2'))}) (command.Simple words: [{(cat)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:443) fd: -1 arg_word: {($ Id.VSub_DollarName '$TMP') (/cc_statement.c)} ) (redir.HereDoc op: (Token id:Id.Redir_DLess val:'<<' span_id:447) fd: -1 here_begin: {(EOF)} here_end_span_id: 456 stdin_parts: [('int main() {\n') (' ') ($ Id.VSub_DollarName '$prog') ('\n') ('}\n')] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(cc_quiet)} {($ Id.VSub_DollarName '$TMP') (/cc_statement.c)}) terminator: (Token id:Id.Op_Semi val:';' span_id:468) ) ] action: [ (C {(echo)} {(DQ ('#define ') ($ Id.VSub_DollarName '$pp_var') (' 1'))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:482) arg_word: {(0)} ) ] spids: [462 470] ) ] else_action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:490) arg_word: {(1)} ) ] ) ] ) ) (command.ShFunction name: detect_readline body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(cc_quiet)} {(build/detect-readline.c)} {(-l)} {(readline)}) terminator: (Token id:Id.Op_Semi val:';' span_id:519) ) ] action: [(C {(echo)} {(SQ (Token id:Id.Lit_Chars val:'HAVE_READLINE=1' span_id:527))})] spids: [510 521] ) ] else_action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(DQ ($ Id.VSub_DollarName '$FLAG_with_readline'))} {(Id.Lit_Equals '=')} {(1)} ) terminator: (Token id:Id.Op_Semi val:';' span_id:545) ) ] action: [ (C {(die)} { (SQ (Token id: Id.Lit_Chars val: 'readline was not detected on the system (--with-readline passed).' span_id: 553 ) ) } ) ] spids: [534 547] ) ] ) (C {(echo)} {(SQ (Token id:Id.Lit_Chars val:'HAVE_READLINE=' span_id:563))}) ] ) ] ) ) (command.ShFunction name: detect_and_echo_vars body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(test)} {(DQ ($ Id.VSub_DollarName '$FLAG_without_readline'))} {(Id.Lit_Equals '=')} {(1)} ) terminator: (Token id:Id.Op_Semi val:';' span_id:590) ) ] action: [(C {(echo)} {(SQ (Token id:Id.Lit_Chars val:'HAVE_READLINE=' span_id:598))})] spids: [579 592] ) ] else_action: [(C {(detect_readline)})] ) (C {(echo)} {(DQ ('PREFIX=') ($ Id.VSub_DollarName '$FLAG_prefix'))}) ] ) ) (command.ShFunction name: cc_print_expr body: (command.BraceGroup children: [ (C {(local)} {(Id.Lit_VarLike 'c_expr=') (DQ ($ Id.VSub_Number '$1'))}) (command.Simple words: [{(cat)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:641) fd: -1 arg_word: {($ Id.VSub_DollarName '$TMP') (/print_expr.c)} ) (redir.HereDoc op: (Token id:Id.Redir_DLess val:'<<' span_id:645) fd: -1 here_begin: {(EOF)} here_end_span_id: 661 stdin_parts: [ ('#include <stdio.h>\n') ('#include <sys/types.h> /* size_t, pid_t */\n') ('\n') ('int main() {\n') (' printf(') (Id.Right_DoubleQuote '"') ('%lu') (Id.Right_DoubleQuote '"') (', ') ($ Id.VSub_DollarName '$c_expr') (');\n') ('}\n') ] ) ] ) (C {(cc_or_die)} {(-o)} {($ Id.VSub_DollarName '$TMP') (/print_expr)} {($ Id.VSub_DollarName '$TMP') (/print_expr.c)} ) (command.Simple words: [{($ Id.VSub_DollarName '$TMP') (/print_expr)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:678) fd: -1 arg_word: {($ Id.VSub_DollarName '$TMP') (/print_expr.out)} ) ] ) ] ) ) (command.ShFunction name: check_sizeof body: (command.BraceGroup children: [ (C {(local)} {(Id.Lit_VarLike 'pp_var=') (DQ ($ Id.VSub_Number '$1'))}) (C {(local)} {(Id.Lit_VarLike 'c_type=') (DQ ($ Id.VSub_Number '$2'))}) (C {(local)} {(Id.Lit_VarLike 'min_bytes=') (DQ ($ Id.VSub_Number '$3'))}) (C {(cc_print_expr)} {(DQ ('sizeof(') ($ Id.VSub_DollarName '$c_type') (')'))}) (C {(local)} {(actual_bytes)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:actual_bytes) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:772) command_list: (command.CommandList children: [(C {(cat)} {($ Id.VSub_DollarName '$TMP') (/print_expr.out)})] ) ) } spids: [771] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(test)} {(-n)} {(DQ ($ Id.VSub_DollarName '$min_bytes'))}) (C {(test)} {(DQ ($ Id.VSub_DollarName '$actual_bytes'))} {(-lt)} {(DQ ($ Id.VSub_DollarName '$min_bytes'))} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:804) ) ] action: [ (C {(die)} { (DQ ('sizeof(') ($ Id.VSub_DollarName '$c_type') (') should be at least ') ($ Id.VSub_DollarName '$min_bytes') ('; got ') ($ Id.VSub_DollarName '$actual_bytes') ) } ) ] spids: [781 806] ) ] ) (C {(echo)} { (DQ ('#define ') ($ Id.VSub_DollarName '$pp_var') (' ') ($ Id.VSub_DollarName '$actual_bytes') ) } ) ] ) ) (command.ShFunction name: detect_c_language body: (command.BraceGroup children: [ (C {(check_sizeof)} {(SIZEOF_INT)} {(SQ (Token id:Id.Lit_Chars val:int span_id:857))} {(4)}) (C {(check_sizeof)} {(SIZEOF_LONG)} {(SQ (Token id:Id.Lit_Chars val:long span_id:868))} {(4)}) (C {(check_sizeof)} {(SIZEOF_VOID_P)} {(SQ (Token id:Id.Lit_Chars val:'void *' span_id:879))} {(4)} ) (C {(check_sizeof)} {(SIZEOF_SHORT)} {(SQ (Token id:Id.Lit_Chars val:short span_id:890))} {(2)} ) (C {(check_sizeof)} {(SIZEOF_FLOAT)} {(SQ (Token id:Id.Lit_Chars val:float span_id:901))} {(4)} ) (C {(check_sizeof)} {(SIZEOF_DOUBLE)} {(SQ (Token id:Id.Lit_Chars val:double span_id:912))} {(8)} ) (C {(check_sizeof)} {(SIZEOF_SIZE_T)} {(SQ (Token id:Id.Lit_Chars val:size_t span_id:924))} {(4)} ) (C {(check_sizeof)} {(SIZEOF_FPOS_T)} {(SQ (Token id:Id.Lit_Chars val:fpos_t span_id:944))} {(4)} ) (C {(check_sizeof)} {(SIZEOF_PID_T)} {(SQ (Token id:Id.Lit_Chars val:pid_t span_id:955))} {(4)} ) (C {(check_sizeof)} {(SIZEOF_OFF_T)} {(SQ (Token id:Id.Lit_Chars val:off_t span_id:967))} {(SQ )}) (C {(check_sizeof)} {(SIZEOF_TIME_T)} {(SQ (Token id:Id.Lit_Chars val:time_t span_id:987))} {(SQ )}) (command.If arms: [ (if_arm cond: [ (C {(cc_statement)} {(HAVE_LONG_LONG)} {(SQ (Token id:Id.Lit_Chars val:'long long x; x = (long long)0;' span_id:1002))} ) ] action: [ (C {(check_sizeof)} {(SIZEOF_LONG_LONG)} {(SQ (Token id:Id.Lit_Chars val:'long long' span_id:1014))} {(8)} ) ] spids: [995 1006] ) ] ) (command.If arms: [ (if_arm cond: [ (C {(cc_statement)} {(HAVE_LONG_DOUBLE)} { (SQ (Token id: Id.Lit_Chars val: 'long double x; x = (long double)0;' span_id: 1030 ) ) } ) ] action: [ (C {(check_sizeof)} {(SIZEOF_LONG_DOUBLE)} {(SQ (Token id:Id.Lit_Chars val:'long double' span_id:1042))} {(8)} ) ] spids: [1023 1034] ) ] ) (command.If arms: [ (if_arm cond: [ (C {(cc_statement)} {(HAVE_C99_BOOL)} {(SQ (Token id:Id.Lit_Chars val:'_Bool x; x = (_Bool)0;' span_id:1059))} ) ] action: [ (C {(check_sizeof)} {(SIZEOF__BOOL)} {(SQ (Token id:Id.Lit_Chars val:_Bool span_id:1075))} {(1)} ) ] spids: [1052 1063] ) ] ) (C {(echo)} {(SQ (Token id:Id.Lit_Chars val:'#define HAVE_WCHAR_H 1' span_id:1117))}) (C {(echo)} {(SQ (Token id:Id.Lit_Chars val:'#define SIZEOF_WCHAR_T 4' span_id:1124))}) (command.Simple words: [{(cat)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:1131) fd: -1 arg_word: {($ Id.VSub_DollarName '$TMP') (/detect_va_list.c)} ) (redir.HereDoc op: (Token id:Id.Redir_DLess val:'<<' span_id:1135) fd: -1 here_begin: {(EOF)} here_end_span_id: 1144 stdin_parts: [ ('#include <stdarg.h> /* C89 */\n') ('int main() {\n') (' va_list list1, list2;\n') (' list1 = list2;\n') ('}\n') ] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(cc_quiet)} {($ Id.VSub_DollarName '$TMP') (/detect_va_list.c)}) terminator: (Token id:Id.Op_Semi val:';' span_id:1152) ) ] action: [(C {(echo)} {(SQ )})] spids: [1146 1154] ) ] else_action: [ (C {(echo)} {(SQ (Token id:Id.Lit_Chars val:'#define VA_LIST_IS_ARRAY 1' span_id:1172))}) ] ) ] ) ) (command.ShFunction name: main body: (command.BraceGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [(C {(cc_quiet)} {(build/detect-cc.c)})] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:1204) ) ] action: [(C {(die)} {(DQ ("Couldn't compile a basic C program (cc not installed?)"))})] spids: [1197 1206] ) ] ) (C {(mkdir)} {(-p)} {(_build)}) (C {(local)} {(Id.Lit_VarLike 'sh_out=') (_build/detected-config.sh)}) (C {(local)} {(Id.Lit_VarLike 'c_out=') (_build/detected-config.h)}) (command.Simple words: [{(detect_and_echo_vars)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:1250) fd: -1 arg_word: {($ Id.VSub_DollarName '$sh_out')} ) ] ) (command.Simple words: [{(detect_c_language)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:1257) fd: -1 arg_word: {($ Id.VSub_DollarName '$c_out')} ) ] ) (C {(log)} { (DQ ('Wrote ') ($ Id.VSub_DollarName '$sh_out') (' and ') ($ Id.VSub_DollarName '$c_out') ) } ) ] ) ) (command.ShFunction name: unittest body: (command.BraceGroup children: [ (C {(cc_print_expr)} {(SQ (Token id:Id.Lit_Chars val:'sizeof(int)' span_id:1285))}) (C {(local)} {(actual)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:actual) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:1295) command_list: (command.CommandList children: [(C {(cat)} {($ Id.VSub_DollarName '$TMP') (/print_expr.out)})] ) ) } spids: [1294] ) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(test)} {(DQ ($ Id.VSub_DollarName '$actual'))} {(Id.Lit_Equals '=')} {(4)}) (C {(die)} {(DQ ('Expected 4, got ') ($ Id.VSub_DollarName '$actual'))}) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(check_sizeof)} {(SIZEOF_INT)} {(SQ (Token id:Id.Lit_Chars val:int span_id:1329))} {(4)} ) (C {(die)} {(DQ (FAILED))}) ] ) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {(cc_statement)} {(HAVE_INT)} {(SQ (Token id:Id.Lit_Chars val:'int x = (int)0;' span_id:1357))} ) (C {(die)} {(DQ (FAILED))}) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(cc_statement)} {(HAVE_FOO)} {(SQ (Token id:Id.Lit_Chars val:'foo x = (foo)0;' span_id:1374))} ) (C {(die)} {(DQ ('Expected to fail'))}) ] ) ] ) ) (C {(main)} {(DQ ($ Id.VSub_At '$@'))}) ] )