From 90836295a030190d71da2f7720ccfc651173dd47 Mon Sep 17 00:00:00 2001 From: Nishi Date: Thu, 3 Oct 2024 20:04:15 +0000 Subject: [PATCH] adding gui manager git-svn-id: file:///raid/svn-personal/tewi/trunk@244 8739d7e6-ffea-ec47-b151-bdff447c6205 --- Binary/pbtewi.bmp | Bin 0 -> 6592 bytes Binary/tewi.bmp | Bin 0 -> 16522 bytes Makefile | 3 +- Platform/bcc.mk | 2 +- Platform/vc6.mk | 2 +- Platform/watcom.mk | 2 +- Platform/win32.mk | 2 +- Platform/win64.mk | 2 +- Server/Makefile | 9 ++ Server/gui.c | 224 +++++++++++++++++++++++++++++++++++++++++++++ Server/gui.h | 20 ++++ Server/gui.rc | 18 ++++ Server/main.c | 5 +- Server/tewi.rc | 2 +- Tool/option.c | 27 +++++- config.h.tmpl | 2 + 16 files changed, 311 insertions(+), 9 deletions(-) create mode 100644 Binary/pbtewi.bmp create mode 100644 Binary/tewi.bmp create mode 100644 Server/gui.c create mode 100644 Server/gui.h create mode 100644 Server/gui.rc diff --git a/Binary/pbtewi.bmp b/Binary/pbtewi.bmp new file mode 100644 index 0000000000000000000000000000000000000000..3b709bcfee92db2bb4fd02909405d102ab900723 GIT binary patch literal 6592 zcmeHMd34m(6~6a3lT0RLArNE>kU~Jj00IF75h1b!l0XRiresf)gqW}|7TW|Q37gpn z$6CY%q*RJkq(?!kfQUz{RS?u;Yq1^*wiPLhTj}?`H@^(^h=2Ew=J4k2_kQoY%X>2< zr@!1@%wLsPWF=ZhQF@}NgrSHuw8Dq`#{m|(>i#pGQKOU7H@ZDa$k!_AUA`;#rMq;DdO1s#O(y?PV>D)eE zx^?a@-Mc18LPDb4)T5{Ly1B3P?2#miz57Z3#3UJ%I7DvgH&6x)7$&z394=kEjFYZ$ z(h;&V^U_xwDHp=bJAThW^9Q}%qWzM z$+ur;NnYV{SzNSAmMmBy!wXKy$Qi$px!ILcTwE>1 zWe>=TWmR%d-a#o}vR6jTJ}k>tKP30B-6|F38)WUW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M)BD)!59H$5K7A9&BGtPQ^PoYItd0a+p z_U)<-7@go^K;~+;3fq*)I1fSF#5wvV`(TW7EcTAEcMIeMcrZR>+E`<96wa_rQ=yHP zF(|+Ra)DuD1+i&~i-Wx4jx@Sr&3P=Z)CC-{w2jzc8)vM+o1sWILDKM`e6W3!zfmXC zo6~Y55jCyJ6Y*9KCyO7YMAj_4SUj?j0Sf)tVK|&f{nl05IV(-;(MDcLF1IRO@0=F5F@c!nR ziI6gF+un?E==0{`uLJycNHyl7TVdFjZEjI`_j ztaj;y{nh;4-jsFybw4;0nVVOh11RyB9g$O7wh--kXb)Plu$1jBXvgLhX62&28|}n0 z07UyF$FptwbG8di+x*-fTQ(*0PMj?kwsYC$ ze-y@{X!dH4gP}Mmgf(!|HGgW$#}7TeD&&u?jpWgk?%HLz530g zSFe7z9lr6A$jc?c{R_5<+Y8{QU=c C8#Flp literal 0 HcmV?d00001 diff --git a/Binary/tewi.bmp b/Binary/tewi.bmp new file mode 100644 index 0000000000000000000000000000000000000000..21b77a166fcd3489c79014dc130ad979584ea977 GIT binary patch literal 16522 zcmcgy2UHhVy3d}xeP?&id;4~ijlFjT6v1dTnkX1!bk)Re5{(8Ux)MdP3#cen42Vdx zqN3Ov5*vaP0kNUj3l=PhNSC1RoZq{@JKkaV3yQ>j96#^O{Acd{eqX=ejLiU_p6|&& zAMwAlpq?-35AQX3?|pGBFL12zhxgvo{_!eoz8vi27hlrmn}dx$YUG~t2WxBV4<}5R z&`QvMhK7dzxyN5Fzu)G2KP%%D|6x24$N!u396BYJAOCi^2qj1IaV;qa$CArlq0`Ba zQM57zr7Mypl>{c^$n14U36IC~htKii{=b(p&fkLbcvr-&Jc7cwJV`~d1t^IvMrm|` zBpsIlBXRNfti%F|sj_=`?ZxrmHzGmvS)5;`XiIkZ`{c7mj6C@B!LDUSJZ|EDU?+_^J1k(P?m>=8YTa zSxCK8gj6Ae)ceJ_AD1g-P?f$-F{$&{$w=K}9F;9RxUAtnbKwyRR-UL}1B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-ZejXliip9POM7T3NO!% z*LeJe?SS8<`wbymkQtX%DSpbKC_WD!F3W1X2KNNq2eOy*w)S6{z9|dZ0{4h5T9_d^ zDyBxdp&ju3Lx@|bv~^SeS2n=!CAWBP#o6QOHC|_-^HKz?2uH7OUl`=jQQ9+QLY&$@ zfj**6km+8K3v+FMHCg<=7i1J|nT8$~|1G#;ws!eDme- zqZ6i&pNYc9#ZnK=Md?)N9zd+jIYDbSa?&sEAYa_0=IZir~io=Ie z_2=_)i^X^Gt~eHQ1d)rkAV|cSfS-MJ@}25~@Wm0huqQ))x6607{>}mV^KY}Z>Akf3 zrQ-Y7!W8lT?d7{(g})?O`v!n@0OOzZ1NKM7dD5m62=`d?PI%z^JAaW|ic`gU{O*9G zVNHE)p&RnRd>l3_@ORle-|{z6VzLjiaoEUan6bcz#%X8yxyO_C`t< ze1{i2cZI~oc}>@nayP8a^GLrPzpEza+L6KAkg-2Qm%Do3Z^W&RE9FVpOY-_eESc#p s-U&Reu`S%Zd{@|WNVRY)Sv-l&g}2b1lHuEqTf%qaV8k)m2RFs`e^`dnX#fBK literal 0 HcmV?d00001 diff --git a/Makefile b/Makefile index 7344a0a..88cc56a 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ PLATFORM = generic PLATFORM_IDENT = NOT_WINDOWS PREFIX = /usr/local MODULE = ./Module +OBJ = o include Platform/$(PLATFORM).mk @@ -24,7 +25,7 @@ all: ./Server $(MODULE) cc -o $@ ./Tool/itworks.c ./Server:: ./Common ./Tool/option ./Tool/genconf ./Tool/itworks - $(MAKE) -C $@ $(FLAGS) EXTOBJS="`./Tool/option objs ../`" EXTLIBS="`./Tool/option libs ../ $(PLATFORM_IDENT)`" EXTCFLAGS="`./Tool/option cflags ../`" EXTLDFLAGS="`./Tool/option ldflags ../`" + $(MAKE) -C $@ $(FLAGS) EXTOBJS="`./Tool/option objs ../ $(PLATFORM_IDENT) $(OBJ)`" EXTLIBS="`./Tool/option libs ../ $(PLATFORM_IDENT) $(OBJ)`" EXTCFLAGS="`./Tool/option cflags ../ $(PLATFORM_IDENT) $(OBJ)`" EXTLDFLAGS="`./Tool/option ldflags ../ $(PLATFORM_IDENT) $(OBJ)`" ./Module:: ./Common $(MAKE) -C $@ $(FLAGS) diff --git a/Platform/bcc.mk b/Platform/bcc.mk index 42e6f64..ed96a23 100644 --- a/Platform/bcc.mk +++ b/Platform/bcc.mk @@ -14,4 +14,4 @@ EXEC = STATIC = lib LIBSUF = .dll OBJ = obj -REQOBJS = tewi_bcc.res +REQOBJS = tewi_bcc.res gui_bcc.res diff --git a/Platform/vc6.mk b/Platform/vc6.mk index bcf8baa..d080ed4 100644 --- a/Platform/vc6.mk +++ b/Platform/vc6.mk @@ -13,4 +13,4 @@ EXEC = STATIC = lib LIBSUF = .dll OBJ = obj -PREOBJS = tewi_vc6.res +PREOBJS = tewi_vc6.res gui_vc6.res diff --git a/Platform/watcom.mk b/Platform/watcom.mk index ee4393e..bf91582 100644 --- a/Platform/watcom.mk +++ b/Platform/watcom.mk @@ -13,4 +13,4 @@ EXEC = .exe STATIC = lib LIBSUF = .dll OBJ = obj -SERVADD = wrc -bt=nt -i=$(WATCOM)/h/nt -fe=tewi.exe tewi.rc +SERVADD = wrc -bt=nt -i=$(WATCOM)/h/nt tewi.rc tewi.exe && wrc -bt=nt -i=$(WATCOM)/h/nt gui.rc tewi.exe diff --git a/Platform/win32.mk b/Platform/win32.mk index 33682c3..7293021 100644 --- a/Platform/win32.mk +++ b/Platform/win32.mk @@ -11,4 +11,4 @@ LDFLAGS = LIBS = EXEC = .exe LIBSUF = .dll -PREOBJS = tewi.res +PREOBJS = tewi.res gui.res diff --git a/Platform/win64.mk b/Platform/win64.mk index f2e5842..4976bb9 100644 --- a/Platform/win64.mk +++ b/Platform/win64.mk @@ -11,4 +11,4 @@ LDFLAGS = LIBS = EXEC = .exe LIBSUF = .dll -PREOBJS = tewi.res +PREOBJS = tewi.res gui.res diff --git a/Server/Makefile b/Server/Makefile index 18aa72e..3f250f0 100644 --- a/Server/Makefile +++ b/Server/Makefile @@ -54,5 +54,14 @@ tewi_vc6.res: tewi.rc ../Binary/tewi.ico tewi_bcc.res: tewi.rc ../Binary/tewi.ico brc32 -r -fo$@ tewi.rc +gui.res: gui.rc gui.h + $(WINDRES) gui.rc -O coff -o $@ + +gui_vc6.res: gui.rc gui.h + rc /fo$@ gui.rc + +gui_bcc.res: gui.rc gui.h + brc32 -r -fo$@ gui.rc + clean: rm -f *.o tewi *.exe *.res *.elf *.sfo *.pbp *.self *.pkg *.obj diff --git a/Server/gui.c b/Server/gui.c new file mode 100644 index 0000000..2f7a8e6 --- /dev/null +++ b/Server/gui.c @@ -0,0 +1,224 @@ +/* $Id$ */ + +#include "../config.h" + +#include "gui.h" + +#include +#include + +HINSTANCE hInst; +HBRUSH pbtewi_brush; +HWND logarea; +HWND button_start; +HWND button_stop; +HWND button_about; +HWND status; +BOOL tewi_alive; +BOOL was_starting; +BOOL exiting; + +#define WINWIDTH(rc) (rc.right - rc.left) +#define WINHEIGHT(rc) (rc.bottom - rc.top) + +#define DIALOG_X(n) (HIWORD(GetDialogBaseUnits()) * n) +#define DIALOG_Y(n) (LOWORD(GetDialogBaseUnits()) * n) + +void ShowBitmapSize(HWND hWnd, HDC hdc, const char* name, int x, int y, int w, int h){ + HBITMAP hBitmap = LoadBitmap(hInst, name); + BITMAP bmp; + HDC hmdc; + GetObject(hBitmap, sizeof(bmp), &bmp); + hmdc = CreateCompatibleDC(hdc); + SelectObject(hmdc, hBitmap); + if(w == 0 && h == 0){ + StretchBlt(hdc, x, y, bmp.bmWidth, bmp.bmHeight, hmdc, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); + }else{ + StretchBlt(hdc, x, y, w, h, hmdc, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); + } + DeleteDC(hmdc); + DeleteObject(hBitmap); +} + +void ShowBitmap(HWND hWnd, HDC hdc, const char* name, int x, int y){ + ShowBitmapSize(hWnd, hdc, name, x, y, 0, 0); +} + +LRESULT CALLBACK VersionDialog(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp){ + if(msg == WM_COMMAND){ + if(LOWORD(wp) == IDOK) EndDialog(hWnd, IDOK); + }else if(msg == WM_PAINT){ + HDC hdc; + PAINTSTRUCT ps; + RECT size; + + size.left = size.top = 5; + size.right = size.bottom = 32 + 5; + MapDialogRect(hWnd, &size); + + hdc = BeginPaint(hWnd, &ps); + ShowBitmapSize(hWnd, hdc, "TEWILOGO", size.left, size.top, WINWIDTH(size), WINWIDTH(size)); + EndPaint(hWnd, &ps); + }else{ + return FALSE; + } + return TRUE; +} + +void StartTewi(void){ + was_starting = TRUE; +} + +void StopTewi(void){ + was_starting = TRUE; +} + +LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp){ + if(msg == WM_COMMAND){ + int trig = LOWORD(wp); + int ev = HIWORD(wp); + if(trig == GUI_BUTTON_ABOUT){ + if(ev == BN_CLICKED){ + DialogBox(hInst, "VERSIONDLG", hWnd, VersionDialog); + } + }else if(trig == GUI_BUTTON_START){ + if(ev == BN_CLICKED){ + SendMessage(status, SB_SETTEXT, 0, (LPARAM)"Starting Tewi HTTPd"); + StartTewi(); + } + }else if(trig == GUI_BUTTON_STOP){ + if(ev == BN_CLICKED){ + SendMessage(status, SB_SETTEXT, 0, (LPARAM)"Stopping Tewi HTTPd"); + StopTewi(); + } + }else if(trig == GUI_BUTTON_EXIT){ + if(ev == BN_CLICKED){ + if(tewi_alive){ + SendMessage(status, SB_SETTEXT, 0, (LPARAM)"Stopping Tewi HTTPd"); + StopTewi(); + exiting = TRUE; + }else{ + SendMessage(hWnd, WM_CLOSE, 0, 0); + } + } + }else if(trig == GUI_LOG){ + } + }else if(msg == WM_CLOSE){ + DestroyWindow(hWnd); + }else if(msg == WM_DESTROY){ + DeleteObject(pbtewi_brush); + PostQuitMessage(0); + }else if(msg == WM_CREATE){ + RECT rc, src; + GetClientRect(hWnd, &rc); + + InitCommonControls(); + + status = CreateStatusWindow(WS_CHILD | WS_VISIBLE | CCS_BOTTOM, NULL, hWnd, GUI_STATUS); + SendMessage(status, SB_SIMPLE, 0, 0); + SendMessage(status, SB_SETTEXT, 0, (LPARAM)"Welcome to Tewi HTTPd"); + SendMessage(status, SB_GETRECT, 0, (LPARAM)&src); + + pbtewi_brush = CreateSolidBrush(RGB(0xf7, 0xc9, 0xf3)); + button_start = CreateWindow("BUTTON", "&Start", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, WINWIDTH(rc) - 100, 20 * 0, 100, 20, hWnd, (HMENU)GUI_BUTTON_START, hInst, NULL); + button_stop = CreateWindow("BUTTON", "S&top", WS_CHILD | WS_VISIBLE | WS_DISABLED | BS_PUSHBUTTON, WINWIDTH(rc) - 100, 20 * 1, 100, 20, hWnd, (HMENU)GUI_BUTTON_STOP, hInst, NULL); + button_about = CreateWindow("BUTTON", "&About", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, WINWIDTH(rc) - 100, 20 * 2, 100, 20, hWnd, (HMENU)GUI_BUTTON_ABOUT, hInst, NULL); + button_about = CreateWindow("BUTTON", "E&xit", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, WINWIDTH(rc) - 100, WINHEIGHT(rc) - WINHEIGHT(src) - 20, 100, 20, hWnd, (HMENU)GUI_BUTTON_EXIT, hInst, NULL); + logarea = CreateWindow("LISTBOX", NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL, 0, 40, WINWIDTH(rc) - 100, WINHEIGHT(rc) - 40 - WINHEIGHT(src), hWnd, (HMENU)GUI_LOG, hInst, NULL); + SetTimer(hWnd, TIMER_WATCH_TEWI, 100, NULL); + }else if(msg == WM_TIMER){ + if(wp == TIMER_WATCH_TEWI){ + if(tewi_alive){ + if(was_starting){ + was_starting = FALSE; + SendMessage(status, SB_SETTEXT, 0, (LPARAM)"Started Tewi HTTPd"); + } + EnableWindow(button_start, FALSE); + EnableWindow(button_stop, TRUE); + }else{ + if(was_starting){ + was_starting = FALSE; + SendMessage(status, SB_SETTEXT, 0, (LPARAM)"Stopped Tewi HTTPd"); + } + EnableWindow(button_start, TRUE); + EnableWindow(button_stop, FALSE); + if(exiting){ + KillTimer(hWnd, TIMER_WATCH_TEWI); + SendMessage(hWnd, WM_CLOSE, 0, 0); + } + } + } + }else if(msg == WM_PAINT){ + HDC hdc; + PAINTSTRUCT ps; + RECT rc; + RECT fill; + + GetClientRect(hWnd, &rc); + hdc = BeginPaint(hWnd, &ps); + SetRect(&fill, 0, 0, WINWIDTH(rc), 40); + FillRect(hdc, &fill, pbtewi_brush); + ShowBitmap(hWnd, hdc, "PBTEWI", 0, 0); + EndPaint(hWnd, &ps); + }else{ + return DefWindowProc(hWnd, msg, wp, lp); + } + return 0; +} + +BOOL InitApp(void){ + WNDCLASS wc; + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = WndProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = hInst; + wc.hIcon = LoadIcon(hInst, "TEWI"); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = GetSysColorBrush(COLOR_MENU); + wc.lpszMenuName = NULL; + wc.lpszClassName = "tewihttpd"; + return RegisterClass(&wc); +} + +BOOL InitWindow(int nCmdShow){ + HWND hWnd; + RECT deskrc, rc; + HWND hDeskWnd = GetDesktopWindow(); + GetWindowRect(hDeskWnd, &deskrc); + hWnd = CreateWindow("tewihttpd", "Tewi HTTPd", (WS_OVERLAPPEDWINDOW ^ WS_THICKFRAME) ^ WS_MAXIMIZEBOX, 0, 0, 600, 200, NULL, 0, hInst, NULL); + + if(!hWnd){ + return FALSE; + } + GetWindowRect(hWnd, &rc); + SetWindowPos(hWnd, HWND_TOP, (deskrc.right - (rc.right - rc.left)) / 2, (deskrc.bottom - (rc.bottom - rc.top)) / 2, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW); + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + return TRUE; +} + +int WINAPI WinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst, LPSTR lpsCmdLine, int nCmdShow){ + MSG msg; + BOOL bret; + hInst = hCurInst; + tewi_alive = FALSE; + was_starting = FALSE; + exiting = FALSE; + if(!InitApp()){ + return FALSE; + } + if(!InitWindow(nCmdShow)){ + return FALSE; + } + + while((bret = GetMessage(&msg, NULL, 0, 0)) != 0){ + if(bret == -1) { + break; + } else { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + return (int)msg.wParam; +} diff --git a/Server/gui.h b/Server/gui.h new file mode 100644 index 0000000..faf1607 --- /dev/null +++ b/Server/gui.h @@ -0,0 +1,20 @@ +/* $Id$ */ + +#ifndef __GUI_H__ +#define __GUI_H__ + +#define GUI_HELP_ABOUT 100 +#define GUI_BUTTON_START 101 +#define GUI_BUTTON_STOP 102 +#define GUI_BUTTON_ABOUT 103 +#define GUI_STATUS 104 +#define GUI_TEWI_ICON 105 +#define GUI_TEWI_NAME 106 +#define GUI_TEWI_ORIGINAL 107 +#define GUI_TEWI_DATE 108 +#define GUI_LOG 109 +#define GUI_BUTTON_EXIT 104 + +#define TIMER_WATCH_TEWI 1000 + +#endif diff --git a/Server/gui.rc b/Server/gui.rc new file mode 100644 index 0000000..11383d1 --- /dev/null +++ b/Server/gui.rc @@ -0,0 +1,18 @@ +/* $Id$ */ + +#include +#include "gui.h" +#include "tw_version.h" + +PBTEWI BITMAP "../Binary/pbtewi.bmp" +TEWILOGO BITMAP "../Binary/tewi.bmp" + +VERSIONDLG DIALOG 0, 0, 200, 50 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Version Information" +{ + LTEXT "Tewi HTTPd version " TW_VERSION, GUI_TEWI_NAME, 42, 5, 192, 50 + LTEXT "Original by Nishi ", GUI_TEWI_ORIGINAL, 42, 5 + 8, 192, 50 + LTEXT "Compilation date: " __DATE__ " " __TIME__, GUI_TEWI_DATE, 42, 5 + 8 + 8, 192, 50 + DEFPUSHBUTTON "&OK", IDOK, 75, 35, 50, 10 +} diff --git a/Server/main.c b/Server/main.c index b84a5e6..fcbd0da 100644 --- a/Server/main.c +++ b/Server/main.c @@ -7,6 +7,7 @@ #ifdef __BORLANDC__ #pragma resource "tewi_bcc.res" +#pragma resource "gui_bcc.res" #endif @@ -30,7 +31,7 @@ #include "tw_server.h" #include "tw_version.h" -#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) +#if defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) #include #endif @@ -524,6 +525,7 @@ void show_png(void) { #endif +#if !defined(BUILD_GUI) || !(defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)) int main(int argc, char** argv) { int st; logfile = stderr; @@ -704,6 +706,7 @@ int main(int argc, char** argv) { #endif return 0; } +#endif int startup(int argc, char** argv) { int i; diff --git a/Server/tewi.rc b/Server/tewi.rc index 4bb3108..7766e8a 100644 --- a/Server/tewi.rc +++ b/Server/tewi.rc @@ -2,7 +2,7 @@ #include "tw_version.h" #include "../config.h" -id ICON "../Binary/tewi.ico" +TEWI ICON "../Binary/tewi.ico" VS_VERSION_INFO VERSIONINFO FILEVERSION 1,0,0,0 PRODUCTVERSION 1,0,0,0 diff --git a/Tool/option.c b/Tool/option.c index c3b556a..1dc0650 100644 --- a/Tool/option.c +++ b/Tool/option.c @@ -13,14 +13,33 @@ int main(int argc, char** argv) { if(strcmp(argv[1], "cflags") == 0) { #ifndef NO_SSL printf("-I %s/openssl/include", argv[2]); +#endif +#ifdef BUILD_GUI + if(strcmp(argv[3], "WINDOWS_WATCOM") == 0){ + printf(" -b nt_win"); + }else if(strcmp(argv[3], "WINDOWS") == 0){ + printf(" -mwindows"); + } #endif } else if(strcmp(argv[1], "ldflags") == 0) { #ifndef NO_SSL printf("-L %s/openssl/lib", argv[2]); +#endif +#ifdef BUILD_GUI + if(strcmp(argv[3], "WINDOWS_WATCOM") == 0){ + printf(" -b nt_win"); + }else if(strcmp(argv[3], "WINDOWS") == 0){ + printf(" -mwindows"); + } #endif } else if(strcmp(argv[1], "objs") == 0) { #ifndef NO_SSL - printf("ssl.o"); + printf("ssl.%s", argv[4]); +#endif +#ifdef BUILD_GUI + if(strcmp(argv[3], "WINDOWS") == 0 || strcmp(argv[3], "WINDOWS_WATCOM") == 0){ + printf(" gui.%s", argv[4]); + } #endif } else if(strcmp(argv[1], "libs") == 0) { #ifndef NO_SSL @@ -31,12 +50,18 @@ int main(int argc, char** argv) { printf(" -lwsock32"); #else printf(" -lws2_32"); +#endif +#ifdef BUILD_GUI + printf(" -lcomctl32"); #endif }else if(strcmp(argv[3], "WINDOWS_WATCOM") == 0){ #ifdef USE_WINSOCK1 printf(" wsock32.lib"); #else printf(" ws2_32.lib"); +#endif +#ifdef BUILD_GUI + printf(" comctl32.lib"); #endif } } diff --git a/config.h.tmpl b/config.h.tmpl index 45fabd2..a5e8b09 100644 --- a/config.h.tmpl +++ b/config.h.tmpl @@ -11,6 +11,7 @@ #define HAS_CHROOT #undef NO_GETADDRINFO #undef USE_WINSOCK1 +#undef BUILD_GUI /* DO NOT EDIT BELOW THIS LINE */ @@ -22,6 +23,7 @@ #undef USE_POLL /* Force select(2) for Windows */ #endif + #if (defined(__MINGW32__) || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)) && defined(USE_WINSOCK1) && !defined(NO_GETADDRINFO) #define NO_GETADDRINFO /* getaddrinfo is not on winsock 1 */ -- 2.43.0