Skip to content

Commit e49159b

Browse files
committed
Merge pull request #418 from asarium/build/native
Use -march=native for linux builds
2 parents a135426 + 206fbab commit e49159b

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

configure.ac

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ AC_ARG_ENABLE(fatal-warnings,
8888
[fs2_fatal_warnings=no],
8989
)
9090

91+
AC_ARG_ENABLE(generic-architecture,
92+
AC_HELP_STRING([--enable-generic-architecture],
93+
[Only use generic architecture optimizations]),
94+
[fs2_generic_architecture=$enableval],
95+
[fs2_generic_architecture=no],
96+
)
97+
9198
AC_ARG_WITH(static-ogg,
9299
AC_HELP_STRING([--with-static-ogg=DIR],
93100
[Link staticly with OGG, Vorbis and Theora libs from this directory]),
@@ -128,14 +135,28 @@ case "$target" in
128135
# linux
129136
echo "Using 64-bit Unix defines (for $host_os)"
130137
fs2_os_linux="yes"
131-
D_CFLAGS="$D_CFLAGS -m64 -mtune=generic -msse -msse2 -pipe"
138+
139+
if test "$fs2_generic_architecture" = "yes" ; then
140+
D_CFLAGS="$D_CFLAGS -m64 -mtune=generic -mfpmath=sse -msse -msse2"
141+
else
142+
D_CFLAGS="$D_CFLAGS -march=native"
143+
fi
144+
145+
D_CFLAGS="$D_CFLAGS -pipe"
132146
D_CFLAGS="$D_CFLAGS -DLUA_USE_LINUX"
133147
;;
134148
*-*-linux*)
135149
# linux
136150
echo "Using Unix defines (for $host_os)"
137151
fs2_os_linux="yes"
138-
D_CFLAGS="$D_CFLAGS -mtune=generic -mfpmath=sse -msse -msse2 -pipe"
152+
153+
if test "$fs2_generic_architecture" = "yes" ; then
154+
D_CFLAGS="$D_CFLAGS -mtune=generic -mfpmath=sse -msse -msse2"
155+
else
156+
D_CFLAGS="$D_CFLAGS -march=native"
157+
fi
158+
159+
D_CFLAGS="$D_CFLAGS -pipe"
139160
D_CFLAGS="$D_CFLAGS -DLUA_USE_LINUX"
140161
;;
141162
*-*-darwin*)

0 commit comments

Comments
 (0)