<div dir="ltr">Ok, I understand that issue now.<br><br>However, the proposed solution still doesn't solve the issue that the value will be compiled in instead of determined at run time. Presumably that is what gcc is doing so this is acceptable (the difference is that clang is less likely to be shipped "bound" to some particular OS version).<br>
<br>If its only being determined at compile time then it isn't unreasonable to obtain the number from "gcc -dM"; chances are we will end up wanting to do this for other configuration values eventually. Of course, getting the value from a header is certainly preferable if you can get the changes into FreeBSD (I'm still confused as to where gcc is getting the number from).<br>
<br> - Daniel<br><br><div class="gmail_quote">On Sat, Oct 11, 2008 at 2:08 AM, Roman Divacky <span dir="ltr"><<a href="mailto:rdivacky@freebsd.org">rdivacky@freebsd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">> >>>I might ignite a discussion on the fbsd mailing list if we can<br>
> >>>change<br>
> >>>the sources to export these two numbers to be exported in some<br>
> >>>header file.<br>
> >><br>
> >>On darwin, we autodetect using the "approved system interfaces".  The<br>
> >>idea is that we want to be able to build a binary on darwin9 and have<br>
> >>it run find on darwin10.  The idea is that we want the compiler to<br>
> >>default to generating code for the current OS, but that requires<br>
> >>detecting it (since the build may have been done on a different one).<br>
> >><br>
> >>Make sense?<br>
> ><br>
</div><div class="Ih2E3d">> >well.. I could parse output of "touch dummy_file.c ; gcc -E -dM<br>
> >dummy_file.c"<br>
> >to get the two defines. there's no other way to get this on runtime,<br>
> >is<br>
> >this an acceptable solution?<br>
><br>
> I'm confused about why that would be useful.  Worst case you could<br>
> parse the output of 'system("uname -a")' or something, no?  Presumably<br>
> uname is implemented in terms of some library/system call, and that<br>
> could just be used instead?<br>
<br>
</div>there's some confusion here...<br>
<br>
we are talking about:<br>
<div class="Ih2E3d">+  Define(Defs, "__FreeBSD__", "8");<br>
+  Define(Defs, "__FreeBSD_cc_version", "800001");<br>
<br>
</div>right?<br>
<br>
the problem is that the second number is defined only in an internal freebsd<br>
header file or can be obtained via "gcc -E -dM dummy_file.c", the __FreeBSD_cc_version<br>
does not correspond to anything in uname.<br>
<br>
so here's the plan. I'll convince people in the freebsd land to include this number<br>
in some public header file and<br>
<br>
#ifdef __FreeBSD__<br>
#include <that_header_file.h><br>
#endif<br>
<br>
to get the numbers, ok?<br>
<br>
hope it's clear enough now :)<br>
<font color="#888888"><br>
roman<br>
</font><br>
p.s. keep me CCed as I am not subscribed to the ML<br>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>