Hello,
I'm trying to port the current CVS-version of the CommonC++ library
(:pserver:address@hidden:/cvsroot/cplusplus)
to AiX using the Visual Age C++ 5.0 (xlC) compiler.
(We cannot use the AiX-version of GNU g++, since its C++ binary format
is incompatible to our xlC-generated C++ libraries)
I had to apply the patches in the attachment to make it compilable:
patch.src:
* Added forward declarations for endKeydata() and siginstall(int).
* Added missing typename's in persist.h.
* thread.h: CCXX_SYSV_SEMAPHORES will be defined for AiX [1].
patch.m4:
* The namespace and mutable test will now use AC_TRY_COMPILE.
This is, because the manual compilation didn't work.
* sys/libcsys.h exists on AiX, but it must not be included,
because otherwise, duplicate declarations of memcpy() will occur.
patch.demo:
* Removed duplicate default-parameter declarations to make xlC happy.
Currently, I'm using a hand-written Makefile for the compiling,
because xlC needs other compiler-options (especially for the linking)
than g++ does. I hope, I can find a way to let automake/libtool create
the right compiler-flags...
Other feedback:
1.)
The demo-program "threadtest" doesn't run through:
----- snip -----
Testing suspend & resume
- thread should not change n...ko
----- snap -----
If I have some time, I will take a closer look at what's going wrong...
2.)
The SocketService currently crashes immediately, after Start()
is called. Maybe it works, if the thread-stuff above is fixed...
[1]
AiX actually has pthread-semaphores, but they don't work!
The sem_xxx calls always return -1 and errno==ENOSYS.
There are two possibilities to solve this problem:
1. Use SysV semaphores, like there seems to be done for FreeBSD <=3.
2. Use an alternative semaphore implementation using a pthread_mutex
and a pthread_cond.
In the second case, the following autoconf-macro may be useful:
----- snip -----
AC_MSG_CHECKING(if POSIX semaphores are working)
AC_TRY_RUN([
#include <semaphore.h>
int main() {
sem_t sem;
int rc;
rc = sem_init(&sem, 0, 0);
return rc;
}],
AC_DEFINE(HAVE_POSIX_SEMAPHORES)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no),
AC_MSG_RESULT(no)
)
----- snap -----
Thank you and ciao.
------------------------------------------------------------------------
Index: m4/ost_cxx.m4
===================================================================
RCS file: /cvsroot/cplusplus/CommonC++/m4/ost_cxx.m4,v
retrieving revision 1.15
diff -c -r1.15 ost_cxx.m4
*** m4/ost_cxx.m4 2002/01/16 15:36:07 1.15
--- m4/ost_cxx.m4 2002/01/17 09:46:51
***************
*** 129,148 ****
AC_LANG_CPLUSPLUS
AC_CACHE_CHECK(whether ${CXX} supports namespace,
ost_cv_cxx_namespace,
! [echo '#include <iostream>' >conftest.c
! echo 'namespace Test { using namespace std; };' >>conftest.c
! if test -z "`${CXX} -c conftest.c 2>&1`" ; then
! ost_cv_cxx_namespace=yes
! else
! ost_cv_cxx_namespace=no
! fi
! rm -f conftest*
! ])
! if test "$ost_cv_cxx_namespace" = yes ; then
! AC_DEFINE(CCXX_NAMESPACES)
! fi
! AC_LANG_RESTORE
])
AC_DEFUN(OST_CXX_MUTABLE,[
--- 129,146 ----
AC_LANG_CPLUSPLUS
AC_CACHE_CHECK(whether ${CXX} supports namespace,
ost_cv_cxx_namespace,
! AC_TRY_COMPILE([
! #include <iostream>
! namespace Test { using namespace std; };],[return 0;],
! ost_cv_cxx_namespace=yes,
! ost_cv_cxx_namespace=no
! )
! )
! if test "$ost_cv_cxx_namespace" = yes ; then
! AC_DEFINE(CCXX_NAMESPACES)
! fi
! AC_LANG_RESTORE
])
AC_DEFUN(OST_CXX_MUTABLE,[
***************
*** 157,170 ****
AC_CACHE_CHECK(whether ${CXX} supports mutable,
ost_cv_cxx_mutable,
! [echo 'class t {mutable int i;};' >conftest.c
! if test -z "`${CXX} -c conftest.c 2>&1`" ; then
! ost_cv_cxx_mutable=yes
! else
! ost_cv_cxx_mutable=no
! fi
! rm -f conftest*
! ])
if test $ost_cv_cxx_mutable = no ; then
CXXFLAGS="$CXXFLAGS -Dmutable"
--- 155,166 ----
AC_CACHE_CHECK(whether ${CXX} supports mutable,
ost_cv_cxx_mutable,
! AC_TRY_COMPILE([
! class t {mutable int i;};], [return 0;],
! ost_cv_cxx_mutable=yes,
! ost_cv_cxx_mutable=no
! )
! )
if test $ost_cv_cxx_mutable = no ; then
CXXFLAGS="$CXXFLAGS -Dmutable"
Index: m4/ost_socket.m4
===================================================================
RCS file: /cvsroot/cplusplus/CommonC++/m4/ost_socket.m4,v
retrieving revision 1.8
diff -c -r1.8 ost_socket.m4
*** m4/ost_socket.m4 2001/12/06 10:30:50 1.8
--- m4/ost_socket.m4 2002/01/17 09:46:51
***************
*** 79,85 ****
--- 79,87 ----
dnl ACCONFIG BOTTOM
dnl
dnl #ifdef HAVE_SYS_LIBCSYS_H
+ dnl #ifndef _AIX
dnl #include <sys/libcsys.h>
+ dnl #endif
dnl #endif
dnl
dnl #ifdef HAVE_WINSOCK_H
------------------------------------------------------------------------
Index: demo/serialecho.cpp
===================================================================
RCS file: /cvsroot/cplusplus/CommonC++/demo/serialecho.cpp,v
retrieving revision 1.11
diff -c -r1.11 serialecho.cpp
*** demo/serialecho.cpp 2001/10/29 13:09:38 1.11
--- demo/serialecho.cpp 2002/01/17 09:33:10
***************
*** 66,72 ****
using namespace std;
SerialEcho::SerialEcho(const char *device,
! int priority = 0, int stacksize = 0) :
TTYSession( device, priority, stacksize ) {
cout << "Creating SerialEcho" << endl;
--- 66,72 ----
using namespace std;
SerialEcho::SerialEcho(const char *device,
! int priority, int stacksize ) :
TTYSession( device, priority, stacksize ) {
cout << "Creating SerialEcho" << endl;
Index: demo/tcpservice.cpp
===================================================================
RCS file: /cvsroot/cplusplus/CommonC++/demo/tcpservice.cpp,v
retrieving revision 1.11
diff -c -r1.11 tcpservice.cpp
*** demo/tcpservice.cpp 2002/01/06 18:29:44 1.11
--- demo/tcpservice.cpp 2002/01/17 09:33:10
***************
*** 371,377 ****
// Run App would normally read some config file or take some
// parameters about which port to connect to and then
// do that !
! int CCExec::RunApp( char * hn = "localhost" )
{
// which port ?
--- 371,377 ----
// Run App would normally read some config file or take some
// parameters about which port to connect to and then
// do that !
! int CCExec::RunApp( char * hn )
{
// which port ?