diff options
author | Bernard Normier <bernard@zeroc.com> | 2003-04-04 23:24:43 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2003-04-04 23:24:43 +0000 |
commit | b8c9b0c0d76730a18c99ec15bbdf8959562ea4fc (patch) | |
tree | 8794d504f8d5798cb4a43785e686926f9e993877 /cpp | |
parent | fixes (diff) | |
download | ice-b8c9b0c0d76730a18c99ec15bbdf8959562ea4fc.tar.bz2 ice-b8c9b0c0d76730a18c99ec15bbdf8959562ea4fc.tar.xz ice-b8c9b0c0d76730a18c99ec15bbdf8959562ea4fc.zip |
Initial phase of Sun support
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 2 | ||||
-rw-r--r-- | cpp/config/Make.rules | 38 | ||||
-rw-r--r-- | cpp/config/Make.rules.Linux | 33 | ||||
-rw-r--r-- | cpp/config/Make.rules.SunOS | 33 | ||||
-rw-r--r-- | cpp/include/Ice/Config.h | 8 | ||||
-rw-r--r-- | cpp/include/Ice/Const.h | 10 | ||||
-rw-r--r-- | cpp/include/IceUtil/Config.h | 6 | ||||
-rw-r--r-- | cpp/include/IceUtil/RWRecMutex.h | 36 | ||||
-rw-r--r-- | cpp/include/IceUtil/Shared.h | 2 | ||||
-rw-r--r-- | cpp/src/IceUtil/Makefile | 5 |
10 files changed, 140 insertions, 33 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 19859425f31..5a18356990e 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,8 @@ Changes since version 1.0.1 --------------------------- +- Build system and IceUtil improvements for Sun port. + - Added support for GCC 2.95.3. - Several incompatible IceStorm changes: diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules index ce6e8ab143f..a66ebec165f 100644 --- a/cpp/config/Make.rules +++ b/cpp/config/Make.rules @@ -56,7 +56,7 @@ prefix = /opt/Ice-$(VERSION) # directory. # -OPENSSL_HOME ?= /opt/openssl +#OPENSSL_HOME ?= /opt/openssl # # If Xerces-C++ is not installed in a standard location where the @@ -66,6 +66,18 @@ OPENSSL_HOME ?= /opt/openssl #XERCESC_HOME ?= /opt/xerces-c + +# +# If E2fsprogs is not installed in a standard location where the +# compiler can find it, set E2FSPROGS_HOME to the E2fsprogs +# installation directory. +# E2fsprogs is used only for its UUID library. +# +# + +#E2FSPROGS_HOME ?= /opt/e2fsprogs + + # ---------------------------------------------------------------------- # Don't change anything below this line! # ---------------------------------------------------------------------- @@ -90,6 +102,8 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_LIBRARY = ${INSTALL} -m 644 INSTALL_DATA = ${INSTALL} -m 644 +UNAME := $(shell uname) + ifneq ($(STLPORT_HOME),) STLPORT_FLAGS = -I$(STLPORT_HOME)/include/stlport ifeq ($(OPTIMIZE),yes) @@ -126,25 +140,27 @@ else XERCESC_LIBS = -lxerces-c endif -CXX = c++ -CXXFLAGS = -ftemplate-depth-128 -fPIC -Wall -ifeq ($(OPTIMIZE),yes) - CXXFLAGS := -O2 -DNDEBUG $(CXXFLAGS) +ifneq ($(E2FSPROGS_HOME),) + E2FSPROGS_FLAGS = -I$(E2FSPROGS_HOME)/include + E2FSPROGS_LIBS = -L$(E2FSPROGS_HOME)/lib -luuid else - CXXFLAGS := -g $(CXXFLAGS) + E2FSPROGS_FLAGS = + E2FSPROGS_LIBS = -luuid endif + +# +# Platform specific definitions +# +include $(top_srcdir)/config/Make.rules.$(UNAME) + + CPPFLAGS = -I$(includedir) $(STLPORT_FLAGS) ICECPPFLAGS = -I$(slicedir) SLICE2CPPFLAGS = $(ICECPPFLAGS) LDFLAGS = -L$(libdir) -SHLIB_LDFLAGS = -shared -Xlinker -soname -Xlinker $(@F) - -LIBEXT = so -BASELIBS = -lIceUtil -lpthread -luuid $(STLPORT_LIBS) -LIBS = -lIce -ldl -lbz2 $(BASELIBS) SLICE2CPP = $(bindir)/slice2cpp SLICE2XSD = $(bindir)/slice2xsd diff --git a/cpp/config/Make.rules.Linux b/cpp/config/Make.rules.Linux new file mode 100644 index 00000000000..e97055f9cf3 --- /dev/null +++ b/cpp/config/Make.rules.Linux @@ -0,0 +1,33 @@ +# ********************************************************************** +# +# Copyright (c) 2003 +# ZeroC, Inc. +# Billerica, MA, USA +# +# All Rights Reserved. +# +# Ice is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. +# +# ********************************************************************** + +# +# This file is included by Make.rules when uname is Linux. +# + +CXX = c++ +CXXFLAGS = -ftemplate-depth-128 -fPIC -Wall + +ifeq ($(OPTIMIZE),yes) + CXXFLAGS := -O2 -DNDEBUG $(CXXFLAGS) +else + CXXFLAGS := -g $(CXXFLAGS) +endif + +SHLIB_LDFLAGS = -shared -Xlinker -soname -Xlinker $(@F) + +LIBEXT = so + +BASELIBS = -lIceUtil $(STLPORT_LIBS) -lpthread +LIBS = -lIce -ldl -lbz2 $(BASELIBS) diff --git a/cpp/config/Make.rules.SunOS b/cpp/config/Make.rules.SunOS new file mode 100644 index 00000000000..540f58bea05 --- /dev/null +++ b/cpp/config/Make.rules.SunOS @@ -0,0 +1,33 @@ +# ********************************************************************** +# +# Copyright (c) 2003 +# ZeroC, Inc. +# Billerica, MA, USA +# +# All Rights Reserved. +# +# Ice is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. +# +# ********************************************************************** + +# +# This file is included by Make.rules when uname is SunOS. +# + +CXX = CC +CXXFLAGS = -KPIC -mt +w +p + +ifeq ($(OPTIMIZE),yes) + CXXFLAGS := -O -DNDEBUG $(CXXFLAGS) +else + CXXFLAGS := -g $(CXXFLAGS) +endif + +SHLIB_LDFLAGS = -G -h $(@F) + +LIBEXT = so + +BASELIBS = -lIceUtil $(STLPORT_LIBS) -lpthread +LIBS = -lIce -lbz2 $(BASELIBS) -ldl diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h index 0dd78d1d584..6f73221b81c 100644 --- a/cpp/include/Ice/Config.h +++ b/cpp/include/Ice/Config.h @@ -75,7 +75,7 @@ inline int getSystemErrno() { return GetLastError(); } inline int getSocketErrno() { return WSAGetLastError(); } inline int getDNSErrno() { return WSAGetLastError(); } -#elif (defined(__linux__) || defined(__FreeBSD__)) && defined(i386) +#elif (defined(__linux__) || defined(__FreeBSD__)) && defined(i386) || defined (__sun) # include <sys/types.h> # include <unistd.h> @@ -89,7 +89,13 @@ namespace Ice typedef char Byte; typedef short Short; typedef int Int; + +#ifdef __sparcv9 +typedef long Long +#else typedef long long Long; +#endif + typedef float Float; typedef double Double; diff --git a/cpp/include/Ice/Const.h b/cpp/include/Ice/Const.h index 39457c89d60..044fd3a8741 100644 --- a/cpp/include/Ice/Const.h +++ b/cpp/include/Ice/Const.h @@ -15,10 +15,18 @@ #ifndef ICE_CONST_H #define ICE_CONST_H +// +// TODO: - switch to C++ compiler macros, since this syntax is compiler +// dependent +// - define an ICE_WIDTH macro (or ICE_32 and ICE_64?) to avoid doing +// the 32 vs 64 bit checks in multiple places. + #if defined(_WIN32) # define ICE_INT64_LITERAL(n) n##i64 -#elif defined(__linux__) && defined(i386) +#elif defined(__linux__) && defined(i386) || (defined (__sun) && !defined(__sparcv9)) # define ICE_INT64_LITERAL(n) n##LL +#elif defined (__sun) && defined(__sparcv9) +# define ICE_INT64_LITERAL(n) n##L #else # error "Unsupported operating system or platform!" #endif diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 89089c451dc..75bda4994a7 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -76,6 +76,12 @@ # define __STDC_LIMIT_MACROS # include <stdint.h> +#elif defined(__sun) && defined(__sparc) + +# define ICE_UTIL_API /**/ +# define SIZEOF_WCHAR_T 4 +# include <inttypes.h> + #else # error "unsupported operating system or platform" diff --git a/cpp/include/IceUtil/RWRecMutex.h b/cpp/include/IceUtil/RWRecMutex.h index 9e47bdba894..362ee2e0314 100644 --- a/cpp/include/IceUtil/RWRecMutex.h +++ b/cpp/include/IceUtil/RWRecMutex.h @@ -23,17 +23,17 @@ namespace IceUtil { template <typename T> -class RLock +class RLockT { public: - RLock(const T& mutex) : + RLockT(const T& mutex) : _mutex(mutex) { _mutex.readlock(); } - ~RLock() + ~RLockT() { _mutex.unlock(); } @@ -56,23 +56,23 @@ private: }; template <typename T> -class TryRLock +class TryRLockT { public: - TryRLock(const T& mutex) : + TryRLockT(const T& mutex) : _mutex(mutex) { _mutex.tryReadlock(); } - TryRLock(const T& mutex, const Time& timeout) : + TryRLockT(const T& mutex, const Time& timeout) : _mutex(mutex) { _mutex.timedTryReadlock(timeout); } - ~TryRLock() + ~TryRLockT() { _mutex.unlock(); } @@ -95,17 +95,17 @@ private: }; template <typename T> -class WLock +class WLockT { public: - WLock(const T& mutex) : + WLockT(const T& mutex) : _mutex(mutex) { _mutex.writelock(); } - ~WLock() + ~WLockT() { _mutex.unlock(); } @@ -116,23 +116,23 @@ private: }; template <typename T> -class TryWLock +class TryWLockT { public: - TryWLock(const T& mutex) : + TryWLockT(const T& mutex) : _mutex(mutex) { _mutex.tryWritelock(); } - TryWLock(const T& mutex, const Time& timeout) : + TryWLockT(const T& mutex, const Time& timeout) : _mutex(mutex) { _mutex.timedTryWritelock(timeout); } - ~TryWLock() + ~TryWLockT() { _mutex.unlock(); } @@ -159,10 +159,10 @@ public: // // RLock (reader) & WLock (writer) typedefs. // - typedef RLock<RWRecMutex> RLock; - typedef TryRLock<RWRecMutex> TryRLock; - typedef WLock<RWRecMutex> WLock; - typedef TryWLock<RWRecMutex> TryWLock; + typedef RLockT<RWRecMutex> RLock; + typedef TryRLockT<RWRecMutex> TryRLock; + typedef WLockT<RWRecMutex> WLock; + typedef TryWLockT<RWRecMutex> TryWLock; RWRecMutex(); ~RWRecMutex(); diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h index 7b8d2aa8128..aae20dc017a 100644 --- a/cpp/include/IceUtil/Shared.h +++ b/cpp/include/IceUtil/Shared.h @@ -20,7 +20,7 @@ // // The inline assembler causes problems with shared libraries. // -#if defined(__ICC) && !defined(_WIN32) +#if (defined(__ICC) && !defined(_WIN32)) || defined (__sun) # define ICE_USE_MUTEX_SHARED #endif diff --git a/cpp/src/IceUtil/Makefile b/cpp/src/IceUtil/Makefile index ceb47a5d4af..a6d950fc77a 100644 --- a/cpp/src/IceUtil/Makefile +++ b/cpp/src/IceUtil/Makefile @@ -35,9 +35,12 @@ SRCS = $(OBJS:.o=.cpp) include $(top_srcdir)/config/Make.rules +CPPFLAGS := $(CPPFLAGS) $(E2FSPROGS_FLAGS) +LINKWITH := $(STLPORT_LIBS) $(E2FSPROGS_LIBS) + $(VERSIONED_NAME): $(OBJS) rm -f $@ - $(CXX) $(SHLIB_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS) + $(CXX) $(SHLIB_LDFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LINKWITH) install:: all $(INSTALL_LIBRARY) $(VERSIONED_NAME) $(install_libdir) |