GNOME Bugzilla – Bug 172179
guard _POSIX_SOURCE in gmime-gpg-context.c for IRIX alone
Last modified: 2006-06-23 00:33:30 UTC
Version details: 2.1.14 configure gmime 2.1.14 on a commercial UNIX, with the compiler set so that it sees the "most modern" set of symbols (e.g. UNIX98). In my particular case, I configured gmime on Tru64 UNIX with the `-std' flag, which results in much more than just the symbols defined by _POSIX_SOURCE being visible. When the compile gets to gmime/gmime-gpg-context.c, it bombs out because _POSIX_SOURCE is now defined, and that effectively hides some needed symbols in the headers that are subsequently included. Since the #define was added specifically for IRIX, the workaround is to guard the define with tests for IRIX. I believe I have done that, though I haven't tested it on our IRIX boxes yet, since I don't have glib on any of them currently. Patch is attached
Created attachment 39467 [details] [review] only define _POSIX_SOURCE if we're on IRIX
how do you know it's only needed for IRIX? I don't have an IRIX machine either, so without beign able to test I'm a bit nervous about committing.
I do have IRIX, I just hadn't tested it when I submitted the initial report. I don't know if only IRIX needs it; I do know that it causes harm on at least one other platform. Since hardcoding _POSIX_SOURCE seemed like kind of a hack to pacify IRIX, I made the code conditional on being on IRIX. I could reverse the sense, and make it only *not* defined on Tru64, but that's also a hack. Alternately, I could try come up with an autoconf test to tell where _POSIX_SOURCE is needed to see the relevant symbols. That's harder, and will take more time, but is possible. Which of the three options do you prefer?
seems like the correct approach is to configure check for its need
I'll see if I can come up with such a test, though I suspect it's going to be a while before I get a chance to do so.
I've spent a bunch of time building the prerequisites on IRIX with the vendor toolchain, and then built gmime 2.1.14. I turned up several unrelated build issues for gmime, which I'll report in different bug reports (hopefully tomorrow). I removed the #define _POSIX_SOURCE, to see how the gmime-gpg-context.c would fail, so I could determine how best to test with autoconf. With the #deifine gone, gmime-gpg-context.c built just fine with the MIPSPro 7.4 C compiler, whether using CC=cc CFLAGS='-64 -xansi' or using CC=c99 CFLAGS='-64' If I instead leave the #define _POSIX_SOURCE there and build, the build *fails*. So, despite the comment above the #define, IRIX (at least recent IRIX) is much better off without the #define. At this point, I don't know why the #define was originally added, but it actually causes build failures on at least two platforms I've tested on. I could test on Solaris 8 with the Forte (commercial) compiler, if you like. Other than that, I don't know how to proceed with this.
I guess we might as well just remove it then.
just removed the #define in CVS - will be included in 2.2.3