Fix building with system libtomcrypt/libtommath

This commit is contained in:
Matt Johnston 2014-02-18 21:03:27 +08:00
parent 47f7272ba1
commit 29062e629f
2 changed files with 14 additions and 11 deletions

View File

@ -13,13 +13,15 @@ ifndef PROGRAMS
PROGRAMS=dropbear dbclient dropbearkey dropbearconvert PROGRAMS=dropbear dbclient dropbearkey dropbearconvert
endif endif
LTC=libtomcrypt/libtomcrypt.a STATIC_LTC=libtomcrypt/libtomcrypt.a
LTM=libtommath/libtommath.a STATIC_LTM=libtommath/libtommath.a
LIBTOM_LIBS=@LIBTOM_LIBS@
ifeq (@BUNDLED_LIBTOM@, 1) ifeq (@BUNDLED_LIBTOM@, 1)
LIBTOM_DEPS=$(LTC) $(LTM) LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM)
CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/ CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/
LIBTOM_LIBS+=$(LTC) $(LTM) LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM)
endif endif
COMMONOBJS=dbutil.o buffer.o \ COMMONOBJS=dbutil.o buffer.o \
@ -192,10 +194,10 @@ link%:
-rm -f $*$(EXEEXT) -rm -f $*$(EXEEXT)
-ln -s dropbearmulti$(EXEEXT) $*$(EXEEXT) -ln -s dropbearmulti$(EXEEXT) $*$(EXEEXT)
$(LTC): options.h $(STATIC_LTC): options.h
cd libtomcrypt && $(MAKE) cd libtomcrypt && $(MAKE)
$(LTM): options.h $(STATIC_LTM): options.h
cd libtommath && $(MAKE) cd libtommath && $(MAKE)
.PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean .PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean

View File

@ -371,16 +371,16 @@ AC_ARG_ENABLE(bundled-libtom,
AC_MSG_NOTICE(Forcing bundled libtom*) AC_MSG_NOTICE(Forcing bundled libtom*)
else else
BUNDLED_LIBTOM=0 BUNDLED_LIBTOM=0
AC_CHECK_LIB(tommath, mp_exptmod, , AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath",
[AC_MSG_ERROR([Missing system libtomcrypt and --disable-bundled-libtom was specified])] ) [AC_MSG_ERROR([Missing system libtommath and --disable-bundled-libtom was specified])] )
AC_CHECK_LIB(tomcrypt, register_cipher, , AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt",
[AC_MSG_ERROR([Missing system libtomcrypt and --disable-bundled-libtom was specified])] ) [AC_MSG_ERROR([Missing system libtomcrypt and --disable-bundled-libtom was specified])] )
fi fi
], ],
[ [
BUNDLED_LIBTOM=0 BUNDLED_LIBTOM=0
AC_CHECK_LIB(tommath, mp_exptmod, , BUNDLED_LIBTOM=1) AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath", BUNDLED_LIBTOM=1)
AC_CHECK_LIB(tomcrypt, register_cipher, , BUNDLED_LIBTOM=1) AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt", BUNDLED_LIBTOM=1)
] ]
) )
@ -388,6 +388,7 @@ if test $BUNDLED_LIBTOM = 1 ; then
AC_DEFINE(BUNDLED_LIBTOM,,Use bundled libtom) AC_DEFINE(BUNDLED_LIBTOM,,Use bundled libtom)
fi fi
AC_SUBST(LIBTOM_LIBS)
AC_SUBST(BUNDLED_LIBTOM) AC_SUBST(BUNDLED_LIBTOM)
dnl Added from OpenSSH 3.6.1p2's configure.ac dnl Added from OpenSSH 3.6.1p2's configure.ac