Checked in Tino Schwarze's port to HP-UX.

This commit is contained in:
Robert Osfield
2002-07-23 10:48:22 +00:00
parent 609a9ebf21
commit 80afddc08d
20 changed files with 165 additions and 25 deletions

View File

@@ -111,6 +111,10 @@ Bob Kuehne <rpk@mac.com>
Kristopher Bixler <kbixler@mac.com>
- port to OSX's native dynamic library support.
Tino Schwarze <tino.schwarze@informatik.tu-chemnitz.de>
-port to HP-UX.
Indirect Contributors
---------------------

View File

@@ -49,7 +49,13 @@ INST_DOC = $(INST_SHARE_PREFIX)/OpenSceneGraph/doc
INST_DATA = $(INST_SHARE_PREFIX)/OpenSceneGraph/data
INST_DEMO_SRC = $(INST_SRC)/demos
ifneq ($(OS),HP-UX)
LINK = ln -sf
else
# HP-UX linker seems to have problems with symlinked libs -
# somehow paths like "../../.." get into the executables
LINK = cp -f
endif
INSTBINCMD = install -m 755
INSTDEVCMD = install -m 644
INSTLINKBINCMD = $(LINK)
@@ -121,7 +127,7 @@ endif
ifeq ($(OS),IRIX)
C++ = CC
DEPFLAGS = -M
DEPARG = -M
INC += -I${TOPDIR}/include -I/usr/freeware/
DEF += -LANG:std -OPT:Olimit=0 \
-DEBUG:woff=1682 -DEBUG:woff=3303\
@@ -406,6 +412,67 @@ ifeq ($(OS),MINGW)
# osgcluster
endif
#### HP-UX Specific definitions
# contributed by tino.schwarze@informatik.tu-chemnitz.de
ifeq ($(OS),HP-UX)
C++ = g++
DEPARG = -M
INC += -I/opt/glut/include
DEF += -W -Wall -fPIC
OPTF = -O2
# gcc 3.1 uses DWARF as default, my GDB might not yet support this...
# at least I've got problems everywhere
DBGF = -g -gstabs+
SHARED = -shared -fPIC
ARCH = 32
ifeq ($(ARCH),64)
# not yet tested
ARCHARGS = -march=2.0
# I don't have performer - just a wild guess of the directory
PF_XTRA_LIBS = -L/opt/graphics/libpfdb -Wl,-rpath -Wl,/opt/graphics/libpfdb \
-lpf3ds -lpfdem -lpfdted -lpfdwb -lpfdxf -lpfevt \
-lpfflt -lpfgds -lpfgfo -lpfim -lpflsa -lpflsb \
-lpfnff -lpfobj -lpfpegg -lpfpfb -lpfphd -lpfpts \
-lpfrot -lpfscale -lpfsgf -lpfsgo -lpfsphere -lpfsv \
-lpftri -lpfunc -lpfvct -lpfdu -lpfutil -lpf -limage
else
# at least my gcc 3.1 defaults to HP-PA RISC 1.1
ARCHARGS =
# I don't have performer - just a wild guess of the directory
PF_XTRA_LIBS = -L/opt/graphics/libpfdb -Wl,-rpath -Wl,/usr/lib64/libpfdb \
-lpf3ds -lpfdem -lpfdted -lpfdwb -lpfdxf -lpfevt \
-lpfflt -lpfgds -lpfgfo -lpfim -lpflsa -lpflsb \
-lpfnff -lpfobj -lpfpegg -lpfpfb -lpfphd -lpfpts \
-lpfrot -lpfscale -lpfsgf -lpfsgo -lpfsphere -lpfsv \
-lpftri -lpfunc -lpfvct -lpfdu -lpfutil -lpf -limage
endif
LINKARGS = -lpthread
LIB_EXT = sl
PLUGIN_EXT = sl
DYNAMICLIBRARYLIB = -ldld
OSG_LIBS = -losgGLUT -losgGA -losgDB -losgUtil -losg
# glut delivered with HP-UX is outdated
GLUT_LIB = -L/opt/glut/lib -lglut
GL_LIBS = -L/opt/graphics/OpenGL/lib -lGLU -lGL
X_LIBS = -L/usr/lib/X11R6 -lXext -lXi -lX11 -L/usr/lib/X11R4 -lXmu
SOCKET_LIBS =
# make sure that global constructors/destructors are called upon
# shl_load() / shl_unload() - this is a gcc specific workaround
OTHER_LIBS = -lm -Wl,+init -Wl,_GLOBAL__DI -Wl,+fini -Wl,_GLOBAL__DD
FREETYPE_INCLUDE = -I/opt/freetype/include -I/opt/freetype/include/freetype2
FREETYPE_LIB = -L/opt/freetype/lib -lfreetype
PNG_INCLUDE = -I/opt/libpng/include
PNG_LIBS = -L/opt/libpng/lib -lpng -L/opt/zlib/lib -lz
JPEG_INCLUDE = -I/opt/jpeg-6/include
JPEG_LIBS = -L/opt/jpeg-6/lib -ljpeg
TIFF_INCLUDE = -I/opt/tiff-3.5/include
TIFF_LIB = -L/opt/tiff-3.5/lib -ltiff
GIF_INCLUDE = -I/opt/libungif/include
GIF_LIBS = -L/opt/libungif/lib -lungif
endif
VPATH=..

