configure: use preprocessor to get infos about target arch#256
configure: use preprocessor to get infos about target arch#256the2masters wants to merge 2 commits intoocaml:trunkfrom the2masters:configure
Conversation
…ssor Signed-off-by: Stefan Hellermann <[email protected]>
Signed-off-by: Stefan Hellermann <[email protected]>
|
The detection of sizes via limits.h is clever and has some chance of being portable, assuming the C standard headers conform to C99 (section 5.2.4.1, "The values given below shall be replaced by constant expressions suitable for use in #if preprocessing directives.") Endianness detection, on the other hand, is hopelessly not portable; at best, it could be a fallback best effort in the cross-compilation case. Concerning the test for negative division, it is not needed for C99 indeed, and was removed in the trunk sources. I take it that for your project you're only interested in the OCaml bytecode compiler and run-time system, not the native-code compiler, right? |
|
2015-10-09 18:46 GMT+02:00 Xavier Leroy [email protected]:
|
|
@the2masters Why do you closed your pull request? Do you know that you can push new commits to your branch in order to update the pull-request? |
|
I know, but I wanted to create a new clean pull request. 2015-10-12 8:10 GMT+02:00 François Bobot [email protected]:
|
You can (and should) always force push to make the request clean based on the feedback you get. Opening new requests is annoying as it dilutes the discussions and comments across many PR, making follow up harder than it should be for everybody. |
* packages: Fix crash when package is removed The query for detecting new files has been changed to using git log, which has the disadventage of returning paths to file that have been added then removed.
I'm trying to port OCaml to the openwrt router distribution [1]. Openwrt makes heavy use of cross-compiling, and supports about 40 different target archs.
When cross-compiling OCaml the configure script fails on 2 tests, it cannot detect integer and pointer sizes and it cannot detect endianess. I could now add rules and manually set the values for all 40 openwrt targets into the configure script, but I think this doesn't scale well and is only useful for openwrt.
So I sat down and wrote an alternative way to detect pointer sizes and endianess by using the preprocessor and parsing it's output. This is currently lightly tested on a few archs, so please comment and test.
There is also a test in configure script which checks if negative division rounds to zero. This check currently fails in case of cross-compile, but is only a warning. I see no way to do this check in the preprocessor.
Is this test really needed? Which compiler do misbehave? Sind C99 round to zero is mandated by the C Standard.
[1] https://openwrt.org/