This patch fixes several issues compiling setup.exe with gcc-4.x while retaining compatibility with gcc-3.4, as tested with gcc-mingw-3.4.4-999 and my mingw-gcc-4.5.1 sample build. Once we switch to a proper mingw-gcc cross-compiler, the only change that will need to be made is to CC/CXX in doconfigure.
OK to apply? Yaakov
2010-08-10 Yaakov Selkowitz <yselkow...@users.sourceforge.net> Fix compatibility with GCC 4.x. * Makefile.am (setup_LDFLAGS): Pass -static to compiler instead of linker so that libgcc is statically linked as well. (autoload.o): Disable optimization. * localdir.cc (browse_cb): Fix "jump to case label crosses initialization" error. * mklink2.cc (sfli): Fix "non-local variable uses anonymous type" warning. * ntdll.h: Fix "redeclared without dllimport attribute: previous dllimport ignored" warnings. * package_message.h (display): Fix "'exit' was not declared in this scope" error. Index: Makefile.am =================================================================== RCS file: /cvs/cygwin-apps/setup/Makefile.am,v retrieving revision 2.81 diff -u -r2.81 Makefile.am --- Makefile.am 8 Apr 2010 15:50:38 -0000 2.81 +++ Makefile.am 23 Jul 2010 17:01:14 -0000 @@ -114,7 +114,7 @@ libinilex.a \ libgetopt++/libgetopt++.la -lgcrypt -lgpg-error \ -lshlwapi -lcomctl32 -lole32 -lwsock32 -lnetapi32 -luuid -llzma -lbz2 -lz -setup_LDFLAGS = -mwindows -Wl,-static -static-libtool-libs +setup_LDFLAGS = -mwindows -Wc,-static -static-libtool-libs setup_SOURCES = \ AntiVirus.cc \ AntiVirus.h \ @@ -283,6 +283,9 @@ libmd5-rfc/md5.c \ libmd5-rfc/md5.h +# autoload code does not optimize well +autoload.o: CFLAGS += -O0 + VER := $(shell sed -ne 's/^\$$Revi[s]ion: *\([^ ]*\) *$$.*/\1/p' \ $(srcdir)/ChangeLog) Index: localdir.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/localdir.cc,v retrieving revision 2.36 diff -u -r2.36 localdir.cc --- localdir.cc 2 Feb 2010 17:28:10 -0000 2.36 +++ localdir.cc 23 Jul 2010 17:01:14 -0000 @@ -152,12 +152,14 @@ SendMessage (h, BFFM_SETSELECTION, TRUE, (LPARAM) local_dir.c_str()); break; case BFFM_SELCHANGED: - // Make a note of each new dir we successfully select, so that - // we know where to create the new directory if an invalid name - // is entered in the text box. - LPITEMIDLIST pidl = reinterpret_cast<LPITEMIDLIST>(lp); - SHGetPathFromIDList (pidl, dirname); - break; + { + // Make a note of each new dir we successfully select, so that + // we know where to create the new directory if an invalid name + // is entered in the text box. + LPITEMIDLIST pidl = reinterpret_cast<LPITEMIDLIST>(lp); + SHGetPathFromIDList (pidl, dirname); + break; + } case BFFM_VALIDATEFAILED: // See if user wants to create a dir in the last successfully-selected. CHAR tempname[MAX_PATH]; Index: mklink2.cc =================================================================== RCS file: /cvs/cygwin-apps/setup/mklink2.cc,v retrieving revision 2.11 diff -u -r2.11 mklink2.cc --- mklink2.cc 18 Dec 2009 11:59:54 -0000 2.11 +++ mklink2.cc 23 Jul 2010 17:01:14 -0000 @@ -111,7 +111,7 @@ : mkcygsymlink_9x (from, to); } -struct { +static struct { FILE_LINK_INFORMATION fli; WCHAR namebuf[32768]; } sfli; Index: ntdll.h =================================================================== RCS file: /cvs/cygwin-apps/setup/ntdll.h,v retrieving revision 2.2 diff -u -r2.2 ntdll.h --- ntdll.h 13 May 2009 11:28:34 -0000 2.2 +++ ntdll.h 23 Jul 2010 17:01:14 -0000 @@ -14,6 +14,8 @@ #ifndef SETUP_NTDLL_H #define SETUP_NTDLL_H +#define NTOSAPI + #include "ddk/ntapi.h" #include "ddk/ntifs.h" Index: package_message.h =================================================================== RCS file: /cvs/cygwin-apps/setup/package_message.h,v retrieving revision 1.2 diff -u -r1.2 package_message.h --- package_message.h 22 Dec 2009 16:19:51 -0000 1.2 +++ package_message.h 23 Jul 2010 17:01:14 -0000 @@ -15,6 +15,7 @@ #include "UserSettings.h" #include "state.h" +#include <stdlib.h> #include <windows.h> class packagemessage