From 29062e629f63935f5cd8bd018c27dd6a534a10dc Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Tue, 18 Feb 2014 21:03:27 +0800 Subject: [PATCH] Fix building with system libtomcrypt/libtommath --- Makefile.in | 14 ++++++++------ configure.ac | 11 ++++++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Makefile.in b/Makefile.in index 7675ea1..ea8d57e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -13,13 +13,15 @@ ifndef PROGRAMS PROGRAMS=dropbear dbclient dropbearkey dropbearconvert endif -LTC=libtomcrypt/libtomcrypt.a -LTM=libtommath/libtommath.a +STATIC_LTC=libtomcrypt/libtomcrypt.a +STATIC_LTM=libtommath/libtommath.a + +LIBTOM_LIBS=@LIBTOM_LIBS@ ifeq (@BUNDLED_LIBTOM@, 1) -LIBTOM_DEPS=$(LTC) $(LTM) +LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM) CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/ -LIBTOM_LIBS+=$(LTC) $(LTM) +LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM) endif COMMONOBJS=dbutil.o buffer.o \ @@ -192,10 +194,10 @@ link%: -rm -f $*$(EXEEXT) -ln -s dropbearmulti$(EXEEXT) $*$(EXEEXT) -$(LTC): options.h +$(STATIC_LTC): options.h cd libtomcrypt && $(MAKE) -$(LTM): options.h +$(STATIC_LTM): options.h cd libtommath && $(MAKE) .PHONY : clean sizes thisclean distclean tidy ltc-clean ltm-clean diff --git a/configure.ac b/configure.ac index e63d164..8095280 100644 --- a/configure.ac +++ b/configure.ac @@ -371,16 +371,16 @@ AC_ARG_ENABLE(bundled-libtom, AC_MSG_NOTICE(Forcing bundled libtom*) else BUNDLED_LIBTOM=0 - AC_CHECK_LIB(tommath, mp_exptmod, , - [AC_MSG_ERROR([Missing system libtomcrypt and --disable-bundled-libtom was specified])] ) - AC_CHECK_LIB(tomcrypt, register_cipher, , + AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath", + [AC_MSG_ERROR([Missing system libtommath and --disable-bundled-libtom was specified])] ) + AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt", [AC_MSG_ERROR([Missing system libtomcrypt and --disable-bundled-libtom was specified])] ) fi ], [ BUNDLED_LIBTOM=0 - AC_CHECK_LIB(tommath, mp_exptmod, , BUNDLED_LIBTOM=1) - AC_CHECK_LIB(tomcrypt, register_cipher, , BUNDLED_LIBTOM=1) + AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath", 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) fi +AC_SUBST(LIBTOM_LIBS) AC_SUBST(BUNDLED_LIBTOM) dnl Added from OpenSSH 3.6.1p2's configure.ac