Skip to content

Commit

Permalink
Add LTM_CFLAGS configure argument
Browse files Browse the repository at this point in the history
  • Loading branch information
mkj committed Nov 10, 2022
1 parent cda8070 commit 54a90dd
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions SMALL
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 16 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ build_vendor
build_cpu
build
STATIC
DROPBEAR_LTM_CFLAGS
LTM_CFLAGS
LD
OBJEXT
EXEEXT
Expand Down Expand Up @@ -754,6 +756,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
LTM_CFLAGS
CXX
CXXFLAGS
CCC
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;}

Expand Down
10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
6 changes: 6 additions & 0 deletions libtommath/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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} $@"
Expand Down

0 comments on commit 54a90dd

Please sign in to comment.