]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/configure.cpp
Add support for /nick 0: changes nick to UID, which can come in useful for circumstan...
[user/henk/code/inspircd.git] / win / configure.cpp
index 852d3ea7350d4113fdd4cdede61b9c48faaaca3b..40a5ea0d25edbbc4bc6716ba6176243e7f5675b2 100644 (file)
@@ -146,13 +146,7 @@ int __stdcall WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPS
 {
        if (!strcmp(lpCmdLine, "/rebase"))
        {
-               AllocConsole();
-               // pipe standard handles to this console
-               freopen("CONIN$", "r", stdin);
-               freopen("CONOUT$", "w", stdout);
-               freopen("CONOUT$", "w", stderr);
                Rebase();
-               FreeConsole();
                return 0;
        }
        FILE * j = fopen("inspircd_config.h", "r");
@@ -432,13 +426,21 @@ void Rebase()
        *dest = 0;
 
        WIN32_FIND_DATA fd;
+#ifdef _DEBUG
+       HANDLE fh = FindFirstFile("..\\bin\\debug\\lib\\*.so", &fd);
+#else
        HANDLE fh = FindFirstFile("..\\bin\\release\\lib\\*.so", &fd);
+#endif
        if(fh == INVALID_HANDLE_VALUE)
                return;
 
        do
        {
+#ifdef _DEBUG
+               strcat(dest, " ..\\bin\\debug\\lib\\");
+#else
                strcat(dest, " ..\\bin\\release\\lib\\");
+#endif
                strcat(dest, fd.cFileName);
        }
        while (FindNextFile(fh, &fd));
@@ -449,7 +451,11 @@ void Rebase()
        printf("%s\n", command);
        system(command);
 
+#ifdef _DEBUG
+       fh = FindFirstFile("..\\bin\\debug\\modules\\*.so", &fd);
+#else
        fh = FindFirstFile("..\\bin\\release\\modules\\*.so", &fd);
+#endif
        if(fh == INVALID_HANDLE_VALUE)
                return;
 
@@ -457,7 +463,11 @@ void Rebase()
 
        do
        {
+#ifdef _DEBUG
+               strcat(dest, " ..\\bin\\debug\\modules\\");
+#else
                strcat(dest, " ..\\bin\\release\\modules\\");
+#endif
                strcat(dest, fd.cFileName);
        }
        while (FindNextFile(fh, &fd));
@@ -514,7 +524,7 @@ void WriteCompileCommands()
                CreateDirectory("..\\bin\\debug\\lib", NULL);
                CreateDirectory("..\\bin\\debug\\modules", NULL);
        #else
-               fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /MD /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release_x64\\bin\\inspircd.lib /OUT:\"..\\..\\bin\\release_x64\\lib\\$*.so\" /PDB:\"..\\..\\bin\\release_x64\\lib\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\release_x64\\lib\\$*.lib\"\n\n");
+               fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /GL /MD /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release_x64\\bin\\inspircd.lib /OUT:\"..\\..\\bin\\release_x64\\lib\\$*.so\" /PDB:\"..\\..\\bin\\release_x64\\lib\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\release_x64\\lib\\$*.lib\"\n\n");
                CreateDirectory("..\\src\\release", NULL);
                CreateDirectory("..\\bin\\release\\bin", NULL);
                CreateDirectory("..\\bin\\release\\lib", NULL);
@@ -528,7 +538,7 @@ void WriteCompileCommands()
                CreateDirectory("..\\bin\\debug\\lib", NULL);
                CreateDirectory("..\\bin\\debug\\modules", NULL);
        #else
-               fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /MD /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release\\bin\\inspircd.lib /OUT:\"..\\..\\bin\\release\\lib\\$*.so\" /PDB:\"..\\..\\bin\\release\\lib\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\release\\lib\\$*.lib\"\n\n");
+               fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/commands\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /GL /MD /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release\\bin\\inspircd.lib /OUT:\"..\\..\\bin\\release\\lib\\$*.so\" /PDB:\"..\\..\\bin\\release\\lib\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\release\\lib\\$*.lib\"\n\n");
                CreateDirectory("..\\src\\release", NULL);
                CreateDirectory("..\\bin\\release\\bin", NULL);
                CreateDirectory("..\\bin\\release\\lib", NULL);
