[cfe-dev] [PATCH]: add support for FreeBSD

Roman Divacky rdivacky at freebsd.org
Sat Oct 11 02:08:47 PDT 2008

> >>>I might ignite a discussion on the fbsd mailing list if we can  
> >>>change
> >>>the sources to export these two numbers to be exported in some
> >>>header file.
> >>
> >>On darwin, we autodetect using the "approved system interfaces".  The
> >>idea is that we want to be able to build a binary on darwin9 and have
> >>it run find on darwin10.  The idea is that we want the compiler to
> >>default to generating code for the current OS, but that requires
> >>detecting it (since the build may have been done on a different one).
> >>
> >>Make sense?
> >
> >well.. I could parse output of "touch dummy_file.c ; gcc -E -dM  
> >dummy_file.c"
> >to get the two defines. there's no other way to get this on runtime,  
> >is
> >this an acceptable solution?
> I'm confused about why that would be useful.  Worst case you could  
> parse the output of 'system("uname -a")' or something, no?  Presumably  
> uname is implemented in terms of some library/system call, and that  
> could just be used instead?

there's some confusion here...

we are talking about:
+  Define(Defs, "__FreeBSD__", "8");
+  Define(Defs, "__FreeBSD_cc_version", "800001");


the problem is that the second number is defined only in an internal freebsd
header file or can be obtained via "gcc -E -dM dummy_file.c", the __FreeBSD_cc_version
does not correspond to anything in uname.

so here's the plan. I'll convince people in the freebsd land to include this number
in some public header file and 

#ifdef __FreeBSD__
#include <that_header_file.h>

to get the numbers, ok?

hope it's clear enough now :)


p.s. keep me CCed as I am not subscribed to the ML
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081011/23efaf09/attachment.sig>

More information about the cfe-dev mailing list