summaryrefslogtreecommitdiff
path: root/dev-libs/dmalloc/files/dmalloc-5.6.5-allow-overriding-ar-and-ld.patch
blob: 981909d9940a585b6eeff779182aaf88076e5ca6 (plain)
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
From 626e5fb4c3f89b21e5ed75ee6c01d86527dede5f Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Sun, 17 Dec 2023 13:57:11 +0200
Subject: [PATCH 2/5] Allow overriding AR and LD

https://bugs.gentoo.org/337429

Signed-off-by: Alfred Wingate <parona@protonmail.com>
--- a/Makefile.in
+++ b/Makefile.in
@@ -303,11 +303,11 @@ $(LIB_SL) : $(LIBRARY)
 	mv $@.t $@
 
 $(LIBRARY) : $(OBJS) $(NORMAL_OBJS)
-	ar cr $@ $?
+	$(AR) cr $@ $?
 	@RANLIB@ $@
 
 $(LIB_TH) : $(OBJS) $(THREAD_OBJS)
-	ar cr $@ $?
+	$(AR) cr $@ $?
 	@RANLIB@ $@
 
 $(LIB_TH_SL) : $(LIB_TH)
@@ -316,7 +316,7 @@ $(LIB_TH_SL) : $(LIB_TH)
 	mv $@.t $@
 
 $(LIB_CXX) : $(OBJS) $(NORMAL_OBJS) $(CXX_OBJS)
-	ar cr $@ $?
+	$(AR) cr $@ $?
 	@RANLIB@ $@
 
 $(LIB_CXX_SL) : $(LIB_CXX)
@@ -325,7 +325,7 @@ $(LIB_CXX_SL) : $(LIB_CXX)
 	mv $@.t $@
 
 $(LIB_TH_CXX) : $(OBJS) $(THREAD_OBJS) $(CXX_OBJS)
-	ar cr $@ $?
+	$(AR) cr $@ $?
 	@RANLIB@ $@
 
 $(LIB_TH_CXX_SL) : $(LIB_TH_CXX)
--- a/configure.ac
+++ b/configure.ac
@@ -76,8 +76,13 @@ if test "$ac_cv_prog_cc_stdc" = "no" ; then
 fi
 AC_PROG_INSTALL
 AC_PROG_RANLIB
+AC_CHECK_TOOL(AR,ar)
+AC_CHECK_TOOL(LD,ld)
 AC_C_CONST
 
+AC_ARG_VAR(AR)
+AC_ARG_VAR(LD)
+
 # we need this for various settings
 AC_HEADER_STDC
 AC_CHECK_HEADER([stdarg.h],
@@ -144,7 +149,7 @@ AC_SUBST(shlibdir)
 AC_MSG_CHECKING([shared library link args])
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([ int foo(int val) { return val + 1; } ])],[
 	# so now we try to create an archive from the compiled .o file
-	(ar cr conftest.a conftest.o) 2>&5
+	(${AR} cr conftest.a conftest.o) 2>&5
 	# see which shared-library ld commands work
 	#
 	# Darwin/Mac OS X - Terry Teague
@@ -169,12 +174,12 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([ int foo(int val) { return val + 1; } ])],[
             ac_cv_shared_link_args='# Could not configure shlib linking'
             enable_shlib=no
           fi
-       elif (ld -shared --whole-archive -soname conftest.so -o conftest.so.t conftest.a) 2>&5; then
-		ac_cv_shared_link_args='ld -shared --whole-archive -soname $@ -o $@.t'
-	elif (ld -shared -o conftest.so.t -all -soname conftest.so.t -none -lc -all conftest.a) 2>&5; then
-		ac_cv_shared_link_args='ld -shared -o $@.t -all -soname $@ -none -lc -all'
-	elif (ld -G -o conftest.so.t conftest.a) 2>&5; then
-		ac_cv_shared_link_args='ld -G -o $@.t'
+       elif (${LD} -shared --whole-archive -soname conftest.so -o conftest.so.t conftest.a) 2>&5; then
+		ac_cv_shared_link_args='$(LD) -shared --whole-archive -soname $@ -o $@.t'
+	elif (${LD} -shared -o conftest.so.t -all -soname conftest.so.t -none -lc -all conftest.a) 2>&5; then
+		ac_cv_shared_link_args='$(LD) -shared -o $@.t -all -soname $@ -none -lc -all'
+	elif (${LD} -G -o conftest.so.t conftest.a) 2>&5; then
+		ac_cv_shared_link_args='$(LD) -G -o $@.t'
 	else
 		# oh well, toss an error
 		ac_cv_shared_link_args='# Could not configure shlib linking'
-- 
2.43.0