1- dnl -* - shell-script -* -
1+ dnl -*- autoconf -*-
22dnl
33dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44dnl University Research and Technology
@@ -103,12 +103,10 @@ AC_DEFUN([OPAL_MCA],[
103103 type=$item
104104 fi
105105 if test -z $comp ; then
106- str=" ` echo DISABLE_${type} =1 | sed s/-/_/g` "
107- eval $str
106+ AS_VAR_COPY ( [ AS_TR_SH ( [ DISABLE_$type] ) ] , [ 1] )
108107 msg="$item $msg"
109108 else
110- str=" ` echo DISABLE_${type} _${comp} =1 | sed s/-/_/g` "
111- eval $str
109+ AS_VAR_COPY ( [ AS_TR_SH ( [ DISABLE_$type_$comp] ) ] , [ 1] )
112110 msg="$item $msg"
113111 fi
114112 done
@@ -151,8 +149,7 @@ AC_DEFUN([OPAL_MCA],[
151149 AC_MSG_ERROR ( [ *** The enable-mca-direct flag requires a
152150*** list of type-component pairs. Invalid input detected.] )
153151 else
154- str=" ` echo DIRECT_$type =$comp | sed s/-/_/g` "
155- eval $str
152+ AS_VAR_COPY ( [ AS_TR_SH ( [ DIRECT_$type] ) ] , [ AS_TR_SH ( [ $comp] ) ] )
156153 msg="$item $msg"
157154 fi
158155 done
@@ -187,8 +184,7 @@ AC_DEFUN([OPAL_MCA],[
187184 IFS="${IFS}$PATH_SEPARATOR,"
188185 msg=
189186 for item in $enable_mca_dso; do
190- str=" ` echo DSO_$item =1 | sed s/-/_/g` "
191- eval $str
187+ AS_VAR_COPY ( [ AS_TR_SH ( [ DSO_$item] ) ] , [ 1] )
192188 msg="$item $msg"
193189 done
194190 IFS="$ifs_save"
@@ -216,8 +212,7 @@ AC_DEFUN([OPAL_MCA],[
216212 IFS="${IFS}$PATH_SEPARATOR,"
217213 msg=
218214 for item in $enable_mca_static; do
219- str=" ` echo STATIC_$item =1 | sed s/-/_/g` "
220- eval $str
215+ AS_VAR_COPY ( [ AS_TR_SH ( [ STATIC_$item] ) ] , [ 1] )
221216 msg="$item $msg"
222217 done
223218 IFS="$ifs_save"
@@ -237,13 +232,8 @@ AC_DEFUN([OPAL_MCA],[
237232 MCA_PROJECT_SUBDIRS=
238233 MCA_PROJECT_DIST_SUBDIRS=
239234 m4_foreach ( mca_project , [ mca_project_list] ,
240- [# BWB: Until projects have separate configure scripts
241- # and can skip running all of ORTE, just avoid recursing
242- # into orte sub directory if orte disabled
243- if (test " mca_project" = " ompi" && test " $enable_mpi " ! = " no" ) || test " mca_project" = " opal" || test " mca_project" = " orte" || test " mca_project" = " oshmem" ; then
244- MCA_PROJECT_SUBDIRS=" $MCA_PROJECT_SUBDIRS mca_project"
245- MCA_PROJECT_DIST_SUBDIRS=" $MCA_PROJECT_DIST_SUBDIRS mca_project"
246- fi
235+ [ MCA_PROJECT_SUBDIRS="$MCA_PROJECT_SUBDIRS mca_project"
236+ MCA_PROJECT_DIST_SUBDIRS="$MCA_PROJECT_DIST_SUBDIRS mca_project"
247237 MCA_CONFIGURE_PROJECT(mca_project)] )
248238
249239 AC_SUBST ( MCA_PROJECT_SUBDIRS )
@@ -703,16 +693,10 @@ AC_DEFUN([MCA_CONFIGURE_ALL_CONFIG_COMPONENTS],[
703693# NOTE: component_name may not be determined until runtime....
704694AC_DEFUN ( [ MCA_COMPONENT_COMPILE_MODE] ,[
705695 SHARED_FRAMEWORK="$DSO_$2 "
706- AS_LITERAL_IF([$3 ],
707- [SHARED_COMPONENT=" $DSO_ $2 _$3 " ],
708- [str=" SHARED_COMPONENT=\$ DSO_$2 _$3 "
709- eval $str ])
696+ AS_VAR_COPY ( [ SHARED_COMPONENT] , [ DSO_$2 _$3 ] )
710697
711698 STATIC_FRAMEWORK="$STATIC_$2 "
712- AS_LITERAL_IF([$3 ],
713- [STATIC_COMPONENT=" $STATIC_ $2 _$3 " ],
714- [str=" STATIC_COMPONENT=\$ STATIC_$2 _$3 "
715- eval $str ])
699+ AS_VAR_COPY ( [ STATIC_COMPONENT] , [ DSO_$2 _$3 ] )
716700
717701 # Look for the most specific specifier between static/dso. If
718702 # there is a tie (either neither or both specified), prefer
@@ -741,6 +725,23 @@ AC_DEFUN([MCA_COMPONENT_COMPILE_MODE],[
741725 fi
742726] )
743727
728+ # OPAL_MCA_STRIP_LAFILES(output_variable(1),
729+ # input_list(2)
730+ # --------------------------------------------
731+ # Helper function to MCA_PROCESS_COMPONENT which will strip
732+ # any .la file entries in the LIBS list. Used for when copying
733+ # a component's LIBS into WRAPPER_LIBS.
734+ AC_DEFUN ( [ OPAL_MCA_STRIP_LAFILES] , [
735+ OPAL_VAR_SCOPE_PUSH([ opal_tmp] )
736+
737+ for arg in $2 ; do
738+ opal_tmp=`echo $arg | awk '{print substr ( [ $] [ 1] , length ( [ $] [ 1] ) - 2 ) }'`
739+ AS_IF ( [ test "$opal_tmp" != ".la"] ,
740+ [ AS_IF ( [ test -z "$$1 "] , [ $1 =$arg] , [ $1 ="$$1 $arg"] ) ] )
741+ done
742+
743+ OPAL_VAR_SCOPE_POP
744+ ] )
744745
745746# MCA_PROCESS_COMPONENT(project_name(1), framework_name (2), component_name (3),
746747# all_components_variable (4), static_components_variable (5)
@@ -812,26 +813,29 @@ AC_MSG_ERROR([*** $2 component $3 was supposed to be direct-called, but
812813 fi
813814 fi
814815
815- # if the component is building, add it's WRAPPER_EXTRA_LDFLAGS and
816- # WRAPPER_EXTRA_LIBS. If the component doesn't specify it's
817- # WRAPPER_EXTRA_LIBS and WRAPPER_EXTRA_LDFLAGS, try using LDFLAGS and LIBS if
818- # component didn't have it's own configure script (in which case,
819- # we know it didn't set LDFLAGS and LIBS because it can't) Don't
820- # have to do this if the component is building dynamically,
821- # because it will link against these (without a dependency from
822- # libmpi.so to these flags)
823- if test " $8 " = " static" ; then
824- AS_LITERAL_IF([$3 ],
825- [m4_foreach(flags, [LDFLAGS, LIBS],
826- [AS_IF([test " $$ 2_$3 _WRAPPER_EXTRA_]flags[" = " " ],
827- [OPAL_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$$ 2_$3 _]flags)],
828- [OPAL_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$$ 2_$3 _WRAPPER_EXTRA_]flags)])
829- ])],
830- [m4_foreach(flags, [LDFLAGS, LIBS],
831- [[str=" line= \$ $2 _$3 _WRAPPER_EXTRA_]flags[" ]
832- eval " $str "
833- OPAL_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$line ])])])
834- fi
816+ # If a component is building static, we need to provide LDFLAGS
817+ # and LIBS configuration to the wrapper compiler, so that it can
818+ # provide them for the final link of the application. Components
819+ # can explicitly set <framework>_<component>_WRAPPER_EXTRA_<flag>
820+ # for either LDFLAGS or LIBS, for cases where the component wants
821+ # to explicitly manage that behavior. If the full variable is not
822+ # defined, this macro will copy <framework>_<component>_<flag>
823+ # into the wrapper flags.
824+ AS_IF ( [ test "$8 " = "static"] ,
825+ [ m4_foreach ( flags , [ LDFLAGS, LIBS] ,
826+ [ m4_if ( flags , [ LIBS] ,
827+ [ OPAL_MCA_STRIP_LAFILES([ tmp_] flags, [ $$2 _$3 _] flags)] ,
828+ [ tmp_] flags [ =$$2 _$3 _] flags )
829+ AS_VAR_SET_IF ( [ $2 _$3 _WRAPPER_EXTRA_] flags ,
830+ [ OPAL_FLAGS_APPEND_UNIQ([ mca_wrapper_extra_] m4_tolower ( flags ) , [ $$2 _$3 _WRAPPER_EXTRA_] flags)] ,
831+ [ OPAL_FLAGS_APPEND_UNIQ([ mca_wrapper_extra_] m4_tolower ( flags ) , [ $tmp_] flags)] )
832+ dnl yes, this is weird indenting, but the
833+ dnl combination of m4_foreach and AS_VAR_SET_IF
834+ dnl will result in the closing of one if and the
835+ dnl start of the next on the same line, resulting
836+ dnl in parse errors, if this is not here.
837+ ] ) ] )
838+
835839
836840 # if needed, copy over WRAPPER_EXTRA_CPPFLAGS. Since a configure script
837841 # component can never be used in a STOP_AT_FIRST framework, we
@@ -930,13 +934,7 @@ AC_DEFUN([MCA_COMPONENT_BUILD_CHECK],[
930934
931935 # if we were explicitly disabled, don't build :)
932936 AS_IF ( [ test "$DISABLE_$2 " = "1"] , [ want_component=0] )
933- AS_LITERAL_IF([$3 ],
934- [AS_IF([test " $DISABLE_ $2 _$3 " = " 1" ], [want_component=0])],
935- [str=" DISABLED_COMPONENT_CHECK= \$ DISABLE_$2 _$3 "
936- eval $str
937- if test " $DISABLED_COMPONENT_CHECK " = " 1" ; then
938- want_component=0
939- fi])
937+ AS_VAR_IF ( [ DISABLE_$2 _$3 ] , [ 1] , [ want_component = 0] )
940938
941939 AS_IF ( [ test "$want_component" = "1"] , [ $4 ] , [ $5 ] )
942940] )
0 commit comments