From 6e4f33e48c1b8459cc556df9f08aa21da580750e Mon Sep 17 00:00:00 2001
From: Brian Barrett <brbarret@open-mpi.org>
Date: Sun, 10 Jul 2005 01:09:31 +0000
Subject: [PATCH] * after careful consideration, there's really no reason to
 force config.m4   components to succeed with --enable-dist.  Instead, just
 add them to   all_components and make dist will still work - we're going to
 stamp out   the Makefiles no matter what * Add missing header to ob1 pml for
 make dist * Clean up the Portals BTL configure code

This commit was SVN r6413.
---
 config/ompi_mca.m4                   |  28 ++---
 ompi/mca/btl/portals/configure.m4    | 164 +++++++++++++++------------
 ompi/mca/io/romio/configure.m4       |   1 -
 ompi/mca/pml/ob1/Makefile.am         |   2 +
 orte/mca/iof/null/configure.m4       |   5 +-
 orte/mca/pls/bproc_seed/configure.m4 |   2 +-
 orte/mca/pls/tm/configure.m4         |   2 +-
 orte/mca/pls/xgrid/configure.m4      |   2 +-
 orte/mca/ras/bjs/configure.m4        |   2 +-
 orte/mca/ras/lsf_bproc/configure.m4  |   2 +-
 orte/mca/ras/tm/configure.m4         |   2 +-
 orte/mca/ras/xgrid/configure.m4      |   2 +-
 12 files changed, 116 insertions(+), 98 deletions(-)

