Revision: 6756
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6756&view=rev
Author:   gbiggs
Date:     2008-07-03 19:44:27 -0700 (Thu, 03 Jul 2008)

Log Message:
-----------
Fixes to make player compile on QNX and Solaris

Modified Paths:
--------------
    code/player/trunk/client_libs/libplayerc/CMakeLists.txt
    code/player/trunk/client_libs/libplayerc/client.c
    code/player/trunk/client_libs/libplayerc++/CMakeLists.txt
    code/player/trunk/cmake/internal/SearchForStuff.cmake
    code/player/trunk/libplayercore/CMakeLists.txt
    code/player/trunk/libplayertcp/CMakeLists.txt
    code/player/trunk/libplayerxdr/CMakeLists.txt
    code/player/trunk/libplayerxdr/functiontable.c
    code/player/trunk/libplayerxdr/functiontable.h
    code/player/trunk/playerconfig.h.in
    code/player/trunk/replace/clock_gettime.c
    code/player/trunk/server/drivers/rfid/rfi341_protocol.cc

Modified: code/player/trunk/client_libs/libplayerc/CMakeLists.txt
===================================================================
--- code/player/trunk/client_libs/libplayerc/CMakeLists.txt     2008-07-03 
23:46:19 UTC (rev 6755)
+++ code/player/trunk/client_libs/libplayerc/CMakeLists.txt     2008-07-04 
02:44:27 UTC (rev 6756)
@@ -59,16 +59,18 @@
 TARGET_LINK_LIBRARIES (playerc playerxdr playerutils playererror 
${PLAYERC_EXTRA_LINK_LIBRARIES})
 IF (HAVE_JPEG)
     TARGET_LINK_LIBRARIES (playerc playerjpeg)
-    PLAYERC_ADD_LINK_LIB (jpeg)
 ENDIF (HAVE_JPEG)
 IF (HAVE_Z)
     TARGET_LINK_LIBRARIES (playerc z)
-    PLAYERC_ADD_LINK_LIB (z)
 ENDIF (HAVE_Z)
 IF (HAVE_GEOS)
     TARGET_LINK_LIBRARIES (playerc ${GEOS_LIBS})
-    PLAYERC_ADD_LINK_LIB (${GEOS_LIBS})
 ENDIF (HAVE_GEOS)
+IF (PLAYER_OS_QNX)
+    TARGET_LINK_LIBRARIES (playerc socket rpc)
+ELSEIF (PLAYER_OS_SOLARIS)
+    TARGET_LINK_LIBRARIES (playerc socket nsl)
+ENDIF (PLAYER_OS_QNX)
 
 PLAYER_INSTALL_HEADERS (playerc playerc.h)
 

