merge from donut
diff --git a/dist/Android.mk b/dist/Android.mk
index b7aad30..c470bfe 100644
--- a/dist/Android.mk
+++ b/dist/Android.mk
@@ -100,10 +100,13 @@
 LOCAL_CFLAGS += -DHAVE_READLINE=1
 endif
 
-LOCAL_LDLIBS += -lpthread -ldl
+LOCAL_LDLIBS += -lpthread
+ifneq ($(HOST_OS),freebsd)
+LOCAL_LDLIBS += -ldl
+endif
 
 ifneq ($(strip $(have_readline)),)
-LOCAL_LDLIBS += -lreadline
+LOCAL_LDLIBS += -lreadline -lncurses
 endif
 ifneq ($(strip $(have_history)),)
 LOCAL_LDLIBS += -lhistory