-------- Original Message --------

Subject:  xml4c on SGI IRIX
Date:  Sun, 28 Nov 1999 16:57:36 +0100
From:  Marc Stuessel <[EMAIL PROTECTED]>
Organization:  IST GmbH
To:  [EMAIL PROTECTED]

 
 

(I also mailed this to [EMAIL PROTECTED])
 
 

Hi

I managed to port xml4c2_3_1 and ICU to SGI IRIX 6.5.5 using SGI MIPSpro C++ 7.3 and 7.2.1 generating 32 bit objects.
 

xml4c Changes/Settings:

1. Environment:

export LD_LIBRARYN32_PATH=usr/lib32/cmplrs:/usr/local/lib:/usr/local/xml4csrc2_3_1/lib:$LD_LIBRARYN32_PATH

(alternatively LD_LIBRARY_PATH may be used). The path /usr/lib/cmplrs is needed for MIPSpro 7.3 compilers only.
No surprises here.
 

2. xml4csrc2_3_1/src/runConfigure (attached)

3. xml4csrc2_3_1/src/Makefile.incl (attached)

4. xml4csrc2_3_1/src/com/ibm/xml/util/AutoSense.hpp IRIXDefs.hpp IRIXPlatformUtils.cpp MIPSproDefs.cpp MIPSporDefs.hpp XML4CDefs.hpp and the Makefile (attached)

Regarding the Makefile in (4): my knowldge of autoconf/automake is limited and hence I'm not sure whether I overlooked something.
 

Actually, in order to make xml4c I had to cheat a little:
When the SGI compilers encounter templates, they emit information in the object file, and in an associated .ii file to help the prelinker determine which files are responsible for instantiating the various template entities referenced in a set of object files.
These .ii files are located in a directory ii_files which is created in the directory where the object files are written (which usually is the directory where the .cpp files are).
These .ii files contain absolute pathnames to their corresponding object files.
Now, you are using an /obj directory where all the object files are copied to. Unfortunately it is not possible to also copy the .ii files to the /obj directory. Due to the absolute filenames the prelinker cannot find the corresponding object file, and a fatal error occurs.
I got around this problem by compiling every source file twice; the second compile output goes directly to the /obj directory -- the .ii files inclusive. This of course renders the cp in the Makefile superfluous.
In Makefile.incl line 61 I created a new variable OBJ_OUT which is used in lines 203 and 207.
This is not very elegant and doubles compile time.
Actually, I don't really understand why you use the /obj directory at all. Building the library would be just as easy when the object files were left where they were compiled. The pathnames are all known; I can't really see what the /obj directory is needed for.
 
 
 

ICU Changes/Settings

1. aclocal.m4 (attached)
2. configure.in (attached)
3. mh-irix (attached)

This is not quite complete, though. I haven't figured out how to get the configure scripts to actually call mh-irix. My knowledge of scripts and autoconf/automake is limited and whatever I did mh-unknown was called. So I just copied mh-irix to mh-unkown which worked just fine.
 

----------------------------
I would like to make some changes in the xml4c sources. Perhaps you could let me know the approx. date of the next relase so that I don't have to do this twice.
If my changes work I'll let you know what I did.
 
 

----------------------------
General Notes:
1.
class DOM_Attr is kind of useless as there is no way to convert from a DOM_Node
to DOM_Attr (eg when using a DOM_NamedNodeMap):

class::method(const DOM_Node& node)
{
   DOM_NamedNodeMap nodeAttributes(node.getAttributes());
   // what now? How do I call DOM_Attr isSpecified() ?
}
 

2. DOM NodeEnumerator is missing
3. DOM AttributeList is missing
If (2) and (3) were implemented, (1) wouldn't be a problem.

4. transcoding: I wrote a little helper method that saves tons of code:

string
XMLParserUtils::transcode(const DOMString& domString)
{
    string result("");

    XMLCh *xmlCh = domString.rawBuffer();
    auto_ptr<char> tmpStr(XMLString::transcode(xmlCh));

    if (tmpStr.get())  {
        result = tmpStr.get();
    }

    return (result);
}

(XMLParserUtils is a namespace). It is a bit unfortunate that I have to delete what XMLString::transcode returns (above this is done automatically by class auto_ptr). On the Windoze NT Platform, the parser crashes when there is no delete [] tmpStr;
 

5. Provided a compiler is used that supports auto_ptr, instantiating a parser can be done like this:

{
    auto_ptr<ValidatingDOMParser> parser(new ValidatingDOMParser);

    auto_ptr<ErrorHandler> errReporter(new DOMTreeErrorReporter);
    parser->setErrorHandler(errReporter.get());

    try  {
        parser->parse((char *)filename);
    }
    catch(const XMLException& ex)  {
        cout << "\nError during parsing: " << filename << "\n"
             << "Exception message is:  \n"
             << XMLParserUtils::transcode(ex.getMessage()) << "\n" << endl;
    }   // catch XMLException
}

delete parser and delete errReporter is not neccesary in this case.

The above would be nicer still if the parse() method would use an STL string as first parameter.
 
 

If there are any questions, or if you want to test a pre-release that supports IRIX, please contact me.
 

-- 
marc

---------------------------------------------------------------
marc stuessel                   mailto:[EMAIL PROTECTED]
IST GmbH
P.O. Box 11 12 29               Fax:   ++49 (0) 721 / 831 32 33
76062 Karlsruhe                 Phone: ++49 (0) 721 / 831 32-0
Germany                         GSM:   ++49 (0) 172 / 527 63 60
 

 
 
 
 
 
 
 
 
 
 
 
 

#
# (C) Copyright IBM Corp. 1998. 1999  All rights reserved.
#
# US Government Users Restricted Rights Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
# The program is provided "as is" without any warranty express or
# implied, including the warranty of non-infringement and the implied
# warranties of merchantibility and fitness for a particular purpose.
# IBM will not be liable for any damages suffered by you as a result
# of using the Program. In no event will IBM be liable for any
# special, indirect or consequential damages or lost profits even if
# IBM has been advised of the possibility of their occurrence. IBM
# will not be liable for any third party claims against you.
#
# @version Revision: 38 1.17 src/Makefile.incl, xml4c2Build, xml4c2, xml4c2_3_1 
#

###################################################################
#                    IMPORTANT NOTE                               #
###################################################################
# Before you try to run the Makefile, make sure you have two      #
# environment variables set.                                      #
#                                                                 #
#   export XML4CROOT=<the directory where you installed XML4C>    #
#   export ICUROOT=<the directory where you installed ICU>        #
#                                                                 #
# Also, to enable debugging, you must type:                       #
#   export DEBUG=1                                                #
# To disable debugging, you must type:                            #
#   unset DEBUG                                                   #
###################################################################


ALL:    all

ALL_OBJECTS_DIR = ${XML4CROOT}/obj

###################### DEBUG MODE OPTION ##########################
# To enable DEBUG mode, just type
# export DEBUG=1
# on your shell (bash assumed) before building.
# To cancel DEBUG mode, type
# unset DEBUG
# on your shell command line.
##################################################################

ifeq (${DEBUG}, 1)
XML_BUILD_OPTIONS = -g
else
XML_BUILD_OPTIONS = -w -O
endif

####################### PLATFORM DEPENDENCIES #####################
#=============== IRIX SPECIFIC OPTIONS ============================
ifeq (${PLATFORM}, IRIX)
PLATFORM_CPP_COMPILER = CC
PLATFORM_C_COMPILER = cc
PLATFORM_LIBRARIES=-L/usr/lib32 
PLATFORM_COMPILE_OPTIONS = -D${PLATFORM} -D_REENTRANT -I/usr/local/include
OBJ_OUT=${XML4CROOT}/obj/
MAKE_SHARED = ${PLATFORM_CPP_COMPILER} -D${PLATFORM} -shared
MAKE_SHARED_C = ${PLATFORM_C_COMPILER} -D${PLATFORM} -shared
EXTRA_LINK_OPTIONS = -lC -lc 
SHLIBSUFFIX=.so
endif


