Le mercredi 13 février 2013 16:17:42, Thomas Preud'homme a écrit :
> 
> Ok, I can do that.

See attached patch and the diffstat below:

 configure        |   48 +++++-------------------------------------------
 print_env_info.c |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 43 deletions(-)

I suggest we include it and then release tomorrow once people checked I didn't 
break something with my last patches.

Best regards,

Thomas
diff --git a/configure b/configure
index 425f719..9bb77ec 100755
--- a/configure
+++ b/configure
@@ -25,7 +25,6 @@ TMPN="./conftest-$$"
 TMPC=$TMPN.c
 TMPH=$TMPN.h
 TMPO=$TMPN.o
-TMPE=$TMPN
 
 # default parameters
 build_cross="no"
@@ -206,21 +205,13 @@ fi
 
 if test -z "$cross_prefix" ; then
 
-# ---
-# big/little endian test
-cat > $TMPC << EOF
-#include <inttypes.h>
-int main(int argc, char ** argv){
-    volatile uint32_t i=0x01234567;
-    return (*((uint8_t*)(&i))) == 0x67;
-}
-EOF
-
-if $cc -o $TMPE $TMPC 2>/dev/null ; then
-    $TMPE && bigendian="yes"
-else
+if ! $cc -o print_env_info print_env_info.c 2>/dev/null ; then
     echo big/little test failed
+else
+	bigendian="$(./print_env_info e)"
+	gcc_major="$(./print_env_info v)"
 fi
+rm print_env_info
 
 else
 
@@ -231,35 +222,6 @@ esac
 
 fi
 
-# check gcc version
-cat > $TMPC <<EOF
-int main(void) {
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
-return 0;
-#else
-#error gcc < 3.2
-#endif
-}
-EOF
-
-gcc_major="2"
-if $cc -o $TMPO $TMPC 2> /dev/null ; then
-    gcc_major="3"
-fi
-cat > $TMPC <<EOF
-int main(void) {
-#if __GNUC__ >= 4
-return 0;
-#else
-#error gcc < 4
-#endif
-}
-EOF
-
-if $cc -o $TMPO $TMPC 2> /dev/null ; then
-    gcc_major="4"
-fi
-
 if test -z "$cross_prefix" ; then
  libc_dir="$(ldd ./print_env_info | grep libc.so | sed 's|[^/]*/\(.*/\)[^/]*|\1|')"
  multiarch_triplet=${libc_dir#*/}
diff --git a/print_env_info.c b/print_env_info.c
new file mode 100644
index 0000000..2331905
--- /dev/null
+++ b/print_env_info.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;
+}

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to