diff --git a/config/ompi_mca.m4 b/config/ompi_mca.m4
index 79406daab0..5bf1bbfcb1 100644
--- a/config/ompi_mca.m4
+++ b/config/ompi_mca.m4
@@ -425,22 +425,24 @@ AC_DEFUN([MCA_CONFIGURE_M4_CONFIG_COMPONENT],[
     MCA_COMPONENT_BUILD_CHECK($1, $2, $3, [should_build=1], [should_build=0])
     MCA_COMPONENT_COMPILE_MODE($1, $2, $3, compile_mode)
 
-    if test "$should_build" = "1" ; then
-        MCA_$2_$3_CONFIG([should_build=1], [should_build=0])
-    fi
+    # special case - if we are doing a dist, add the component to 
+    # the list of all components, even if the build failed.  The
+    # makefiles are going to be there no matter what, so no reason
+    # to make the components have to "artificially succeed"
+    AS_IF([test "$should_build" = "1"],
+          [MCA_$2_$3_CONFIG([should_build=1], 
+                            [should_build=0
+                             # add component to all component list
+                             $4="$$4 $3"])])
 
-    if test "$should_build" = "1" ; then
-        MCA_PROCESS_COMPONENT($1, $2, $3, $4, $5, $6, $7, $compile_mode)
-    else
-        MCA_PROCESS_DEAD_COMPONENT($1, $2, $3)
-    fi
+    AS_IF([test "$should_build" = "1"],
+          [MCA_PROCESS_COMPONENT($1, $2, $3, $4, $5, $6, $7, $compile_mode)],
+          [MCA_PROCESS_DEAD_COMPONENT($1, $2, $3)])
 
     # set the AM_CONDITIONAL on how we should build
-    if test "$compile_mode" = "dso" ; then
-        BUILD_$2_$3_DSO=1
-    else
-        BUILD_$2_$3_DSO=0
-    fi
+    AS_IF([test "$compile_mode" = "dso"], 
+          [BUILD_$2_$3_DSO=1],
+          [BUILD_$2_$3_DSO=0])
     AM_CONDITIONAL(OMPI_BUILD_$2_$3_DSO, test "$BUILD_$2_$3_DSO" = "1")
 
     unset compile_mode
diff --git a/ompi/mca/btl/portals/configure.m4 b/ompi/mca/btl/portals/configure.m4
index ece2de8fc8..16848e5a79 100644
--- a/ompi/mca/btl/portals/configure.m4
+++ b/ompi/mca/btl/portals/configure.m4
@@ -15,16 +15,11 @@
 # $HEADER$
 #
 
-#
-# quicky function to set #defines based on argument values
-#
-# ARGUMENTS:
-#  1    configure name (first argument to ARG_WITH, minus the btl-portals-)
-#  2    define name
-#  3    default value
-#  4    description (used for both ARG_WITH and DEFINE)
-AC_DEFUN([MCA_BTL_PORTALS_CONFIG_VAL],
-[
+
+# _MCA_btl_portals_config_val(config_name, define_name, 
+#                             default_val, descrtiption)
+# -----------------------------------------------------
+AC_DEFUN([MCA_btl_portals_CONFIG_VAL], [
     AC_ARG_WITH([btl-portals-$1], AC_HELP_STRING([--with-btl-portals-$1], 
                 [$4 (default: $3)]))
     AC_MSG_CHECKING([for $1 value])
@@ -43,28 +38,65 @@ AC_DEFUN([MCA_BTL_PORTALS_CONFIG_VAL],
             ;;
     esac
     AC_DEFINE_UNQUOTED([$2], [[$]$2], [$4])
-])dnl
+])
 
 
-AC_DEFUN([MCA_btl_portals_CONFIG],[
+# _MCA_btl_portals_CONFIG_VALS()
+# ------------------------------
+AC_DEFUN([MCA_btl_portals_CONFIG_VALS], [
+    # User configuration options
+    MCA_btl_portals_CONFIG_VAL([send-table-id],
+        [BTL_PORTALS_SEND_TABLE_ID], [3],
+        [Portals table id to use for send/recv ])
 
-    btl_portals_save_CPPFLAGS="$CPPFLAGS"
-    btl_portals_save_LDFLAGS="$LDFLAGS"
-    btl_portals_save_LIBS="$LIBS"
+    MCA_btl_portals_CONFIG_VAL([rdma-table-id],
+        [BTL_PORTALS_RDMA_TABLE_ID], [4],
+        [Portals table id to use for RDMA request])
 
-    # allow user a way to say where the Portals installation is
-    AC_ARG_WITH(btl-portals, 
-        AC_HELP_STRING([--with-btl-portals=DIR],
-                       [Specify the installation directory of PORTALS]))
+    MCA_btl_portals_CONFIG_VAL([debug-level],
+        [BTL_PORTALS_DEFAULT_DEBUG_LEVEL], [100],
+        [debugging level for portals btl])
 
-    AS_IF([test -n "$with_btl_portals"],
-          [AS_IF([test -d "$with_btl_portals/include"],
-                 [btl_portals_CPPFLAGS="-I$with_btl_portals/include"
-                  CPPFLAGS="$CPPFLAGS $btl_portals_CPPFLAGS"], [])
-           AS_IF([test -d "$with_btl_portals/lib"],
-                 [btl_portals_LDFLAGS="-L$with_btl_portals/lib"
-                  LDFLAGS="$LDFLAGS $btl_portals_LDFLAGS"], [])])
+    MCA_btl_portals_CONFIG_VAL([eager-limit],
+        [BTL_PORTALS_DEFAULT_EAGER_LIMIT], [16384],
+        [max size for eager sends])
 
+    MCA_btl_portals_CONFIG_VAL([min-send-size],
+        [BTL_PORTALS_DEFAULT_MIN_SEND_SIZE], [0],
+        [min size for send fragments])
+    MCA_btl_portals_CONFIG_VAL([max-send-size],
+        [BTL_PORTALS_DEFAULT_MAX_SEND_SIZE], [32768],
+        [max size for send fragments])
+
+    MCA_btl_portals_CONFIG_VAL([min-rdma-size],
+        [BTL_PORTALS_DEFAULT_MIN_RDMA_SIZE], [0],
+        [min size for rdma fragments])
+    MCA_btl_portals_CONFIG_VAL([max-rdma-size],
+        [BTL_PORTALS_DEFAULT_MAX_RDMA_SIZE], [2147483647],
+        [max size for rdma fragments])
+
+    MCA_btl_portals_CONFIG_VAL([max-sends-pending],
+        [BTL_PORTALS_MAX_SENDS_PENDING], [128],
+        [max number of sends pending at any time])
+    MCA_btl_portals_CONFIG_VAL([recv-queue-size],
+        [BTL_PORTALS_DEFAULT_RECV_QUEUE_SIZE], [512],
+        [size of event queue for receiving frags])
+
+    MCA_btl_portals_CONFIG_VAL([free-list-init-num],
+        [BTL_PORTALS_DEFAULT_FREE_LIST_INIT_NUM], [8],
+        [starting size of free lists])
+    MCA_btl_portals_CONFIG_VAL([free-list-max-num],
+        [BTL_PORTALS_DEFAULT_FREE_LIST_MAX_NUM], [1024],
+        [maximum size of free lists])
+    MCA_btl_portals_CONFIG_VAL([free-list-inc-num],
+        [BTL_PORTALS_DEFAULT_FREE_LIST_INC_NUM], [32],
+        [grow size for freelists])
+])
+
+
+# _MCA_btl_portals_CONFIG_PLATFORM()
+# ----------------------------------
+AC_DEFUN([MCA_btl_portals_CONFIG_PLATFORM], [
     # Configure Portals for our local environment
     BTL_PORTALS_UTCP=0
     BTL_PORTALS_REDSTORM=0
@@ -120,61 +152,43 @@ AC_DEFUN([MCA_btl_portals_CONFIG],[
     AC_DEFINE_UNQUOTED([BTL_PORTALS_REDSTORM], [$BTL_PORTALS_REDSTORM],
                        [Use the Red Storm implementation or Portals])
     AM_CONDITIONAL([BTL_PORTALS_REDSTORM], [test "$BTL_PORTALS_REDSTORM" = "1"])
+])
 
+
+# MCA_btl_portals_CONFIG(action-if-can-compile, 
+#                        [action-if-cant-compile])
+# ------------------------------------------------
+AC_DEFUN([MCA_btl_portals_CONFIG],[
+    # save compiler flags so that we don't alter them for later
+    # components.
+    btl_portals_save_CPPFLAGS="$CPPFLAGS"
+    btl_portals_save_LDFLAGS="$LDFLAGS"
+    btl_portals_save_LIBS="$LIBS"
+
+    # allow user a way to say where the Portals installation is
+    AC_ARG_WITH(btl-portals, 
+        AC_HELP_STRING([--with-btl-portals=DIR],
+                       [Specify the installation directory of PORTALS]))
+
+    AS_IF([test -n "$with_btl_portals"],
+          [AS_IF([test -d "$with_btl_portals/include"],
+                 [btl_portals_CPPFLAGS="-I$with_btl_portals/include"
+                  CPPFLAGS="$CPPFLAGS $btl_portals_CPPFLAGS"], [])
+           AS_IF([test -d "$with_btl_portals/lib"],
+                 [btl_portals_LDFLAGS="-L$with_btl_portals/lib"
+                  LDFLAGS="$LDFLAGS $btl_portals_LDFLAGS"], [])])
+
+    # try to get our platform configuration
+    MCA_btl_portals_CONFIG_PLATFORM()
+
+    # check for portals
     LIBS="$LIBS $btl_portals_LIBS"
     AC_CHECK_HEADERS([portals3.h],
         [AC_MSG_CHECKING([if possible to link Portals application])
          AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <portals3.h>], 
                                          [int i; PtlInit(&i);])],
               [AC_MSG_RESULT([yes])
-               # User configuration options
-               MCA_BTL_PORTALS_CONFIG_VAL([send-table-id],
-                   [BTL_PORTALS_SEND_TABLE_ID], [3],
-                   [Portals table id to use for send/recv ])
-
-               MCA_BTL_PORTALS_CONFIG_VAL([rdma-table-id],
-                   [BTL_PORTALS_RDMA_TABLE_ID], [4],
-                   [Portals table id to use for RDMA request])
-
-               MCA_BTL_PORTALS_CONFIG_VAL([debug-level],
-                   [BTL_PORTALS_DEFAULT_DEBUG_LEVEL], [100],
-                   [debugging level for portals btl])
-
-               MCA_BTL_PORTALS_CONFIG_VAL([eager-limit],
-                   [BTL_PORTALS_DEFAULT_EAGER_LIMIT], [16384],
-                   [max size for eager sends])
-
-               MCA_BTL_PORTALS_CONFIG_VAL([min-send-size],
-                   [BTL_PORTALS_DEFAULT_MIN_SEND_SIZE], [0],
-                   [min size for send fragments])
-               MCA_BTL_PORTALS_CONFIG_VAL([max-send-size],
-                   [BTL_PORTALS_DEFAULT_MAX_SEND_SIZE], [32768],
-                   [max size for send fragments])
-
-               MCA_BTL_PORTALS_CONFIG_VAL([min-rdma-size],
-                   [BTL_PORTALS_DEFAULT_MIN_RDMA_SIZE], [0],
-                   [min size for rdma fragments])
-               MCA_BTL_PORTALS_CONFIG_VAL([max-rdma-size],
-                   [BTL_PORTALS_DEFAULT_MAX_RDMA_SIZE], [2147483647],
-                   [max size for rdma fragments])
-
-               MCA_BTL_PORTALS_CONFIG_VAL([max-sends-pending],
-                   [BTL_PORTALS_MAX_SENDS_PENDING], [128],
-                   [max number of sends pending at any time])
-               MCA_BTL_PORTALS_CONFIG_VAL([recv-queue-size],
-                   [BTL_PORTALS_DEFAULT_RECV_QUEUE_SIZE], [512],
-                   [size of event queue for receiving frags])
-
-               MCA_BTL_PORTALS_CONFIG_VAL([free-list-init-num],
-                   [BTL_PORTALS_DEFAULT_FREE_LIST_INIT_NUM], [8],
-                   [starting size of free lists])
-               MCA_BTL_PORTALS_CONFIG_VAL([free-list-max-num],
-                   [BTL_PORTALS_DEFAULT_FREE_LIST_MAX_NUM], [1024],
-                   [maximum size of free lists])
-               MCA_BTL_PORTALS_CONFIG_VAL([free-list-inc-num],
-                   [BTL_PORTALS_DEFAULT_FREE_LIST_INC_NUM], [32],
-                   [grow size for freelists])
-          
+               MCA_btl_portals_CONFIG_VALS()          
                btl_portals_WRAPPER_EXTRA_LDFLAGS="$btl_portals_LDFLAGS"
                btl_portals_WRAPPER_EXTRA_LIBS="$btl_portals_LIBS"
                $1],
@@ -182,10 +196,12 @@ AC_DEFUN([MCA_btl_portals_CONFIG],[
                $2])],
         [$2])
 
+    # substitute in the things needed to build Portals
     AC_SUBST([btl_portals_CPPFLAGS])
     AC_SUBST([btl_portals_LDFLAGS])
     AC_SUBST([btl_portals_LIBS])
 
+    # reset the flags for the next test
     CPPFLAGS="$btl_portals_save_CPPFLAGS"
     LDFLAGS="$btl_portals_save_LDFLAGS"
     LIBS="$btl_portals_save_LIBS"
diff --git a/ompi/mca/io/romio/configure.m4 b/ompi/mca/io/romio/configure.m4
index a709c13fde..047ea992b1 100644
--- a/ompi/mca/io/romio/configure.m4
+++ b/ompi/mca/io/romio/configure.m4
@@ -54,6 +54,5 @@ AC_DEFUN([MCA_io_romio_CONFIG],[
                   $1],
                  [LIBS="$io_romio_LIBS"
                   AC_MSG_WARN([ROMIO distribution did not configure successfully])
-                  AS_IF([test "$OMPI_WANT_DIST" != "no"], [AC_MSG_ERROR([can not continue])])
                   $2])])
 ])
diff --git a/ompi/mca/pml/ob1/Makefile.am b/ompi/mca/pml/ob1/Makefile.am
index 5bd17b1ada..d72453ba42 100644
--- a/ompi/mca/pml/ob1/Makefile.am
+++ b/ompi/mca/pml/ob1/Makefile.am
@@ -20,10 +20,12 @@ ob1_sources  = \
 	pml_ob1.c \
 	pml_ob1.h \
 	pml_ob1_comm.c \
+	pml_ob1_comm.h \
 	pml_ob1_component.c \
 	pml_ob1_component.h \
 	pml_ob1_endpoint.c \
 	pml_ob1_endpoint.h \
+	pml_ob1_hdr.h \
 	pml_ob1_iprobe.c \
 	pml_ob1_irecv.c \
 	pml_ob1_isend.c \
diff --git a/orte/mca/iof/null/configure.m4 b/orte/mca/iof/null/configure.m4
index 6b7dc0441d..dde1770993 100644
--- a/orte/mca/iof/null/configure.m4
+++ b/orte/mca/iof/null/configure.m4
@@ -27,8 +27,7 @@ AC_DEFUN([MCA_iof_null_CONFIG],[
 
     OMPI_CHECK_TM([iof_null], [iof_null_good=1], [iof_null_good=0])
          
-    # don't need to set any flags - there's no XGrid-using code in this
+    # don't need to set any flags - there's no TM-using code in this
     # component
-    AS_IF([test "$iof_null_good" = "0" -a "$OMPI_WANT_DIST" = "no"], [$2],
-          [$1])
+    AS_IF([test "$iof_null_good" = "1"], [$1], [$2])
 ])dnl
diff --git a/orte/mca/pls/bproc_seed/configure.m4 b/orte/mca/pls/bproc_seed/configure.m4
index 2675ecae79..d55f100ff1 100644
--- a/orte/mca/pls/bproc_seed/configure.m4
+++ b/orte/mca/pls/bproc_seed/configure.m4
@@ -22,7 +22,7 @@ AC_DEFUN([MCA_pls_bproc_seed_CONFIG],[
     # For very dumb reasons involving linking, it's near impossible
     # to build the XGrid components as static libraries.  Disable if that's
     # the case.
-    AS_IF([test "$pls_bproc_seed_good" = "0" -a "$OMPI_WANT_DIST" = "no"], [$2],
+    AS_IF([test "$pls_bproc_seed_good" = "0"], [$2],
           [pls_bproc_seed_WRAPPER_EXTRA_LDFLAGS="$pls_bproc_seed_LDFLAGS"
            pls_bproc_seed_WRAPPER_EXTRA_LIBS="$pls_bproc_seed_LIBS"
            $1])
diff --git a/orte/mca/pls/tm/configure.m4 b/orte/mca/pls/tm/configure.m4
index f58e6ffd4f..d1221de891 100644
--- a/orte/mca/pls/tm/configure.m4
+++ b/orte/mca/pls/tm/configure.m4
@@ -18,7 +18,7 @@
 AC_DEFUN([MCA_pls_tm_CONFIG],[
     OMPI_CHECK_TM([pls_tm], [pls_tm_good=1], [pls_tm_good=0])
          
-    AS_IF([test "$pls_tm_good" = "0" -a "$OMPI_WANT_DIST" = "no"], [$2],
+    AS_IF([test "$pls_tm_good" = "0"], [$2],
           [pls_tm_WRAPPER_EXTRA_LDFLAGS="$pls_tm_LDFLAGS"
            pls_tm_WRAPPER_EXTRA_LIBS="$pls_tm_LIBS"
            $1])
diff --git a/orte/mca/pls/xgrid/configure.m4 b/orte/mca/pls/xgrid/configure.m4
index 971474f6ef..1bb7da3336 100644
--- a/orte/mca/pls/xgrid/configure.m4
+++ b/orte/mca/pls/xgrid/configure.m4
@@ -21,7 +21,7 @@ AC_DEFUN([MCA_pls_xgrid_CONFIG],[
     # For very dumb reasons involving linking, it's near impossible
     # to build the XGrid components as static libraries.  Disable if that's
     # the case.
-    AS_IF([test "$pls_xgrid_good" = "0" -a "$OMPI_WANT_DIST" = "no"], [$2],
+    AS_IF([test "$pls_xgrid_good" = "0"], [$2],
           [AS_IF([test "$compile_mode" = "dso"],
                   [ # pls_xgrid_LDFLAGS will be set by OMPI_CHECK_XGRID
                    pls_xgrid_WRAPPER_EXTRA_LDFLAGS="$pls_xgrid_LDFLAGS"
diff --git a/orte/mca/ras/bjs/configure.m4 b/orte/mca/ras/bjs/configure.m4
index e64632c3ca..61e2401965 100644
--- a/orte/mca/ras/bjs/configure.m4
+++ b/orte/mca/ras/bjs/configure.m4
@@ -21,7 +21,7 @@ AC_DEFUN([MCA_ras_bjs_CONFIG],[
     # For very dumb reasons involving linking, it's near impossible
     # to build the XGrid components as static libraries.  Disable if that's
     # the case.
-    AS_IF([test "$ras_bjs_good" = "0" -a "$OMPI_WANT_DIST" = "no"], [$2],
+    AS_IF([test "$ras_bjs_good" = "0"], [$2],
           [ras_bjs_WRAPPER_EXTRA_LDFLAGS="$ras_bjs_LDFLAGS"
            ras_bjs_WRAPPER_EXTRA_LIBS="$ras_bjs_LIBS"
            $1])
diff --git a/orte/mca/ras/lsf_bproc/configure.m4 b/orte/mca/ras/lsf_bproc/configure.m4
index 25b0ab3515..9e7fcd27a5 100644
--- a/orte/mca/ras/lsf_bproc/configure.m4
+++ b/orte/mca/ras/lsf_bproc/configure.m4
@@ -21,7 +21,7 @@ AC_DEFUN([MCA_ras_lsf_bproc_CONFIG],[
     # For very dumb reasons involving linking, it's near impossible
     # to build the XGrid components as static libraries.  Disable if that's
     # the case.
-    AS_IF([test "$ras_lsf_bproc_good" = "0" -a "$OMPI_WANT_DIST" = "no"], [$2],
+    AS_IF([test "$ras_lsf_bproc_good" = "0"], [$2],
           [ras_lsf_bproc_WRAPPER_EXTRA_LDFLAGS="$ras_lsf_bproc_LDFLAGS"
            ras_lsf_bproc_WRAPPER_EXTRA_LIBS="$ras_lsf_bproc_LIBS"
            $1])
diff --git a/orte/mca/ras/tm/configure.m4 b/orte/mca/ras/tm/configure.m4
index dd1b780806..fedcb72af8 100644
--- a/orte/mca/ras/tm/configure.m4
+++ b/orte/mca/ras/tm/configure.m4
@@ -18,7 +18,7 @@
 AC_DEFUN([MCA_ras_tm_CONFIG],[
     OMPI_CHECK_TM([ras_tm], [ras_tm_good=1], [ras_tm_good=0])
          
-    AS_IF([test "$ras_tm_good" = "0" -a "$OMPI_WANT_DIST" = "no"], [$2],
+    AS_IF([test "$ras_tm_good" = "0"], [$2],
           [ras_tm_WRAPPER_EXTRA_LDFLAGS="$ras_tm_LDFLAGS"
            ras_tm_WRAPPER_EXTRA_LIBS="$ras_tm_LIBS"
            $1])
diff --git a/orte/mca/ras/xgrid/configure.m4 b/orte/mca/ras/xgrid/configure.m4
index fbe8628f22..3df039ba43 100644
--- a/orte/mca/ras/xgrid/configure.m4
+++ b/orte/mca/ras/xgrid/configure.m4
@@ -22,7 +22,7 @@ AC_DEFUN([MCA_ras_xgrid_CONFIG],[
     # component.  For very dumb reasons involving linking, it's near impossible
     # to build the XGrid components as static libraries.  Disable if that's
     # the case.
-    AS_IF([test "$ras_xgrid_good" = "0" -a "$OMPI_WANT_DIST" = "no"], [$2],
+    AS_IF([test "$ras_xgrid_good" = "0"], [$2],
           [AS_IF([test "$compile_mode" = "dso"], [$1], 
                  [AC_MSG_WARN([XGrid components must be built as DSOs.  Disabling])
                   $2])])