View File

@@ -71,16 +71,22 @@ $(LIB) : $(OBJS)
$(PLUGIN) : $(OBJS)
$(C++) $(LDFLAGS) -bundle $(OBJS) $(LIBS) -o $@
else
ifeq ($(OS),HP-UX)
# we need to explicitly tell the linker the library name - else it will
# include paths like ../../../libosg.sl into executables
$(LIB) $(PLUGIN) : $(OBJS)
$(C++) $(LDFLAGS) $(SHARED) $(OBJS) $(LIBS) -Wl,+h -Wl,$@ -Wl,-v -o $@
else
$(LIB) $(PLUGIN) : $(OBJS)
$(C++) $(LDFLAGS) $(SHARED) $(OBJS) $(LIBS) -o $@
endif
endif # not HP-UX
endif # not Darwin
$(EXEC:=.dbg) :
@[ -d $(DEBUGDIR) ] || mkdir $(DEBUGDIR)
@cd $(DEBUGDIR); \
$(MAKE) -f ../Makefile DOF=$(DBGF) TOPDIR=../${TOPDIR} \
$(MAKE) -f ../Makefile "DOF=$(DBGF)" TOPDIR=../${TOPDIR} \
THISDIR=../$(THISDIR)\
MAKEDEPEND=Makedepend $(EXEC)
@$(MAKE) LNSRC=$(DEBUGDIR)/$(EXEC) LNDEST=$(BININST)/$(EXEC) __link
@@ -88,7 +94,7 @@ $(EXEC:=.dbg) :
$(LIB:=.dbg) :
@[ -d $(DEBUGDIR) ] || mkdir $(DEBUGDIR)
@cd $(DEBUGDIR);\
$(MAKE) -f ../Makefile DOF=$(DBGF) TOPDIR=../${TOPDIR} \
$(MAKE) -f ../Makefile "DOF=$(DBGF)" TOPDIR=../${TOPDIR} \
THISDIR=../$(THISDIR)\
MAKEDEPEND=Makedepend $(LIB)
@$(MAKE) LNSRC=$(DEBUGDIR)/$(LIB) LNDEST=$(LIBINST)/$(LIB) __link
@@ -96,7 +102,7 @@ $(LIB:=.dbg) :
$(PLUGIN:=.dbg) :
@[ -d $(DEBUGDIR) ] || mkdir $(DEBUGDIR)
@cd $(DEBUGDIR); \
$(MAKE) -f ../Makefile DOF=$(DBGF) TOPDIR=../${TOPDIR} \
$(MAKE) -f ../Makefile "DOF=$(DBGF)" TOPDIR=../${TOPDIR} \
THISDIR=../$(THISDIR)\
MAKEDEPEND=Makedepend $(PLUGIN)
@$(MAKE) LNSRC=$(DEBUGDIR)/$(PLUGIN) LNDEST=$(PLUGININST)/$(PLUGIN) __link
@@ -144,7 +150,7 @@ endif
## Doesn't work too well, but leave the code here for later evaulation
ifeq (0,1)
ifneq ($(OS),IRIX)
$(C++) $(INC) $(DEPFLAGS) $< > .temp.dep
$(C++) $(INC) $(DEPARG) $< > .temp.dep
if [ -f $(MAKEDEPEND) ] ; \
then \
grep -v $< $(MAKEDEPEND) > .temp.dep1;\

View File

@@ -7,7 +7,7 @@
#include <math.h>
#if defined(WIN32) || defined (macintosh)|| defined (sun) || defined (__DARWIN_OSX__)
#if defined(WIN32) || defined (macintosh)|| defined (sun) || defined (__DARWIN_OSX__) || defined(__hpux__)
#include <float.h>

View File

