unix: Defaults -Ofast and adds --enable-sse41, --enable-avx and --enable-neon.

This commit is contained in:
Kenta Yoshimura 2019-05-05 02:54:25 +09:00
parent 0f71fcd0ab
commit c1042e5349
2 changed files with 336 additions and 3 deletions

290
unix/configure vendored
View File

@ -709,6 +709,9 @@ ac_user_opts='
enable_option_checking enable_option_checking
enable_debug enable_debug
enable_mtune enable_mtune
enable_sse41
enable_avx2
enable_neon
enable_gamepad enable_gamepad
enable_debugger enable_debugger
enable_netplay enable_netplay
@ -1362,6 +1365,9 @@ Optional Features:
(default: no) (default: no)
--enable-mtune use the specified value for the -mtune/-mcpu flag --enable-mtune use the specified value for the -mtune/-mcpu flag
(default: no) (default: no)
--enable-sse41 enable SSE4.1 if available (default: no)
--enable-avx2 enable AVX2 if available (default: no)
--enable-neon enable NEON if available (default: no)
--enable-gamepad enable gamepad support if available (default: yes) --enable-gamepad enable gamepad support if available (default: yes)
--enable-debugger enable debugger (default: no) --enable-debugger enable debugger (default: no)
--enable-netplay enable netplay support (default: no) --enable-netplay enable netplay support (default: no)
@ -3558,6 +3564,63 @@ $as_echo "no" >&6; }
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -Ofast" >&5
$as_echo_n "checking whether g++ accepts -Ofast... " >&6; }
if ${snes9x_cv_option_ofast+:} false; then :
$as_echo_n "(cached) " >&6
else
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$OLD_CXXFLAGS -Ofast"
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int foo;
int main (int argc, char **argv)
{
/* The following code triggs gcc:s generation of aline opcodes,
which some versions of as does not support. */
if (argc > 0)
argc = 0;
return (argc);
}
_ACEOF
if ac_fn_cxx_try_run "$LINENO"; then :
snes9x_cv_option_ofast="yes"
else
snes9x_cv_option_ofast="no"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
CXXFLAGS="$OLD_CXXFLAGS"
if test "x$snes9x_cv_option_ofast" = "xyes"; then
S9XFLGS="$S9XFLGS -Ofast"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -O3" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -O3" >&5
$as_echo_n "checking whether g++ accepts -O3... " >&6; } $as_echo_n "checking whether g++ accepts -O3... " >&6; }
@ -3734,6 +3797,8 @@ $as_echo "no" >&6; }
fi fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -fomit-frame-pointer" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -fomit-frame-pointer" >&5
$as_echo_n "checking whether g++ accepts -fomit-frame-pointer... " >&6; } $as_echo_n "checking whether g++ accepts -fomit-frame-pointer... " >&6; }
@ -4282,6 +4347,228 @@ $as_echo "no" >&6; }
fi fi
# Enable SSE4.1
# Check whether --enable-sse41 was given.
if test "${enable_sse41+set}" = set; then :
enableval=$enable_sse41;
else
enable_sse41="no"
fi
if test "x$enable_sse41" = "xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -msse4.1" >&5
$as_echo_n "checking whether g++ accepts -msse4.1... " >&6; }
if ${snes9x_cv_option_sse41+:} false; then :
$as_echo_n "(cached) " >&6
else
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$OLD_CXXFLAGS -msse4.1"
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int foo;
int main (int argc, char **argv)
{
/* The following code triggs gcc:s generation of aline opcodes,
which some versions of as does not support. */
if (argc > 0)
argc = 0;
return (argc);
}
_ACEOF
if ac_fn_cxx_try_run "$LINENO"; then :
snes9x_cv_option_sse41="yes"
else
snes9x_cv_option_sse41="no"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
CXXFLAGS="$OLD_CXXFLAGS"
if test "x$snes9x_cv_option_sse41" = "xyes"; then
S9XFLGS="$S9XFLGS -msse4.1"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$snes9x_cv_option_sse41" != "xyes"; then
enable_sse41="no"
fi
fi
# Enable AVX2
# Check whether --enable-avx2 was given.
if test "${enable_avx2+set}" = set; then :
enableval=$enable_avx2;
else
enable_avx2="no"
fi
if test "x$enable_avx2" = "xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -mavx2" >&5
$as_echo_n "checking whether g++ accepts -mavx2... " >&6; }
if ${snes9x_cv_option_avx2+:} false; then :
$as_echo_n "(cached) " >&6
else
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$OLD_CXXFLAGS -mavx2"
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int foo;
int main (int argc, char **argv)
{
/* The following code triggs gcc:s generation of aline opcodes,
which some versions of as does not support. */
if (argc > 0)
argc = 0;
return (argc);
}
_ACEOF
if ac_fn_cxx_try_run "$LINENO"; then :
snes9x_cv_option_avx2="yes"
else
snes9x_cv_option_avx2="no"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
CXXFLAGS="$OLD_CXXFLAGS"
if test "x$snes9x_cv_option_avx2" = "xyes"; then
S9XFLGS="$S9XFLGS -mavx2"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$snes9x_cv_option_avx2" != "xyes"; then
enable_avx2="no"
fi
fi
# Enable ARM NEON
# Check whether --enable-neon was given.
if test "${enable_neon+set}" = set; then :
enableval=$enable_neon;
else
enable_neon="no"
fi
if test "x$enable_neon" = "xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether g++ accepts -mfpu=neon" >&5
$as_echo_n "checking whether g++ accepts -mfpu=neon... " >&6; }
if ${snes9x_cv_option_neon+:} false; then :
$as_echo_n "(cached) " >&6
else
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$OLD_CXXFLAGS -mfpu=neon"
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int foo;
int main (int argc, char **argv)
{
/* The following code triggs gcc:s generation of aline opcodes,
which some versions of as does not support. */
if (argc > 0)
argc = 0;
return (argc);
}
_ACEOF
if ac_fn_cxx_try_run "$LINENO"; then :
snes9x_cv_option_neon="yes"
else
snes9x_cv_option_neon="no"
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
fi
CXXFLAGS="$OLD_CXXFLAGS"
if test "x$snes9x_cv_option_neon" = "xyes"; then
S9XFLGS="$S9XFLGS -mfpu=neon"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$snes9x_cv_option_neon" != "xyes"; then
enable_neon="no"
fi
fi
# Check if the OS is Linux. # Check if the OS is Linux.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the OS is Linux" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the OS is Linux" >&5
@ -6365,6 +6652,9 @@ GZIP support......... $enable_gzip
ZIP support.......... $enable_zip ZIP support.......... $enable_zip
SYSTEM_ZIP........... $with_system_zip SYSTEM_ZIP........... $with_system_zip
JMA support.......... $enable_jma JMA support.......... $enable_jma
SSE4.1............... $enable_sse41
AVX2................. $enable_avx2
NEON................. $enable_neon
debugger............. $enable_debugger debugger............. $enable_debugger
EOF EOF

