From 0fc788d6af65925781a8cd1126cad6c579d221b2 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 14 Nov 2022 23:21:53 +0100 Subject: [PATCH] -mcpu=native -> -mtune=native --- configure | 40 ++++++++++++++++++++++++++++++++++++++++ configure.ac | 1 + 2 files changed, 41 insertions(+) diff --git a/configure b/configure index 1232531f..d81be824 100755 --- a/configure +++ b/configure @@ -7069,6 +7069,46 @@ else $as_nop : fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -mtune=native" >&5 +printf %s "checking whether C compiler accepts -mtune=native... " >&6; } +if test ${ax_cv_check_cflags___mtune_native+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -mtune=native" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +time_t x; int fodder = 0; if (fodder > -1000 && time(&x)) return (int) x + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ax_cv_check_cflags___mtune_native=yes +else $as_nop + ax_cv_check_cflags___mtune_native=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___mtune_native" >&5 +printf "%s\n" "$ax_cv_check_cflags___mtune_native" >&6; } +if test "x$ax_cv_check_cflags___mtune_native" = xyes +then : + CFLAGS="$CFLAGS -mtune=native" +else $as_nop + : +fi + fi diff --git a/configure.ac b/configure.ac index a739b797..5fd58885 100644 --- a/configure.ac +++ b/configure.ac @@ -202,6 +202,7 @@ AC_ARG_ENABLE(opt, AX_CHECK_COMPILE_FLAG([-ftree-slp-vectorize], [CFLAGS="$CFLAGS -ftree-slp-vectorize"]) AX_CHECK_COMPILE_FLAG([-fomit-frame-pointer], [CFLAGS="$CFLAGS -fomit-frame-pointer"]) AX_CHECK_COMPILE_FLAG([-march=native], [CFLAGS="$CFLAGS -march=native"]) + AX_CHECK_COMPILE_FLAG([-mtune=native], [CFLAGS="$CFLAGS -mtune=native"]) ]) ])