#=============== SOLARIS SPECIFIC OPTIONS =========================
ifeq (${PLATFORM}, SOLARIS)
PLATFORM_CPP_COMPILER = CC
PLATFORM_C_COMPILER = cc
PLATFORM_LIBRARIES=-L/usr/lib 
PLATFORM_COMPILE_OPTIONS = -KPIC -mt -xs -instances=static -features=rtti 
-D${PLATFORM} -D_REENTRANT
MAKE_SHARED = ${PLATFORM_CPP_COMPILER} -D${PLATFORM} -G
MAKE_SHARED_C = ${PLATFORM_C_COMPILER} -D${PLATFORM} -G
EXTRA_LINK_OPTIONS = -lC -lc 
SHLIBSUFFIX=.so
endif

#================= AIX SPECIFIC OPTIONS ===========================
ifeq (${PLATFORM}, AIX)
PLATFORM_CPP_COMPILER = xlC_r
PLATFORM_C_COMPILER = xlc_r
PLATFORM_LIBRARIES=-L/usr/lpp/xlC/lib -L${ICUROOT}/source/common
PLATFORM_COMPILE_OPTIONS = -qnotempinc -D_THREAD_SAFE
MAKE_SHARED = makeC++SharedLib_r -p 5000
MAKE_SHARED_C = makeC++SharedLib_r -p 5000
EXTRA_LINK_OPTIONS = -licu-uc -lbsd
SHLIBSUFFIX=.a
endif

#=============== LINUX SPECIFIC OPTIONS =========================
ifeq (${PLATFORM}, LINUX)
PLATFORM_CPP_COMPILER = g++
PLATFORM_C_COMPILER = gcc
PLATFORM_LIBRARIES=-L/usr/lib -L/usr/local/lib -L/usr/ccs/lib
PLATFORM_COMPILE_OPTIONS = -c -fpic -instances=static -D${PLATFORM} -D_REENTRANT
MAKE_SHARED = ${PLATFORM_CPP_COMPILER} -D${PLATFORM} -shared -fpic
MAKE_SHARED_C = ${PLATFORM_C_COMPILER} -D${PLATFORM} -shared -fpic
EXTRA_LINK_OPTIONS = -lc
SHLIBSUFFIX=.so
endif

#=============== OS2 SPECIFIC OPTIONS =========================
ifeq (${PLATFORM}, OS/2)
PLATFORM_CPP_COMPILER = icc
PLATFORM_C_COMPILER = icc
PLATFORM_LIBRARIES= CPPOM30.LIB os2386.lib mmpm2.lib
PLATFORM_COMPILE_OPTIONS = /C+ /Gd- /Ge- /Gm+ /Gs- /Re /J+  /Ms /Sm /Sn /Ss+
MAKE_SHARED = ilink /nofree
MAKE_SHARED_C = ilink /nofree
EXTRA_LINK_OPTIONS = /map /nod /noe /noi /packcode /packdata /exepack /align:4
SHLIBSUFFIX= .dll
ifneq (${DEBUG}, 1)
XML_BUILD_OPTIONS = -2
endif
endif


#================= HP SPECIFIC OPTIONS ===========================
ifeq (${PLATFORM}, HPUX)
  ifeq (${COMPILER}, aCC)
    PLATFORM_CPP_COMPILER = aCC
    PLATFORM_C_COMPILER = aCC
    PLATFORM_LIBRARIES=-L/opt/aCC/lib -L/usr/ccs/lib
    PLATFORM_COMPILE_OPTIONS = $(COMPILESWITCH) -D_HP_UX -DHPaCC 
-D_PTHREADS_DRAFT4 \
        +DAportable -w +z +inst_compiletime
    MAKE_SHARED = ${PLATFORM_CPP_COMPILER} -D${PLATFORM} -b
    MAKE_SHARED_C = ${PLATFORM_C_COMPILER} -D${PLATFORM} -b
    EXTRA_LINK_OPTIONS = -lcma -lCsup -lstream
    SHLIBSUFFIX=.sl
  else
    ifneq (${DEBUG}, 1)
      XML_BUILD_OPTIONS = -w +O1
    endif
    PLATFORM_CPP_COMPILER = CC
    PLATFORM_C_COMPILER = cc
    PLATFORM_LIBRARIES= -L${ICUROOT}/lib -L/opt/CC/lib -L/usr/lib
    TEMPLATESREPOSITORY = ${ALL_OBJECTS_DIR}/ptrepository
    COMMON_COMPILE_OPTIONS = $(COMPILESWITCH) -D_HP_UX -DXML4C2_TMPLSINC \
        -D_PTHREADS_DRAFT4 +DAportable -w +eh +z -z +a1
    ifeq ($(MODULE), dom)
      PLATFORM_COMPILE_OPTIONS  = -DDOM_PROJ $(COMMON_COMPILE_OPTIONS)
    else
      PLATFORM_COMPILE_OPTIONS  = $(COMMON_COMPILE_OPTIONS) 
-ptr${TEMPLATESREPOSITORY}
    endif
    ALLINCLUDES=-I$(XML4CROOT)/src/com/ibm/xml -I$(XML4CROOT)/src 
-I$(ICUROOT)/include
    MAKE_SHARED = $(PLATFORM_CPP_COMPILER) $(PLATFORM_COMPILE_OPTIONS) 
$(ALLINCLUDES)
    MAKE_SHARED_C = $(PLATFORM_C_COMPILER) $(PLATFORM_COMPILE_OPTIONS) 
$(ALLINCLUDES)
    ALLLIBS = -licu-uc -lcma -lm
    EXTRA_LINK_OPTIONS = -b -Wl,+s -Wl,-a,shared
    SHLIBSUFFIX=.sl
  endif
endif

#================ OS/390 SPECIFIC OPTIONS =========================
ifeq (${PLATFORM}, OS390)
PLATFORM_CPP_COMPILER = _CXX_CXXSUFFIX="cpp" _CXX_STEPS="-1" c++
PLATFORM_C_COMPILER = _CXX_CXXSUFFIX="cpp" _CXX_STEPS="-1" cc
PLATFORM_LIBRARIES=
PLATFORM_COMPILE_OPTIONS =-Wc,dll,expo -W0,"langlvl(extended)" -D${PLATFORM} 
-D_OPEN_THREADS -D_XOPEN_SOURCE_EXTENDED
MAKE_SHARED = ${PLATFORM_CPP_COMPILER} -D${PLATFORM} -W l,dll
MAKE_SHARED_C = ${PLATFORM_C_COMPILER} -D${PLATFORM} -W l,dll
ALLLIBS = ${ICUROOT}/source/common/libicu-uc.x
EXTRA_LINK_OPTIONS =
SHLIBSUFFIX=.dll
OS390SIDEDECK=.x
ifneq (${DEBUG}, 1)
  XML_BUILD_OPTIONS = -2
endif
endif

###################### STANDARD TOOLS #############################
CP = -cp -fp
RM = -rm -f
CAT = cat
AR = ar -cqv
CD = cd
CC1 = ${PLATFORM_CPP_COMPILER} ${PLATFORM_COMPILE_OPTIONS}
JUST_CC = ${PLATFORM_C_COMPILER} -D${PLATFORM}
ECHO = echo
CREATE_DEPENDS_FILE = echo "" > depends
MAKE_DEPEND = ${CC1} -E -xM

########################## DIRECTORIES ############################
XML_LIB_DIR = $(XML4CROOT)/lib
XML_INC_DIR = $(XML4CROOT)/include
INTL_INC_DIR1 = $(ICUROOT)/include
# INTL_INC_DIR2 = $(ICUROOT)/source/common  # not used any more

#################### COMPILE/LINK FLAGS ###########################
XML_INCL = -I. -I$(XML_INC_DIR) -I$(INTL_INC_DIR1)

##################### HELPER MACROS ###############################
DEPFILE = depends
LINKLIB = $(XML_LIB_DIR)

######################### SUFFIX RULES ############################
.SUFFIXES:
.SUFFIXES: .cpp .c .o

.cpp.o:
        $(CC1) -c $(XML_BUILD_OPTIONS) $(XML_DEF) $(XML_INCL) 
$(EXTRA_COMPILE_OPTIONS) -o $(@) $(<)
        $(CC1) -c $(XML_BUILD_OPTIONS) $(XML_DEF) $(XML_INCL) 
$(EXTRA_COMPILE_OPTIONS) -o $(OBJ_OUT)$(@) $(<)

.c.o:
        $(JUST_CC) -c $(XML_BUILD_OPTIONS) $(XML_DEF) $(XML_INCL) 
$(EXTRA_COMPILE_OPTIONS) -o $(@) $(<)

        $(JUST_CC) -c $(XML_BUILD_OPTIONS) $(XML_DEF) $(XML_INCL) 
