--- lftp-3.5.11/configure.ac	2007-04-11 07:10:34.000000000 +0200
+++ lftp-3.5.11.new/configure.ac	2007-06-14 10:24:32.000000000 +0200
@@ -344,7 +344,7 @@
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
 AC_HEADER_TIME
-AC_CHECK_HEADERS(fcntl.h sys/time.h errno.h stdlib.h varargs.h dirent.h\
+AC_CHECK_HEADERS(libintl.h fcntl.h sys/time.h errno.h stdlib.h varargs.h dirent.h\
  termios.h termio.h sys/select.h sys/poll.h sys/stropts.h string.h memory.h\
  strings.h sys/ioctl.h dlfcn.h arpa/inet.h arpa/nameser.h netinet/in.h netinet/tcp.h\
  netinet/in_systm.h netinet/ip.h termcap.h\
diff -Naur lftp-3.5.11/include/gettext.h lftp-3.5.11.new/include/gettext.h
--- lftp-3.5.11/include/gettext.h	2006-08-09 07:03:14.000000000 +0200
+++ lftp-3.5.11.new/include/gettext.h	2007-06-14 10:31:48.000000000 +0200
@@ -41,7 +41,7 @@
    it now, to make later inclusions of <libintl.h> a NOP.  */
 #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
 # include <cstdlib>
-# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
+# ifdef HAVE_LIBINTL_H
 #  include <libintl.h>
 # endif
 #endif
diff -Naur lftp-3.5.11/m4/needtrio.m4 lftp-3.5.11.new/m4/needtrio.m4
--- lftp-3.5.11/m4/needtrio.m4	2005-08-12 09:29:24.000000000 +0200
+++ lftp-3.5.11.new/m4/needtrio.m4	2007-06-14 10:18:30.000000000 +0200
@@ -30,7 +30,7 @@
 	       return 1;
 
 	    return 0;
-	 }],[],[ac_cv_need_trio="yes (because %lld fails)"],[])
+	 }],[],[ac_cv_need_trio="yes (because %lld fails)"],[ac_cv_need_trio="no (assumed)"])
 
       fi
    ])
diff -Naur lftp-3.5.11/m4/va_copy.m4 lftp-3.5.11.new/m4/va_copy.m4
--- lftp-3.5.11/m4/va_copy.m4	2006-07-24 10:50:34.000000000 +0200
+++ lftp-3.5.11.new/m4/va_copy.m4	2007-06-14 10:27:19.000000000 +0200
@@ -22,7 +22,7 @@
       }],
       [lftp_cv_va_copy=yes],
       [lftp_cv_va_copy=no],
-      [])
+      [lftp_cv_va_copy=yes])
    ])
    if test x$lftp_cv_va_copy != xyes; then
       AC_CACHE_CHECK([for an implementation of __va_copy()],lftp_cv___va_copy,[
@@ -43,7 +43,7 @@
 	 }],
 	 [lftp_cv___va_copy=yes],
 	 [lftp_cv___va_copy=no],
-	 [])
+	 [lftp_cv___va_copy=no])
       ])
    fi
 
diff -Naur lftp-3.5.11/src/buffer.cc lftp-3.5.11.new/src/buffer.cc
--- lftp-3.5.11/src/buffer.cc	2006-09-27 09:03:38.000000000 +0200
+++ lftp-3.5.11.new/src/buffer.cc	2007-06-13 12:31:46.000000000 +0200
@@ -248,6 +248,7 @@
 
 void DirectedBuffer::SetTranslation(const char *enc,bool translit)
 {
+#ifdef HAVE_ICONV
    if(backend_translate)
       iconv_close(backend_translate);
    backend_translate=0;
@@ -270,6 +271,7 @@
 			      to_code,from_code,strerror(errno));
       backend_translate=0;
    }
