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

@@ -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)