@@ -8,7 +8,11 @@
#if defined(__DARWIN_OSX__)
#include <GLUT/glut.h>
#else
#if defined(__hpux__)
#include <glut.h>
#else
#include <GL/glut.h>
#endif
#endif
#endif // __osgGLUT_h

View File

@@ -64,4 +64,4 @@ but until that day we're stuck with this 'hack'...
Robert Osfield,
March 20001.
March 2001.

View File

@@ -36,6 +36,8 @@
#elif defined (WIN32)
#include <winsock.h>
#include <stdio.h>
#elif defined (__hpux__)
#include <unistd.h>
#else
#error Teach me how to build on this system
#endif

View File

@@ -23,4 +23,4 @@ but until that day we're stuck with this 'hack'...
Robert Osfield,
March 20001.
March 2001.

View File

@@ -23,4 +23,4 @@ but until that day we're stuck with this 'hack'...
Robert Osfield,
March 20001.
March 2001.

View File

@@ -71,6 +71,10 @@ void* osg::getGLExtensionFuncPtr(const char *funcName)
symbol = NSLookupAndBindSymbol( temp.c_str() );
return NSAddressOfSymbol( symbol );
#else // all other unixes
// Note: although we use shl_load() etc. for Plugins on HP-UX, it's
// not neccessary here since we only used them because library
// intialization was not taking place with dlopen() which renders
// Plugins useless on HP-UX.
static void *lib = dlopen("libGL.so", RTLD_LAZY);
if (lib)
return dlsym(lib, funcName);

View File

