113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
-
+
|
LDFLAGS="$OLD_LDFLAGS"
unset OLD_LDFLAGS
ADDLDFLAGS=""
for opt in $LDFLAGS $LIBS; do
if echo "$opt" | grep '^-L' >/dev/null; then
rpathdir=`echo "$opt" | sed 's@^-L *@@'`
rpathdir="`echo "$opt" | sed 's@^-L *@@'`"
ADDLDFLAGS="$ADDLDFLAGS $rsk_cv_link_set_rpath -Wl,$rpathdir"
fi
done
unset opt
LDFLAGS="$LDFLAGS $ADDLDFLAGS"
|
212
213
214
215
216
217
218
|
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
break
])
done
AC_SUBST(SHOBJLDFLAGS)
])
dnl $1 = Description to show user
dnl $2 = Libraries to link to
dnl $3 = Variable to update (optional; default LIBS)
dnl $4 = Action to run if found
dnl $5 = Action to run if not found
AC_DEFUN([SHOBJ_DO_STATIC_LINK_LIB], [
ifelse($3, [], [
define([VAR_TO_UPDATE], [LIBS])
], [
define([VAR_TO_UPDATE], [$3])
])
AC_MSG_CHECKING([for how to statically link to $1])
SAVELIBS="$LIBS"
staticlib=""
found="0"
dnl HP/UX uses -Wl,-a,archive ... -Wl,-a,shared_archive
dnl Linux and Solaris us -Wl,-Bstatic ... -Wl,-Bdynamic
AC_LANG_PUSH([C])
for trylink in "-Wl,-a,archive $2 -Wl,-a,shared_archive" "-Wl,-Bstatic $2 -Wl,-Bdynamic" "$2"; do
if echo " ${LDFLAGS} " | grep ' -static ' >/dev/null; then
if test "${trylink}" != "$2"; then
continue
fi
fi
LIBS="${SAVELIBS} ${trylink}"
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
staticlib="${trylink}"
found="1"
break
])
done
AC_LANG_POP([C])
LIBS="${SAVELIBS}"
if test "${found}" = "1"; then
new_RESULT=''
SAVERESULT="$VAR_TO_UPDATE"
for lib in ${SAVERESULT}; do
addlib='1'
for removelib in $2; do
if test "${lib}" = "${removelib}"; then
addlib='0'
break
fi
done
if test "$addlib" = '1'; then
new_RESULT="${new_RESULT} ${lib}"
fi
done
VAR_TO_UPDATE="${new_RESULT} ${staticlib}"
AC_MSG_RESULT([${staticlib}])
$4
else
AC_MSG_RESULT([cant])
$5
fi
])
|