+#endif
 }
 DirectedBuffer::~DirectedBuffer()
 {
@@ -278,14 +280,17 @@
 }
 void DirectedBuffer::ResetTranslation()
 {
+#ifdef HAVE_ICONV
    if(!backend_translate)
       return;
    iconv(backend_translate,0,0,0,0);
+#endif
    delete untranslated;
    untranslated=0;
 }
 void DirectedBuffer::PutTranslated(const char *put_buf,int size)
 {
+#ifdef HAVE_ICONV
    if(!backend_translate)
    {
       Buffer::Put(put_buf,size);
@@ -342,12 +347,17 @@
       }
    }
    return;
+#else
+   Buffer::Put(put_buf,size);
+   return;
+#endif
 }
 void DirectedBuffer::EmbraceNewData(int len)
 {
    if(len<=0)
       return;
    RateAdd(len);
+#ifdef HAVE_ICONV
    if(backend_translate)
    {
       if(!untranslated)
@@ -360,6 +370,9 @@
    {
       in_buffer+=len;
    }
+#else
+      in_buffer+=len;
+#endif
    SaveMaxCheck(0);
 }
 
diff -Naur lftp-3.5.11/src/buffer.h lftp-3.5.11.new/src/buffer.h
--- lftp-3.5.11/src/buffer.h	2006-06-09 20:10:35.000000000 +0200
+++ lftp-3.5.11.new/src/buffer.h	2007-06-13 12:31:24.000000000 +0200
@@ -30,9 +30,12 @@
 #include "xstring.h"
 
 #include <stdarg.h>
+
+#ifdef HAVE_ICONV
 CDECL_BEGIN
 #include <iconv.h>
 CDECL_END
+#endif
 
 #define GET_BUFSIZE 0x10000
 #define PUT_LL_MIN  0x2000
@@ -131,13 +134,20 @@
    enum dir_t { GET, PUT };
 
 protected:
+#ifdef HAVE_ICONV
    iconv_t backend_translate;
+#endif
    Buffer *untranslated;
    dir_t mode;
    void EmbraceNewData(int len);
 
 public:
-   DirectedBuffer(dir_t m) { mode=m; backend_translate=0; untranslated=0; }
+   DirectedBuffer(dir_t m) { mode=m; 
+#ifdef HAVE_ICONV
+	   backend_translate=0; 
+#endif
+	   untranslated=0;
+   }
    ~DirectedBuffer();
    void SetTranslation(const char *be_encoding,bool translit=true);
    virtual void PutTranslated(const char *buf,int size);
diff -Naur lftp-3.5.11/src/ResMgr.cc lftp-3.5.11.new/src/ResMgr.cc
--- lftp-3.5.11/src/ResMgr.cc	2006-06-30 16:25:11.000000000 +0200
+++ lftp-3.5.11.new/src/ResMgr.cc	2007-06-13 12:25:46.000000000 +0200
@@ -867,17 +867,22 @@
    return FileAccessible(value,R_OK|X_OK,1);
 }
 
+#ifdef HAVE_ICONV
 CDECL_BEGIN
 #include <iconv.h>
 CDECL_END
+#endif
+
 const char *ResMgr::CharsetValidate(char **value)
 {
+#ifdef HAVE_ICONV
    if(!**value)
       return 0;
    iconv_t ic=iconv_open(*value,*value);
    if(ic==(iconv_t)-1)
       return _("this encoding is not supported");
    iconv_close(ic);
+#endif
    return 0;
 }
 
diff -Naur lftp-3.5.11/src/SFtp.cc lftp-3.5.11.new/src/SFtp.cc
--- lftp-3.5.11/src/SFtp.cc	2006-06-13 16:35:40.000000000 +0200
+++ lftp-3.5.11.new/src/SFtp.cc	2007-06-13 12:36:40.000000000 +0200
@@ -31,7 +31,6 @@
 
 #include <assert.h>
 #include <errno.h>
-#include <iconv.h>
 
 #define max_buf 0x10000
 