$(EXTRA_COMPILE_OPTIONS) -o $(OBJ_OUT)$(@) $(<)
#!/bin/sh

# runConfigure : This script will run the "configure" script for the 
appropriate platform
# Only supported platforms are recognized

usage()
{
    echo "runConfigure: Helper script to run \"configure\" for one of the 
supported platforms"
    echo "Usage: runConfigure \"<platform_name>\""
    echo "       where <platform_name> is the platform and compiler combination 
you want"
    echo "       valid choices are :"
    echo "          0. 'IRIX' if you are using native CC compiler on SGI IRIX"
    echo "          1. 'AIXxlC' if you are using xlC on AIX"
    echo "          2. 'SOLARISCC' if you are using native CC compiler on 
Solaris"
    echo "          3. 'SOLARISGCC' if you are using GNU C++ compiler on 
Solaris"
    echo "          4. 'LINUXGCC' if you are using GNU C++ compiler on Linux"
    echo "          5. 'HPCC' if you are using native C++ compiler on HP-UX"
    echo "          6. 'HPACC' if you are using Advanced C++ compiler on HP-UX"
}

if test ${1}o = "o"; then
   usage
   exit 0
fi

if test ${XML4CROOT}o = "o"; then
   echo ERROR : You have not set your XML4CROOT environment variable
   echo Though this environment variable has nothing to do with creating 
makefiles,
   echo this is just a general warning to prevent you from pitfalls in future. 
Please
   echo set an environment variable called XML4CROOT to indicate where you 
installed
   echo the XML4C files, and run this command again to proceed. See the 
documentation
   echo for an example if you are still confused.
   exit 0
fi

if test $1 = "-h"; then
   usage
   exit 0
fi

platform=${1};
rm -f config.cache
rm -f config.log
rm -f config.status

case $platform in
        IRIX)
                echo Running configure for SGI IRIX using native CC compiler ...
                CPP=CC; export CPP
                CC=cc; export CC
                CPPFLAGS="-mips4 -LANG:pch -LANG:std -O2"; export CPPFLAGS
                CXX=CC; export CXX
                CFLAGS="-mips4 -O2"; export CFLAGS
                CXXFLAGS="-mips4 -LANG:pch -O2"; export CXXFLAGS
                LDFLAGS="-lC"; export LDFLAGS
                LIBS=""; export LIBS
                ./configure;;
        AIXxlC)
                echo Running configure for AIX using xlC compiler ...
                CPP=xlC_r; export CPP
                CC=xlc_r; export CC
                CPPFLAGS="-w -O"; export CPPFLAGS
                CXX=xlC_r; export CXX
                CFLAGS="-w -O"; export CFLAGS
                CXXFLAGS="-w -O"; export CXXFLAGS
                LDFLAGS="-lC"; export LDFLAGS
                LIBS="-L/usr/lpp/xlC/lib"; export LIBS
                ./configure;;
        SOLARISCC)
                echo Running configure for SOLARIS using native CC compiler ...
                CPP=CC; export CPP
                CC=cc; export CC
                CPPFLAGS="-w -O"; export CPPFLAGS
                CXX=CC; export CXX
                CFLAGS="-w -O"; export CFLAGS
                CXXFLAGS="-w -O"; export CXXFLAGS
                LDFLAGS="-lC"; export LDFLAGS
                LIBS="-L/usr/lib -L/usr/ccs/lib"; export LIBS
                ./configure;;
        SOLARISGCC)
                echo Running configure for Solaris using gcc compiler ...
                CPP=g++; export CPP
                CC=gcc; export CC
                CPPFLAGS="-w -O"; export CPPFLAGS
                CXX=g++; export CXX
                CFLAGS="-w -O"; export CFLAGS
                CXXFLAGS="-w -O"; export CXXFLAGS
                LDFLAGS="-lc"; export LDFLAGS
                LIBS="-L/usr/local/lib"; export LIBS
                ./configure;;
        LINUXGCC)
                echo Running configure for Linux using gcc compiler ...
                CPP=g++; export CPP
                CC=gcc; export CC
                CPPFLAGS="-w -O"; export CPPFLAGS
                CXX=g++; export CXX
                CFLAGS="-w -O"; export CFLAGS
                CXXFLAGS="-w -O"; export CXXFLAGS
                LDFLAGS="-lc"; export LDFLAGS
                LIBS="-L/usr/local/lib"; export LIBS
                ./configure;; 
        HPCC)
                echo Running configure for HP using native CC compiler ...
                CPP=CC; export CPP
                CC=cc; export CC
                CPPFLAGS="-w -O"; export CPPFLAGS
                CXX=CC CFLAGS="-w -O"; export CXX
                CXXFLAGS="-w -O"; export CXXFLAGS
                LDFLAGS="-lC"; export LDFLAGS
                LIBS="-L/usr/lib"; export LIBS
                ./configure;;
        HPACC)
                echo Running configure for HP using aCC compiler ...
                CPP=aCC; export CPP
                CC=aCC; export CC
                CPPFLAGS="-w -O"; export CPPFLAGS
                CXX=aCC; export CXX
                CFLAGS="-w -O"; export CFLAGS
                CXXFLAGS="-w -O"; export CXXFLAGS
                LDFLAGS="-lC"; export LDFLAGS
                LIBS="-L/usr/lib -L/opt/aCC/lib"; export LIBS
                ./configure;;
        *)
                echo I do not recognize the option \"$platform\". Please type 
${0} -h for help.
                exit 0;;
esac

echo
echo If the result of the above commands look OK to you, go to the directory
echo ${XML4CROOT}/src and type \"make\" to make the XML4C system.
/*
 * (C) Copyright IBM Corp. 1999  All rights reserved.
 *
 * US Government Users Restricted Rights Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 * The program is provided "as is" without any warranty express or
 * implied, including the warranty of non-infringement and the implied
 * warranties of merchantibility and fitness for a particular purpose.
 * IBM will not be liable for any damages suffered by you as a result
 * of using the Program. In no event will IBM be liable for any
 * special, indirect or consequential damages or lost profits even if
 * IBM has been advised of the possibility of their occurrence. IBM
 * will not be liable for any third party claims against you.
 */

/**
 * @version Revision: 09 1.15 src/com/ibm/xml/util/AutoSense.hpp, xml4c2Utils, 
xml4c2, xml4c2_3_1 
 */

#ifndef AUTOSENSE_HPP
#define AUTOSENSE_HPP

// ---------------------------------------------------------------------------
//  This section attempts to auto detect the operating system. It will set
//  up XML4C2 specific defines that are used by the rest of the code.
// ---------------------------------------------------------------------------
#if defined(IRIX)
    #define XML_IRIX
    #define XML_UNIX
#elif defined(_AIX) \
    #define XML_AIX
    #define XML_UNIX
#elif defined(_HP_UX) \
||  defined(__hpux) \
||  defined(_HPUX_SOURCE)
    #define XML_HPUX
    #define XML_UNIX
#elif defined(SOLARIS) || defined(__SVR4)
    #define XML_SOLARIS
    #define XML_UNIX
#elif defined(__linux__)
    #define XML_LINUX
    #define XML_UNIX
#elif defined(__MVS__)
    #define XML_OS390
    #define XML_UNIX
#elif defined(AS400)
    #define XML_AS400
    #define XML_UNIX
#elif defined(__OS2__)
    #define XML_OS2
#elif defined(__TANDEM)
    #define XML_TANDEM
    #define XML_UNIX
    #define XML_CSET
#elif defined(_WIN32) \
|| defined(WIN32)
    #define XML_WIN32
    #ifndef WIN32
      #define WIN32
    #endif
#elif defined(__WINDOWS__)

    // IBM VisualAge special handling
    #if defined(__32BIT__)
    #define XML_WIN32
    #else
    #define XML_WIN16
    #endif
    #elif defined(__MSDXML__)
    #define XML_DOS

#elif defined(macintosh)
    #define XML_MACOS
#else
    #error Code requires port to host OS!
#endif


// ---------------------------------------------------------------------------
//  This section attempts to autodetect the compiler being used. It will set
//  up XML4C2 specific defines that can be used by the rest of the code.
// ---------------------------------------------------------------------------
#if defined(XML_IRIX)
    #define XML_MIPSPRO_CC
