[EXAMPLE-PATCH] Autodetect -march=i586/686

Nicholas J. Leon (nicholas@binary9.net)
Thu, 28 May 1998 19:11:53 -0400 (EDT)


Since I'm posting useless patches, here's another. It detects whether your
compiler is capable of handling
-march=i586
and/or
-march=i686

for those egcs/gcc 2.8 people. I am hoping that since we are a long way
away from using GNU's autoconf (or something similiar), this may give some
ideas to people.

Thank you!

diff -Nur linux.104-prist/arch/i386/Makefile linux.104-egcs/arch/i386/Makefile
--- linux.104-prist/arch/i386/Makefile Fri May 8 03:09:20 1998
+++ linux.104-egcs/arch/i386/Makefile Thu May 28 19:08:00 1998
@@ -36,11 +36,21 @@
endif

ifdef CONFIG_M586
+HAS586 := $(shell touch dummy.c; if $(CC) -march=i586 -c dummy.c 2>&1 >/dev/null; then echo y;else echo n;fi; rm -f dummy.[oc] )
+ifeq ($(HAS586),y)
+CFLAGS := $(CFLAGS) -march=i586 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
+else
CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
endif
+endif

ifdef CONFIG_M686
+HAS686 := $(shell touch dummy.c; if $(CC) -march=i686 -c dummy.c 2>&1 >/dev/null; then echo y;else echo n;fi; rm -f dummy.[oc] )
+ifeq ($(HAS686),y)
+CFLAGS := $(CFLAGS) -march=i686 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
+else
CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686
+endif
endif

ifdef SMP

___________________________________________________________________________

simple is elegant mrnick.binary9.net nicholas@binary9.net
___________________________________________________________________________

Linux 2.1.104 #2 Thu May 28 14:52:53 EDT 1998, up 4:08
Linux 2.1.103 #2 Fri May 22 11:45:19 EDT 1998, up 5:47
Linux 2.1.96 #2 Wed Apr 15 11:38:48 EDT 1998, up 2 days

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu