Skip to content

Commit

Permalink
Autoconf modules I've made.
Browse files Browse the repository at this point in the history
imported from: dustin@spy.net--projects/snippets--autoconf--1.0--patch-1
  • Loading branch information
dustin committed Dec 31, 2008
1 parent e03374c commit a3196fe
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions autoconf/pthread.m4
@@ -0,0 +1,50 @@
dnl Copyright (c) 2002 Dustin Sallings <dustin@spy.net>
dnl
dnl $id$

dnl Let's see if the threads actually work
AC_DEFUN(SPY_PTHREAD, [
AC_CACHE_CHECK([for working pthread], auth_cv_working_pthread, [
AC_TRY_RUN([
/* Need this for Solaris */
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif /* HAVE_PTHREAD_H */
void *thread_main(void *arg) {
exit(0);
}
int main(int argc, char **argv) {
pthread_t t;
/* If the thread actually executes, the program will exit 0 */
pthread_create(&t, NULL, thread_main, NULL);
sleep(2);
exit(1);
}
], [
dnl Test worked
auth_cv_working_pthread=yes
],
[
dnl Test failed
auth_cv_working_pthread=no
],
[
dnl Cross-compiling
auth_cv_working_pthread=no
]
)
])
if test "x$auth_cv_working_pthread" = "xyes"
then
AC_DEFINE_UNQUOTED(WORKING_PTHREAD, 1)
AC_SUBST(WORKING_PTHREAD)
fi])

0 comments on commit a3196fe

Please sign in to comment.