#elif defined(_MSC_VER)
    #define XML_VISUALCPP
#elif defined(__BORLANDC__)
    #define XML_BORLAND
#elif defined(__xlC__)
    #define XML_CSET
#elif defined(XML_SOLARIS)
    #if defined(__SUNPRO_CC)
        #define XML_SUNCC
    #elif defined(_EDG_RUNTIME_USES_NAMESPACES)
        #define XML_SOLARIS_KAICC
    #endif
#elif defined(__GNUG__)
    #define XML_GNUG
#elif defined(XML_HPUX)
    #if defined(EXM_HPUX)
        #define XML_HPUX_KAICC
    #elif (__cplusplus == 1)
        #define XML_HPUX_CC
    #elif (__cplusplus == 199707 || __cplusplus == 199711)
        #define XML_HPUX_aCC
    #endif
#elif defined(XML_TANDEM)
    #define XML_TANDEMCC
#elif defined(__linux__)
    #define XML_GCC
#elif defined(__MVS__) && defined(__cplusplus)
    #define XML_MVSCPP
#elif defined(__IBMCPP__)
    #if defined(XML_WIN32)
        #define XML_IBMVAW32
    #elif defined(XML_OS2)
        #define XML_IBMVAOS2
    #endif
#elif defined(__IBMC__)
    #if defined(XML_WIN32)
        #define XML_IBMVAW32
    #elif defined(XML_OS2)
        #define XML_IBMVAOS2
    #endif
#elif defined(__MWERKS__)
    #define XML_METROWERKS
#else
    #error Code requires port to current development environment
#endif


#endif // AUTOSENSE_HPP
/*
 * (C) Copyright IBM Corp. 1999  All rights reserved.
 *
 * US Government Users Restricted Rights Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 * The program is provided "as is" without any warranty express or
 * implied, including the warranty of non-infringement and the implied
 * warranties of merchantibility and fitness for a particular purpose.
 * IBM will not be liable for any damages suffered by you as a result
 * of using the Program. In no event will IBM be liable for any
 * special, indirect or consequential damages or lost profits even if
 * IBM has been advised of the possibility of their occurrence. IBM
 * will not be liable for any third party claims against you.
 */

/**
 * @version Revision: 91 1.5 src/com/ibm/xml/util/AIXDefs.hpp, xml4c2Utils, 
xml4c2, xml4c2_3_1 
 */


// ---------------------------------------------------------------------------
//  IRIX runs in big endian mode
// ---------------------------------------------------------------------------
#define ENDIANMODE_BIG
typedef void* FileHandle;

/*
 * (C) Copyright IBM Corp. 1999  All rights reserved.
 *
 * US Government Users Restricted Rights Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 * The program is provided "as is" without any warranty express or
 * implied, including the warranty of non-infringement and the implied
 * warranties of merchantibility and fitness for a particular purpose.
 * IBM will not be liable for any damages suffered by you as a result
 * of using the Program. In no event will IBM be liable for any
 * special, indirect or consequential damages or lost profits even if
 * IBM has been advised of the possibility of their occurrence. IBM
 * will not be liable for any third party claims against you.
 */

/**
 *  @version Revision: 20 1.7 src/com/ibm/xml/util/LinuxPlatformUtils.cpp, 
xml4c2Utils, xml4c2, xml4c2_3_1 
 */


// ---------------------------------------------------------------------------
//  Includes
// ---------------------------------------------------------------------------

#ifndef APP_NO_THREADS
#include    <pthread.h>
#endif

#include    <unistd.h>
#include    <stdio.h>
#include    <stdlib.h>
#include    <errno.h>
#include    <libgen.h>
#include    <sys/timeb.h>
#include    <string.h>
#include    <util/PlatformUtils.hpp>
#include    <util/RuntimeException.hpp>
#include    <util/Janitor.hpp>
#include    <util/Mutexes.hpp>


// ---------------------------------------------------------------------------
//  Local Methods
// ---------------------------------------------------------------------------

static void WriteCharStr( FILE* stream, const char* const toWrite)
{
    if (fputs(toWrite, stream) == EOF)
    {
        throw XMLPlatformUtilsException("Could not write to standard out/err");
    }
}

