diff --git a/configure.ac b/configure.ac index 7a66f1c98a..651e82b212 100644 --- a/configure.ac +++ b/configure.ac @@ -879,10 +879,12 @@ AC_DEFINE_UNQUOTED(OMPI_OFFSET_DATATYPE, $MPI_OFFSET_DATATYPE, [MPI datatype cor # sysconf(), but does not have _SC_NPROCESSORS_ONLN. Doh! AC_MSG_CHECKING([for _SC_NPROCESSORS_ONLN]) -AC_TRY_COMPILE([#include ], - [(void)sysconf(_SC_NPROCESSORS_ONLN);], -[MSG=yes VALUE=1], [MSG=no VALUE=0]) -AC_DEFINE_UNQUOTED(OPAL_HAVE__SC_NPROCESSORS_ONLN, $VALUE, +AC_COMPILE_IFELSE(AC_LANG_SOURCE([[#include +]],[[int i = _SN_NPROCESSORS_ONLN;]]), + [MSG=yes OMPI_HAVE__SC_NPROCESSORS_ONLN=1], + [MSG=no OMPI_HAVE__SC_NPROCESSORS_ONLN=0]) +AC_DEFINE_UNQUOTED(OPAL_HAVE__SC_NPROCESSORS_ONLN, + $OMPI_HAVE__SC_NPROCESSORS_ONLN, [Whether we have the _SC_NPROCESSORS_ONLN]) AC_MSG_RESULT([$MSG]) diff --git a/opal/mca/paffinity/darwin/configure.m4 b/opal/mca/paffinity/darwin/configure.m4 index e985fa409f..ce7dbfd1fe 100644 --- a/opal/mca/paffinity/darwin/configure.m4 +++ b/opal/mca/paffinity/darwin/configure.m4 @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2007 Cisco, Inc. All rights reserved. +# Copyright (c) 2007-2008 Cisco, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # $COPYRIGHT$ # @@ -22,18 +22,12 @@ # MCA_paffinity_darwin_CONFIG([action-if-found], [action-if-not-found]) # ----------------------------------------------------------- AC_DEFUN([MCA_paffinity_darwin_CONFIG],[ + OMPI_VAR_SCOPE_PUSH([happy]) # check to see if we have # as this is a Darwin-specific thing AC_CHECK_HEADER([mach/mach_host.h], [happy=yes], [happy=no]) - if test "$happy" = "yes"; then - AC_MSG_RESULT([$happy ]) - fi - - if test "$happy" = "yes"; then - $1 - else - $2 - fi + AS_IF([test "$happy" = "yes"], [$1], [$2]) + OMPI_VAR_SCOPE_POP ])dnl diff --git a/opal/mca/paffinity/posix/configure.m4 b/opal/mca/paffinity/posix/configure.m4 index fe711797e1..dac5ac7305 100644 --- a/opal/mca/paffinity/posix/configure.m4 +++ b/opal/mca/paffinity/posix/configure.m4 @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2007 Cisco, Inc. All rights reserved. +# Copyright (c) 2007-2008 Cisco, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # $COPYRIGHT$ # @@ -22,17 +22,18 @@ # MCA_paffinity_posix_CONFIG([action-if-found], [action-if-not-found]) # ----------------------------------------------------------- AC_DEFUN([MCA_paffinity_posix_CONFIG],[ - #check to see if we have + OMPI_VAR_SCOPE_PUSH([happy]) + # Check to see if we have AC_CHECK_HEADER([unistd.h], [happy=yes], [happy=no]) - if test "$happy" = "yes"; then - AC_MSG_RESULT([$happy ]) - fi + # Check to see if we have _SC_NPROCESSORS_ONLN + AS_IF([test "$happy" = "yes"], + [AC_MSG_CHECKING([for _SC_NPROCESSORS_ONLN]) + AS_IF([test "$OMPI_HAVE__SC_NPROCESSORS_ONLN" = "1"], + [happy=yes], [happy=no]) + AC_MSG_RESULT([(cached) $happy])]) - if test "$happy" = "yes"; then - $1 - else - $2 - fi + AS_IF([test "$happy" = "yes"], [$1], [$2]) + OMPI_VAR_SCOPE_POP ])dnl