Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 665770
Collapse All | Expand All

(-)./configure.ac (-19 / +19 lines)
Lines 169-213 Link Here
169
	else
169
	else
170
		CFLAGS=""
170
		CFLAGS=""
171
		dnl O3 generally gives better performance than O2 in both Intel and ARM
171
		dnl O3 generally gives better performance than O2 in both Intel and ARM
172
		AC_CHECK_CC_OPT([-O3], [CFLAGS="$CFLAGS -O3"], [])
172
		AX_CHECK_COMPILE_FLAG([-O3], [CFLAGS="$CFLAGS -O3"], [])
173
173
174
		if test $ac_enable_32 = yes ; then
174
		if test $ac_enable_32 = yes ; then
175
			dnl Force build for 32 bit x86
175
			dnl Force build for 32 bit x86
176
			AC_CHECK_CC_OPT([-m32 -march=i686], [CFLAGS="$CFLAGS -m32 -march=i686"], [])
176
			AX_CHECK_COMPILE_FLAG([-m32 -march=i686], [CFLAGS="$CFLAGS -m32 -march=i686"], [])
177
			AC_CHECK_CC_OPT([-fomit-frame-pointer], [CFLAGS="$CFLAGS -fomit-frame-pointer"], [])
177
			AX_CHECK_COMPILE_FLAG([-fomit-frame-pointer], [CFLAGS="$CFLAGS -fomit-frame-pointer"], [])
178
		elif $GREP a02082\\\|a22082 /proc/cpuinfo >/dev/null 2>&1; then
178
		elif $GREP a02082\\\|a22082 /proc/cpuinfo >/dev/null 2>&1; then
179
			dnl Raspberry Pi 3
179
			dnl Raspberry Pi 3
180
			dnl GCC 4 has problems with -march=native in Raspbian,
180
			dnl GCC 4 has problems with -march=native in Raspbian,
181
			dnl resulting in a "double free or corruption" error
181
			dnl resulting in a "double free or corruption" error
182
			dnl See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=139091
182
			dnl See: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=139091
183
			AC_CHECK_CC_OPT([-march=armv8-a+crc], [CFLAGS="$CFLAGS -march=armv8-a+crc"], [])
183
			AX_CHECK_COMPILE_FLAG([-march=armv8-a+crc], [CFLAGS="$CFLAGS -march=armv8-a+crc"], [])
184
			AC_CHECK_CC_OPT([-mtune=cortex-a53], [CFLAGS="$CFLAGS -mtune=cortex-a53"], [])
184
			AX_CHECK_COMPILE_FLAG([-mtune=cortex-a53], [CFLAGS="$CFLAGS -mtune=cortex-a53"], [])
185
			AC_CHECK_CC_OPT([-mfloat-abi=hard], [CFLAGS="$CFLAGS -mfloat-abi=hard"], [])
185
			AX_CHECK_COMPILE_FLAG([-mfloat-abi=hard], [CFLAGS="$CFLAGS -mfloat-abi=hard"], [])
186
			AC_CHECK_CC_OPT([-mfpu=crypto-neon-fp-armv8], [CFLAGS="$CFLAGS -mfpu=crypto-neon-fp-armv8"], [])
186
			AX_CHECK_COMPILE_FLAG([-mfpu=crypto-neon-fp-armv8], [CFLAGS="$CFLAGS -mfpu=crypto-neon-fp-armv8"], [])
187
			AC_CHECK_CC_OPT([-funsafe-math-optimizations], [CFLAGS="$CFLAGS -funsafe-math-optimizations"], [])
187
			AX_CHECK_COMPILE_FLAG([-funsafe-math-optimizations], [CFLAGS="$CFLAGS -funsafe-math-optimizations"], [])
188
			dnl Raspberry Pi 2
188
			dnl Raspberry Pi 2
189
		elif $GREP a01040\\\|a01041\\\|a21041\\\|a22042 /proc/cpuinfo >/dev/null 2>&1; then
189
		elif $GREP a01040\\\|a01041\\\|a21041\\\|a22042 /proc/cpuinfo >/dev/null 2>&1; then