static void WriteUStrStdErr( const XMLCh* const toWrite)
{
    char* tmpVal = XMLString::transcode(toWrite);
    ArrayJanitor<char> janText(tmpVal);
    if (fputs(tmpVal, stderr) == EOF)
    {
        throw XMLPlatformUtilsException("Could not write to standard error 
file");
    }
}

static void WriteUStrStdOut( const XMLCh* const toWrite)
{
    char* tmpVal = XMLString::transcode(toWrite);
    ArrayJanitor<char> janText(tmpVal);
    if (fputs(tmpVal, stdout) == EOF)
    {
        throw XMLPlatformUtilsException("Could not write to standard out file");
    }
}


// ---------------------------------------------------------------------------
//  XMLPlatformUtils: Platform init method
// ---------------------------------------------------------------------------
static XMLMutex atomicOpsMutex;

void XMLPlatformUtils::platformInit()
{
    //
    // The atomicOps mutex needs to be created early.
    // Normally, mutexes are created on first use, but there is a
    // circular dependency between compareAndExchange() and
    // mutex creation that must be broken.
    atomicOpsMutex.fHandle = XMLPlatformUtils::makeMutex();
}


void XMLPlatformUtils::setupIntlPath()
{
    //
    //  We need to figure out the path to the Intl classes. They will be
    //  in the .\Intl subdirectory under this DLL.
    //

    static const char * xml4cIntlDirEnvVar = "ICU_DATA";
    static const char * sharedLibEnvVar    = "LD_LIBRARY_PATH";

    char* envVal = getenv(xml4cIntlDirEnvVar);
    //check if environment variable is set
    if (envVal != NULL)
    {
        // Store this string in the static member
        unsigned int pathLen = strlen(envVal);
        fgIntlPath = new char[pathLen + 2];

        strcpy((char *) fgIntlPath, envVal);
        if (envVal[pathLen - 1] != '/')
        {
            strcat((char *) fgIntlPath, "/");
        }
        return;
    }

    //
    //  If we did not find the environment var, so lets try to go the auto
    //  search route.
    //

    char libName[256];
    strcpy(libName, XML4C2_DLLName);
    strcat(libName, gXML4C2VersionStr);
    strcat(libName, ".so");

    char* libEnvVar = getenv(sharedLibEnvVar);
    char* libPath = NULL;

    if (libEnvVar == NULL)
    {
        fprintf(stderr,
                "Error: Could not locate i18n converter files.\n");
        fprintf(stderr,
                "Environment variable '%s' is not defined.\n", sharedLibEnvVar);
        fprintf(stderr,
                "Environment variable 'ICU_DATA' is also not defined.\n");
        exit(-1);
    }

    //
    // Its necessary to create a copy because strtok() modifies the
    // string as it returns tokens. We don't want to modify the string
    // returned to by getenv().
    //

    libPath = new char[strlen(libEnvVar) + 1];
    strcpy(libPath, libEnvVar);

    //First do the searching process for the first directory listing
    //
    char*  allPaths = libPath;
    char*  libPathName;

    while ((libPathName = strtok(allPaths, ":")) != NULL)
    {
        FILE*  dummyFptr = 0;
        allPaths = 0;

        char* libfile = new char[strlen(libPathName) + strlen(libName) + 2];
        strcpy(libfile, libPathName);
        strcat(libfile, "/");
        strcat(libfile, libName);

        dummyFptr = (FILE *) fopen(libfile, "rb");
        delete [] libfile;
        if (dummyFptr != NULL)
        {
            fclose(dummyFptr);
            fgIntlPath =
              new char[strlen(libPathName)+ strlen("/icu/data/")+1];
            strcpy((char *) fgIntlPath, libPathName);
            strcat((char *) fgIntlPath, "/icu/data/");
            break;
        }

    } // while

    delete libPath;

    if (fgIntlPath == NULL)
    {
        fprintf(stderr,
        "Could not find %s in %s for auto locating the converter files.\n",
                libName, sharedLibEnvVar);
        fprintf(stderr,
                "And the environment variable 'ICU_DATA' not defined.\n");
        exit(-1);
    }
}

// ---------------------------------------------------------------------------
//  XMLPlatformUtils: File Methods
// ---------------------------------------------------------------------------
unsigned int XMLPlatformUtils::curFilePos(FileHandle theFile)
{
    // Get the current position
    int curPos = ftell( (FILE*)theFile);
    if (curPos == -1)
        throw XMLPlatformUtilsException("XMLPlatformUtils::curFilePos - Could 
not get current pos");

    return (unsigned int)curPos;
}

void XMLPlatformUtils::closeFile(FileHandle theFile)
{
    if (fclose((FILE*)theFile))
        throw XMLPlatformUtilsException("XMLPlatformUtils::closeFile - Could 
not close the file handle");
}

unsigned int XMLPlatformUtils::fileSize(FileHandle theFile)
{
    // Get the current position
    long  int curPos = ftell((FILE*)theFile);
    if (curPos == -1)
        throw XMLPlatformUtilsException("XMLPlatformUtils::fileSize - Could not 
get current pos");

    // Seek to the end and save that value for return
     if (fseek( (FILE*)theFile, 0, SEEK_END) )
        throw XMLPlatformUtilsException("XMLPlatformUtils::fileSize - Could not 
seek to end");

    long int retVal = ftell( (FILE*)theFile);
    if (retVal == -1)
        throw XMLPlatformUtilsException("XMLPlatformUtils::fileSize - Could not 
get the file size");

    // And put the pointer back
    if (fseek( (FILE*)theFile, curPos, SEEK_SET) )
        throw XMLPlatformUtilsException("XMLPlatformUtils::fileSize - Could not 
seek back to original pos");

    return (unsigned int)retVal;
}

FileHandle XMLPlatformUtils::openFile(const unsigned short* const fileName)
{
    const char* tmpFileName = XMLString::transcode(fileName);
    ArrayJanitor<char> janText((char*)tmpFileName);
    FileHandle retVal = (FILE*)fopen( tmpFileName , "rb" );

    if (retVal == NULL)
        return 0;
    return retVal;
}

unsigned int
XMLPlatformUtils::readFileBuffer(  FileHandle      theFile
                                , const unsigned int    toRead
                                , XMLByte* const  toFill)
{
    size_t noOfItemsRead = fread( (void*) toFill, 1, toRead, (FILE*)theFile);

    if(ferror((FILE*)theFile))
    {
        throw XMLPlatformUtilsException("XMLPlatformUtils::readFileBuffer - 
Read failed");
    }

    return (unsigned int)noOfItemsRead;
}


void XMLPlatformUtils::resetFile(FileHandle theFile)
{
    // Seek to the start of the file
    if (fseek((FILE*)theFile, 0, SEEK_SET) )
        throw XMLPlatformUtilsException("XMLPlatformUtils::resetFile - Could 
not seek to beginning");
}



// ---------------------------------------------------------------------------
//  XMLPlatformUtils: Timing Methods
// ---------------------------------------------------------------------------

unsigned long XMLPlatformUtils::getCurrentMillis()
{
    timeb aTime;
    ftime(&aTime);
    return (unsigned long)(aTime.time*1000 + aTime.millitm);

}



XMLCh* XMLPlatformUtils::getBasePath(const XMLCh* const srcPath)
{

    //
    //  NOTE: THe path provided has always already been opened successfully,
    //  so we know that its not some pathological freaky path. It comes in
    //  in native format, and goes out as Unicode always
    //
    char* newSrc = XMLString::transcode(srcPath);
    ArrayJanitor<char> janText(newSrc);

    // Use a local buffer that is big enough for the largest legal path
     char* tmpPath = dirname((char*)newSrc);
    if (!tmpPath)
    {
        throw XMLPlatformUtilsException("XMLPlatformUtils::resetFile - Could 
not get the base path name");
    }

    char* newXMLString = new char [strlen(tmpPath) +2];
    ArrayJanitor<char> newJanitor(newXMLString);
    strcpy(newXMLString, tmpPath);
        strcat(newXMLString , "/");
    // Return a copy of the path, in Unicode format
    return XMLString::transcode(newXMLString);
}
bool XMLPlatformUtils::isRelative(const XMLCh* const toCheck)
{
    // Check for pathological case of empty path
    if (!toCheck[0])
        return false;

    //
    //  If it starts with a slash, then it cannot be relative. This covers
    //  both something like "\Test\File.xml" and an NT Lan type remote path
    //  that starts with a node like "\\MyNode\Test\File.xml".
    //
    if (toCheck[0] == XMLCh('/'))
        return false;

    // Else assume its a relative path
    return true;
}

// -----------------------------------------------------------------------
//  Standard out/error support
// -----------------------------------------------------------------------

void XMLPlatformUtils::writeToStdErr(const char* const toWrite)
{
    WriteCharStr(stderr, toWrite);
}
void XMLPlatformUtils::writeToStdErr(const XMLCh* const toWrite)
{
    WriteUStrStdErr(toWrite);
}
void XMLPlatformUtils::writeToStdOut(const XMLCh* const toWrite)
{
    WriteUStrStdOut(toWrite);
}
void XMLPlatformUtils::writeToStdOut(const char* const toWrite)
{
    WriteCharStr(stdout, toWrite);
}


// -----------------------------------------------------------------------
//  Mutex methods
// -----------------------------------------------------------------------

#ifndef APP_NO_THREADS
void XMLPlatformUtils::closeMutex(void* const mtxHandle)
{
    if (mtxHandle == NULL)
        return;
    if (pthread_mutex_destroy( (pthread_mutex_t*)mtxHandle))
    {
        throw XMLPlatformUtilsException("Could not destroy a mutex");
    }
    if ((pthread_mutex_t*)mtxHandle)
        delete mtxHandle;
}
void XMLPlatformUtils::lockMutex(void* const mtxHandle)
{
    if (mtxHandle == NULL)
        return;
    if (pthread_mutex_lock( (pthread_mutex_t*)mtxHandle))
    {
        throw XMLPlatformUtilsException("Could not lock a mutex");
    }
}
void* XMLPlatformUtils::makeMutex()
{
    pthread_mutex_t* mutex = new pthread_mutex_t;

    if (pthread_mutex_init(mutex, NULL))
    {
        throw XMLPlatformUtilsException("Could not create a mutex");
    }
    return (void*)(mutex);
}
void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
{
    if (mtxHandle == NULL)
        return;
    if (pthread_mutex_unlock( (pthread_mutex_t*)mtxHandle))
    {
        throw XMLPlatformUtilsException("Could not unlock a mutex");
    }
}

#else // #ifndef APP_NO_THREADS

void XMLPlatformUtils::closeMutex(void* const mtxHandle)
{
}

void XMLPlatformUtils::lockMutex(void* const mtxHandle)
{
}

void* XMLPlatformUtils::makeMutex()
{
        return 0;
}

void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
{
}

#endif // APP_NO_THREADS

// -----------------------------------------------------------------------
//  Miscellaneous synchronization methods
// -----------------------------------------------------------------------


void* XMLPlatformUtils::compareAndSwap ( void**      toFill ,
                    const void* const newValue ,
                    const void* const toCompare)
{
    XMLMutexLock  localLock(&atomicOpsMutex);
    void *retVal = *toFill;
    if (*toFill == toCompare)
              *toFill = (void *)newValue;
    return retVal;
}

int XMLPlatformUtils::atomicIncrement(int &location)
{
    XMLMutexLock localLock(&atomicOpsMutex);
    return ++location;
}
int XMLPlatformUtils::atomicDecrement(int &location)
{
    XMLMutexLock localLock(&atomicOpsMutex);
    return --location;
}

FileHandle XMLPlatformUtils::openStdInHandle()
{
        return (FileHandle)fdopen(dup(0), "rb");
}

/*
 * (C) Copyright IBM Corp. 1999  All rights reserved.
 *
 * US Government Users Restricted Rights Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 * The program is provided "as is" without any warranty express or
 * implied, including the warranty of non-infringement and the implied
 * warranties of merchantibility and fitness for a particular purpose.
 * IBM will not be liable for any damages suffered by you as a result
 * of using the Program. In no event will IBM be liable for any
 * special, indirect or consequential damages or lost profits even if
 * IBM has been advised of the possibility of their occurrence. IBM
 * will not be liable for any third party claims against you.
 */

/**
 * @version Revision: 35 1.3 src/com/ibm/xml/util/CSetDefs.cpp, xml4c2Utils, 
xml4c2, xml4c2_3_1 
 */


// ---------------------------------------------------------------------------
//  Includes
// ---------------------------------------------------------------------------
#include <strings.h>


int stricmp(const char* const str1, const char* const  str2) 
{
        return strcasecmp(str1, str2);
}

int strnicmp(const char* const str1, const char* const  str2, const unsigned 
int count)
{
        if (count == 0)
                return 0;

        return strncasecmp( str1, str2, (size_t)count);
}
/*
 * (C) Copyright IBM Corp. 1999  All rights reserved.
 *
 * US Government Users Restricted Rights Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 * The program is provided "as is" without any warranty express or
 * implied, including the warranty of non-infringement and the implied
 * warranties of merchantibility and fitness for a particular purpose.
 * IBM will not be liable for any damages suffered by you as a result
 * of using the Program. In no event will IBM be liable for any
 * special, indirect or consequential damages or lost profits even if
 * IBM has been advised of the possibility of their occurrence. IBM
 * will not be liable for any third party claims against you.
 */

/**
 * @version Revision: 96 1.10 src/com/ibm/xml/util/CSetDefs.hpp, xml4c2Utils, 
xml4c2, xml4c2_3_1 
 */


// ---------------------------------------------------------------------------
// Define these away for this platform
// ---------------------------------------------------------------------------
#define PLATFORM_EXPORT
#define PLATFORM_IMPORT


// ---------------------------------------------------------------------------
//  Define our version of the XML character
// ---------------------------------------------------------------------------
typedef unsigned short XMLCh;


// ---------------------------------------------------------------------------
//  Force on the XML4C2 debug token if it was on in the build environment
// ---------------------------------------------------------------------------
#if 0
#define XML4C2_DEBUG
#endif

int stricmp(const char* const str1, const char* const  str2);
int strnicmp(const char* const str1, const char* const  str2, const unsigned 
int count);

// ---------------------------------------------------------------------------
//  The name of the DSO that is built by the MIPSpro C++ version of the
//  system. We append a previously defined token which holds the DSO
//  versioning string. This is defined in XML4CDefs.hpp which is what this
//  file is included into.
// ---------------------------------------------------------------------------
const char* const XML4C2_DLLName = "libIXXML4C";
# Generated automatically from Makefile.in by configure.
#
# (C) Copyright IBM Corp. 1997-1999  All rights reserved.
#
# US Government Users Restricted Rights Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
# The program is provided "as is" without any warranty express or
# implied, including the warranty of non-infringement and the implied
# warranties of merchantibility and fitness for a particular purpose.
# IBM will not be liable for any damages suffered by you as a result
# of using the Program. In no event will IBM be liable for any
# special, indirect or consequential damages or lost profits even if
# IBM has been advised of the possibility of their occurrence. IBM
# will not be liable for any third party claims against you.
#
# Revision: 44 1.12 src/com/ibm/xml/util/Makefile.in, xml4c2Build, xml4c2, 
xml4c2_3_1 
#

PLATFORM = IRIX
COMPILER = CC
PREFIX = /usr/local

include ../../../../Makefile.incl

MODULE = util


ifeq ($(PLATFORM),IRIX)
PLATFORM_DEPEND_OBJECTS = IRIXPlatformUtils.o MIPSproDefs.o
endif
ifeq ($(PLATFORM),SOLARIS)
PLATFORM_DEPEND_OBJECTS = SUNPlatformUtils.o SunCCDefs.o
endif
ifeq ($(PLATFORM),AIX)
PLATFORM_DEPEND_OBJECTS = AIXPlatformUtils.o CSetDefs.o
endif
ifeq ($(PLATFORM),LINUX)
PLATFORM_DEPEND_OBJECTS = LinuxPlatformUtils.o GCCDefs.o
endif
ifeq ($(PLATFORM),HPUX)
PLATFORM_DEPEND_OBJECTS = HPPlatformUtils.o HPCCDefs.o
endif
ifeq ($(PLATFORM),OS390)
PLATFORM_DEPEND_OBJECTS = OS390PlatformUtils.o MVSCPPDefs.o
endif

UTIL_CPP_PUBHEADERS = \
        AIXDefs.hpp \
        HPUXDefs.hpp \
        HPCCDefs.hpp \
        IRIXDefs.hpp \
        SunCCDefs.hpp \
        LinuxDefs.hpp \
        GCCDefs.hpp \
        GNUGDefs.hpp \
        MVSCPPDefs.hpp \
        ArrayIndexOutOfBoundsException.hpp \
        AutoSense.hpp \
        BinFileInputStream.hpp \
        BinInputStream.hpp \
        BinMemInputStream.hpp \
        BitOps.hpp \
        BitSet.hpp \
        BorlandCDefs.hpp \
        CSetDefs.hpp \
        CountedPointer.hpp \
        EmptyStackException.hpp \
        Enumerator.hpp \
        Exception.hpp \
        FlagJanitor.hpp \
        IOException.hpp \
        IllegalArgumentException.hpp \
        InvalidCastException.hpp \
        Janitor.hpp \
        KeyValuePair.hpp \
        Mutexes.hpp \
        NoSuchElementException.hpp \
        NullPointerException.hpp \
        OS390Defs.hpp \
        PlatformUtils.hpp \
        RefArrayOf.hpp \
        RefHashTableOf.hpp \
        RefStackOf.hpp \
        RefVectorOf.hpp \
        RuntimeException.hpp \
        SolarisDefs.hpp \
        StdOut.hpp \
        String.hpp \
        SunCCDefs.hpp \
        TextOutputStream.hpp \
        TranscodingException.hpp \
        URL.hpp \
        UTFDataFormatException.hpp \
        UnexpectedEOFException.hpp \
        UnsupportedEncodingException.hpp \
        VCPPDefs.hpp \
        ValueArrayOf.hpp \
        ValueStackOf.hpp \
        ValueVectorOf.hpp \
        Win32Defs.hpp \
        XML4CDefs.hpp \
        XMLUni.hpp

UTIL_CPP_PRIVHEADERS =

C_FILES = \
        CountedPointer.c \
        FlagJanitor.c \
        Janitor.c \
        KeyValuePair.c \
        RefArrayOf.c \
        RefHashTableOf.c \
        RefStackOf.c \
        RefVectorOf.c \
        ValueArrayOf.c \
        ValueStackOf.c \
        ValueVectorOf.c


UTIL_CPP_OBJECTS = \
        BinFileInputStream.o \
        BinInputStream.o \
        BinMemInputStream.o \
        BitSet.o \
        Exception.o \
        HeaderDummy.o \
        Mutexes.o \
        PlatformUtils.o \
        StdOut.o \
        String.o \
        TextOutputStream.o \
        URL.o \
        XMLUni.o

UTIL_CPP_OBJECTS += $(PLATFORM_DEPEND_OBJECTS)

all:    includes $(UTIL_CPP_OBJECTS) publish

includes:       pubheaders $(C_FILES)

pubheaders:
        -mkdir -p $(XML_INC_DIR)/$(MODULE)
        $(CP) $(UTIL_CPP_PUBHEADERS) $(C_FILES) $(XML_INC_DIR)/$(MODULE)

publish:
        -mkdir -p ${ALL_OBJECTS_DIR}
        $(CP) $(UTIL_CPP_OBJECTS) $(ALL_OBJECTS_DIR)

# this may generate unnecessary dependencies, but it makes life easier
depend: includes
        $(MAKE_DEPEND) $(XML_INCL)  *.cpp > $(DEPFILE)

clean:
        @echo "Making clean in $(MODULE) ..."
        $(RM) $(UTIL_CPP_OBJECTS)

distclean:      clean
        $(RM) Makefile $(DEPFILE)
        @echo "Removing all $(MODULE) header files ..."
        @for file in $(UTIL_CPP_PUBHEADERS); do \
        rm -f $(XML_INC_DIR)/$(MODULE)/$$file; \
        done
        @for file in $(C_FILES); do \
        rm -f $(XML_INC_DIR)/$(MODULE)/$$file; \
        done
        @echo "Removing all $(MODULE) object files ..."
        @for file in $(UTIL_CPP_OBJECTS); do \
        rm -f $(ALL_OBJECTS_DIR)/$$file; \
        done

install:
        -mkdir -p $(PREFIX)/$(MODULE)
        $(CP) $(UTIL_CPP_PUBHEADERS) $(C_FILES) $(PREFIX)/$(MODULE)
/*
 * (C) Copyright IBM Corp. 1999  All rights reserved.
 *
 * US Government Users Restricted Rights Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 * The program is provided "as is" without any warranty express or
 * implied, including the warranty of non-infringement and the implied
 * warranties of merchantibility and fitness for a particular purpose.
 * IBM will not be liable for any damages suffered by you as a result
 * of using the Program. In no event will IBM be liable for any
 * special, indirect or consequential damages or lost profits even if
 * IBM has been advised of the possibility of their occurrence. IBM
 * will not be liable for any third party claims against you.
 */

/**
 * @version Revision: 58 1.37 src/com/ibm/xml/util/XML4CDefs.hpp, xml4c2Utils, 
xml4c2, xml4c2_3_1 
 */


#ifndef XML4CDEFS_HPP
#define XML4CDEFS_HPP


// ---------------------------------------------------------------------------
//  These are the various representations of the current version of XML4C2.
//  These are updated for every build. They must be at the top because they
//  can be used by various per-compiler headers below.
// ---------------------------------------------------------------------------
#define XML4C2_DLLVersionStr "2_3"
static const char* const    gXML4C2VersionStr = "2_3";
static const char* const    gXML4C2FullVersionStr = "2_3_1";
static const unsigned int   gXMLMajVersion = 2;
static const unsigned int   gXMLMinVersion = 3;
static const unsigned int   gXMLRevision   = 1;



// ---------------------------------------------------------------------------
//  Some general typedefs that are defined for internal flexibility.
// ---------------------------------------------------------------------------
typedef unsigned char       XMLByte;


// ---------------------------------------------------------------------------
//  Include the header that does automatic sensing of the current platform
//  and compiler.
// ---------------------------------------------------------------------------
#include    <util/AutoSense.hpp>


// ---------------------------------------------------------------------------
//  According to the platform we include a platform specific file. This guy
//  will set up any platform specific stuff, such as character mode.
// ---------------------------------------------------------------------------
#ifdef      XML_IRIX
#include    <util/IRIXDefs.hpp>
#endif

#ifdef      XML_WIN32
#include    <util/Win32Defs.hpp>
#endif

#ifdef      XML_AIX
#include    <util/AIXDefs.hpp>
#endif

#ifdef      XML_SOLARIS
#include    <util/SolarisDefs.hpp>
#endif

#ifdef      XML_HPUX
#include    <util/HPUXDefs.hpp>
#endif

#ifdef      XML_TANDEM
#include    <util/TandemDefs.hpp>
#endif

#ifdef      XML_LINUX
#include    <util/LinuxDefs.hpp>
#endif

#ifdef      XML_OS390
#include    <util/OS390Defs.hpp>
#endif


#ifdef      XML_OS2
#include    <util/OS2Defs.hpp>
#endif

#ifdef          XML_MACOS
#include        <util/MacOSDefs.hpp>
#endif


// ---------------------------------------------------------------------------
//  And now we subinclude a header according to the development environment
//  we are on. This guy defines for each platform some basic stuff that is
//  specific to the development environment.
// ---------------------------------------------------------------------------
#ifdef      XML_MIPSPRO_CC
#include    <util/MIPSproDefs.hpp>
#endif

#ifdef      XML_VISUALCPP
#include    <util/VCPPDefs.hpp>
#endif

#ifdef      XML_CSET
#include    <util/CSetDefs.hpp>
#endif

#ifdef      XML_BORLAND
#include    <util/BorlandCDefs.hpp>
#endif

#ifdef      XML_SUNCC
#include    <util/SunCCDefs.hpp>
#endif

#if defined(XML_SOLARIS_KAICC)
#include    <util/SunKaiDefs.hpp>
#endif

#ifdef      XML_GNUG
#include    <util/GNUGDefs.hpp>
#endif

#if defined(XML_HPUX_CC) || defined(XML_HPUX_aCC) || defined(XML_HPUX_KAICC)
#include    <util/HPCCDefs.hpp>
#endif

#ifdef      XML_TANDEMCC
#include    <util/TandemCCDefs.hpp>
#endif

#ifdef      XML_GCC
#include    <util/GCCDefs.hpp>
#endif

#ifdef      XML_MVSCPP
#include    <util/MVSCPPDefs.hpp>
#endif

#ifdef      XML_IBMVAW32
#include    <util/IBMVAW32Defs.hpp>
#endif

#ifdef      XML_IBMVAOS2
#include    <util/IBMVAOS2Defs.hpp>
#endif

#ifdef          XML_METROWERKS
#include        <util/CodeWarriorDefs.hpp>
#endif


// ---------------------------------------------------------------------------
//  Handle boolean. If the platform can handle booleans itself, then we
//  map our boolean type to the native type. Otherwise we create a default
//  one as an int and define const values for true and false.
//
//  This flag will be set in the per-development environment stuff above.
// ---------------------------------------------------------------------------
#ifdef  NO_NATIVE_BOOL
typedef int     bool;
const   bool    true    = 1;
const   bool    false   = 0;
#endif


// ---------------------------------------------------------------------------
//  Set up the import/export keyword  for our core projects. The
//  PLATFORM_XXXX keywords are set in the per-development environment
//  include above.
// ---------------------------------------------------------------------------
#ifdef  PROJ_XMLUTIL
#define XMLUTIL_EXPORT PLATFORM_EXPORT
#else
#define XMLUTIL_EXPORT PLATFORM_IMPORT
#endif

#ifdef  PROJ_XMLPARSER
#define XMLPARSER_EXPORT PLATFORM_EXPORT
#else
#define XMLPARSER_EXPORT PLATFORM_IMPORT
#endif

#ifdef  PROJ_SAX4C
#define SAX_EXPORT PLATFORM_EXPORT
#else
#define SAX_EXPORT PLATFORM_IMPORT
#endif

#ifdef  PROJ_DOM
#define CDOM_EXPORT PLATFORM_EXPORT
#else
#define CDOM_EXPORT PLATFORM_IMPORT
#endif

#ifdef  PROJ_PARSERS
#define PARSERS_EXPORT  PLATFORM_EXPORT
#else
#define PARSERS_EXPORT  PLATFORM_IMPORT
#endif

#endif
dnl aclocal.m4 for ICU
dnl Stephen F. Booth

dnl @TOP@

dnl ICU_CHECK_MH_FRAG
AC_DEFUN(ICU_CHECK_MH_FRAG, [
        AC_CACHE_CHECK(
                [which Makefile fragment to use],
                [icu_cv_host_frag],
                [
case "${host}" in
*-*-solaris*)   
        if test "$ac_cv_prog_gcc" = yes; then   
                icu_cv_host_frag=$srcdir/config/mh-solaris-gcc 
        else
                icu_cv_host_frag=$srcdir/config/mh-solaris 
        fi ;;
*-*-mips*)      icu_cv_host_frag=$srcdir/config/mh-irix ;;
*-*-linux*)     icu_cv_host_frag=$srcdir/config/mh-linux ;;
*-*-aix*)       icu_cv_host_frag=$srcdir/config/mh-aix ;;
*-*-hpux*)
        case "$CXX" in 
        *aCC)    icu_cv_host_frag=$srcdir/config/mh-hpux-acc ;;
        *CC)     icu_cv_host_frag=$srcdir/config/mh-hpux-cc ;;
        esac;;
*-*-os390*)     icu_cv_host_frag=$srcdir/config/mh-os390 ;;
*)              icu_cv_host_frag=$srcdir/config/mh-unknown ;;
esac
                ]
        )
])

dnl ICU_CONDITIONAL - Taken from Automake 1.4
AC_DEFUN(ICU_CONDITIONAL,
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
  $1_TRUE=
  $1_FALSE='#'
else
  $1_TRUE='#'
  $1_FALSE=
fi])
dnl -*-m4-*-
dnl configure.in for ICU
dnl Stephen F. Booth

