Re: Compiling lftp on Solaris with Sun Studio

Yann Rouillard <[email protected]> Sat, 23 Sep 2006 15:15:14 +0200
Newsgroups gmane.network.lftp.devel
Message-ID <[email protected]>
> The gnulib folks recently rewrite the bool module so I'd suggest
> updating to the latest gnulib modules you're using.

I checked the cvs but the stdbool_.h didn't look different (?).

However I think this file is ok, the problem is rather that HAVE__BOOL 
is defined although CC doesn't support it.

And HAVE__BOOL is defined because the configure test was done using cc 
and not CC (the C++ compiler).

To try to solve properly the problem, I added a new m4 macro 
LFTP_CXX__BOOL similar to LFTP_CXX_BOOL which allows _Bool to be defined 
if it doesn't exist. Patch attached.

Alexander, does this patch suit you ?

Yann
sun_cc_bool_compilation_fix.patch (text/x-patch, 1.3 KB)
diff -ur lftp-3.5.5rc2/configure.ac lftp-3.5.5rc2.orig/configure.ac
--- lftp-3.5.5rc2/configure.ac	2006-09-23 14:41:38.000000000 +0200
+++ lftp-3.5.5rc2.orig/configure.ac	2006-09-03 06:45:06.000000000 +0200
@@ -105,7 +105,6 @@
 LFTP_CXX_TEST
 CXX_DYNAMIC_INITIALIZERS
 LFTP_CXX_BOOL
-LFTP_CXX__BOOL
 LFTP_CXX_ANSI_SCOPE
 
 AC_ISC_POSIX
diff -ur lftp-3.5.5rc2/m4/lftp.m4 lftp-3.5.5rc2.orig/m4/lftp.m4
--- lftp-3.5.5rc2/m4/lftp.m4	2006-09-23 14:48:27.000000000 +0200
+++ lftp-3.5.5rc2.orig/m4/lftp.m4	2004-02-12 14:36:56.000000000 +0100
@@ -207,27 +207,6 @@
 #endif ])
 ])
 
-dnl try to build and run a dummy program
-AC_DEFUN([LFTP_CXX__BOOL],
-[
-   AC_MSG_CHECKING(whether $CXX supports _Bool type)
-   AC_CACHE_VAL(lftp_cv_cxx__Bool,
-   [
-      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_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
-   AH_VERBATIM([OPT_CPP__BOOL], [
-#if defined(__cplusplus) && !defined(HAVE_CXX__BOOL)
-   typedef bool _Bool;
-#endif ])
-])
-
 dnl check if C++ compiler needs extra arguments to grok ANSI scoping rules
 AC_DEFUN([LFTP_CXX_ANSI_SCOPE],
 [