190
			AC_CHECK_CC_OPT([-march=armv7-a], [CFLAGS="$CFLAGS -march=armv7-a"], [])
190
			AX_CHECK_COMPILE_FLAG([-march=armv7-a], [CFLAGS="$CFLAGS -march=armv7-a"], [])
191
			AC_CHECK_CC_OPT([-mfpu=neon-vfpv4], [CFLAGS="$CFLAGS -mfpu=neon-vfpv4"], [])
191
			AX_CHECK_COMPILE_FLAG([-mfpu=neon-vfpv4], [CFLAGS="$CFLAGS -mfpu=neon-vfpv4"], [])
192
		else
192
		else
193
			AC_CHECK_CC_OPT([-march=native], [CFLAGS="$CFLAGS -march=native"], [])
193
			AX_CHECK_COMPILE_FLAG([-march=native], [CFLAGS="$CFLAGS -march=native"], [])
194
			AC_CHECK_CC_OPT([-fomit-frame-pointer], [CFLAGS="$CFLAGS -fomit-frame-pointer"], [])
194
			AX_CHECK_COMPILE_FLAG([-fomit-frame-pointer], [CFLAGS="$CFLAGS -fomit-frame-pointer"], [])
195
		fi
195
		fi
196
196
197
		dnl Code was written when compilers where not aggressively optimizing undefined behaviour about aliasing
197
		dnl Code was written when compilers where not aggressively optimizing undefined behaviour about aliasing
198
		dnl WARNING! At present disabled to maximize performance
198
		dnl WARNING! At present disabled to maximize performance
199
		dnl AC_CHECK_CC_OPT([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"], [])
199
		dnl AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"], [])
200
		dnl Code was written when compilers where not aggressively optimizing undefined behaviour about overflow in signed integers
200
		dnl Code was written when compilers where not aggressively optimizing undefined behaviour about overflow in signed integers
201
		dnl WARNING! At present disabled to maximize performance
201
		dnl WARNING! At present disabled to maximize performance
202
		dnl AC_CHECK_CC_OPT([-fno-strict-overflow], [CFLAGS="$CFLAGS -fno-strict-overflow"], [])
202
		dnl AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CFLAGS="$CFLAGS -fno-strict-overflow"], [])
203
		dnl Code was written on Intel where char is signed
203
		dnl Code was written on Intel where char is signed
204
		AC_CHECK_CC_OPT([-fsigned-char], [CFLAGS="$CFLAGS -fsigned-char"], [])
204
		AX_CHECK_COMPILE_FLAG([-fsigned-char], [CFLAGS="$CFLAGS -fsigned-char"], [])
205
		dnl We are not interested in stack protection
205
		dnl We are not interested in stack protection
206
		AC_CHECK_CC_OPT([-fno-stack-protector], [CFLAGS="$CFLAGS -fno-stack-protector"], [])
206
		AX_CHECK_COMPILE_FLAG([-fno-stack-protector], [CFLAGS="$CFLAGS -fno-stack-protector"], [])
207
		dnl Some useful warnings
207
		dnl Some useful warnings
208
		AC_CHECK_CC_OPT([-Wall], [CFLAGS="$CFLAGS -Wall"], [])
208
		AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"], [])
209
		AC_CHECK_CC_OPT([-Wno-sign-compare], [CFLAGS="$CFLAGS -Wno-sign-compare"], [])
209
		AX_CHECK_COMPILE_FLAG([-Wno-sign-compare], [CFLAGS="$CFLAGS -Wno-sign-compare"], [])
210
		AC_CHECK_CC_OPT([-Wno-unused], [CFLAGS="$CFLAGS -Wno-unused"], [])
210
		AX_CHECK_COMPILE_FLAG([-Wno-unused], [CFLAGS="$CFLAGS -Wno-unused"], [])
211
	fi
211
	fi
212
	if test ! -z $ac_host_cflags; then
212
	if test ! -z $ac_host_cflags; then
213
		CFLAGS="$ac_host_cflags $CFLAGS"
213
		CFLAGS="$ac_host_cflags $CFLAGS"

Return to bug 665770