dnl Process this file with autoconf to produce a configure script
AC_INIT(common/utypes.h)
AC_CONFIG_HEADER(common/icucfg.h)
PACKAGE="icu"
AC_SUBST(PACKAGE)
VERSION="1.2.5"
AC_SUBST(VERSION)

dnl Checks for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_CHECK_PROG(AUTOCONF, autoconf, autoconf, true)

dnl Determine the host system and Makefile fragment
AC_CANONICAL_HOST
ICU_CHECK_MH_FRAG

dnl Checks for libraries
dnl On HP/UX, don't link to -lm from a shared lib because it isn't
dnl  PIC (at least on 10.2)
case "${host}" in
        *-*-hpux*)      AC_CHECK_LIB(m, floor, LIB_M="-lm") ;;
        *)              AC_CHECK_LIB(m, floor) 
                        LIB_M="" ;;
esac
AC_SUBST(LIB_M)

dnl special pthread handling 
dnl AIX uses pthreads instead of pthread, and HP/UX uses cma
AC_CHECK_LIB(pthread, pthread_create)
if test $ac_cv_lib_pthread_pthread_create = no; then
AC_CHECK_LIB(pthreads, pthread_create)
fi
if test $ac_cv_lib_pthread_pthread_create = no; then
AC_CHECK_LIB(cma, pthread_create)
fi

