Attached is a patch to turn on -LANG:ansi-for-init-scope=ON on the
IRIX C++ compiler to grok ANSI scoping rules. BTW, -LANG:std enables
more C++ compliance in the IRIX compiler (we build with -LANG:std so
have no need for -LANG:ansi-for-init-scope=ON).
I've also changed all:
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
...
AC_LANG_RESTORE
to:
AC_LANG_PUSH(C++)
...
AC_LANG_POP(C++)
New autoconf test:
checking whether CC understands ANSI scoping rules... -LANG:ansi-for-init-scope=ON
added to $CXXFLAGS
Also:
1. LFTP_PTY_CHECK was not in m4/* anywhere but in aclocal.m4.
So, I added it to m4/lftp.m4.
2. Missing closing brace in src/lftp_pty.c on AIX
3. Tru64 UNIX has unsetenv() in libc but no function prototype
4. GCC 2.95.3 gives the following warning on HP-UX 10.20 and AIX 4.3.2:
TimeDate.h: In method `TimeDiff::TimeDiff(const Time &, const Time &)':
TimeDate.h:109: warning: can't inline call to `void
TimeDiff::SetDiff(const Time &, const Time &)'
TimeDate.h:105: warning: called from here
5. Compaq C++ gives the error:
cxx -DHAVE_CONFIG_H -I. -I. -I../include -I../include
-I/opt/TWWfsw/readline42/include -c -o NetAccess.o `test -f
NetAccess.cc || echo './'`NetAccess.cc
cxx: Error: NetAccess.cc, line 483: more than one operator ">="
matches these
operands:
built-in operator "arithmetic >= arithmetic"
function "Time::operator>=(const Time &) const"
function "Time::operator>=(std::time_t) const"
operand types are: TimeDate >= long
if(now >= try_time+interval)
----------^
cxx: Info: 1 error detected in the compilation of "NetAccess.cc".
6. The test for environ is not correct. Don't use AC_CHECK_FUNC as
environ is not a function. I've replaced the autoconf check with
AC_TRY_LINK.
7. HP-UX 11.00, with the aCC compiler, gives:
Error 221: "FtpDirList.h", line 32 # Member 'EPLF' not declared in class
FtpDirList ["FtpDirList.h", line 26].
static char *FtpDirList::EPLF(const char *line, int len);
^^^^
--
albert chin ([EMAIL PROTECTED])
-- snip snip
--- src/ColumnOutput.cc.orig Tue Dec 11 09:42:43 2001
+++ src/ColumnOutput.cc Tue Dec 11 09:43:27 2001
@@ -124,9 +124,8 @@
ws_arr[j] = 99999999;
}
- int filesno;
/* Find the amount of whitespace shared by every entry in the column. */
- for (filesno = 0; filesno < lst_cnt; ++filesno) {
+ for (int filesno = 0; filesno < lst_cnt; ++filesno) {
int idx = filesno / ((lst_cnt + cols - 1) / cols);
int ws = lst[filesno]->whitespace();
if(ws < ws_arr[idx]) ws_arr[idx] = ws;
@@ -136,7 +135,7 @@
* the same amount from each entry (per column) to keep each
* column aligned with itself. */
unsigned line_len = cols * MIN_COLUMN_WIDTH;
- for (filesno = 0; filesno < lst_cnt; ++filesno) {
+ for (int filesno = 0; filesno < lst_cnt; ++filesno) {
int idx = filesno / ((lst_cnt + cols - 1) / cols);
int name_length = lst[filesno]->width();
--- src/lftp_pty.c.orig Tue Dec 11 17:44:52 2001
+++ src/lftp_pty.c Tue Dec 11 17:44:59 2001
@@ -80,6 +80,7 @@
if(*ptyfd<0)
goto fail;
name=ttyname(*ptyfd);
+}
#else /* HAVE_DEV_PTS_AND_PTC */
{
/* BSD-style pty code. */
--- src/misc.cc.orig Tue Dec 11 17:58:39 2001
+++ src/misc.cc Tue Dec 11 18:21:25 2001
@@ -51,6 +51,10 @@
#include "SignalHook.h"
#include "url.h"
+#if defined(HAVE_UNSETENV) && !defined(HAVE_UNSETENV_DECL)
+CDECL void unsetenv(const char *name);
+#endif
+
const char *dir_file(const char *dir,const char *file)
{
if(dir==0 || dir[0]==0)
--- m4/lftp.m4.orig Tue Dec 11 16:55:41 2001
+++ m4/lftp.m4 Tue Dec 11 18:06:59 2001
@@ -33,25 +33,23 @@
if test "$GCC" = yes -a "$GXX" = yes; then
old_CXX="$CXX"
CXX="$CC"
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
+ AC_LANG_PUSH(C++)
AC_TRY_LINK([],[char *a=new char[10];delete[] a;],
[],[CXX="$old_CXX";])
- AC_LANG_RESTORE
+ AC_LANG_POP(C++)
fi
AC_MSG_RESULT(using $CXX)
])
dnl try to build and run a dummy program
AC_DEFUN(LFTP_CXX_TEST,
[
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
+ AC_LANG_PUSH(C++)
AC_MSG_CHECKING(if c++ compiler works)
AC_TRY_RUN([int main() { return(0); } ],
[AC_MSG_RESULT(yes)], [
AC_MSG_RESULT(no)
AC_MSG_ERROR(C++ test compile failed; check your C++ compiler)],
[AC_MSG_RESULT(cross-compiling)])
- AC_LANG_RESTORE
+ AC_LANG_POP(C++)
])
AC_DEFUN(LFTP_FUNC_SSCANF_CONST,
@@ -106,8 +104,7 @@
flags="-fno-implement-inlines -Winline"
AC_CACHE_VAL(lftp_cv_noimplementinline,
[
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
+ AC_LANG_PUSH(C++)
old_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $flags"
AC_TRY_LINK([
@@ -125,7 +122,7 @@
[lftp_cv_noimplementinline=yes],
[lftp_cv_noimplementinline=no])
CXXFLAGS="$old_CXXFLAGS"
- AC_LANG_RESTORE
+ AC_LANG_POP(C++)
])
AC_MSG_RESULT($lftp_cv_noimplementinline)
if test x$lftp_cv_noimplementinline = xyes; then
@@ -137,8 +134,7 @@
flags="$1"
AC_MSG_CHECKING(if $CXX supports $flags)
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
+ AC_LANG_PUSH(C++)
old_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $flags"
AC_TRY_COMPILE([
@@ -155,7 +151,7 @@
],[],
[support=yes],[support=no])
CXXFLAGS="$old_CXXFLAGS"
- AC_LANG_RESTORE
+ AC_LANG_POP(C++)
AC_MSG_RESULT($support)
if test x$support = xyes; then
@@ -167,8 +163,7 @@
AC_MSG_CHECKING(if math library is needed)
AC_CACHE_VAL(lftp_cv_libm_needed,
[
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
+ AC_LANG_PUSH(C++)
AC_TRY_LINK([
#include <math.h>
double a,b;
@@ -177,7 +172,7 @@
],
[lftp_cv_libm_needed=no],
[lftp_cv_libm_needed=yes])
- AC_LANG_RESTORE
+ AC_LANG_POP(C++)
])
AC_MSG_RESULT($lftp_cv_libm_needed)
if test x$lftp_cv_libm_needed = xyes; then
@@ -190,14 +185,66 @@
AC_MSG_CHECKING(whether $CXX supports bool type)
AC_CACHE_VAL(lftp_cv_cxx_bool,
[
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
+ AC_LANG_PUSH(C++)
AC_TRY_COMPILE([bool t=true;bool f=false;],[],
[lftp_cv_cxx_bool=yes],[lftp_cv_cxx_bool=no])
- AC_LANG_RESTORE
+ AC_LANG_POP(C++)
])
AC_MSG_RESULT($lftp_cv_cxx_bool)
if test x$lftp_cv_cxx_bool = xyes; then
AC_DEFINE(HAVE_CXX_BOOL, 1, [define if c++ compiler supports bool])
fi
+])
+dnl check if C++ compiler needs extra arguments to grok ANSI scoping rules
+AC_DEFUN([LFTP_CXX_ANSI_SCOPE],
+[
+ AC_MSG_CHECKING([whether $CXX understands ANSI scoping rules])
+ AC_CACHE_VAL(lftp_cv_cxx_ansi_scope,
+ [
+ AC_LANG_PUSH(C++)
+ AC_TRY_COMPILE(,[
+ for (int i = 0; i < 4; i++) ;
+ for (int i = 0; i < 4; i++) ;],
+ [lftp_cv_cxx_ansi_scope=yes],
+ [
+ # IRIX C++ needs -LANG:ansi-for-init-scope=ON if
+ # -LANG:std not used
+ _cxxflags=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS -LANG:ansi-for-init-scope=ON"
+ AC_TRY_COMPILE(,[
+ for (int i = 0; i < 4; i++) ;
+ for (int i = 0; i < 4; i++) ;],
+ [lftp_cv_cxx_ansi_scope="-LANG:ansi-for-init-scope=ON"],
+ [lftp_cv_cxx_ansi_scope=no])
+ CXXFLAGS=$_cxxflags
+ ])
+ AC_LANG_POP(C++)
+ ])
+ if test x$lftp_cv_cxx_ansi_scope = xno; then
+ AC_MSG_RESULT([$lftp_cv_cxx_ansi_scope])
+ AC_MSG_ERROR([C++ compiler does not understand ANSI scoping rules])
+ elif test x$lftp_cv_cxx_ansi_scope != xyes; then
+ AC_MSG_RESULT([$lftp_cv_cxx_ansi_scope added to \$CXXFLAGS])
+ CXXFLAGS="$CXXFLAGS $lftp_cv_cxx_ansi_scope"
+ else
+ AC_MSG_RESULT($lftp_cv_cxx_ansi_scope)
+ fi
+])
+
+AC_DEFUN([LFTP_PTY_CHECK],[
+case "$host" in
+*-*-linux*) no_dev_ptmx=1;;
+*-*-sco3.2v4*) no_dev_ptmx=1;;
+*-*-sco3.2v5*) no_dev_ptmx=1;;
+esac
+if test -z "$no_dev_ptmx" ; then
+ AC_CHECK_FILE("/dev/ptmx", [
+ AC_DEFINE(HAVE_DEV_PTMX,1,[define if you have /dev/ptmx
+device])])
+fi
+AC_CHECK_FILE("/dev/ptc", [
+ AC_DEFINE(HAVE_DEV_PTS_AND_PTC,1,[define if you have /dev/ptc
+device])])
+AC_CHECK_HEADERS([util.h sys/stropts.h pty.h])
+AC_CHECK_FUNCS([openpty _getpty])
])
--- m4/cxx-dynamic-initializers.m4.orig Tue Dec 11 17:32:05 2001
+++ m4/cxx-dynamic-initializers.m4 Tue Dec 11 17:32:17 2001
@@ -1,8 +1,7 @@
dnl check if c++ compiler can use dynamic initializers for static variables
AC_DEFUN(CXX_DYNAMIC_INITIALIZERS,
[
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
+ AC_LANG_PUSH(C++)
AC_MSG_CHECKING(if c++ compiler can handle dynamic initializers)
AC_TRY_RUN(
[
@@ -20,5 +19,5 @@
if test x$cxx_dynamic_init = xno; then
AC_MSG_ERROR(C++ compiler cannot handle dynamic initializers of static objects)
fi
- AC_LANG_RESTORE
+ AC_LANG_POP(C++)
])
--- m4/socklen.m4.orig Tue Dec 11 17:32:19 2001
+++ m4/socklen.m4 Tue Dec 11 23:27:12 2001
@@ -4,8 +4,7 @@
AC_MSG_CHECKING(for socklen_t)
AC_CACHE_VAL(lftp_cv_socklen_t,
[
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
+ AC_LANG_PUSH(C++)
lftp_cv_socklen_t=no
AC_TRY_COMPILE([
#include <sys/types.h>
@@ -18,7 +17,7 @@
[
lftp_cv_socklen_t=yes
])
- AC_LANG_RESTORE
+ AC_LANG_POP(C++)
])
AC_MSG_RESULT($lftp_cv_socklen_t)
if test $lftp_cv_socklen_t = no; then
@@ -26,8 +25,7 @@
AC_CACHE_VAL(lftp_cv_socklen_t_equiv,
[
lftp_cv_socklen_t_equiv=int
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
+ AC_LANG_PUSH(C++)
for t in int size_t unsigned long "unsigned long"; do
AC_TRY_COMPILE([
#include <sys/types.h>
@@ -42,9 +40,10 @@
break
])
done
- AC_LANG_RESTORE
+ AC_LANG_POP(C++)
])
AC_MSG_RESULT($lftp_cv_socklen_t_equiv)
- AC_DEFINE_UNQUOTED(socklen_t, $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])
fi
])
--- acconfig.h.orig Tue Dec 11 17:57:43 2001
+++ acconfig.h Tue Dec 11 18:27:11 2001
@@ -95,6 +95,8 @@
#undef HAVE_H_ERRNO_DECL
+#undef HAVE_UNSETENV_DECL
+
#undef NEED_YYWRAP
#undef HAVE_POLL
@@ -120,9 +122,6 @@
#undef HAVE_RANDOM_DECL
#undef HAVE_INET_ATON_DECL
-
-/* Define to `int' if <sys/socket.h> doesn't define. */
-#undef socklen_t
/* define if you are building with SOCKS support */
#undef SOCKS4
--- configure.in.orig Tue Dec 11 09:40:56 2001
+++ configure.in Wed Dec 12 00:44:59 2001
@@ -92,6 +92,7 @@
LFTP_CXX_TEST
CXX_DYNAMIC_INITIALIZERS
LFTP_CXX_BOOL
+LFTP_CXX_ANSI_SCOPE
AC_ISC_POSIX
@@ -333,9 +334,20 @@
AC_CHECK_FUNCS(strdup strstr lstat select regexec glob\
killpg setpgid tcgetattr ftruncate vsnprintf gettimeofday\
gethostbyname2 getipnodebyname getaddrinfo getnameinfo setsid random\
- inet_aton unsetenv environ)
+ inet_aton unsetenv)
IU_CHECK_DECL(vsnprintf, [#include <stdio.h>])
+IU_CHECK_DECL(unsetenv, [#include <stdlib.h>])
dnl AC_CHECK_DECLS([va_copy, __va_copy],,, [#include <stdarg.h>])
+
+AC_MSG_CHECKING([for environ])
+AC_TRY_LINK([#include <unistd.h>
+
+extern char **environ;],[
+ char **e = environ;],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_ENVIRON, 1,
+ [if environ available])],[
+ AC_MSG_RESULT([no])])
AC_REPLACE_FUNCS(mktime memmove strcasecmp strncasecmp strtol strtoul strptime)
IU_CHECK_DECL(strcasecmp, [#include <string.h>])