Skip to content

Commit 76acb74

Browse files
authored
Merge pull request #8745 from bwbarrett/bugfix/treedata-libraries
Fix .la files leaking into wrapper compilers
2 parents 92389c3 + 6e799d0 commit 76acb74

File tree

2 files changed

+51
-101
lines changed

2 files changed

+51
-101
lines changed

config/opal_mca.m4

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dnl -*- shell-script -*-
1+
dnl -*- autoconf -*-
22
dnl
33
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
dnl 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....
704694
AC_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
])

config/opal_setup_wrappers.m4

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -383,54 +383,6 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
383383
AC_MSG_RESULT([$OPAL_WRAPPER_EXTRA_LIBS])
384384
])
385385

386-
m4_ifdef([project_orte], [
387-
AC_MSG_CHECKING([for ORTE CPPFLAGS])
388-
if test "$WANT_INSTALL_HEADERS" = "1" ; then
389-
ORTE_WRAPPER_EXTRA_CPPFLAGS='-I${includedir}/openmpi'
390-
fi
391-
ORTE_WRAPPER_EXTRA_CPPFLAGS="$ORTE_WRAPPER_EXTRA_CPPFLAGS $orte_mca_wrapper_extra_cppflags $wrapper_extra_cppflags $with_wrapper_cppflags"
392-
AC_SUBST([ORTE_WRAPPER_EXTRA_CPPFLAGS])
393-
AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_CPPFLAGS])
394-
395-
AC_MSG_CHECKING([for ORTE CFLAGS])
396-
ORTE_WRAPPER_EXTRA_CFLAGS="$wrapper_extra_cflags $with_wrapper_cflags"
397-
AC_SUBST([ORTE_WRAPPER_EXTRA_CFLAGS])
398-
AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_CFLAGS])
399-
400-
AC_MSG_CHECKING([for ORTE CFLAGS_PREFIX])
401-
ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX="$with_wrapper_cflags_prefix"
402-
AC_SUBST([ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX])
403-
AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX])
404-
405-
AC_MSG_CHECKING([for ORTE LDFLAGS])
406-
ORTE_WRAPPER_EXTRA_LDFLAGS="$orte_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags"
407-
RPATHIFY_LDFLAGS([ORTE_WRAPPER_EXTRA_LDFLAGS])
408-
AC_SUBST([ORTE_WRAPPER_EXTRA_LDFLAGS])
409-
AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_LDFLAGS])
410-
411-
# Convert @{libdir} to ${libdir} for pkg-config
412-
_OPAL_SETUP_WRAPPER_FINAL_PKGCONFIG([ORTE])
413-
414-
AC_MSG_CHECKING([for ORTE LIBS])
415-
ORTE_WRAPPER_EXTRA_LIBS="$orte_mca_wrapper_extra_libs"
416-
OPAL_FLAGS_APPEND_UNIQ([ORTE_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs])
417-
ORTE_WRAPPER_EXTRA_LIBS="$ORTE_WRAPPER_EXTRA_LIBS $with_wrapper_libs"
418-
AC_SUBST([ORTE_WRAPPER_EXTRA_LIBS])
419-
AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_LIBS])
420-
421-
m4_ifdef([project_ompi], [], [
422-
# these are used by orte_info/ompi_info (yes, they are named poorly)
423-
AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_CFLAGS, "$ORTE_WRAPPER_EXTRA_CFLAGS",
424-
[Additional CFLAGS to pass through the wrapper compilers])
425-
AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_CFLAGS_PREFIX, "$ORTE_WRAPPER_EXTRA_CFLAGS_PREFIX",
426-
[Additional CFLAGS_PREFIX to pass through the wrapper compilers])
427-
AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_LDFLAGS, "$ORTE_WRAPPER_EXTRA_LDFLAGS",
428-
[Additional LDFLAGS to pass through the wrapper compilers])
429-
AC_DEFINE_UNQUOTED(WRAPPER_EXTRA_LIBS, "$ORTE_WRAPPER_EXTRA_LIBS",
430-
[Additional LIBS to pass through the wrapper compilers])
431-
])
432-
])
433-
434386
m4_ifdef([project_ompi], [
435387
AC_MSG_CHECKING([for OMPI CPPFLAGS])
436388
if test "$WANT_INSTALL_HEADERS" = "1" ; then

0 commit comments

Comments
 (0)