1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
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
288
289
290
291
292
293
294
|
From 9848b4f5b207d762a75d6cf0ccbb59c6486a1616 Mon Sep 17 00:00:00 2001
From: Alexey Neyman <stilor@att.net>
Date: Fri, 3 Feb 2017 22:01:48 -0800
Subject: [PATCH] Check for libz first
If building statically, linking libz before libbfd results in unresolved symbols
(compress/compressBound in libbfd.a).
Signed-off-by: Alexey Neyman <stilor@att.net>
---
configure | 108 +++++++++++++++++++++++++++++++++--------------------------
configure.ac | 10 +++---
2 files changed, 65 insertions(+), 53 deletions(-)
diff --git a/configure b/configure
index d8d14be..df612cb 100755
--- a/configure
+++ b/configure
@@ -675,6 +675,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -758,6 +759,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1010,6 +1012,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1147,7 +1158,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1300,6 +1311,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -3779,14 +3791,14 @@ if test "$ac_binutils_build_dir" != "NONE"; then
test "$ac_binutils_include_dir" = "NONE" && ac_binutils_include_dir="$ac_binutils_build_dir/include"
fi
-if test "$ac_libiberty" = "NONE"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objalloc_create in -liberty" >&5
-$as_echo_n "checking for objalloc_create in -liberty... " >&6; }
-if ${ac_cv_lib_iberty_objalloc_create+:} false; then :
+if test "$ac_zlib_prefix" = "NONE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5
+$as_echo_n "checking for deflate in -lz... " >&6; }
+if ${ac_cv_lib_z_deflate+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-liberty $LIBS"
+LIBS="-lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -3796,47 +3808,46 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char objalloc_create ();
+char deflate ();
int
main ()
{
-return objalloc_create ();
+return deflate ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_iberty_objalloc_create=yes
+ ac_cv_lib_z_deflate=yes
else
- ac_cv_lib_iberty_objalloc_create=no
+ ac_cv_lib_z_deflate=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iberty_objalloc_create" >&5
-$as_echo "$ac_cv_lib_iberty_objalloc_create" >&6; }
-if test "x$ac_cv_lib_iberty_objalloc_create" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5
+$as_echo "$ac_cv_lib_z_deflate" >&6; }
+if test "x$ac_cv_lib_z_deflate" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBIBERTY 1
+#define HAVE_LIBZ 1
_ACEOF
- LIBS="-liberty $LIBS"
+ LIBS="-lz $LIBS"
fi
- ac_libiberty=auto
else
- LIBS="$ac_libiberty $LIBS"
+ LIBS="-L$ac_zlib_prefix/lib -lz $LIBS"
fi
-if test "$ac_libbfd" = "NONE"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_openr in -lbfd" >&5
-$as_echo_n "checking for bfd_openr in -lbfd... " >&6; }
-if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
+if test "$ac_libiberty" = "NONE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objalloc_create in -liberty" >&5
+$as_echo_n "checking for objalloc_create in -liberty... " >&6; }
+if ${ac_cv_lib_iberty_objalloc_create+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lbfd $LIBS"
+LIBS="-liberty $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -3846,47 +3857,47 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char bfd_openr ();
+char objalloc_create ();
int
main ()
{
-return bfd_openr ();
+return objalloc_create ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_bfd_bfd_openr=yes
+ ac_cv_lib_iberty_objalloc_create=yes
else
- ac_cv_lib_bfd_bfd_openr=no
+ ac_cv_lib_iberty_objalloc_create=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
-$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
-if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iberty_objalloc_create" >&5
+$as_echo "$ac_cv_lib_iberty_objalloc_create" >&6; }
+if test "x$ac_cv_lib_iberty_objalloc_create" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBBFD 1
+#define HAVE_LIBIBERTY 1
_ACEOF
- LIBS="-lbfd $LIBS"
+ LIBS="-liberty $LIBS"
fi
- ac_libbfd=auto
+ ac_libiberty=auto
else
- LIBS="$ac_libbfd $LIBS"
+ LIBS="$ac_libiberty $LIBS"
fi
-if test "$ac_zlib_prefix" = "NONE"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5
-$as_echo_n "checking for deflate in -lz... " >&6; }
-if ${ac_cv_lib_z_deflate+:} false; then :
+if test "$ac_libbfd" = "NONE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_openr in -lbfd" >&5
+$as_echo_n "checking for bfd_openr in -lbfd... " >&6; }
+if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz $LIBS"
+LIBS="-lbfd $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -3896,37 +3907,38 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char deflate ();
+char bfd_openr ();
int
main ()
{
-return deflate ();
+return bfd_openr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_z_deflate=yes
+ ac_cv_lib_bfd_bfd_openr=yes
else
- ac_cv_lib_z_deflate=no
+ ac_cv_lib_bfd_bfd_openr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_deflate" >&5
-$as_echo "$ac_cv_lib_z_deflate" >&6; }
-if test "x$ac_cv_lib_z_deflate" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
+$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
+if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBZ 1
+#define HAVE_LIBBFD 1
_ACEOF
- LIBS="-lz $LIBS"
+ LIBS="-lbfd $LIBS"
fi
+ ac_libbfd=auto
else
- LIBS="-L$ac_zlib_prefix/lib -lz $LIBS"
+ LIBS="$ac_libbfd $LIBS"
fi
bfd_include_dir=
diff --git a/configure.ac b/configure.ac
index dcf0f92..7dcc082 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,6 +114,11 @@ if test "$ac_binutils_build_dir" != "NONE"; then
fi
dnl Checks for libraries.
+if test "$ac_zlib_prefix" = "NONE"; then
+ AC_CHECK_LIB(z, deflate)
+else
+ LIBS="-L$ac_zlib_prefix/lib -lz $LIBS"
+fi
if test "$ac_libiberty" = "NONE"; then
AC_CHECK_LIB(iberty, objalloc_create)
ac_libiberty=auto
@@ -126,11 +131,6 @@ if test "$ac_libbfd" = "NONE"; then
else
LIBS="$ac_libbfd $LIBS"
fi
-if test "$ac_zlib_prefix" = "NONE"; then
- AC_CHECK_LIB(z, deflate)
-else
- LIBS="-L$ac_zlib_prefix/lib -lz $LIBS"
-fi
bfd_include_dir=
if test "$ac_bfd_include_dir" != "NONE"; then
--
2.9.3
|