dnl -*- shell-script -*- dnl dnl Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana dnl University Research and Technology dnl Corporation. All rights reserved. dnl Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow dnl dnl $HEADER$ dnl ###################################################################### # # OMPI_EXT # # configure the Interface Extensions [similar to MCA version]. Works hand in # hand with Open MPI's autogen.sh, requiring it's specially formatted lists # of frameworks, components, etc. # # USAGE: # OMPI_EXT() # ###################################################################### AC_DEFUN([OMPI_EXT],[ dnl for OMPI_CONFIGURE_USER env variable AC_REQUIRE([OMPI_CONFIGURE_SETUP]) # Note that we do not build DSO's here -- we *only* build convenience # libraries that get slurped into higher-level libraries # # [default -- no option given] = No extensions built # --enable-mpi-ext=[,]*EXTENSION[,]* # AC_ARG_ENABLE(mpi-ext, AC_HELP_STRING([--enable-mpi-ext[=LIST]], [Comma-separated list of extensions that should be built (default: none).])) AC_MSG_CHECKING([which extension components should be enabled]) if test "$enable_mpi_ext" = "yes"; then msg="All Extensions" str="`echo ENABLE_EXT_ALL=1`" eval $str else ifs_save="$IFS" IFS="${IFS}$PATH_SEPARATOR," msg= for item in $enable_mpi_ext; do type="`echo $item | cut -s -f1 -d-`" if test -z $type ; then type=$item fi str="`echo ENABLE_${type}=1 | sed s/-/_/g`" eval $str msg="$item $msg" done IFS="$ifs_save" fi AC_MSG_RESULT([$msg]) unset msg AC_MSG_CHECKING([for projects containing EXT frameworks]) AC_MSG_RESULT([ext_project_list]) # if there isn't a project list, abort m4_ifdef([ext_project_list], [], [m4_fatal([Could not find project list - rerun autogen.sh without -l])]) # now configre all the projects, frameworks, and components. Most # of the hard stuff is in here EXT_PROJECT_SUBDIRS= m4_foreach(ext_project, [ext_project_list], [EXT_PROJECT_SUBDIRS="$EXT_PROJECT_SUBDIRS ext_project" EXT_CONFIGURE_PROJECT(ext_project) ]) # make all the config output statements for the no configure # components EXT_NO_CONFIG_CONFIG_FILES() AC_SUBST(EXT_C_HEADERS) AC_SUBST(EXT_CXX_HEADERS) AC_SUBST(EXT_F77_HEADERS) AC_SUBST(EXT_F90_HEADERS) AC_SUBST(EXT_C_LIBS) AC_SUBST(EXT_CXX_LIBS) AC_SUBST(EXT_F77_LIBS) AC_SUBST(EXT_F90_LIBS) AC_SUBST(EXT_PROJECT_SUBDIRS) ]) ###################################################################### # # EXT_CONFIGURE_PROJECT # # Configure all frameworks inside the given project name. Assumes that # the frameworks are located in [project_name]/[frameworks] and that # there is an m4_defined list named ext_[project]_framework_list with # the list of frameworks. # # USAGE: # EXT_CONFIGURE_PROJECT(project_name) # ###################################################################### AC_DEFUN([EXT_CONFIGURE_PROJECT],[ # can't use a variable rename here because these need to be evaled # at auto* time. ompi_show_subtitle "Configuring EXT for $1" AC_MSG_CHECKING([for frameworks for $1]) AC_MSG_RESULT([ext_$1_framework_list]) # iterate through the list of frameworks. There is something # funky with m4 foreach if the list is defined, but empty. It # will call the 3rd argument once with an empty value for the # first argument. Protect against calling EXT_CONFIGURE_FRAMEWORK # with an empty second argument. Grrr.... # if there isn't a project list, abort # # Also setup two variables for Makefiles: # EXT_project_FRAMEWORKS - list of frameworks in that project # EXT_project_FRAMEWORK_LIBS - list of libraries (or variables pointing # to more libraries) that must be included # in the project's main library m4_ifdef([ext_$1_framework_list], [_EXT_CONFIGURE_PROJECT($1)], [echo No EXT frameworks for $1 - skipped]) ])dnl ###################################################################### # # _EXT_CONFIGURE_PROJECT # # Back end for EXT_CONFIGURE_PROJECT # # USAGE: # _EXT_CONFIGURE_PROJECT(project_name) # ###################################################################### AC_DEFUN([_EXT_CONFIGURE_PROJECT],[ EXT_$1_FRAMEWORKS= EXT_$1_FRAMEWORKS_SUBDIRS= EXT_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS= EXT_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS= EXT_$1_FRAMEWORK_LIBS= m4_foreach(ext_framework, [ext_$1_framework_list], [m4_ifval(ext_framework, [ EXT_$1_FRAMEWORKS="$EXT_$1_FRAMEWORKS ext_framework" EXT_$1_FRAMEWORKS_SUBDIRS="$EXT_$1_FRAMEWORKS_SUBDIRS ext_framework" EXT_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS="$EXT_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS [\$(EXT_]ext_framework[_ALL_SUBDIRS)]" EXT_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS="$EXT_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS [\$(EXT_]ext_framework[_STATIC_SUBDIRS)]" EXT_$1_FRAMEWORK_LIBS="$EXT_$1_FRAMEWORK_LIBS [\$(EXT_]ext_framework[_STATIC_LTLIBS)]" m4_ifdef([EXT_]ext_framework[_CONFIG], [EXT_]ext_framework[_CONFIG]($1, ext_framework), [EXT_CONFIGURE_FRAMEWORK($1, ext_framework, 1)])])]) AC_SUBST(EXT_$1_FRAMEWORKS) AC_SUBST(EXT_$1_FRAMEWORKS_SUBDIRS) AC_SUBST(EXT_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS) AC_SUBST(EXT_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS) AC_SUBST(EXT_$1_FRAMEWORK_LIBS) ]) ###################################################################### # # EXT_CONFIGURE_FRAMEWORK # # Configure the given framework and all components inside the # framework. Assumes that the framework is located in # [project_name]/[framework], and that all components are # available under the framework directory. Will configure all # no-configure and builtin components, then search for components with # configure scripts. Assumes that no component is marked as builtin # AND has a configure script. # # USAGE: # EXT_CONFIGURE_PROJECT(project_name, framework_name, allow_succeed) # ###################################################################### AC_DEFUN([EXT_CONFIGURE_FRAMEWORK],[ ompi_show_subsubtitle "Configuring EXT framework $2" OMPI_VAR_SCOPE_PUSH([all_components outfile outfile_real]) # setup for framework all_components= static_components= static_ltlibs= outdir=$1/include # first create the output include directory mkdir -p $outdir # remove any previously generated #include files mpi_ext_h=$outdir/mpi-ext.h rm -f $mpi_ext_h # Create the final mpi-ext.h file. cat > $mpi_ext_h <> $mpi_ext_h <__CONFIG # macro, print a friendly warning and abort. [AC_MSG_WARN([*** The $2:$3 did not define an]) AC_MSG_WARN([*** EXT_$2_$3_CONFIG macro in the]) AC_MSG_WARN([*** $1/$2/$3/configure.m4 file]) AC_MSG_ERROR([Cannot continue])]) ]) AS_IF([test "$should_build" = "1"], [EXT_PROCESS_COMPONENT($1, $2, $3, $4, $6, $compile_mode) # add component to static component list $5="$$5 $3" ], [EXT_PROCESS_DEAD_COMPONENT($1, $2, $3) # add component to all component list $4="$$4 $3"]) m4_ifdef([EXT_$2_$3_POST_CONFIG], [EXT_$2_$3_POST_CONFIG($should_build)]) AS_IF([test "$should_build" = "1"],[$8], [$9]) unset compile_mode ]) ###################################################################### # # EXT_CONFIGURE_ALL_CONFIG_COMPONENTS # # configure all components in the given framework that have configure # scripts and should be configured according to the usual rules... # # USAGE: # EXT_CONFIGURE_ALL_CONFIG_COMPONENTS(project_name, # framework_name, # all_components_variable, # static_ltlibs_variable) # ###################################################################### AC_DEFUN([EXT_CONFIGURE_ALL_CONFIG_COMPONENTS],[ for component_path in $srcdir/$1/$2/* ; do component="`basename $component_path`" if test -d $component_path -a -x $component_path/configure ; then ompi_show_subsubsubtitle "EXT component $2:$component (need to configure)" EXT_COMPONENT_BUILD_CHECK($1, $2, $component, [should_build=1], [should_build=0]) EXT_COMPONENT_COMPILE_MODE($1, $2, $component, compile_mode) if test "$should_build" = "1" ; then OMPI_CONFIG_SUBDIR([$1/$2/$component], [$ompi_subdir_args], [should_build=1], [should_build=2]) fi if test "$should_build" = "1" ; then EXT_PROCESS_COMPONENT($1, $2, $component, $3, $4, $compile_mode) else EXT_PROCESS_DEAD_COMPONENT($1, $2, $component) fi fi done ]) ###################################################################### # # EXT_COMPONENT_COMPILE_MODE # # set compile_mode_variable to the compile mode for the given component # # USAGE: # EXT_COMPONENT_COMPILE_MODE(project_name, # framework_name, component_name # compile_mode_variable) # # NOTE: component_name may not be determined until runtime.... # ###################################################################### AC_DEFUN([EXT_COMPONENT_COMPILE_MODE],[ project=$1 framework=$2 component=$3 # Extensions are always static, no need for further checks $4="static" #AC_MSG_CHECKING([for EXT component $framework:$component compile mode]) #AC_MSG_RESULT([$$4]) ]) ###################################################################### # # EXT_PROCESS_COMPONENT # # does all setup work for given component. It should be known before # calling that this component can build properly (and exists) # # USAGE: # EXT_CONFIGURE_ALL_CONFIG_COMPONENTS(project_name, # framework_name, component_name # all_components_variable (4), # static_ltlibs_variable (5), # compile_mode_variable (6)) # # NOTE: component_name may not be determined until runtime.... # # M4 directive to disable language support in configure.m4 # Need to build a list of .la for each lang. to pull into final library # List ext_c_headers, ext_c_libs {same for other lang.} # C: framework_component_c{.h, .la} # CXX: framework_component_cxx{.h, .la} # F77: framework_component_f77{.h, .la} # F90: framework_component_f90{.h, .la} ??? ###################################################################### AC_DEFUN([EXT_PROCESS_COMPONENT],[ AC_REQUIRE([AC_PROG_GREP]) project=$1 framework=$2 component=$3 # Output pretty results AC_MSG_CHECKING([if EXT component $framework:$component can compile]) AC_MSG_RESULT([yes]) # Save the list of headers and convenience libraries that this component will output # There *must* be C bindings EXT_C_HEADERS="$EXT_C_HEADERS $framework/$component/${framework}_${component}_c.h" EXT_C_LIBS="$EXT_C_LIBS $framework/$component/libext_${framework}_${component}.la" component_header="${framework}_${component}_c.h" tmp[=]m4_translit([$3],[a-z],[A-Z]) component_define="OMPI_HAVE_MPI_EXT_${tmp}" cat >> $mpi_ext_h <