dnl Checks for header files
AC_CHECK_HEADERS(inttypes.h)
if test $ac_cv_header_inttypes_h = no; then
HAVE_INTTYPES_H=0
else
HAVE_INTTYPES_H=1
fi
AC_SUBST(HAVE_INTTYPES_H)

dnl Checks for typedefs
AC_CHECK_TYPE(int8_t,signed char)
AC_CHECK_TYPE(uint8_t,unsigned char)
AC_CHECK_TYPE(int16_t,signed short)
AC_CHECK_TYPE(uint16_t,unsigned short)
AC_CHECK_TYPE(int32_t,signed long)
AC_CHECK_TYPE(uint32_t,unsigned long)
AC_CHECK_TYPE(bool_t,signed char)

if test $ac_cv_type_int8_t = no; then
HAVE_INT8_T=0
else
HAVE_INT8_T=1
fi
AC_SUBST(HAVE_INT8_T)

if test $ac_cv_type_uint8_t = no; then
HAVE_UINT8_T=0
else
HAVE_UINT8_T=1
fi
AC_SUBST(HAVE_UINT8_T)

if test $ac_cv_type_int16_t = no; then
HAVE_INT16_T=0
else
HAVE_INT16_T=1
fi
AC_SUBST(HAVE_INT16_T)

