mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
Use "-march=native" when possible.
Recent versions of GCC have a tuning option value of 'native', which causes the compiler to optimize the build for the CPU the compile is performed on. Since most people are building Asterisk on the machine they plan to run it on, the configure script and build system will now use this value unless a different value is specified by the user in CFLAGS when the configure script is executed. In addition, this value will be used for building the GSM and LPC10 codecs as well, in preference to the logic that has been in their Makefiles forever to optimize for certain types of CPUs. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@310332 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -45,28 +45,33 @@ ifeq ($(shell $(CC) -v 2>&1 | awk '/^gcc version/ { split($$3, v, "."); printf "
|
||||
OPTIMIZE=-O2
|
||||
endif
|
||||
|
||||
ifeq (,$(findstring $(shell uname -s),Darwin SunOS))
|
||||
ifeq (,$(strip $(findstring $(PROC) ,"x86_64 amd64 ultrasparc sparc64 arm armv5b armeb ppc powerpc ppc64 ia64 s390 bfin mipsel mips ")))
|
||||
ifeq (,$(strip $(findstring $(shell uname -m) ,"ppc ppc64 alpha armv4l s390 ")))
|
||||
OPTIMIZE+=-march=$(PROC)
|
||||
# If the compiler's '-march' flag has been specified already, then assume it's a value
|
||||
# that is what the user wants (or has been determined by the configure script). If not,
|
||||
# do some simple logic to set a decent value
|
||||
ifeq ($(findstring -march,$(_ASTCFLAGS) $(ASTCFLAGS)),)
|
||||
ifeq (,$(findstring $(shell uname -s),Darwin SunOS))
|
||||
ifeq (,$(strip $(findstring $(PROC) ,"x86_64 amd64 ultrasparc sparc64 arm armv5b armeb ppc powerpc ppc64 ia64 s390 bfin mipsel mips ")))
|
||||
ifeq (,$(strip $(findstring $(shell uname -m) ,"ppc ppc64 alpha armv4l s390 ")))
|
||||
OPTIMIZE+=-march=$(PROC)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifneq (,$(findstring $(OSARCH),Darwin))
|
||||
ifeq ($(shell /usr/bin/sw_vers -productVersion | cut -c1-4),10.6)
|
||||
# Snow Leopard reports i386, even though it's really x86_64
|
||||
OPTIMIZE+=-mtune=native
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifneq (,$(findstring $(OSARCH),Darwin))
|
||||
ifeq ($(shell /usr/bin/sw_vers -productVersion | cut -c1-4),10.6)
|
||||
# Snow Leopard reports i386, even though it's really x86_64
|
||||
OPTIMIZE+=-mtune=native
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
|
||||
#This works for even old (2.96) versions of gcc and provides a small boost either way.
|
||||
#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
|
||||
#So we go lowest common available by gcc and go a step down, still a step up from
|
||||
#the default as we now have a better instruction set to work with. - Belgarath
|
||||
ifeq ($(PROC),ultrasparc)
|
||||
OPTIMIZE+=-mcpu=v8 -mtune=$(PROC) -O3
|
||||
#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
|
||||
#This works for even old (2.96) versions of gcc and provides a small boost either way.
|
||||
#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it.
|
||||
#So we go lowest common available by gcc and go a step down, still a step up from
|
||||
#the default as we now have a better instruction set to work with. - Belgarath
|
||||
ifeq ($(PROC),ultrasparc)
|
||||
OPTIMIZE+=-mcpu=v8 -mtune=$(PROC) -O3
|
||||
endif
|
||||
endif
|
||||
|
||||
PG =
|
||||
|
Reference in New Issue
Block a user