# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Tue Oct 20 11:18:44 EET DST 1998 [metaconfig 3.0 PL70]
+# Generated on Thu Oct 22 10:24:53 EET DST 1998 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by jhi@iki.fi)
cat >/tmp/c1$$ <<EOF
privlib=''
privlibexp=''
prototype=''
-pthread_setdetachstate_pointer=''
ptrsize=''
drand01=''
randbits=''
set poll d_poll
eval $inlibc
+
+: see whether the various POSIXish _yields exist
+$cat >try.c <<EOP
+#include <pthread.h>
+#include <stdio.h>
+main() {
+#ifdef SCHED_YIELD
+ sched_yield();
+#else
+#ifdef PTHREAD_YIELD
+ pthread_yield();
+#else
+#ifdef PTHREAD_YIELD_NULL
+ pthread_yield(NULL);
+#endif
+#endif
+#endif
+}
+EOP
+: see if sched_yield exists
+set try -DSCHED_YIELD
+if eval $compile; then
+ val="$define"
+ sched_yield='sched_yield()'
+else
+ val="$undef"
+fi
+case "$usethreads" in
+$define)
+ case "$val" in
+ $define) echo 'sched_yield() found.' >&4 ;;
+ *) echo 'sched_yield() NOT found.' >&4 ;;
+ esac
+esac
+set d_sched_yield
+eval $setvar
+
+: see if pthread_yield exists
+set try -DPTHREAD_YIELD
+if eval $compile; then
+ val="$define"
+ case "$sched_yield" in
+ '') sched_yield='pthread_yield()' ;;
+ esac
+else
+ set try -DPTHREAD_YIELD_NULL
+ if eval $compile; then
+ val="$define"
+ case "$sched_yield" in
+ '') sched_yield='pthread_yield(NULL)' ;;
+ esac
+ else
+ val="$undef"
+ fi
+fi
+case "$usethreads" in
+$define)
+ case "$val" in
+ $define) echo 'pthread_yield() found.' >&4 ;;
+ *) echo 'pthread_yield() NOT found.' >&4 ;;
+ esac
+ ;;
+esac
+set d_pthread_yield
+eval $setvar
+
+case "$sched_yield" in
+'') sched_yield=undef ;;
+esac
+
+$rm -f try try.*
+
: test whether pthreads are created in joinable -- aka undetached -- state
if test "X$usethreads" = "X$define"; then
echo $n "Checking whether pthreads are created joinable. $c" >&4
int detachstate;
printf("%s\n",
pthread_attr_init(&attr) == 0 &&
+#if PTHREAD_ATTR_GETDETACHSTATE_INT
+ pthread_attr_getdetachstate(&attr) == 0 &&
+#else
pthread_attr_getdetachstate(&attr, &detachstate) == 0 &&
+#endif
detachstate == PTHREAD_CREATE_DETACHED ?
"detached" : "joinable");
exit(0);
*) echo "Yup, they are." >&4 ;;
esac
else
- echo " "
- echo "(I can't execute the test program--assuming they are.)" >&4
- yyy=joinable
+ set try -DPTHREAD_ATTR_GETDETACHSTATE_INT
+ if eval $compile; then
+ yyy=`./try`
+ case "$yyy" in
+ detached) echo "Nope, they aren't." >&4 ;;
+ *) echo "Yup, they are." >&4 ;;
+ esac
+ else
+ echo " "
+ echo "(I can't execute the test program--assuming they are.)" >&4
+ yyy=joinable
+ fi
fi
$rm -f try try.*
case "$yyy" in
set pid_t pidtype int stdio.h sys/types.h
eval $typedef_ask
-
-: see whether the state of pthread_attr_setdetachstate is an int pointer
-$cat >try.c <<EOP
-#include <pthread.h>
-main() {
- pthread_attr_t attr;
- int state = 0;
- pthread_attr_init(&attr);
-#ifdef POINTER
- pthread_attr_setdetachstate(&attr, &state);
-#else
- pthread_attr_setdetachstate(&attr, state);
-#endif
-}
-EOP
-set try
-if eval $compile; then
- val="$undef"
-else
- set try -DPOINTER
- if eval $compile; then
- val="$define"
- else
- val="$undef"
- fi
-fi
-set pthread_setdetachstate_pointer
-eval $setvar
-
-$rm -f try try.*
-
: check for length of pointer
echo " "
case "$ptrsize" in
fi
$rm -f foo* bar*
-
-: see whether the various POSIXish _yields exist
-$cat >try.c <<EOP
-#include <pthread.h>
-#include <stdio.h>
-main() {
-#ifdef SCHED_YIELD
- sched_yield();
-#else
-#ifdef PTHREAD_YIELD
- pthread_yield();
-#else
-#ifdef PTHREAD_YIELD_NULL
- pthread_yield(NULL);
-#endif
-#endif
-#endif
-}
-EOP
-: see if sched_yield exists
-set try -DSCHED_YIELD
-if eval $compile; then
- val="$define"
- sched_yield='sched_yield()'
-else
- val="$undef"
-fi
-case "$usethreads" in
-$define)
- case "$val" in
- $define) echo 'sched_yield() found.' >&4 ;;
- *) echo 'sched_yield() NOT found.' >&4 ;;
- esac
-esac
-set d_sched_yield
-eval $setvar
-
-: see if pthread_yield exists
-set try -DPTHREAD_YIELD
-if eval $compile; then
- val="$define"
- case "$sched_yield" in
- '') sched_yield='pthread_yield()' ;;
- esac
-else
- set try -DPTHREAD_YIELD_NULL
- if eval $compile; then
- val="$define"
- case "$sched_yield" in
- '') sched_yield='pthread_yield(NULL)' ;;
- esac
- else
- val="$undef"
- fi
-fi
-case "$usethreads" in
-$define)
- case "$val" in
- $define) echo 'pthread_yield() found.' >&4 ;;
- *) echo 'pthread_yield() NOT found.' >&4 ;;
- esac
- ;;
-esac
-set d_pthread_yield
-eval $setvar
-
-case "$sched_yield" in
-'') sched_yield=undef ;;
-esac
-
-$rm -f try try.*
-
: see if sys/select.h has to be included
set sys/select.h i_sysselct
eval $inhdr
privlib='$privlib'
privlibexp='$privlibexp'
prototype='$prototype'
-pthread_setdetachstate_pointer='$pthread_setdetachstate_pointer'
ptrsize='$ptrsize'
randbits='$randbits'
randfunc='$randfunc'