@@ -6,8 +6,15 @@
#include <mach-o/dyld.h>
#else // all other unix
#include <unistd.h>
#ifdef __hpux__
// Although HP-UX has dlopen() it is broken! We therefore need to stick
// to shl_load()/shl_unload()/shl_findsym()
#include <dl.h>
#include <errno.h>
#else
#include <dlfcn.h>
#endif
#endif
#include <osg/Notify>
@@ -31,6 +38,9 @@ DynamicLibrary::~DynamicLibrary()
FreeLibrary((HMODULE)_handle);
#elif defined(__DARWIN_OSX__)
NSUnLinkModule(_handle, FALSE);
#elif defined(__hpux__)
// fortunately, shl_t is a pointer
shl_unload (static_cast<shl_t>(_handle));
#else // other unix
dlclose(_handle);
#endif
@@ -58,6 +68,12 @@ DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName)
}
// if (os_handle) return osgNew DynamicLibrary(libraryName,os_handle);
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
#elif defined(__hpux__)
// BIND_FIRST is neccessary for some reason
HANDLE handle = shl_load ( fullLibraryName.c_str(), BIND_DEFERRED|BIND_FIRST|BIND_VERBOSE, 0);
if (handle) return osgNew DynamicLibrary(libraryName,handle);
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
notify(WARN) << "DynamicLibrary::error "<<strerror(errno)<<std::endl;
#else // other unix
HANDLE handle = dlopen( fullLibraryName.c_str(), RTLD_LAZY );
if (handle) return osgNew DynamicLibrary(libraryName,handle);
@@ -79,6 +95,18 @@ DynamicLibrary::PROC_ADDRESS DynamicLibrary::getProcAddress(const std::string& p
temp += procName; // Mac OS X prepends an underscore on function names
symbol = NSLookupAndBindSymbol(temp.c_str());
return NSAddressOfSymbol(symbol);
#elif defined(__hpux__)
void* result = NULL;
if (shl_findsym (reinterpret_cast<shl_t*>(&_handle), procName.c_str(), TYPE_PROCEDURE, result) == 0)
{
return result;
}
else
{
notify(WARN) << "DynamicLibrary::failed looking up " << procName << std::endl;
notify(WARN) << "DynamicLibrary::error " << strerror(errno) << std::endl;
return NULL;
}
#else // other unix
return dlsym( _handle, procName.c_str() );
#endif

View File

@@ -394,6 +394,9 @@ std::string Registry::createLibraryNameForExt(const std::string& ext)
#endif
#elif macintosh
return "osgdb_"+ext;
#elif defined(__hpux__)
// why don't we use PLUGIN_EXT from the makefiles here?
return "osgdb_"+ext+".sl";
#else
return "osgdb_"+ext+".so";
#endif
@@ -417,6 +420,9 @@ std::string Registry::createLibraryNameForNodeKit(const std::string& name)
#endif
#elif macintosh
return name;
#elif defined(__hpux__)
// why don't we use PLUGIN_EXT from the makefiles here?
return "lib"+name+".sl";
#else
return "lib"+name+".so";
#endif

View File

@@ -65,7 +65,7 @@ bool Window::open()
glutInitDisplayMode( _displayMode);
glutCreateWindow( _title.c_str() );
glutCreateWindow( const_cast<char*>(_title.c_str()) );
glutReshapeFunc( reshapeCB );
glutVisibilityFunc( visibilityCB );

View File

@@ -605,6 +605,12 @@ inline int IsNaNorInf( float f )
return isnanf(f) || isinf(f);
#elif defined(WIN32)
return _isnan(f) || !_finite(f);
#elif defined(__hpux__)
// this is a hack - cmath from gcc 3.1 #undef's isinf() but does not
// redefine it (at least for me), enabling _GLIBCPP_USE_C99 also
// doesn't help (loads of compilation errors), so I just repeat the
// definition of isinf() from math.h here.
return isnan(f) || (_ISINF(f));
#else
# error Teach me how to find non-numbers on this platform.
return 0;
@@ -1228,15 +1234,6 @@ void DXArrayWriter::WritePerVertexTCoords(
//----------------------------------------------------------------------------
inline float MAX( float x, float y )
{ return x > y ? x : y; }
inline float MAX3( float x, float y, float z )
{ return MAX( MAX( x, y ), z ); }
inline float MaxVecXYZ( const osg::Vec4 &v )
{ return MAX3( v[0], v[1], v[2] ); }
inline float Luminance( const osg::Vec4 &v )
{ return 0.2122*v[0] + 0.7013*v[1] * 0.0865*v[2]; }

View File

@@ -5,10 +5,15 @@ CXXFILES =\
ReaderWriterGIF.cpp\
ifeq ($(OS),HP-UX)
INC += $(GIF_INCLUDE)
else
INC += -I/usr/local/include\
-I/usr/freeware/include\
LINKARGS += -L/usr/freeware/lib$(ARCH)
endif
LIBS += $(OSG_LIBS) $(GIF_LIBS) $(OTHER_LIBS)

View File

@@ -4,7 +4,11 @@ include $(TOPDIR)/Make/makedefs
CXXFILES =\
ReaderWriterJPEG.cpp\
ifneq ($(OS),HP-UX)
INC += -I/usr/local/include/
else
INC += $(JPEG_INCLUDE)
endif
LIBS += $(OSG_LIBS) $(JPEG_LIBS) $(OTHER_LIBS)

View File

@@ -6,4 +6,4 @@ in the future to support inline images. Currently osg::Images are supported
via the osgDB::Registry::read/writeImage methods and plugins.
Robert Osfield,
March 20001.
March 2001.

View File

@@ -5,10 +5,14 @@ CXXFILES =\
ReaderWriterPNG.cpp\
LIBS += $(OSG_LIBS) $(PNG_LIBS) $(OTHER_LIBS)
ifneq ($(OS),HP-UX)
INC += -I/usr/local/include\
-I/usr/freeware/include\
LINKARGS += -L/usr/freeware/lib$(ARCH)
else
INC += $(PNG_INCLUDE)
endif
TARGET_BASENAME = png
include $(TOPDIR)/Make/cygwin_plugin_def

View File

@@ -6,8 +6,12 @@ CXXFILES =\
LIBS += $(OSG_LIBS) $(TIFF_LIB) $(OTHER_LIBS)
ifeq ($(OS),HP-UX)
INC += $(TIFF_INCLUDE)
else
INC += -I/usr/local/include
LDFLAGS += -L/usr/local/lib
endif
TARGET_BASENAME = tiff
include $(TOPDIR)/Make/cygwin_plugin_def

View File

@@ -32,16 +32,21 @@ CXXFILES =\
LIBS += $(OSG_LIBS) $(FREETYPE_LIB) $(OTHER_LIBS)
DEF += -DOSGTEXT_LIBRARY
ifneq ($(OS),HP-UX)
INC += -I$(OSGHOME)/include \
-I/usr/include/freetype2 \
-I/usr/local/include \
-I/usr/local/include/freetype2 \
-I/usr/freeware/include \
-I/usr/freeware/include/freetype2 \
DEF += -DOSGTEXT_LIBRARY
-I/usr/freeware/include/freetype2
LINKARGS += -L/usr/local/lib\
-L/usr/freeware/lib$(ARCH)
else
INC += $(FREETYPE_INCLUDE)
endif
TARGET_BASENAME = osgText
LIB = $(LIB_PREFIX)$(TARGET_BASENAME).$(LIB_EXT)