@@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California.
12
12
dnl All rights reserved.
13
13
dnl Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved.
14
14
dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
15
- dnl Copyright (c) 2015 Research Organization for Information Science
15
+ dnl Copyright (c) 2015-2016 Research Organization for Information Science
16
16
dnl and Technology (RIST). All rights reserved.
17
17
dnl Copyright (c) 2016 IBM Corporation. All rights reserved.
18
18
dnl $COPYRIGHT $
173
173
174
174
AS_IF([test -n " $rpath_args " ],
175
175
[WRAPPER_RPATH_SUPPORT= rpath
176
- AC_MSG_RESULT([yes ($rpath_args )])],
176
+ cat > $rpath_script << EOF
177
+ #! /bin/sh
178
+
179
+ # Slurp in the libtool config into my environment
180
+
181
+ # Apparently, "libtoool --config" calls "exit", so we can't source it
182
+ # (because if script A sources script B, and B calls "exit", then both
183
+ # B and A will exit). Instead, we have to send the output to a file
184
+ # and then source that.
185
+ $OPAL_TOP_BUILDDIR /libtool --tag= FC --config > $rpath_outfile
186
+
187
+ chmod +x $rpath_outfile
188
+ . ./$rpath_outfile
189
+ rm -f $rpath_outfile
190
+
191
+ # Evaluate \$hardcode_libdir_flag_spec, and substitute in LIBDIR for \$libdir
192
+ libdir= LIBDIR
193
+ flags= " \` eval echo \$ hardcode_libdir_flag_spec\` "
194
+ echo \$ flags
195
+
196
+ # Done
197
+ exit 0
198
+ EOF
199
+ chmod +x $rpath_script
200
+ rpath_fc_args= ` ./$rpath_script `
201
+ rm -f $rpath_script
202
+ AC_MSG_RESULT([yes ($rpath_args + $rpath_fc_args )])],
177
203
[WRAPPER_RPATH_SUPPORT= unnecessary
178
204
AC_MSG_RESULT([yes (no extra flags needed)])])
179
205
192
218
# If DT_RUNPATH is supported, then we'll use *both* the RPATH and
193
219
# RUNPATH flags in the LDFLAGS.
194
220
AC_DEFUN([OPAL_SETUP_RUNPATH],[
195
- OPAL_VAR_SCOPE_PUSH([LDFLAGS_save])
221
+ OPAL_VAR_SCOPE_PUSH([LDFLAGS_save rpath_script rpath_outfile wl_fc ])
196
222
197
223
AC_MSG_CHECKING([if linker supports RUNPATH])
198
224
# Set the output in $runpath_args
@@ -206,6 +232,45 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[
206
232
AC_MSG_RESULT([yes (-Wl,--enable-new-dtags)])],
207
233
[AC_MSG_RESULT([no])])
208
234
AC_LANG_POP([C])
235
+ m4_ifdef([project_ompi],[
236
+ # Output goes into globally-visible $rpath_args. Run this in a
237
+ # sub-process so that we don't pollute the current process
238
+ # environment.
239
+ rpath_script= conftest.$$ .sh
240
+ rpath_outfile= conftest.$$ .out
241
+ rm -f $rpath_script $rpath_outfile
242
+ cat > $rpath_script << EOF
243
+ #! /bin/sh
244
+
245
+ # Slurp in the libtool config into my environment
246
+
247
+ # Apparently, "libtoool --config" calls "exit", so we can't source it
248
+ # (because if script A sources script B, and B calls "exit", then both
249
+ # B and A will exit). Instead, we have to send the output to a file
250
+ # and then source that.
251
+ $OPAL_TOP_BUILDDIR /libtool --tag= FC--config > $rpath_outfile
252
+
253
+ chmod +x $rpath_outfile
254
+ . ./$rpath_outfile
255
+ rm -f $rpath_outfile
256
+
257
+ wl= " \` eval echo \$ wl\` "
258
+ echo \$ wl
259
+
260
+ # Done
261
+ exit 0
262
+ EOF
263
+ chmod +x $rpath_script
264
+ wl_fc= ` ./$rpath_script `
265
+ rm -f $rpath_script
266
+
267
+ LDFLAGS= " $LDFLAGS_save ${wl_fc} --enable-new-dtags"
268
+ AC_LANG_PUSH([Fortran])
269
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[program test
270
+ end program]])],
271
+ [runpath_fc_args= " ${wl_fc} --enable-new-dtags" ],
272
+ [runpath_fc_args= " " ])
273
+ AC_LANG_POP([Fortran])])
209
274
LDFLAGS= $LDFLAGS_save
210
275
211
276
OPAL_VAR_SCOPE_POP
@@ -215,27 +280,30 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[
215
280
# for each of them. Then also add in an RPATH for @{libdir} (which
216
281
# will be replaced by the wrapper compile to the installdir libdir at
217
282
# runtime), and the RUNPATH args, if we have them.
218
- AC_DEFUN([RPATHIFY_LDFLAGS ],[
283
+ AC_DEFUN([RPATHIFY_LDFLAGS_INTERNAL ],[
219
284
OPAL_VAR_SCOPE_PUSH([rpath_out rpath_dir rpath_tmp])
220
285
AS_IF([test " $enable_wrapper_rpath " = " yes" && test " $WRAPPER_RPATH_SUPPORT " != " disabled" && test " $WRAPPER_RPATH_SUPPORT " != " unnecessary" ], [
221
286
rpath_out= " "
222
287
for val in ${$1 } ; do
223
288
case $val in
224
289
-L* )
225
290
rpath_dir=` echo $val | cut -c3-`
226
- rpath_tmp=` echo $rpath_args | sed -e s@LIBDIR@$rpath_dir @`
291
+ rpath_tmp=` echo ${ $2 } | sed -e s@LIBDIR@$rpath_dir @`
227
292
rpath_out=" $rpath_out $rpath_tmp "
228
293
;;
229
294
esac
230
295
done
231
296
232
297
# Now add in the RPATH args for @{libdir}, and the RUNPATH args
233
- rpath_tmp= ` echo $rpath_args | sed -e s/LIBDIR/@{libdir}/`
234
- $1 = " ${$1 } $rpath_out $rpath_tmp $runpath_args "
298
+ rpath_tmp= ` echo ${ $2 } | sed -e s/LIBDIR/@{libdir}/`
299
+ $1 = " ${$1 } $rpath_out $rpath_tmp ${ $3 } "
235
300
])
236
301
OPAL_VAR_SCOPE_POP
237
302
])
238
303
304
+ AC_DEFUN([RPATHIFY_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1 ], [rpath_args], [runpath_args])])
305
+
306
+ AC_DEFUN([RPATHIFY_FC_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1 ], [rpath_fc_args], [runpath_fc_args])])
239
307
240
308
dnl
241
309
dnl Avoid some repetitive code below
@@ -410,9 +478,12 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
410
478
411
479
AC_MSG_CHECKING([for OMPI LDFLAGS])
412
480
OMPI_WRAPPER_EXTRA_LDFLAGS= " $ompi_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags "
481
+ OMPI_WRAPPER_EXTRA_FC_LDFLAGS= $OMPI_WRAPPER_EXTRA_LDFLAGS
413
482
RPATHIFY_LDFLAGS([OMPI_WRAPPER_EXTRA_LDFLAGS])
414
483
AC_SUBST([OMPI_WRAPPER_EXTRA_LDFLAGS])
415
484
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LDFLAGS ])
485
+ RPATHIFY_FC_LDFLAGS([OMPI_WRAPPER_EXTRA_FC_LDFLAGS])
486
+ AC_SUBST([OMPI_WRAPPER_EXTRA_FC_LDFLAGS])
416
487
417
488
# Convert @{libdir} to ${libdir} for pkg-config
418
489
_OPAL_SETUP_WRAPPER_FINAL_PKGCONFIG([OMPI])
@@ -421,6 +492,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
421
492
OMPI_WRAPPER_EXTRA_LIBS= " $ompi_mca_wrapper_extra_libs "
422
493
OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs ])
423
494
OMPI_WRAPPER_EXTRA_LIBS= " $OMPI_WRAPPER_EXTRA_LIBS $with_wrapper_libs "
495
+ OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$LIBS ])
424
496
AC_SUBST([OMPI_WRAPPER_EXTRA_LIBS])
425
497
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LIBS ])
426
498
0 commit comments