if test $ac_cv_type_uint16_t = no; then
HAVE_UINT16_T=0
else
HAVE_UINT16_T=1
fi
AC_SUBST(HAVE_UINT16_T)

if test $ac_cv_type_int32_t = no; then
HAVE_INT32_T=0
else
HAVE_INT32_T=1
fi
AC_SUBST(HAVE_INT32_T)

if test $ac_cv_type_uint32_t = no; then
HAVE_UINT32_T=0
else
HAVE_UINT32_T=1
fi
AC_SUBST(HAVE_UINT32_T)

if test $ac_cv_type_bool_t = no; then
HAVE_BOOL_T=0
else
HAVE_BOOL_T=1
fi
AC_SUBST(HAVE_BOOL_T)

dnl Enable/disable extras
AC_ARG_ENABLE(extras,
        [  --enable-extras         build ICU extras [default=yes]],
        [case "${enableval}" in
                yes) extras=true ;;
                no)  extras=false ;;
                *) AC_MSG_ERROR(bad value ${enableval} for --enable-extras) ;;
                esac], 
        extras=true)
ICU_CONDITIONAL(EXTRAS, test "$extras" = true)

dnl Enable/disable tests
AC_ARG_ENABLE(tests,
        [  --enable-tests          build ICU tests [default=yes]],
        [case "${enableval}" in
                yes) tests=true ;;
                no)  tests=false ;;
                *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
                esac], 
        tests=true)
ICU_CONDITIONAL(TESTS, test "$tests" = true)

dnl Enable/disable samples
AC_ARG_ENABLE(samples,
        [  --enable-samples        build ICU samples [default=yes]],
        [case "${enableval}" in
                yes) samples=true ;;
                no)  samples=false ;;
                *) AC_MSG_ERROR(bad value ${enableval} for --enable-samples) ;;
                esac], 
        samples=true)
ICU_CONDITIONAL(SAMPLES, test "$samples" = true)

dnl Platform-specific Makefile setup
case "${host}" in
        *-*-solaris*)   platform=SOLARIS ;;
        *-*-linux*)     platform=LINUX ;;
        *-*-aix*)       platform=AIX ;;
        *-*-hpux*)      platform=HPUX ;;
        *-*-irix*)      platform=IRIX ;;
        *-*-os390*)     platform=OS390 ;;
        *)              platform=UNKNOWN ;;
esac
AC_SUBST(platform)
host_frag=$icu_cv_host_frag
AC_SUBST_FILE(host_frag)

dnl Handle -rpath options for shared library paths
case "${host}" in
        *-*-solaris*)   ld_rpath_suf=":" ;;
        *-*-linux*)     ld_rpath_suf=" " ;;
        *-*-aix*)       ld_rpath_suf="" ;;
        *-*-hpux*)      ld_rpath_suf=":" ;;
        *-*-irix*)      ld_rpath_suf=" " ;;
        *-*-os390*)     ld_rpath_suf=" " ;;
        *)              ld_rpath_suf="" ;;
esac
AC_SUBST(ld_rpath_suf)

dnl On HP/UX, main() functions compiled in C don't invoke
dnl static constructors in C++ libs.  Hack around that here
dnl by renaming some .c files to .cpp
case "${host}" in
        *-*-hpux*)      
                for file in tools/gencol/gencol samples/date/date \
                  samples/cal/cal test/cintltst/cintltst
                do
                  if test -f $file.c; then
                    mv $file.c $file.cpp
                  fi
                done
        ;;
esac


dnl output the Makefiles
AC_OUTPUT([Makefile \
                common/Makefile common/platform.h i18n/Makefile \
                extra/Makefile extra/ustdio/Makefile \
                tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \
                tools/genrb/Makefile tools/gencol/Makefile \
                tools/rbdump/Makefile \
                test/Makefile test/intltest/Makefile test/cintltst/Makefile \
                test/ieeetest/Makefile \
                samples/Makefile samples/date/Makefile samples/cal/Makefile \
                samples/XMLConverter/Makefile])
## -*-makefile-*-
## IRIX-specific setup (for CC)


## Commands to generate dependency files
GEN_DEPS.c=     $(CC) -E -M $(DEFS) $(CPPFLAGS)
GEN_DEPS.cc=    $(CXX) -E -M $(DEFS) $(CPPFLAGS)

## Commands to compile
COMPILE.c=      $(CC) -shared $(DEFS) $(CPPFLAGS) $(CFLAGS) -c
COMPILE.cc=     $(CXX) -shared $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -c

## Commands to link
## We need to use the C++ linker, even when linking C programs, since
##  our libraries contain C++ code (C++ static init not called)
#LINK.c=        $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
LINK.c=         $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
LINK.cc=        $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)

## Commands to make a shared library
## SHLIB.c=        ${PLATFORM_CPP_COMPILER} -D${PLATFORM} -shared
## SHLIB.cc=       ${PLATFORM_C_COMPILER} -D${PLATFORM} -shared
## SHLIB.c=     ${PLATFORM_CPP_COMPILER}
## SHLIB.c=     ${PLATFORM_C_COMPILER}
SHLIB.c=        $(CC) -shared $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
SHLIB.cc=       $(CXX) -shared $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)



## Compiler switch to embed a runtime search path
LD_RPATH=       -I
LD_RPATH_PRE=

## Shared object suffix
SO=             so

## Link commands to link to ICU libs
LIBICU-UC=      -L$(top_builddir)/common -licu-uc
LIBICU-I18N=    -L$(top_builddir)/i18n -licu-i18n
LIBCTESTFW=     -L$(top_builddir)/tools/ctestfw -lctestfw

## Compilation rules
%.o : $(srcdir)/%.c
        $(COMPILE.c) -o $@ $<

%.o : $(srcdir)/%.cpp
        $(COMPILE.cc) -o $@ $<

## Dependency rules
%.d : $(srcdir)/%.c
        @echo "Generating dependency information for $<"
        @$(SHELL) -ec '$(GEN_DEPS.c) $< \
                | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
                [ -s $@ ] || rm -f $@'

%.d : $(srcdir)/%.cpp
        @echo "Generating dependency information for $<"
        @$(SHELL) -ec '$(GEN_DEPS.cc) $< \
                | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
                [ -s $@ ] || rm -f $@'

## End IRIX-specific setup

Reply via email to