@@ -536,7 +546,11 @@ void WriteCompileCommands()
        #endif
 #endif
 
-       fprintf(f, "makedir:\n  if not exist debug mkdir debug\n  if not exist release mkdir release\n\n");
+#ifdef _DEBUG
+       fprintf(f, "makedir:\n  if not exist debug mkdir debug\n  if not exist ..\\..\\bin\\debug\\lib mkdir ..\\..\\bin\\debug\\lib\n\n");
+#else
+       fprintf(f, "makedir:\n  if not exist release mkdir release\n  if not exist ..\\..\\bin\\release\\lib mkdir ..\\..\\bin\\release\\lib\n\n");
+#endif
        
        // dump modules.. again the second and last time :)
        for(int i = 0; i < command_count; ++i)
@@ -588,7 +602,7 @@ void WriteCompileModules()
                fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" /D \"WIN32\" /D \"_DEBUG\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /Gm /EHsc /Gm /RTC1 /MDd /Fo\"Debug/\" /Fd\"Debug/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\debug_x64\\bin\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\debug_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\debug_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\debug_x64\\modules\\$*.lib\"\n\n");
                CreateDirectory("..\\src\\modules\\debug_x64", NULL);
        #else
-               fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /MD /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release_x64\\bin\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\release_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\release_x64\\modules\\$*.lib\"\n\n");
+               fprintf(f, "  cl /nologo /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /GL /MD /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release_x64\\bin\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\release_x64\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release_x64\\modules\\$*.pdb\" /MACHINE:X64 /IMPLIB:\"..\\..\\bin\\release_x64\\modules\\$*.lib\"\n\n");
                CreateDirectory("..\\src\\modules\\release_x64", NULL);
        #endif
 #else
@@ -599,7 +613,7 @@ void WriteCompileModules()
                CreateDirectory("..\\src\\modules\\debug\\modules", NULL);
                CreateDirectory("..\\src\\modules\\debug\\bin", NULL);
        #else
-               fprintf(f, "  cl /nologo -Dssize_t=long /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /MD /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release\\bin\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\release\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\release\\modules\\$*.lib\"\n\n");
+               fprintf(f, "  cl /nologo -Dssize_t=long /LD /Od /I \".\" /I \"../../include\" /I \"../../include/modes\" /I \"../../include/modules\" /I \"../../win\" /D \"WIN32\" /D \"_CONSOLE\" /D \"_MBCS\" /D \"DLL_BUILD\" /EHsc /Gm /GL /MD /Fo\"Release/\" /Fd\"Release/vc70.pdb\" /W2 /Wp64 /Zi /TP $*.cpp ..\\..\\win\\inspircd_memory_functions.cpp /link ..\\..\\bin\\release\\bin\\inspircd.lib ws2_32.lib /OUT:\"..\\..\\bin\\release\\modules\\$*.so\" /PDB:\"..\\..\\bin\\release\\modules\\$*.pdb\" /IMPLIB:\"..\\..\\bin\\release\\modules\\$*.lib\"\n\n");
                CreateDirectory("..\\src\\modules\\release", NULL);
                CreateDirectory("..\\src\\modules\\release\\lib", NULL);
                CreateDirectory("..\\src\\modules\\release\\modules", NULL);
@@ -607,7 +621,11 @@ void WriteCompileModules()
        #endif
 #endif
        
-       fprintf(f, "makedir:\n  if not exist debug mkdir debug\n  if not exist release mkdir release\n\n");
+#ifdef _DEBUG
+       fprintf(f, "makedir:\n  if not exist debug mkdir debug\n  if not exist ..\\..\\bin\\debug\\modules mkdir ..\\..\\bin\\debug\\modules\n\n");
+#else
+       fprintf(f, "makedir:\n  if not exist release mkdir release\n  if not exist ..\\..\\bin\\release\\modules mkdir ..\\..\\bin\\release\\modules\n\n");
+#endif
 
        // dump modules.. again the second and last time :)
        for(int i = 0; i < module_count; ++i)