[Gtkradiant] Re: Patch work for FreeBSD native build

Lyndon Griffin gtkradiant@zerowing.idsoftware.com
Mon, 30 Sep 2002 02:07:55 -0400

I made some solid progress today (Sunday).  I'm using __nix__ as the 
#define, rather than __unix__ (there's apparently a gcc builtin that is 
__unix__, probably wouldn't be wise to use it without knowing more about 

I've slowed a tad - there's a problem that I ran into early on in my efforts 
that I never resolved, and I've decided to figure it out before I continue.  
The gist of the problem is that the preprocessor wants to rename 
idStr::toupper() and idStr::tolower() to __toupper and __tolower because of 
macros which get included from FreeBSD's ctype.h:
#define toupper(c) __toupper(c)
#define tolower(c) __tolower(c) 

The files in question are libs/splines/util_str.(h|cpp) in Stable-1_2.  I 
think these go away in 1.3, and it appears that they aren't used outside of 
the splines library, but I'd like to avoid renaming the functions, if 
possible (which is what I've done in the past to get through the build). 

So, I have a proposed solution:  it goes something like this: 

#if !defined  (__FreeBSD__)
#include <ctype.h>
//macro my own ::toupper(int) here
//macro my own ::tolower(int) here

Not pretty, but it might work.  I only shudder at that because it does take 
away from the consolidation of using __nix__ in place of __FreeBSD__ 
__linux__ __APPLE__, but I already know two other places where I'm going to 
!define __FreeBSD__; one is in abandoned code that ain't worth fixing, the 
other is just to get a warning-free compile (FreeBSD's malloc moved from 
malloc.h to stdlib.h a while back). 

Anyways, I've got the Construct worked around to detect the OS and append 
"-D__nix__" to $BASE_CFLAGS, if necessary.  Also, I dropped logic in 
Construct to "find" the xml2-config/gtk-config/glib-config executables and 
export those locations to Conscripts, and I have most of the Conscripts 
importing those variables and using them successfully. 

I hate to make and break a promise, but if I get any free time at work 
tomorrow, I believe I'll be dropping a new patch on bugzilla before bedtime. 
For now, I gots to get sleep. 

<:)  Lyndon