View File

@ -67,9 +67,10 @@ if test "x$enable_debug" = "xyes"; then
AC_S9X_COMPILER_FLAG([-g], [g]) AC_S9X_COMPILER_FLAG([-g], [g])
AC_S9X_COMPILER_FLAG([-O0], [o0]) AC_S9X_COMPILER_FLAG([-O0], [o0])
else else
AC_S9X_COMPILER_FLAG([-Ofast], [ofast], [
AC_S9X_COMPILER_FLAG([-O3], [o3], [ AC_S9X_COMPILER_FLAG([-O3], [o3], [
AC_S9X_COMPILER_FLAG([-O2], [o2], [ AC_S9X_COMPILER_FLAG([-O2], [o2], [
AC_S9X_COMPILER_FLAG([-O1], [o1])])]) AC_S9X_COMPILER_FLAG([-O1], [o1])])])])
AC_S9X_COMPILER_FLAG([-fomit-frame-pointer], [omit_frame_pointer]) AC_S9X_COMPILER_FLAG([-fomit-frame-pointer], [omit_frame_pointer])
fi fi
@ -94,6 +95,45 @@ AC_S9X_COMPILER_FLAG([-Wall], [Wall])
AC_S9X_COMPILER_FLAG([-W], [W]) AC_S9X_COMPILER_FLAG([-W], [W])
AC_S9X_COMPILER_FLAG([-Wno-unused-parameter], [Wno_unused_parameter]) AC_S9X_COMPILER_FLAG([-Wno-unused-parameter], [Wno_unused_parameter])
# Enable SSE4.1
AC_ARG_ENABLE([sse41],
[AS_HELP_STRING([--enable-sse41],
[enable SSE4.1 if available (default: no)])],
[], [enable_sse41="no"])
if test "x$enable_sse41" = "xyes"; then
AC_S9X_COMPILER_FLAG([-msse4.1], [sse41])
if test "x$snes9x_cv_option_sse41" != "xyes"; then
enable_sse41="no"
fi
fi
# Enable AVX2
AC_ARG_ENABLE([avx2],
[AS_HELP_STRING([--enable-avx2],
[enable AVX2 if available (default: no)])],
[], [enable_avx2="no"])
if test "x$enable_avx2" = "xyes"; then
AC_S9X_COMPILER_FLAG([-mavx2], [avx2])
if test "x$snes9x_cv_option_avx2" != "xyes"; then
enable_avx2="no"
fi
fi
# Enable ARM NEON
AC_ARG_ENABLE([neon],
[AS_HELP_STRING([--enable-neon],
[enable NEON if available (default: no)])],
[], [enable_neon="no"])
if test "x$enable_neon" = "xyes"; then
AC_S9X_COMPILER_FLAG([-mfpu=neon], [neon])
if test "x$snes9x_cv_option_neon" != "xyes"; then
enable_neon="no"
fi
fi
# Check if the OS is Linux. # Check if the OS is Linux.
AC_MSG_CHECKING([whether the OS is Linux]) AC_MSG_CHECKING([whether the OS is Linux])
@ -496,6 +536,9 @@ GZIP support......... $enable_gzip
ZIP support.......... $enable_zip ZIP support.......... $enable_zip
SYSTEM_ZIP........... $with_system_zip SYSTEM_ZIP........... $with_system_zip
JMA support.......... $enable_jma JMA support.......... $enable_jma
SSE4.1............... $enable_sse41
AVX2................. $enable_avx2
NEON................. $enable_neon
debugger............. $enable_debugger debugger............. $enable_debugger
EOF EOF