From 626e5fb4c3f89b21e5ed75ee6c01d86527dede5f Mon Sep 17 00:00:00 2001 From: Alfred Wingate 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 --- 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