Add LTM_CFLAGS configure argument

This commit is contained in:
Matt Johnston 2022-11-10 17:39:27 +08:00
parent cda8070898
commit 54a90ddac5
4 changed files with 38 additions and 0 deletions

6
SMALL
View File

@ -47,4 +47,10 @@ deciding.
Of course using small C libraries such as uClibc and dietlibc can also help.
---
Libtommath has its own default CFLAGS to improve speed. You can use
./configure LTM_CFLAGS=-O2
to reduce size at the expense of speed.
If you have any queries, mail me and I'll see if I can help.

16
configure vendored
View File

@ -672,6 +672,8 @@ build_vendor
build_cpu
build
STATIC
DROPBEAR_LTM_CFLAGS
LTM_CFLAGS
LD
OBJEXT
EXEEXT
@ -754,6 +756,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
LTM_CFLAGS
CXX
CXXFLAGS
CCC
@ -1417,6 +1420,8 @@ Some influential environment variables:
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
LTM_CFLAGS CFLAGS for bundled libtommath. Default -O3 -funroll-loops
-fomit-frame-pointer
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CPP C preprocessor
@ -3990,6 +3995,17 @@ printf "%s\n" "$as_me: No \$CFLAGS set... using \"-Os -W -Wall\" for GCC" >&6;}
CFLAGS="-Os -W -Wall"
fi
# LTM_CFLAGS is given to ./configure by the user,
# DROPBEAR_LTM_CFLAGS is substituted in the LTM Makefile.in
DROPBEAR_LTM_CFLAGS="$LTM_CFLAGS"
if test -z "$DROPBEAR_LTM_CFLAGS"; then
DROPBEAR_LTM_CFLAGS="-O3 -funroll-loops -fomit-frame-pointer"
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: Setting LTM_CFLAGS to $DROPBEAR_LTM_CFLAGS" >&5
printf "%s\n" "$as_me: Setting LTM_CFLAGS to $DROPBEAR_LTM_CFLAGS" >&6;}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: Checking if compiler '$CC' supports -Wno-pointer-sign" >&5
printf "%s\n" "$as_me: Checking if compiler '$CC' supports -Wno-pointer-sign" >&6;}

View File

@ -42,6 +42,16 @@ if test -z "$ORIGCFLAGS" && test "$GCC" = "yes"; then
CFLAGS="-Os -W -Wall"
fi
# LTM_CFLAGS is given to ./configure by the user,
# DROPBEAR_LTM_CFLAGS is substituted in the LTM Makefile.in
DROPBEAR_LTM_CFLAGS="$LTM_CFLAGS"
if test -z "$DROPBEAR_LTM_CFLAGS"; then
DROPBEAR_LTM_CFLAGS="-O3 -funroll-loops -fomit-frame-pointer"
fi
AC_MSG_NOTICE(Setting LTM_CFLAGS to $DROPBEAR_LTM_CFLAGS)
AC_ARG_VAR(LTM_CFLAGS, CFLAGS for bundled libtommath. Default -O3 -funroll-loops -fomit-frame-pointer)
AC_SUBST(DROPBEAR_LTM_CFLAGS)
AC_MSG_NOTICE([Checking if compiler '$CC' supports -Wno-pointer-sign])
DB_TRYADDCFLAGS([-Wno-pointer-sign])

View File

@ -25,8 +25,14 @@ endif
coverage: LIBNAME:=-Wl,--whole-archive $(LIBNAME) -Wl,--no-whole-archive
# Dropbear sets its own flags below
IGNORE_SPEED=1
include $(srcdir)/makefile_include.mk
# override makefile_include.mk flags
LTM_CFLAGS += @DROPBEAR_LTM_CFLAGS@
%.o: %.c $(HEADERS)
ifneq ($V,1)
@echo " * ${CC} $@"