From e8dbdab2168875e15209569a44d0151c0ffb7f28 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 13 Nov 2022 22:52:29 +0100 Subject: [PATCH] Try using -Ofast / -O3 by default --- configure.ac | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f0b92201..2183163a 100644 --- a/configure.ac +++ b/configure.ac @@ -42,10 +42,23 @@ AS_IF([pwd | fgrep ' ' > /dev/null 2>&1], [AC_MSG_ERROR([The build directory contains whitespaces - This can cause tests/installation to fail due to limitations of some libtool versions])] ) +sodium_CFLAGS=${CFLAGS+set} +: ${CFLAGS=""} + AC_PROG_CC AM_PROG_AS AC_USE_SYSTEM_EXTENSIONS +dnl Default optimization flags + +if test "$sodium_CFLAGS" != "set" ; then + AX_CHECK_COMPILE_FLAG([-Ofast], [CFLAGS="$CFLAGS -Ofast"], + [AX_CHECK_COMPILE_FLAG([-O3], [CFLAGS="$CFLAGS -O3"], + [AX_CHECK_COMPILE_FLAG([-O2], [CFLAGS="$CFLAGS -O2"], + [AX_CHECK_COMPILE_FLAG([-O1], [CFLAGS="$CFLAGS -O1"], + [AX_CHECK_COMPILE_FLAG([-O], [CFLAGS="$CFLAGS -O"])])])])]) +fi + dnl Switches AC_ARG_ENABLE(ssp, @@ -197,7 +210,6 @@ AC_ARG_ENABLE(opt, [AS_HELP_STRING(--enable-opt,Optimize for the native CPU - The resulting library will be faster but not portable)], [ AS_IF([test "x$enableval" = "xyes"], [ - AX_CHECK_COMPILE_FLAG([-Ofast], [CFLAGS="$CFLAGS -Ofast"]) AX_CHECK_COMPILE_FLAG([-ftree-vectorize], [CFLAGS="$CFLAGS -ftree-vectorize"]) AX_CHECK_COMPILE_FLAG([-ftree-slp-vectorize], [CFLAGS="$CFLAGS -ftree-slp-vectorize"]) AX_CHECK_COMPILE_FLAG([-fomit-frame-pointer], [CFLAGS="$CFLAGS -fomit-frame-pointer"])