The following patches below are required to get lftp 2.6.10 to build on the following platforms: AIX 4.3.2, 5.1, HP-UX 10.20, 11.00, 11i IRIX 6.5 Redhat Linux 7.1, 9.0 Solaris 2.5.1-9/SPARC Tru64 UNIX 4.0D, 5.1
1. [include/post-config.h] Don't assume C++ compiler defines __STDC__. 2. [missing] Update to latest version from automake 1.7.9. I imagine anything from 1.7.x should be ok. 3. [src/Makefile.am] Because we use libtool to build lftp, use $(LTLIBINTL) for the gettext libraries. 4. [src/ftpclass.cc, src/NetAccess.h, src/NetAccess.cc, src/FileAccess.cc, configure.ac, m4/socklen.m4] Ok, this was fun. On HP-UX 11i, we had to replace socklen_t with socktype_t which is defined to socklen_t if it exists or some appropriate definition otherwise. The problem is that <sys/socket.h> defines socklen_t but _uses_ it only when _XOPEN_SOURCE_EXTENDED is defined. And, we don't want to do this. So, the test fails, defining socklen_t to 'int' which generates a failure because of the 'typedef size_t socklen_t' entry in <sys/socket.h>. So, we work around this by coming up with a new name, socktype_t. 5. [src/HttpDir.cc] Patch to build with HP C++ compiler. 6. [m4/inttypes_h.m4, m4/mbstate_t.m4, m4/uintmax_t.m4, m4/stdint_h.m4, m4/human.m4] Rename some of these macros from jm_xxx to lftp_xxx. Because we use the result of these macros with C++, we should test for their existence with C++. We cannot use the jm_xxx versions because that conflicts with the versions from gettext. On Tru64 UNIX with the Compaq DTK compiler and the Compaq C++ complier, include files like <inttypes.h> and <stdint.h> differ depending on whether or not you're building with C or C++. 7. [configure.ac] LOCALE_DIR no longer used. -- albert chin ([EMAIL PROTECTED]) -- snip snip --- include/post-config.h.orig 2003-12-14 17:39:34.530602000 -0600 +++ include/post-config.h 2003-12-14 17:39:51.029682000 -0600 @@ -33,7 +33,7 @@ #define N_(Text) Text #ifndef PARAMS -# ifdef __STDC__ +# if defined __STDC__ || defined __cplusplus # define PARAMS(x) x # else # define PARAMS(x) () --- missing.orig 2003-12-14 12:47:25.075558000 -0600 +++ missing 2003-12-14 12:47:32.759537000 -0600 @@ -1,6 +1,6 @@ #! /bin/sh # Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. # Originally by Fran,cois Pinard <[EMAIL PROTECTED]>, 1996. # This program is free software; you can redistribute it and/or modify @@ -18,6 +18,11 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 @@ -25,6 +30,14 @@ run=: +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + case "$1" in --run) # Try to run requested program, and just exit if it succeeds. @@ -57,6 +70,7 @@ automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags @@ -64,7 +78,7 @@ ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.2 - GNU automake" + echo "missing 0.4 - GNU automake" ;; -*) @@ -73,31 +87,46 @@ exit 1 ;; - aclocal) + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`configure.in'. You might want + you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`configure.in'. You might want to install the + you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`configure.in'. You might want + you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do @@ -110,10 +139,15 @@ touch $touch_files ;; - automake) + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | @@ -121,6 +155,34 @@ while read f; do touch "$f"; done ;; + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if @@ -174,7 +236,37 @@ fi ;; + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file @@ -201,23 +293,23 @@ # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then - gnutar ${1+"$@"} && exit 0 + gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then - gtar ${1+"$@"} && exit 0 + gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" ${1+"$@"} && exit 0 + tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" ${1+"$@"} && exit 0 + tar "$firstarg" "$@" && exit 0 ;; esac fi @@ -234,7 +326,7 @@ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing + it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 --- src/Makefile.am.orig 2003-12-15 11:40:32.303486000 -0600 +++ src/Makefile.am 2003-12-15 17:03:12.570182000 -0600 @@ -74,7 +74,7 @@ lftp_LDFLAGS = -export-dynamic $(LFTP_SSL_LDFLAGS) lftp_LDADD = libjobs.a libtasks.a $(MODULES_LA_STATIC) $(READLINE) \ - $(top_builddir)/lib/liblib.a $(LFTP_SSL_LIBS) $(INTLLIBS) + $(top_builddir)/lib/liblib.a $(LFTP_SSL_LIBS) $(LTLIBINTL) lftp_DEPENDENCIES = libjobs.a libtasks.a $(READLINE_DEPEND) \ $(top_builddir)/lib/liblib.a $(MODULES_LA_STATIC) --- src/ftpclass.cc.orig 2003-12-14 17:38:04.071911000 -0600 +++ src/ftpclass.cc 2003-12-14 17:38:30.739174000 -0600 @@ -111,7 +111,7 @@ if(sock==-1) return; int avail=-1; - socklen_t len=sizeof(avail); + socktype_t len=sizeof(avail); if(getsockopt(sock,SOL_SOCKET,SO_SNDBUF,(char*)&avail,&len)==-1) avail=-1; int buf=-1; @@ -191,7 +191,7 @@ { sockaddr_u d; sockaddr_u c; - socklen_t len; + socktype_t len; len=sizeof(d); if(dp) d=*dp; @@ -744,7 +744,7 @@ return 0; } - socklen_t len=sizeof(data_sa); + socktype_t len=sizeof(data_sa); getpeername(control_sock,&data_sa.sa,&len); if(data_sa.sa.sa_family==AF_INET) data_sa.in.sin_port=htons(port); @@ -1120,7 +1120,7 @@ const char *command=0; bool append_file=false; int res; - socklen_t addr_len; + socktype_t addr_len; unsigned char *a; unsigned char *p; automate_state oldstate; @@ -4108,7 +4108,7 @@ int buffer=0; if(TIOCOUTQ_returns_free_space) { - socklen_t len=sizeof(buffer); + socktype_t len=sizeof(buffer); if(getsockopt(data_sock,SOL_SOCKET,SO_SNDBUF,(char*)&buffer,&len)==-1) return 0; int avail=buffer; --- src/NetAccess.h.orig 2003-12-14 17:38:38.239606000 -0600 +++ src/NetAccess.h 2003-12-14 17:38:49.418274000 -0600 @@ -67,7 +67,7 @@ static const char *SocketNumericAddress(const sockaddr_u *u); static int SocketPort(const sockaddr_u *u); - static socklen_t SocketAddrLen(const sockaddr_u *u); + static socktype_t SocketAddrLen(const sockaddr_u *u); static int SocketConnect(int fd,const sockaddr_u *u); int SocketCreate(int,int,int); int SocketCreateTCP(int); --- src/NetAccess.cc.orig 2003-12-14 17:38:53.930860000 -0600 +++ src/NetAccess.cc 2003-12-14 17:38:59.902559000 -0600 @@ -184,7 +184,7 @@ return 0; } -socklen_t NetAccess::SocketAddrLen(const sockaddr_u *u) +socktype_t NetAccess::SocketAddrLen(const sockaddr_u *u) { if(u->sa.sa_family==AF_INET) return sizeof(u->in); --- src/FileAccess.cc.orig 2003-12-14 17:40:00.664129000 -0600 +++ src/FileAccess.cc 2003-12-14 17:40:14.520693000 -0600 @@ -208,7 +208,7 @@ #ifdef SO_ERROR char str[256]; int s_errno=0; - socklen_t len; + socktype_t len; errno=0; --- src/HttpDir.cc.orig 2003-12-15 08:48:45.309673000 -0600 +++ src/HttpDir.cc 2003-12-15 08:48:51.681173000 -0600 @@ -566,7 +566,7 @@ else if(info.perms[0]=='l') { info.is_sym_link=true; - char *p=strstr(ext,"-> "); + const char *p=strstr(ext,"-> "); if(p) { info.sym_link=xstrdup(p+6); --- m4/inttypes_h.m4.orig 2003-12-14 12:42:54.142039000 -0600 +++ m4/inttypes_h.m4 2003-12-15 15:30:39.948960000 -0600 @@ -11,16 +11,19 @@ # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, # doesn't clash with <sys/types.h>, and declares uintmax_t. -AC_DEFUN([jm_AC_HEADER_INTTYPES_H], +AC_DEFUN([lftp_AC_HEADER_INTTYPES_H], [ - AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, - [AC_TRY_COMPILE( + AC_CACHE_CHECK([for inttypes.h], lftp_ac_cv_header_inttypes_h, + [AC_LANG_PUSH(C++) + AC_LANG(C++) + AC_TRY_COMPILE( [#include <sys/types.h> #include <inttypes.h>], [uintmax_t i = (uintmax_t) -1;], - jm_ac_cv_header_inttypes_h=yes, - jm_ac_cv_header_inttypes_h=no)]) - if test $jm_ac_cv_header_inttypes_h = yes; then + [lftp_ac_cv_header_inttypes_h=yes], + [lftp_ac_cv_header_inttypes_h=no]) + AC_LANG_POP(C++)]) + if test $lftp_ac_cv_header_inttypes_h = yes; then AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. ]) --- m4/mbstate_t.m4.orig 2003-12-14 12:58:12.315654000 -0600 +++ m4/mbstate_t.m4 2003-12-14 12:58:32.842773000 -0600 @@ -15,14 +15,16 @@ AC_CHECK_HEADERS(stdlib.h) AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t, - [AC_TRY_COMPILE([ + [AC_LANG_PUSH(C++) + AC_TRY_COMPILE([ #if HAVE_STDLIB_H # include <stdlib.h> #endif #include <wchar.h>], [mbstate_t x; return sizeof x;], ac_cv_type_mbstate_t=yes, - ac_cv_type_mbstate_t=no)]) + ac_cv_type_mbstate_t=no) + AC_LANG_POP(C++)]) if test $ac_cv_type_mbstate_t = no; then AC_DEFINE(mbstate_t, int, [Define to a type if <wchar.h> does not define.]) --- m4/socklen.m4.orig 2003-12-14 16:07:37.145841000 -0600 +++ m4/socklen.m4 2003-12-14 16:37:29.953626000 -0600 @@ -1,11 +1,11 @@ dnl Check for size of addr length argument -AC_DEFUN(TYPE_SOCKLEN_T, +AC_DEFUN(TYPE_SOCKTYPE_T, [ AC_MSG_CHECKING(for socklen_t) - AC_CACHE_VAL(lftp_cv_socklen_t, + AC_CACHE_VAL(lftp_cv_socktype_t, [ AC_LANG_PUSH(C++) - lftp_cv_socklen_t=no + lftp_cv_socktype_t=no AC_TRY_COMPILE([ #include <sys/types.h> #include <sys/socket.h> @@ -15,16 +15,17 @@ getpeername(0,0,&len); ], [ - lftp_cv_socklen_t=yes + lftp_cv_socktype_t=yes + lftp_cv_socktype_t_equiv=socklen_t ]) AC_LANG_POP(C++) ]) - AC_MSG_RESULT($lftp_cv_socklen_t) - if test $lftp_cv_socklen_t = no; then - AC_MSG_CHECKING(for socklen_t equivalent) - AC_CACHE_VAL(lftp_cv_socklen_t_equiv, + AC_MSG_RESULT($lftp_cv_socktype_t) + if test $lftp_cv_socktype_t = no; then + AC_MSG_CHECKING([for socklen_t equivalent for socket functions]) + AC_CACHE_VAL(lftp_cv_socktype_t_equiv, [ - lftp_cv_socklen_t_equiv=int + lftp_cv_socktype_t_equiv=int AC_LANG_PUSH(C++) for t in int size_t unsigned long "unsigned long"; do AC_TRY_COMPILE([ @@ -36,14 +37,14 @@ getpeername(0,0,&len); ], [ - lftp_cv_socklen_t_equiv="$t" + lftp_cv_socktype_t_equiv="$t" break ]) done AC_LANG_POP(C++) ]) - AC_MSG_RESULT($lftp_cv_socklen_t_equiv) - AC_DEFINE_UNQUOTED(socklen_t, $lftp_cv_socklen_t_equiv, - [type to use in place of socklen_t if not defined]) + AC_MSG_RESULT($lftp_cv_socktype_t_equiv) fi + AC_DEFINE_UNQUOTED(socktype_t, $lftp_cv_socktype_t_equiv, + [type to use in place of socklen_t if not defined]) ]) --- m4/uintmax_t.m4.orig 2003-12-15 14:05:00.410387000 -0600 +++ m4/uintmax_t.m4 2003-12-15 15:28:35.735143000 -0600 @@ -13,11 +13,12 @@ # Define uintmax_t to `unsigned long' or `unsigned long long' # if <inttypes.h> does not exist. -AC_DEFUN([jm_AC_TYPE_UINTMAX_T], +AC_DEFUN([lftp_AC_TYPE_UINTMAX_T], [ - AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([jm_AC_HEADER_STDINT_H]) - if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then + AC_REQUIRE([lftp_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([lftp_AC_HEADER_STDINT_H]) + if test $lftp_ac_cv_header_inttypes_h = no && \ + test $lftp_ac_cv_header_stdint_h = no; then AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) test $ac_cv_type_unsigned_long_long = yes \ && ac_type='unsigned long long' \ --- m4/stdint_h.m4.orig 2003-12-15 14:05:56.713909000 -0600 +++ m4/stdint_h.m4 2003-12-15 15:28:59.271029000 -0600 @@ -11,16 +11,18 @@ # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, # doesn't clash with <sys/types.h>, and declares uintmax_t. -AC_DEFUN([jm_AC_HEADER_STDINT_H], +AC_DEFUN([lftp_AC_HEADER_STDINT_H], [ - AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, - [AC_TRY_COMPILE( + AC_CACHE_CHECK([for stdint.h], lftp_ac_cv_header_stdint_h, + [AC_LANG_PUSH(C++) + AC_TRY_COMPILE( [#include <sys/types.h> #include <stdint.h>], [uintmax_t i = (uintmax_t) -1;], - jm_ac_cv_header_stdint_h=yes, - jm_ac_cv_header_stdint_h=no)]) - if test $jm_ac_cv_header_stdint_h = yes; then + lftp_ac_cv_header_stdint_h=yes, + lftp_ac_cv_header_stdint_h=no) + AC_LANG_POP(C++)]) + if test $lftp_ac_cv_header_stdint_h = yes; then AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares uintmax_t. ]) --- m4/human.m4.orig 2003-12-15 15:15:22.241407000 -0600 +++ m4/human.m4 2003-12-15 15:29:41.677626000 -0600 @@ -1,10 +1,10 @@ # If you use human.c, you need the following files: # uintmax_t.m4 inttypes_h.m4 ulonglong.m4 -AC_DEFUN(jm_PREREQ_HUMAN, +AC_DEFUN(lftp_PREREQ_HUMAN, [ + AC_REQUIRE([lftp_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([lftp_AC_TYPE_UINTMAX_T]) AC_CHECK_HEADERS(limits.h stdlib.h string.h) AC_CHECK_DECLS([getenv]) - AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) - AC_REQUIRE([jm_AC_TYPE_UINTMAX_T]) ]) --- configure.ac.orig 2003-12-14 12:37:02.205044000 -0600 +++ configure.ac 2003-12-15 16:25:39.995782000 -0600 @@ -98,7 +98,7 @@ jm_PREREQ_MBSWIDTH # for lib/human.{c,h} -jm_PREREQ_HUMAN +lftp_PREREQ_HUMAN jm_FUNC_MBRTOWC AC_MBSTATE_T @@ -118,12 +118,6 @@ fi -AC_ARG_WITH(locale-dir, - [ --with-locale-dir=DIR specify locale directory], - LOCALE_DIR=$withval) -test -z "$LOCALE_DIR" && LOCALE_DIR='$(datadir)/locale' -AC_SUBST(LOCALE_DIR) - ALL_LINGUAS="de es fr it ja ko pl pt_BR ru zh_CN zh_TW" AM_GNU_GETTEXT([external]) if test x$USE_INCLUDED_LIBINTL = xyes; then @@ -309,7 +303,7 @@ if test x$ac_cv_header_endian_h = xno; then AC_C_BIGENDIAN fi -TYPE_SOCKLEN_T +TYPE_SOCKTYPE_T AC_STRUCT_TIMEZONE @@ -324,7 +318,7 @@ LFTP_FUNC_POLL LFTP_FUNC_SSCANF_CONST AC_CHECK_FUNCS(strdup strstr lstat lchown select regexec glob\ - killpg setpgid tcgetattr ftruncate vsnprintf gettimeofday\ + killpg setpgid tcgetattr ftruncate vsnprintf sscanf gettimeofday\ gethostbyname2 getipnodebyname getaddrinfo getnameinfo setsid random\ inet_aton unsetenv setlocale) AC_FUNC_ALLOCA