On Fri, 2006-10-06 at 11:35 +0200, Åke Sandgren wrote:
> Hi!
> 
> Attached is a patch that fixes some errors in the configure tests for
> pthreads on linux (both for gcc and pgi).

Oops, forgot part of the patch.
Here is an updated patch.
diff -ru site/config/ompi_config_pthreads.m4 amd64_ubuntu606-pgi6.2/config/ompi_config_pthreads.m4
--- site/config/ompi_config_pthreads.m4	2006-06-02 21:51:39.000000000 +0200
+++ amd64_ubuntu606-pgi6.2/config/ompi_config_pthreads.m4	2006-10-06 10:54:22.000000000 +0200
@@ -480,7 +480,6 @@
                               ompi_pthread_cxx_success=0)
     AC_LANG_POP(C++)
     if test "$ompi_pthread_cxx_success" = "1"; then
-      PTHREAD_LIBS="$pl"
       AC_MSG_RESULT([yes])
     else
       CXXCPPFLAGS="$orig_CXXCPPFLAGS"
@@ -515,6 +514,7 @@
       else
         PTHREAD_CXXCPPFLAGS=
         CXXCPPFLAGS="$orig_CXXCPPFLAGS"
+        LIBS="$orig_LIBS"
         AC_MSG_RESULT([no])
       fi
     done
@@ -535,7 +535,6 @@
     OMPI_INTL_PTHREAD_TRY_LINK_F77(ompi_pthread_f77_success=1, 
                                   ompi_pthread_f77_success=0)
     AC_LANG_POP(C)
-    LIBS="$orig_LIBS"
     if test "$ompi_pthread_f77_success" = "1"; then
       AC_MSG_RESULT([yes])
     else
@@ -550,12 +549,12 @@
       OMPI_INTL_PTHREAD_TRY_LINK_F77(ompi_pthread_f77_success=1, 
                                     ompi_pthread_f77_success=0)
       AC_LANG_POP(C)
-      LIBS="$orig_LIBS"
       if test "$ompi_pthread_f77_success" = "1"; then
 	PTHREAD_LIBS="$pl"
         AC_MSG_RESULT([yes])
         break
       else
+        LIBS="$orig_LIBS"
         AC_MSG_RESULT([no])
       fi
     done
diff -ru site/config/ompi_check_pthread_pids.m4 amd64_ubuntu606-pgi6.2/config/ompi_check_pthread_pids.m4
--- site/config/ompi_check_pthread_pids.m4	2006-04-12 18:12:28.000000000 +0200
+++ amd64_ubuntu606-pgi6.2/config/ompi_check_pthread_pids.m4	2006-10-06 12:05:11.000000000 +0200
@@ -33,6 +33,8 @@
     [Do threads have different pids (pthreads on linux)])

 AC_MSG_CHECKING([if threads have different pids (pthreads on linux)])
+CFLAGS_save="$CFLAGS"
+CFLAGS="$CFLAGS $THREAD_CFLAGS"
 CPPFLAGS_save="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS"
 LDFLAGS_save="$LDFLAGS"
@@ -46,20 +48,20 @@
 void *checkpid(void *arg);
 int main(int argc, char* argv[]) {
   pthread_t thr;
-  int pid, retval;
+  int pid, *retval;
   pid = getpid();
   pthread_create(&thr, NULL, checkpid, &pid);
   pthread_join(thr, (void **) &retval);
-  exit(retval);
+  exit(*retval);
 }
+static int ret;
 void *checkpid(void *arg) {
-   int ret;
    int ppid = *((int *) arg);
    if (ppid == getpid())
      ret = 0;
    else
      ret = 1;
-     pthread_exit((void *) ret);
+   pthread_exit((void *) &ret);
 }], 
 [MSG=no OMPI_THREADS_HAVE_DIFFERENT_PIDS=0], 
 [MSG=yes OMPI_THREADS_HAVE_DIFFERENT_PIDS=1],
@@ -75,6 +77,7 @@
  esac
 ])

+CFLAGS="$CFLAGS_save"
 CPPFLAGS="$CPPFLAGS_save"
 LDFLAGS="$LDFLAGS_save"
 LIBS="$LIBS_save"

Reply via email to