summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in19
-rw-r--r--configure.in25
-rw-r--r--includes.h6
3 files changed, 41 insertions, 9 deletions
diff --git a/Makefile.in b/Makefile.in
index 599f33c..4eaeddf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -16,6 +16,12 @@ endif
LTC=libtomcrypt/libtomcrypt.a
LTM=libtommath/libtommath.a
+ifeq (@BUNDLED_LIBTOM@, 1)
+LIBTOM_DEPS=$(LTC) $(LTM)
+CFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/
+LIBS+=$(LTC) $(LTM)
+endif
+
COMMONOBJS=dbutil.o buffer.o \
dss.o bignum.o \
signkey.o rsa.o random.o \
@@ -70,8 +76,8 @@ RANLIB=@RANLIB@
STRIP=@STRIP@
INSTALL=@INSTALL@
CPPFLAGS=@CPPFLAGS@
-CFLAGS=-I. -I$(srcdir) -I$(srcdir)/libtomcrypt/src/headers/ $(CPPFLAGS) @CFLAGS@
-LIBS=$(LTC) $(LTM) @LIBS@
+CFLAGS=-I. -I$(srcdir) $(CPPFLAGS) @CFLAGS@
+LIBS+=@LIBS@
LDFLAGS=@LDFLAGS@
EXEEXT=@EXEEXT@
@@ -107,10 +113,6 @@ ifeq ($(SCPPROGRESS), 1)
CFLAGS+=-DPROGRESS_METER
endif
-#%: $(HEADERS)
-#%: $(HEADERS) Makefile
-# TODO
-
all: $(TARGETS)
strip: $(TARGETS)
@@ -154,8 +156,7 @@ dbclient: $(dbclientobjs)
dropbearkey: $(dropbearkeyobjs)
dropbearconvert: $(dropbearconvertobjs)
-dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LTC) $(LTM) \
- Makefile
+dropbear dbclient dropbearkey dropbearconvert: $(HEADERS) $(LIBTOM_DEPS) Makefile
$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBS)
# scp doesn't use the libs so is special.
@@ -172,7 +173,7 @@ endif
dropbearmulti: multilink
-multibinary: $(HEADERS) $(MULTIOBJS) $(LTC) $(LTM) Makefile
+multibinary: $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile
$(CC) $(LDFLAGS) -o dropbearmulti$(EXEEXT) $(MULTIOBJS) $(LIBS)
multilink: multibinary $(addprefix link, $(PROGRAMS))
diff --git a/configure.in b/configure.in
index 97ce251..9229902 100644
--- a/configure.in
+++ b/configure.in
@@ -363,6 +363,23 @@ AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
AC_CHECK_FUNCS(setutxent utmpxname)
AC_CHECK_FUNCS(logout updwtmp logwtmp)
+AC_ARG_ENABLE(bundled-libtom,
+ [ --enable-bundled-libtom Use bundled libtomcrypt/libtommath even if a system version exists],
+ [
+ AC_MSG_NOTICE(use bundled)
+ AC_DEFINE(BUNDLED_LIBTOM,,Use bundled libtom)
+ BUNDLED_LIBTOM=1
+ ],
+ [
+ AC_MSG_NOTICE(not bundled)
+ BUNDLED_LIBTOM=0
+ AC_CHECK_LIB(tomcrypt, register_cipher, , BUNDLED_LIBTOM=1)
+ AC_CHECK_LIB(tommath, mp_exptmod, , BUNDLED_LIBTOM=1)
+ ]
+)
+
+AC_SUBST(BUNDLED_LIBTOM)
+
dnl Added from OpenSSH 3.6.1p2's configure.ac
dnl allow user to disable some login recording features
@@ -671,5 +688,13 @@ AC_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile)
AC_OUTPUT(libtomcrypt/Makefile)
AC_OUTPUT(libtommath/Makefile)
+
+AC_MSG_NOTICE()
+if test $BUNDLED_LIBTOM = 1 ; then
+AC_MSG_NOTICE(Using bundled libtomcrypt and libtommath)
+else
+AC_MSG_NOTICE(Using system libtomcrypt and libtommath)
+fi
+
AC_MSG_NOTICE()
AC_MSG_NOTICE(Now edit options.h to choose features.)
diff --git a/includes.h b/includes.h
index 03cb1cf..571a3be 100644
--- a/includes.h
+++ b/includes.h
@@ -120,8 +120,14 @@
#include <libgen.h>
#endif
+#ifdef BUNDLED_LIBTOM
#include "libtomcrypt/src/headers/tomcrypt.h"
#include "libtommath/tommath.h"
+#else
+#include <tomcrypt.h>
+#include <tommath.h>
+#endif
+
#include "compat.h"
#include "fake-rfc2553.h"