From 72e8138bec5f2aef1a90c2c723f7c81ac9cbda36 Mon Sep 17 00:00:00 2001
From: Tinny Ng <tng@apache.org>
Date: Mon, 26 Aug 2002 14:50:27 +0000
Subject: [PATCH] [Bug 12004] Samples/Tests don't build under cygwin.  Patch
 from Abe Backus.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@174185 13f79535-47bb-0310-9956-ffa450edef68
---
 credits.txt                     |  1 +
 doc/feedback.xml                |  1 +
 doc/releases.xml                |  7 +++++++
 samples/Makefile.incl           | 10 ++++++++++
 samples/configure               |  1 +
 samples/configure.in            |  1 +
 samples/runConfigure            |  4 ++--
 tests/Makefile.incl             | 10 ++++++++++
 tests/ThreadTest/ThreadTest.cpp |  2 +-
 tests/configure                 |  1 +
 tests/configure.in              |  1 +
 tests/runConfigure              |  4 ++--
 12 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/credits.txt b/credits.txt
index 1672ae462..bcffe4252 100644
--- a/credits.txt
+++ b/credits.txt
@@ -8,6 +8,7 @@ Curt Arnold
 Edward Avis
 Anupam Bagchi
 Torbjörn Bäckström
+Abe Backus
 Frank Balluffi
 Matthew Baker
 Devin Barnhart
diff --git a/doc/feedback.xml b/doc/feedback.xml
index e5bff1542..cda5b41c6 100644
--- a/doc/feedback.xml
+++ b/doc/feedback.xml
@@ -33,6 +33,7 @@
             <li>Edward Avis</li>
             <li>Anupam Bagchi</li>
             <li>Torbjörn Bäckström</li>
+            <li>Abe Backus</li>
             <li>Frank Balluffi</li>
             <li>Matthew Baker</li>
             <li>Devin Barnhart</li>
diff --git a/doc/releases.xml b/doc/releases.xml
index 5b8a664e8..e1f6bc7c5 100644
--- a/doc/releases.xml
+++ b/doc/releases.xml
@@ -25,6 +25,13 @@
         <td>Description</td>
     </tr>
 
+    <tr>
+        <td>2002-08-26</td>
+        <td>Abe Backus</td>
+        <td>[Bug 12004] Samples/Tests don't build under cygwin.
+        </td>
+    </tr>
+
     <tr>
         <td>2002-08-23</td>
         <td>Tinny Ng</td>
diff --git a/samples/Makefile.incl b/samples/Makefile.incl
index 3116c993d..f19b00d5c 100644
--- a/samples/Makefile.incl
+++ b/samples/Makefile.incl
@@ -189,6 +189,16 @@ EXTRA_LINK_OPTIONS=-lc ${EXTRA_LIBS}
 SHLIBSUFFIX=.so
 endif
 
+#=============== CYGWIN SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, CYGWIN)
+CMP= -c ${CXXFLAGS}
+CC= ${COMPILER} -c -D__${PLATFORM}__
+LINK =  ${COMPILER} -D__${PLATFORM}__ ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+SHLIBSUFFIX=.dll
+endif
+
 #=============== FREEBSD SPECIFIC OPTIONS =========================
 ifeq (${PLATFORM}, FREEBSD)
   CMP= -c ${CXXFLAGS}
diff --git a/samples/configure b/samples/configure
index 3f95dcc3e..e33621d1f 100755
--- a/samples/configure
+++ b/samples/configure
@@ -1323,6 +1323,7 @@ case "${host}" in
         *-*-OS400*)     platform=OS400 ;;
         *-*-osf*)       platform=TRU64 ;;
         *-apple-*)		platform=MACOSX ;;
+        *-*-cygwin*)	platform=CYGWIN ;;
         *)              platform=UNKNOWN ;;
 esac
 
diff --git a/samples/configure.in b/samples/configure.in
index 3f563a1f5..d4999bdac 100644
--- a/samples/configure.in
+++ b/samples/configure.in
@@ -51,6 +51,7 @@ case "${host}" in
         *-*-OS400*)     platform=OS400 ;;
         *-*-osf*)       platform=TRU64 ;;
         *-apple-*)		platform=MACOSX ;;
+        *-*-cygwin*)	platform=CYGWIN ;;
         *)              platform=UNKNOWN ;;
 esac
 AC_SUBST(platform)
diff --git a/samples/runConfigure b/samples/runConfigure
index 45d3e8871..0fa163540 100755
--- a/samples/runConfigure
+++ b/samples/runConfigure
@@ -84,7 +84,7 @@ usage()
     echo "       where options may be any of the following:"
     echo "       -p <platform> (accepts 'aix', 'linux', 'freebsd', 'solaris',
                  'hp-10', 'hp-11', 'openserver', 'unixware', 'os400', 'irix',
-                 'ptx', 'tru64', 'macosx')"
+                 'ptx', 'tru64', 'macosx', 'cygwin')"
     echo "       -c <C compiler name> (e.g. gcc, cc, xlc_r, icc or ecc)"
     echo "       -x <C++ compiler name> (e.g. g++, CC, xlC_r, icc or ecc)"
     echo "       -d (specifies that you want to build debug version)"
