diff --git a/programs/games/MSquare/trunk/MSquare.asm b/programs/games/MSquare/trunk/MSquare.asm new file mode 100644 index 0000000000..8b3587a3c2 --- /dev/null +++ b/programs/games/MSquare/trunk/MSquare.asm @@ -0,0 +1,725 @@ +; 10.06.2010 staper@inbox.ru + +;Магический квадрат - это набор таких целых чисел, что их суммы +;в строках, столбцах (реже в диагоналях) равны. + +;Пример: + +; 16 3 2 13 +; 5 10 11 8 +; 9 6 7 12 +; 4 15 14 1 + +use32 +org 0x0 + db 'MENUET01' + dd 0x1, START, I_END, (D_END+100) and not 3, (D_END+100) and not 3, 0, 0 + +;Цвета: +Bckgrd_clr equ 0xffffff ;фон +Brdr_line_clr equ 0xb0b0b0 ;линии по границам +Inter_line_clr equ 0xb0b0b0 ;внутренние линии +Square_clr equ 0xdddddd ;цвет курсора +Fix_nmb_clr equ 0x83459 ;статичное значение +Chg_nmb_clr equ 0;x008d8d ;переменное значение +Text_clr equ 0x000000 ;текст +Message_clr equ 0x0000ff ;сообщения + +max_dif equ 10 +min_dif equ 2 +len_kub equ 30 ;длина стороны квадратика +beg_x equ 40 ;координата Х левого верхнего угла +beg_y equ 50 ;координата Y левого верхнего угла +sym_x equ 20 +sym_y equ 20 +win_x equ 400 ;ширина окна +win_y equ 400 ;высота окна + + +DEBUG equ 0 + +macro dbg_dec num +{pushad +newline +debug_print_dec num +popad +} + +include 'macros.inc' +;include 'debug.inc' +include 'editbox_ex.mac' +include 'lang.inc' + + +START: + ;mcall 40,7 + +redraw_all: + mcall 12,1 + mcall 48,4 + add eax,100*65536+win_x + mov ecx,eax + mcall 0,100*65536+win_y,,(0x34000000+Bckgrd_clr),,title + movzx eax,[Difficult] + mov ebx,len_kub + xor edx,edx + mul ebx + add eax,beg_x*65536+beg_x + xchg eax,ebx + mcall 38,,beg_y*65536+beg_y,Brdr_line_clr + mov edx,Inter_line_clr + movzx esi,[Difficult] + dec esi + @@: add ecx,len_kub*65536+len_kub + mcall + dec esi + jnz @b + add ecx,len_kub*65536+len_kub + mcall ,,,Brdr_line_clr + + movzx eax,[Difficult] + mov ecx,len_kub + xor edx,edx + mul ecx + add eax,(beg_y+1)*65536+beg_y-1 + xchg eax,ecx + mov ebx,beg_x*65536+beg_x + mcall 38,,,Brdr_line_clr + mov edx,Inter_line_clr + movzx esi,[Difficult] + dec esi + + @@: add ebx,len_kub*65536+len_kub + mcall + dec esi + jnz @b + add ebx,len_kub*65536+len_kub + mcall ,,,Brdr_line_clr + + mcall 8,<3,78>,<3,13>,2,0xbbbbbb + mcall 4,<7,5>,(0x80000000+Text_clr),txt.clear + mcall ,<105,5>,,txt.dif + + + call show_level + + push dword Map;esi; mov esi,Map + mcall 12,2 +draw_pole: + if DEBUG + call SysMsgBoardNum ;show esp + endf + + movzx eax,[Y] + dec al + movzx ebx,[Difficult] + mul bl + mov bl,[X] + add al,bl + pop esi ; mov esi,Map + push eax ;курсорчик + movzx eax,[Difficult] + mov ebx,eax + mul eax + sub eax,ebx + mov edi,eax + pop eax + push eax +; mov edi,81-9 + movzx ebp,[Difficult] + mov ebx,beg_x*65536+beg_x+sym_x + mov ecx,beg_y*65536+beg_y+sym_y + call out_numbers + pop eax + call out_sum + +still: + mcall 10 + + dec al + jz redraw_all + dec al + jz key + dec al + jnz still +;button: + mcall 17 + cmp ah,1 + jne @f + mcall -1 +.clear: +@@: mov ecx,max_dif*max_dif + mov esi,Map +@@: mov byte [esi+ecx-1],0 + loop @b + jmp redraw_all + +key: + mcall 2 + +.43: cmp ah,43 ;+ + jne .45 + cmp [Difficult],max_dif + je still + inc [Difficult] + jmp redraw_all + jmp still +.45: ;- + cmp ah,45 + jne .99 + cmp [Difficult],min_dif + je still + dec [Difficult] + jmp redraw_all + jmp still + +.99: cmp ah,0x58 + je @f + cmp ah,0x78 + jne .39 +@@: jmp still.clear + +.39: cmp ah,0x39 + ja .110 + cmp ah,0x30 + jb still + sub ah,0x30 + mov cl,ah + + movzx eax,[Y] + dec al + mov ebx,max_dif;[Difficult] + mul bl + mov bl,[X] + dec bl + add al,bl + + mov esi,Map + bt [flags],9 + jnc @f + mov bl,[esi+eax] + push eax + mov ax,10 + xor dl,dl + mul bl + add cl,al + pop eax + mov [esi+eax],cl + btr [flags],9 + jmp .onedraw + @@: mov [esi+eax],cl + bts [flags],9 + jmp .onedraw + + +.110: cmp ah,110 ;n + jne .176 +.new_game: + jmp redraw_all + +.176: cmp ah,176 ;курсоры + jne .177 + call draw_one_symbol + dec [X] + cmp [X],1 + jge @f + push eax + movzx eax,[Difficult] + mov [X],al + pop eax +@@: btr [flags],9 + jmp .onedraw +.177: cmp ah,177 + jne .178 + call draw_one_symbol + inc [Y] + push eax + movzx eax,[Difficult] + cmp [Y],al + jbe @f + mov [Y],1 +@@: pop eax + btr [flags],9 + jmp .onedraw +.178: cmp ah,178 + jne .179 + call draw_one_symbol + dec [Y] + cmp [Y],1 + jge @f + push eax + movzx eax,[Difficult] + mov [Y],al + pop eax +@@: btr [flags],9 + jmp .onedraw +.179: cmp ah,179 + jne still + call draw_one_symbol + inc [X] + push eax + movzx eax,[Difficult] + cmp [X],al + jbe @f + mov [X],1 +@@: btr [flags],9 + pop eax +.onedraw: + bts [flags],4 + call draw_one_symbol + call out_one_sum + jmp still ;.todraw + +show_level: + movzx ecx,[Difficult] + mcall 47,0x10000,,<205,5>,(0x50000000+Text_clr),Bckgrd_clr +ret + + +draw_one_symbol: + movzx eax,[X] + mov ebx,len_kub*65536+len_kub + mul ebx + xchg eax,ebx + add ebx,(beg_x*65536+beg_y-len_kub*65536+len_kub) + movzx eax,[Y] + mov ecx,len_kub*65536+len_kub + mul ecx + xchg eax,ecx + add ecx,(beg_y*65536+beg_y+sym_y-len_kub*65536+len_kub) + movzx eax,[Y] + dec al + push ebx + movzx ebx,[Difficult] + mul bl + mov bl,[X] + add al,bl + dec al + pop ebx + mov esi,Map + add esi,eax + push dword 0 ;не курсор + bt [flags],4 + jnc @f + mov dword [esp],1 ;курсор + btr [flags],4 +@@: mov edi,0 + mov ebp,1 + call out_numbers + pop eax +ret + + +out_numbers: + push ebx ecx esi + shr ebx,16 + inc bx + shl ebx,16 + add ebx,len_kub-1 + shr ecx,16 + inc cx + shl ecx,16 + add ecx,len_kub-1 + mov edx,Bckgrd_clr + push ebp + dec dword [esp+4*5] + jnz @f + mov edx,Square_clr +@@: mcall 13 + pop ebp + pop esi + + push ebx edx + mov eax,esi + sub eax,Map-1 + xor edx,edx + movzx ebx,[Difficult] + div ebx + push edx + xor edx,edx + mov ebx,max_dif + mul ebx + pop edx + test edx,edx + jnz @f + movzx edx,[Difficult] + sub eax,max_dif +@@: add eax,edx + mov al,[eax+Map-1] + pop edx ebx + test al,al + +; cmp byte [esi],0 + jnz .changeable_number + jmp .null +.end: + inc esi + dec ebp + jnz out_numbers + test edi,edi + jz @f + push ebx edx + movzx eax,[Difficult] + sub edi,eax + mov ebp,eax + mov ebx,len_kub*65536 + xor edx,edx + mul ebx + push eax + movzx eax,[Difficult] + mov ebx,len_kub + mul ebx + pop ebx + add eax,ebx + pop edx + pop ebx + sub ebx,eax +; add ebx,-9*24*65536-9*24 + add ecx,len_kub*65536+len_kub + jmp out_numbers + @@: +ret + + +.null: + pop ecx ebx + add ebx,len_kub*65536+len_kub + jmp .end +.changeable_number: + push esi + shr ebx,16 + shr ecx,16 + mov dx,bx + shl edx,16 + mov dx,cx + add edx,8*65536+4 + + push ebx edx + mov eax,esi + sub eax,Map-1 + xor edx,edx + movzx ebx,[Difficult] + div ebx + push edx + xor edx,edx + mov ebx,max_dif + mul ebx + pop edx + test edx,edx + jnz @f + movzx edx,[Difficult] + sub eax,max_dif +@@: add eax,edx + pop edx ebx + + movzx ebx,byte [eax+Map-1];[esi] + + + push esi ebp edi edx + sub edx,2*65536-3 + push edx + xchg eax,ebx + mov ebx,10 + xor edx,edx + div ebx + mov ebx,edx + pop edx + + push ebx + + test eax,eax + jz .only_first_num + +; bt [flags],9 +; jc .only_first_num + + xchg eax,ebx + + shl bx,4 + add ebx,FONT + mov ecx,8*65536+16 + + mov edi,Pltr.ch + cmp dword [esp+4*9],0 + jne @f + mov edi,Pltr.chk +@@: mov esi,1 + mov ebp,0 + mcall 65 + +.only_first_num: + pop ebx + shl bl,4 + + add ebx,FONT + mov ecx,8*65536+16 + add edx,8*65536 + mov edi,Pltr.ch + cmp dword [esp+4*8],0 + jne @f + mov edi,Pltr.chk +@@: mov esi,1 + mov ebp,0 + mcall 65 + pop edx edi ebp esi + pop esi ecx ebx + add ebx,len_kub*65536+len_kub + jmp .end + +out_sum: + movzx eax,[Difficult] + push eax + mov esi,Map + mov edi,out_sum_buf +.1: xor ebx,ebx + xor ecx,ecx + xor edx,edx +.2: mov dl,[ebx+esi] + add ecx,edx + inc ebx + cmp ebx,[esp] + jne .2 + mov word [edi],cx + add edi,2 + add esi,max_dif + dec eax + jnz .1 + + push out_sum_buf + movzx eax,[Difficult] + mov ebx,len_kub*65536 + xor edx,edx + mul ebx + add eax,40*65536 + push eax + mov edx,(beg_x-30)*65536+beg_y+10 + mov ebx,0x30000 + mov esi,0x50000000+Fix_nmb_clr + mov edi,Bckgrd_clr + +.3: mov ecx,[esp+4] + mov cx,[ecx] + shl ecx,16 + shr ecx,16 + mcall 47 + push edx + add edx,[esp+4] + mcall + pop edx + add edx,len_kub + add dword [esp+4],2 + dec dword [esp+8] + jnz .3 + pop eax + pop eax + pop eax + + + movzx eax,[Difficult] + push eax + mov esi,Map + mov edi,out_sum_buf + xor ebx,ebx +.4: xor ecx,ecx + xor edx,edx + mov ebx,[esp] +.5: mov dl,[esi] + add ecx,edx + add esi,max_dif + dec ebx + jnz .5 + mov word [edi],cx + add edi,2 + push eax + mov eax,max_dif + xor edx,edx + mul dword [esp+4] + dec eax + sub esi,eax + pop eax + dec eax + jnz .4 + + push out_sum_buf + movzx eax,[Difficult] + mov ebx,len_kub + xor edx,edx + mul ebx + add eax,35 + push eax + mov edx,(beg_x+5)*65536+beg_y-20 + mov ebx,0x30000 + mov esi,0x50000000+Fix_nmb_clr + mov edi,Bckgrd_clr + +.6: mov ecx,[esp+4] + mov ecx,[ecx] + shl ecx,16 + shr ecx,16 + mcall 47 + push edx + add edx,[esp+4] + mcall + pop edx + add edx,len_kub*65536;[esp] + add dword [esp+4],2 + dec dword [esp+8] + jnz .6 + pop eax + pop eax + pop eax +ret + + + +out_one_sum: + movzx ecx,[Difficult] + mov esi,Map + xor edx,edx + + movzx eax,[Y] + dec al + mov ebx,max_dif + mul bl + add esi,eax +@@: mov al,[esi] + inc esi + add edx,eax + loop @b + + mov ecx,edx + movzx eax,[Difficult] + mov ebx,len_kub*65536 + xor edx,edx + mul ebx + add eax,40*65536 + push eax + movzx eax,[Y] + dec eax + mov ebx,len_kub + xor edx,edx + mul ebx + mov edx,(beg_x-30)*65536+beg_y+10 + add edx,eax + mov ebx,0x30000 + mov esi,0x50000000+Fix_nmb_clr + mov edi,Bckgrd_clr + + mcall 47 + add edx,[esp] + mcall + pop eax + + + + + movzx ecx,[Difficult] + mov esi,Map + xor edx,edx + + movzx eax,[X] + dec al + add esi,eax +@@: mov al,[esi] + add esi,max_dif + add edx,eax + loop @b + + mov ecx,edx + movzx eax,[Difficult] + mov ebx,len_kub + xor edx,edx + mul ebx + add eax,35 + push eax + movzx eax,[X] + dec eax + mov ebx,len_kub*65536 + xor edx,edx + mul ebx + mov edx,eax + add edx,(beg_x+5)*65536+beg_y-20 + mov ebx,0x30000 + mov esi,0x50000000+Fix_nmb_clr + mov edi,Bckgrd_clr + + mcall 47 + add edx,[esp] + mcall + + pop edx + +ret + + + + +if DEBUG +SysMsgBoardNum: ;warning: destroys eax,ebx,ecx,esi + mov ebx,esp + mov ecx,8 + mov esi,(number_to_out+1) +.1: + mov eax,ebx + and eax,0xF + add al,'0' + cmp al,(10+'0') + jb @f + add al,('A'-'0'-10) +@@: + mov [esi+ecx],al + shr ebx,4 + loop .1 + dec esi + mcall 71,1,number_to_out +ret + +number_to_out db '0x00000000',13,10,0 +endf + + + + + +if lang eq ru +title db 'Магический квадрат',0 +txt: +.dif db "Сложность (+/-):",0 +.clear db 'Очистить (x)',0 +else +title db 'Magical square',0 +txt: +.dif db "Difficult (+/-)",0 +.clear db 'Clear (x)',0 +endf + + + + +align 4 +;Палитры: +Pltr: +.ch dd Bckgrd_clr,Chg_nmb_clr +.chk dd Square_clr,Chg_nmb_clr +.fx dd Bckgrd_clr,Fix_nmb_clr +.fxk dd Square_clr,Fix_nmb_clr + +FONT file "MSquare.fnt" + +X db 1 +Y db 1 + +Difficult db 3 + +I_END: +align 16 +Map rb max_dif*max_dif +out_sum_buf rw max_dif + +flags rw 1 + +D_END: +;бит 0: см. перед draw_pole +;2: в draw_pole и key +;4: in draw_one_symbol +;9: введёна первая цифра числа diff --git a/programs/games/MSquare/trunk/MSquare.fnt b/programs/games/MSquare/trunk/MSquare.fnt new file mode 100644 index 0000000000..efa18a4aea Binary files /dev/null and b/programs/games/MSquare/trunk/MSquare.fnt differ diff --git a/programs/games/MSquare/trunk/editbox_ex.mac b/programs/games/MSquare/trunk/editbox_ex.mac new file mode 100644 index 0000000000..938904c57c --- /dev/null +++ b/programs/games/MSquare/trunk/editbox_ex.mac @@ -0,0 +1,194 @@ + +ch_struc_size=36 +ed_struc_size=76 +ch_flag_en=10b + +ch_left equ [edi] ;координата начала рисования по х +ch_top equ [edi+2] ;координата начала рисования по у +ch_text_margin equ [edi+4] ;=4 расстояние от прямоугольника чек бокса до надписи +ch_size equ [edi+8] ;12 размер квадрата чек бокса +ch_color equ [edi+12] ;цвет внутри checkbox +ch_border_color equ [edi+16] ; or [edi+4] ;цвет рамки checkbox ее можно задать самостоятельно +ch_text_color equ [edi+20];[edi+4] ;цвет текста +ch_text_ptr equ [edi+24] ;указатель на начало текстовой строки +ch_text_length equ [edi+28] +ch_flags equ [edi+32] ;флаги + +ed_width equ [edi] ;ширина компонента +ed_left equ [edi+4] ;положение по оси х +ed_top equ [edi+8] ;положение по оси у +ed_color equ [edi+12] ;цвет фона компонента +shift_color equ [edi+16] ;=0x6a9480 для примера возьем желеный цвет бокса +ed_focus_border_color equ [edi+20] ;цвет рамки компонента +ed_blur_border_color equ [edi+24] ;цвет не активного компонента +ed_text_color equ [edi+28] ;цвет текста +ed_max equ [edi+32] ;кол-во символов которые можно максимально ввести +ed_text equ [edi+36] ;указатель на буфер +ed_mouse_variable equ [edi+40] ; указатель на переменную для бокса/группы +ed_flags equ [edi+44] ;флаги +bp_flags equ [ebp+44] ;в некоторых процедурах edi используется, взамен указатель храниться в ebp +ed_size equ [edi+48] ;кол-во символов +bp_size equ [ebp+48] ;кол-во симвполов, для адресации испльзуется ebpб edi занят +ed_pos equ [edi+52] ;позиция курсора +ed_offset equ [edi+56] ;смещение +cl_curs_x equ [edi+60] ;предыдущее координата курсора по х +cl_curs_y equ [edi+64] ;предыдущее координата курсора по у +ed_shift_pos equ [edi+68] ;положение курсора +ed_shift_pos_old equ [edi+72] ;старое положение курсора + +ed_struc_size=76 +struc edit_box width,left,top,color,shift_color,focus_border_color,\ + blur_border_color,text_color,max,text,mouse_variable,flags,size,pos +{ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;Bit mask from editbox +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +ed_figure_only= 1000000000000000b ;одни символы +ed_always_focus= 100000000000000b +ed_focus= 10b ;фокус приложения +ed_shift_on= 1000b ;если не установлен -значит впервые нажат shift,если был установлен, значит мы уже что - то делали удерживая shift +ed_shift_on_off=1111111111110111b +ed_shift= 100b ;включается при нажатии на shift т.е. если нажимаю +ed_shift_off= 1111111111111011b +ed_shift_bac= 10000b ;бит для очистки выделеного shift т.е. при установке говорит что есть выделение +ed_shift_bac_cl=1111111111101111b ;очистка при удалении выделения +ed_shift_cl= 1111111111100011b +ed_shift_mcl= 1111111111111011b +ed_left_fl= 100000b +ed_right_fl= 1111111111011111b +ed_offset_fl= 1000000b +ed_offset_cl= 1111111110111111b +ed_insert= 10000000b +ed_insert_cl= 1111111101111111b +ed_mouse_on = 100000000b +ed_mous_adn_b= 100011000b +ed_mouse_on_off=1111111011111111b +ed_height=14 ; высота + +.width dd width +.left dd left +.top dd top +.color dd color +.shift_color dd shift_color +.focus_border_color dd focus_border_color +.blur_border_color dd blur_border_color +.text_color dd text_color +.max dd max +.text dd text +.mouse_variable dd mouse_variable +.flags dd flags+0 +.size dd size+0 +.pos dd pos+0 +.offset dd 0 +.cl_curs_x dd 0 +.cl_curs_y dd 0 +.shift dd 0 +.shift_old dd 0 +} +macro edit_boxes_set_sys_color start,end,color_table +{ + mov edi,start + mov ecx,((end-start)/ed_struc_size) + mov esi,color_table +@@: + mov eax,dword [esi+36] + mov ebx,dword [esi+20] + push dword eax + pop dword ed_focus_border_color + shr bh,1 + shr bl,1 + shr ah,1 + shr al,1 + add ah,bh + add al,bl + ror eax,16 + ror ebx,16 + shr bl,1 + shr al,1 + add al,bl + ror eax,16 + mov dword ed_blur_border_color,eax + mov dword shift_color,eax + add edi,ed_struc_size + loop @b +} +macro get_sys_colors col_buf +{ + ;mov eax,48 + push 48 + pop eax + ;mov ebx,3 + push 3 + pop ebx + ;mov ecx,col_buf + push col_buf + pop ecx + ;mov edx,40 + push 40 + pop edx + mcall +} +macro check_boxes_set_sys_color start,end,color_table +{ +ch_left equ [edi] ;координата начала рисования по х +ch_top equ [edi+2] ;координата начала рисования по у +ch_text_margin equ [edi+4] ;=4 расстояние от прямоугольника чек бокса до надписи +ch_size equ [edi+8] ;12 размер квадрата чек бокса +ch_color equ [edi+12] ;цвет внутри checkbox +ch_border_color equ [edi+16] ; or [edi+4] ;цвет рамки checkbox ее можно задать самостоятельно +ch_text_color equ [edi+20];[edi+4] ;цвет текста +ch_text_ptr equ [edi+24] ;указатель на начало текстовой строки +ch_text_length equ [edi+28] +ch_flags equ [edi+32] ;флаги + + +;ch_left equ [edi] ;координата начала рисования по х +;ch_top equ [edi+2] ;координата начала рисования по у +;ch_color equ [edi+4] ;цвет внутри checkbox +;ch_border_color equ [edi+8] ;цвет рамки checkbox +;ch_text_color equ [edi+12] ;цвет текста +;ch_text_ptr equ [edi+16] ;указатель на начало текстовой строки +;ch_text_length equ [edi+20] ;длина надписи (2^64 такой длины может быть текст) +;ch_flags equ [edi+24] ;флаги + + mov edi,start + mov ecx,((end-start)/ch_struc_size) + mov esi,color_table +@@: + push dword [esi+32] + pop dword ch_text_color + push dword [esi+36] + pop dword ch_border_color + add edi,ch_struc_size + loop @b +} +struc check_box left,top,ch_text_margin,ch_size,color,border_color,text_color,text,ch_text_length,flags +{ ;структура параметров для чек бокса +ch_flag_en=10b +.left: dw left ;+0 ;положение по х +.top: dw top ;положение по у +.ch_text_margin: dd ch_text_margin ;расстояние от прямоугольника чек бокса до надписи +.ch_size: dd ch_size ;размер квадрата чек бокса, для примера 12 +.color: dd color ;цвет внутри чекбокса +.border_color: dd border_color ;цвет рамки +.text_color: dd text_color ;цвет надписи +.text: dd text ;адрес в коде программы где расположен текст +.ch_text_length: dd ch_text_length ;длинна строки с символами +.flags: dd flags+0 ; флаги +} +struc option_box point_gr,left,top,op_text_margin,op_size,color,border_color,text_color,text,op_text_length,flags +{ ;структура параметров для чек бокса +op_flag_en=10b +.option_group: dd point_gr +.left: dw left ;+0 ;положение по х +.top: dw top ;положение по у +.ch_text_margin: dd op_text_margin ;расстояние от прямоугольника чек бокса до надписи +.ch_size: dd op_size ;размер квадрата чек бокса, для примера 12 +.color: dd color ;цвет внутри чекбокса +.border_color: dd border_color ;цвет рамки +.text_color: dd text_color ;цвет надписи +.text: dd text ;адрес в коде программы где расположен текст +.ch_text_length: dd op_text_length ;длинна строки с символами +.flags: dd flags+0 ; флаги +} + diff --git a/programs/games/mario2/trunk/MARIO.ASM b/programs/games/mario2/trunk/MARIO.ASM new file mode 100644 index 0000000000..e22bf314ac --- /dev/null +++ b/programs/games/mario2/trunk/MARIO.ASM @@ -0,0 +1,813 @@ +; +; MARIO for MENUET +; +; Compile with fasm +; + +use32 + + org 0x0 + + db 'MENUET00' ; 8 byte id + dd 38 ; required os + dd START ; program start + dd I_END ; image size + dd 0x100000 ; reguired amount of memory + dd 0x00000000 ; reserved=no extended header + + +empty equ 0x80000 + 0*3*40*40 +build_1 equ 0x80000 + 1*3*40*40 +build_2 equ 0x80000 + 2*3*40*40 +build_3 equ 0x80000 + 3*3*40*40 + +mario_1 equ 0x90000 + 0*3*70*51 +mario_2 equ 0x90000 + 1*3*70*51 +mario_3 equ 0x90000 + 2*3*70*51 +mario_4 equ 0x90000 + 3*3*70*51 +mario_5 equ 0x90000 + 4*3*70*51 +mario_6 equ 0x90000 + 5*3*70*51 +mario_green equ 0x90000 + 6*3*70*51 +loadp equ 0x90000 + 7*3*70*51 + + +START: + + + call load_graph + + mov [marioxy], dword 300*65536+270 + mov [leftright], dword 1 + mov [velocity], dword 0xff + + call draw_window + + +sta: + + mov eax,field + mov edx,1*65526+30 + mov [xxyy],dword 1*65536+22 + + stl: + + cmp [eax],byte ' ' + jnz noempty + mov ebx,empty + noempty: + + cmp [eax],byte '1' + jnz no1 + mov ebx,build_1 + no1: + + cmp [eax],byte '2' + jnz no2 + mov ebx,build_2 + no2: + + cmp [eax],byte '3' + jnz no3 + mov ebx,build_3 + no3: + + pusha + + mov edx,[xxyy] + + mov eax,7 ; display image + mov ecx,40*65536+40 + int 0x40 + + popa + + add word [xxyy+2],word 40 + cmp word [xxyy+2],word 40*12+1 + jnz nonewline + mov word [xxyy+2],word 1 + add word [xxyy+0],word 40 + nonewline: + + add eax,1 + cmp eax,field+12*9 + jz nodraw + jmp stl + + nodraw: + + +; ********* MAIN LOOP *********** + + +wait_for_event: + + call draw_mario + + mov eax,11 ; check if os wants to say something + int 0x40 + cmp eax,1 + jz red + cmp eax,2 + jz key + cmp eax,3 + jnz wait_for_event + + jmp button + + red: + + mov [mariomem],dword 0x0 + + call draw_window + jmp sta + + key: + + mov [mariomem],dword 0x0 + + mov eax,2 ; ah <- key + int 0x40 + + cmp ah,176 + jnz key1 + mov byte [leftright],byte 1 + key1: + + cmp ah,179 + jnz key2 + mov byte [leftright],byte 4 + key2: + + cmp ah,177 + jnz key3 + mov al,byte [leftright] + mov bl,al + cmp al,1 + jnz key31 + mov bl,2 + key31: + cmp al,4 + jnz key32 + mov bl,3 + key32: + mov byte [leftright],bl + key3: + + cmp ah,178 + jnz key4 + cmp [velocity],dword 0xff + jnz key4 + mov [velocity],dword 0x110 + key4: + + + + jmp wait_for_event + + button: + + mov eax,0xffffffff ; close this program + int 0x40 + + ; end of program + + +load_graph: + + pusha + + mov eax,6 ; 6 = open file + mov ebx,filename + mov ecx,0 + mov edx,0xFFFFFF + mov esi,loadp + mov edi,0 ; floppy + int 0x40 + + ; empty + + mov edi,empty + mov ecx,40*40 + mov eax,0x00500f + cld + emptyl: + mov [edi],eax + add edi,3 + loop emptyl + + mov [width],40*3 + mov [width_move],20 + mov [sub_esi],150*3+2 + mov [add_edi],40*3*2 + mov [imul_esi],20*3 + mov [base],loadp+18*3+3*150*34+3*98-1 + + mov esi,0 + mov edi,build_1 + call convert + + mov esi,1 + mov edi,build_2 + call convert + + + + ; build_3 + + mov edi,build_3 + mov esi,loadp+18*3+230*3+3*300*69 + mov ecx,40 + build_3l: + pusha + mov ecx,3*40 + cld + rep movsb + popa + sub esi,300*3 + add edi,40*3 + loop build_3l + + mov [width],50*3 + mov [width_move],25 + mov [sub_esi],150*3+2 + mov [add_edi],50*3*2 + mov [imul_esi],25*3 + mov [base],loadp+18*3+3*150*34+68 + + mov esi,0 + mov edi,mario_1 + call convert + + mov esi,1 + mov edi,mario_2 + call convert + + mov esi,2 + mov edi,mario_3 + call convert + + jmp mario_mirror + + +convert: + + imul esi,[imul_esi] + add esi,[base] ; loadp+18*3+3*150*34+68 + + mov ecx,70 + mario_1l: + pusha + mov ecx,[width_move] + putpix: + mov eax,[esi] + mov [edi+00],ax + mov [edi+03],ax + mov ebx,[width] + mov [edi+ebx],ax + add ebx,3 + mov [edi+ebx],ax + shr eax,16 + mov [edi+02],al + dec ebx + mov [edi+ebx],al + mov [edi+05],al + add ebx,3 + mov [edi+ebx],al + add esi,3 + add edi,6 + loop putpix + popa + sub esi,[sub_esi] + add edi,[add_edi] + loop mario_1l + + ret + +sub_esi dd 0x0 +add_edi dd 0x0 +imul_esi dd 0x0 +base dd 0x0 +width dd 0x0 +width_move dd 0x0 + + + +mario_mirror: + + + ; mario_green + + mov edi,mario_green + mov ecx,70*50 + mario_greenl: + mov [edi],dword 0x00500f + add edi,3 + loop mario_greenl + + + + ; mario_4 + + mov edi,mario_4 + mov esi,mario_1+49*3 + mov ecx,70 + m4l1: + pusha + mov ecx,50 + m4l2: + mov eax,[esi] + mov [edi],ax + shr eax,16 + mov [edi+2],al + add edi,3 + sub esi,3 + loop m4l2 + popa + add esi,50*3 + add edi,50*3 + loop m4l1 + + + ; mario_5 + + mov edi,mario_5 + mov esi,mario_2+49*3 + mov ecx,70 + m5l1: + pusha + mov ecx,50 + m5l2: + mov eax,[esi] + mov [edi],ax + shr eax,16 + mov [edi+2],al + add edi,3 + sub esi,3 + loop m5l2 + popa + add esi,50*3 + add edi,50*3 + loop m5l1 + + + ; mario_6 + + mov edi,mario_6 + mov esi,mario_3+49*3 + mov ecx,70 + m6l1: + pusha + mov ecx,50 + m6l2: + mov eax,[esi] + mov [edi],ax + shr eax,16 + mov [edi+2],al + add edi,3 + sub esi,3 + loop m6l2 + popa + add esi,50*3 + add edi,50*3 + loop m6l1 + + + popa + + ret + + + +advance_mario: + + pusha + + mov eax,[marioxy] ; wherey ? + and eax,65535 + add eax,40+21 + xor edx,edx + mov ebx,40 + div ebx + mov [marioy],eax + + mov eax,[marioxy] ; wherex ? + shr eax,16 + add eax,20 + xor edx,edx + mov ebx,40 + div ebx + mov [mariox],eax + + + + cmp byte [leftright],byte 1 ; go left + jnz noleft + mov eax,[marioxy] + xor edx,edx + shr eax,16 + sub eax,7 + mov ebx,40 + div ebx + add eax,field+7*12 + cmp [eax],byte ' ' + jz mgoleft + mov byte [leftright],byte 2 + jmp noleft + mgoleft: + mov eax,[marioxy] + sub eax,6*65536 + mov [marioxy],eax + noleft: + + + + cmp byte [leftright],byte 4 ; go right + jnz noright + mov eax,[marioxy] + xor edx,edx + shr eax,16 + add eax,54 + mov ebx,40 + div ebx + add eax,field+7*12 + cmp byte [eax],byte ' ' + jz mgoright + mov byte [leftright],byte 3 + jmp noright + mgoright: + mov eax,[marioxy] + add eax,6*65536 + mov [marioxy],eax + noright: + + + + + cmp [velocity],dword 0x100 ; jump up ? + jbe nojumpup + mov ebx,[velocity] + sub ebx,1 + cmp ebx,0x100 + jnz no0x100 + mov [velocity],dword 0xff + jmp nojumpup + no0x100: + mov [velocity],ebx + sub ebx,0x100-1 + mov eax,[marioxy] + sub ax,bx + mov [marioxy],eax + nojumpup: + + call mario_environment + + cmp [velocity],dword 0x100 ; jump -> down ? + jge nojumpdown + mov eax,[marioy] + cmp eax,[mario_below] + jb yesgd + mov [velocity],dword 0xff + mov eax,[marioxy] + mov eax,[mario_below] + sub eax,1 + mov ebx,40 + mul ebx + sub eax,10 + mov word [marioxy],ax + jmp nojumpdown + yesgd: + mov ebx,[velocity] + sub ebx,1 + mov [velocity],ebx + mov eax,[marioxy] + add ax,0xff + sub ax,bx + mov [marioxy],eax + nojumpdown: + + + popa + + ret + + +marioy dd 0x0 + +mariox dd 0x0 + +mario_below dd 5 + + +mario_environment: + + pusha + + mov eax,[marioy] + mov ebx,12 + mul ebx + add eax,[mariox] + add eax,field + + cmp [eax],byte ' ' + jz me_ok + + mov eax,[marioy] + mov [mario_below],eax + + popa + ret + + me_ok: + + mov [mario_below],dword 100 + + popa + ret + + +mario_delay: + + pusha + + mov eax,5 + mov ebx,2 + int 0x40 + + popa + ret + + + +draw_mario: + + pusha + + mov eax,[mariomem] + cmp eax,[marioxy] + jnz dm1 + + call mario_delay + + popa + + ret + + dm1: + + mov eax,[marioxy] + mov [mariomem],eax + + + cmp byte [leftright],byte 1 ; go left + jnz no_m_left + jmp m_left + no_m_left: + + cmp byte [leftright],byte 4 ; go right + jnz no_m_right + jmp m_right + no_m_right: + + cmp byte [leftright],byte 2 ; stand left + jnz no_r_still + mov eax,7 + mov ebx,mario_green + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call advance_mario + mov eax,7 + mov ebx,mario_1 + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call mario_delay + popa + ret + no_r_still: + + cmp byte [leftright],byte 3 ; stand right + jnz no_l_still + mov eax,7 + mov ebx,mario_green + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call advance_mario + mov eax,7 + mov ebx,mario_4 + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call mario_delay + + popa + ret + no_l_still: + + popa + ret + + + + + m_left: + + mov eax,7 + mov ebx,mario_green + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call advance_mario + mov eax,7 + mov ebx,mario_1 + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call mario_delay + + mov eax,7 + mov ebx,mario_green + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call advance_mario + mov eax,7 + mov ebx,mario_2 + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call mario_delay + + mov eax,7 + mov ebx,mario_green + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call advance_mario + mov eax,7 + mov ebx,mario_3 + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call mario_delay + + mov eax,7 + mov ebx,mario_green + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call advance_mario + mov eax,7 + mov ebx,mario_2 + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call mario_delay + + popa + + ret + + m_right: + + + mov eax,7 + mov ebx,mario_green + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call advance_mario + mov eax,7 + mov ebx,mario_4 + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call mario_delay + + mov eax,7 + mov ebx,mario_green + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call advance_mario + mov eax,7 + mov ebx,mario_5 + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call mario_delay + + mov eax,7 + mov ebx,mario_green + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call advance_mario + mov eax,7 + mov ebx,mario_6 + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call mario_delay + + mov eax,7 + mov ebx,mario_green + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call advance_mario + mov eax,7 + mov ebx,mario_5 + mov ecx,50*65536+70 + mov edx,[marioxy] + int 0x40 + call mario_delay + + popa + + ret + + + + + +draw_window: + + pusha + + mov eax,12 ; tell os about redraw + mov ebx,1 + int 0x40 + + mov eax,0 ; define and draw window + mov ebx,80*65536+480+1 + mov ecx,20*65536+382 + mov edx,0x0000500f + mov esi,0x8066AA88 + mov edi,0x00559977 + int 0x40 + + mov eax,dword 0x00000004 + mov ebx,8*65536+8 + mov ecx,dword 0x00cccccc + mov edx,text + mov esi,textlen-text + int 0x40 + + mov eax,8 + mov ebx,(481-19)*65536+12 ; button start x & size + mov ecx,5*65536+12 ; button start y & size + mov edx,1 ; button number + mov esi,0x00229911 ; button color + int 0x40 + + mov eax,12 ; tell os about redraw end + mov ebx,2 + int 0x40 + + popa + + ret + + +; DATA SECTION + + +filename: + db 'MARIOALLBMP' + +text: + db 'SUPER MARIO - USE ARROW KEYS' +textlen: + +xx db 'x' + +field: + + db '1 1' + db '1 1' + db '111 111' + db '1 1' + db '1 1' + db '1 111111 1' + db '1 1' + db '1 1' + db '222222222222' + +xxyy dd 0x0 + +marioxy dd 0x0 + +mariomem dd 0x0 + +leftright dd 0x0 + +velocity dd 0x0 + + +I_END: + + + + diff --git a/programs/games/mario2/trunk/MARIOALL.BMP b/programs/games/mario2/trunk/MARIOALL.BMP new file mode 100644 index 0000000000..54b6cbc5b9 Binary files /dev/null and b/programs/games/mario2/trunk/MARIOALL.BMP differ diff --git a/programs/games/megamaze/trunk/GIF_LITE.INC b/programs/games/megamaze/trunk/GIF_LITE.INC new file mode 100644 index 0000000000..579ce2ad9f --- /dev/null +++ b/programs/games/megamaze/trunk/GIF_LITE.INC @@ -0,0 +1,318 @@ +; GIF LITE v2.0 by Willow +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; This include file will contain functions to handle GIF image format +; +; Created: August 15, 2004 +; Last changed: September 9, 2004 + +; Change COLOR_ORDER in your program +; if colors are displayed improperly + +if ~ (COLOR_ORDER in ) +; This message may not appear under MenuetOS, so watch... + display 'Please define COLOR_ORDER: MENUETOS or OTHER',13,10 +end if + +struc GIF_info +{ +; .NextImg rd 1 ; used internally + .Left rw 1 + .Top rw 1 + .Width rw 1 + .Height rw 1 +} + +_null fix 0x1000 + +; **************************************** +; FUNCTION GetGIFinfo - retrieve Nth image info +; **************************************** +; in: +; esi - pointer to image list header +; ecx - image_index (0...img_count-1) +; edi - pointer to GIF_info structure to be filled + +; out: +; eax - pointer to RAW data, or 0, if error + +GetGIFinfo: + push esi ecx edi + xor eax,eax + jecxz .eloop + .lp: + mov esi,[esi] + test esi,esi + jz .error + loop .lp + .eloop: + add esi,4 + movsd + movsd + mov eax,esi + .error: + pop edi ecx esi + ret + +; **************************************** +; FUNCTION ReadGIF - unpacks GIF image +; **************************************** +; in: +; esi - pointer to GIF file in memory +; edi - pointer to output image list +; eax - pointer to work area (MIN 16 KB!) + +; out: +; eax - 0, all OK; +; eax - 1, invalid signature; +; eax >=8, unsupported image attributes +; +; ecx - number of images + +ReadGIF: + push esi edi + mov [.table_ptr],eax + mov [.cur_info],edi + xor eax,eax + mov [.globalColor],eax + mov [.img_count],eax + inc eax + cmp dword[esi],'GIF8' + jne .er ; signature + mov ecx,[esi+0xa] + inc eax + add esi,0xd + mov edi,esi + bt ecx,7 + jnc .nextblock + mov [.globalColor],esi + call .Gif_skipmap + .nextblock: + cmp byte[edi],0x21 + jne .noextblock + inc edi + cmp byte[edi],0xf9 ; Graphic Control Ext + jne .no_gc + add edi,7 + jmp .nextblock + .no_gc: + cmp byte[edi],0xfe ; Comment Ext + jne .no_comm + inc edi + .block_skip: + movzx eax,byte[edi] + lea edi,[edi+eax+1] + cmp byte[edi],0 + jnz .block_skip + inc edi + jmp .nextblock + .no_comm: + cmp byte[edi],0xff ; Application Ext + jne .nextblock + add edi,13 + jmp .block_skip + .noextblock: + cmp byte[edi],0x2c ; image beginning + jne .er + inc [.img_count] + inc edi + mov esi,[.cur_info] + add esi,4 + xchg esi,edi + movsd + movsd + push edi + movzx ecx,word[esi] + inc esi + bt ecx,7 + jc .uselocal + push [.globalColor] + mov edi,esi + jmp .setPal + .uselocal: + call .Gif_skipmap + push esi + .setPal: + movzx ecx,byte[edi] + inc ecx + mov [.codesize],ecx + dec ecx + pop [.Palette] + lea esi,[edi+1] + mov edi,[.table_ptr] + xor eax,eax + cld + lodsb ; eax - block_count + add eax,esi + mov [.block_ofs],eax + mov [.bit_count],8 + mov eax,1 + shl eax,cl + mov [.CC],eax + inc eax + mov [.EOI],eax + lea ecx,[eax-1] + mov eax, _null shl 16 + .filltable: + stosd + inc eax + loop .filltable + pop edi + mov [.img_start],edi + .reinit: + mov edx,[.EOI] + inc edx + push [.codesize] + pop [.compsize] + call .Gif_get_sym + cmp eax,[.CC] + je .reinit + call .Gif_output + .cycle: + movzx ebx,ax + call .Gif_get_sym + cmp eax,edx + jae .notintable + cmp eax,[.CC] + je .reinit + cmp eax,[.EOI] + je .end + call .Gif_output + .add: + push eax + mov eax,[.table_ptr] + mov [eax+edx*4],ebx + pop eax + cmp edx,0xFFF + jae .cycle + inc edx + bsr ebx,edx + cmp ebx,[.compsize] + jne .noinc + inc [.compsize] + .noinc: + jmp .cycle + .notintable: + push eax + mov eax,ebx + call .Gif_output + push ebx + movzx eax,bx + call .Gif_output + pop ebx eax + jmp .add + .er: + pop edi + jmp .ex + .end: + mov eax,[.cur_info] + mov [eax],edi + mov [.cur_info],edi + add esi,2 + xchg esi,edi + .nxt: + cmp byte[edi],0 + jnz .continue + inc edi + jmp .nxt + .continue: + cmp byte[edi],0x3b + jne .nextblock + xor eax,eax + stosd + mov ecx,[.img_count] + .ex: + pop edi esi + ret + +.Gif_skipmap: +; in: ecx - image descriptor, esi - pointer to colormap +; out: edi - pointer to area after colormap + + and ecx,111b + inc ecx ; color map size + mov ebx,1 + shl ebx,cl + lea ebx,[ebx*2+ebx] + lea edi,[esi+ebx] + ret + +.Gif_get_sym: + mov ecx,[.compsize] + push ecx + xor eax,eax + .shift: + ror byte[esi],1 + rcr eax,1 + dec [.bit_count] + jnz .loop1 + inc esi + cmp esi,[.block_ofs] + jb .noblock + push eax + xor eax,eax + lodsb + test eax,eax + jnz .nextbl + mov eax,[.EOI] + sub esi,2 + add esp,8 + jmp .exx + .nextbl: + add eax,esi + mov [.block_ofs],eax + pop eax + .noblock: + mov [.bit_count],8 + .loop1: + loop .shift + pop ecx + rol eax,cl + .exx: + xor ecx,ecx + ret + +.Gif_output: + push esi eax edx + mov edx,[.table_ptr] + .next: + push word[edx+eax*4] + mov ax,word[edx+eax*4+2] + inc ecx + cmp ax,_null + jnz .next + shl ebx,16 + mov bx,[esp] + .loop2: + pop ax + + lea esi,[eax+eax*2] + add esi,[.Palette] + + if COLOR_ORDER eq MENUETOS + mov esi,[esi] + bswap esi + shr esi,8 + mov [edi],esi + add edi,3 + else + movsw + movsb + end if + + loop .loop2 + pop edx eax esi + ret + + .globalColor rd 1 + .img_count rd 1 + .cur_info rd 1 ; image table pointer + .img_start rd 1 + .codesize rd 1 + .compsize rd 1 + .bit_count rd 1 + .CC rd 1 + .EOI rd 1 + .Palette rd 1 + .block_ofs rd 1 + .table_ptr rd 1 diff --git a/programs/games/megamaze/trunk/MACROS.INC b/programs/games/megamaze/trunk/MACROS.INC new file mode 100644 index 0000000000..7de7b6f831 --- /dev/null +++ b/programs/games/megamaze/trunk/MACROS.INC @@ -0,0 +1,264 @@ +; new application structure +macro meos_app_start + { + use32 + org 0x0 + + db 'MENUET01' + dd 0x01 + dd __start + dd __end + dd __memory + dd __stack + + if used __params & ~defined __params + dd __params + else + dd 0x0 + end if + + dd 0x0 + } +MEOS_APP_START fix meos_app_start + +macro code + { + __start: + } +CODE fix code + +macro data + { + __data: + } +DATA fix data + +macro udata + { + if used __params & ~defined __params + __params: + db 0 + __end: + rb 255 + else + __end: + end if + __udata: + } +UDATA fix udata + +macro meos_app_end + { + align 32 + rb 2048 + __stack: + __memory: + } +MEOS_APP_END fix meos_app_end + + +; macro for defining multiline text data +struc mstr [sstring] + { + forward + local ssize + virtual at 0 + db sstring + ssize = $ + end virtual + dd ssize + db sstring + common + dd -1 + } + + +; strings +macro sz name,[data] { ; from MFAR [mike.dld] + common + if used name + label name + end if + forward + if used name + db data + end if + common + if used name + .size = $-name + end if +} + +macro lsz name,[lng,data] { ; from MFAR [mike.dld] + common + label name + forward + if lang eq lng + db data + end if + common + .size = $-name +} + + + +; easy system call macro +macro mpack dest, hsrc, lsrc +{ + if (hsrc eqtype 0) & (lsrc eqtype 0) + mov dest, (hsrc) shl 16 + lsrc + else + if (hsrc eqtype 0) & (~lsrc eqtype 0) + mov dest, (hsrc) shl 16 + add dest, lsrc + else + mov dest, hsrc + shl dest, 16 + add dest, lsrc + end if + end if +} + +macro __mov reg,a,b { ; mike.dld + if (~a eq)&(~b eq) + mpack reg,a,b + else if (~a eq)&(b eq) + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + +; language for programs +;lang fix ru ; ru en fr ge fi + + + +; optimize the code for size +__regs fix + +macro add arg1,arg2 + { + if (arg2 eqtype 0) + if (arg2) = 1 + inc arg1 + else + add arg1,arg2 + end if + else + add arg1,arg2 + end if + } + +macro sub arg1,arg2 + { + if (arg2 eqtype 0) + if (arg2) = 1 + dec arg1 + else + sub arg1,arg2 + end if + else + sub arg1,arg2 + end if + } + +macro mov arg1,arg2 + { + if (arg1 in __regs) & (arg2 eqtype 0) + if (arg2) = 0 + xor arg1,arg1 + else if (arg2) = 1 + xor arg1,arg1 + inc arg1 + else if (arg2) = -1 + or arg1,-1 + else if (arg2) > -128 & (arg2) < 128 + push arg2 + pop arg1 + else + mov arg1,arg2 + end if + else + mov arg1,arg2 + end if + } + + +macro struct name + { + virtual at 0 + name name + sizeof.#name = $ - name + end virtual + } + +; structures used in MeOS +struc process_information + { + .cpu_usage dd ? ; +0 + .window_stack_position dw ? ; +4 + .window_stack_value dw ? ; +6 + .not_used1 dw ? ; +8 + .process_name rb 12 ; +10 + .memory_start dd ? ; +22 + .used_memory dd ? ; +26 + .PID dd ? ; +30 + .x_start dd ? ; +34 + .y_start dd ? ; +38 + .x_size dd ? ; +42 + .y_size dd ? ; +46 + .slot_state dw ? ; +50 + rb (1024-52) + } +struct process_information + +struc system_colors + { + .frame dd ? + .grab dd ? + .grab_button dd ? + .grab_button_text dd ? + .grab_text dd ? + .work dd ? + .work_button dd ? + .work_button_text dd ? + .work_text dd ? + .work_graph dd ? + } +struct system_colors + + +; constants + +; events +EV_IDLE = 0 +EV_TIMER = 0 +EV_REDRAW = 1 +EV_KEY = 2 +EV_BUTTON = 3 +EV_EXIT = 4 +EV_BACKGROUND = 5 +EV_MOUSE = 6 +EV_IPC = 7 +EV_STACK = 8 + +; event mask bits for function 40 +EVM_REDRAW = 1b +EVM_KEY = 10b +EVM_BUTTON = 100b +EVM_EXIT = 1000b +EVM_BACKGROUND = 10000b +EVM_MOUSE = 100000b +EVM_IPC = 1000000b +EVM_STACK = 10000000b diff --git a/programs/games/megamaze/trunk/blackbox.inc b/programs/games/megamaze/trunk/blackbox.inc new file mode 100644 index 0000000000..b98a2d2ed5 --- /dev/null +++ b/programs/games/megamaze/trunk/blackbox.inc @@ -0,0 +1,300 @@ +RAY_NUM equ 100000b +RAY_ABS equ 1000000b +RAY_REF equ 10000000b +BBSIZE equ 10 +ATOM_COUNT equ BBSIZE/2 + +CELL_EMPTY_CENTER equ 10100000b +CELL_ABSORBED equ 10000000b +CELL_REFLECTED equ 01000000b +CELL_EMPTY_EDGE equ 11000000b +CELL_FULL_EDGE equ 00100000b +MASK_ATOM equ 00000001b +MASK_GUESS equ 00000010b +MASK_ALL equ 11100000b +MASK_DIR equ 00000011b + +BB_levelp: + mcall 40,100111b + mov byte[fx],BBSIZE + mov byte[fy],BBSIZE + and [cur_step],0 + and [pause_time],0 + call get_xy_sf.count + call erase_field + mov edi,field+1 + mov ecx,BBSIZE-2 + mov eax,CELL_EMPTY_EDGE+1 + rep stosb + mov eax,CELL_EMPTY_CENTER + mov ecx,BBSIZE-2 + .lp: + push ecx + mov word[edi],(CELL_EMPTY_EDGE+3) shl 8+CELL_EMPTY_EDGE + add edi,2 + mov ecx,BBSIZE-2 + rep stosb + pop ecx + loop .lp + mov word[edi],(CELL_EMPTY_EDGE+3) shl 8+CELL_EMPTY_EDGE + add edi,2 + mov eax,CELL_EMPTY_EDGE+2 + mov ecx,BBSIZE-2 + rep stosb + + mov ecx,BBSIZE/2 + mov ebx,BBSIZE*BBSIZE + .again: + call get_rnd + xor edx,edx + div ebx + cmp byte[field+edx],CELL_EMPTY_CENTER + jne .again + or byte[field+edx],MASK_ATOM + loop .again + mov [win_flag],5 + ret + +BB_key: + cmp eax,-1 + je BB_mouse + cmp eax,9 + jne .ex + xor edx,edx + xor edi,edi + mov esi,field + mov ecx,BBSIZE*BBSIZE + .lp: + lodsb + mov ebx,eax + and eax,MASK_ALL;+MASK_ATOM + cmp eax,CELL_EMPTY_CENTER + jne .nxt + cmp ebx,CELL_EMPTY_CENTER+MASK_ATOM+MASK_GUESS + jne .nomatch + add dx,0x101 + jmp .nxt + .nomatch: + test ebx,MASK_GUESS + jz .nxt + inc dh + .nxt: + loop .lp + cmp dh,ATOM_COUNT + je .chk + mov [win_flag],9 + jmp .ex + .chk: + mov [win_flag],10 + mov ebx,(BBSIZE-2)*4 + mov ecx,ATOM_COUNT + sub cl,dl + imul ecx,ATOM_COUNT + sub ebx,ecx + sub ebx,[pause_time] + mov [score],ebx + .ex: + ret + +BB_drawm: + mov eax,47 + mov esi,0x100000ff + cmp [win_flag],5 + jne .no5 + mcall ,0x10000,ATOM_COUNT, + .no5: + cmp [win_flag],10 + jne .no10 + mcall ,0x20000,[score], + .no10: + cmp [win_flag],9 + jne .no9 + mcall ,0x10000,ATOM_COUNT, + .no9: + mov ecx,[cell_count] + .lp: + push ecx + lea eax,[ecx-1] + movzx ebx,byte[field+eax] + call get_xy + mov eax,ebx + and eax,MASK_ALL + cmp eax,CELL_EMPTY_CENTER + jne .nocenter + test ebx,MASK_ATOM + jz .noatom + cmp [win_flag],10 + jne .noatom + mov edx,0xff0000 + push ebx + mcall 13,[lx],[ly] + pop ebx + .noatom: + test ebx,MASK_GUESS + jz .nxtlp + add [lx],2 shl 16-4 + add [ly],2 shl 16-4 + mov edx,0xffff00 + .bar: + mcall 13,[lx],[ly] + .nxtlp: + pop ecx + loop .lp + .ex2: + ret + .nocenter: + mov edx,0xff + cmp eax,CELL_ABSORBED + je .bar + mov edx,0x8000 + cmp eax,CELL_REFLECTED + je .bar + cmp eax,CELL_FULL_EDGE + jne .nxtlp + and ebx,11111b + mov ecx,ebx + push word[ly+2] + pop word[lx] + mov eax,[Ces] + shr eax,1 + add word[lx],ax + add word[lx+2],ax + sub [lx],8 shl 16+6 + mcall 47,0x20000,,[lx],0x10000000 + jmp .nxtlp + +corners db 0,BBSIZE-1,BBSIZE*BBSIZE-1,BBSIZE*(BBSIZE-1) + +BB_mouse: + cmp [win_flag],1 + je .ex + mov [jump],still + mov edx,eax + call get_last_mclick + mov eax,ebx + mov edi,corners + mov ecx,4 + repne scasb + je .ex + movzx ebx,byte[field+eax] + mov ecx,ebx + and ecx,MASK_ALL + cmp ecx,CELL_EMPTY_CENTER + jne .nocenter + xor byte[field+eax],MASK_GUESS + mov [win_flag],11 + jmp .red + .nocenter: + cmp ecx,CELL_EMPTY_EDGE + jne .ex + + mov [player],eax + and ebx,MASK_DIR + .step: + mov [finish],eax + add eax,[dirs+ebx*4] ; 1 step + mov [stepptr],eax + movzx edx,byte[field+eax] ; cell ahead - edx + and edx,MASK_ALL+MASK_ATOM + cmp edx,CELL_EMPTY_CENTER+MASK_ATOM + jne .noabsorb + mov eax,[player] + mov byte[field+eax],CELL_ABSORBED + inc [pause_time] + mov [win_flag],7 + jmp .red + .noabsorb: + lea ecx,[ebx-2] + and ecx,MASK_DIR + add eax,[dirs+ecx*4] + movzx edx,byte[field+eax] ; cell aside - edx + xor ecx,11b + and edx,MASK_ALL+MASK_ATOM + cmp edx,CELL_EMPTY_CENTER+MASK_ATOM + jne .noreflect1 + .reflect: + mov eax,[finish] + cmp eax,[player] + je .endref + mov ebx,ecx ;new direction + jmp .nextstep + .noreflect1: + mov eax,[stepptr] + add eax,[dirs+ecx*4] + movzx edx,byte[field+eax] ; cell aside - edx + xor ecx,11b + and edx,MASK_ALL+MASK_ATOM + cmp edx,CELL_EMPTY_CENTER+MASK_ATOM + je .reflect + .noreflect2: + mov eax,[stepptr] + movzx edx,byte[field+eax] + and edx,MASK_ALL + cmp edx,CELL_EMPTY_CENTER + je .nextstep + + cmp eax,[player] + je .endref + mov ebx,[cur_step] + add ebx,CELL_FULL_EDGE + mov byte[field+eax],bl + mov eax,[player] + mov byte[field+eax],bl + inc [cur_step] + mov [win_flag],6 + add [pause_time],2 + jmp .red + .endref: + mov eax,[player] + mov byte[field+eax],CELL_REFLECTED + mov [win_flag],8 + inc [pause_time] + jmp .red + .nextstep: + jmp .step + + .red: + mov [jump],drw + .ex: + ret + +BB_level: + db 0 + +if lang eq ru + BB_help mstr \ + 'Ваша цель состоит в том, чтобы обнаружить',\ + 'положение пяти атомов в черном ящике, посылая',\ + 'лучи света в коробку и наблюдая, где лучи',\ + 'появляются. Атом или поглотит луч, если луч',\ + 'упадет на него в упор, или отклонит луч на 90',\ + 'градусов, если он пройдет по смежному ряду или',\ + 'колонке). Могут произойти 2 отклонения, вынуждая',\ + 'луч возвратиться во входной точке,- это считается',\ + 'отражением. Если желаете проверить себя и узнать',\ + 'счет, отметьте 5 клеток желтым цветом и нажмите',\ + 'TAB. Пять скрытых атомов будут показаны красными',\ + 'квадратиками.',\ + ' Луч поглощен - синий квадрат;',\ + ' Луч отражен - зеленый квадрат.',\ + ' Числами отмечены точки входа и выхода лучей.','',\ + 'http://puzzleprograms.narod.ru' +else + BB_help mstr \ + 'Your goal is to discover the whereabouts of five',\ + 'atoms in a black box by sending rays of light',\ + 'into the box and observing if and where the rays',\ + 'emerge. An atom will either absorb a ray if the',\ + 'ray hits it head on, or deflect a ray through 90',\ + 'if it comes close (passes through an adjacent row',\ + 'or column). Two deflections can occur at the same',\ + 'time forcing a ray to return and emerge at its',\ + 'entry point, this is referred to as reflection.','',\ + 'The challenge is to pin point the location of all',\ + 'atoms using the least number of rays. If you wish',\ + 'to commit your solution and to discover your',\ + 'score you must have exactly five guesses marked,',\ + 'then press TAB. The five hidden atoms will appear',\ + 'as red squares.','',\ + 'http://puzzleprograms.narod.ru' +end if diff --git a/programs/games/megamaze/trunk/colzone.bin b/programs/games/megamaze/trunk/colzone.bin new file mode 100644 index 0000000000..6f81b0c887 Binary files /dev/null and b/programs/games/megamaze/trunk/colzone.bin differ diff --git a/programs/games/megamaze/trunk/colzone.inc b/programs/games/megamaze/trunk/colzone.inc new file mode 100644 index 0000000000..5aa31e0679 --- /dev/null +++ b/programs/games/megamaze/trunk/colzone.inc @@ -0,0 +1,140 @@ +; level format +; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2] + +; internal format +; [stepptr]= worms # +; area: [worm_len][start_cell #][end_cell #]..[dirs].. +; [cur_step]: dragged worm pointer +; [finish]: 0 - if head dragged, 1- if tail +CZ_levelp: + call get_xy_sf + call LP_levelp.bit2 + mov dword[area],5;0 + ret + +CZ_key: + mov [jump],still + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov ecx,dword[area] + lea ebx,[eax-176] + mov eax,[player] + call check_bounds + je .ex + cmp ecx,5 + jne .novert + .vert: + add eax,[dirs+ebx*4] + call check_bounds + je .ex + mov ecx,eax + add ecx,[dirs+ebx*4] + mov cl,[field+ecx] + cmp cl,[field+eax] + jne .ex + mov dword[area],ebx + .ok: + mov [player],eax + cmp eax,[finish] + jne .jm + cmp dword[area],5 + jne .jm + mov [win_flag],1 + .jm: + mov [jump],drw + .ex: + ret + .novert: + mov edx,ebx + cmp edx,ecx ; the same dir + jne .nosame + add eax,[dirs+ebx*4] + call check_bounds + je .ex + .set5: + mov dword[area],5 + add eax,[dirs+ebx*4] + jmp .ok + .nosame: + xor edx,11b + cmp edx,ecx ; the opposite dir + je .set5 + add eax,[dirs+ebx*4] + mov ebx,ecx + xor ecx,11b + add eax,[dirs+ecx*4] + jmp .vert + +CZ_drawm: + mov ecx,[cell_count] + mov esi,field + mov [sq_size],3 + .lp: + push ecx + movzx ebx,byte[field+ecx-1] + shr ebx,6 + lea eax,[ecx-1] + call get_xy + add [lx],5-2 shl 16 + add [ly],5-2 shl 16 + mov edx,[f_colors+ebx*4] + mcall 13,[lx],[ly] + .no: + pop ecx + loop .lp + + inc [sq_size] + mov eax,[player] + call get_xy + xor edx,edx + cmp dword[area],5 + je .vert + push [lx] + push [ly] + mov edx,dword[area] + add eax,[dirs+edx*4] + call get_xy + mcall 13,[lx],[ly] + pop [ly] + pop [lx] + .vert: + mcall 13,[lx],[ly] + add [sq_size],5 + mov eax,[finish] + call get_xy + mcall 13,[lx],[ly],0xffffff + + ret + + +CZ_level: +file 'colzone.bin' + +if lang eq ru + CZ_help mstr \ + 'Черный блок из 2 кубиков стоит на раскрашенной',\ + 'клетчатой доске. Ваша задача - перекатить его на',\ + 'клетку с белым квадратиком. Блок начинает стоя и',\ + 'должен закончить тоже в вертикальном положении.',\ + 'Нельзя выкатывать его за пределы сетки и сверх',\ + 'того - кубики блока должны всегда ложиться на',\ + 'клетки одинакового цвета. Блок не отображен в 3D,',\ + 'поэтому Вы видите лишь его проекцию.','',\ + 'http://www.clickmazes.com' +else + CZ_help mstr \ + 'A black block, made of two black cubes stuck',\ + 'together, sits on a coloured grid. Your challenge',\ + 'is to roll the black block to its target',\ + 'position, which is marked with a small white',\ + 'square. The block starts on one end (vertical)',\ + 'and must also finish in this position. The block',\ + 'is not permitted to roll off the grid and, in',\ + 'addition, the block must always lie entirely',\ + 'within one colour-zone. Note the block is not',\ + 'displayed in 3D, in effect you see only its',\ + 'shadow.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/cstep.bin b/programs/games/megamaze/trunk/cstep.bin new file mode 100644 index 0000000000..df0984c5db Binary files /dev/null and b/programs/games/megamaze/trunk/cstep.bin differ diff --git a/programs/games/megamaze/trunk/cstep.inc b/programs/games/megamaze/trunk/cstep.inc new file mode 100644 index 0000000000..9242de6541 --- /dev/null +++ b/programs/games/megamaze/trunk/cstep.inc @@ -0,0 +1,66 @@ +; level format +; [fx|fy][blue xy][red xy]..[maze walls] + +; internal format +; [player]= blue +; [finish]= red + + +CSTEP_key: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov esi,area + inc esi + lea ebx,[eax-176] + mov [jump],still + mov eax,[player] + call check_move + jc .ex + add eax,[dirs+ebx*4] + mov edx,eax + .nom1: + mov eax,[finish] + xor ebx,11b + call check_move + jc .ex + add eax,[dirs+ebx*4] + mov [finish],eax + mov [player],edx + mov [jump],drw + cmp eax,edx + jnz .ex + mov [win_flag],1 + .ex: + ret + +CSTEP_drawm: + mov eax,[player] + call get_xy + mcall 13,[lx],[ly],0xff0000 + mov eax,[finish] + call get_xy + mcall 13,[lx],[ly],0xff + ret + +CSTEP_level: +file 'cstep.bin' + +if lang eq ru + CSTEP_help mstr \ + 'Соедините красный и синий блоки путем управления',\ + 'одним красным блоком. Синий блок следует за',\ + 'красным, но движется в прямо противоположном',\ + 'направлении. Ход разрешен только в случае',\ + 'отсутствия препятствий для обоих блоков.','',\ + 'http://www.clickmazes.com' +else + CSTEP_help mstr \ + 'Unite the red and blue dots by moving just the',\ + 'red dot. The blue dot follows the red dot, but',\ + 'moves in exactly in the opposite direction. A',\ + 'move is only permitted if the path is clear for',\ + 'both dots.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/debug.inc b/programs/games/megamaze/trunk/debug.inc new file mode 100644 index 0000000000..1f43e064a7 --- /dev/null +++ b/programs/games/megamaze/trunk/debug.inc @@ -0,0 +1,137 @@ +macro debug_print str +{ + local ..string, ..label + + jmp ..label + ..string db str,0 + ..label: + + pushf + pushad + mov edx,..string + call debug_outstr + popad + popf +} + +dps fix debug_print + +macro debug_print_dec arg +{ + pushf + pushad + if ~arg eq eax + mov eax,arg + end if + call debug_outdec + popad + popf +} + +dpd fix debug_print_dec + +;--------------------------------- +debug_outdec: ;(eax - num, edi-str) + push 10 ;2 + pop ecx ;1 + push -'0' ;2 + .l0: + xor edx,edx ;2 + div ecx ;2 + push edx ;1 + test eax,eax ;2 + jnz .l0 ;2 + .l1: + pop eax ;1 + add al,'0' ;2 + call debug_outchar ; stosb + jnz .l1 ;2 + ret ;1 +;--------------------------------- + +debug_outchar: ; al - char + pushf + pushad + mov cl,al + mov eax,63 + mov ebx,1 + int 0x40 + popad + popf +ret + +debug_outstr: + mov eax,63 + mov ebx,1 + @@: + mov cl,[edx] + test cl,cl + jz @f + int 40h + inc edx + jmp @b + @@: + ret + +_debug_crlf db 13, 10, 0 + +macro newline +{ + pushf + pushad + mov edx, _debug_crlf + call debug_outstr + popad + popf +} + +macro print message +{ + dps message + newline +} + +macro pregs +{ + dps "EAX: " + dpd eax + dps " EBX: " + dpd ebx + newline + dps "ECX: " + dpd ecx + dps " EDX: " + dpd edx + newline +} + +macro debug_print_hex arg +{ + pushf + pushad + if ~arg eq eax + mov eax, arg + end if + call debug_outhex + popad + popf +} +dph fix debug_print_hex + +debug_outhex: + ; eax - number + mov edx, 8 + .new_char: + rol eax, 4 + movzx ecx, al + and cl, 0x0f + mov cl, [__hexdigits + ecx] + pushad + mcall 63, 1 + popad + dec edx + jnz .new_char +ret + +__hexdigits: + db '0123456789ABCDEF' \ No newline at end of file diff --git a/programs/games/megamaze/trunk/fhouse.bin b/programs/games/megamaze/trunk/fhouse.bin new file mode 100644 index 0000000000..93a25de5aa Binary files /dev/null and b/programs/games/megamaze/trunk/fhouse.bin differ diff --git a/programs/games/megamaze/trunk/fhouse.inc b/programs/games/megamaze/trunk/fhouse.inc new file mode 100644 index 0000000000..4c580e1de7 --- /dev/null +++ b/programs/games/megamaze/trunk/fhouse.inc @@ -0,0 +1,197 @@ +FH_levelp: + mcall 40,100111b + call get_xy_sf + call erase_field + sub esi,2 + mov [levptr],esi + movzx ecx,byte[esi-2] + sub ecx,2 + xor eax,eax + .lp: + lodsb + mov byte[field+eax],-1 + loop .lp + mov dword[player],-1 + mov [win_flag],3 + ret + +FH_key: + cmp eax,-1 + je FH_mouse + cmp eax,8 + jne .nobsp + cmp [stepptr],0 + jne .no1st + mov [jump],run.game + ret + .no1st: + mov [win_flag],0 + sub [cur_step],2 + mov esi,[cur_step] + mov edi,[finish] + mov eax,3 + movzx ebx,byte[esi] + sub eax,ebx + movzx ecx,byte[esi+1] + .lp0: + and byte[field+edi],0 + add edi,[dirs+eax*4] + loop .lp0 + mov [finish],edi + dec [stepptr] + ret + .nobsp: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + sub eax,176 + jmp FH_mouse.fromkey + .ex: + ret + +FH_drawm: + mov ecx,[cell_count] + .lp: + push ecx + movzx ebx,byte[field+ecx-1] + test ebx,ebx + jz .no + lea eax,[ecx-1] + call get_xy + mov edx,0 + cmp ebx,0xf + jne .stable + mov edx,0x909090 + .stable: + mcall 13,[lx],[ly] + .no: + pop ecx + loop .lp + + mov eax,[player] + cmp eax,-1 + je .ex + call get_xy + mcall 13,[lx],[ly],0xff00 + mov eax,[finish] + call get_xy + mcall 13,[lx],[ly],0xff0000 + + mov ecx,[stepptr] + jecxz .ex + mov ebx,area + mov edi,[player] + mov edx,0xffffff + .lp3: + push ecx + mov esi,edi + movzx eax,byte[ebx] + movzx ecx,byte[ebx+1] + add ebx,2 + .lp2: + add edi,[dirs+eax*4] + loop .lp2 + call getline + pop ecx + loop .lp3 + .ex: + ret + +FH_mouse: + mov [jump],drw;red + call get_last_mclick + cmp byte[field+ebx],0 + jne .ex + cmp dword[player],-1 + jne .nostart + mov dword[player],ebx + mov byte[field+ebx],0xf + mov [finish],ebx + and [win_flag],0 + mov [cur_step],area + and [stepptr],0 + ret + .nostart: + mov eax,[finish] + call get_offset + cmp eax,-1 + je .ex + .fromkey: + xor ecx,ecx + mov edx,eax + mov esi,[finish] + .lp: + add esi,[dirs+edx*4] + cmp byte[field+esi],0 + jnz .exlp + mov eax,[finish] + mov ebx,esi + call get_offset + cmp eax,edx + jne .exlp + mov byte[field+esi],0xf + inc ecx + mov [finish],esi + jmp .lp + + .exlp: + jecxz .ex + mov eax,edx + mov edi,[cur_step] + stosb + mov [edi],cl + inc edi + mov [cur_step],edi + inc [stepptr] + mov edi,field + mov ecx,[cell_count] + xor eax,eax + repne scasb + je .ch_deadend + mov [win_flag],1 + .ex: + ret + .ch_deadend: + mov ecx,4 + mov edx,dirs + .lpp: + mov eax,[finish] + mov ebx,[edx] + add ebx,eax + push ebx + call get_offset + pop ebx + cmp eax,-1 + je .nxtlp + cmp byte[field+ebx],0 + jz .ex + .nxtlp: + add edx,4 + loop .lpp + mov [win_flag],4 + ret + +FH_level: +file 'fhouse.bin' + +if lang eq ru + FH_help mstr \ + 'В задании найдите начальную клетку и проведите',\ + 'линию, которая проходит через пустые клетки по',\ + 'одному разу.',\ + ' Каждый раз красный квадрат двигается прямо,',\ + 'останавливаясь только у края, перед черными',\ + 'квадратами или уже посещенными клетками.','',\ + 'http://www.clickmazes.com' +else + FH_help mstr \ + 'For each puzzle find the starting square and draw',\ + 'a path moving horizontally and vertically that',\ + 'passes through each open square exactly once.','',\ + 'At each move the red runner will always run',\ + 'straight, as far as possible, stopping only when',\ + "blocked by the grid's edge, a black square, or a",\ + 'square already visited.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/loops.bin b/programs/games/megamaze/trunk/loops.bin new file mode 100644 index 0000000000..b851d36c55 Binary files /dev/null and b/programs/games/megamaze/trunk/loops.bin differ diff --git a/programs/games/megamaze/trunk/loops.inc b/programs/games/megamaze/trunk/loops.inc new file mode 100644 index 0000000000..8faa40b2dc --- /dev/null +++ b/programs/games/megamaze/trunk/loops.inc @@ -0,0 +1,245 @@ +LP_levelp: + mcall 40,100111b + inc [drag_flag] + lodsb + lodsw + mov byte[fx],al + mov byte[fy],ah + and dword[player],0 + and dword[finish],0 + call get_xy_sf.count + call erase_field +; mov [levptr],esi + .bit2: + mov edx,8/2 + mov edi,field + lodsb + mov ecx,[cell_count] + .lp: + mov bl,al + rol al,2 + and bl,11000000b + mov [edi],bl + inc edi + dec edx + test edx,edx + jnz .nxt + mov edx,8/2 + lodsb + .nxt: + loop .lp + ret + +LP_key: + cmp eax,0 + jl LP_mouse + cmp eax,8 + jne .nobsp + cmp [stepptr],0 + jne .no1st + mov [jump],run.game + ret + .no1st: + mov [win_flag],0 + sub [cur_step],2 + mov esi,[cur_step] + mov edi,[finish] + mov eax,3 + movzx ebx,byte[esi] + sub eax,ebx + movzx ecx,byte[esi+1] + .lp0: + and byte[field+edi],0 + add edi,[dirs+eax*4] + loop .lp0 + mov [finish],edi + dec [stepptr] + ret + .nobsp: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + sub eax,176 + .ex: + ret + +LP_drawm: + and [pause_time],0 + mov ecx,[cell_count] + .lp: + push ecx + mov bl,byte[field+ecx-1] + push ebx + lea eax,[ecx-1] + mov ecx,eax + call get_xy + + mov al,bl + and al,0xf + test bl,11000000b + jnz .noempty + mov esi,LP_aw + mov ecx,11 + call LP_draw_alert + jmp .no + .noempty: + mov edx,0 + test bl,10000000b + je .stable + mov edx,0xffffff + mov esi,LP_aw + mov ecx,7 + jmp .d13 + .stable: + mov esi,LP_em + mov ecx,9 + .d13: + call LP_draw_alert + mcall 13,[lx],[ly] + .no: + mov esi,[esp+4] + dec esi + mov edi,esi + mov edx,0x0000FF + ; ecx - cell # + test byte[esp],10b + je .no_dn + add edi,[dirs+4*1] + call getline + .no_dn: + test byte[esp],1000b + je .no_right + mov edi,esi + add edi,[dirs+4*3] + call getline + .no_right: + pop ebx + pop ecx + .valid: + loop .lp2 + jmp .exlp + .lp2: + jmp .lp + .exlp: + + mov esi,[player] + mov edi,[finish] + cmp esi,edi + je .ex + mov edx,0x7777FF + call getline + .ex: + cmp [pause_time],0 + jne .ex2 + xor ecx,ecx + xor ebx,ebx + mov edx,5 +; eax - cur cell content, ebx - cell #, ecx - cell counter, edx - dir + .chwin: + movzx eax,byte[field+ebx] + and eax,0xf + btr eax,edx + bsf edx,eax + je .ex3 + inc ecx + add ebx,[dirs+edx*4] + jz .ex3 + xor edx,11b + jmp .chwin + .ex3: + cmp ecx,[cell_count] + jne .ex2 + mov [win_flag],1 + .ex2: + ret + +LP_mouse: + cmp [win_flag],1 + je .ex + mov [jump],still + mov edx,eax + call get_last_mclick + cmp edx,-2 + jne .no1st + test eax,eax + jnz .noempty + mov eax,[player] + mov ebx,[finish] + call get_offset + mov ecx,eax + mov edx,0x101 + shl dl,cl + xor ecx,11b + shl dh,cl + mov ecx,ebx + jecxz LP_drawm.ex2 + mov esi,[player] + .lp: + xor [field+esi],dl + add esi,[dirs+eax*4] + xor [field+esi],dh + loop .lp + xor ebx,ebx + .noempty: + mov [player],ebx + jmp .exx + .no1st: + test eax,eax + jz .ex + mov eax,[player] + push ebx + call get_offset + pop ebx + cmp eax,-1 + je .ex + .exx: + mov [finish],ebx + mov [jump],drw +; ud2 + .ex: + ret + + +LP_aw db 1001b,0110b +LP_em db 0000b,0001b,0010b,0100b,1000b +LP_ab db 0011b,0101b,1100b,1010b,1001b,0110b + +LP_draw_alert: +; al-cell, esi - ptr,ecx - len + .lp: + cmp al,[esi] + je .ex + inc esi + loop .lp + pusha + mov ebx,[lx] + mov ecx,[ly] + add ebx,4-2 shl 16 + add ecx,4-2 shl 16 + mcall 13,,,0xFFAAAA + mov [pause_time],eax + popa + .ex: + ret + +LP_level: +file 'loops.bin' + +if lang eq ru + LP_help mstr \ + 'Через все клетки прямоугольника необходимо',\ + 'провести замкнутую ломаную. Проходя через черный',\ + 'кружок, ломаная обязана повернуть, а проходя',\ + 'через белый кружок, ломаная поворачивать не',\ + 'может. В пустых же клетках ломаная ведет себя как',\ + 'захочет.','',\ + 'http://puzzleprograms.narod.ru' +else + LP_help mstr \ + 'You have to draw closed line over every grid',\ + 'cell. On black square line must turn, and it must',\ + 'go straight when over white square. The line may',\ + 'behave anyhow elsewhere.','',\ + 'http://puzzleprograms.narod.ru' +end if diff --git a/programs/games/megamaze/trunk/marble.bin b/programs/games/megamaze/trunk/marble.bin new file mode 100644 index 0000000000..20d126b692 Binary files /dev/null and b/programs/games/megamaze/trunk/marble.bin differ diff --git a/programs/games/megamaze/trunk/marble.inc b/programs/games/megamaze/trunk/marble.inc new file mode 100644 index 0000000000..7865cd4668 --- /dev/null +++ b/programs/games/megamaze/trunk/marble.inc @@ -0,0 +1,138 @@ +; level format +; [fx|fy][hole xy][balls #]..[1-red,0-black xy]..[maze walls] + +; internal format +; [stepptr]= balls # +; [finish]= hole cell +; area: ..[1-red,0-black xy].. ( -1 if empty) + +MAR_levelp: + call get_xy_sf + movzx eax,byte[esi-2] + mov [finish],eax + movzx ecx,byte[esi-1] + mov [stepptr],ecx + mov edi,area + rep movsb + mov [pause_time],10 + call unpack_level + ret + +MAR_key: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov esi,area-1 + lea ebx,[eax-176] + .again: + and [cur_step],0 + mov ecx,[stepptr] + .lp: + movzx eax,byte[esi+ecx] + cmp al,-1 + je .ex1 + mov byte[player],al + and byte[player],0x80 + and eax,0x7f + call check_move + jc .ex1 + add eax,[dirs+ebx*4] + cmp eax,[finish] + jne .nohole + mov byte[esi+ecx],-1 + jmp .ex2 + .nohole: + push ecx + mov ecx,[stepptr] + mov edi,area + .lp2: + mov dl,[edi] + and dl,0x7f + cmp al,dl + je .exlp2 + inc edi + loop .lp2 + .exlp2: + pop ecx + je .ex1 + or al,byte[player] + mov [esi+ecx],al + .ex2: + inc [cur_step] + .ex1: + loop .lp + cmp [cur_step],0 + je .exx + call delay + call drwfld + jmp .again + .exx: + mov ecx,[stepptr] + inc esi + .lp3: + lodsb + cmp al,-1 + je .nxt + test al,0x80 + jne .ex + .nxt: + loop .lp3 + mov [win_flag],1 + .ex: + ret + +MAR_drawm: + shl [sq_size],1 + mov eax,[finish] + call get_xy + shr [sq_size],1 + mcall 13,[lx],[ly],0xa0a0a0 + movzx ecx,byte[stepptr] + mov edi,area + .lp: + push ecx + movzx eax,byte[edi] + mov edx,0x0 + cmp al,-1 + je .exlp + test eax,0x80 + je .no + mov edx,0xff00000 + .no: + and eax,0x7f + call get_xy + mcall 13,[lx],[ly] + .exlp: + pop ecx + inc edi + loop .lp + .ex: + ret + +MAR_level: +file 'marble.bin' + +if lang eq ru + MAR_help mstr \ + 'Несколько красных и черных плашек лежат на доске,',\ + 'дырка обозначена серой клеткой. Когда плашка',\ + 'проходит над дыркой, она падает туда и исчезает.',\ + 'Используйте стрелки для наклона доски.',\ + ' Ваша задача - сбросить все красные плашки.',\ + 'Количество упавших черных плашек роли не играет.','',\ + 'http://www.clickmazes.com' +else + MAR_help mstr \ + 'Several red and black marbles sit on a flat tray,',\ + 'a grey square indicate a hole in the tray. If a',\ + 'marble rolls onto or over the hole it drops',\ + 'through and disappears. Use the cursor keys to',\ + 'tilt the tray and start the marbles rolling, the',\ + 'marbles roll in a straight line until they come',\ + 'to rest, you can then roll again. Your challenge',\ + 'is to drop all the red marbles, it does not',\ + 'matter how many black marbles you lose in the',\ + 'process.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/megamaze.asm b/programs/games/megamaze/trunk/megamaze.asm new file mode 100644 index 0000000000..7d3912a6df --- /dev/null +++ b/programs/games/megamaze/trunk/megamaze.asm @@ -0,0 +1,855 @@ +IDA equ 1 ; We're running debugida.exe + +STRIP equ 40 +LEVNUM equ 500 + XFOFS equ 10 + YFOFS equ 55 + MSGXO equ 32 +GAMES_ALL equ 12 +WNDCOLOR equ 0x03c0c0c0;0x03f6f6f6; +MINCS equ 40 +MAXCS equ 80 +macro icall lbl +{ + call [lbl+ebp*4] +} + + use32 + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd run ; start of code + dd I_END ; size of image + dd end_mem ; memory for app + dd stack_end ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon +lang fix ru +include "MACROS.INC" +purge mov +;include "DEBUG.INC" +COLOR_ORDER equ MENUETOS + +include 'gif_lite.inc' + +include 'tam.inc' +include 'smz.inc' +include 'tilt.inc' +include 'tilt2.inc' +include 'fhouse.inc' +include 'loops.inc' +include 'wriggle.inc' +include 'blackbox.inc' +include 'marble.inc' +include 'cstep.inc' +include 'orient.inc' +include 'nolt.inc' +include 'colzone.inc' + +run: + mov [Ces],STRIP;20 + mcall 3 + mov cl,16 + ror eax,cl + mov [generator],eax ; random generator from Tetris + + and [mpress_flag],0 + and [gif_unp],0 + xor ebp,ebp ; game_t +; mov ebp,10 + mcall 64,1,end_mem + mov [pause_time],40 + call resize + .game1: + mov [levnum],LEVNUM + .game: + and [win_flag],0 + and [drag_flag],0 + mov ecx,[levnum] + mov esi,[levels+ebp*4] + jecxz .skip + .nxt: + movzx eax,byte[esi] + add esi,eax + xor eax,eax + cmp al,byte[esi] + jne .noz + mov esi,LEVNUM;500 + sub esi,ecx + mov [levcount],esi + and [levnum],0 + jmp .game + .noz: + loop .nxt + .skip: + mcall 40,111b + mov [mouse_processed],1 + xor eax,eax + icall prepare_level +wnd_size: + mov eax,[Ces] + shr eax,2 + sub eax,2 + mov [sq_size],eax + if ~ IDA eq 1 + mov edx,[fx] + imul edx,[Ces] + add edx,XFOFS*2+20 + mov esi,[fy] + imul esi,[Ces] + add esi,YFOFS+30 + mov ecx,-1 + mcall 67,ecx + end if +red: + call draw_window + +drw: + call drwfld + +still: + mcall 2 + test al,al + jz still + mcall 10 + cmp eax,2 + je key + cmp eax,1 ; redraw request ? + je red + cmp eax,3 ; button in buffer ? + je button + cmp eax,6 ; mouse event ? + je mouse +key: + mcall 2 +; movzx ebx,ah +; dpd ebx + cmp ebp,10 + je .noplus + mov ebx,5 + cmp ah,184 + jne .nomin + cmp [Ces],MINCS + je still + .ces: + sub [Ces],ebx + call resize + jmp wnd_size + .nomin: + cmp ah,183 + jne .noplus + cmp [Ces],MAXCS + je still + neg ebx + jmp .ces + .noplus: + cmp ah,'h' + jne .nohlp +; if IDA eq 1 +; cmp [child],0 +; jne still +; else + call kill_help +; end if + mov [pack],ebp + mcall 51,1,show_help,chs_end +; dpd eax + mov [child],eax + jmp still + .nohlp: + cmp [win_flag],10 + je .levover + cmp [win_flag],2 + je .no_win + cmp [win_flag],1 + jne .now + .levover: + call lev_next + .no_win: + and [win_flag],al + jmp run.game + .now: + shr eax,8 + mov [jump],drw;red + cmp eax,13 + je run.game + icall key_handler + jmp [jump] + +button: + mcall 17 + cmp ah,1 + je close + cmp ah,2 + je .game_type + cmp ah,4 + je .inclev + cmp ah,3 + je .declev + jmp still + .declev: + dec [levnum] + cmp [levnum],0 + jge run.game + push [levcount] + pop [levnum] + jmp run.game + .inclev: + call lev_next + jmp run.game + .game_type: + inc ebp + cmp ebp,GAMES_ALL + jbe run.game1 + xor ebp,ebp + jmp run.game1 + close: + if ~ IDA eq 1 + call kill_help + end if + mcall -1 + +;if ~ IDA eq 1 + +kill_help: + mcall 9,prc_info2,-1 + mov edx,[child] + mov ecx,eax + .lp: + mcall 9 + cmp edx,[ebx+30] + jne .nochild + mcall 18,2 + and [child],0 + ret + .nochild: + loop .lp + ret + +;end if + +mouse: + cmp [mouse_processed],1 + jne .ex + mcall 37,1 + sub eax,XFOFS shl 16+YFOFS + xor edx,edx + mov ebx,[Ces] + mov ecx,eax + and eax,0xffff + div ebx + xor edx,edx + mov [mouse_y],eax + cmp eax,[fy] + jae .ex + mov eax,ecx + shr eax,16 + div ebx + mov [mouse_x],eax + cmp eax,[fx] + jae .ex + mcall 37,2 ; get buttons + cmp [drag_flag],0 + je .nodrag + mov ebx,eax + cmp eax,[mpress_flag] + mov eax,-1 + je .nochg + dec eax + .nochg: + mov [mpress_flag],ebx + jmp .call_hnd + .nodrag: + test eax,eax + jz .ex1 + cmp eax,[mpress_flag] + je .ex + mov [mpress_flag],eax + mov eax,-1 + .call_hnd: + mov [mouse_processed],0 + icall key_handler + jmp [jump] + .ex1: + mov [mpress_flag],0 + .ex: + jmp still + +lev_next: + push eax + inc [levnum] + mov eax,[levnum] + cmp eax,[levcount] + jbe .ex + and [levnum],0 + .ex: + pop eax + ret + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* +draw_window: + pusha + mcall 12,1 + mov ebx,[fx] + imul ebx,[Ces] + push ebx + add ebx,50 shl 16+XFOFS*2+20 + mov ecx,[fy] + imul ecx,[Ces] + add ecx,10 shl 16+YFOFS+30 + mcall 0,,,WNDCOLOR + mov esi,edx + and esi,0xffffff + mcall 9,prc_info,-1 + mov ebx,[esp] + pop ebx + add ebx,XFOFS shl 16+XFOFS*2 + + mcall 8,,<25,12>,2 + + mcall 8,,<40,12>,3 + add ebx,14 shl 16 + inc edx + mcall + mcall 4,<8,8>,0x10ffffff,header,header.size + mov ecx,ebp + mov edx,game_names+4 + call get_mstr + mcall ,,0x8000 + imul esi,6 + add esi,3 + shl esi,16 + lea edx,[ebx+esi] + mcall 47,0x020001,levnum,,0x8000 + + mcall 4,,0x108000,next_msg,3 + mcall 12,2 + popa + ret + +unpack_level: + mov ecx,[cell_count] + mov edi,field + .lp: + movzx eax,byte[esi] + inc esi + shl ax,4 + shr al,4 + stosw + loop .lp + ret + +get_xy: +; eax-coord +; out: [lx]-[x+2][CS-4],[ly]-[y+2][CS-4] + pusha + xor edx,edx + mov esi,[sq_size] + lea edi,[esi*2] + neg edi + add edi,[Ces] + mov [lx],edi + mov [ly],edi + mov ebx,[fx] + div bx + imul eax,[Ces] + imul edx,[Ces] + lea edx,[edx+XFOFS+esi] + lea eax,[eax+YFOFS+esi] + mov word[ly+2],ax + mov word[lx+2],dx + popa + ret + +check_move: +; eax-coord, ebx-direction +; CF=0 if move is valid + bt dword[field+eax],ebx + ret + +delay: + pusha + mcall 5,[pause_time] + popa + ret + +get_mstr: +; in: edx,ecx +; out: edx,esi + mov esi,[edx-4] + jecxz .ex + lea edx,[edx+esi+4] + dec ecx + jmp get_mstr + .ex: + ret + +maze_field: + mov edi,field + mov [ly],YFOFS shl 16+YFOFS + mov eax,38 + mov ecx,[fy] + .lp1: + push ecx + mov [lx],XFOFS shl 16+XFOFS + mov ecx,[fx] + .lp2: + push ecx + xor esi,esi + .lp3: + mov edx,0xd0d0d0 + bt dword[edi],esi + jnc .gray + mov edx,0 + .gray: + mov ebx,[lx] + add ebx,[dir_ofs+esi*4] + mov ecx,[ly] + add ecx,[dir_ofs+esi*4+8] + mcall + inc esi + cmp esi,4 + jb .lp3 + inc edi + mov ecx,[Ces] + add word[lx],cx + add word[lx+2],cx + pop ecx + loop .lp2 + mov ecx,[Ces] + add word[ly],cx + add word[ly+2],cx + pop ecx + loop .lp1 + ret + +grid_field: + mov edx,0xa0a0a0 + mov eax,38 + + mov ecx,[fy] + mov ebx,[fx] + imul ebx,[Ces] + add ebx,XFOFS shl 16+XFOFS + mov esi,YFOFS shl 16+YFOFS + inc ecx + .lp1: + push ecx + mov ecx,esi + mcall + mov ecx,[Ces] + add esi,ecx + shl ecx,16 + add esi,ecx + pop ecx + loop .lp1 + + mov ecx,[fx] + mov esi,[fy] + imul esi,[Ces] + add esi,YFOFS shl 16+YFOFS + mov ebx,XFOFS shl 16+XFOFS + inc ecx + .lp2: + push ecx + mov ecx,esi + mcall + mov ecx,[Ces] + add ebx,ecx + shl ecx,16 + add ebx,ecx + pop ecx + loop .lp2 + ret + +get_xy_sf: + xor eax,eax + and [player],eax + mov [fx],eax + mov [fy],eax + lodsb + lodsb + mov ah,al + shr ah,4 + and al,0xf + mov byte[fx],ah + mov byte[fy],al + lodsb + mov byte[player],al + lodsb + mov byte[finish],al + .count: + mov eax,[fx] + mov [dirs+4],eax + neg eax + mov [dirs+8],eax + mov eax,[fx] + imul eax,[fy] + mov [cell_count],eax + + ret + +get_last_mclick: +; out - eax=0 no click or outside field +; eax>0 button pressed, ebx=[xy] + mov [mouse_processed],1 + mov eax,[mpress_flag] + mov ebx,[mouse_y] + imul ebx,[fx] + add ebx,[mouse_x] + ret + +erase_field: + pusha + mov ecx,[cell_count] + xor eax,eax + mov edi,field + rep stosb + popa + ret + +get_pxy: +; in: [pack] - cell#, out: word[pack] - packed [xy] + pusha + mov eax,[pack] + cdq + mov ebx,[fx] + div ebx + shl edx,8 + add eax,edx + mov [pack],eax + popa + ret + +check_bounds: +; in: eax - cell, ebx - dir +; out: ebx=-1 if bounds crossed + push eax ecx + mov ecx,eax + add ecx,[dirs+ebx*4] + mov ebx,ecx + call get_offset + mov ebx,eax + pop ecx eax + cmp ebx,-1 + ret + +get_offset: +; in: eax - start, ebx-end +; out: eax - dir or -1 if not straight +; ebx - distance + push ecx edx + mov ecx,-1 + mov edx,[cell_count] + cmp eax,edx + jae .ex + cmp ebx,edx + jae .ex + mov [pack],eax + call get_pxy + mov eax,[pack] + mov [pack],ebx + call get_pxy + mov ebx,[pack] + cmp ah,bh ; compare X + jne .noX + mov ecx,1 + sub bl,al + ja .ok + inc ecx + .ok2: + neg bl + jmp .ok + .noX: + cmp al,bl ; compare Y + jne .ex + inc ecx + sub bh,ah + mov bl,bh + jb .ok2 + add ecx,3 + .ok: + movzx ebx,bl + .ex: + mov eax,ecx + pop edx ecx + ret + +show_help: + mov ebp,[pack] + .red: + mcall 12,1 + mov ebx,[prc_info.x_start] + add ebx,[prc_info.x_size] + shl ebx,16 + add ebx,310 + mov ecx,[prc_info.y_start] + shl ecx,16 + add ecx,220 + mcall 0,,,0x03c0c0c0 + mcall 4,<8,8>,0x00ffffff,help_hdr,help_hdr.size + mov ecx,ebp + mov edx,game_names+4 + call get_mstr + sub esi,2 + mcall 4,<6*help_hdr.size+15,8>,0x00ffffff + + mov edx,[help_msg+ebp*4] + add edx,4 + xor ecx,ecx + mov ebx,10 shl 16+30 + .nxt: + mov esi,[edx-4] + jecxz .drw + dec ecx + lea edx,[edx+esi+4] + jmp .nxt + .drw: + cmp esi,-1 + je .edraw + mcall ,,0x000000ff + mov ecx,1 + add ebx,12 + jmp .nxt + .edraw: + mcall 12,2 + .still: + mcall 10 + cmp eax,2 + jne .nokey + mcall + jmp .close + .nokey: + cmp eax,1 ; redraw request ? + je .red + cmp eax,3 ; button in buffer ? + jne .still + mcall 17 + cmp ah,1 + jne .still + .close: + and [child],0 + mcall -1 + +getline: +; in: esi,edi + pusha + mov eax,esi + call get_xy + mov ebx,[lx] + mov ecx,[ly] + mov eax,edi + call get_xy + mov bx,word[lx+2] + mov cx,word[ly+2] + mov eax,[Ces] + shr eax,1 + sub eax,[sq_size] + add ebx,eax + add ecx,eax + shl eax,16 + add ebx,eax + add ecx,eax + mov [lx],ebx + mov [ly],ecx + mcall 38 + popa + ret + +bold_line: + WGSPC equ 1 + pusha + mov edi,WGSPC shl 16+WGSPC + add [lx],edi + add [ly],edi + mcall 38,[lx],[ly] + shl edi,1 + sub ebx,edi + sub ecx,edi + mcall + popa + ret + +get_rnd: + mov eax, [generator] + sub eax,0x43ab45b5 ; next random number + ror eax,1 + xor eax,0x32c4324f + ror eax,1 + mov [generator],eax + ret + +drwfld: + pusha + mov ebx,[fx] + imul ebx,[Ces] + add ebx,XFOFS shl 16 + mov ecx,[fy] + imul ecx,[Ces] + add ecx,YFOFS shl 16 + mcall 13,,,WNDCOLOR + add ebx,26 shl 16-26 + sub ecx,16 shl 16 + mov cx,16 + mcall + icall draw_field + icall draw_more + cmp [win_flag],0 + jz .edraw + movzx ecx,[win_flag] + mov edx,msgs+4 + call get_mstr + mcall 4,,0x100000ff + .edraw: + popa + ret + +resize: + mov eax,[Ces] + mov edi,dir_ofs+4 + stosd + stosd + stosw + stosw + mov [edi+4],eax + ret + +need_image: +; in: eax - gif pointer + cmp [gif_unp],0 + jne .skip + push esi edi + mov esi,eax + mov eax,field + mov edi,raw_area + call ReadGIF + mov [gif_unp],1 + pop edi esi + .skip: + ret + +out_image: +; in: eax - coord, ebx - image # + +STRIP2 = STRIP-2 + pusha + call get_xy + mov edx,[lx] + mov dx,word[ly+2] + add edx,1 shl 16+1 + imul ebx,STRIP2*STRIP2*3 + add ebx,raw_area+12 + mcall 7,,STRIP2 shl 16+STRIP2 + popa + ret + +OR_strip: +;file 'orient2.gif' +file 'orientg2.gif' + rd 2 + gif_unp dd 0 + +; DATA AREA +help_hdr db 'MegaMaze Help -' + .size=$-help_hdr + +dirs dd -1,0,0,1 +dir_ofs dd 0, 1, 1, 1 shl 16+1, 0, 1 + +dir_rotate db 2,0,3,1,1,3,0,2 + +w_colors dd 0x0404CA,0xCC0404,0x00CC00 +f_colors dd 0x9494FC,0xFC9494,0x99FF99,0xFFFF00 + +levnum dd LEVNUM + +prepare_level dd TM_levelp,SMZ_levelp,TILT_levelp,TILT2_levelp,FH_levelp,\ + LP_levelp,WG_levelp,BB_levelp,MAR_levelp,TM_levelp,OR_levelp,NLT_levelp,\ + CZ_levelp +key_handler dd TM_key,SMZ_key,TILT_key,TILT2_key,FH_key,LP_key,WG_key,BB_key,\ + MAR_key,CSTEP_key,OR_key,NLT_key,CZ_key +draw_more dd TM_drawm,SMZ_drawm,TILT_drawm,TILT2_drawm,FH_drawm,LP_drawm,\ + WG_drawm,BB_drawm,MAR_drawm,CSTEP_drawm,OR_drawm,NLT_drawm,CZ_drawm +draw_field dd maze_field,maze_field,maze_field,maze_field,grid_field,\ + grid_field,grid_field,grid_field,maze_field,maze_field,OR_drawf,maze_field,\ + grid_field +levels dd TM_level,SMZ_level,TILT_level,TILT2_level,FH_level,LP_level,\ + WG_level,BB_level,MAR_level,CSTEP_level,OR_level,NLT_level,CZ_level +help_msg dd TM_help,SMZ_help,TILT_help,TILT2_help,FH_help,LP_help,WG_help,\ + BB_help,MAR_help,CSTEP_help,OR_help,NLT_help,CZ_help + +if lang eq ru + header db 'Mega Maze' +else + header db 'Mega Maze' +end if + .size = $ - header + +next_msg db '< >' + +game_names mstr \ + 'Teseus & Minotaur #',\ + '1-2-3 Maze #',\ + 'Tilt Maze #',\ + 'Double Tilt #',\ + 'Full-house #',\ + 'Loops #',\ + 'Wriggle #',\ + 'BlackBox #',\ + 'Marble #',\ + 'Counter Step #',\ + 'Orientation #',\ + 'No left turn #',\ + 'Colour-zone #' + +msgs mstr ' ','You win!!!','Game over.','Start cell?','Dead end!',\ + " atoms hidden.",'Ray emerged.','Ray absorbed.','Ray reflected.',\ + 'Mark exactly guesses','Your score is','Guess mark toggled' + +I_END: +main_pid dd ? +child_stack rb 256 + chs_end: +drag_flag db ? +sq_size dd ? +mouse_processed dd ? +mpress_flag dd ? +mouse_x dd ? +mouse_y dd ? + +Ces dd ? +pack dd ? +fy dd ? +fx dd ? +lx dd ? +ly dd ? +generator dd ? +cell_count dd ? +levptr dd ? +levcount dd ? + +score dd ? +player: +teseus dd ? +finish: +minotaur dd ? + +stepptr dd ? +cur_step dd ? + +win_flag db ? +jump dd ? +pause_time dd ? +child dd ? +area rb 1024 +stak rb 1024 +stack_end: +prc_info process_information +prc_info2 process_information +field: + rb 128*128 +raw_area: + rb STRIP*STRIP*12*3+16 +end_mem: diff --git a/programs/games/megamaze/trunk/nolt.bin b/programs/games/megamaze/trunk/nolt.bin new file mode 100644 index 0000000000..fc6d216708 Binary files /dev/null and b/programs/games/megamaze/trunk/nolt.bin differ diff --git a/programs/games/megamaze/trunk/nolt.inc b/programs/games/megamaze/trunk/nolt.inc new file mode 100644 index 0000000000..1af437bb4b --- /dev/null +++ b/programs/games/megamaze/trunk/nolt.inc @@ -0,0 +1,92 @@ +NLT_levelp: + mov eax,OR_strip + call need_image + xor eax,eax + lodsb + lodsb + mov [fx],eax + lodsb + mov [fy],eax + lodsw + mov [player],eax + mov dword[area],5 + lodsw + mov [finish],eax + call get_xy_sf.count + mov [levptr],esi + call unpack_level + ret + +NLT_key: + mov [jump],still + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + lea ebx,[eax-176] + mov eax,[player] + call check_move + jc .ex + mov ecx,ebx + mov edx,ebx + movzx ecx,byte[dir_rotate+ecx] + cmp ecx,dword[area] + je .ex + xor edx,11b + cmp edx,dword[area] + je .ex + add eax,[dirs+ebx*4] + mov dword[area],ebx + mov [player],eax + cmp eax,[finish] + jne .nowin + mov [win_flag],1 + .nowin: + mov [jump],drw + .ex: + ret + +NLT_drawm: + push [sq_size] + mov [sq_size],0 + mov eax,[finish] + mov ebx,6 + call out_image +; mcall 13,[lx],[ly],0xff0000 + mov ebx,dword[area] + cmp ebx,5 + jne .skip + mov eax,[player] + mov edi,eax + pop [sq_size] + call get_xy + mcall 13,[lx],[ly],0x8000 + jmp .ex + .skip: + add ebx,8 + mov eax,[player] + call out_image + pop [sq_size] + .ex: + ret + +NLT_level: +file 'nolt.bin' + +if lang eq ru + NLT_help mstr \ + 'Ваша задача - провести зеленый квадрат к красному',\ + 'без поворота налево и движения назад. Это труднее',\ + 'чем кажется. Внимание: если Вы примете плохое',\ + 'решение, можете попасть в тупик и будете',\ + 'вынуждены начать сначала.','',\ + 'http://puzzleprograms.narod.ru' +else + NLT_help mstr \ + 'Your challenge is to manouvre the green dot to',\ + 'the red square without ever turning left, or',\ + 'making a U-turn. Harder than it looks. Beware, if',\ + 'you make a bad decision in this maze you may get',\ + 'completely stuck and have to restart.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/omaze.bin b/programs/games/megamaze/trunk/omaze.bin new file mode 100644 index 0000000000..f645bedd43 Binary files /dev/null and b/programs/games/megamaze/trunk/omaze.bin differ diff --git a/programs/games/megamaze/trunk/or2.bin b/programs/games/megamaze/trunk/or2.bin new file mode 100644 index 0000000000..b2ee0b558b Binary files /dev/null and b/programs/games/megamaze/trunk/or2.bin differ diff --git a/programs/games/megamaze/trunk/orient.bin b/programs/games/megamaze/trunk/orient.bin new file mode 100644 index 0000000000..9ea38c2d88 Binary files /dev/null and b/programs/games/megamaze/trunk/orient.bin differ diff --git a/programs/games/megamaze/trunk/orient.inc b/programs/games/megamaze/trunk/orient.inc new file mode 100644 index 0000000000..6386d4755b --- /dev/null +++ b/programs/games/megamaze/trunk/orient.inc @@ -0,0 +1,227 @@ +; level format +; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2] + +; internal format +; [stepptr]= worms # +; area: [worm_len][start_cell #][end_cell #]..[dirs].. +; [cur_step]: dragged worm pointer +; [finish]: 0 - if head dragged, 1- if tail + +OR_levelp: + mov [Ces],40 + mcall 40,100111b + inc [drag_flag] + mov eax,OR_strip + call need_image + inc esi + movzx ecx,byte[esi] + inc esi + push esi + mov esi,OR_maze + jecxz .sk + .nxtmz: + movzx eax,byte[esi] + add esi,eax + loop .nxtmz + .sk: + call get_xy_sf + call unpack_level + pop esi + movzx ecx,byte[esi] + inc esi + mov [cur_step],ecx + jecxz .sk2 + mov edi,area + rep movsb + .sk2: + mov ecx,[cell_count] + mov edi,area+16 + rep movsb + mov [stepptr],2 +; call erase_field +; ud2 + ret + +OR_key: + cmp eax,0 + jl OR_mouse + ret + +OR_drawf: + mov ecx,[cell_count] + push [sq_size] + mov [sq_size],0 + .lp: + push ecx + movzx ebx,byte[area+16+ecx-1] + cmp bl,0xf + je .no + lea eax,[ecx-1] + call out_image + .no: + pop ecx + loop .lp + pop [sq_size] + ret + +OR_drawm: + push [sq_size] + mov [sq_size],0 + mov eax,[player] + mov ebx,[stepptr] + add ebx,8 + call out_image + mov ecx,[cur_step] + jecxz .skipb + mov ebx,7 + mov esi,area + xor eax,eax + .nxtb: + lodsb + call out_image + loop .nxtb + .skipb: + mov eax,[player] + .again: + mov ebx,[stepptr] + call check_move + jc .ex + add eax,[dirs+ebx*4] + cmp byte[area+16+eax],6 + je .ex + mov ecx,[cur_step] + jecxz .skbchk + mov edi,area + repne scasb + je .again + .skbchk: + mov [sq_size],1 + push eax + call get_xy + mov ebx,[lx] + sub bx,2 + mov ecx,[ly] + mov cx,3 + mcall 13,,,0xFFC633 + xchg bx,cx + mcall + mov esi,[Ces] + sub esi,3+2 + shl esi,16 + push ebx + add ebx,esi + mcall + pop ebx + add ecx,esi + xchg bx,cx + add bx,2 + mcall + pop eax + jmp .again + .ex: + pop [sq_size] + ret + +OR_mouse: + cmp [win_flag],1 + je .ex + mov [jump],still + mov edx,eax + call get_last_mclick + cmp edx,-2 + jne .ex + test eax,eax + jnz .noempty + .drw: + mov [jump],drw + ret + .noempty: + +; First Click at ebx cell + mov eax,[player] + cmp eax,ebx + je OR_drawf + mov ecx,[cur_step] + jecxz .skbchk + mov edi,area + xchg eax,ebx + repne scasb + xchg eax,ebx + je OR_drawf + .skbchk: + cmp byte[area+16+ebx],0xf + je .ex + cmp byte[area+16+ebx],6 + je .ex + push eax + mov edx,ebx + call get_offset + mov ebx,eax + pop eax + cmp ebx,[stepptr] + jne .ex + + call check_move + jc .ex + movzx ecx,byte[area+16+edx] + cmp ecx,4 + jae .noarr + mov ebx,ecx + call check_move + jc .ex + mov edx,eax + add eax,[dirs+ebx*4] + mov [player],eax + mov ecx,[cur_step] + jecxz .skbchk2 + mov edi,area + repne scasb + jne .skbchk2 + mov [edi-1],dl + .skbchk2: + cmp eax,[finish] + jne .drw + mov [win_flag],1 + jmp .drw + .noarr: + mov edx,[stepptr] + cmp ecx,4 + jne .nocw + movzx edx,byte[dir_rotate+edx] + jmp .ex2 + .nocw: + cmp ecx,5 + jne .ex + movzx edx,byte[dir_rotate+4+edx] + .ex2: + mov [stepptr],edx + jmp .drw + .ex: + ret + +OR_maze: +file 'omaze.bin' + +OR_level: +file 'or2.bin' + +if lang eq ru + OR_help mstr \ + 'Щелчок на выделенной клетке передвигает или',\ + 'вращает красную стрелку. Синий блок действует',\ + 'как препятствие, скрывая одну клетку. При',\ + 'переходе стрелки на клетку синего блока они',\ + 'поменяются местами. Задача - провести красную',\ + 'стрелку из нижней клетки в верхнюю.','',\ + 'http://www.clickmazes.com' +else + OR_help mstr \ + 'Click on a highlighted square to move or rotate',\ + 'the red pointer. The blue switcher acts as an',\ + 'obstacle, hiding one square. The red pointer and',\ + 'blue switcher will swap places if the red pointer',\ + 'is pushed onto a square occupied by a blue',\ + 'switcher. Your challenge is to negotiate the red',\ + 'arrow from the bottom to the top square.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/orientg2.gif b/programs/games/megamaze/trunk/orientg2.gif new file mode 100644 index 0000000000..2cfc5cff50 Binary files /dev/null and b/programs/games/megamaze/trunk/orientg2.gif differ diff --git a/programs/games/megamaze/trunk/smz.bin b/programs/games/megamaze/trunk/smz.bin new file mode 100644 index 0000000000..459d26fa99 Binary files /dev/null and b/programs/games/megamaze/trunk/smz.bin differ diff --git a/programs/games/megamaze/trunk/smz.inc b/programs/games/megamaze/trunk/smz.inc new file mode 100644 index 0000000000..5a7770b893 --- /dev/null +++ b/programs/games/megamaze/trunk/smz.inc @@ -0,0 +1,94 @@ +SMZ_levelp: + call get_xy_sf + xor eax,eax + mov [stepptr],esi + lodsb + mov [cur_step],esi + add esi,eax + mov [levptr],esi + call unpack_level + ret + +SMZ_key: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov ecx,[cur_step] + movzx ecx,byte[ecx] + lea ebx,[eax-176] + mov eax,[player] + .lp: + call check_move + jc .exl + add eax,[dirs+ebx*4] + loop .lp + .exl: + test ecx,ecx + jne .ex + mov [player],eax + cmp eax,[finish] + jne .nowin + mov [win_flag],1 + .nowin: + mov esi,[stepptr] + movzx eax,byte[esi] + inc esi + lea ebx,[esi+eax] + inc [cur_step] + cmp [cur_step],ebx + jb .ex + mov [cur_step],esi + .ex: + ret + +SMZ_drawm: + mov eax,[player] + call get_xy + mcall 13,[lx],[ly],0xff00 + mov eax,[finish] + call get_xy + mcall 13,[lx],[ly],0xff0000 + cmp [win_flag],1 + je .ex + mov edi,[stepptr] + movzx ecx,byte[edi] + inc edi + mov edx,(XFOFS+MSGXO) shl 16+42 + mov ebx,0x010000 + mov eax,47 + .lp: + push ecx + mov esi,0x10000000 + movzx ecx,byte[edi] + cmp edi,[cur_step] + jne .nocur + mov esi,0x100000ff + mcall + add edx,1 shl 16 + .nocur: + mcall + pop ecx + add edx,10 shl 16 + inc edi + loop .lp + .ex: + ret + +SMZ_level: +file 'smz.bin' + +if lang eq ru + SMZ_help mstr \ + 'Повторяйте последовательность ходов, двигая',\ + 'зеленый квадрат на подсвеченное количество клеток',\ + 'по прямой, пока не достигнете красного квадрата.','',\ + 'http://puzzleprograms.narod.ru' +else + SMZ_help mstr \ + 'Repeat sequence shown above the field moving the',\ + 'green square by highlighted count of spaces as',\ + 'many times as you like, until you finish at the',\ + 'red square.','',\ + 'http://puzzleprograms.narod.ru' +end if diff --git a/programs/games/megamaze/trunk/tam.INC b/programs/games/megamaze/trunk/tam.INC new file mode 100644 index 0000000000..023c734230 --- /dev/null +++ b/programs/games/megamaze/trunk/tam.INC @@ -0,0 +1,164 @@ +TM_levelp: + call get_xy_sf + mov [levptr],esi + call unpack_level + ret + +TM_key: + cmp eax,' ' + je .mm + cmp eax,176 + jb .still + cmp eax,179 + ja .still + lea ebx,[eax-176] + mov eax,[teseus] + call check_move + jc .still + call move_teseus + cmp [win_flag],0 + jne .ex + .nowin: + call drwfld + .mm: + call move_minotaur + cmp eax,[teseus] + jne .still + mov [win_flag],2 + jmp .ex + .still: + mov [jump],still + .ex: + ret + +move_minotaur: + xor esi,esi + mov eax,[teseus] + mov ebx,[fx] + div bl + mov ecx,eax ;teseus: ch-x, cl-y + mov eax,[minotaur] + .again: + call mino_xy + xor ebx,ebx + cmp dh,ch + je .stand2 + ja .ok1 + add ebx,3 + .ok1: + call check_move + jc .stand2 + add eax,[dirs+ebx*4] + mov [minotaur],eax + inc esi + call delay + call drwfld + cmp esi,2 + jb .again + jmp .ex + .stand1: + call mino_xy + .stand2: + mov ebx,2 + cmp dl,cl + je .ex + ja .ok2 + dec ebx + .ok2: + call check_move + jc .ex + add eax,[dirs+ebx*4] + mov [minotaur],eax + inc esi + call delay + call drwfld + cmp esi,2 + jb .again + .ex: + ret + +mino_xy: + push eax + div byte[fx] + mov edx,eax ;minotaur: dh-x, dl-y + pop eax + ret + +move_teseus: + pusha + cdq + mov ecx,[fx] + div cl + add ax,1 shl 8+1 + test ebx,ebx + jne .no0 + cmp ah,1 + jne .move + .win: + inc [win_flag] + jmp .ex + .no0: + cmp ebx,1 + jne .no1 + cmp al,byte[fy] + je .win + jmp .move + .no1: + cmp ebx,2 + jne .no2 + cmp al,1 + je .win + jmp .move + .no2: + cmp ebx,3 + jne .move + cmp ah,byte[fx] + je .win + .move: + mov eax,[esp+28] + add eax,[dirs+ebx*4] + mov [teseus],eax + .ex: + popa + ret + +TM_drawm: + mov eax,[teseus] + call get_xy + mcall 13,[lx],[ly],0xff00 + mov eax,[minotaur] + call get_xy + mcall 13,[lx],[ly],0xff0000 + ret + +TM_level: +file 'tam.bin' + +if lang eq ru + TM_help mstr \ + ' Тесей (зеленый квадрат) должен убежать из',\ + 'лабиринта. За ним гонится механический Минотавр',\ + '(красный квадрат). На каждый ход Тесей Минотавр',\ + 'делает 2 хода по такой схеме:',\ + ' Сначала он пытается приблизиться к Тесею по',\ + 'горизонтали на 1 квадрат. Если это невозможно,',\ + 'он пытается подойти по вертикали на 1 квадрат.',\ + 'Если невозможно сделать ни того, ни другого,',\ + 'Минотавр пропускает данный ход.','',\ + 'http://puzzleprograms.narod.ru' +else + TM_help mstr \ + ' Theseus (the green dot) must escape from a maze.',\ + 'There is also a mechanical Minotaur (the red',\ + 'dot) in each maze. For every turn that Theseus',\ + 'takes, the Minotaur takes two turns.',\ + ' Each turn he decides following:',\ + 'First he tests if he can move horizontally and',\ + 'get closer to Theseus. If he can, he will move',\ + "one square horizontally. If he can't, he will",\ + 'test if he could move vertically and get closer',\ + 'to Theseus. If he can, he will move one square',\ + "vertically. If he can't move either horizontally",\ + 'or vertically, then he just skips that turn.','',\ + 'http://puzzleprograms.narod.ru' +end if diff --git a/programs/games/megamaze/trunk/tam.bin b/programs/games/megamaze/trunk/tam.bin new file mode 100644 index 0000000000..e94f1a1584 Binary files /dev/null and b/programs/games/megamaze/trunk/tam.bin differ diff --git a/programs/games/megamaze/trunk/tilt.bin b/programs/games/megamaze/trunk/tilt.bin new file mode 100644 index 0000000000..49fba85374 Binary files /dev/null and b/programs/games/megamaze/trunk/tilt.bin differ diff --git a/programs/games/megamaze/trunk/tilt.inc b/programs/games/megamaze/trunk/tilt.inc new file mode 100644 index 0000000000..e9082c5750 --- /dev/null +++ b/programs/games/megamaze/trunk/tilt.inc @@ -0,0 +1,93 @@ +TILT_levelp: + call SMZ_levelp + mov esi,[stepptr] + movzx ecx,byte[esi] + mov [finish],ecx + inc ecx + mov edi,area + rep movsb + mov [pause_time],10 + ret + +TILT_key: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov esi,area + inc esi + lea ebx,[eax-176] + mov eax,[player] + .lp: + call check_move + jc .ex1 + add eax,[dirs+ebx*4] + movzx ecx,byte[esi-1] + mov edi,esi + repne scasb + jne .notfound + mov byte[edi-1],0xff + dec dword[finish] + .notfound: + mov [player],eax + call delay + call drwfld + jmp .lp + .ex1: + cmp dword[finish],0 + jnz .ex + mov [win_flag],1 + .ex: + ret + +TILT_drawm: + mov eax,[player] + call get_xy + mcall 13,[lx],[ly],0xff00 + cmp [win_flag],1 + je .ex + mov edi,area + movzx ecx,byte[edi] + jecxz .ex + inc edi + .lp: + push ecx + movzx eax,byte[edi] + cmp eax,0xff + je .no + call get_xy + mcall 13,[lx],[ly],0xff0000 + .no: + pop ecx + inc edi + loop .lp + .ex: + ret + +TILT_level: +file 'tilt.bin' + +if lang eq ru + TILT_help mstr \ + 'Плашка (зеленый квадрат) лежит на доске, которую',\ + 'можно наклонять по горизонтали и вертикали',\ + ' После наклона плашка скользит, пока не наткнется',\ + 'на стенку. Нельзя остановить плашку во середине',\ + 'пути.',\ + ' Ваша задача - заставить плашку посетить клетки',\ + 'с красными квадратами.','',\ + 'http://www.clickmazes.com' +else + TILT_help mstr \ + 'You are to imagine that a marble (shown here as a',\ + 'green square) is on a board that you can tilt',\ + 'only to the north, south, east, or west. (You',\ + "can't do anything tricky like tilt it southeast.)",\ + ' Once you tilt the board, the marble will roll',\ + '(horizontally or vertically) until it hits a',\ + "barrier. There's no way you can stop the marble",\ + 'in the middle of its roll.',\ + ' The object is to roll the marble onto or over',\ + 'every red square in the maze.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/tilt2.bin b/programs/games/megamaze/trunk/tilt2.bin new file mode 100644 index 0000000000..2ff32b2007 Binary files /dev/null and b/programs/games/megamaze/trunk/tilt2.bin differ diff --git a/programs/games/megamaze/trunk/tilt2.inc b/programs/games/megamaze/trunk/tilt2.inc new file mode 100644 index 0000000000..29d3c23281 --- /dev/null +++ b/programs/games/megamaze/trunk/tilt2.inc @@ -0,0 +1,105 @@ +; level format +; [fx|fy][blue xy][red xy][blue point xy][red point xy]..[maze walls] + +; internal format +; points db=[stepptr] +; [player]= blue +; [finish]= red +; area: ..[1-red,0-black xy].. ( -1 if empty) + +TILT2_levelp: + call get_xy_sf + mov [stepptr],esi + add esi,2 + call unpack_level + mov [pause_time],10 + ret + +TILT2_key: + cmp eax,176 + jb .ex + cmp eax,179 + ja .ex + mov esi,area + inc esi + lea ebx,[eax-176] + .lp: + xor edx,edx + mov eax,[player] + call check_move + jc .nom1 + inc edx + add eax,[dirs+ebx*4] + mov [player],eax + .nom1: + mov eax,[finish] + call check_move + jc .nom2 + inc edx + add eax,[dirs+ebx*4] + mov [finish],eax + .nom2: + test edx,edx + jz .ex1 + call delay + call drwfld + jmp .lp + .ex1: + mov eax,[finish] + cmp eax,[player] + jnz .ex2 + mov [win_flag],2 + jmp TILT2_drawm.skip + .ex2: + mov esi,[stepptr] + cmp al,[esi+1] + jne .ex + mov eax,[player] + cmp al,[esi] + jne .ex + mov [win_flag],1 + .ex: + ret + +TILT2_drawm: + cmp [win_flag],2 + je .skip +; mov [sq_size],3 + mov eax,[player] + call get_xy + mcall 13,[lx],[ly],0xff + mov eax,[finish] + call get_xy + mcall 13,[lx],[ly],0xff0000 + .skip: + shl [sq_size],1 + mov esi,[stepptr] + lodsb + call get_xy + mcall 13,[lx],[ly],0xff + lodsb + call get_xy + shr [sq_size],1 + mcall 13,[lx],[ly],0xff0000 + ret + +TILT2_level: +file 'tilt2.bin' + +if lang eq ru + TILT2_help mstr \ + 'Красный и синий блоки должны достичь клеток',\ + 'соответствующего цвета. Внимание! Блоки сделаны',\ + 'из агрессивного материала, и при столкновении',\ + 'мгновенно испаряются. В этом случае Вам придется',\ + 'начать уровень сначала.','',\ + 'http://www.clickmazes.com' +else + TILT2_help mstr \ + 'The red block must reach the red target and the',\ + 'blue block the blue target. Beware! The two',\ + 'blocks are made of highly reactive material and,',\ + 'if they collide, will instantly evaporate. At',\ + 'this point you must start all over again.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/megamaze/trunk/wriggle.bin b/programs/games/megamaze/trunk/wriggle.bin new file mode 100644 index 0000000000..99b17fb31c Binary files /dev/null and b/programs/games/megamaze/trunk/wriggle.bin differ diff --git a/programs/games/megamaze/trunk/wriggle.inc b/programs/games/megamaze/trunk/wriggle.inc new file mode 100644 index 0000000000..0fe7c355ed --- /dev/null +++ b/programs/games/megamaze/trunk/wriggle.inc @@ -0,0 +1,251 @@ +; level format +; [fx|fy]..[field cells x2]..[worm_count]..[worm_len][start cell #][body dirs x2] + +; internal format +; [stepptr]= worms # +; area: [worm_len][start_cell #][end_cell #]..[dirs].. +; [cur_step]: dragged worm pointer +; [finish]: 0 - if head dragged, 1- if tail +WG_levelp: + mcall 40,100111b + inc [drag_flag] + call get_xy_sf + sub esi,2 + call LP_levelp.bit2 + cmp edx,4 + jne .ok + dec esi + .ok: + movzx ecx,byte[esi] + mov [stepptr],ecx + inc esi + xor eax,eax + mov edi,area + .lp1: + push ecx + movzx ecx,byte[esi] + inc esi + mov [edi],cl + inc edi + lodsb + dec ecx + movzx ebx,al + stosb + push edi + inc edi + mov edx,8/2 + lodsb + .lp: + rol al,2 + push ecx + mov cl,al + and ecx,11b + add ebx,[dirs+ecx*4] + mov [edi],cl + pop ecx + inc edi + dec edx + test edx,edx + jnz .nxt + mov edx,8/2 + lodsb + .nxt: + loop .lp + cmp edx,4 + jne .ok2 + dec esi + .ok2: + pop ecx + mov [ecx],bl + pop ecx + loop .lp1 + mov esi,[stepptr] + ret + +WG_key: + cmp eax,0 + jl WG_mouse + ret + +WG_drawm: + mov [win_flag],1 + mov ecx,[cell_count] +; mov [sq_size],3 + .lp: + push ecx + movzx ebx,byte[field+ecx-1] + and byte[field+ecx-1],11000000b + shr ebx,6 + test ebx,ebx + jz .no + dec ebx + lea eax,[ecx-1] + call get_xy + add [lx],5-2 shl 16 + add [ly],5-2 shl 16 + mov edx,[f_colors+ebx*4] + mcall 13,[lx],[ly] + .no: + pop ecx + loop .lp + + add [sq_size],3 + + mov ecx,[stepptr] + xor eax,eax + mov esi,area + push ebp + mov edi,w_colors + mov dword[player],1 + .lp2: + push ecx + movzx ecx,byte[esi] + inc esi + xor eax,eax + lodsb + mov ebp,esi + .lp1: + inc esi + push ecx eax + call get_xy + mcall 13,[lx],[ly],[edi] + pop eax + mov ecx,[player] + mov bl,[field+eax] + shr bl,6 + add [field+eax],cl + cmp bl,cl + je .match + and [win_flag],0 + .match: + pop ecx + push esi edi + movzx ebx,byte[esi] + mov esi,eax + mov [ebp],al + add eax,[dirs+ebx*4] + + cmp ecx,1 + je .skip + mov edi,eax + call getline + call bold_line + .skip: + pop edi esi + loop .lp1 + pop ecx + add edi,4 + inc dword[player] + loop .lp2 + pop ebp + sub [sq_size],3 + + ret + +WG_mouse: + cmp [win_flag],1 + je .ex + mov [jump],still + mov edx,eax + call get_last_mclick + cmp edx,-2 + jne .no1st + test eax,eax + jz .ex + .noempty: + +; First Click at ebx cell +; dpd ebx + mov [cur_step],0 + mov dword[finish],0 + mov esi,area + mov ecx,[stepptr] + .fndlp: + movzx edx,byte[esi] + cmp bl,[esi+1] + je .fnd + cmp bl,[esi+2] + jne .nxt + inc dword[finish] + .fnd: + mov [cur_step],esi + mov [jump],drw;red + jmp .ex + .nxt: + lea esi,[esi+edx+2] + loop .fndlp + jmp .ex + + .no1st: + test eax,eax + jz .ex +; While dragging + mov esi,[cur_step] + test esi,esi + jz .ex + lea edi,[esi+1] + add edi,[finish] + movzx eax,byte[edi] + cmp eax,ebx + je .ex + push ebx + cmp dword[finish],0 + jne .noswap + xchg eax,ebx + .noswap: + call get_offset + cmp ebx,1 + pop ebx + jne .ex + cmp eax,-1 + je .ex + test byte[field+ebx],11b + jnz .ex + movzx ecx,byte[esi] + cmp dword[finish],0 + jne .tail + mov [esi+1],bl + mov [esi+2],al + add esi,ecx + std + lea edi,[esi+1] + rep movsb + jmp .redex + + .tail: + mov [esi+2],bl + movzx ebx,byte[esi+3] + movzx edx,byte[esi+1] + add edx,[dirs+ebx*4] + mov [esi+1],dl + add esi,3 + lea edi,[esi-1] + rep movsb + mov [edi-1],al +; ud2 + .redex: + cld + mov [jump],drw;red + mov esi,area + .ex: + ret + +WG_level: +file 'wriggle.bin' + +if lang eq ru + WG_help mstr \ + 'Ваша задача - тянуть червяков за голову или',\ + 'хвост, пока каждый из них не покроет клетки',\ + 'своего цвета, оставив незакрытыми белые квадраты.',\ + 'Червяки не могут перекрывать и пересекать друг',\ + 'друга.','',\ + 'http://www.clickmazes.com' +else + WG_help mstr \ + 'Your aim is to drag the wriggley worms by head or',\ + 'tail until each worm covers the squares of its',\ + 'own colour leaving only white squares exposed.',\ + 'Worms cannot cross or overlap.','',\ + 'http://www.clickmazes.com' +end if diff --git a/programs/games/pig/trunk/AUTHORS b/programs/games/pig/trunk/AUTHORS new file mode 100644 index 0000000000..27c34eea40 --- /dev/null +++ b/programs/games/pig/trunk/AUTHORS @@ -0,0 +1 @@ +David Olofson diff --git a/programs/games/pig/trunk/COPYING b/programs/games/pig/trunk/COPYING new file mode 100644 index 0000000000..dc63aaca03 --- /dev/null +++ b/programs/games/pig/trunk/COPYING @@ -0,0 +1,340 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/programs/games/pig/trunk/ChangeLog b/programs/games/pig/trunk/ChangeLog new file mode 100644 index 0000000000..11eacb641b --- /dev/null +++ b/programs/games/pig/trunk/ChangeLog @@ -0,0 +1,2 @@ + +20040124: First release. diff --git a/programs/games/pig/trunk/INSTALL b/programs/games/pig/trunk/INSTALL new file mode 100644 index 0000000000..b42a17ac46 --- /dev/null +++ b/programs/games/pig/trunk/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/programs/games/pig/trunk/INSTRUCTIONS b/programs/games/pig/trunk/INSTRUCTIONS new file mode 100644 index 0000000000..04c5a87cb1 --- /dev/null +++ b/programs/games/pig/trunk/INSTRUCTIONS @@ -0,0 +1,54 @@ + + Fixed Rate Pig + -------------- + Instructions + +The Story +--------- +Aw, come on! Like anyone actually cares... :-) Oh +well, here it is, anyway: + You're a cute, bouncy rubber pig, caught in some +weird toy world in a parallel universe. As always, +the only way out is through. Or at least, that's +your best bet, as you can't seem to figure out any +other way - and you probably don't want to be a toy +rubber pig for the rest of your life. (How long do +toy rubber pigs live, anyway?) + So, off you go, to run, jump and stomp your way +through this strange looking toy world. Hopefully, +you will find a portal back to your universe or +something eventually. + Or maybe you'll just wake up, have a big cup of +black coffee, and realize that the layer of toys +covering the floor reminds a great deal of +something you dreamt. + Better not waste your limited supply of lives +until you know for sure, tough. What if it *isn't* +a dream...? + + +The Game +-------- +Well, Fixed Rate Pig is just another retro style +platform game, inspired by the 8 bit generation. +Controls are very simple: Left and right arrows to +move left/right, and the up arrow to jump. + The enemies are the evil looking spinning heads. +Some bounce around, just to be a bit more annoying. +Jump and stomp'em all in the head! When all enemies +are gone, the level is clear. + Jumping when stomping an enemy gives you an +extra high jump from the point of impact. Note that +you get knocked if you're hit by an enemy while +standing or walking on a platform - even if the +enemy hits you from below. You need to be falling +downwards with some speed to stomp someone. + Watch out for the holes in the floor! Falling +off the map means you lose one life. Avoid running +into enemies or getting stomped, as that knocks you +out and has you falling past platforms for a brief +moment. That's actually no big deal - provided you +wake up before you fall off the screen... + At certain score intervals, powerups icons are +dropped into the level. Pick these up before they +fall off the screen! (No need to stomp them.) diff --git a/programs/games/pig/trunk/Makefile.am b/programs/games/pig/trunk/Makefile.am new file mode 100644 index 0000000000..73d66e3b07 --- /dev/null +++ b/programs/games/pig/trunk/Makefile.am @@ -0,0 +1,6 @@ +AUTOMAKE_OPTIONS = foreign + +bin_PROGRAMS = pig +pig_SOURCES = pig.c engine.c dirty.c + +EXTRA_DIST = *.h *.txt *.png INSTRUCTIONS pig-linux-x86 pig-win32.exe diff --git a/programs/games/pig/trunk/Makefile.in b/programs/games/pig/trunk/Makefile.in new file mode 100644 index 0000000000..fd997e9a75 --- /dev/null +++ b/programs/games/pig/trunk/Makefile.in @@ -0,0 +1,494 @@ +# Makefile.in generated by automake 1.7.1 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_triplet = @host@ +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__quote = @am__quote@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +AUTOMAKE_OPTIONS = foreign + +bin_PROGRAMS = pig +pig_SOURCES = pig.c engine.c dirty.c + +EXTRA_DIST = *.h *.txt *.png INSTRUCTIONS pig-linux-x86 pig-win32.exe +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +bin_PROGRAMS = pig$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) + +am_pig_OBJECTS = pig.$(OBJEXT) engine.$(OBJEXT) dirty.$(OBJEXT) +pig_OBJECTS = $(am_pig_OBJECTS) +pig_LDADD = $(LDADD) +pig_DEPENDENCIES = +pig_LDFLAGS = + +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dirty.Po ./$(DEPDIR)/engine.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/pig.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DIST_SOURCES = $(pig_SOURCES) +DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ + Makefile.in NEWS aclocal.m4 config.guess config.sub configure \ + configure.in depcomp install-sh missing mkinstalldirs +SOURCES = $(pig_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj + +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) + +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +pig$(EXEEXT): $(pig_OBJECTS) $(pig_DEPENDENCIES) + @rm -f pig$(EXEEXT) + $(LINK) $(pig_LDFLAGS) $(pig_OBJECTS) $(pig_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirty.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/engine.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pig.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ +@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ +@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \ +@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ +@am__fastdepCC_TRUE@ fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'` +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = . +distdir = $(PACKAGE)-$(VERSION) + +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } + +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -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 {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + $(am__remove_distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ + && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +distuninstallcheck: + cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf autom4te.cache +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags dist dist-all dist-gzip distcheck distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/programs/games/pig/trunk/NEWS b/programs/games/pig/trunk/NEWS new file mode 100644 index 0000000000..e69de29bb2 diff --git a/programs/games/pig/trunk/README b/programs/games/pig/trunk/README new file mode 100644 index 0000000000..243806b69a --- /dev/null +++ b/programs/games/pig/trunk/README @@ -0,0 +1,269 @@ + + Fixed Rate Pig - a fixed logic frame rate demo + ---------------------------------------------- + + This SDL programming example - a simple + platform game - demonstrates the use of + a fixed virtual logic frame rate + together with interpolation, for smooth + and accurate game logic that is + independent of the rendering frame rate. + + The example also demonstrates sprite + animation and partial display updating + techniques, suitable for games and + applications that need high frame rates + but can do without updating the whole + screen every frame. + + +Fixed Logic Frame Rate +---------------------- +Having a fixed logic frame rate means that the game +logic (that is, what defines the gameplay in terms +of object behavior and user input handling) runs a +fixed number of times per unit of time. This makes +it possible to use "frame count" as a unit of time. + More interestingly, since the logic frame rate +can be set at any sufficient value (say, 20 Hz for +a slow turn based game, or 100 Hz for fast action) +the logic code will run exactly once per frame. +Thus, there is no need to take delta times in +account, solving equations, making calculations on +velocity, acceleration, jerk and stuff like that. +You can just deal with hardcoded "step" values and +simple tests. + Perhaps most importantly, you can *still* rely +on the game behaving *exactly* the same way, +regardless of the rendering frame rate or other +system dependent parameters - something that is +virtually impossible with delta times, since you +cannot have infinite accuracy in the calculations. + + +Virtual Logic Frame Rate +------------------------ +By "virtual", I mean that the actual frame rate is +not necessarily stable at the nominal value at all +times. Rather, the *average* logic frame rate is +kept at the nominal value by means of controlling +the number of logic frames processed for each +rendered frame. + That is, if the rendering frame rate is lower +than the nominal logic frame rate, the engine will +run the game logic several times before rendering +each frame. Thus, the game logic may actually be +running at tens of kHz for a few frames at a time, +but this doesn't matter, as long as the game logic +code relies entirely on logic time. + So, do not try to read time using SDL_GetTicks() +or similar in the game logic code! Instead, just +count logic frames, like we did back in the C64 and +Amiga days, where video frames were actually a +reliable time unit. It really works! + + +Resampling Distortion +--------------------- +Now, there is one problem with fixed logic frame +rates: Resampling distortion. (The same phenomena +that cause poor audio engines to squeal and feep +when playing back waveforms at certain pitches.) + The object coordinates generated by the game +logic engine can be thought of as streams of values +describing signals (in electrical engineering/DSP +terms) with a fixed sample rate. Each coordinate +value is one stream. + Since the logic frame rate is fixed, and the +game logic runs an integer number of times per +rendered frame, what we get is a "nearest point" +resampling from the logic frame rate to the +rendering frame rate. That's not very nice, since +only the last set of coordinates after each run of +logic frames is actually used - the rest are thrown +away! + What's maybe even worse, especially if the logic +frame rate is low, is that you get new coordinates +only every now and then, when the rendering frame +rate is higher than the logic frame rate. + + +Getting Smooth Animation +------------------------ +So, what do we do? Well, given my hint above, the +answer is probably obvious: interpolation! We just +need to replace the basic "nearest sample" method +with something better. + Resampling is a science and an art in the audio +field, and countless papers have been written on +the subject, most of which are probably totally +incomprehensible for anyone who hasn't got a degree +in maths. + However, our requirements for the resampling can +be kept reasonably low by keeping the logic frame +rate reatively high (ie in the same order of +magnitude as the expected rendering frame rate) - +and we generally want to do that anyway, to reduce +the game's control latency. + + +Chosing An Interpolator +----------------------- +Since the rendering frame rate can vary constantly +in unpredictable ways, we will have to recalculate +the input/output ratio of the resampling filter for +every rendered frame. + However, using a polynomial interpolator (as +opposed to a FIR resampling filter), we can get +away without actually doing anything special. We +just feed the interpolator the coordinates and the +desired fractional frame time, and get the +coordinates calculated. + DSP people will complain that a polynomial +resampler (that is, without a brickwall filter, or +oversampling + bandlimited downsampling) doesn't +really solve the whole problem. Right, it doesn't +remove frequencies above Nyqvist of the rendering +frame rate, so those can cause aliasing distortion. +But let's consider this: + Do we actually *have* significant amounts of +energy at such frequencies in the data from the +game logic? Most probably not! You would have to +have objects bounce around or oscillate at insane +speed to get anywhere near Nyqvist of (that is, 50% +of) any reasonable (ie playable) rendering frame +rate. In fact, we can probably assume that we're +dealing with signals in the range 0..10 Hz. Not +even the transients caused by abrupt changes in +speed and direction will cause visible side +effects. + So, in this programming example, I'm just using +a simple linear interpolator. No filters, no +oversampling or anything like that. As simple as it +gets, but still an incredible improvement over +"nearest sample" resampling. You can enable/disable +interpolation with the F1 key when running the +example. + + +Rendering Sprites +----------------- +In order to cover another animation related FAQ, +this example includes "smart" partial updates of +the screen. Only areas that are affected by moving +and/or animated sprites are updated. + To keep things simple and not annoyingly non- +deterministic, updates are done by removing all +sprites, updating their positions and animation +frames, and then rendering all sprites. This is +done every frame, and includes all sprites, whether +they move or not. + So, why not update only the sprites that +actually moved? That would allow for cheap but +powerful animated "backgrounds" and the like. + Well, the problem is that sprites can overlap, +and when they do, they start dragging each other +into the update loop, leading to recursion and +potentially circular dependencies. A non-recursive +two-pass (mark + render) algorithm is probably a +better idea than actual recursion. It's quite +doable and neat, if the updates are restricted by +clipping - but I'll leave that for another example. +Pretty much all sprites in Fixed Rate Pig move all +the time, so there's nothing to gain by using a +smarter algorithm. + + +Efficient Software Rendering +---------------------------- +To make it a bit more interesting, I also added +alpha blending for sprite anti-aliasing and effects. +Most 2D graphics APIs and drivers (and as a result, +most SDL backends) lack h/w acceleration of alpha +blended blits, which means the CPU has to perform +the blending. That's relatively expensive, but +SDL's software blitters are pretty fast, and it +turns out *that's* usually not a problem. + However, there is one problem: Alpha blending +requires that data is read from the target surface, +modified, and then written back. Unfortunately, +modern video cards handle CPU reads from VRAM very +poorly. The bandwidth for CPU reads - even on the +latest monster AGP 8x card - is on par with that of +an old hard drive. (I'm not kidding!) + This is why I wanted to demonstrate how to avoid +this problem, by rendering into a s/w back buffer +instead of the h/w display surface. If you're on a +system that supports hardware display surfaces, you +can see the difference by hitting F2 in the game, +to enable/disable rendering directly into VRAM. + Indeed, SDL can set that up for you, but *only* +if you ask for a single buffered display - and we +do NOT want that! Single buffered displays cannot +sync animation with the retrace, and as a result, +we end up hogging the CPU (since we never block, +but just pump out new frames) and still getting +unsmooth animation. + Accidentally, this approach of using a s/w back +buffer for rendering mixes very well with partial +update strategies, so it fits right in. + + +Smart Dirty Rectangle Management +-------------------------------- +The most complicated part of this implementation +is keeping track of the exact areas of the screen +that need updating. Just maintaining one rectangle +per sprite would not be sufficient. A moving sprite +has to be removed, animated and then re-rendered. +That's two rectangles that need to be pushed to the +screen; one to remove the old sprite image, and one +for the new position. + On a double buffered display, it gets even worse, +as the rendering is done into two alternating +buffers. When we update a buffer, the old sprites +in it are actually *two* frames old - not one. + I've chosen to implement a "smart" rectangle +merging algorithm that can deal with all of this +with a minimum of support from higher levels. The +algorithm merges rectangles in order to minimize +overdraw and rectangle count when blitting to and +updating the screen. See the file dirtyrects.txt for +details. You can (sort of) see what's going on by +hitting F3 in the game. Here's what's going on: + + 1. All sprites are removed from the rendering + buffer. The required information is found + in the variables that store the results of + the interpolation. + 2. The dirtyrect table for the display surface + is swapped into a work dirtyrect table. The + display surface dirtyrect table is cleared. + 3. New graphic coordinates are calculated, and + all sprites are rendered into the rendering + buffer. The bounding rectangles are fed + into the display surface dirtyrect table. + 4. The dirtyrect table compiled in step 3 is + merged into the work dirtyrect table. The + result covers all areas that need to be + updated to remove old sprites and make the + new ones visible. + 5. The dirtyrect table compiled in step 4 is + used to blit from the rendering buffer to + the display surface. + + On a double buffered display, there is one +dirtyrect table for each display page, and there +is (obviously) a page flip operation after step 5, +but other than that, the algorithm is the same. + + +Command Line Options +-------------------- + + -f Fullscreen + -s Single buffer + Depth = bits + + + //David Olofson diff --git a/programs/games/pig/trunk/aclocal.m4 b/programs/games/pig/trunk/aclocal.m4 new file mode 100644 index 0000000000..065f6b5317 --- /dev/null +++ b/programs/games/pig/trunk/aclocal.m4 @@ -0,0 +1,961 @@ +# generated automatically by aclocal 1.7.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Do all the work for Automake. -*- Autoconf -*- + +# This macro actually does too much some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +AC_PREREQ([2.54]) + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl + AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl + +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[_am_stamp_count=`expr ${_am_stamp_count-0} + 1` +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright 2002 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., 59 Temple Place - Suite 330, Boston, MA + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.7.1])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright 2001, 2002 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# +# Check to make sure that the build environment is sane. +# + +# Copyright 1996, 1997, 2000, 2001 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # 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". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# -*- Autoconf -*- + + +# Copyright 1997, 1999, 2000, 2001 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_AUX_DIR_EXPAND + +# Copyright 2001 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +# Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50]) + +AC_DEFUN([AM_AUX_DIR_EXPAND], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright 2001 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright 2001 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# serial 4 -*- Autoconf -*- + +# Copyright 1999, 2000, 2001 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c -o conftest.o conftest.c >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null +AC_SUBST([DEPDIR]) +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright 1999, 2000, 2001, 2002 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +#serial 2 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST(am__include) +AC_SUBST(am__quote) +AC_MSG_RESULT($_am_result) +rm -f confinc confmf +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright 1997, 2000, 2001 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 5 + +AC_PREREQ(2.52) + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]) +fi])]) + +# Configure paths for SDL +# Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS +dnl +AC_DEFUN(AM_PATH_SDL, +[dnl +dnl Get the cflags and libraries from the sdl-config script +dnl +AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], + sdl_prefix="$withval", sdl_prefix="") +AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], + sdl_exec_prefix="$withval", sdl_exec_prefix="") +AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], + , enable_sdltest=yes) + + if test x$sdl_exec_prefix != x ; then + sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_args="$sdl_args --prefix=$sdl_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_prefix/bin/sdl-config + fi + fi + + AC_REQUIRE([AC_CANONICAL_TARGET]) + PATH="$prefix/bin:$prefix/usr/bin:$PATH" + AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) + min_sdl_version=ifelse([$1], ,0.11.0,$1) + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + no_sdl="" + if test "$SDL_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` + SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` + + sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SDL is sufficiently new. (Also sanity +dnl checks the results of sdl-config to some extent +dnl + rm -f conf.sdltest + AC_TRY_RUN([ +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdltest"); + */ + { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdl_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); + printf("*** to point to the correct copy of sdl-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SDL_CONFIG" = "no" ; then + echo "*** The sdl-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL_CONFIG environment variable to the" + echo "*** full path to sdl-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + AC_TRY_LINK([ +#include +#include "SDL.h" + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SDL_CFLAGS) + AC_SUBST(SDL_LIBS) + rm -f conf.sdltest +]) + diff --git a/programs/games/pig/trunk/config.guess b/programs/games/pig/trunk/config.guess new file mode 100644 index 0000000000..f1657bbc46 --- /dev/null +++ b/programs/games/pig/trunk/config.guess @@ -0,0 +1,1363 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-09-03' + +# This file 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. +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# This shell variable is my proudest work .. or something. --bje + +set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; +(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) + || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; +dummy=$tmpdir/dummy ; +files="$dummy.c $dummy.o $dummy.rel $dummy" ; +trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $files ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; +unset files' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + eval $set_cc_for_build + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + 3-1307) + UNAME_MACHINE="alphaev7" + ;; + esac + fi + rm -f $dummy.s $dummy && rmdir $tmpdir + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy && rmdir $tmpdir + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i386-pc-interix3 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c && rmdir $tmpdir + test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +rm -f $dummy.c $dummy && rmdir $tmpdir + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +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` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/programs/games/pig/trunk/config.sub b/programs/games/pig/trunk/config.sub new file mode 100644 index 0000000000..1dea9b79d5 --- /dev/null +++ b/programs/games/pig/trunk/config.sub @@ -0,0 +1,1470 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-09-05' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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. +# +# 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, 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. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39 | mipstx39el \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic4x | c4x*) + basic_machine=tic4x-unknown + os=-coff + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/programs/games/pig/trunk/configure b/programs/games/pig/trunk/configure new file mode 100644 index 0000000000..60c4be2c95 --- /dev/null +++ b/programs/games/pig/trunk/configure @@ -0,0 +1,4713 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59. +# +# Copyright (C) 2003 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. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + 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=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # 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 before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, 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 + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { 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 sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="pig.c" +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP SDL_CONFIG SDL_CFLAGS SDL_LIBS LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + 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 && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + 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 +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --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 + --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 + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors + --disable-sdltest Do not try to compile and run a test SDL program + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-sdl-prefix=PFX Prefix where SDL is installed (optional) + --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 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 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +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` +hostinfo = `(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=. + echo "PATH: $as_dir" +done + +} >&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. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + 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; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >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 + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + 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 + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +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 + + + + + + + + + + + + + + + + + + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +am__api_version="1.7" +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_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. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # 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". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +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; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + # test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=pig + VERSION=1.0 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + + + +ac_ext=c +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 +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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_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" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + 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 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out 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. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + 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 + { { 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 +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 +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; 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 +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +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 +rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null + + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c -o conftest.o conftest.c >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +ac_ext=c +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 +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&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 + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent 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 +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + 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 + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # 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 +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent 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 +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + 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 + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +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 + + + +echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#ifdef signal +# undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_signal=void +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_signal=int +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + + +SDL_VERSION=1.2.0 + +# Check whether --with-sdl-prefix or --without-sdl-prefix was given. +if test "${with_sdl_prefix+set}" = set; then + withval="$with_sdl_prefix" + sdl_prefix="$withval" +else + sdl_prefix="" +fi; + +# Check whether --with-sdl-exec-prefix or --without-sdl-exec-prefix was given. +if test "${with_sdl_exec_prefix+set}" = set; then + withval="$with_sdl_exec_prefix" + sdl_exec_prefix="$withval" +else + sdl_exec_prefix="" +fi; +# Check whether --enable-sdltest or --disable-sdltest was given. +if test "${enable_sdltest+set}" = set; then + enableval="$enable_sdltest" + +else + enable_sdltest=yes +fi; + + if test x$sdl_exec_prefix != x ; then + sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_args="$sdl_args --prefix=$sdl_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_prefix/bin/sdl-config + fi + fi + + + PATH="$prefix/bin:$prefix/usr/bin:$PATH" + # Extract the first word of "sdl-config", so it can be a program name with args. +set dummy sdl-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_SDL_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $SDL_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no" + ;; +esac +fi +SDL_CONFIG=$ac_cv_path_SDL_CONFIG + +if test -n "$SDL_CONFIG"; then + echo "$as_me:$LINENO: result: $SDL_CONFIG" >&5 +echo "${ECHO_T}$SDL_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + min_sdl_version=$SDL_VERSION + echo "$as_me:$LINENO: checking for SDL - version >= $min_sdl_version" >&5 +echo $ECHO_N "checking for SDL - version >= $min_sdl_version... $ECHO_C" >&6 + no_sdl="" + if test "$SDL_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` + SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` + + sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + rm -f conf.sdltest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdltest"); + */ + { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdl_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); + printf("*** to point to the correct copy of sdl-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +no_sdl=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + : + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test "$SDL_CONFIG" = "no" ; then + echo "*** The sdl-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL_CONFIG environment variable to the" + echo "*** full path to sdl-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include "SDL.h" + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main + +int +main () +{ + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl-config script: $SDL_CONFIG" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + { { echo "$as_me:$LINENO: error: *** SDL version $SDL_VERSION required!" >&5 +echo "$as_me: error: *** SDL version $SDL_VERSION required!" >&2;} + { (exit 1); exit 1; }; } + + fi + + + rm -f conf.sdltest + +CFLAGS="$CFLAGS $SDL_CFLAGS" +LIBS="$LIBS $SDL_LIBS" + + +echo "$as_me:$LINENO: checking for IMG_Load in -lSDL_image" >&5 +echo $ECHO_N "checking for IMG_Load in -lSDL_image... $ECHO_C" >&6 +if test "${ac_cv_lib_SDL_image_IMG_Load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lSDL_image -lSDL + $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char IMG_Load (); +int +main () +{ +IMG_Load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_SDL_image_IMG_Load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_SDL_image_IMG_Load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_image_IMG_Load" >&5 +echo "${ECHO_T}$ac_cv_lib_SDL_image_IMG_Load" >&6 +if test $ac_cv_lib_SDL_image_IMG_Load = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSDL_IMAGE 1 +_ACEOF + + LIBS="-lSDL_image $LIBS" + +else + { { echo "$as_me:$LINENO: error: You need the SDL_image library to compile this software. + Get it at http://www.libsdl.org/projects/SDL_image/" >&5 +echo "$as_me: error: You need the SDL_image library to compile this software. + Get it at http://www.libsdl.org/projects/SDL_image/" >&2;} + { (exit 1); exit 1; }; } +fi + +LIBS="$LIBS -lSDL_image" + +CFLAGS="$CFLAGS $SDL_CFLAGS" +LIBS="$LIBS $SDL_LIBS" + + ac_config_files="$ac_config_files Makefile" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `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" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\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" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ 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/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + 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=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # 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 before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, 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 + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +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 sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +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=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@AMTAR@,$AMTAR,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@CPP@,$CPP,;t t +s,@SDL_CONFIG@,$SDL_CONFIG,;t t +s,@SDL_CFLAGS@,$SDL_CFLAGS,;t t +s,@SDL_LIBS@,$SDL_LIBS,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + 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; } +fi + diff --git a/programs/games/pig/trunk/configure.in b/programs/games/pig/trunk/configure.in new file mode 100644 index 0000000000..b7e280199b --- /dev/null +++ b/programs/games/pig/trunk/configure.in @@ -0,0 +1,43 @@ +dnl Process this file with autoconf to produce a configure script. + +dnl Simple Automake init +AC_INIT(pig.c) + +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + +AM_INIT_AUTOMAKE(pig, 1.0) + +dnl Check for various tools +AC_PROG_CC +AC_PROG_CPP + +dnl Check some compiler/platform stuff +AC_TYPE_SIGNAL + +dnl------------------------------------------------------- +dnl Checks for SDL +dnl------------------------------------------------------- +SDL_VERSION=1.2.0 +AM_PATH_SDL($SDL_VERSION,:, + AC_MSG_ERROR([*** SDL version $SDL_VERSION required!]) +) +CFLAGS="$CFLAGS $SDL_CFLAGS" +LIBS="$LIBS $SDL_LIBS" + +dnl------------------------------------------------------- +dnl Checks for SDL_image +dnl------------------------------------------------------- +AC_CHECK_LIB(SDL_image, IMG_Load,, + AC_MSG_ERROR([You need the SDL_image library to compile this software. + Get it at http://www.libsdl.org/projects/SDL_image/]), + -lSDL +) +LIBS="$LIBS -lSDL_image" + +dnl Get compile and linking flags +CFLAGS="$CFLAGS $SDL_CFLAGS" +LIBS="$LIBS $SDL_LIBS" + +dnl Generate Makefile +AC_OUTPUT(Makefile) diff --git a/programs/games/pig/trunk/depcomp b/programs/games/pig/trunk/depcomp new file mode 100644 index 0000000000..65899658ee --- /dev/null +++ b/programs/games/pig/trunk/depcomp @@ -0,0 +1,411 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, 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 . + +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 +# `libtool' can also be set to `yes' or `no'. + +depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} +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. 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. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # 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" + ;; + +tru64) + # The Tru64 AIX 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. + + tmpdepfile1="$object.d" + tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` + if test "$libtool" = yes; then + "$@" -Wc,-MD + else + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab 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 proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + test -z "$dashmflag" && dashmflag=-M + ( IFS=" " + case " $* " in + *" --mode=compile "*) # this is libtool, let us make it quiet + for arg + do # cycle over the arguments + case "$arg" in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + 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) + # 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;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tail +3 "$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 proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + ( IFS=" " + case " $* " in + *" --mode=compile "*) + for arg + do # cycle over the arguments + case $arg in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + 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 proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + ( IFS=" " + case " $* " in + *" --mode=compile "*) + for arg + do # cycle over the arguments + case $arg in + "--mode=compile") + # insert --quiet before "--mode=compile" + set fnord "$@" --quiet + shift # fnord + ;; + esac + set fnord "$@" "$arg" + shift # fnord + shift # "$arg" + done + ;; + esac + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + ) & + proc=$! + "$@" + stat=$? + wait "$proc" + if test "$stat" != 0; then exit $stat; fi + 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 diff --git a/programs/games/pig/trunk/dirty.c b/programs/games/pig/trunk/dirty.c new file mode 100644 index 0000000000..5722c929dc --- /dev/null +++ b/programs/games/pig/trunk/dirty.c @@ -0,0 +1,176 @@ +/* +------------------------------------------------------------ + Fixed Rate Pig - a fixed logic frame rate demo +------------------------------------------------------------ + * Copyright (C) 2004 David Olofson + * + * This software is released under the terms of the GPL. + * + * Contact author for permission if you want to use this + * software, or work derived from it, under other terms. + */ + +#include +#include "engine.h" + +/* Approximate worth of one dirtyrect in pixels. */ +#define PIG_WORST_MERGE 300 + +/* + * If the merged result gets at most this many percent + * bigger than the larger of the two input rects, + * accept it as Perfect. + */ +#define PIG_INSTANT_MERGE 10 + + +PIG_dirtytable *pig_dirty_open(int size) +{ + PIG_dirtytable *pdt = (PIG_dirtytable *)malloc(sizeof(PIG_dirtytable)); + if(!pdt) + return NULL; + + pdt->size = size; + pdt->rects = (SDL_Rect *)calloc(size, sizeof(SDL_Rect)); + if(!pdt->rects) + { + free(pdt); + return NULL; + } + + pdt->count = 0; + pdt->best = 0; + return pdt; +} + + +void pig_dirty_close(PIG_dirtytable *pdt) +{ + free(pdt->rects); + free(pdt); +} + + +void pig_mergerect(SDL_Rect *from, SDL_Rect *to) +{ + int x1 = from->x; + int y1 = from->y; + int x2 = from->x + from->w; + int y2 = from->y + from->h; + if(to->x < x1) + x1 = to->x; + if(to->y < y1) + y1 = to->y; + if(to->x + to->w > x2) + x2 = to->x + to->w; + if(to->y + to->h > y2) + y2 = to->y + to->h; + to->x = x1; + to->y = y1; + to->w = x2 - x1; + to->h = y2 - y1; +} + + +void pig_intersectrect(SDL_Rect *from, SDL_Rect *to) +{ + int Amin, Amax, Bmin, Bmax; + Amin = to->x; + Amax = Amin + to->w; + Bmin = from->x; + Bmax = Bmin + from->w; + if(Bmin > Amin) + Amin = Bmin; + to->x = Amin; + if(Bmax < Amax) + Amax = Bmax; + to->w = Amax - Amin > 0 ? Amax - Amin : 0; + + Amin = to->y; + Amax = Amin + to->h; + Bmin = from->y; + Bmax = Bmin + from->h; + if(Bmin > Amin) + Amin = Bmin; + to->y = Amin; + if(Bmax < Amax) + Amax = Bmax; + to->h = Amax - Amin > 0 ? Amax - Amin : 0; +} + + +void pig_dirty_add(PIG_dirtytable *pdt, SDL_Rect *dr) +{ + int i, j, best_i, best_loss; + /* + * Look for merger candidates. + * + * We start right before the best match we + * had the last time around. This can give + * us large numbers of direct or quick hits + * when dealing with old/new rects for moving + * objects and the like. + */ + best_i = -1; + best_loss = 100000000; + if(pdt->count) + i = (pdt->best + pdt->count - 1) % pdt->count; + for(j = 0; j < pdt->count; ++j) + { + int a1, a2, am, ratio, loss; + SDL_Rect testr; + + a1 = dr->w * dr->h; + + testr = pdt->rects[i]; + a2 = testr.w * testr.h; + + pig_mergerect(dr, &testr); + am = testr.w * testr.h; + + /* Perfect or Instant Pick? */ + ratio = 100 * am / (a1 > a2 ? a1 : a2); + if(ratio < PIG_INSTANT_MERGE) + { + /* Ok, this is good enough! Stop searching. */ + pig_mergerect(dr, &pdt->rects[i]); + pdt->best = i; + return; + } + + loss = am - a1 - a2; + if(loss < best_loss) + { + best_i = i; + best_loss = loss; + pdt->best = i; + } + + ++i; + i %= pdt->count; + } + /* ...and if the best result is good enough, merge! */ + if((best_i >= 0) && (best_loss < PIG_WORST_MERGE)) + { + pig_mergerect(dr, &pdt->rects[best_i]); + return; + } + + /* Try to add to table... */ + if(pdt->count < pdt->size) + { + pdt->rects[pdt->count++] = *dr; + return; + } + + /* Emergency: Table full! Grab best candidate... */ + pig_mergerect(dr, &pdt->rects[best_i]); +} + + +void pig_dirty_merge(PIG_dirtytable *pdt, PIG_dirtytable *from) +{ + int i; + for(i = 0; i < from->count; ++i) + pig_dirty_add(pdt, from->rects + i); +} diff --git a/programs/games/pig/trunk/dirty.h b/programs/games/pig/trunk/dirty.h new file mode 100644 index 0000000000..56dc5e19d2 --- /dev/null +++ b/programs/games/pig/trunk/dirty.h @@ -0,0 +1,41 @@ +/* +------------------------------------------------------------ + Fixed Rate Pig - a fixed logic frame rate demo +------------------------------------------------------------ + * Copyright (C) 2004 David Olofson + * + * This software is released under the terms of the GPL. + * + * Contact author for permission if you want to use this + * software, or work derived from it, under other terms. + */ + +#ifndef PIG_DIRTY_H +#define PIG_DIRTY_H + +/* A table of dirtyrects for one display page */ +typedef struct PIG_dirtytable +{ + int size; /* Table size */ + SDL_Rect *rects; /* Table of rects */ + int count; /* # of rects currently used */ + int best; /* Merge testing starts here! */ +} PIG_dirtytable; + + +PIG_dirtytable *pig_dirty_open(int size); +void pig_dirty_close(PIG_dirtytable *pdt); + +/* Add rectangle 'dr' to table 'pdt' */ +void pig_dirty_add(PIG_dirtytable *pdt, SDL_Rect *dr); + +/* Merge table 'from' into 'pdt' */ +void pig_dirty_merge(PIG_dirtytable *pdt, PIG_dirtytable *from); + +/* Extend 'to' to a new rect that includes both 'from' and 'to' */ +void pig_mergerect(SDL_Rect *from, SDL_Rect *to); + +/* Clip 'to' into a rect that is the intersection of 'from' and 'to' */ +void pig_intersectrect(SDL_Rect *from, SDL_Rect *to); + +#endif /* PIG_DIRTY_H */ diff --git a/programs/games/pig/trunk/dirtyrects.txt b/programs/games/pig/trunk/dirtyrects.txt new file mode 100644 index 0000000000..2c45ce692e --- /dev/null +++ b/programs/games/pig/trunk/dirtyrects.txt @@ -0,0 +1,83 @@ + + Smart Dirty Rectangle Management + -------------------------------- + +pig_dirty() contains an algorithm that tries to find +the the best dirtyrect candidates for merging. While +searching, it looks out for perfect or sufficiently +good candidates. + +(Perfect candidate:) + The merged rectangle is of the same size + as the largest of the two input rectangles: + + Amerged <= MAX(A1, A2) + + We don't actually test for this, but rather for... + +Instant Pick candidate: + Not Perfect, but good enough to be treated + as such, considering the cost of going on + searching for a better candidate: + Amerged 100 / MAX(A1, A2) - 100 <= PIG_INSTANT_MERGE + + (That is, the area of the merged rect must be + no more than PIG_INSTANT_MERGE % bigger than + the area of the larger of the two input rects.) + + Note that this is also about how likely it is + that thereis* a better candidate. Assuming + that PIG_INSTANT_MERGE is set to a sensible + value, it is not very likely at all. There + would have to be another dirtyrect nearby, and + the chance of that being a better match is + rather low, since that would most likely have + caused it to be merged with the tested dirtyrect + long before our new rect came in. + +(Good candidate:) + The area of the merged rectangle is smaller + than the total area of the two input rectangles: + + (Amerged - A1 - A2) < 0 + + We don't actually test for this, but rather for... + +Acceptable candidate: + The area of the merged rectangle is larger + than the total of the two input rectangles, but + since there is some per-rectangle overhead, + merging is still a win: + + (Amerged - A1 - A2) <= PIG_WORST_MERGE + + The default setting assumes that the cost of a + rectangle is in the range of 300 pixels. One + should probably benchmark a few different systems + to see if that's reasonable. + +Unacceptable candidate: + The area of the merged rectangle is larger than + the total of the input rectangles to the degree + that merging is a definite loss: + + (Amerged - A1 - A2) > PIG_WORST_MERGE + +The algorithm instantly returns Perfect candidates as +solutions. If there are only Good and Acceptable +candidates, the best one (lowest number of wasted +pixels) is the solution. + +If there are only Unacceptable candidates, there is no +sensible merger solution, so pig_dirty() will try to add +a new dirtyrect. + +If that fails (table full), the best candidate is used, +even though it would have been Unacceptable under normal +circumstances. + + +TODO: Thereare* more alternatives than just "merge" or +TODO: "don't merge"! For example, it might pay off to +TODO: detect overlapping and clip dirtyrects to avoid +TODO: it, when merging is not a viable option. diff --git a/programs/games/pig/trunk/engine.c b/programs/games/pig/trunk/engine.c new file mode 100644 index 0000000000..054db63f9f --- /dev/null +++ b/programs/games/pig/trunk/engine.c @@ -0,0 +1,1156 @@ +/* +------------------------------------------------------------ + Fixed Rate Pig - a fixed logic frame rate demo +------------------------------------------------------------ + * Copyright (C) 2004 David Olofson + * + * This software is released under the terms of the GPL. + * + * Contact author for permission if you want to use this + * software, or work derived from it, under other terms. + */ + +#include +#include +#include "engine.h" +#include "SDL_image.h" + +/* Size of sprite frame table */ +#define PIG_MAX_SPRITES 1024 + + +/* + * Actually remove an objects. Used internally, + * to remove objects that have been marked for + * destruction. + */ +static void close_object(PIG_object *po); + + +/*---------------------------------------------------------- + Engine +----------------------------------------------------------*/ +PIG_engine *pig_open(SDL_Surface *screen) +{ + PIG_engine *pe = (PIG_engine *)calloc(1, sizeof(PIG_engine)); + if(!pe) + return NULL; + + pe->screen = screen; + if(!pe->screen) + { + pig_close(pe); + return NULL; + } + if((pe->screen->flags & SDL_HWSURFACE) == SDL_HWSURFACE) + { + pe->buffer = SDL_CreateRGBSurface(SDL_SWSURFACE, + screen->w, screen->h, + screen->format->BitsPerPixel, + screen->format->Rmask, + screen->format->Gmask, + screen->format->Bmask, + screen->format->Amask); + if(!pe->buffer) + { + pig_close(pe); + return NULL; + } + pe->surface = pe->buffer; + } + else + pe->surface = screen; + + pe->pages = 1 + ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF); + + pe->interpolation = 1; + pe->time = 0.0; + pe->view.w = pe->surface->w; + pe->view.h = pe->surface->h; + + pe->sprites = (PIG_sprite **)calloc(PIG_MAX_SPRITES, + sizeof(PIG_sprite *)); + if(!pe->sprites) + { + pig_close(pe); + return NULL; + } + + pe->pagedirty[0] = pig_dirty_open(128); + pe->workdirty = pig_dirty_open(256); + if(!pe->pagedirty[0] || !pe->workdirty) + { + pig_close(pe); + return NULL; + } + if(pe->pages > 1) + { + pe->pagedirty[1] = pig_dirty_open(128); + if(!pe->pagedirty[1]) + { + pig_close(pe); + return NULL; + } + } + + return pe; +} + + +void pig_close(PIG_engine *pe) +{ + if(pe->sprites) + { + int i; + for(i = 0; i < pe->nsprites; ++i) + if(pe->sprites[i]) + { + if(pe->sprites[i]->surface) + SDL_FreeSurface(pe->sprites[i]->surface); + free(pe->sprites[i]); + } + free(pe->sprites); + } + while(pe->objects) + close_object(pe->objects); + if(pe->map) + pig_map_close(pe->map); + if(pe->buffer) + SDL_FreeSurface(pe->buffer); + if(pe->pagedirty[0]) + pig_dirty_close(pe->pagedirty[0]); + if(pe->pagedirty[1]) + pig_dirty_close(pe->pagedirty[1]); + if(pe->workdirty) + pig_dirty_close(pe->workdirty); + free(pe); +} + + +void pig_viewport(PIG_engine *pe, int x, int y, int w, int h) +{ + pe->view.x = x; + pe->view.y = y; + pe->view.w = w; + pe->view.h = h; +} + + +int pig_sprites(PIG_engine *pe, const char *filename, int sw, int sh) +{ + int x, y, count, handle; + SDL_Surface *tmp = IMG_Load(filename); + if(!tmp) + { + fprintf(stderr, "Could not load '%s'!\n", filename); + return -1; + } + + handle = pe->nsprites; + + if(!sw) + sw = tmp->w; + if(!sh) + sh = tmp->h; + + /* Disable blending, so we get the alpha channel COPIED! */ + SDL_SetAlpha(tmp, 0, 0); + + count = 0; + for(y = 0; y <= tmp->h - sh; y += sh) + for(x = 0; x <= tmp->w - sw; x += sw) + { + SDL_Rect r; + SDL_Surface *tmp2; + PIG_sprite *s; + if(pe->nsprites >= PIG_MAX_SPRITES) + { + fprintf(stderr, "Sprite bank full!\n"); + return -1; + } + s = (PIG_sprite *)calloc(1, sizeof(PIG_sprite)); + if(!s) + return -1; + s->w = sw; + s->h = sh; + s->hotx = sw / 2; + s->hoty = sh / 2; + s->radius = (sw + sh) / 5; + tmp2 = SDL_CreateRGBSurface(SDL_SWSURFACE, + sw, sh, 32, + 0xff000000, 0x00ff0000, + 0x0000ff00, 0x000000ff); + SDL_SetAlpha(tmp2, 0, 0); + r.x = x; + r.y = y; + r.w = sw; + r.h = sh; + SDL_BlitSurface(tmp, &r, tmp2, NULL); + SDL_SetAlpha(tmp2, SDL_SRCALPHA | SDL_RLEACCEL, + SDL_ALPHA_OPAQUE); + s->surface = SDL_DisplayFormatAlpha(tmp2); + if(!s->surface) + { + fprintf(stderr, "Could not convert sprite %d" + " of '%s'!\n", + count, filename); + return -1; + } + SDL_FreeSurface(tmp2); + pe->sprites[pe->nsprites] = s; + ++pe->nsprites; + ++count; + } + + SDL_FreeSurface(tmp); + return handle; +} + + +int pig_hotspot(PIG_engine *pe, int frame, int hotx, int hoty) +{ + if((frame < 0 ) || (frame >= pe->nsprites)) + return -1; + + switch(hotx) + { + case PIG_UNCHANGED: + break; + case PIG_MIN: + pe->sprites[frame]->hotx = 0; + break; + case PIG_CENTER: + pe->sprites[frame]->hotx = pe->sprites[frame]->w / 2; + break; + case PIG_MAX: + pe->sprites[frame]->hotx = pe->sprites[frame]->w; + break; + default: + pe->sprites[frame]->hotx = hotx; + break; + } + switch(hoty) + { + case PIG_UNCHANGED: + break; + case PIG_MIN: + pe->sprites[frame]->hoty = 0; + break; + case PIG_CENTER: + pe->sprites[frame]->hoty = pe->sprites[frame]->h / 2; + break; + case PIG_MAX: + pe->sprites[frame]->hoty = pe->sprites[frame]->h; + break; + default: + pe->sprites[frame]->hoty = hoty; + break; + } + return 0; +} + + +int pig_radius(PIG_engine *pe, int frame, int radius) +{ + if((frame < 0 ) || (frame >= pe->nsprites)) + return -1; + + pe->sprites[frame]->radius = radius; + return 0; +} + + +void pig_start(PIG_engine *pe, int frame) +{ + PIG_object *po = pe->objects; + pe->time = (double)frame; + pe->frame = frame; + while(po) + { + po->ip.gx = po->ip.ox = po->x; + po->ip.gy = po->ip.oy = po->y; + po->ip.gimage = po->ibase + po->image; + po = po->next; + } +} + + +static void run_timers(PIG_engine *pe, PIG_object *po) +{ + int i; + for(i = 0; i < PIG_TIMERS; ++i) + if(po->timer[i]) + { + --po->timer[i]; + if(!po->timer[i]) + { + PIG_event ev; + ev.type = PIG_TIMER0 + i; + po->handler(po, &ev); + if(!po->id) + return; + } + } +} + + +static void test_offscreen(PIG_engine *pe, PIG_object *po, PIG_sprite *s) +{ + PIG_event ev; + int hx, hy, w, h; + if(s) + { + hx = s->hotx; + hy = s->hoty; + w = s->w; + h = s->h; + } + else + hx = hy = w = h = 0; + ev.cinfo.sides = (po->y - hy < -h) << PIG_TOP_B; + ev.cinfo.sides |= (po->y - hy >= pe->view.h) << PIG_BOTTOM_B; + ev.cinfo.sides |= (po->x - hx < -w) << PIG_LEFT_B; + ev.cinfo.sides |= (po->x - hx >= pe->view.w) << PIG_RIGHT_B; + if(ev.cinfo.sides) + { + float dx = po->x - po->ip.ox; + float dy = po->y - po->ip.oy; + if(ev.cinfo.sides & PIG_TOP) + { + ev.cinfo.y = 0; + if(dy) + ev.cinfo.x = po->ip.ox - dx * po->ip.oy / dy; + } + else if(ev.cinfo.sides & PIG_BOTTOM) + { + ev.cinfo.y = pe->view.h - 1; + if(dy) + ev.cinfo.x = po->ip.ox + dx * + (ev.cinfo.y - po->ip.oy) / dy; + } + if(ev.cinfo.sides & PIG_LEFT) + { + ev.cinfo.x = 0; + if(dx) + ev.cinfo.y = po->ip.oy - dy * po->ip.ox / dx; + } + else if(ev.cinfo.sides & PIG_RIGHT) + { + ev.cinfo.x = pe->view.w - 1; + if(dx) + ev.cinfo.y = po->ip.oy + dy * + (ev.cinfo.x - po->ip.ox) / dx; + } + ev.type = PIG_OFFSCREEN; + po->handler(po, &ev); + } +} + + +/* Test for stationary sprite/sprite collision */ +static void sprite_sprite_one(PIG_object *po, PIG_object *po2, float t, float hitdist) +{ + float dx, dy, dsquare; + PIG_event ev; + int sides; + float ix = po->ip.ox * (1 - t) + po->x * t; + float iy = po->ip.oy * (1 - t) + po->y * t; + float ix2 = po2->ip.ox * (1 - t) + po2->x * t; + float iy2 = po2->ip.oy * (1 - t) + po2->y * t; + dx = ix - ix2; + dy = iy - iy2; + dsquare = dx*dx + dy*dy; + if(dsquare >= hitdist*hitdist) + return; /* Nothing... --> */ + + if(fabs(dsquare) < 1) + sides = PIG_ALL; + else + { + float d = sqrt(dsquare); + dx /= d; + dy /= d; + if(dx < -0.707) + sides = PIG_LEFT; + else if((dx > 0.707)) + sides = PIG_RIGHT; + else + sides = 0; + if(dy < -0.707) + sides |= PIG_TOP; + else if((dy > 0.707)) + sides |= PIG_BOTTOM; + } + ev.type = PIG_HIT_OBJECT; + ev.cinfo.ff = 0.0; + + ev.cinfo.x = ix; + ev.cinfo.y = iy; + ev.cinfo.sides = sides; + if(po->hitmask & po2->hitgroup) + { + ev.obj = po2; + po->handler(po, &ev); + } + + if(po2->id && (po2->hitmask & po->hitgroup)) + { + int s; + ev.cinfo.x = ix2; + ev.cinfo.y = iy2; + s = ((sides >> PIG_LEFT_B) & 1) << PIG_RIGHT_B; + s |= ((sides >> PIG_RIGHT_B) & 1) << PIG_LEFT_B; + s |= ((sides >> PIG_TOP_B) & 1) << PIG_BOTTOM_B; + s |= ((sides >> PIG_BOTTOM_B) & 1) << PIG_TOP_B; + ev.cinfo.sides = s; + ev.obj = po; + po2->handler(po2, &ev); + } +} + + +/* + * Check 'po' against all subsequent objects in the list. + * The testing is step size limited so that neither object + * moves more than 25% of the collision distance between tests. + * (25% should be sufficient for correct direction flags.) + */ +static void test_sprite_sprite(PIG_engine *pe, PIG_object *po, PIG_sprite *s) +{ + int image; + PIG_object *po2, *next2; + for(po2 = po->next; po2; po2 = next2) + { + float hitdist, d, dmax, t, dt; + next2 = po2->next; + if(!po->id || !po2->id) + break; + + /* Check collision groups and masks */ + if(!(po->hitmask & po2->hitgroup) && + !(po2->hitmask & po->hitgroup)) + continue; + + /* Calculate minimum distance */ + hitdist = s ? s->radius : 0; + image = po2->ibase + po2->image; + if((image >= 0) && (image < pe->nsprites)) + hitdist += pe->sprites[image]->radius; + if(hitdist < 1) + hitdist = 1; + + /* Calculate number of testing steps */ + dmax = fabs(po->ip.ox - po->x); + d = fabs(po->ip.oy - po->y); + dmax = d > dmax ? d : dmax; + d = fabs(po2->ip.ox - po2->x); + dmax = d > dmax ? d : dmax; + d = fabs(po2->ip.oy - po2->y); + dmax = d > dmax ? d : dmax; + if(dmax > 1) + dt = hitdist / (dmax * 4); + else + dt = 1; + + /* Sweep test! */ + for(t = 0; t < 1; t += dt) + sprite_sprite_one(po, po2, t, hitdist); + } +} + + +/* + * Returns a non-zero value if the tile at (x, y) is marked for + * collisions on the side indicated by 'mask'. + */ +static __inline__ int check_tile(PIG_map *m, int x, int y, int mask) +{ + int mx, my; + /* + * Must check < 0 first! (Division rounds + * towards zero - not downwards.) + */ + if(x < 0 || y < 0) + return PIG_NONE; + + mx = x / m->tw; + my = y / m->th; + if(mx >= m->w || my >= m->h) + return PIG_NONE; + + return m->hit[my * m->w + mx] & mask; +} + + +int pig_test_map(PIG_engine *pe, int x, int y) +{ + int mx, my; + if(x < 0 || y < 0) + return PIG_NONE; + + mx = x / pe->map->tw; + my = y / pe->map->th; + if(mx >= pe->map->w || my >= pe->map->h) + return PIG_NONE; + + return pe->map->hit[my * pe->map->w + mx]; +} + + +/* + * Simple implementation that checks only for top edge collisions. + * (Full top/bottom/left/right checks with proper handling of + * corners and rows of tiles is a lot more complicated, so I'll + * leave that out for now, rather than hacking something simple + * but incorrect.) + */ +int pig_test_map_vector(PIG_engine *pe, int x1, int y1, int x2, int y2, + int mask, PIG_cinfo *ci) +{ + PIG_cinfo lci; + PIG_map *m = pe->map; + int x, y; + int dist = 2000000000L; + if(!ci) + ci = &lci; + ci->sides = 0; + if((mask & PIG_TOP) && (y1 < y2)) + { + /* Test for tiles that can be hit from the top */ + for(y = y1 + m->th - y1 % m->th; y <= y2; y += m->th) + { + x = x1 + (x2 - x1) * (y - y1) / (y2 - y1); + if(check_tile(m, x, y + 1, PIG_TOP)) + { + dist = (x-x1) * (x-x1) + (y-y1) * (y-y1); + ci->x = x; + ci->y = y - 1; + ci->sides |= PIG_TOP; + break; + } + } + } + if(ci->sides) + ci->ff = sqrt((x2 - x1) * (x2 - x1) + + (y2 - y1) * (y2 - y1) / dist); + return ci->sides; +} + + +static void test_sprite_map(PIG_engine *pe, PIG_object *po, PIG_sprite *s) +{ + PIG_event ev; + if(pig_test_map_vector(pe, po->ip.ox, po->ip.oy, po->x, po->y, + po->tilemask, &ev.cinfo)) + { + ev.type = PIG_HIT_TILE; + po->handler(po, &ev); + } +} + + +static void run_logic(PIG_engine *pe) +{ + PIG_object *po, *next; + int image; + + /* Shift logic coordinates */ + for(po = pe->objects; po; po = po->next) + { + po->ip.ox = po->x; + po->ip.oy = po->y; + } + + if(pe->before_objects) + pe->before_objects(pe); + + for(po = pe->objects; po; po = next) + { + PIG_event ev; + /* + * We must grab the next pointer before + * we call any event handlers, as they + * may cause objects to remove themselves! + */ + next = po->next; + ev.type = PIG_PREFRAME; + po->handler(po, &ev); + } + + for(po = pe->objects; po; po = next) + { + PIG_sprite *s; + next = po->next; + image = po->ibase + po->image; + if((image >= 0) && (image < pe->nsprites)) + s = pe->sprites[image]; + else + s = NULL; + + /* Move! */ + po->vx += po->ax; + po->vy += po->ay; + po->x += po->vx; + po->y += po->vy; + + /* Check and handle events */ + if(po->handler) + { + run_timers(pe, po); + if(po->id) + test_offscreen(pe, po, s); + if(po->id && (po->hitmask || po->hitgroup)) + test_sprite_sprite(pe, po, s); + if(po->id && po->tilemask) + test_sprite_map(pe, po, s); + + } + } + + for(po = pe->objects; po; po = next) + { + next = po->next; + if(po->id) + { + PIG_event ev; + ev.type = PIG_POSTFRAME; + po->handler(po, &ev); + ++po->age; + } + } + + if(pe->after_objects) + pe->after_objects(pe); +} + + +void pig_animate(PIG_engine *pe, float frames) +{ + /* Advance logic time */ + int i = floor(pe->time + frames) - floor(pe->time); + while(i--) + { + run_logic(pe); + ++pe->frame; + } + pe->time += frames; +} + + +void pig_dirty(PIG_engine *pe, SDL_Rect *dr) +{ + SDL_Rect r; + r.x = 0; + r.y = 0; + r.w = pe->surface->w; + r.h = pe->surface->h; + if(dr) + pig_intersectrect(dr, &r); + if(r.w && r.h) + pig_dirty_add(pe->pagedirty[pe->page], &r); +} + + +static void tile_area(PIG_engine *pe, SDL_Rect *r) +{ + SDL_Rect cr; + int x, y, startx, starty, maxx, maxy, tilesperrow; + cr = *r; + cr.x += pe->view.x; + cr.y += pe->view.y; + SDL_SetClipRect(pe->surface, &cr); + + startx = r->x / pe->map->tw; + starty = r->y / pe->map->th; + maxx = (r->x + r->w + pe->map->tw - 1) / pe->map->tw; + maxy = (r->y + r->h + pe->map->th - 1) / pe->map->th; + if(maxx > pe->map->w - 1) + maxx = pe->map->w - 1; + if(maxy > pe->map->h - 1) + maxy = pe->map->h - 1; + tilesperrow = pe->map->tiles->w / pe->map->tw; + + for(y = starty; y <= maxy; ++y) + for(x = startx; x <= maxx; ++x) + { + SDL_Rect from, to; + int c = pe->map->map[y * pe->map->w + x]; + from.x = c % tilesperrow * pe->map->tw; + from.y = c / tilesperrow * pe->map->th; + from.w = pe->map->tw; + from.h = pe->map->th; + to.x = pe->view.x + x * pe->map->tw; + to.y = pe->view.y + y * pe->map->th; + SDL_BlitSurface(pe->map->tiles, &from, + pe->surface, &to); + } +} + + +void remove_sprites(PIG_engine *pe) +{ + SDL_Rect r; + PIG_sprite *s; + PIG_object *po, *next; + + /* + * Remove all objects, using the information that + * remains from the last frame. The actual removal + * is done by drawing over the sprites with tiles + * from the map. + * + * We assume that most objects don't overlap. If + * they do that a lot, we could use a "dirty map" + * to avoid rendering the same tiles multiple times + * in the overlapping areas. + */ + for(po = pe->objects; po; po = next) + { + next = po->next; + if((po->ip.gimage < 0) || (po->ip.gimage >= pe->nsprites)) + continue; + s = pe->sprites[po->ip.gimage]; + r.x = po->ip.gx - s->hotx; + r.y = po->ip.gy - s->hoty; + r.w = s->w; + r.h = s->h; + pig_intersectrect(&pe->view, &r); + if(r.w && r.h) + tile_area(pe, &r); + + /* + * Delete dead objects *after* they've + * been removed from the rendering buffer! + */ + if(!po->id) + close_object(po); + } +} + + +void draw_sprites(PIG_engine *pe) +{ + PIG_dirtytable *pdt; + PIG_sprite *s; + PIG_object *po; + float fframe = pe->time - floor(pe->time); + SDL_SetClipRect(pe->surface, &pe->view); + + /* Swap the work and display/back page dirtytables */ + pdt = pe->workdirty; + pe->workdirty = pe->pagedirty[pe->page]; + pe->pagedirty[pe->page] = pdt; + + /* Clear the display/back page dirtytable */ + pdt->count = 0; + + /* Update positions and render all objects */ + po = pe->objects; + while(po) + { + /* Calculate graphic coordinates */ + if(pe->interpolation) + { + po->ip.gx = po->ip.ox * (1 - fframe) + po->x * fframe; + po->ip.gy = po->ip.oy * (1 - fframe) + po->y * fframe; + } + else + { + po->ip.gx = po->x; + po->ip.gy = po->y; + } + po->ip.gimage = po->ibase + po->image; + + /* Render the sprite! */ + if((po->ip.gimage >= 0) && (po->ip.gimage < pe->nsprites)) + { + SDL_Rect dr; + s = pe->sprites[po->ip.gimage]; + dr.x = po->ip.gx - s->hotx + pe->view.x; + dr.y = po->ip.gy - s->hoty + pe->view.y; + SDL_BlitSurface(pe->sprites[po->ip.gimage]->surface, + NULL, pe->surface, &dr); + /* + * We use the clipped rect for the dirtyrect! + */ + if(dr.w && dr.h) + pig_dirty_add(pdt, &dr); + } + po = po->next; + } + + /* Merge the display/back page table into the work table */ + pig_dirty_merge(pe->workdirty, pdt); +} + + +void pig_refresh(PIG_engine *pe) +{ + remove_sprites(pe); + draw_sprites(pe); +} + + +void pig_refresh_all(PIG_engine *pe) +{ + tile_area(pe, &pe->view); + pig_dirty(pe, NULL); + draw_sprites(pe); +} + + +static void show_rects(PIG_engine *pe, PIG_dirtytable *pdt) +{ + int i; + Uint32 color; + if(!pe->buffer) + { + pe->buffer = SDL_CreateRGBSurface(SDL_SWSURFACE, + pe->screen->w, pe->screen->h, + pe->screen->format->BitsPerPixel, + pe->screen->format->Rmask, + pe->screen->format->Gmask, + pe->screen->format->Bmask, + pe->screen->format->Amask); + if(!pe->buffer) + return; + pe->surface = pe->buffer; + tile_area(pe, &pe->view); + } + if(!pe->buffer) + return; + + pe->direct = 0; + + for(i = 0; i < pdt->count; ++i) + { + SDL_Rect r; + r = pdt->rects[i]; + r.x -= 32; + r.y -= 32; + r.w += 64; + r.h += 64; + SDL_BlitSurface(pe->buffer, &r, pe->screen, &r); + } + + color = SDL_MapRGB(pe->screen->format, 255, 0, 255); + for(i = 0; i < pdt->count; ++i) + { + SDL_Rect r; + r = pdt->rects[i]; + r.h = 1; + SDL_FillRect(pe->screen, &r, color); + r.y += pdt->rects[i].h - 1; + SDL_FillRect(pe->screen, &r, color); + r = pdt->rects[i]; + r.w = 1; + SDL_FillRect(pe->screen, &r, color); + r.x += pdt->rects[i].w - 1; + SDL_FillRect(pe->screen, &r, color); + } +} + + +void pig_flip(PIG_engine *pe) +{ + PIG_dirtytable *pdt = pe->workdirty; + int i; + SDL_SetClipRect(pe->surface, NULL); + + if(pe->show_dirtyrects) + { + show_rects(pe, pdt); + for(i = 0; i < pdt->count; ++i) + { + pdt->rects[i].x -= 32; + pdt->rects[i].y -= 32; + pdt->rects[i].w += 64; + pdt->rects[i].h += 64; + pig_intersectrect(&pe->buffer->clip_rect, &pdt->rects[i]); + } + } + else if(pe->surface == pe->buffer) + for(i = 0; i < pdt->count; ++i) + SDL_BlitSurface(pe->buffer, pdt->rects + i, + pe->screen, pdt->rects + i); + + if((pe->screen->flags & SDL_HWSURFACE) == SDL_HWSURFACE) + { + SDL_Flip(pe->screen); + if(pe->pages > 1) + pe->page = 1 - pe->page; + } + else + SDL_UpdateRects(pe->screen, pdt->count, pdt->rects); + + if(pe->direct) + pe->surface = pe->screen; + else + pe->surface = pe->buffer ? pe->buffer : pe->screen; +} + + +void pig_draw_sprite(PIG_engine *pe, int frame, int x, int y) +{ + SDL_Rect dr; + if(frame >= pe->nsprites) + return; + dr.x = x - pe->sprites[frame]->hotx + pe->view.x; + dr.y = y - pe->sprites[frame]->hoty + pe->view.y; + SDL_BlitSurface(pe->sprites[frame]->surface, NULL, + pe->surface, &dr); +} + + +/*---------------------------------------------------------- + Map +----------------------------------------------------------*/ +PIG_map *pig_map_open(PIG_engine *pe, int w, int h) +{ + if(pe->map) + pig_map_close(pe->map); + + pe->map = (PIG_map *)calloc(1, sizeof(PIG_map)); + if(!pe->map) + return NULL; + + pe->map->owner = pe; + pe->map->w = w; + pe->map->h = h; + pe->map->hit = (unsigned char *)calloc(w, h); + if(!pe->map->hit) + { + pig_map_close(pe->map); + return NULL; + } + pe->map->map = (unsigned char *)calloc(w, h); + if(!pe->map->map) + { + pig_map_close(pe->map); + return NULL; + } + return pe->map; +} + + +void pig_map_close(PIG_map *pm) +{ + PIG_engine *pe = pm->owner; + if(pm->tiles) + SDL_FreeSurface(pm->tiles); + free(pm->hit); + free(pm->map); + free(pe->map); + pe->map = NULL; +} + + +int pig_map_tiles(PIG_map *pm, const char *filename, int tw, int th) +{ + SDL_Surface *tmp; + pm->tw = tw; + pm->th = th; + tmp = IMG_Load(filename); + if(!tmp) + { + fprintf(stderr, "Could not load '%s'!\n", filename); + return -1; + } + pm->tiles = SDL_DisplayFormat(tmp); + if(!pm->tiles) + { + fprintf(stderr, "Could not convert '%s'!\n", filename); + return -1; + } + SDL_FreeSurface(tmp); + return 0; +} + + +void pig_map_collisions(PIG_map *pm, unsigned first, unsigned count, PIG_sides sides) +{ + int i; + if(first > 255) + return; + if(first + count > 255) + count = 255 - first; + for(i = first; i < first + count; ++i) + pm->hitinfo[i] = sides; +} + + +/* + * Load a map from a string (one byte/tile). 'trans' + * is a string used for translating 'data' into integer + * tile indices. Each position in 'trans' corresponds + * to one tile in the tile palette. + */ +int pig_map_from_string(PIG_map *pm, const char *trans, const char *data) +{ + int x, y, z; + + /* Load the map */ + z = 0; + for(y = 0; y < pm->h; ++y) + for(x = 0; x < pm->w; ++x) + { + const char *f; + int c = data[z]; + if(!c) + { + fprintf(stderr, "Map string too short!\n"); + return -1; + } + f = strchr(trans, c); + if(!f) + { + fprintf(stderr, "Character '%c' not in" + " the translation string!\n", + c); + return -1; + } + pm->map[z] = f - trans; + ++z; + } + /* Generate collision map */ + for(y = 0; y < pm->h; ++y) + for(x = 0; x < pm->w; ++x) + pm->hit[y * pm->w + x] = + pm->hitinfo[pm->map[y * pm->w + x]]; + return 0; +} + + +/*---------------------------------------------------------- + Object +----------------------------------------------------------*/ + + +static PIG_object *get_object(PIG_engine *pe) +{ + PIG_object *po; + if(pe->object_pool) + { + po = pe->object_pool; + pe->object_pool = po->next; + memset(po, 0, sizeof(PIG_object)); + } + else + { + po = (PIG_object *)calloc(1, sizeof(PIG_object)); + if(!po) + return NULL; + } + po->id = ++pe->object_id_counter; + return po; +} + + +static void free_object(PIG_object *po) +{ + po->prev = NULL; + po->next = po->owner->object_pool; + po->owner->object_pool = po; + po->id = 0; +} + + +PIG_object *pig_object_open(PIG_engine *pe, int x, int y, int last) +{ + PIG_object *po = get_object(pe); + if(!po) + return NULL; + + po->owner = pe; + po->tilemask = PIG_ALL; + po->hitmask = 0; + po->hitgroup = 0; + + if(last && pe->objects) + { + PIG_object *lo = pe->objects; + while(lo->next) + lo = lo->next; + po->prev = lo; + po->next = NULL; + lo->next = po; + } + else + { + po->prev = NULL; + po->next = pe->objects; + if(po->next) + po->next->prev = po; + pe->objects = po; + } + + po->x = x; + po->y = y; + po->ip.ox = x; + po->ip.oy = y; + return po; +} + + +static void close_object(PIG_object *po) +{ + if(po == po->owner->objects) + po->owner->objects = po->next; + else if(po->prev) + po->prev->next = po->next; + if(po->next) + po->next->prev = po->prev; + free_object(po); +} + + +void pig_object_close(PIG_object *po) +{ + if(!po->id) + fprintf(stderr, "Object %p closed more than once!\n", po); + po->id = 0; /* Mark for eventual removal and destruction */ +} + + +void pig_object_close_all(PIG_engine *pe) +{ + while(pe->objects) + close_object(pe->objects); +} + + +PIG_object *pig_object_find(PIG_object *start, int id) +{ + PIG_object *pob, *pof; + if(start) + pob = pof = start; + else + { + pof = start->owner->objects; + while(pof) + { + if(pof->id == id) + return pof; + pof = pof->next; + } + return NULL; + } + while(1) + { + if(pob) + { + if(pob->id == id) + return pob; + pob = pob->prev; + } + if(pof) + { + if(pof->id == id) + return pof; + pof = pof->next; + } + else + if(!pob) + return NULL; + } +} diff --git a/programs/games/pig/trunk/engine.h b/programs/games/pig/trunk/engine.h new file mode 100644 index 0000000000..7a88ea1cf6 --- /dev/null +++ b/programs/games/pig/trunk/engine.h @@ -0,0 +1,404 @@ +/* +------------------------------------------------------------ + Fixed Rate Pig - a fixed logic frame rate demo +------------------------------------------------------------ + * Copyright (C) 2004 David Olofson + * + * This software is released under the terms of the GPL. + * + * Contact author for permission if you want to use this + * software, or work derived from it, under other terms. + */ + +#ifndef PIG_ENGINE_H +#define PIG_ENGINE_H + +#include "SDL.h" +#include +#ifndef M_PI +# define M_PI 3.14159265358979323846 /* pi */ +#endif +#include "dirty.h" + + +/*---------------------------------------------------------- + Game Engine +----------------------------------------------------------*/ + +typedef struct PIG_object PIG_object; +typedef struct PIG_engine PIG_engine; + + +/* Interpolated point */ +typedef struct PIG_ipoint +{ + /* From the last logic frame: */ + float ox, oy; /* Position */ + + /* From the last/current rendered frame: */ + int gimage; /* Sprite frame index */ + float gx, gy; /* Interpolated position */ +} PIG_ipoint; + + +/* + * Game logic events + * + * PREFRAME: + * Occurs once per logic frame, before collision and + * off-screen detection, and before timer handlers. + * + * TIMERx: + * Occurs whenever timer x expires. Timers are one- + * shot, but can be reloaded by the handler for + * periodic action. Timer events are handled before + * before collision and off-screen detection. + * + * HIT_TILE: + * Occurs when the hot-spot of an object hits a + * marked side of a tile, and the corresponding bit + * in 'tilemask' is set. + * + * HIT_OBJECT: + * Occurs when the collision circle of an object + * intersects the collision circle of another object, + * provided one or more bits in 'hitgroup' of the + * other object matches bits in 'hitmask'. + * + * OFFSCREEN: + * Occurs when an object is off-screen. This takes + * in account the hot-spot and bounding rectangle of + * the current sprite frame. + * + * POSTFRAME: + * Occurs once per logic frame, after collision + * detection, off-screen detection and all other + * events. + * + */ +#define PIG_TIMERS 3 +typedef enum +{ + PIG_PREFRAME, + PIG_TIMER0, + PIG_TIMER1, + PIG_TIMER2, + PIG_HIT_TILE, + PIG_HIT_OBJECT, + PIG_OFFSCREEN, + PIG_POSTFRAME +} PIG_events; + + +typedef enum +{ + PIG_NONE = 0, + + /* Bit positions */ + PIG_TOP_B = 0, + PIG_BOTTOM_B = 1, + PIG_LEFT_B = 2, + PIG_RIGHT_B = 3, + + /* Masks */ + PIG_TOP = 1 << PIG_TOP_B, + PIG_BOTTOM = 1 << PIG_BOTTOM_B, + PIG_LEFT = 1 << PIG_LEFT_B, + PIG_RIGHT = 1 << PIG_RIGHT_B, + + /* Combined masks */ + PIG_TL = PIG_TOP | PIG_LEFT, + PIG_TR = PIG_TOP | PIG_RIGHT, + PIG_BL = PIG_BOTTOM | PIG_LEFT, + PIG_BR = PIG_BOTTOM | PIG_RIGHT, + PIG_ALL = 0xf, +} PIG_sides; + + +typedef enum +{ + PIG_UNCHANGED = -10000000, + PIG_MIN = -10000001, + PIG_CENTER = -10000002, + PIG_MAX = -10000003 +} PIG_values; + + +/* Collision info */ +typedef struct +{ + float ff; /* Fractional frame */ + int x, y; /* Exact position */ + PIG_sides sides; /* Side of tile hit */ +} PIG_cinfo; + + +typedef struct PIG_event +{ + PIG_events type; + + /* For HIT_TILE, HIT_OBJECT and OFFSCREEN: */ + PIG_cinfo cinfo; /* Detailed collision info */ + + /* For HIT_OBJECT: */ + PIG_object *obj; /* Which object? */ +} PIG_event; + + +/* Logic object */ +struct PIG_object +{ + PIG_engine *owner; + PIG_object *next, *prev; + + int id; /* Unique ID. 0 means "free". */ + + int ibase; /* Sprite frame base index */ + int image; /* Sprite frame offset */ + float x, y; /* Position */ + float vx, vy; /* Speed */ + float ax, ay; /* Acceleration */ + PIG_ipoint ip; + int tilemask; /* Sprite/tile mask [PIG_ALL] */ + + int hitmask; /* Sprite/sprite mask [0] */ + int hitgroup; /* Sprite/sprite group [0] */ + + int timer[PIG_TIMERS]; /* Down-counting timers */ + int age; /* Age timer (logic frames) */ + + int score; + int power; + int target; + int state; + + void (*handler)(PIG_object *po, const PIG_event *ev); + + void *userdata; +}; + + +/* Level map */ +typedef struct PIG_map +{ + PIG_engine *owner; + + int w, h; /* Size of map (tiles) */ + unsigned char *map; /* 2D aray of tile indices */ + unsigned char *hit; /* 2D aray of collision flags */ + + int tw, th; /* Size of one tile (pixels) */ + SDL_Surface *tiles; /* Tile palette image */ + unsigned char hitinfo[256]; /* Collision info for the tiles */ +} PIG_map; + + +/* Sprite frame */ +typedef struct PIG_sprite +{ + int w, h; /* Size of sprite (pixels) */ + int hotx, hoty; /* Hot-spot offset (pixels) */ + int radius; /* Collision zone radius (pixels) */ + SDL_Surface *surface; +} PIG_sprite; + +/* Engine */ +struct PIG_engine +{ + /* Video stuff */ + SDL_Surface *screen; + SDL_Surface *buffer; /* For h/w surface displays */ + SDL_Surface *surface; /* Where to render to */ + int pages; /* # of display VRAM buffers */ + SDL_Rect view; /* Viewport pos & size (pixels) */ + int page; /* Current page (double buffer) */ + PIG_dirtytable *pagedirty[2]; /* One table for each page */ + PIG_dirtytable *workdirty; /* The work dirtytable */ + + /* "Live" switches */ + int interpolation; + int direct; /* 1 ==> render directly to screen */ + int show_dirtyrects; + + /* Time */ + double time; /* Logic time (frames) */ + int frame; /* Logic time; integer part */ + + /* Background graphics */ + PIG_map *map; + + /* Sprites and stuff */ + PIG_object *objects; + PIG_object *object_pool; + int object_id_counter; + int nsprites; + PIG_sprite **sprites; + + /* Logic frame global handlers */ + void (*before_objects)(PIG_engine *pe); + void (*after_objects)(PIG_engine *pe); + + /* Space for user data */ + void *userdata; +}; + + +/* + * Engine + */ +PIG_engine *pig_open(SDL_Surface *screen); +void pig_close(PIG_engine *pe); + +/* Set viewport size and position */ +void pig_viewport(PIG_engine *pe, int x, int y, int w, int h); + +/* Start engine at logic time 'frame' */ +void pig_start(PIG_engine *pe, int frame); + +/* + * Load a sprite palette image. The image is chopped up into + * sprites, based on 'sw' and 'sh', and added as new frames + * in the sprite bank. Default values: + * Hot-spot: (sw/2, sh/2) + * Collision radius: 0.2 * (sw + sh) + * + * Passing 0 for 'sw' and/or 'sh' makes pig_sprites() take + * the respective value from the image width and/or height. + * + * Returns the index of the first frame loaded. + */ +int pig_sprites(PIG_engine *pe, const char *filename, int sw, int sh); + +/* Set hot-spot of sprite 'frame' to (hotx, hoty) */ +int pig_hotspot(PIG_engine *pe, int frame, int hotx, int hoty); + +/* Set sprite/sprite collision zone radius of 'frame' */ +int pig_radius(PIG_engine *pe, int frame, int radius); + +/* Advance logic time by 'frames' logic frames */ +void pig_animate(PIG_engine *pe, float frames); + +/* + * Manually add a dirtyrect for pig_refresh(). + * 'dr' can be outside the engine viewport. + */ +void pig_dirty(PIG_engine *pe, SDL_Rect *dr); + +/* + * Do what's needed to deal with the dirtyrects + * and then make the new frame visible. + */ +void pig_flip(PIG_engine *pe); + +/* + * Refresh the viewport and any additional dirtyrects. + * + * Note that this does not refresh the entire viewport; + * only the areas that have actually changed! + */ +void pig_refresh(PIG_engine *pe); + +/* + * Refresh the whole viewport, including sprites. + */ +void pig_refresh_all(PIG_engine *pe); + +/* Render a sprite "manually", bypassing the engine */ +void pig_draw_sprite(PIG_engine *pe, int frame, int x, int y); + +/* + * Get the collision flags for the tile at (x, y), + * where the unit of x and y is pixels. The return + * is the PIG_sides flags for the tile, or PIG_NONE + * if (x, y) is outside the map. + */ +int pig_test_map(PIG_engine *pe, int x, int y); + +/* + * Find the first "collidable" tile side when going from + * (x1, y1) to (x2, y2). 'mask' determines which tile sides + * are considered for collisions. + * + * Returns the side(s) hit, if any tile was hit. If the return + * is non-zero, the PIG_cinfo struct at 'ci' contains detailed + * information about the collision. + */ +int pig_test_map_vector(PIG_engine *pe, int x1, int y1, int x2, int y2, + int mask, PIG_cinfo *ci); + + +/* + * Map + */ +PIG_map *pig_map_open(PIG_engine *pe, int w, int h); +void pig_map_close(PIG_map *pm); + +/* Load a tile palette image */ +int pig_map_tiles(PIG_map *pm, const char *filename, int tw, int th); + +/* + * Set tile collision info for 'count' tiles, starting at + * 'first'. Each tile in the tile palette has a set of + * PIG_sides flags that determine which sides the tile are + * considered for sprite/map collisions. + */ +void pig_map_collisions(PIG_map *pm, unsigned first, unsigned count, + PIG_sides sides); + +/* + * Load a map from a string (one byte/tile). 'trans' + * is a string used for translating 'data' into integer + * tile indices. Each position in 'trans' corresponds + * to one tile in the tile palette. + */ +int pig_map_from_string(PIG_map *pm, const char *trans, const char *data); + + +/* + * Object + */ + +/* + * Create an object with the initial position (x, y). If + * 'last' is 1, the object will end up last in the + * processing and rendering order, otherwise, first. + * + * Note that relative processing order is very important + * to objects that chase each other and stuff like that! + * If they're placed in the "wrong" order, the tracking + * objects get an extra frame of reaction time, which is + * annoying if it's not what you intend. + */ +PIG_object *pig_object_open(PIG_engine *pe, int x, int y, int last); + +/* + * Delete an object. + * + * Note that objects are never actually deleted. Instead, + * they are placed in a free pool, where pig_object_open() + * looks for objects to recycle. + * + * In fact, they are not even freed when you ask for it, + * but rather kept around until the next rendered frame, + * so they can be removed from the screen correctly. + */ +void pig_object_close(PIG_object *po); + +/* + * Close all objects. + */ +void pig_object_close_all(PIG_engine *pe); + +/* + * Find object by 'id', starting at object 'start'. + * + * The search starts at 'start' and is done in both + * directions in parallel, assuming that the matching + * object is near 'start' in the list. (It usually is + * when dealing with linked objects.) + * + * Returns NULL if the object was not found. + */ +PIG_object *pig_object_find(PIG_object *start, int id); + +#endif /* PIG_ENGINE_H */ diff --git a/programs/games/pig/trunk/evil.png b/programs/games/pig/trunk/evil.png new file mode 100644 index 0000000000..ca79c1dad6 Binary files /dev/null and b/programs/games/pig/trunk/evil.png differ diff --git a/programs/games/pig/trunk/font.png b/programs/games/pig/trunk/font.png new file mode 100644 index 0000000000..6567d3d7a9 Binary files /dev/null and b/programs/games/pig/trunk/font.png differ diff --git a/programs/games/pig/trunk/glassfont.png b/programs/games/pig/trunk/glassfont.png new file mode 100644 index 0000000000..b9b491ef59 Binary files /dev/null and b/programs/games/pig/trunk/glassfont.png differ diff --git a/programs/games/pig/trunk/icons.png b/programs/games/pig/trunk/icons.png new file mode 100644 index 0000000000..f1711df8df Binary files /dev/null and b/programs/games/pig/trunk/icons.png differ diff --git a/programs/games/pig/trunk/install-sh b/programs/games/pig/trunk/install-sh new file mode 100644 index 0000000000..e9de23842d --- /dev/null +++ b/programs/games/pig/trunk/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# 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}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# 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 $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/programs/games/pig/trunk/lifepig.png b/programs/games/pig/trunk/lifepig.png new file mode 100644 index 0000000000..9fd487bbed Binary files /dev/null and b/programs/games/pig/trunk/lifepig.png differ diff --git a/programs/games/pig/trunk/missing b/programs/games/pig/trunk/missing new file mode 100644 index 0000000000..7789652e87 --- /dev/null +++ b/programs/games/pig/trunk/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois 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., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -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 + +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 + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. 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 missing on your system. You should only need it if + you modified \`configure.in'. 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 missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. 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.in` + 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 missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + 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 + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. 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 missing on your system. 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 + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. 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." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. 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 prerequirements 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 diff --git a/programs/games/pig/trunk/mkinstalldirs b/programs/games/pig/trunk/mkinstalldirs new file mode 100644 index 0000000000..4f58503ea4 --- /dev/null +++ b/programs/games/pig/trunk/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/programs/games/pig/trunk/pig-linux-x86 b/programs/games/pig/trunk/pig-linux-x86 new file mode 100644 index 0000000000..42e8d9e9c8 Binary files /dev/null and b/programs/games/pig/trunk/pig-linux-x86 differ diff --git a/programs/games/pig/trunk/pig.c b/programs/games/pig/trunk/pig.c new file mode 100644 index 0000000000..961cbc1ba0 --- /dev/null +++ b/programs/games/pig/trunk/pig.c @@ -0,0 +1,1332 @@ +/* +------------------------------------------------------------ + Fixed Rate Pig - a fixed logic frame rate demo +------------------------------------------------------------ + * Copyright (C) 2004 David Olofson + * + * This software is released under the terms of the GPL. + * + * Contact author for permission if you want to use this + * software, or work derived from it, under other terms. + */ + +#include +#include +#include +#include +#include +#include +#include "engine.h" + + +/* Graphics defines */ +#define SCREEN_W 800 +#define SCREEN_H 600 +#define TILE_W 32 +#define TILE_H 32 +#define MAP_W 25 +#define MAP_H 17 +#define FONT_SPACING 45 +#define PIG_FRAMES 12 + +/* World/physics constants */ +#define GRAV_ACC 4 +#define JUMP_SPEED 28 + +/* Sprite collision groups */ +#define GROUP_ENEMY 0x0001 +#define GROUP_POWERUP 0x0002 + +typedef enum +{ + POWER_LIFE, + POWER_BONUS1, + POWER_BONUS2 +} POWERUPS; + + +typedef struct GAMESTATE +{ + /* I/O */ + PIG_engine *pe; + Uint8 *keys; + int nice; + int refresh_screen; + int jump; + + /* Sprites */ + int lifepig; + int scorefont; + int glassfont; + int icons; + int stars; + int pigframes; + int evil; + int slime; + + /* Global game state */ + int running; + int level; + int lives; + float lives_wobble; + float lives_wobble_time; + int score; + float score_wobble; + float score_wobble_time; + float dashboard_time; + int fun_count; + int enemycount; + int messages; + + /* Objects */ + PIG_object *player; + + /* Statistics */ + int logic_frames; + int rendered_frames; +} GAMESTATE; + + +static void add_life(GAMESTATE *gs); +static void remove_life(GAMESTATE *gs); +static void inc_score(GAMESTATE *gs, int v); +static void inc_score_nobonus(GAMESTATE *gs, int v); +static PIG_object *new_player(GAMESTATE *gs); +static void message(GAMESTATE *gs, const char *s); +static PIG_object *new_powerup(GAMESTATE *gs, + int x, int y, int speed, POWERUPS type); +static PIG_object *new_star(GAMESTATE *gs, int x, int y, int vx, int vy); +static PIG_object *new_evil(GAMESTATE *gs, + int x, int y, int speed); +static PIG_object *new_slime(GAMESTATE *gs, + int x, int y, int speed); + + +/*---------------------------------------------------------- + Init, load stuff etc +----------------------------------------------------------*/ + +static int load_level(GAMESTATE *gs, int map) +{ + const char *m; + const char *k; + if(map > 4) + map = 1; + gs->level = map; + pig_object_close_all(gs->pe); + gs->enemycount = 0; + gs->messages = 0; + switch(map) + { + case 1: + case 2: + case 4: + k = "abcd" "efgh" "ijkl" /* Red, green, yellov */ + "0123456789ABCDEFG" /* Sky */ + "xyz"; /* Single R, G, Y */ + break; + case 0: + case 3: + k = "abcd" "efgh" "ijkl" /* Red, green, yellov */ + "................." + "xyz" /* Single R, G, Y */ + "-+012345..ABCDEF"; /* Night sky */ + break; + } + switch(map) + { + case 0: m = "-------------ad----------" + "-abcd-x-ad--ad-abcd-acd--" + "-x----x--abcd--x----x--x-" + "-abd--x---ad---abd--x--x-" + "-x----x--abcd--x----x--x-" + "-x----x-ad--ad-abcd-abd--" + "----efhad-eh--egh-efh----" + "----y--y-y--y--y--y------" + "++++efh++efgh++y++eh+++++" + "0123y50y2y45y12y45y123450" + "ABCDyFAyCyEFyBCyEFeghDEFA" + "----ijkjl-ijkl--ijkjl----" + "----il--il-il--il--------" + "----ijkjl--il--il-ikl----" + "----il-----il--il--il----" + "----il----ijkl--ijkjl----" + "-------------------------"; + break; + case 1: m = "0000000000000000000000000" + "1111111111111111111111111" + "2222222222222222222222222" + "3333333333333333333333333" + "4444444444444444444444444" + "5555555555555555555555555" + "6666666666666666666666666" + "7777777ijkjkjjkjkl7777777" + "8888888888888888888888888" + "9999999999999999999999999" + "abcdAAAAAAAAAAAAAAAAAabcd" + "BBBBBBBBBBBBBBBBBBBBBBBBB" + "CCCCCCCCCCCCCCCCCCCCCCCCC" + "efgfgffgfgfgfgfggffgfgfgh" + "EEEEEEEEEEEEEEEEEEEEEEEEE" + "FFFFFFFFFFFFFFFFFFFFFFFFF" + "GGGGGGGGGGGGGGGGGGGGGGGGG"; + new_evil(gs, 2, 0, 5); + new_evil(gs, 22, 0, 5); + new_evil(gs, 5, 0, 7); + new_evil(gs, 19, 0, 7); + break; + case 2: m = "0000000000000000000000000" + "1111111111111111111111111" + "2222222222222222222222222" + "3333333333333333333333333" + "4444444444xxxxx4444444444" + "5555555555x555x5555555555" + "6666666666x666x6666666666" + "7777777xxxx777xxxx7777777" + "8888888x888888888x8888888" + "9999999x999999999x9999999" + "AAAAAAAxxxxAAAxxxxAAAAAAA" + "BBBBBBBBBBxBBBxBBBBBBBBBB" + "CCCCCCCCCCxCCCxCCCCCCCCCC" + "DDDDDDDDDDxxxxxDDDDDDDDDD" + "EEEEEEEEEEEEEEEEEEEEEEEEE" + "ijklFFFFFFFFFFFFFFFFFijkl" + "GGGijlGilGilGilGilGiklGGG"; + new_slime(gs, 2, 0, -5); + new_slime(gs, 22, 0, 5); + new_evil(gs, 8, 0, 7); + new_evil(gs, 16, 0, -7); + break; + case 3: m = "-------------------------" + "-------------------------" + "-------------------------" + "-------------------------" + "ijkl----------efgh-------" + "-------------------------" + "-------------------------" + "z----------------abcbcbbd" + "+++++++++++++++++++++++++" + "01z3450123450123450123450" + "ABCDEFABCefgfgfghFABCDEFA" + "----z--------------------" + "-------------------------" + "------z--------------ijkl" + "-------------------------" + "-------------------------" + "abdefghijkl---efghijklabd"; + new_slime(gs, 5, 0, -5); + new_slime(gs, 20, 15, -5); + new_evil(gs, 1, 0, 7); + new_evil(gs, 20, 0, 10); + new_evil(gs, 15, 0, 7); + break; + case 4: m = "0000000000000000000000000" + "1111111111111111111111111" + "2222222222222222222222222" + "3333333333333333333333333" + "4444444444444444444444444" + "555555555555z555555555555" + "66666666666ijl66666666666" + "7777777777ijlil7777777777" + "888888888ijlikkl888888888" + "99999999ijkjklikl99999999" + "AAAAAAAikjlijkjkjlAAAAAAA" + "BBBBBBiklijkjlijkjlBBBBBB" + "CCCCCijkjlikkjklikklCCCCC" + "DDDDijklijjklikjkjkklDDDD" + "EEEijkkjkjlikjkjlijjklEEE" + "FFijkjlilijkjklikjlikklFF" + "efggfggfgfgfggfgfgfgfgfgh"; + new_evil(gs, 11, 0, 5); + new_evil(gs, 10, 0, 6); + new_evil(gs, 9, 0, 7); + new_evil(gs, 8, 0, 8); + new_evil(gs, 7, 0, 9); + new_evil(gs, 6, 0, 10); + new_evil(gs, 5, 0, 11); + new_evil(gs, 4, 0, 12); + new_evil(gs, 3, 0, 13); + new_slime(gs, 1, 0, 16); + new_slime(gs, 24, 0, -14); + break; + default: + return -1; + } + pig_map_from_string(gs->pe->map, k, m); + gs->refresh_screen = gs->pe->pages; + return 0; +} + + +static GAMESTATE *init_all(SDL_Surface *screen) +{ + int i; + PIG_map *pm; + GAMESTATE *gs = (GAMESTATE *)calloc(1, sizeof(GAMESTATE)); + if(!gs) + return NULL; + + gs->running = 1; + + gs->pe = pig_open(screen); + if(!gs->pe) + { + fprintf(stderr, "Could not open the Pig Engine!\n"); + free(gs); + return NULL; + } + gs->pe->userdata = gs; + + pig_viewport(gs->pe, 0, 0, SCREEN_W, MAP_H * TILE_H); + + i = gs->lifepig = pig_sprites(gs->pe, "lifepig.png", 0, 0); + i |= gs->scorefont = pig_sprites(gs->pe, "font.png", 44, 56); + i |= gs->glassfont = pig_sprites(gs->pe, "glassfont.png", 60, 60); + i |= gs->icons = pig_sprites(gs->pe, "icons.png", 48, 48); + i |= gs->stars = pig_sprites(gs->pe, "stars.png", 32, 32); + i |= gs->pigframes = pig_sprites(gs->pe, "pigframes.png", 64, 48); + i |= gs->evil = pig_sprites(gs->pe, "evil.png", 48, 48); + i |= gs->slime = pig_sprites(gs->pe, "slime.png", 48, 48); + if(i < 0) + { + fprintf(stderr, "Could not load graphics!\n"); + pig_close(gs->pe); + free(gs); + return NULL; + } + for(i = gs->icons; i < gs->icons + 3*8; ++i) + pig_hotspot(gs->pe, i, PIG_CENTER, 45); + for(i = gs->pigframes; i < gs->pigframes + 12; ++i) + pig_hotspot(gs->pe, i, PIG_CENTER, 43); + for(i = gs->evil; i < gs->evil + 16; ++i) + pig_hotspot(gs->pe, i, PIG_CENTER, 46); + for(i = gs->slime; i < gs->slime + 16; ++i) + pig_hotspot(gs->pe, i, PIG_CENTER, 46); + + pm = pig_map_open(gs->pe, MAP_W, MAP_H); + if(!pm) + { + fprintf(stderr, "Could not create map!\n"); + pig_close(gs->pe); + free(gs); + return NULL; + } + if(pig_map_tiles(pm, "tiles.png", TILE_W, TILE_H) < 0) + { + fprintf(stderr, "Could not load background graphics!\n"); + pig_close(gs->pe); + free(gs); + return NULL; + } + + /* Mark tiles for collision detection */ + pig_map_collisions(pm, 0, 12, PIG_ALL); /* Red, green, yellov */ + pig_map_collisions(pm, 12, 17, PIG_NONE);/* Sky */ + pig_map_collisions(pm, 29, 3, PIG_ALL); /* Single R, G, Y */ + + load_level(gs, 0); + return gs; +} + + +/*---------------------------------------------------------- + Render the dashboard +----------------------------------------------------------*/ +static void dashboard(GAMESTATE *gs) +{ + SDL_Rect r; + int i, v; + float x; + float t = SDL_GetTicks() * 0.001; + r.x = 0; + r.y = SCREEN_H - 56; + r.w = SCREEN_W; + r.h = 56; + SDL_SetClipRect(gs->pe->surface, &r); + + /* Render "plasma bar" */ + for(i = 0; i < 56; ++i) + { + float f1, f2, m; + SDL_Rect cr; + cr.x = 0; + cr.w = SCREEN_W; + cr.y = SCREEN_H - 56 + i; + cr.h = 1; + f1 = .25 + .25 * sin(t * 1.7 + (float)i / SCREEN_H * 42); + f1 += .25 + .25 * sin(-t * 2.1 + (float)i / SCREEN_H * 66); + f2 = .25 + .25 * sin(t * 3.31 + (float)i / SCREEN_H * 90); + f2 += .25 + .25 * sin(-t * 1.1 + (float)i / SCREEN_H * 154); + m = sin((float)i * M_PI / 56.0); + m = sin(m * M_PI * 0.5); + m = sin(m * M_PI * 0.5); + SDL_FillRect(gs->pe->surface, + &cr, SDL_MapRGB(gs->pe->surface->format, + ((int)128.0 * f1 + 64) * m, + ((int)64.0 * f1 * f2 + 64) * m, + ((int)128.0 * f2 + 32) * m + )); + } + + /* Draw pigs... uh, lives! */ + x = -10; + for(i = 0; i < gs->lives; ++i) + { + x += 48 + gs->lives_wobble * + sin(gs->lives_wobble_time * 12) * .2; + pig_draw_sprite(gs->pe, gs->lifepig, + (int)x + gs->lives_wobble * + sin(gs->lives_wobble_time * 20 + i * 1.7), + SCREEN_H - 56/2); + } + + /* Print score */ + x = SCREEN_W + 5; + v = gs->score; + for(i = 9; i >= 0; --i) + { + int n = v % 10; + x -= 39 - gs->score_wobble * + sin(gs->score_wobble_time * 15 + i * .5); + pig_draw_sprite(gs->pe, gs->scorefont + n, (int)x, + SCREEN_H - 56/2); + v /= 10; + if(!v) + break; + } + + pig_dirty(gs->pe, &r); +} + + +/*---------------------------------------------------------- + Game logic event handlers +----------------------------------------------------------*/ +static void before_objects(PIG_engine *pe) +{ + GAMESTATE *gs = (GAMESTATE *)pe->userdata; + if(gs->lives_wobble > 0) + { + gs->lives_wobble *= 0.95; + gs->lives_wobble -= 0.3; + if(gs->lives_wobble < 0) + gs->lives_wobble = 0; + } + if(gs->score_wobble > 0) + { + gs->score_wobble *= 0.95; + gs->score_wobble -= 0.3; + if(gs->score_wobble < 0) + gs->score_wobble = 0; + } + ++gs->logic_frames; + + if(0 == gs->level) + { + switch(gs->fun_count % 60) + { + case 17: + new_powerup(gs, 250, -20, -10, POWER_LIFE); + break; + case 29: + new_powerup(gs, 550, -20, 10, POWER_LIFE); + break; + case 37: + new_powerup(gs, 250, -20, 10, POWER_BONUS2); + break; + case 51: + new_powerup(gs, 550, -20, -10, POWER_BONUS1); + break; + } + if(150 == gs->fun_count % 300) + message(gs, "Press Space!"); + ++gs->fun_count; + } +} + + +typedef enum +{ + WAITING, + WALKING, + FALLING, + KNOCKED, + NEXT_LEVEL, + DEAD +} OBJECT_states; + + +static void player_handler(PIG_object *po, const PIG_event *ev) +{ + GAMESTATE *gs = (GAMESTATE *)po->owner->userdata; + switch(ev->type) + { + case PIG_PREFRAME: + switch(po->state) + { + case WAITING: + if(1 == po->age) + message(gs, "Get ready!"); + else if(po->age > 50) + po->state = FALLING; + break; + case WALKING: + if(gs->keys[SDLK_LEFT]) + { + po->ax = -(20 + po->vx) * .4; + po->target = 3 + po->age % 4 - 1; + if(5 == po->target) + po->target = 3; + } + else if(gs->keys[SDLK_RIGHT]) + { + po->ax = (20 - po->vx) * .4; + po->target = 9 + po->age % 4 - 1; + if(11 == po->target) + po->target = 9; + } + else + { + po->ax = -po->vx * .8; + if(po->target >= 6) + po->target = (po->target + 1) % + PIG_FRAMES; + else if(po->target) + --po->target; + } + break; + case FALLING: + if(gs->keys[SDLK_LEFT]) + po->ax = -(20 + po->vx) * .2; + else if(gs->keys[SDLK_RIGHT]) + po->ax = (20 - po->vx) * .2; + else + po->ax = -po->vx * .2; + po->target = (po->target + 1) % PIG_FRAMES; + break; + } + po->timer[0] = 1; + break; + case PIG_TIMER0: + if(po->x < 0) + po->x = 0; + else if(po->x > po->owner->view.w - 1) + po->x = po->owner->view.w - 1; + switch(po->state) + { + case WALKING: + if(po->power) + --po->power; + po->image = po->target % PIG_FRAMES; + if(!pig_test_map(gs->pe, po->x, po->y + 1)) + { + po->state = FALLING; + po->ay = GRAV_ACC; + } + if(gs->jump || gs->keys[SDLK_UP]) + { + po->ay = 0; + po->vy = -JUMP_SPEED; + po->state = FALLING; + gs->jump = 0; + } + break; + case FALLING: + if(po->vy > 2) + po->power = 3; + po->ay = GRAV_ACC; + po->image = po->target; + break; + case KNOCKED: + po->power = 0; + po->ay = GRAV_ACC; + po->target = (po->target + 2) % PIG_FRAMES; + po->image = po->target; + po->ax = -po->vx * .2; + break; + case NEXT_LEVEL: + po->vx = (SCREEN_W / 2 - po->x) * .1; + po->target = (po->target + 1) % PIG_FRAMES; + po->image = po->target; + break; + case DEAD: + po->ax = po->ay = 0; + po->vx = po->vy = 0; + break; + } + if(gs->jump) + --gs->jump; + if(NEXT_LEVEL != po->state) + { + if(gs->enemycount <= 0) + { + message(gs, "Well Done!"); + po->state = NEXT_LEVEL; + po->vy = 0; + po->ay = -1; + po->tilemask = 0; + po->hitgroup = 0; + po->timer[2] = 50; + } + } + break; + + case PIG_TIMER1: + /* Snap out of KNOCKED mode */ + po->state = FALLING; + break; + + case PIG_TIMER2: + switch(po->state) + { + case NEXT_LEVEL: + add_life(gs); + pig_object_close(po); + load_level(gs, gs->level + 1); + new_player(gs); + break; + default: + pig_object_close(po); + if(!new_player(gs)) + load_level(gs, 0); + break; + } + break; + + case PIG_HIT_TILE: + if(KNOCKED == po->state) + break; + + if(ev->cinfo.sides & PIG_TOP) + { + po->y = ev->cinfo.y; + po->vy = 0; + po->ay = 0; + } + po->state = WALKING; + break; + + case PIG_HIT_OBJECT: + if(KNOCKED == po->state) + break; + + switch(ev->obj->hitgroup) + { + case GROUP_ENEMY: + if((po->power && ev->cinfo.sides & PIG_TOP) || + (po->vy - ev->obj->vy) >= 15) + { + /* Win: Stomp! */ + inc_score(gs, ev->obj->score); + ev->obj->y = ev->cinfo.y + 10; + if(po->vy > 0) + ev->obj->vy = po->vy; + else + ev->obj->vy = 10; + ev->obj->ay = GRAV_ACC; + ev->obj->tilemask = 0; + ev->obj->hitgroup = 0; + if(gs->jump || gs->keys[SDLK_UP]) + { + /* Mega jump! */ + po->vy = -(JUMP_SPEED + 7); + gs->jump = 0; + } + else + { + /* Bounce a little */ + po->vy = -15; + } + po->y = ev->cinfo.y; + po->ay = 0; + po->state = FALLING; + } + else + { + /* Lose: Knocked! */ + po->vy = -15; + po->ay = GRAV_ACC; + po->state = KNOCKED; + po->timer[1] = 11; + new_star(gs, po->x, po->y - 20, -5, 3); + new_star(gs, po->x, po->y - 20, 2, -6); + new_star(gs, po->x, po->y - 20, 4, 4); + } + break; + case GROUP_POWERUP: + switch(ev->obj->score) + { + case POWER_LIFE: + add_life(gs); + message(gs, "Extra Life!"); + break; + case POWER_BONUS1: + /* Double or 100k bonus! */ + if(gs->score < 100000) + { + inc_score_nobonus(gs, gs->score); + message(gs, "Double Score!"); + } + else + { + inc_score_nobonus(gs, 100000); + message(gs, "100 000!"); + } + break; + case POWER_BONUS2: + inc_score_nobonus(gs, 1000); + message(gs, "1000!"); + break; + } + ev->obj->state = DEAD; + ev->obj->tilemask = 0; + ev->obj->hitgroup = 0; + ev->obj->vy = -20; + ev->obj->ay = -2; + break; + } + break; + case PIG_OFFSCREEN: + /* + * Dead pigs don't care about being off-screen. + * A timer is used to remove them, and to continue + * the game with a new life. + */ + if(DEAD == po->state) + break; + if(po->y < 0) /* Above the playfield is ok. */ + break; + if(gs->lives) + message(gs, "Oiiiiiiink!!!"); + else + message(gs, "Game Over!"); + po->state = DEAD; + po->timer[2] = 50; + default: + break; + } +} + + +static void powerup_handler(PIG_object *po, const PIG_event *ev) +{ + GAMESTATE *gs = (GAMESTATE *)po->owner->userdata; + switch(ev->type) + { + case PIG_PREFRAME: + if(DEAD == po->state) + break; + po->ax = (po->target - po->vx) * .3; + po->ay = GRAV_ACC; + po->image = po->age % 8; + ++po->power; + break; + case PIG_HIT_TILE: + if(DEAD == po->state) + break; + if(po->power > 2) + po->target = -po->target; + po->power = 0; + po->vy = 0; + po->ay = 0; + po->x = ev->cinfo.x + po->vx; + po->y = ev->cinfo.y; + break; + case PIG_OFFSCREEN: + if(po->y > SCREEN_H || (po->y < -100)) + { + pig_object_close(po); + --gs->enemycount; + } + default: + break; + } +} + + +static void star_handler(PIG_object *po, const PIG_event *ev) +{ + switch(ev->type) + { + case PIG_PREFRAME: + if(po->age >= 8) + pig_object_close(po); + else + po->image = po->age; + default: + break; + } +} + + +static void evil_handler(PIG_object *po, const PIG_event *ev) +{ + GAMESTATE *gs = (GAMESTATE *)po->owner->userdata; + int look_x; + switch(ev->type) + { + case PIG_PREFRAME: + if(DEAD == po->state) + break; + po->ax = (po->target - po->vx) * .5; + po->ay = GRAV_ACC; + po->image = po->age % 16; + break; + case PIG_HIT_TILE: + if(DEAD == po->state) + break; + po->vy = 0; + po->ay = 0; + po->x = ev->cinfo.x + po->vx; + po->y = ev->cinfo.y; + break; + case PIG_OFFSCREEN: + if(po->y > SCREEN_H) + { + pig_object_close(po); + --gs->enemycount; + } + break; + case PIG_POSTFRAME: + if(DEAD == po->state) + break; + look_x = 10 + fabs(po->vx * 2); + if(po->target < 0) + look_x = -look_x; + if(!pig_test_map(po->owner, po->x + look_x, po->y + 1)) + po->target = -po->target; + default: + break; + } +} + + +static void slime_handler(PIG_object *po, const PIG_event *ev) +{ + GAMESTATE *gs = (GAMESTATE *)po->owner->userdata; + int look_x; + switch(ev->type) + { + case PIG_PREFRAME: + if(DEAD == po->state) + break; + po->ax = (po->target - po->vx) * .2; + po->ay = GRAV_ACC; + po->image = po->age % 16; + break; + case PIG_HIT_TILE: + po->vy = -(JUMP_SPEED + GRAV_ACC); + po->ay = 0; + po->y = ev->cinfo.y; + break; + case PIG_OFFSCREEN: + if(po->y > SCREEN_H) + { + pig_object_close(po); + --gs->enemycount; + } + break; + case PIG_POSTFRAME: + if(DEAD == po->state) + break; + /* Don't bother looking if we're close to a floor. */ + if(pig_test_map_vector(po->owner, + po->x, po->y, + po->x, po->y + 48, + PIG_TOP, NULL)) + break; + /* Turn around if there's no floor! */ + look_x = 10 + fabs(po->vx * 4); + if(po->target < 0) + look_x = -look_x; + if(!pig_test_map_vector(po->owner, + po->x + look_x, po->y, + po->x + look_x, SCREEN_H, + PIG_TOP, NULL)) + po->target = -po->target; + default: + break; + } +} + + +static void chain_head_handler(PIG_object *po, const PIG_event *ev) +{ + GAMESTATE *gs = (GAMESTATE *)po->owner->userdata; + switch(ev->type) + { + case PIG_PREFRAME: + po->vx = (po->target - po->x) * .3; + po->vy = 15 * cos(po->age * .3) - 9; + if((gs->messages > 1) && (1 == po->state)) + po->timer[1] = 0; + if(po->timer[1]) + break; + case PIG_TIMER1: + switch(po->state) + { + case 0: + po->timer[1] = 35; + ++po->state; + break; + case 1: + po->target = -SCREEN_W; + po->timer[1] = 50; + ++po->state; + if(gs->messages > 0) + --gs->messages; + break; + case 2: + pig_object_close(po); + break; + } + default: + break; + } +} + +static void chain_link_handler(PIG_object *po, const PIG_event *ev) +{ + PIG_object *target = pig_object_find(po, po->target); + switch(ev->type) + { + case PIG_PREFRAME: + if(target) + { + po->vx = ((target->x + FONT_SPACING) - po->x) * .6; + po->vy = (target->y - po->y) * .6 - 9; + } + else + pig_object_close(po); + default: + break; + } +} + + +/*---------------------------------------------------------- + Accounting (score, lives etc) +----------------------------------------------------------*/ + +static void add_life(GAMESTATE *gs) +{ + ++gs->lives; + gs->lives_wobble += 10; + if(gs->lives_wobble > 15) + gs->lives_wobble = 15; + gs->lives_wobble_time = 0; +} + + +static void remove_life(GAMESTATE *gs) +{ + --gs->lives; + gs->lives_wobble += 10; + if(gs->lives_wobble > 15) + gs->lives_wobble = 15; + gs->lives_wobble_time = 0; +} + + +static void inc_score_nobonus(GAMESTATE *gs, int v) +{ + int os = gs->score; + gs->score += v; + while(v) + { + gs->score_wobble += 1; + v /= 10; + } + if(gs->score_wobble > 15) + gs->score_wobble = 15; + gs->score_wobble_time = 0; + if(os / 10000 != gs->score / 10000) + new_powerup(gs, SCREEN_W / 2, -20, -4, POWER_LIFE); +} + +static void inc_score(GAMESTATE *gs, int v) +{ + int os = gs->score; + inc_score_nobonus(gs, v); + if(os / 5000 != gs->score / 5000) + new_powerup(gs, SCREEN_W / 2, -20, 8, POWER_BONUS1); + else if(os / 1000 != gs->score / 1000) + new_powerup(gs, SCREEN_W / 2, -20, -6, POWER_BONUS2); +} + + +static PIG_object *new_player(GAMESTATE *gs) +{ + PIG_object *po; + if(!gs->lives) + return NULL; + + po = pig_object_open(gs->pe, SCREEN_W / 2, -50, 1); + if(!po) + return NULL; + + remove_life(gs); + po->ibase = gs->pigframes; + po->handler = player_handler; + po->hitmask = GROUP_POWERUP | GROUP_ENEMY; + return po; +} + + +static PIG_object *new_powerup(GAMESTATE *gs, + int x, int y, int speed, POWERUPS type) +{ + PIG_object *po = pig_object_open(gs->pe, x, y, 1); + if(!po) + return NULL; + + ++gs->enemycount; + po->score = type; + po->ibase = gs->icons + 8 * po->score; + po->target = speed; + po->handler = powerup_handler; + po->tilemask = PIG_TOP; + po->hitgroup = GROUP_POWERUP; + return po; +} + + +static PIG_object *new_star(GAMESTATE *gs, int x, int y, int vx, int vy) +{ + PIG_object *po = pig_object_open(gs->pe, x + vx, y + vy, 1); + if(!po) + return NULL; + + po->ibase = gs->stars; + po->ax = -vx * 0.3; + po->vx = vx * 3; + po->ay = -vy * 0.3; + po->vy = vy * 3; + po->handler = star_handler; + return po; +} + + +static PIG_object *new_evil(GAMESTATE *gs, + int x, int y, int speed) +{ + PIG_object *po = pig_object_open(gs->pe, + x * TILE_W, y * TILE_H, 1); + if(!po) + return NULL; + + ++gs->enemycount; + po->ibase = gs->evil; + po->target = speed; + po->handler = evil_handler; + po->score = 200; + po->tilemask = PIG_TOP; + po->hitgroup = GROUP_ENEMY; + return po; +} + + +static PIG_object *new_slime(GAMESTATE *gs, + int x, int y, int speed) +{ + PIG_object *po = pig_object_open(gs->pe, + x * TILE_W, y * TILE_H, 1); + if(!po) + return NULL; + + ++gs->enemycount; + po->ibase = gs->slime; + po->target = speed; + po->handler = slime_handler; + po->score = 300; + po->tilemask = PIG_TOP; + po->hitgroup = GROUP_ENEMY; + return po; +} + + +static PIG_object *new_chain_head(GAMESTATE *gs, + int x, int y, int image, int target_x) +{ + PIG_object *po = pig_object_open(gs->pe, x, y, 1); + if(!po) + return NULL; + + po->ibase = image; + po->handler = chain_head_handler; + po->target = target_x; + return po; +} + + +static PIG_object *new_chain_link(GAMESTATE *gs, + int x, int y, int image, int target) +{ + PIG_object *po = pig_object_open(gs->pe, x, y, 1); + if(!po) + return NULL; + + po->ibase = image; + po->handler = chain_link_handler; + po->target = target; + return po; +} + + +static void message(GAMESTATE *gs, const char *s) +{ + int i = 0; + const int x = SCREEN_W + FONT_SPACING; + const int y = MAP_H * TILE_H - 30; + int tx = (SCREEN_W - ((signed)strlen(s) - 1) * FONT_SPACING) / 2; + PIG_object *po = NULL; + while(s[i]) + { + int c = toupper(s[i]) - 32 + gs->glassfont; + if(0 == i) + po = new_chain_head(gs, x, y, c, tx); + else + po = new_chain_link(gs, x, y, c, po->id); + if(!po) + return; + ++i; + } + ++gs->messages; +} + + +static int start_game(GAMESTATE *gs) +{ + if(0 != gs->level) + return 0; /* Already playing! --> */ + + gs->score = 0; + gs->lives = 5; + + if(load_level(gs, 1) < 0) + return -1; + + gs->player = new_player(gs); + if(!gs->player) + return -1; + + return 0; +} + + +/*---------------------------------------------------------- + Input; events and game control keys +----------------------------------------------------------*/ +static void handle_input(GAMESTATE *gs, SDL_Event *ev) +{ + switch(ev->type) + { + case SDL_MOUSEBUTTONUP: + break; + case SDL_KEYDOWN: + switch(ev->key.keysym.sym) + { + case SDLK_UP: + gs->jump = 3; + break; + case SDLK_F1: + gs->pe->interpolation = !gs->pe->interpolation; + if(gs->pe->interpolation) + message(gs, "Interpolation: ON"); + else + message(gs, "Interpolation: OFF"); + break; + case SDLK_F2: + gs->pe->direct = !gs->pe->direct; + if(gs->pe->direct) + message(gs, "Rendering: Direct"); + else + message(gs, "Rendering: Buffered"); + break; + case SDLK_F3: + gs->pe->show_dirtyrects = !gs->pe->show_dirtyrects; + if(gs->pe->show_dirtyrects) + message(gs, "Dirtyrects: ON"); + else + message(gs, "Dirtyrects: OFF"); + break; + case SDLK_F4: + gs->nice = !gs->nice; + if(gs->nice) + message(gs, "Be Nice: ON"); + else + message(gs, "Be Nice: OFF"); + break; + case SDLK_SPACE: + start_game(gs); + default: + break; + } + break; + case SDL_KEYUP: + switch(ev->key.keysym.sym) + { + case SDLK_ESCAPE: + gs->running = 0; + default: + break; + } + break; + case SDL_QUIT: + gs->running = 0; + break; + } +} + + +static void handle_keys(GAMESTATE *gs) +{ +} + + +static int break_received = 0; + +#ifndef RETSIGTYPE +#define RETSIGTYPE void +#endif +static RETSIGTYPE breakhandler(int sig) +{ + /* For platforms that drop the handlers on the first signal... */ + signal(SIGTERM, breakhandler); + signal(SIGINT, breakhandler); + break_received = 1; +#if (RETSIGTYPE != void) + return 0; +#endif +} + + +/*---------------------------------------------------------- + main() +----------------------------------------------------------*/ +int main(int argc, char* argv[]) +{ + SDL_Surface *screen; + GAMESTATE *gs; + int i; + int bpp = 0; + int last_tick, start_time, end_time; + int dashframe; + float logic_fps = 20.0; + int flags = SDL_DOUBLEBUF | SDL_HWSURFACE; + + SDL_Init(SDL_INIT_VIDEO); + atexit(SDL_Quit); + signal(SIGTERM, breakhandler); + signal(SIGINT, breakhandler); + + for(i = 1; i < argc; ++i) + { + if(strncmp(argv[i], "-s", 2) == 0) + flags &= ~SDL_DOUBLEBUF; + else if(strncmp(argv[i], "-f", 2) == 0) + flags |= SDL_FULLSCREEN; + else + bpp = atoi(&argv[i][1]); + } + + screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, bpp, flags); + if(!screen) + { + fprintf(stderr, "Failed to open screen!\n"); + return 1; + } + + SDL_WM_SetCaption("Fixed Rate Pig", "Pig"); + SDL_ShowCursor(0); + + gs = init_all(screen); + if(!gs) + return 1; + + gs->keys = SDL_GetKeyState(&i); + + gs->logic_frames = 0; + gs->rendered_frames = 0; + gs->pe->before_objects = before_objects; + + pig_start(gs->pe, 0); + gs->refresh_screen = gs->pe->pages; + start_time = last_tick = SDL_GetTicks(); + while(gs->running) + { + int tick; + float frames, dt; + SDL_Event ev; + + /* Handle input */ + while(SDL_PollEvent(&ev) > 0) + handle_input(gs, &ev); + handle_keys(gs); + if(break_received) + gs->running = 0; + + /* Calculate time since last update */ + tick = SDL_GetTicks(); + dt = (tick - last_tick) * 0.001; + frames = dt * logic_fps; + + /* Run the game logic */ + pig_animate(gs->pe, frames); + + /* + * Limit the dashboard frame rate to 15 fps + * when there's no wobbling going on. + * + * The 'dashframe' deal is about keeping the + * pages in sync on a double buffered display. + */ + if(gs->lives_wobble || gs->score_wobble || + (gs->dashboard_time > 1.0/15.0)) + { + dashframe = gs->pe->pages; + gs->dashboard_time = 0; + } + if(dashframe) + { + --dashframe; + dashboard(gs); + } + + /* Update sprites */ + if(gs->refresh_screen) + { + --gs->refresh_screen; + pig_refresh_all(gs->pe); + } + else + pig_refresh(gs->pe); + + /* Make the new frame visible */ + pig_flip(gs->pe); + + /* Update statistics, timers and stuff */ + ++gs->rendered_frames; + gs->lives_wobble_time += dt; + gs->score_wobble_time += dt; + gs->dashboard_time += dt; + + last_tick = tick; + if(gs->nice) + SDL_Delay(10); + } + + /* Print some statistics */ + end_time = SDL_GetTicks(); + i = end_time - start_time; + printf(" Total time running: %d ms\n", i); + if(!i) + i = 1; + printf("Average rendering frame rate: %.2f fps\n", + gs->rendered_frames * 1000.0 / i); + printf(" Average logic frame rate: %.2f fps\n", + gs->logic_frames * 1000.0 / i); + + pig_close(gs->pe); + return 0; +} diff --git a/programs/games/pig/trunk/pigframes.png b/programs/games/pig/trunk/pigframes.png new file mode 100644 index 0000000000..fbeb0a6936 Binary files /dev/null and b/programs/games/pig/trunk/pigframes.png differ diff --git a/programs/games/pig/trunk/slime.png b/programs/games/pig/trunk/slime.png new file mode 100644 index 0000000000..1b5c1002ad Binary files /dev/null and b/programs/games/pig/trunk/slime.png differ diff --git a/programs/games/pig/trunk/stars.png b/programs/games/pig/trunk/stars.png new file mode 100644 index 0000000000..bd0c2d9575 Binary files /dev/null and b/programs/games/pig/trunk/stars.png differ diff --git a/programs/games/pig/trunk/tiles.png b/programs/games/pig/trunk/tiles.png new file mode 100644 index 0000000000..822c9dde6b Binary files /dev/null and b/programs/games/pig/trunk/tiles.png differ diff --git a/programs/games/soko/trunk/100BOXES.LEV b/programs/games/soko/trunk/100BOXES.LEV new file mode 100644 index 0000000000..b7836270df Binary files /dev/null and b/programs/games/soko/trunk/100BOXES.LEV differ diff --git a/programs/games/soko/trunk/990602.LEV b/programs/games/soko/trunk/990602.LEV new file mode 100644 index 0000000000..541a5c72ff Binary files /dev/null and b/programs/games/soko/trunk/990602.LEV differ diff --git a/programs/games/soko/trunk/AENIGMA.LEV b/programs/games/soko/trunk/AENIGMA.LEV new file mode 100644 index 0000000000..5ebb8f6b82 Binary files /dev/null and b/programs/games/soko/trunk/AENIGMA.LEV differ diff --git a/programs/games/soko/trunk/ALBG-BST.LEV b/programs/games/soko/trunk/ALBG-BST.LEV new file mode 100644 index 0000000000..3d7117a684 Binary files /dev/null and b/programs/games/soko/trunk/ALBG-BST.LEV differ diff --git a/programs/games/soko/trunk/ALBG1-1.LEV b/programs/games/soko/trunk/ALBG1-1.LEV new file mode 100644 index 0000000000..d300957a98 Binary files /dev/null and b/programs/games/soko/trunk/ALBG1-1.LEV differ diff --git a/programs/games/soko/trunk/ALBG1-2.LEV b/programs/games/soko/trunk/ALBG1-2.LEV new file mode 100644 index 0000000000..2867ea5c03 Binary files /dev/null and b/programs/games/soko/trunk/ALBG1-2.LEV differ diff --git a/programs/games/soko/trunk/ALBG1-3.LEV b/programs/games/soko/trunk/ALBG1-3.LEV new file mode 100644 index 0000000000..5adc825093 Binary files /dev/null and b/programs/games/soko/trunk/ALBG1-3.LEV differ diff --git a/programs/games/soko/trunk/AUTOGEN.LEV b/programs/games/soko/trunk/AUTOGEN.LEV new file mode 100644 index 0000000000..6b75a73a0d Binary files /dev/null and b/programs/games/soko/trunk/AUTOGEN.LEV differ diff --git a/programs/games/soko/trunk/BAGLE.LEV b/programs/games/soko/trunk/BAGLE.LEV new file mode 100644 index 0000000000..43e063aa43 Binary files /dev/null and b/programs/games/soko/trunk/BAGLE.LEV differ diff --git a/programs/games/soko/trunk/BAGLE2.LEV b/programs/games/soko/trunk/BAGLE2.LEV new file mode 100644 index 0000000000..f012169e90 Binary files /dev/null and b/programs/games/soko/trunk/BAGLE2.LEV differ diff --git a/programs/games/soko/trunk/BOXXLE1.LEV b/programs/games/soko/trunk/BOXXLE1.LEV new file mode 100644 index 0000000000..01231ba101 Binary files /dev/null and b/programs/games/soko/trunk/BOXXLE1.LEV differ diff --git a/programs/games/soko/trunk/BOXXLE2.LEV b/programs/games/soko/trunk/BOXXLE2.LEV new file mode 100644 index 0000000000..9d58ce2da6 Binary files /dev/null and b/programs/games/soko/trunk/BOXXLE2.LEV differ diff --git a/programs/games/soko/trunk/CANTRIP.LEV b/programs/games/soko/trunk/CANTRIP.LEV new file mode 100644 index 0000000000..c01226b50f Binary files /dev/null and b/programs/games/soko/trunk/CANTRIP.LEV differ diff --git a/programs/games/soko/trunk/CANTRIP2.LEV b/programs/games/soko/trunk/CANTRIP2.LEV new file mode 100644 index 0000000000..a6f37f651d Binary files /dev/null and b/programs/games/soko/trunk/CANTRIP2.LEV differ diff --git a/programs/games/soko/trunk/CELLTYPE.INC b/programs/games/soko/trunk/CELLTYPE.INC new file mode 100644 index 0000000000..3d40f0153b --- /dev/null +++ b/programs/games/soko/trunk/CELLTYPE.INC @@ -0,0 +1,28 @@ + +EOF equ 0xf0 ; image index: +macro EndConf {db 0xff} +tEmpty equ 0000b ; (0xf) - missing +tPlace equ 0001b ; 9 +tPlayer equ 0010b ; 0 +tWall equ 0100b ; 1 +tBlock equ 0110b ; 5 + +tHole equ 0111b ; 2 +tConnect equ 1000b ; 7 +tStConnect equ 1001b ; 8 +tPlate equ 1010b ; 3 +tBroken equ 1011b ; 4 + +tLaserW equ 1100b ; 0xa +tLaserS equ 1101b ; 0xa +tLaserN equ 1110b ; 0xa +tLaserE equ 1111b ; 0xa + +tRedB equ 1000b ; 0xc +tBluB equ 1001b ; 0xb +tGrnB equ 1010b ; 0xd +tYelB equ 1011b ; 0xe + +sSokoban equ 0xf1 +sSokolor equ 0xf2 +sSokonex equ 0xf3 \ No newline at end of file diff --git a/programs/games/soko/trunk/CNF b/programs/games/soko/trunk/CNF new file mode 100644 index 0000000000..efde248014 Binary files /dev/null and b/programs/games/soko/trunk/CNF differ diff --git a/programs/games/soko/trunk/CNF.ASM b/programs/games/soko/trunk/CNF.ASM new file mode 100644 index 0000000000..677a39fdfb --- /dev/null +++ b/programs/games/soko/trunk/CNF.ASM @@ -0,0 +1,102 @@ +include "celltype.inc" + +macro Header name, game_type, x, y +{ + db game_type,x,y + local ..label + db ..label-$-1 + db name + ..label: +} + +macro C cell,cnt +{ + if cnt eq + db (cell shl 4) + else + db (cell shl 4)+cnt-1 + end if +} + + +Header 'Sokonex test', sSokonex, 6, 6 + +; # Wall; + Connector; * Player; B Block + +; ###### +; # + # +; # # +; # ++ # +; #* # +; ###### + +C tWall,7 + +C tEmpty,2 +C tConnect +C tEmpty + +C tWall,2 +C tEmpty,4 +C tWall,2 +C tEmpty + +C tConnect,2 +C tEmpty +C tWall,2 +C tPlayer + +C tEmpty,3 +C tWall,7 + +EndConf + +Header 'Just push!', sSokoban, 9, 8 + +; ##### +; ### ### +; # @@@ # +; # # # # +; ## #B# ## +; # B * B # +; # # # +; ######### + +C tEmpty,2 +C tWall,5 +C tEmpty,2 + +C tWall,3 +C tEmpty,3 +C tWall,4 +C tEmpty,2 +C tPlace,3 +C tEmpty,2 +C tWall,2 +C tEmpty,2 + +C tWall +C tEmpty +C tWall +C tEmpty,2 +C tWall,3 +C tEmpty +C tWall +C tBlock +C tWall +C tEmpty +C tWall,3 +C tEmpty +C tBlock +C tEmpty +C tPlayer +C tEmpty +C tBlock +C tEmpty +C tWall,2 +C tEmpty,3 +C tWall +C tEmpty,3 +C tWall,10 + +EndConf diff --git a/programs/games/soko/trunk/DH1.LEV b/programs/games/soko/trunk/DH1.LEV new file mode 100644 index 0000000000..dc526c4818 Binary files /dev/null and b/programs/games/soko/trunk/DH1.LEV differ diff --git a/programs/games/soko/trunk/DH2.LEV b/programs/games/soko/trunk/DH2.LEV new file mode 100644 index 0000000000..cbef4b7a14 Binary files /dev/null and b/programs/games/soko/trunk/DH2.LEV differ diff --git a/programs/games/soko/trunk/DIM-YORK.LEV b/programs/games/soko/trunk/DIM-YORK.LEV new file mode 100644 index 0000000000..45d4924208 Binary files /dev/null and b/programs/games/soko/trunk/DIM-YORK.LEV differ diff --git a/programs/games/soko/trunk/ERIM.LEV b/programs/games/soko/trunk/ERIM.LEV new file mode 100644 index 0000000000..accd36cfe1 Binary files /dev/null and b/programs/games/soko/trunk/ERIM.LEV differ diff --git a/programs/games/soko/trunk/FPOK.LEV b/programs/games/soko/trunk/FPOK.LEV new file mode 100644 index 0000000000..7fa30fbcc6 Binary files /dev/null and b/programs/games/soko/trunk/FPOK.LEV differ diff --git a/programs/games/soko/trunk/GRIG2001.LEV b/programs/games/soko/trunk/GRIG2001.LEV new file mode 100644 index 0000000000..c931b43074 Binary files /dev/null and b/programs/games/soko/trunk/GRIG2001.LEV differ diff --git a/programs/games/soko/trunk/GRIG2002.LEV b/programs/games/soko/trunk/GRIG2002.LEV new file mode 100644 index 0000000000..084537addb Binary files /dev/null and b/programs/games/soko/trunk/GRIG2002.LEV differ diff --git a/programs/games/soko/trunk/HANDMADE.LEV b/programs/games/soko/trunk/HANDMADE.LEV new file mode 100644 index 0000000000..258ea3c79c Binary files /dev/null and b/programs/games/soko/trunk/HANDMADE.LEV differ diff --git a/programs/games/soko/trunk/HEYTAK.LEV b/programs/games/soko/trunk/HEYTAK.LEV new file mode 100644 index 0000000000..55702f50c0 Binary files /dev/null and b/programs/games/soko/trunk/HEYTAK.LEV differ diff --git a/programs/games/soko/trunk/HOWARD1.LEV b/programs/games/soko/trunk/HOWARD1.LEV new file mode 100644 index 0000000000..23fbab31ec Binary files /dev/null and b/programs/games/soko/trunk/HOWARD1.LEV differ diff --git a/programs/games/soko/trunk/HOWARD2.LEV b/programs/games/soko/trunk/HOWARD2.LEV new file mode 100644 index 0000000000..a75f803484 Binary files /dev/null and b/programs/games/soko/trunk/HOWARD2.LEV differ diff --git a/programs/games/soko/trunk/HOWARD3.LEV b/programs/games/soko/trunk/HOWARD3.LEV new file mode 100644 index 0000000000..18ceaffbc5 Binary files /dev/null and b/programs/games/soko/trunk/HOWARD3.LEV differ diff --git a/programs/games/soko/trunk/HOWARD4.LEV b/programs/games/soko/trunk/HOWARD4.LEV new file mode 100644 index 0000000000..83d4431b6d Binary files /dev/null and b/programs/games/soko/trunk/HOWARD4.LEV differ diff --git a/programs/games/soko/trunk/JCD.LEV b/programs/games/soko/trunk/JCD.LEV new file mode 100644 index 0000000000..c570dd4e45 Binary files /dev/null and b/programs/games/soko/trunk/JCD.LEV differ diff --git a/programs/games/soko/trunk/JCT.LEV b/programs/games/soko/trunk/JCT.LEV new file mode 100644 index 0000000000..ae21dfd638 Binary files /dev/null and b/programs/games/soko/trunk/JCT.LEV differ diff --git a/programs/games/soko/trunk/KOKOBAN.LEV b/programs/games/soko/trunk/KOKOBAN.LEV new file mode 100644 index 0000000000..4fa1989608 Binary files /dev/null and b/programs/games/soko/trunk/KOKOBAN.LEV differ diff --git a/programs/games/soko/trunk/KOMPACT.LEV b/programs/games/soko/trunk/KOMPACT.LEV new file mode 100644 index 0000000000..7397357ef4 Binary files /dev/null and b/programs/games/soko/trunk/KOMPACT.LEV differ diff --git a/programs/games/soko/trunk/LOMA.LEV b/programs/games/soko/trunk/LOMA.LEV new file mode 100644 index 0000000000..2f7e9e5876 Binary files /dev/null and b/programs/games/soko/trunk/LOMA.LEV differ diff --git a/programs/games/soko/trunk/MACROS.INC b/programs/games/soko/trunk/MACROS.INC new file mode 100644 index 0000000000..4cb0765ce7 --- /dev/null +++ b/programs/games/soko/trunk/MACROS.INC @@ -0,0 +1,189 @@ +; new application structure +macro meos_app_start + { + use32 + org 0x0 + + db 'MENUET01' + dd 0x01 + dd __start + dd __end + dd __memory + dd __stack + + if used __params & ~defined __params + dd __params + else + dd 0x0 + end if + + dd 0x0 + } +MEOS_APP_START fix meos_app_start + +macro code + { + __start: + } +CODE fix code + +macro data + { + __data: + } +DATA fix data + +macro udata + { + if used __params & ~defined __params + __params: + db 0 + __end: + rb 255 + else + __end: + end if + __udata: + } +UDATA fix udata + +macro meos_app_end + { + align 32 + rb 2048 + __stack: + __memory: + } +MEOS_APP_END fix meos_app_end + + + +; language for programs +lang fix ru ; ru en fr ge fi +;lang equ ru + + +; optimize the code for size +macro add arg1,arg2 + { + if arg1 in + if arg2 eqtype 0 + if arg2 = 1 + inc arg1 + else + add arg1,arg2 + end if + else + add arg1,arg2 + end if + else + add arg1,arg2 + end if + } + +macro sub arg1,arg2 + { + if arg2 eqtype 0 + if arg2 = 1 + dec arg1 + else + sub arg1,arg2 + end if + else + sub arg1,arg2 + end if + } + +macro mov arg1,arg2 + { + if arg1 in + if arg2 eqtype 0 + if arg2 = 0 + xor arg1,arg1 + else if arg2 = 1 + xor arg1,arg1 + inc arg1 + else if arg2 = -1 + or arg1,-1 + else if arg2 > -128 & arg2 < 128 + push arg2 + pop arg1 + else + mov arg1,arg2 + end if + else + mov arg1,arg2 + end if + else + mov arg1,arg2 + end if + } + + +macro struct name + { + virtual at 0 + name name + sizeof.#name = $ - name + end virtual + } + +; structures used in MeOS +struc process_information + { + .cpu_usage dd ? ; +0 + .window_stack_position dw ? ; +4 + .window_stack_value dw ? ; +6 + .not_used1 dw ? ; +8 + .process_name rb 12 ; +10 + .memory_start dd ? ; +22 + .used_memory dd ? ; +26 + .PID dd ? ; +30 + .x_start dd ? ; +34 + .y_start dd ? ; +38 + .x_size dd ? ; +42 + .y_size dd ? ; +46 + .slot_state dw ? ; +50 + rb (1024-52) + } +struct process_information + +struc system_colors + { + .frame dd ? + .grab dd ? + .grab_button dd ? + .grab_button_text dd ? + .grab_text dd ? + .work dd ? + .work_button dd ? + .work_button_text dd ? + .work_text dd ? + .work_graph dd ? + } +struct system_colors + + +; constants + +; events +EV_IDLE = 0 +EV_TIMER = 0 +EV_REDRAW = 1 +EV_KEY = 2 +EV_BUTTON = 3 +EV_EXIT = 4 +EV_BACKGROUND = 5 +EV_MOUSE = 6 +EV_IPC = 7 +EV_STACK = 8 + +; event mask bits for function 40 +EVM_REDRAW = 1b +EVM_KEY = 10b +EVM_BUTTON = 100b +EVM_EXIT = 1000b +EVM_BACKGROUND = 10000b +EVM_MOUSE = 100000b +EVM_IPC = 1000000b +EVM_STACK = 10000000b \ No newline at end of file diff --git a/programs/games/soko/trunk/MAELSTRM.LEV b/programs/games/soko/trunk/MAELSTRM.LEV new file mode 100644 index 0000000000..58c14b0e2a Binary files /dev/null and b/programs/games/soko/trunk/MAELSTRM.LEV differ diff --git a/programs/games/soko/trunk/MARIOB.LEV b/programs/games/soko/trunk/MARIOB.LEV new file mode 100644 index 0000000000..62c13c787a Binary files /dev/null and b/programs/games/soko/trunk/MARIOB.LEV differ diff --git a/programs/games/soko/trunk/MASMICRO.LEV b/programs/games/soko/trunk/MASMICRO.LEV new file mode 100644 index 0000000000..64c17eeebf Binary files /dev/null and b/programs/games/soko/trunk/MASMICRO.LEV differ diff --git a/programs/games/soko/trunk/MASSASQ.LEV b/programs/games/soko/trunk/MASSASQ.LEV new file mode 100644 index 0000000000..22f1df9284 Binary files /dev/null and b/programs/games/soko/trunk/MASSASQ.LEV differ diff --git a/programs/games/soko/trunk/MICRCOSM.LEV b/programs/games/soko/trunk/MICRCOSM.LEV new file mode 100644 index 0000000000..b37987b105 Binary files /dev/null and b/programs/games/soko/trunk/MICRCOSM.LEV differ diff --git a/programs/games/soko/trunk/MICROBAN.LEV b/programs/games/soko/trunk/MICROBAN.LEV new file mode 100644 index 0000000000..122a1569db Binary files /dev/null and b/programs/games/soko/trunk/MICROBAN.LEV differ diff --git a/programs/games/soko/trunk/MINICOSM.LEV b/programs/games/soko/trunk/MINICOSM.LEV new file mode 100644 index 0000000000..431a9f7276 Binary files /dev/null and b/programs/games/soko/trunk/MINICOSM.LEV differ diff --git a/programs/games/soko/trunk/NABOCOSM.LEV b/programs/games/soko/trunk/NABOCOSM.LEV new file mode 100644 index 0000000000..ac7c497e91 Binary files /dev/null and b/programs/games/soko/trunk/NABOCOSM.LEV differ diff --git a/programs/games/soko/trunk/NOVOBAN.LEV b/programs/games/soko/trunk/NOVOBAN.LEV new file mode 100644 index 0000000000..245ff5b78f Binary files /dev/null and b/programs/games/soko/trunk/NOVOBAN.LEV differ diff --git a/programs/games/soko/trunk/NUMBERS.LEV b/programs/games/soko/trunk/NUMBERS.LEV new file mode 100644 index 0000000000..3522aa5004 Binary files /dev/null and b/programs/games/soko/trunk/NUMBERS.LEV differ diff --git a/programs/games/soko/trunk/ONLINE.LEV b/programs/games/soko/trunk/ONLINE.LEV new file mode 100644 index 0000000000..74e1226970 Binary files /dev/null and b/programs/games/soko/trunk/ONLINE.LEV differ diff --git a/programs/games/soko/trunk/ORIGINAL.LEV b/programs/games/soko/trunk/ORIGINAL.LEV new file mode 100644 index 0000000000..24601d5714 Binary files /dev/null and b/programs/games/soko/trunk/ORIGINAL.LEV differ diff --git a/programs/games/soko/trunk/PICOCOSM.LEV b/programs/games/soko/trunk/PICOCOSM.LEV new file mode 100644 index 0000000000..0bb7e29c7e Binary files /dev/null and b/programs/games/soko/trunk/PICOCOSM.LEV differ diff --git a/programs/games/soko/trunk/RULES.TXT b/programs/games/soko/trunk/RULES.TXT new file mode 100644 index 0000000000..3d929d6273 --- /dev/null +++ b/programs/games/soko/trunk/RULES.TXT @@ -0,0 +1,180 @@ +SOKOBAN FOR MENUET v0.1 July 2, 2004 + Written in pure assembler by Ivushkin Andrey aka Willow + Main idea, art & graphics + Sokofun for Windows 95 by Games 4 Brains + and Sokoban 2.3 by BjЎrn Kфllmark + + Level designers: + + Alberto Garcia, Aymeric du Peloux, Brian Kent, David Holland, + David W Skinner, Erim Sever, Evgeniy Grigoriev, Franчois Marques, + Frantisek Pokorny, Howard Abed,J franklin Mentzer, Jaques Duthen, + John C Davis, John Polhemus, Kobus Theron, Lee Haywood, Mario Bonenfant, + Martin P Holland, Mic (Jan Reineke), Phil Shapiro, Richard Weston, + Sven Egevad, Ken'ichiro Takahashi (takaken), Thinking Rabbit, + Yoshio Murase, ZICO (Zbigniew Kornas) + + Special thanks to Hirohiko Nakamiya + + More credits: + Masato Hiramatsu, Kazuo Fukushima, Klaus Clemens + + Game uses its own format of levelset files *.LEV + with simple run-length compression + +!!!!NB!!!! +It is strongly recommended that you place application files into C:\menuetos +directory. Otherwise you should change CUR_DIR (SOKO.ASM, line 30) to the +appropriate value! + +Interface + +When loaded, application opens skin file SKIN.RAW in the current directory. +It is an image 16x240 pt. Then so-named "standard" levels SOKO-?.LEV are +read in the same dir. ? means a number within 0 and 9. +You can navigate along the level list pressing PgUp and PgDn keys. User +selects the level desired by pressing keys 0-9. Space key moves focus to the +text field below, so you can enter filename there. +Additional levels are in program subfolder LEV. For example, you wish to load +a levelset file /HD/1/MENUETOS/LEV/AENIGMA.LEV. Then you should enter +lev/aenigma.lev +Within the textbox user can press Backspace. There's no cursor yet :-( +Pressing Enter in the text field is equvalent for button "Load file". + +When in game, pressing Esc restarts the level, pressing Home returns back to +the levelset selection mode. + +Game Rules + +You have a little PUSHER. You will guide him using the cursor-keys. + +SOKOBAN (same as SOKOBLUE or SOKOWAHN) + The pink pyramids have to be pushed onto the marked places. + The problem is: You can only push things, but not pull them. + A level is solved when every pyramid stands on a marked place. + +SOKOLOR + Tiles of the same colour need to be pushed together. + +SOKONEX + Push all CONNECTOR-TILES together! + + Game-items of SOKONEX and their properties: + + PLATE: undestructable, movable, covers holes + HOLE: you can push LASERS and BROKEN PLATES into them + BROKEN PLATE: destructable, movable + CONNECTOR: undestructable, movable + FIXED CONNECTOR: undestructable, not movable + LASER: destructable, movable + BEAM: eleminates LASERS and BROKEN PLATES, paralyses PUSHERS + +The objective is always the same: You must push boxes the right way. +Sometimes tasks seem to be impossible. +But, be sure: There is always a solution! + +To-Do list: + +1. Better interface - I saw XTREE and understood that it's really possible to + write wonderful programs for MenuetOS easily. +2. More skins. And lesser file size... +3. Improve user interaction, I think. +4. Level Editor. Having a great wish you may compose levelsets by yourself and + compile them with FASM - see files CNF.ASM and CNF. +5. Correct bugs, make improvements from opinions of you, respective users of + this application ;-) +6. Include support for XTREE dialogs. + +**************************************** +**************************************** + +СОКОБАН ДЛЯ MENUET v0.1 2 июля 2004 г. + + Написана на чистом ассемблере Ивушкиным Андреем (Willow) + Главная идея, рисунки и графика + Sokofun for Windows 95 от Games 4 Brains + и Sokoban 2.3 от BjЎrn Kфllmark + + Дизайнеры уровней: + + Alberto Garcia, Aymeric du Peloux, Brian Kent, David Holland, + David W Skinner, Erim Sever, Evgeniy Grigoriev, Franчois Marques, + Frantisek Pokorny, Howard Abed,J franklin Mentzer, Jaques Duthen, + John C Davis, John Polhemus, Kobus Theron, Lee Haywood, Mario Bonenfant, + Martin P Holland, Mic (Jan Reineke), Phil Shapiro, Richard Weston, + Sven Egevad, Ken'ichiro Takahashi (takaken), Thinking Rabbit, + Yoshio Murase, ZICO (Zbigniew Kornas) + + Особая благодарность Hirohiko Nakamiya + + Еще благодарности: + Masato Hiramatsu, Kazuo Fukushima, Klaus Clemens + + В игре используется специальный формат файлов уровней *.LEV + с тривиальным сжатием информации + +!!!!NB!!!! +Настоятельно рекомендуется поместить файлы программы в каталог C:\menuetos. +В противном случае Вам придется изменить константу CUR_DIR в файле +SOKO.ASM на строке 30 соответсвующим значением! + +Интерфейс + +При запуске программа открывает файл скинов для игровых объектов SKIN.RAW +в собственном каталоге. Это картинка размером 16х240 точек. Затем в этом +же каталоге читаются так называемые "стандартные" уровни SOKO-?.LEV, где +? - число от 0 до 9. +По списку уровней можно передвигаться клавишами PgUp и PgDn. Желаемый уровень +выбирается нажатием клавиш от 0 до 9. +Нажатие пробела переносит фокус на текстовое поле ввода имени файла уровня. +Дополнительные уровни находятся в подкаталоге LEV программы. Допустим, вы +хотите загрузить файл уровней /HD/1/MENUETOS/LEV/AENIGMA.LEV. Тогда следует +ввести строку lev/aenigma.lev +В поле действует клавиша Backspace. Курсор пока не реализован :-( Нажатие +Enter в строке ввода эквивалентно кнопке 'Загрузить'. + +В режиме игры нажатие Esc производит рестарт уровня, нажатие Home выводит +из игры обратно к списку уровней. + +Правила игры + +В этой игре у вас есть ТОЛКАТЕЛЬ, которым можно управлять клавишами стрелок. + +СОКОБАН (иначе СОКОБЛЮ :-) или СОКОВАН) + Розовые пирамидки нужно передвинуть на специальные клетки. + Проблема в том, что можно только толкать предметы, но не тащить их. + Уровень решен, когда каждая пирамидка находится на маркерной клетке. + +СОКОЛОР + Блоки одинакового цвета нужно подтолкать друг к другу. + +СОКОНЕКС + Все блоки-коннекторы нужно подтолкать друг к другу. + + Объекты в игре СОКОНЕКС и их свойства: + + ПЛИТА: неуничтожаемая, подвижная, закрывает ДЫРЫ + ДЫРА: туда можно сталкивать ЛАЗЕРЫ и РАЗБИТЫЕ ПЛИТЫ + РАЗБИТАЯ ПЛИТА: уничтожаемая, подвижная + КОННЕКТОР: неуничтожаемый, подвижный + ФИКС-КОННЕКТОР: неуничтожаемый, подвижный + ЛАЗЕР: уничтожаемый, подвижный + ЛАЗЕРНЫЙ ЛУЧ: уничтожает ЛАЗЕРЫ и РАЗБИТЫЕ ПЛИТЫ, парализует ТОЛКАТЕЛЯ (!) + +Цель игры всегда одинакова: Вы должны правильно переставлять блоки. +Иногда задание кажется невыполнимым. +Но будьте уверены: всегда есть решение! + +Что еще можно сделать: + +1. Покрасивше интерфейс - после XTREE я понял, что для Menuet можно + относительно легко писать очень красивые программы. +2. Дополнительные скины - для гурманов. И меньше размер файлов сделать: + 11 кб как-никак на дороге не валяются +3. Улучшить управление - мне так кажется. +4. Редактор уровней. При особом желании файлы уровней можно писать вручную и + компилировать FASM'ом - см. файлы CNF.ASM и CNF. +5. Исправить баги, внести улучшения и учесть пожелания Вас, уважаемых + пользователей данной программы ;-) +6. Включить поддержку диалогов из XTREE. + diff --git a/programs/games/soko/trunk/SASQ_.LEV b/programs/games/soko/trunk/SASQ_.LEV new file mode 100644 index 0000000000..d0dcbb6443 Binary files /dev/null and b/programs/games/soko/trunk/SASQ_.LEV differ diff --git a/programs/games/soko/trunk/SASQ_III.LEV b/programs/games/soko/trunk/SASQ_III.LEV new file mode 100644 index 0000000000..94fd6a8f25 Binary files /dev/null and b/programs/games/soko/trunk/SASQ_III.LEV differ diff --git a/programs/games/soko/trunk/SASQ_IV.LEV b/programs/games/soko/trunk/SASQ_IV.LEV new file mode 100644 index 0000000000..ae434d8dda Binary files /dev/null and b/programs/games/soko/trunk/SASQ_IV.LEV differ diff --git a/programs/games/soko/trunk/SASQ_V.LEV b/programs/games/soko/trunk/SASQ_V.LEV new file mode 100644 index 0000000000..e940de9cf1 Binary files /dev/null and b/programs/games/soko/trunk/SASQ_V.LEV differ diff --git a/programs/games/soko/trunk/SASQ_VI.LEV b/programs/games/soko/trunk/SASQ_VI.LEV new file mode 100644 index 0000000000..e7d965f49e Binary files /dev/null and b/programs/games/soko/trunk/SASQ_VI.LEV differ diff --git a/programs/games/soko/trunk/SIMPLE.LEV b/programs/games/soko/trunk/SIMPLE.LEV new file mode 100644 index 0000000000..9bd0455095 Binary files /dev/null and b/programs/games/soko/trunk/SIMPLE.LEV differ diff --git a/programs/games/soko/trunk/SKIN.RAW b/programs/games/soko/trunk/SKIN.RAW new file mode 100644 index 0000000000..2a57a4501a Binary files /dev/null and b/programs/games/soko/trunk/SKIN.RAW differ diff --git a/programs/games/soko/trunk/SOKEVO.LEV b/programs/games/soko/trunk/SOKEVO.LEV new file mode 100644 index 0000000000..42ca104d97 Binary files /dev/null and b/programs/games/soko/trunk/SOKEVO.LEV differ diff --git a/programs/games/soko/trunk/SOKHARD.LEV b/programs/games/soko/trunk/SOKHARD.LEV new file mode 100644 index 0000000000..d0a77f68e9 Binary files /dev/null and b/programs/games/soko/trunk/SOKHARD.LEV differ diff --git a/programs/games/soko/trunk/SOKO b/programs/games/soko/trunk/SOKO new file mode 100644 index 0000000000..3ed1bb7352 Binary files /dev/null and b/programs/games/soko/trunk/SOKO differ diff --git a/programs/games/soko/trunk/SOKO-4.LEV b/programs/games/soko/trunk/SOKO-4.LEV new file mode 100644 index 0000000000..54d7c2f8d7 Binary files /dev/null and b/programs/games/soko/trunk/SOKO-4.LEV differ diff --git a/programs/games/soko/trunk/SOKO-5.LEV b/programs/games/soko/trunk/SOKO-5.LEV new file mode 100644 index 0000000000..ab118f8894 Binary files /dev/null and b/programs/games/soko/trunk/SOKO-5.LEV differ diff --git a/programs/games/soko/trunk/SOKO-6.LEV b/programs/games/soko/trunk/SOKO-6.LEV new file mode 100644 index 0000000000..0bec1d44de Binary files /dev/null and b/programs/games/soko/trunk/SOKO-6.LEV differ diff --git a/programs/games/soko/trunk/SOKO-7.LEV b/programs/games/soko/trunk/SOKO-7.LEV new file mode 100644 index 0000000000..47d4dae732 Binary files /dev/null and b/programs/games/soko/trunk/SOKO-7.LEV differ diff --git a/programs/games/soko/trunk/SOKO-8.LEV b/programs/games/soko/trunk/SOKO-8.LEV new file mode 100644 index 0000000000..62a85fe5ab Binary files /dev/null and b/programs/games/soko/trunk/SOKO-8.LEV differ diff --git a/programs/games/soko/trunk/SOKO-9.LEV b/programs/games/soko/trunk/SOKO-9.LEV new file mode 100644 index 0000000000..5c5ddd637e Binary files /dev/null and b/programs/games/soko/trunk/SOKO-9.LEV differ diff --git a/programs/games/soko/trunk/SOKO.ASM b/programs/games/soko/trunk/SOKO.ASM new file mode 100644 index 0000000000..4529556d5b --- /dev/null +++ b/programs/games/soko/trunk/SOKO.ASM @@ -0,0 +1,1161 @@ +; SOKOBAN FOR MENUET v0.1 +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; Last changed: July 2, 2004 +; +; Main idea, art & graphics +; Sokofun for Windows 95 by Games 4 Brains +; and Sokoban 2.3 by BjЎrn Kфllmark +; +; Level designers: +; +; Alberto Garcia, Aymeric du Peloux, Brian Kent, David Holland, +; David W Skinner, Erim Sever, Evgeniy Grigoriev, Franчois Marques, +; Frantisek Pokorny, Howard Abed,J franklin Mentzer, Jaques Duthen, +; John C Davis, John Polhemus, Kobus Theron, Lee Haywood, Mario Bonenfant, +; Martin P Holland, Mic (Jan Reineke), Phil Shapiro, Richard Weston, +; Sven Egevad, Ken'ichiro Takahashi (takaken), Thinking Rabbit, +; Yoshio Murase, ZICO (Zbigniew Kornas) +; +; Special thanks to Hirohiko Nakamiya +; +; More credits: +; Masato Hiramatsu, Kazuo Fukushima, Klaus Clemens +; +; Game uses its own format of levelset files *.LEV +; with simple run-length compression + +; COMPILE WITH FASM + +CUR_DIR equ '/HD/1/MENUETOS/' ; change it to appropriate path + +SKIN_SIZE equ 11520 ; size of skin file (16x240) + +; field dimensions +FLD_LEFT equ 43 +FLD_LEFT2 equ FLD_LEFT shl 16 +FLD_TOP equ 40 +FLD_TOP2 equ FLD_TOP shl 16 +IMG_SIZE equ 16 shl 16+16 +SHIFT equ (16 shl 16) +WND_COLOR equ 0x03aabbcc + +; level list dimensions +LEVLIST_XY equ FLD_TOP shl 16+45 +LEVLIST_SPACING equ 10 +LEVWND_X equ 320 +LEVWND_Y equ 200 + +; input line dimensions +INP_X equ 10 shl 16+300 +INP_Y equ 160 shl 16+16 +INP_XY equ 15 shl 16+164 + +; load button dimensions +LOAD_X equ 130 shl 16+65 +LOAD_Y equ 180 shl 16+14 +LOAD_XY equ 135 shl 16+184 +CHOOSE_XY equ 40 shl 16+148 + + +WIN_XY equ 135 shl 16+25 + +; workmode constants, more defs in CELLTYPE.INC +WM_WINNER equ 0x10 +WM_READSET equ 0 +WM_LOSE equ 0x20 + +use32 + org 0x0 + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd 0x100000 + dd 0x7fff0 + dd 0x0 + dd 0x0 + +include 'macros.inc' ; decrease code size (optional) +include 'celltype.inc' ; object identifiers +;include 'debug.inc' +;lang equ ru ; russian interface; english if undefined + +START: + mov eax,58 ; load skin image-it is in RAW 16x240 BGR + mov ebx,file_info ; IrfanView recommended + int 0x40 + test ebx,ebx +; jmp load_level +; jz close + load_fail: ; clear input line, also if levelset load failed + mov [inp_pos],0 + load_std: + mov esi,stdlev + mov edi,path_end + mov ecx,stdlev_len-stdlev + rep movsb + mov ecx,10 + reset_fi: + mov dword[cnf_level],level_start + xor eax,eax + mov [levpage],eax + mov word[ll_num],'00' ; reset some counters + read_cnf: + mov eax,58 + mov ebx,file_info + int 0x40 + test ebx,ebx ; load standard levels SOKO-?.LEV instead of custom + jz nxt_cnf + add dword[cnf_level],ebx + nxt_cnf: + test ecx,ecx ; this check is for loading a custom levelset + jz no_increase + inc byte[file_num] ; next standard levelset + loop read_cnf + no_increase: + cmp dword[cnf_level],level_start + jne go_on + test ecx,ecx + jz load_fail + jmp close ; missing standard levels & exiting + go_on: + mov eax,[cnf_level] + mov byte[eax],0xf0 ; end-of-levels mark + + call read_levelset + backto_set: + mov byte[workmode],WM_READSET + mov byte[winmode],0 + jmp red +restart_level: + call decode_field ; uncompress level + +red: + call draw_window + +still: + + mov eax,10 + int 0x40 + cmp byte[winmode],WM_WINNER + je backto_set + cmp byte[winmode],WM_LOSE + je backto_set + cmp eax,1 + je red + cmp eax,2 + je key + cmp eax,3 + je button + + jmp still + + key: + mov eax,2 + int 0x40 + + cmp byte[workmode],WM_READSET + jne key_move + cmp ah,32 ; Space moves focus to input line + je is_input + cmp ah,184 + jne no_prev + cmp [levpage],0 ; PgUp + jz still + sub [levpage],10 + cmp byte[ll_num+1],'0' + jnz _pu + dec byte[ll_num] + mov byte[ll_num+1],'9'+1 + _pu: + dec byte[ll_num+1] + jmp red + no_prev: + cmp ah,183 ; PgDn + jne no_next + mov eax,[levpage] + add eax,10 + cmp eax,[levelcount] + jae still + mov [levpage],eax + cmp byte[ll_num+1],'9' + jnz _pd + inc byte[ll_num] + mov byte[ll_num+1],'0'-1 + _pd: + inc byte[ll_num+1] + jmp red + no_next: + sub ah,48 + cmp ah,9 + ja still + movzx eax,ah ; user selects a level + add eax,[levpage] + cmp eax,[levelcount] + jae still + mov eax,[levelmap+eax*4] + mov [levptr],eax ; current level pointer + mov al,byte[eax] + mov byte[workmode],al + jmp restart_level + + ; we're already in game + key_move: + cmp ah,180 ; Home + je backto_set + cmp ah,176 + jb no_arrows + sub ah,176 + cmp ah,3 + ja no_arrows + movzx ecx,ah + movzx edx,[player] + inc ch + call valid_move + cmp byte[winmode],WM_WINNER + jne no_winner + mov ecx,0x20ac0000 + mov edx,win_msg + mov esi,win_msg_end-win_msg ; print victory congratulations + print_msg: + mov ebx,WIN_XY + mov eax,4 + int 0x40 + jmp d_f + no_winner: + cmp byte[winmode],WM_LOSE + jne d_f + no_loser: + test al,al ; no move accepted + jnz still + d_f: + call draw_field ; move performed-redraw + jmp still + no_arrows: + cmp ah,27 + je restart_level + + jmp still + + button: + mov eax,17 + int 0x40 + + cmp ah,1 + jne noclose + close: + xor eax,eax + dec eax + int 0x40 ; shutdown. + + noclose: + cmp ah,2 + jne no_input + is_input: ; simple input line with backspace feature + mov ebx,[entered] ; sorry - no cursor + test ebx,ebx + jnz wait_input + mov [inp_pos],ebx + inc [entered] + wait_input: + call draw_input + mov eax,10 + int 0x40 + cmp eax,2 + jne still + mov edi,[inp_pos] + mov eax,2 + int 0x40 + shr eax,8 + cmp eax,27 + je still + cmp eax,13 + je load_level + cmp eax,8 + je backsp + mov [fn_input+edi],al + inc [inp_pos] + jmp wait_input + backsp: + test edi,edi + jz wait_input + dec [inp_pos] + jmp wait_input + no_input: + cmp ah,3 + jne no_load + load_level: + mov ecx,[inp_pos] + test ecx,ecx + je load_std + mov esi,fn_input + mov byte[esi+ecx],0 + inc ecx + mov edi,path_end + rep movsb + jmp reset_fi + no_load: + jmp still + + +; ********************************************* +; ** FILLS LEVEL POINTER MAP ****************** +; ********************************************* +read_levelset: + + mov dword[wnd_width],LEVWND_X + mov dword[wnd_height],LEVWND_Y + mov [levelcount],0 + mov edi,level_start + mov esi,levelmap + mov al,0xff + rls_cycle: + cmp byte[edi],EOF + je end_of_levelset + mov [esi],edi + add esi,4 + mov ecx,1024 + inc [levelcount] + repne scasb + jecxz eol ;end_of_levelset + jmp rls_cycle + end_of_levelset: + mov eax,[levelcount] +; debug_print_dec eax + ret + eol: +; debug_print '*** ' + jmp end_of_levelset + +; ********************************************* +; ******* DEFINE & DRAW WINDOW & OTHER STUFF * +; ********************************************* + +draw_window: + + mov eax,12 + mov ebx,1 + int 0x40 + + mov eax,0 + mov ebx,150*65536 + add ebx,[wnd_width] + mov ecx,50*65536 + add ecx,[wnd_height] + mov edx,WND_COLOR + mov esi,0x805080d0 + mov edi,0x005080d0 + int 0x40 + + mov eax,4 + mov ebx,8*65536+8 + mov ecx,0x10ddeeff + mov edx,zagolovok + mov esi,zag_konets-zagolovok + int 0x40 + + cmp byte[workmode],WM_READSET + je list_levels + + mov edi,[levptr] ; print custom level filename + add ebx,170*65536 + lea edx,[edi+4] + movzx esi,byte[edi+3] + int 0x40 + + call draw_field + cmp [entered],0 + jz end_of_draw + mov edx,fn_input ; print input line text + mov esi,[inp_pos] + mov ebx,FLD_LEFT2+FLD_TOP-15 + jmp draw_level_file + + list_levels: + + call draw_input + + mov eax,8 ; draw load button + mov ebx,LOAD_X + mov ecx,LOAD_Y + mov edx,3 + mov esi,WND_COLOR + int 0x40 + + mov eax,4 + mov ecx,0x20107a30 + mov ebx,LOAD_XY + mov edx,load_char + mov esi,loadlen-load_char + int 0x40 + + mov ebx,LEVLIST_XY + mov edi,0x204e00e7 + xor esi,esi + mov ecx,10 + ll_cycle: + push ecx esi ebx esi + lea ecx,[esi+'0'] + mov [ll_num+2],cl + mov ecx,edi + mov edx,ll_num + mov esi,4 + int 0x40 + add ebx,25 shl 16 + pop esi + add esi,[levpage] + mov edx,[levelmap+esi*4] + add edx,4 + movzx esi,byte[edx-1] + int 0x40 + pop ebx esi ecx + inc esi + mov edx,[levelcount] + sub edx,[levpage] + cmp edx,esi + jbe choose_print + add ebx,LEVLIST_SPACING + loop ll_cycle + choose_print: + mov edx,ll_msg + mov esi,ll_msg_end-ll_msg + mov ebx,CHOOSE_XY + draw_level_file: + mov eax,4 + int 0x40 + + end_of_draw: + mov eax,12 + mov ebx,2 + int 0x40 + + ret + +; ********************************************* +; ******* DRAW CELL IMAGES WITHIN FIELD ******* +; ********************************************* + +draw_field: + cmp byte[workmode],sSokonex + jne no_chl + call check_lasers ; Sokonex game + no_chl: + mov eax,13 ; clear field area + mov edx,WND_COLOR + mov edi,[levptr] + movzx ebx,byte[edi+1] + shl ebx,4 + lea ebx, [FLD_LEFT2+ebx] + movzx ecx,byte[edi+2] + shl ecx,4 + lea ecx, [FLD_TOP shl 16+ecx] + int 0x40 + + mov edx, FLD_LEFT2+FLD_TOP + movzx edi,byte[edi+1] + shl edi,20 + add edi, FLD_LEFT2 + + xor eax,eax + mov ecx,[fld_size] + mov esi,field + fld_cycle: + lodsb + call draw_img + add edx,SHIFT + cmp edx,edi + jl no_nl + add edx,16 + and edx,0xffff + add edx,FLD_LEFT2 + no_nl: + loop fld_cycle + cmp byte[workmode],sSokonex + jne end_of_df + call draw_lasers + end_of_df: + ret + +; ********************************************* +; *********** DRAW CELL IMAGE ***************** +; ********************************************* + +draw_img: ; in: eax-object index, edx-coordinates + pusha + cmp eax,tWall + jbe no_adjust + cmp [workmode],sSokolor + jne no_di_color + add eax,pm_col-pm_nex + jmp no_adjust + no_di_color: + cmp [workmode],sSokonex + jne no_adjust + inc eax + no_adjust: + movzx ebx,byte [pic_map+eax] + cmp ebx,0xf + je no_img + bl_place: + mov ecx, IMG_SIZE + imul ebx, 256*3 + add ebx,strip + mov eax,7 ; draw_image sysfunc + int 0x40 + no_img: + popa + ret + +;**************************************** +;******* DRAW CONTENTS OF INPUT LINE **** +;**************************************** +draw_input: + push edi + cmp eax,4 + jne highlight + mov esi,WND_COLOR + jmp di_draw + highlight: + mov esi,0xe0e0e0 + di_draw: + mov eax,8 + mov ebx,INP_X + mov ecx,INP_Y + mov edx,2 + int 0x40 + mov eax,4 + mov ecx,0x00107a30 ; шрифт 1 и цвет ( 0xF0RRGGBB ) + mov ebx,INP_XY + mov edx,fn_input + mov esi,[inp_pos] + int 0x40 + pop edi + ret + +; ******************************************************** +; * DECOMPRESS LEVEL & FILL SOME TABLES TO CHECK VICTORY * +; ******************************************************** + +decode_field: +; debug_print <13,10> + xor eax,eax + mov dword[checkpoint],eax + mov dword[checkpoint+4],eax + mov byte[checkcount],al + mov edi,[levptr] + mov dl,[edi] + mov [workmode],dl + movzx edx,byte[edi+1] + mov esi,edx + shl esi,4 + add esi,FLD_LEFT*2-25 + mov [wnd_width],esi + neg edx + mov [move_map+8],edx + neg edx + mov [move_map+4],edx + movzx eax,byte[edi+2] + mov esi,eax + shl esi,4 + add esi,FLD_TOP*2-18 + mov [wnd_height],esi + imul edx,eax + mov [fld_size],edx + lea esi,[edi+4] + movzx ecx,byte[edi+3] + add esi,ecx + cmp byte[esi],0xff + je backto_set + xor edi,edi + cld + dec_cycle: + lodsb + movzx ecx,al + and ecx,0xf ; ecx-count of objects + shr al,4 ; eax-index of object + inc ecx + sub edx,ecx + dc_cycle: + mov [field+edi],al + call chk_win_obj + jne no_register + push eax ecx esi + movzx ecx,al + shl eax,12 + or eax,edi + inc byte[checkcount] + cmp [workmode],sSokolor + jne chk_sokoban +; debug_print ':' +; debug_print_dec ecx + sub ecx,tRedB + shl ecx,1 + cmp word[checkpoint+ecx],0 + jnz no_new_check + mov [checkpoint+ecx],ax + and eax,0xfff +; debug_print_dec eax + jmp no_new_check + chk_sokoban: + cmp [workmode],sSokonex + jne no_nex + cmp byte[checkcount],1 + ja no_new_check + no_nex: + movzx ecx,byte[checkcount] + mov word[checkpoint-2+ecx*2],ax + no_new_check: + pop esi ecx eax + no_register: + inc edi + loop dc_cycle + cmp edx,0 + jg dec_cycle + mov ecx,[fld_size] + xor edx,edx + fp_cycle: + mov al,[field+edx] + and al,0xfe + cmp al,tPlayer + je pl_found + inc edx + loop fp_cycle + pl_found: + mov [player],dx + movzx eax,byte[checkcount] +; debug_print_dec eax + ret + +; ********************************************* +; * WHETHER OBJECT IS VICTORY DEPENDENT ******* +; ********************************************* + +chk_win_obj: ; al-object in a cell + push ecx eax + and al,0xf + mov cl,[workmode] + cmp cl,sSokoban + jne nota_sokoban + cmp al,tBlock + jmp cwo_exit + nota_sokoban: + cmp cl,sSokonex + jne nota_sokonex + cmp al,tConnect + je cwo_exit + cmp al,tStConnect + jmp cwo_exit + nota_sokonex: + push eax + and eax,tRedB + cmp eax,tRedB + pop eax + cwo_exit: + pop eax ecx + ret + +; ********************************************* +; ***** GET CELL AT CERTAIN DIRECTION ********* +; ********************************************* + +get_cell_at: ; in: dx - current cell, cl - direction + mov ebx,edx ; out: al - object at direction, bx - new position + movzx eax,cl + and eax,11b + mov eax, [move_map+eax*4] + add ebx,eax + mov al,[field+ebx] + ret + +; ********************************************* +; *** WHETHER A MOVE CAN BE DONE, & DO IT ***** +; ********************************************* + +valid_move: ; in: dx - current cell, cl - direction + push edx esi + call get_cell_at ; if ch>0 perform all moves + cmp al,tWall + jb result_ok + je vm_exit + cmp [workmode],sSokonex + jne n_vm_nex + cmp al,tStConnect + je vm_exit + cmp al,tHole + je vm_exit + n_vm_nex: + push edx ebx + mov edx,ebx + movzx esi,al + call get_cell_at + cmp al,tPlace + jbe push_it + cmp [workmode],sSokonex + jne no_plate + cmp al,tHole + jne no_plate + cmp esi,tBroken + jae vm_sink + cmp esi,tPlate + jne no_plate + and byte[field+ebx],0 + vm_sink: + and byte[field+edx],0 + jmp vm_hole + no_plate: + pop ebx edx esi edx + ret + push_it: + call do_move + vm_hole: + pop ebx edx + result_ok: + call do_move + xor al,al + vm_exit: + pop esi edx + ret + +; ********************************************* +; ******* ACTUALLY PERFORM MOVES ************** +; ********************************************* + +do_move: ; in: dx - source cell + test ch,ch ; bx - target cell + jz dm_exit ; ch = 0 don't perform moves + mov al,byte[field+edx] + cmp byte[workmode],sSokoban + jne no_dm_ban + and al,0xfe + no_dm_ban: + xor byte[field+edx],al + or byte[field+ebx],al + call chk_win_obj + jne no_check_win + pusha + movzx ecx,byte[checkcount] + xor edi,edi + dm_cycle: + movzx esi,word[checkpoint+edi*2] + and esi,0xfff + and edx,0xfff + cmp esi,edx + jnz not_an_obj + movzx eax,dl + movzx eax,byte[field+ebx] + shl eax,12 + or eax,ebx + mov word[checkpoint+edi*2],ax + jmp dm_ex + not_an_obj: + inc edi + loop dm_cycle + dm_ex: + popa + call check_win + jne no_check_win + mov byte[winmode],WM_WINNER + no_check_win: + cmp al,tPlayer + jne dm_exit + mov [player],bx + dm_exit: + ret + +; ********************************************* +; ******* CHECK VICTORY CONDITIONS ************ +; ********************************************* + +check_win: +; debug_print <13,10> + push eax ebx ecx esi + xor eax,eax + movzx ecx,byte[checkcount] + mov esi,checkpoint + mov bl,byte[workmode] + xor bh,bh + mov [colcount],bh + cld + cw_cycle: + lodsw + cmp bl,sSokoban + jne nocw_sokoban + test ax,1 shl 12 + jz cw_not_inplace + inc bh + cw_not_inplace: + loop cw_cycle +; movzx eax,bh + cmp [checkcount],bh + jmp cw_exit + nocw_sokoban: + cmp bl,sSokonex + jne nocw_sokonex + mov dx,ax + call scan_root + cmp al,[checkcount] + jmp cw_exit + + nocw_sokonex: + cmp esi,checkpoint+8 + ja cwlor_exit +; debug_print '*' + test ax,ax + jz cw_cycle + mov dx,ax + call scan_root + add [colcount],al +; debug_print '*->' +; debug_print_dec eax + jmp cw_cycle + cwlor_exit: + mov al,[colcount] + cmp al,[checkcount] + cw_exit: +; debug_print <13,10> + pop esi ecx ebx eax + ret + +; ********************************************* +; **** WHETHER LASERS DESTROY SOMETHING ******* +; ********************************************* + +check_lasers: + pusha + xor edx,edx + mov ecx,[fld_size] + cl_loop: + push ecx edx + mov cl,[field+edx] + sub cl,tLaserW + jl cl_exit + cl_begin: + call get_cell_at + cmp al,tLaserW + jae cl_destroy + cmp al,tBroken + je cl_destroy + cmp al,tEmpty + je no_cl_destroy + cmp al,tHole + je no_cl_destroy + cmp al,tPlayer + jne cl_exit + mov ecx,0x20ac0000 + mov edx,lose_msg + mov esi,lose_msg_end-lose_msg ; print loose message + mov byte[winmode],WM_LOSE + mov ebx,WIN_XY + mov eax,4 + int 0x40 + jmp cl_exit + cl_destroy: + mov byte[field+ebx],0 + no_cl_destroy: + mov edx,ebx + jmp cl_begin + cl_exit: + pop edx ecx + inc edx + loop cl_loop + popa + ret + +; ********************************************* +; *** USED BY CHECK_WIN IN SOKONEX & SOKOLOR ** +; ********************************************* + +scan_root: ; input: dx-beginning cell, ebx-what to search + push esi + mov edi,srch ; output: eax-number of win_obj found + mov eax,0xfff + movzx ecx,[checkcount] + inc ecx + cld + rep stosw ; clearing area for scan + movzx ebx,dx + and edx,eax ; dx-cell number to compare with + shr ebx,12 ; bl-obj id + mov [color],bl + mov esi,srch + mov edi,eax ; mask to extract cell + mov word[srch],dx + sr_loop: + lodsw + push esi ; saving scan pointer + movzx edx,ax ; edx-[dirs*4][cell*12] + and edx,edi +; debug_print ' >' + mov ecx,4 + sr_dir_loop1: +; debug_print '.' + push ecx ; saving dir counter + lea ebx,[ecx+11] + bts word[esi-2],bx + jc sr_endloop ; this entry is already processed +; debug_print '^' + dec ecx ; cl-direction + call get_cell_at ; bx-new position, al-object +; cmp [workmode],sSokonex +; jne no_sr_nex + call chk_win_obj + jne sr_endloop ; not a win_obj there +; debug_print '@' + cmp [workmode],sSokolor + jne no_sr_lor + cmp al,[color] + jne sr_endloop + no_sr_lor: + push esi + mov esi,srch ; let us search for existing entries + sr_loop1: + lodsw + and eax,edi ; eax-cell w/o dirs + cmp eax,ebx + je sr_foundentry ; this is the entry we're seeking for + cmp word[esi],0xfff + jnz sr_loop1 ; next entry + ; we reached empty area + mov [esi],bx + add esi,2 + sr_foundentry: + mov eax,15 + sub eax,ecx + bts [esi-2],ax ; mark entry as used + pop esi +; inc [e_fnd] ; one more obj found + sr_endloop: + pop ecx + loop sr_dir_loop1 +; jmp tttt +; sr_dir_loop: +; jmp sr_dir_loop1 +; tttt: + pop esi + cmp word[esi],0xfff + jne sr_loop + mov eax,esi + sub eax,srch + shr eax,1 + pop esi +; debug_print_dec eax + ret + +; ********************************************* +; *** SPECIAL ROUTINE TO DRAW LASERS ********** +; ********************************************* + +draw_lasers: + xor edx,edx + mov ecx,[fld_size] + dl_loop: + push ecx edx + mov cl,[field+edx] + sub cl,tLaserW + jl dl_eloop + inc ch + dl_gca: + call get_cell_at + cmp al,tEmpty + je dl_draw + cmp al,tHole + jne dl_eloop + dl_draw: + call draw_beams + mov edx,ebx + jmp dl_gca + dl_eloop: + pop edx + inc edx + pop ecx + loop dl_loop + ret + +; ********************************************* +; *** DRAWS LASER BEAMS IN CERTAIN DIRECTION ** +; ********************************************* + +draw_beams: + pusha + mov esi,[levptr] + movzx esi,byte[esi+1] + mov eax,ebx + xor edx,edx + div esi + movzx esi,cl + dec esi + shr esi,1 + and esi,1 + shl edx,20 + mov ebx,edx + shl eax,20 + mov ecx,eax + add ebx,dword[beam_xy+esi*8] + add ecx,dword[beam_xy+esi*8+4] + mov edx,0xe9e25c + mov eax,13 + int 0x40 + popa + ret + +ud: + ud2 ; debugging purposes only + + +; ********************************************* +; *** COMPRESS LEVEL - NOT READY YET ********** +; ********************************************* + +; push esi ebx ;ecx +; xchg ebx,edi +; mov esi,edi ; esi,edi - beginning +;; ebx - end of unpacked field +; first_enc: +; lodsb ; al - first byte +; shl ax,8 ; ah - this byte, al=0 +; next_enc: +; cmp esi,ebx +; jae exit_enc +;; movzx ecx,byte[esi] +;; debug_print_dec ecx +; cmp ah,byte[esi] +; jne newchar +; inc esi +; inc al +; cmp al,15 +; jb next_enc +; newchar: +; shl al,4 +; shr ax,4 +; stosb +; jmp first_enc +; exit_enc: +; shl al,4 +; shr ax,4 +; stosb +; mov al,0xff +; stosb +; pop ebx esi ecx +; +; dec ecx +; jcxz outcycle +; jmp next_lev +; outcycle: + + +; Здесь находятся данные программы: + +; интерфейс программы двуязычный - задайте язык в macros.inc +load_char: +if lang eq ru + db 'Загрузить' +else + db 'Open file' +end if +loadlen: + +ll_msg: +if lang eq ru + db 'Выберите уровень' +else + db 'Choose a level' +end if + db ' (0-9, PgUp, PgDn)' +ll_msg_end: + +fn_input: +; db 'cnf' +; db 'soko-4.lev' +if lang eq ru + db 'или введите имя файла' +else + db 'or enter a filename' +end if +inp_end: + rb 256-(inp_end-fn_input) + +win_msg: +if lang eq ru + db 'Ура!!! Вы прошли уровень!' +else + db "You've completed the level!" +end if +win_msg_end: + +lose_msg: +if lang eq ru + db 'Вы парализованы! Проигрыш...' +else + db "You're paralized! Game over..." +end if +lose_msg_end: + +zagolovok: ; строка заголовка +if lang eq ru + db 'СОКОБАН ДЛЯ' +else + db 'SOKOBAN FOR' +end if + db ' MENUET' +zag_konets: ; и её конец + +pic_map: + db 0xf,9,0,0,1,1,5,6 +pm_nex: + db 2,7,8,3,4,0xa,0xa,0xa,0xa +pm_col: + db 0xb,0xc,0xd,0xe + +beam_xy: + dd (FLD_LEFT+7) shl 16+2, FLD_TOP2+16 + dd FLD_LEFT2+16, (FLD_TOP+7) shl 16+2 + +ll_num db '00x.' + +move_map dd -1,+0,-0,1 ; 0 - W, 1 - S, 2 - N, 3 - E + +stdlev db 'SOKO-0.LEV',0 +stdlev_len: + +inp_pos dd inp_end-fn_input +entered dd 0 + +file_info: + dd 0 + dd 0 + dd 0x100 +cnf_level dd strip + dd workarea +file_name db CUR_DIR +path_end db 'SKIN.' +file_num db 'RAW',0 + + rb 256-($-file_name) + +I_END: ; конец программы + +winmode db ? +scanptr dd ? +levpage dd ? +workmode db ? +player dw ? +fld_size dd ? +levptr dd ? +wnd_height dd ? +wnd_width dd ? +color db ? +colcount db ? +levelcount dd ? +checkcount db ? +checkpoint: + times 256 dw ? +levelmap: + times 1024 dd ? +strip rb SKIN_SIZE + +workarea: + srch rb 0x10000-($-workarea) + +level_start rb 0x20000 +field: diff --git a/programs/games/soko/trunk/SOKOLATE.LEV b/programs/games/soko/trunk/SOKOLATE.LEV new file mode 100644 index 0000000000..81a7933b6e Binary files /dev/null and b/programs/games/soko/trunk/SOKOLATE.LEV differ diff --git a/programs/games/soko/trunk/SOLOBAN.LEV b/programs/games/soko/trunk/SOLOBAN.LEV new file mode 100644 index 0000000000..0e67d8ea47 Binary files /dev/null and b/programs/games/soko/trunk/SOLOBAN.LEV differ diff --git a/programs/games/soko/trunk/STILMORE.LEV b/programs/games/soko/trunk/STILMORE.LEV new file mode 100644 index 0000000000..2b3919a6ca Binary files /dev/null and b/programs/games/soko/trunk/STILMORE.LEV differ diff --git a/programs/games/soko/trunk/SVEN.LEV b/programs/games/soko/trunk/SVEN.LEV new file mode 100644 index 0000000000..a0d7d5745b Binary files /dev/null and b/programs/games/soko/trunk/SVEN.LEV differ diff --git a/programs/games/soko/trunk/TAKAKEN.LEV b/programs/games/soko/trunk/TAKAKEN.LEV new file mode 100644 index 0000000000..5668b0bf1c Binary files /dev/null and b/programs/games/soko/trunk/TAKAKEN.LEV differ diff --git a/programs/games/soko/trunk/TITLSCRN.LEV b/programs/games/soko/trunk/TITLSCRN.LEV new file mode 100644 index 0000000000..0c7acf79a7 Binary files /dev/null and b/programs/games/soko/trunk/TITLSCRN.LEV differ diff --git a/programs/games/soko/trunk/TWISTY.LEV b/programs/games/soko/trunk/TWISTY.LEV new file mode 100644 index 0000000000..26a492dd81 Binary files /dev/null and b/programs/games/soko/trunk/TWISTY.LEV differ