You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/07/03 18:51:36 UTC
cvs commit: xml-xerces/c/src/util/Platforms/Solaris SolarisPlatformUtils.cpp
tng 01/07/03 09:51:35
Modified: c/samples Makefile.incl runConfigure
c/src Makefile.incl configure configure.in runConfigure
c/src/util/Compilers Makefile.in
c/src/util/Platforms/AIX AIXPlatformUtils.cpp
c/src/util/Platforms/Solaris SolarisPlatformUtils.cpp
Log:
Supporting dce threading on:
- AIX 4x with IBM xlC_r4 compiler
- SunOS with SUN CC compiler and Transarc DCE implementation (transarc belongs
to IBM); it seems to be the only DCE implementation for SunOS
Patch submitted by Miroslaw Dobrzanski-Neumann.
Revision Changes Path
1.32 +6 -5 xml-xerces/c/samples/Makefile.incl
Index: Makefile.incl
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/Makefile.incl,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- Makefile.incl 2001/06/25 15:59:07 1.31
+++ Makefile.incl 2001/07/03 16:50:56 1.32
@@ -54,7 +54,7 @@
# <http://www.apache.org/>.
#
#
-# $Id: Makefile.incl,v 1.31 2001/06/25 15:59:07 tng Exp $
+# $Id: Makefile.incl,v 1.32 2001/07/03 16:50:56 tng Exp $
#
################## LIBRARY NAMES AND DIRECTORIES ##################
@@ -143,10 +143,11 @@
#================= AIX SPECIFIC OPTIONS ===========================
ifeq (${PLATFORM}, AIX)
CMP= -c ${CXXFLAGS} -qnotempinc
-CC=xlC_r -D${PLATFORM}
-LINK = ${CC}
-PLATFORM_LIB_LINK_OPTIONS=-L/usr/lpp/xlC/lib
-EXTRA_LINK_OPTIONS=-lC
+CC=${COMPILER} -D${PLATFORM}
+LINK = ${COMPILER}
+# the compiler knows about this two
+# PLATFORM_LIB_LINK_OPTIONS=-L/usr/lpp/xlC/lib
+# EXTRA_LINK_OPTIONS=-lC
SHLIBSUFFIX=.a
endif
1.17 +13 -4 xml-xerces/c/samples/runConfigure
Index: runConfigure
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/runConfigure,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- runConfigure 2001/06/05 19:42:26 1.16
+++ runConfigure 2001/07/03 16:50:58 1.17
@@ -58,7 +58,7 @@
#
#
-# $Id: runConfigure,v 1.16 2001/06/05 19:42:26 jberry Exp $
+# $Id: runConfigure,v 1.17 2001/07/03 16:50:58 tng Exp $
#
#
@@ -149,6 +149,13 @@
esac
done
+if test $platform = "aix"; then
+ if test ! -n "$ccompiler" -o ! -n "$cppcompiler"; then
+ ccompiler=xlc
+ cppcompiler=xlC
+ fi
+fi
+
echo "Generating makefiles with the following options ..."
echo "Platform: $platform"
echo "C Compiler: $ccompiler"
@@ -180,9 +187,11 @@
CXX=$cppcompiler; export CXX
case $cppcompiler in
- xlC | xlc | xlC_r | xlc_r)
- LDFLAGS="-lC"; export LDFLAGS
- LIBS="-L/usr/lpp/xlC/lib"; export LIBS ;;
+ xlC* | xlc*)
+ #the compiler knows better about this stuff
+ #LDFLAGS="-lC"; export LDFLAGS
+ #LIBS="-L/usr/lpp/xlC/lib"; export LIBS
+ ;;
g++ | c++)
LDFLAGS="-lc"; export LDFLAGS
1.46 +16 -7 xml-xerces/c/src/Makefile.incl
Index: Makefile.incl
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/Makefile.incl,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- Makefile.incl 2001/06/25 16:27:01 1.45
+++ Makefile.incl 2001/07/03 16:51:06 1.46
@@ -54,7 +54,7 @@
# <http://www.apache.org/>.
#
#
-# $Id: Makefile.incl,v 1.45 2001/06/25 16:27:01 tng Exp $
+# $Id: Makefile.incl,v 1.46 2001/07/03 16:51:06 tng Exp $
#
###################################################################
@@ -122,14 +122,12 @@
else
PLATFORM_COMPILE_OPTIONS = -KPIC -mt -xs -ptr$(XML_OBJ_DIR) \
-features=rtti -D${PLATFORM} -D_REENTRANT
- MAKE_SHARED = ${CXX} -D${PLATFORM} -G -ptr$(XML_OBJ_DIR) ${LDFLAGS}
- MAKE_SHARED_C = ${CC} -D${PLATFORM} -G ${LDFLAGS}
+ MAKE_SHARED = ${CXX} -D${PLATFORM} -G -ptr$(XML_OBJ_DIR)
+ MAKE_SHARED_C = ${CC} -D${PLATFORM} -G
ifeq (${TRANSCODER}, ICU)
- ALLLIBS = -mt ${LIBS} -L/usr/local/SUNWspro/lib -L/usr/ccs/lib \
- -licuuc -licudata -lc -lgen
+ ALLLIBS = -mt -licuuc -licudata ${LIBS}
else
- ALLLIBS = -mt ${LIBS} -L/usr/local/SUNWspro/lib -L/usr/ccs/lib \
- -lc -lgen
+ ALLLIBS = -mt ${LIBS}
endif
endif
SHLIBSUFFIX=.so
@@ -202,6 +200,17 @@
PLATFORM_COMPILE_OPTIONS = -qnotempinc -D_THREAD_SAFE
MAKE_SHARED = makeC++SharedLib_r -p 5000
MAKE_SHARED_C = makeC++SharedLib_r -p 5000
+ifeq (xlC_r4,$(CXX))
+ ifeq (AIX41,$(OSVER))
+ ALLLIBS += -lC_r -lC -L/usr/lib/threads -ldcelibc_r -ldcepthreads
+ endif
+ ifeq (AIX42,$(OSVER))
+ ALLLIBS += -lC_r -lC -L/usr/lib/threads -ldcelibc_r -ldcepthreads
+ endif
+ ifeq (AIX43,$(OSVER))
+ ALLLIBS += -L/usr/lib/threads -ldcelibc_r -ldcepthreads -lpthreads_compat
+ endif
+endif
SHLIBSUFFIX=.a
endif
1.30 +7 -1 xml-xerces/c/src/configure
Index: configure
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/configure,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- configure 2001/06/27 17:08:01 1.29
+++ configure 2001/07/03 16:51:09 1.30
@@ -1303,7 +1303,13 @@
*-*-unixware*) platform=UNIXWARE ;;
*-*-linux*) platform=LINUX ;;
*-*-irix*) platform=IRIX ;;
- *-*-aix*) platform=AIX ;;
+ *-*-aix*) platform=AIX
+ case "${host}" in
+ *-*-aix4.1*) osver=AIX41;;
+ *-*-aix4.2*) osver=AIX42;;
+ *-*-aix4.3*) osver=AIX43;;
+ *-*-aix4.*) osver=AIX43;;
+ esac;;
*-sequent-*) platform=PTX ;;
*-*-hp*) platform=HPUX ;
case "${host}" in
1.26 +7 -1 xml-xerces/c/src/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/configure.in,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- configure.in 2001/06/27 17:08:03 1.25
+++ configure.in 2001/07/03 16:51:10 1.26
@@ -35,7 +35,13 @@
*-*-unixware*) platform=UNIXWARE ;;
*-*-linux*) platform=LINUX ;;
*-*-irix*) platform=IRIX ;;
- *-*-aix*) platform=AIX ;;
+ *-*-aix*) platform=AIX
+ case "${host}" in
+ *-*-aix4.1*) osver=AIX41;;
+ *-*-aix4.2*) osver=AIX42;;
+ *-*-aix4.3*) osver=AIX43;;
+ *-*-aix4.*) osver=AIX43;;
+ esac;;
*-sequent-*) platform=PTX ;;
*-*-hp*) platform=HPUX ;
case "${host}" in
1.39 +66 -12 xml-xerces/c/src/runConfigure
Index: runConfigure
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/runConfigure,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- runConfigure 2001/06/05 19:35:50 1.38
+++ runConfigure 2001/07/03 16:51:11 1.39
@@ -55,7 +55,7 @@
# <http://www.apache.org/>.
#
#
-# $Id: runConfigure,v 1.38 2001/06/05 19:35:50 jberry Exp $
+# $Id: runConfigure,v 1.39 2001/07/03 16:51:11 tng Exp $
#
#
@@ -86,7 +86,7 @@
echo " -m <message loader> can be 'inmem', 'icu', 'MsgFile' or 'iconv'"
echo " -n <net accessor> can be 'fileonly', 'libwww', 'socket' or 'native'"
echo " -t <transcoder> can be 'icu', 'Iconv400', 'Iconv390' or 'native'"
- echo " -r <thread option> can be 'pthread' or 'dce' (only used on HP-11)"
+ echo " -r <thread option> can be 'pthread' or 'dce' (only used on aix, HP-11 and solaris)"
echo " -l <extra linker options>"
echo " -z <extra compiler options>"
echo " -P <install-prefix>"
@@ -196,6 +196,16 @@
echo "Extra configure options: $configureoptions"
+if test -z "$ccompiler" -a -n "$cppcompiler"; then
+ echo "either both c/c++ compiler must be given or nothing at all"
+ exit ${ERROR_EXIT_CODE};
+fi
+if test -n "$ccompiler" -a -z "$cppcompiler"; then
+ echo "either both c/c++ compiler must be given or nothing at all"
+ exit ${ERROR_EXIT_CODE};
+fi
+
+
#
# Now check if the options are correct or not, bail out if incorrect
#
@@ -259,14 +269,42 @@
esac
fi
elif test $platform = "aix"; then
- aix_version=`./config.guess`;
+ aix_version=`sh ./config.guess`;
echo Found host system to be $aix_version
- case $aix_version in
- *4.3*)
- threadingLibs="-lpthreads_compat -lpthreads";;
- *)
- threadingLibs="-lpthreads";;
+ if test -n "$ccompiler"; then
+ if test -n "$thread"; then
+ echo "user given compiler no threadig available"
+ fi;
+ case $aix_version in
+ *4.3*)
+ threadingLibs="-lpthreads_compat -lpthreads";;
+ *)
+ threadingLibs="-lpthreads";;
+ esac
+ elif test -z "$thread"; then
+ ccompiler=xlc
+ cppcompiler=xlC
+ threadingLibs=
+ threadingDefines=
+ else
+ case $thread in
+ pthread)
+ ccompiler=xlc_r
+ cppcompiler=xlC_r
+ threadingLibs=
+ threadingDefines=
+ ;;
+ dce)
+ ccompiler=xlc_r4
+ cppcompiler=xlC_r4
+ threadingLibs=
+ threadingDefines="-DXML_USE_DCE"
+ ;;
+ *)
+ echo "I do not recognize the thread option '$thread'. Please type '${0} -h' for help."
+ exit ${ERROR_EXIT_CODE};;
esac
+ fi
elif test $platform = "ptx"; then
threadingLibs=" "
if test -z $XMLINSTALL; then
@@ -277,6 +315,19 @@
threadingDefines="-DXML_USE_DCE"
elif test $platform = "unixware"; then
threadingLibs="-lthread"
+elif test $platform = "solaris"; then
+ if test $thread; then
+ case $thread in
+ pthread)
+ ;;
+ dce)
+ threadingLibs="-ldce";
+ threadingDefines="-DXML_USE_DCE";;
+ *)
+ echo "I do not recognize the thread option '$thread'. Please type '${0} -h' for help."
+ exit ${ERROR_EXIT_CODE};;
+ esac
+ fi
fi
@@ -370,7 +421,11 @@
netaccessorDefines="-DXML_USE_NETACCESSOR_SOCKET"
case $platform in
solaris)
- netaccessorLibs="-lnsl -lsocket";;
+ netaccessorLibs="-lnsl -lsocket"
+ if test $thread = "dce"; then
+ netaccessorLibs=""
+ fi
+ ;;
*)
;;
esac;;
@@ -406,7 +461,7 @@
#
case $cppcompiler in
- xlC | xlc | xlC_r | xlc_r | g++ | c++ | cc | CC | aCC | icc | ICC | cxx)
+ xlC* | xlc* | g++ | c++ | cc | CC | aCC | icc | ICC | cxx)
;;
*)
@@ -420,7 +475,6 @@
CXX="$cppcompiler"
export CXX
-
#
# Set the extra C and C++ compiler flags
#
@@ -454,7 +508,7 @@
elif test $platform = "ptx"; then
./configure --prefix=$XMLINSTALL
else
-./configure $configureoptions
+sh ./configure $configureoptions
fi
echo
echo In future, you may also directly type the following commands to create the Makefiles.
1.15 +2 -2 xml-xerces/c/src/util/Compilers/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/Compilers/Makefile.in,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Makefile.in 2001/06/27 17:08:35 1.14
+++ Makefile.in 2001/07/03 16:51:21 1.15
@@ -54,7 +54,7 @@
# <http://www.apache.org/>.
#
#
-# $Id: Makefile.in,v 1.14 2001/06/27 17:08:35 tng Exp $
+# $Id: Makefile.in,v 1.15 2001/07/03 16:51:21 tng Exp $
#
PLATFORM = @platform@
@@ -109,7 +109,7 @@
CPP_OBJECTS = SCOCCDefs.$(TO)
endif
endif
-ifeq (${CXX},xlC_r)
+ifeq (xlC_r,$(findstring xlC_r,${CXX}))
CPP_OBJECTS = CSetDefs.$(TO)
endif
ifeq (${CXX},g++)
1.18 +17 -2 xml-xerces/c/src/util/Platforms/AIX/AIXPlatformUtils.cpp
Index: AIXPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/Platforms/AIX/AIXPlatformUtils.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- AIXPlatformUtils.cpp 2000/07/25 22:29:26 1.17
+++ AIXPlatformUtils.cpp 2001/07/03 16:51:25 1.18
@@ -55,7 +55,7 @@
*/
/*
- * $Id: AIXPlatformUtils.cpp,v 1.17 2000/07/25 22:29:26 aruna1 Exp $
+ * $Id: AIXPlatformUtils.cpp,v 1.18 2001/07/03 16:51:25 tng Exp $
*/
@@ -63,7 +63,11 @@
// Includes
// ---------------------------------------------------------------------------
#ifndef APP_NO_THREADS
-#include <pthread.h>
+# if defined(XML_USE_DCE)
+# include <dce/pthread.h>
+# else
+# include <pthread.h>
+# endif // XML_USE_DCE
#include <sys/atomic_op.h>
#endif
@@ -503,6 +507,16 @@
XMLExcepts::Mutex_CouldNotCreate);
}
pthread_mutexattr_t* attr = new pthread_mutexattr_t;
+#if defined(XML_USE_DCE)
+ pthread_mutexattr_create(attr);
+ pthread_mutexattr_setkind_np(attr, MUTEX_RECURSIVE_NP);
+ if (pthread_mutex_init(mutex, *attr))
+ {
+ ThrowXML(XMLPlatformUtilsException,
+ XMLExcepts::Mutex_CouldNotCreate);
+ }
+ pthread_mutexattr_delete(attr);
+#else
pthread_mutexattr_init(attr);
pthread_mutexattr_setkind_np(attr, MUTEX_RECURSIVE_NP);
if (pthread_mutex_init(mutex, attr))
@@ -511,6 +525,7 @@
XMLExcepts::Mutex_CouldNotCreate);
}
pthread_mutexattr_destroy(attr);
+#endif
delete attr;
return (void*)(mutex);
}
1.19 +48 -3 xml-xerces/c/src/util/Platforms/Solaris/SolarisPlatformUtils.cpp
Index: SolarisPlatformUtils.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/util/Platforms/Solaris/SolarisPlatformUtils.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- SolarisPlatformUtils.cpp 2000/07/25 22:30:41 1.18
+++ SolarisPlatformUtils.cpp 2001/07/03 16:51:32 1.19
@@ -55,7 +55,7 @@
*/
/*
- * $Id: SolarisPlatformUtils.cpp,v 1.18 2000/07/25 22:30:41 aruna1 Exp $
+ * $Id: SolarisPlatformUtils.cpp,v 1.19 2001/07/03 16:51:32 tng Exp $
*/
@@ -64,7 +64,11 @@
// ---------------------------------------------------------------------------
#if !defined (APP_NO_THREADS)
-#include <pthread.h>
+# if defined (XML_USE_DCE)
+# include <dce/pthread.h>
+# else
+# include <pthread.h>
+# endif
#endif // APP_NO_THREADS
@@ -107,7 +111,6 @@
-
// ---------------------------------------------------------------------------
// Local Methods
// ---------------------------------------------------------------------------
@@ -521,10 +524,17 @@
gAtomicOpMutex = new pthread_mutex_t;
+#if defined(XML_USE_DCE)
+ if (pthread_mutex_init(gAtomicOpMutex, pthread_mutexattr_default))
+ panic( XMLPlatformUtils::Panic_SystemInit );
+#else // XML_USE_DCE
if (pthread_mutex_init(gAtomicOpMutex, NULL))
panic( XMLPlatformUtils::Panic_SystemInit );
+#endif // XML_USE_DCE
}
+#ifndef XML_USE_DCE
+// inlining the class with dce threading causes segmentation fault
class RecursiveMutex
{
public:
@@ -566,10 +576,30 @@
tid = 0;
};
};
+#endif // ifndef XML_USE_DCE
void* XMLPlatformUtils::makeMutex()
{
+#if defined(XML_USE_DCE)
+ pthread_mutex_t* mutex = new pthread_mutex_t;
+ if (mutex == NULL)
+ {
+ ThrowXML(XMLPlatformUtilsException,
+ XMLExcepts::Mutex_CouldNotCreate);
+ }
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_create(&attr);
+ pthread_mutexattr_setkind_np(&attr, MUTEX_RECURSIVE_NP);
+ if (pthread_mutex_init(mutex, attr))
+ {
+ ThrowXML(XMLPlatformUtilsException,
+ XMLExcepts::Mutex_CouldNotCreate);
+ }
+ pthread_mutexattr_delete(&attr);
+ return (void*)(mutex);
+#else
return new RecursiveMutex;
+#endif
};
@@ -577,7 +607,12 @@
{
if (mtxHandle == NULL)
return;
+#if defined(XML_USE_DCE)
+ pthread_mutex_t *rm = (pthread_mutex_t *)mtxHandle;
+ pthread_mutex_destroy(rm);
+#else
RecursiveMutex *rm = (RecursiveMutex *)mtxHandle;
+#endif
delete rm;
};
@@ -586,16 +621,26 @@
{
if (mtxHandle == NULL)
return;
+#if defined(XML_USE_DCE)
+ pthread_mutex_t *rm = (pthread_mutex_t *)mtxHandle;
+ pthread_mutex_lock(rm);
+#else
RecursiveMutex *rm = (RecursiveMutex *)mtxHandle;
rm->lock();
+#endif
}
void XMLPlatformUtils::unlockMutex(void* const mtxHandle)
{
if (mtxHandle == NULL)
return;
+#if defined(XML_USE_DCE)
+ pthread_mutex_t *rm = (pthread_mutex_t *)mtxHandle;
+ pthread_mutex_unlock(rm);
+#else
RecursiveMutex *rm = (RecursiveMutex *)mtxHandle;
rm->unlock();
+#endif
}
// -----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org