blob: 86cc0be1d38f891d344535137bb9a0249b7fef0e [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001Fix cross link using autoconf detected AR
2
3If building on 32bit host and creating 64bit libraries, the target
4package builds should not invoke the 32bit hosts's ar. Specifically
5you will get an error message like:
6
7x86_64-linux-gcc -m64 --sysroot=/opt/qemux86-64/tmp/sysroots/qemux86-64 -g -o test test.o libnewt.a -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lslang
8libnewt.a: could not read symbols: Archive has no index; run ranlib to add one
9collect2: error: ld returned 1 exit status
10
11Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
12
13Upstream-Status: Pending
14
15Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
16---
17 Makefile.in | 3 ++-
18 configure.ac | 4 ++++
19 2 files changed, 6 insertions(+), 1 deletion(-)
20
Brad Bishop316dfdd2018-06-25 12:45:53 -040021Index: newt-0.52.20/Makefile.in
22===================================================================
23--- newt-0.52.20.orig/Makefile.in
24+++ newt-0.52.20/Makefile.in
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025@@ -7,6 +7,7 @@ CFLAGS = @CFLAGS@
26 LDFLAGS = @LDFLAGS@
Brad Bishop316dfdd2018-06-25 12:45:53 -040027 CPPFLAGS = -D_GNU_SOURCE @CPPFLAGS@
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 GNU_LD = @GNU_LD@
29+AR = @AR@
30
31 VERSION = @VERSION@
32 TAG = r$(subst .,-,$(VERSION))
Brad Bishop316dfdd2018-06-25 12:45:53 -040033@@ -109,7 +110,7 @@ whiptcl.$(SOEXT): $(WHIPTCLOBJS) $(LIBNE
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034 $(CC) -shared $(SHCFLAGS) $(LDFLAGS) -o whiptcl.$(SOEXT) $(WHIPTCLOBJS) -L. -lnewt $(LIBTCL) -lpopt $(LIBS)
35
36 $(LIBNEWT): $(LIBOBJS)
37- ar rv $@ $^
38+ $(AR) rv $@ $^
39
40 newt.o $(SHAREDDIR)/newt.o: newt.c Makefile
41
Brad Bishop316dfdd2018-06-25 12:45:53 -040042Index: newt-0.52.20/configure.ac
43===================================================================
44--- newt-0.52.20.orig/configure.ac
45+++ newt-0.52.20/configure.ac
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046@@ -15,6 +15,10 @@ AC_PROG_INSTALL
47 AC_PROG_LN_S
48 AC_PROG_GREP
49 AC_SYS_LARGEFILE
50+AN_MAKEVAR([AR], [AC_PROG_AR])
51+AN_PROGRAM([ar], [AC_PROG_AR])
52+AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
53+AC_PROG_AR
54
Brad Bishop316dfdd2018-06-25 12:45:53 -040055 AC_CHECK_SIZEOF([long])
56 AC_CHECK_SIZEOF([long long])