77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
SHLIBOBJS=""
for obj in $LIB@&t@OBJS; do
SHLIBOBJS="$SHLIBOBJS `echo $obj | sed 's/\.o$/_shr.o/g'`"
done
])
AC_DEFUN([DC_SYNC_RPATH], [
OLD_LDFLAGS="$LDFLAGS"
for tryrpath in "-Wl,-rpath" "-Wl,--rpath" "-Wl,-R"; do
LDFLAGS="$OLD_LDFLAGS $tryrpath -Wl,/tmp"
AC_LINK_IFELSE(AC_LANG_PROGRAM([], [ return(0); ]), [
rpathldflags="$tryrpath"
break
])
done
unset tryrpath
LDFLAGS="$OLD_LDFLAGS"
unset OLD_LDFLAGS
ADDLDFLAGS=""
for opt in $LDFLAGS; do
if echo "$opt" | grep '^-L' >/dev/null; then
rpathdir=`echo "$opt" | sed 's@^-L *@@'`
ADDLDFLAGS="$ADDLDFLAGS $rpathldflags -Wl,$rpathdir"
fi
done
unset opt rpathldflags
LDFLAGS="$LDFLAGS $ADDLDFLAGS"
unset ADDLDFLAGS
])
AC_DEFUN([DC_CHK_OS_INFO], [
AC_CANONICAL_HOST
AC_SUBST(SHOBJEXT)
AC_SUBST(SHOBJFLAGS)
AC_SUBST(SHOBJCPPFLAGS)
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
|
|
|
|
|
|
|
>
|
>
|
|
|
|
|
|
|
|
|
|
|
|
>
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
SHLIBOBJS=""
for obj in $LIB@&t@OBJS; do
SHLIBOBJS="$SHLIBOBJS `echo $obj | sed 's/\.o$/_shr.o/g'`"
done
])
AC_DEFUN([DC_SYNC_RPATH], [
AC_ARG_ENABLE([rpath], AS_HELP_STRING([--disable-rpath], [disable setting of rpath]), [
if test "$enableval" = 'no'; then
set_rpath='no'
else
set_rpath='yes'
fi
], [
if test "$cross_compiling" = 'yes'; then
set_rpath='no'
else
ifelse($1, [], [
set_rpath='yes'
], [
set_rpath='$1'
])
fi
])
if test "$set_rpath" = 'yes'; then
OLD_LDFLAGS="$LDFLAGS"
AC_CACHE_CHECK([how to set rpath], [rsk_cv_link_set_rpath], [
AC_LANG_PUSH(C)
for tryrpath in "-Wl,-rpath" "-Wl,--rpath" "-Wl,-R"; do
LDFLAGS="$OLD_LDFLAGS $tryrpath -Wl,/tmp"
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [ return(0); ])], [
rsk_cv_link_set_rpath="$tryrpath"
break
])
done
AC_LANG_POP(C)
unset tryrpath
])
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 *@@'`"
ADDLDFLAGS="$ADDLDFLAGS $rsk_cv_link_set_rpath -Wl,$rpathdir"
fi
done
unset opt
LDFLAGS="$LDFLAGS $ADDLDFLAGS"
unset ADDLDFLAGS
fi
])
AC_DEFUN([DC_CHK_OS_INFO], [
AC_CANONICAL_HOST
AC_SUBST(SHOBJEXT)
AC_SUBST(SHOBJFLAGS)
AC_SUBST(SHOBJCPPFLAGS)
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
SHOBJEXT="so"
;;
*)
SHOBJEXT="sl"
;;
esac
;;
aix[0-9].*)
SHOBJEXT="a"
;;
mingw32|mingw32msvc*)
SHOBJEXT="dll"
CFLAGS="$CFLAGS -mms-bitfields"
CPPFLAGS="$CPPFLAGS -mms-bitfields"
SHOBJCPPFLAGS="-DPIC"
SHOBJLDFLAGS='-shared -Wl,--dll -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a'
;;
msvc)
SHOBJEXT="dll"
CFLAGS="$CFLAGS -nologo"
SHOBJCPPFLAGS='-DPIC'
SHOBJLDFLAGS='/LD /LINK /NODEFAULTLIB:MSVCRT'
;;
cygwin*)
SHOBJEXT="dll"
SHOBJFLAGS="-fPIC"
SHOBJCPPFLAGS="-DPIC"
CFLAGS="$CFLAGS -mms-bitfields"
CPPFLAGS="$CPPFLAGS -mms-bitfields"
SHOBJLDFLAGS='-shared -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a'
;;
esac
fi
])
AC_DEFUN(SHOBJ_SET_SONAME, [
SAVE_LDFLAGS="$LDFLAGS"
AC_MSG_CHECKING([how to specify soname])
for try in "-Wl,--soname,$1" "Wl,-install_name,$1" '__fail__'; do
LDFLAGS="$SAVE_LDFLAGS"
|
<
<
<
>
>
|
|
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
SHOBJEXT="so"
;;
*)
SHOBJEXT="sl"
;;
esac
;;
mingw32|mingw32msvc*)
SHOBJEXT="dll"
AREXT='lib'
CFLAGS="$CFLAGS -mms-bitfields"
CPPFLAGS="$CPPFLAGS -mms-bitfields"
SHOBJCPPFLAGS="-DPIC"
SHOBJLDFLAGS='-shared -Wl,--dll -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a'
;;
msvc)
SHOBJEXT="dll"
AREXT='lib'
CFLAGS="$CFLAGS -nologo"
SHOBJCPPFLAGS='-DPIC'
SHOBJLDFLAGS='/LD /LINK /NODEFAULTLIB:MSVCRT'
;;
cygwin*)
SHOBJEXT="dll"
SHOBJFLAGS="-fPIC"
SHOBJCPPFLAGS="-DPIC"
CFLAGS="$CFLAGS -mms-bitfields"
CPPFLAGS="$CPPFLAGS -mms-bitfields"
SHOBJLDFLAGS='-shared -Wl,--enable-auto-image-base -Wl,--output-def,$[@].def,--out-implib,$[@].a'
;;
esac
fi
])
AC_DEFUN([SHOBJ_SET_SONAME], [
SAVE_LDFLAGS="$LDFLAGS"
AC_MSG_CHECKING([how to specify soname])
for try in "-Wl,--soname,$1" "Wl,-install_name,$1" '__fail__'; do
LDFLAGS="$SAVE_LDFLAGS"
|
193
194
195
196
197
198
199
|
break
])
done
AC_SUBST(SHOBJLDFLAGS)
])
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
288
289
290
291
292
293
294
295
296
297
298
299
300
|
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])
trylink_ADD_LDFLAGS=''
for arg in $VAR_TO_UPDATE; do
case "${arg}" in
-L*)
trylink_ADD_LDFLAGS="${arg}"
;;
esac
done
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_ADD_LDFLAGS} ${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
])
|