On 12/16/07, Pete French <[EMAIL PROTECTED]> wrote:
> fairly simple question really - on machines where I never use the compiled
> binaries anywhere else, is it O.K. to set the CPU type to 'native' in
> make.conf ? According to gcc this should detect the processor type and
> set the various flas as approrpiate, which is nice, as we have a mix of P3,
> P4 and AMD processors around the place, and having one make.conf which will
> do the right thing on all of them would be nice.
>
> I've been trying it out on a couple of machines, and it seems to work fine,
> but I have a feeling that various bits of the kerenel complie are
> sensetive to the cpu type, so am just asking to check if it's O.K.
>
While setting CPUTYPE=native in /etc/make.conf may work, it fails to
set MACHINE_CPU to the correct values for your processor type.

The problem is that bsd.cpu.mk doesn't know how to handle CPU type 'native'.

There is a simple fix for this problem by applying the attached patch
which uses:

gcc -v -x c -E -mtune=native /dev/null -o /dev/null 2>&1 | grep mtune
| sed -e 's/.*mtune=//'

to reset CPUTYPE to the processor type of your system when CPUTYPE=native.

Scot
Index: bsd.cpu.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.cpu.mk,v
retrieving revision 1.63
diff -u -r1.63 bsd.cpu.mk
--- bsd.cpu.mk	16 Oct 2007 18:32:37 -0000	1.63
+++ bsd.cpu.mk	17 Oct 2007 22:28:32 -0000
@@ -18,6 +18,14 @@
 . endif
 .else
 
+# Handle 'native' by converting it to the appropriate CPUTYPE
+
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
+. if ${CPUTYPE} == "native"
+CPUTYPE != gcc -v -x c -E -mtune=native /dev/null -o /dev/null 2>&1 | grep mtune | sed -e 's/.*mtune=//'
+. endif
+.endif
+
 # Handle aliases (not documented in make.conf to avoid user confusion
 # between e.g. i586 and pentium)
 
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to