Index: locks/unix/proc_mutex.c
===================================================================
--- locks/unix/proc_mutex.c	(revision 595788)
+++ locks/unix/proc_mutex.c	(working copy)
@@ -263,7 +263,7 @@
 
     if (mutex->curr_locked == 1) {
         if ((rv = pthread_mutex_unlock(mutex->pthread_interproc))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
             rv = errno;
 #endif
             return rv;
@@ -272,7 +272,7 @@
     /* curr_locked is set to -1 until the mutex has been created */
     if (mutex->curr_locked != -1) {
         if ((rv = pthread_mutex_destroy(mutex->pthread_interproc))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
             rv = errno;
 #endif
             return rv;
@@ -310,14 +310,14 @@
     new_mutex->curr_locked = -1; /* until the mutex has been created */
 
     if ((rv = pthread_mutexattr_init(&mattr))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
         proc_mutex_proc_pthread_cleanup(new_mutex);
         return rv;
     }
     if ((rv = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
         proc_mutex_proc_pthread_cleanup(new_mutex);
@@ -328,7 +328,7 @@
 #ifdef HAVE_PTHREAD_MUTEX_ROBUST
     if ((rv = pthread_mutexattr_setrobust_np(&mattr, 
                                                PTHREAD_MUTEX_ROBUST_NP))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
         proc_mutex_proc_pthread_cleanup(new_mutex);
@@ -336,7 +336,7 @@
         return rv;
     }
     if ((rv = pthread_mutexattr_setprotocol(&mattr, PTHREAD_PRIO_INHERIT))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
         proc_mutex_proc_pthread_cleanup(new_mutex);
@@ -346,7 +346,7 @@
 #endif /* HAVE_PTHREAD_MUTEX_ROBUST */
 
     if ((rv = pthread_mutex_init(new_mutex->pthread_interproc, &mattr))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
         proc_mutex_proc_pthread_cleanup(new_mutex);
@@ -357,7 +357,7 @@
     new_mutex->curr_locked = 0; /* mutex created now */
 
     if ((rv = pthread_mutexattr_destroy(&mattr))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
         proc_mutex_proc_pthread_cleanup(new_mutex);
@@ -376,7 +376,7 @@
     apr_status_t rv;
 
     if ((rv = pthread_mutex_lock(mutex->pthread_interproc))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
 #ifdef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP
@@ -402,7 +402,7 @@
 
     mutex->curr_locked = 0;
     if ((rv = pthread_mutex_unlock(mutex->pthread_interproc))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
         return rv;
Index: locks/unix/thread_rwlock.c
===================================================================
--- locks/unix/thread_rwlock.c	(revision 595788)
+++ locks/unix/thread_rwlock.c	(working copy)
@@ -29,7 +29,7 @@
     apr_status_t stat;
 
     stat = pthread_rwlock_destroy(&rwlock->rwlock);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (stat) {
         stat = errno;
     }
@@ -47,7 +47,7 @@
     new_rwlock->pool = pool;
 
     if ((stat = pthread_rwlock_init(&new_rwlock->rwlock, NULL))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         stat = errno;
 #endif
         return stat;
@@ -66,7 +66,7 @@
     apr_status_t stat;
 
     stat = pthread_rwlock_rdlock(&rwlock->rwlock);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (stat) {
         stat = errno;
     }
@@ -79,7 +79,7 @@
     apr_status_t stat;
 
     stat = pthread_rwlock_tryrdlock(&rwlock->rwlock);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (stat) {
         stat = errno;
     }
@@ -95,7 +95,7 @@
     apr_status_t stat;
 
     stat = pthread_rwlock_wrlock(&rwlock->rwlock);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (stat) {
         stat = errno;
     }
@@ -108,7 +108,7 @@
     apr_status_t stat;
 
     stat = pthread_rwlock_trywrlock(&rwlock->rwlock);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (stat) {
         stat = errno;
     }
@@ -124,7 +124,7 @@
     apr_status_t stat;
 
     stat = pthread_rwlock_unlock(&rwlock->rwlock);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (stat) {
         stat = errno;
     }
Index: locks/unix/thread_mutex.c
===================================================================
--- locks/unix/thread_mutex.c	(revision 595788)
+++ locks/unix/thread_mutex.c	(working copy)
@@ -26,7 +26,7 @@
     apr_status_t rv;
 
     rv = pthread_mutex_destroy(&mutex->mutex);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (rv) {
         rv = errno;
     }
@@ -71,7 +71,7 @@
         rv = pthread_mutex_init(&new_mutex->mutex, NULL);
 
     if (rv) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
         return rv;
@@ -90,7 +90,7 @@
     apr_status_t rv;
 
     rv = pthread_mutex_lock(&mutex->mutex);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (rv) {
         rv = errno;
     }
@@ -105,7 +105,7 @@
 
     rv = pthread_mutex_trylock(&mutex->mutex);
     if (rv) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
         return (rv == EBUSY) ? APR_EBUSY : rv;
@@ -119,7 +119,7 @@
     apr_status_t status;
 
     status = pthread_mutex_unlock(&mutex->mutex);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (status) {
         status = errno;
     }
Index: locks/unix/thread_cond.c
===================================================================
--- locks/unix/thread_cond.c	(revision 595788)
+++ locks/unix/thread_cond.c	(working copy)
@@ -27,7 +27,7 @@
     apr_status_t rv;
 
     rv = pthread_cond_destroy(&cond->cond);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (rv) {
         rv = errno;
     }
@@ -46,7 +46,7 @@
     new_cond->pool = pool;
 
     if ((rv = pthread_cond_init(&new_cond->cond, NULL))) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
         return rv;
@@ -66,7 +66,7 @@
     apr_status_t rv;
 
     rv = pthread_cond_wait(&cond->cond, &mutex->mutex);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (rv) {
         rv = errno;
     }
@@ -87,7 +87,7 @@
     abstime.tv_nsec = apr_time_usec(then) * 1000; /* nanoseconds */
 
     rv = pthread_cond_timedwait(&cond->cond, &mutex->mutex, &abstime);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (rv) {
         rv = errno;
     }
@@ -104,7 +104,7 @@
     apr_status_t rv;
 
     rv = pthread_cond_signal(&cond->cond);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (rv) {
         rv = errno;
     }
@@ -117,7 +117,7 @@
     apr_status_t rv;
 
     rv = pthread_cond_broadcast(&cond->cond);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (rv) {
         rv = errno;
     }
Index: threadproc/unix/signals.c
===================================================================
--- threadproc/unix/signals.c	(revision 595788)
+++ threadproc/unix/signals.c	(working copy)
@@ -422,7 +422,7 @@
     }
 #else
     if ((rv = pthread_sigmask(SIG_SETMASK, &sig_mask, NULL)) != 0) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
     }
@@ -448,7 +448,7 @@
     }
 #else
     if ((rv = pthread_sigmask(SIG_BLOCK, &sig_mask, NULL)) != 0) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
     }
@@ -475,7 +475,7 @@
     }
 #else
     if ((rv = pthread_sigmask(SIG_UNBLOCK, &sig_mask, NULL)) != 0) {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         rv = errno;
 #endif
     }
Index: threadproc/unix/thread.c
===================================================================
--- threadproc/unix/thread.c	(revision 595788)
+++ threadproc/unix/thread.c	(working copy)
@@ -29,7 +29,7 @@
     apr_status_t rv;
 
     rv = pthread_attr_destroy(&attr->attr);
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     if (rv) {
         rv = errno;
     }
@@ -51,7 +51,7 @@
                                   apr_pool_cleanup_null);
         return APR_SUCCESS;
     }
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     stat = errno;
 #endif
 
@@ -68,7 +68,7 @@
                                                     apr_int32_t on)
 {
     apr_status_t stat;
-#ifdef PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR
+#ifdef HAVE_ZOS_PTHREADS
     int arg = DETACH_ARG(on);
 
     if ((stat = pthread_attr_setdetachstate(&attr->attr, &arg)) == 0) {
@@ -79,7 +79,7 @@
         return APR_SUCCESS;
     }
     else {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         stat = errno;
 #endif
 
@@ -110,7 +110,7 @@
     if (stat == 0) {
         return APR_SUCCESS;
     }
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     stat = errno;
 #endif
 
@@ -127,7 +127,7 @@
     if (rv == 0) {
         return APR_SUCCESS;
     }
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
     rv = errno;
 #endif
     return rv;
@@ -181,7 +181,7 @@
         return APR_SUCCESS;
     }
     else {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         stat = errno;
 #endif
 
@@ -220,7 +220,7 @@
         return APR_SUCCESS;
     }
     else {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         stat = errno;
 #endif
 
@@ -232,7 +232,7 @@
 {
     apr_status_t stat;
 
-#ifdef PTHREAD_DETACH_ARG1_ADDR
+#ifdef HAVE_ZOS_PTHREADS
     if ((stat = pthread_detach(thd->td)) == 0) {
 #else
     if ((stat = pthread_detach(*thd->td)) == 0) {
@@ -241,7 +241,7 @@
         return APR_SUCCESS;
     }
     else {
-#ifdef PTHREAD_SETS_ERRNO
+#ifdef HAVE_ZOS_PTHREADS
         stat = errno;
 #endif
 
Index: build/apr_hints.m4
===================================================================
--- build/apr_hints.m4	(revision 595788)
+++ build/apr_hints.m4	(working copy)
@@ -409,7 +409,7 @@
        APR_SETIFNULL(apr_sysvsem_is_global, [yes])
        APR_SETIFNULL(apr_gethostbyname_is_thread_safe, [yes])
        APR_SETIFNULL(apr_gethostbyaddr_is_thread_safe, [yes])
-       APR_ADDTO(CPPFLAGS, [-U_NO_PROTO -DPTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR -DPTHREAD_SETS_ERRNO -DPTHREAD_DETACH_ARG1_ADDR -DSIGPROCMASK_SETS_THREAD_MASK -DTCP_NODELAY=1])
+       APR_ADDTO(CPPFLAGS, [-U_NO_PROTO -DHAVE_ZOS_PTHREADS -DSIGPROCMASK_SETS_THREAD_MASK -DTCP_NODELAY=1])
        ;;
     *-ibm-as400)
        APR_SETIFNULL(apr_lock_method, [USE_SYSVSEM_SERIALIZE])