@@ -196,7 +196,7 @@ echo "Extra link options: $linkeroptions"
 # Now check if the options are correct or not, bail out if incorrect
 #
 case $platform in
-   aix | openserver | unixware | linux | freebsd | solaris | hp-10 | hp-11 | os400 | irix | ptx | tru64 | macosx)
+   aix | openserver | unixware | linux | freebsd | solaris | hp-10 | hp-11 | os400 | irix | ptx | tru64 | macosx | cygwin)
        # platform has been recognized
        ;;
    *)
diff --git a/tests/Makefile.incl b/tests/Makefile.incl
index 295835f13..f80f75e66 100644
--- a/tests/Makefile.incl
+++ b/tests/Makefile.incl
@@ -188,6 +188,16 @@ EXTRA_LINK_OPTIONS=-lc ${EXTRA_LIBS}
 SHLIBSUFFIX=.so
 endif
 
+#=============== CYGWIN SPECIFIC OPTIONS =========================
+ifeq (${PLATFORM}, CYGWIN)
+CMP= -c ${CXXFLAGS}
+CC= ${COMPILER} -c -D__${PLATFORM}__
+LINK =  ${COMPILER} -D__${PLATFORM}__ ${LDFLAGS}
+PLATFORM_LIB_LINK_OPTIONS=-L/usr/lib -L/usr/local/lib
+EXTRA_LINK_OPTIONS=${EXTRA_LIBS}
+SHLIBSUFFIX=.dll
+endif
+
 #=============== FREEBSD SPECIFIC OPTIONS =========================
 ifeq (${PLATFORM}, FREEBSD)
   CMP= -c ${CXXFLAGS}
diff --git a/tests/ThreadTest/ThreadTest.cpp b/tests/ThreadTest/ThreadTest.cpp
index 1b0223636..27599e5d7 100644
--- a/tests/ThreadTest/ThreadTest.cpp
+++ b/tests/ThreadTest/ThreadTest.cpp
@@ -119,7 +119,7 @@ void ThreadFuncs::startThread(ThreadFunc func, void *param)
 }
 
 
-#elif defined (AIX) || defined(SOLARIS) || defined(LINUX) || defined(HPUX) || defined (OS390) || defined(FREEBSD)
+#elif defined (AIX) || defined(SOLARIS) || defined(LINUX) || defined(HPUX) || defined (OS390) || defined(FREEBSD) || defined(__CYGWIN__)
 #include <pthread.h>
 #include <unistd.h>
 #include <errno.h>
diff --git a/tests/configure b/tests/configure
index f3f632a84..819befe57 100755
--- a/tests/configure
+++ b/tests/configure
@@ -1323,6 +1323,7 @@ case "${host}" in
         *-*-OS400*)     platform=OS400 ;;
         *-*-osf*)       platform=TRU64 ;;
         *-apple-*)		platform=MACOSX ;;
+        *-*-cygwin*)		platform=CYGWIN ;;
         *)              platform=UNKNOWN ;;
 esac
 
diff --git a/tests/configure.in b/tests/configure.in
index 076be178e..deb5e3cef 100644
--- a/tests/configure.in
+++ b/tests/configure.in
@@ -51,6 +51,7 @@ case "${host}" in
         *-*-OS400*)     platform=OS400 ;;
         *-*-osf*)       platform=TRU64 ;;
         *-apple-*)		platform=MACOSX ;;
+        *-*-cygwin*)		platform=CYGWIN ;;
         *)              platform=UNKNOWN ;;
 esac
 AC_SUBST(platform)
diff --git a/tests/runConfigure b/tests/runConfigure
index 6cf4e1c73..a165005a5 100755
--- a/tests/runConfigure
+++ b/tests/runConfigure
@@ -84,7 +84,7 @@ usage()
     echo "       where options may be any of the following:"
     echo "       -p <platform> (accepts 'aix', 'linux', 'freebsd', 'solaris',
                  'hp-10', 'hp-11', 'openserver', 'unixware', 'os400', 'irix',
-                 'ptx', 'tru64', 'macosx')"
+                 'ptx', 'tru64', 'macosx', 'cygwin')"
     echo "       -c <C compiler name> (e.g. gcc, cc, xlc_r, icc or ecc)"
     echo "       -x <C++ compiler name> (e.g. g++, CC, xlC_r, icc or ecc)"
     echo "       -d (specifies that you want to build debug version)"
@@ -196,7 +196,7 @@ echo "Extra link options: $linkeroptions"
 # Now check if the options are correct or not, bail out if incorrect
 #
 case $platform in
-   aix | openserver | unixware | linux | freebsd | solaris | hp-10 | hp-11 | os400 | irix | ptx | tru64 | macosx)
+   aix | openserver | unixware | linux | freebsd | solaris | hp-10 | hp-11 | os400 | irix | ptx | tru64 | macosx | cygwin)
        # platform has been recognized
        ;;
    *)
-- 
GitLab