Modified: code/player/trunk/client_libs/libplayerc/client.c
===================================================================
--- code/player/trunk/client_libs/libplayerc/client.c   2008-07-03 23:46:19 UTC 
(rev 6755)
+++ code/player/trunk/client_libs/libplayerc/client.c   2008-07-04 02:44:27 UTC 
(rev 6756)
@@ -1180,7 +1180,7 @@
     if((encode_msglen =
         (*packfunc)(client->write_xdrdata + PLAYERXDR_MSGHDR_SIZE,
                     PLAYER_MAX_MESSAGE_SIZE - PLAYERXDR_MSGHDR_SIZE,
-                    data, PLAYERXDR_ENCODE)) < 0)
+                    (void*) data, PLAYERXDR_ENCODE)) < 0)
     {
       PLAYERC_ERR4("encoding failed on message from %s:%u with type %s:%u",
                    interf_to_str(header->addr.interf), header->addr.index, 
msgtype_to_str(header->type), header->subtype);

Modified: code/player/trunk/client_libs/libplayerc++/CMakeLists.txt
===================================================================
--- code/player/trunk/client_libs/libplayerc++/CMakeLists.txt   2008-07-03 
23:46:19 UTC (rev 6755)
+++ code/player/trunk/client_libs/libplayerc++/CMakeLists.txt   2008-07-04 
02:44:27 UTC (rev 6756)
@@ -1,6 +1,11 @@
 ADD_SUBDIRECTORY (test)
 
-OPTION (BUILD_PLAYERCC "Build the C++ client library" ON)
+IF (HAVE_STL)
+    OPTION (BUILD_PLAYERCC "Build the C++ client library" ON)
+ELSE (HAVE_STL)
+    MESSAGE (STATUS "PlayerC++ client library will not be built - STL is not 
available.")
+    SET (BUILD_PLAYERCC OFF CACHE BOOL "Build the C++ client library" FORCE)
+ENDIF (HAVE_STL)
 
 IF (PLAYER_OS_OSX AND CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION 
EQUAL 4)
     # Boost is off by default on OS X under CMake 2.4
@@ -191,6 +196,13 @@
 
     PLAYER_ADD_LIBRARY (playerc++ ${playerccSrcs} ${playercppconfig_h})
     TARGET_LINK_LIBRARIES (playerc++ playerxdr playerutils playerc 
${PLAYERCC_EXTRA_LINK_LIBRARIES})
+    IF (PLAYER_OS_SOLARIS)
+        TARGET_LINK_LIBRARIES (playerc++ socket nsl)
+        SET (pkgconfigLibFlags "-lsocket -lnsl")
+    ELSE (PLAYER_OS_SOLARIS)
+        SET (pkgconfigLibFlags)
+    ENDIF (PLAYER_OS_SOLARIS)
+
     PLAYER_MAKE_PKGCONFIG ("playerc++"
                            "C++ wrapper for libplayerc - part of the Player 
Project"
                            "playerxdr playerc" "" "-I${boostIncludeDir}"

Modified: code/player/trunk/cmake/internal/SearchForStuff.cmake
===================================================================
--- code/player/trunk/cmake/internal/SearchForStuff.cmake       2008-07-03 
23:46:19 UTC (rev 6755)
+++ code/player/trunk/cmake/internal/SearchForStuff.cmake       2008-07-04 
02:44:27 UTC (rev 6756)
@@ -12,6 +12,16 @@
 CHECK_FUNCTION_EXISTS (getaddrinfo HAVE_GETADDRINFO)
 SET (CMAKE_REQUIRED_LIBRARIES)
 
+IF (PLAYER_OS_QNX)
+    SET (CMAKE_REQUIRED_LIBRARIES rpc)
+ENDIF (PLAYER_OS_QNX)
+CHECK_FUNCTION_EXISTS (xdr_free HAVE_XDR)
+IF (NOT HAVE_XDR)
+    MESSAGE (STATUS "XDR was not found. This is necessary for Player to 
function.")
+ENDIF (NOT HAVE_XDR)
+CHECK_FUNCTION_EXISTS (xdr_longlong_t HAVE_XDR_LONGLONG_T)
+SET (CMAKE_REQUIRED_LIBRARIES)
+
 CHECK_FUNCTION_EXISTS (cfmakeraw HAVE_CFMAKERAW)
 CHECK_FUNCTION_EXISTS (dirname HAVE_DIRNAME)
 CHECK_LIBRARY_EXISTS (ltdl lt_dlopenext "" HAVE_LIBLTDL)
@@ -93,6 +103,20 @@
 
 IF (PLAYER_OS_QNX)
     SET (PTHREAD_LIB)
+    SET (SOCKET_LIBS socket)
+    SET (SOCKET_LIBS_FLAGS -lsocket)
+ELSEIF (PLAYER_OS_SOLARIS)
+    SET (PTHREAD_LIB -lpthread)
+    SET (SOCKET_LIBS socket nsl)
+    SET (SOCKET_LIBS_FLAGS "-lsocket -lnsl")
 ELSE (PLAYER_OS_QNX)
     SET (PTHREAD_LIB -lpthread)
+    SET (SOCKET_LIBS)
+    SET (SOCKET_LIBS_FLAGS)
 ENDIF (PLAYER_OS_QNX)
+
+# STL check
+SET (testSTLSource ${CMAKE_CURRENT_BINARY_DIR}/CMakeTmp/test_stl.cpp)
+FILE (WRITE ${testSTLSource}
+    "#include <string>\nint main () {std::string a = \"blag\"; return 0;}\n")
+TRY_COMPILE (HAVE_STL ${CMAKE_CURRENT_BINARY_DIR} ${testSTLSource})

Modified: code/player/trunk/libplayercore/CMakeLists.txt
===================================================================
--- code/player/trunk/libplayercore/CMakeLists.txt      2008-07-03 23:46:19 UTC 
(rev 6755)
+++ code/player/trunk/libplayercore/CMakeLists.txt      2008-07-04 02:44:27 UTC 
(rev 6756)
@@ -61,10 +61,11 @@
 # from the fact that message cloning functions are auto-generated into
 # playerxdr and used here.  Those functions should go into a separate
 # library.
-SET (coreLibs playerutils playererror playerxdr pthread)
+SET (coreLibs playerutils playererror playerxdr)
 IF (PLAYER_OS_QNX)
     SET (corePCLibs)
 ELSE (PLAYER_OS_QNX)
+    SET (coreLibs ${coreLibs} pthread)
     SET (corePCLibs "-lpthread")
     PLAYER_ADD_LINK_LIB (pthread)
 ENDIF (PLAYER_OS_QNX)

Modified: code/player/trunk/libplayertcp/CMakeLists.txt
===================================================================
--- code/player/trunk/libplayertcp/CMakeLists.txt       2008-07-03 23:46:19 UTC 
(rev 6755)
+++ code/player/trunk/libplayertcp/CMakeLists.txt       2008-07-04 02:44:27 UTC 
(rev 6756)
@@ -3,6 +3,17 @@
 
 INCLUDE_DIRECTORIES (${PROJECT_BINARY_DIR}/libplayercore)
 
+IF (PLAYER_OS_QNX)
+    SET (socketLibs socket)
+    SET (socketLibsFlags -lsocket)
+ELSEIF (PLAYER_OS_SOLARIS)
+    SET (socketLibs socket nsl)
+    SET (socketLibsFlags "-lsocket -lnsl")
+ELSE (PLAYER_OS_QNX)
+    SET (socketLibs)
+    SET (socketLibsFlags)
+ENDIF (PLAYER_OS_QNX)
+
 IF (INCLUDE_TCP)
     OPTION (ENABLE_TCP_NODELAY "Turn off Nagel's buffering algorithm (which 
may increase socket latency when used)" OFF)
 
@@ -14,12 +25,17 @@
       SET (playertcpSrcs ${playertcpSrcs} 
${PROJECT_SOURCE_DIR}/replace/compressBound.c)
     ENDIF (NOT HAVE_COMPRESSBOUND)
     PLAYER_ADD_LIBRARY (playertcp ${playertcpSrcs})
-    TARGET_LINK_LIBRARIES (playertcp playercore playererror playerutils 
playerxdr)
+    TARGET_LINK_LIBRARIES (playertcp playercore playererror playerutils 
playerxdr ${SOCKET_LIBS})
+    IF (SOCKET_LIBS)
+        PLAYER_ADD_LINK_LIB (${SOCKET_LIBS})
+    ENDIF (SOCKET_LIBS)
     IF (HAVE_Z)
         TARGET_LINK_LIBRARIES (playertcp z)
         PLAYER_ADD_LINK_LIB (z)
+        SET (zLibFlag -lz)
     ENDIF (HAVE_Z)
-    PLAYER_MAKE_PKGCONFIG ("playertcp" "Player TCP messaging library - part of 
the Player Project" "playererror playercore" "" "" "")
+    PLAYER_MAKE_PKGCONFIG ("playertcp" "Player TCP messaging library - part of 
the Player Project"
+                           "playererror playercore" "" "" "${zLibFlag} 
${SOCKET_LIBS_FLAGS}")
 
     PLAYER_INSTALL_HEADERS (playertcp playertcp.h)
 ENDIF (INCLUDE_TCP)
@@ -33,9 +49,12 @@
       SET (playerudpSrcs ${playerudpSrcs} 
${PROJECT_SOURCE_DIR}/replace/compressBound.c)
     ENDIF (NOT HAVE_COMPRESSBOUND)
     PLAYER_ADD_LIBRARY (playerudp ${playerudpSrcs})
-    TARGET_LINK_LIBRARIES (playerudp playercore playererror playerutils 
playerxdr)
-    TARGET_LINK_LIBRARIES (playerudp z)
-    PLAYER_MAKE_PKGCONFIG ("playerudp" "Player UDP messaging library - part of 
the Player Project" "playererror playercore" "" "" "")
+    TARGET_LINK_LIBRARIES (playerudp playercore playererror playerutils 
playerxdr ${SOCKET_LIBS} z)
+    IF (SOCKET_LIBS)
+        PLAYER_ADD_LINK_LIB (${SOCKET_LIBS} z)
+    ENDIF (SOCKET_LIBS)
+    PLAYER_MAKE_PKGCONFIG ("playerudp" "Player UDP messaging library - part of 
the Player Project"
+                           "playererror playercore" "" "" "-lz 
${SOCKET_LIBS_FLAGS}")
 
     PLAYER_INSTALL_HEADERS (playertcp playerudp.h)
 ENDIF (INCLUDE_UDP)

Modified: code/player/trunk/libplayerxdr/CMakeLists.txt
===================================================================
--- code/player/trunk/libplayerxdr/CMakeLists.txt       2008-07-03 23:46:19 UTC 
(rev 6755)
+++ code/player/trunk/libplayerxdr/CMakeLists.txt       2008-07-04 02:44:27 UTC 
(rev 6756)
@@ -36,9 +36,19 @@
                     functiontable.c
                     ${functiontable_gen_h})
 
+IF (PLAYER_OS_QNX)
+    SET (xdrLibFlag -lrpc)
+ELSE (PLAYER_OS_QNX)
+    SET (xdrLibFlag)
+ENDIF (PLAYER_OS_QNX)
+
 INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
 PLAYER_ADD_LIBRARY (playerxdr ${playerxdrSrcs})
 SET_SOURCE_FILES_PROPERTIES (${playerxdr_h} ${playerxdr_c} PROPERTIES 
GENERATED TRUE)
-PLAYER_MAKE_PKGCONFIG ("playerxdr" "Player XDR messaging library - part of the 
Player Project" "" "" "" "")
+IF (PLAYER_OS_QNX)
+    TARGET_LINK_LIBRARIES (playerxdr rpc)
+    PLAYER_ADD_LINK_LIB (rpc)
+ENDIF (PLAYER_OS_QNX)
+PLAYER_MAKE_PKGCONFIG ("playerxdr" "Player XDR messaging library - part of the 
Player Project" "" "" "" "${xdrLibFlag}")
 
 PLAYER_INSTALL_HEADERS (playerxdr ${playerxdr_h} functiontable.h)

Modified: code/player/trunk/libplayerxdr/functiontable.c
===================================================================
--- code/player/trunk/libplayerxdr/functiontable.c      2008-07-03 23:46:19 UTC 
(rev 6755)
+++ code/player/trunk/libplayerxdr/functiontable.c      2008-07-04 02:44:27 UTC 
(rev 6756)
@@ -56,6 +56,34 @@
 #include "playerxdr.h"
 #include "functiontable.h"
 
+#ifndef HAVE_XDR_LONGLONG_T
+#include <rpc/types.h>
+#include <rpc/xdr.h>
+
+bool_t xdr_longlong_t(XDR *xdrs, long long int *llp)
+{
+  long int t1, t2;
+  
+  if (xdrs->x_op == XDR_ENCODE)
+  {
+    t1 = (long) ((*llp) >> 32);
+    t2 = (long) (*llp);
+    return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, &t2));
+  }
+  if (xdrs->x_op == XDR_DECODE)
+  {
+    if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
+      return FALSE;
+    *llp = ((long long int) t1) << 32;
+    *llp |= (uint32_t) t2;
+    return TRUE;
+  }
+  if (xdrs->x_op == XDR_FREE)
+    return TRUE;
+  return FALSE;
+}
+#endif
+
 static playerxdr_function_t init_ftable[] =
 {
   /* This list is currently alphabetized, please keep it that way! */

Modified: code/player/trunk/libplayerxdr/functiontable.h
===================================================================
--- code/player/trunk/libplayerxdr/functiontable.h      2008-07-03 23:46:19 UTC 
(rev 6755)
+++ code/player/trunk/libplayerxdr/functiontable.h      2008-07-04 02:44:27 UTC 
(rev 6756)
@@ -53,6 +53,12 @@
 extern "C" {
 #endif
 
+#ifndef HAVE_XDR_LONGLONG_T
+       #include <rpc/types.h>
+       #include <rpc/xdr.h>
+       bool_t xdr_longlong_t(XDR *xdrs, long long int *llp);
+#endif
+
 /** @addtogroup libplayerxdr libplayerxdr @{ */
 
 /** Generic Prototype for a player XDR packing function */

Modified: code/player/trunk/playerconfig.h.in
===================================================================
--- code/player/trunk/playerconfig.h.in 2008-07-03 23:46:19 UTC (rev 6755)
+++ code/player/trunk/playerconfig.h.in 2008-07-04 02:44:27 UTC (rev 6756)
@@ -10,6 +10,8 @@
 #cmakedefine INCLUDE_RTK 1
 #cmakedefine INCLUDE_RTKGUI 1
 #cmakedefine HAVE_CLOCK_GETTIME 1
+#cmakedefine HAVE_XDR_LONGLONG_T 1
+#cmakedefine HAVE_STL 1
 
 #ifdef HAVE_STDINT_H
 #include <stdint.h>

Modified: code/player/trunk/replace/clock_gettime.c
===================================================================
--- code/player/trunk/replace/clock_gettime.c   2008-07-03 23:46:19 UTC (rev 
6755)
+++ code/player/trunk/replace/clock_gettime.c   2008-07-04 02:44:27 UTC (rev 
6756)
@@ -20,6 +20,8 @@
  *
  */
 
+#include <stddef.h>
+#include <time.h>
 #include <sys/time.h>
 
 /* This replacement function originally written by Klass Gadeyne

Modified: code/player/trunk/server/drivers/rfid/rfi341_protocol.cc
===================================================================
--- code/player/trunk/server/drivers/rfid/rfi341_protocol.cc    2008-07-03 
23:46:19 UTC (rev 6755)
+++ code/player/trunk/server/drivers/rfid/rfi341_protocol.cc    2008-07-04 
02:44:27 UTC (rev 6756)
@@ -5,7 +5,6 @@
  CVS: $Id$
 */
 #include <termios.h>
-#include <iostream>
 #include <unistd.h>
 #include <fcntl.h>
 #include <libplayercore/playercore.h>


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to