aboutsummaryrefslogtreecommitdiff
path: root/config-print.c
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2013-02-13 22:35:36 +0100
committerThomas Preud'homme <robotux@celest.fr>2013-02-13 22:35:36 +0100
commite298f608385d51911184281f1cdb09addc560c59 (patch)
tree8287eec5c504798769673f2b83dbeab9391255a8 /config-print.c
parenta4cbd9b002ab34023b6e6a3d2afc1f3496247b79 (diff)
downloadtinycc-e298f608385d51911184281f1cdb09addc560c59.tar.gz
tinycc-e298f608385d51911184281f1cdb09addc560c59.tar.bz2
Create config-print program to test $cc
Create a helper program called config-print to print informations relative to the BUILD/HOST environment in the case of native compilation.
Diffstat (limited to 'config-print.c')
-rw-r--r--config-print.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/config-print.c b/config-print.c
new file mode 100644
index 0000000..2331905
--- /dev/null
+++ b/config-print.c
@@ -0,0 +1,35 @@
+#include <inttypes.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[]) {
+ switch(argc == 2 ? argv[1][0] : 0) {
+ case 'v':
+#ifdef __GNUC__
+# if __GNUC__ >= 4
+ puts("4");
+# elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
+ puts("3");
+# else
+ puts("2");
+# endif
+#else
+ puts("0");
+#endif
+ break;
+ case 'm':
+#ifdef __GNUC__
+ printf("%d\n", __GNUC_MINOR__);
+#else
+ puts("-1");
+#endif
+ break;
+ case 'e':
+ {
+ volatile uint32_t i=0x01234567;
+ if ((*((uint8_t*)(&i))) == 0x67)
+ puts("yes");
+ }
+ break;
+ }
+ return 0;
+}