From d1706ea7e965c72762bd443ea2f1925af710ff20 Mon Sep 17 00:00:00 2001
From: Andoni Morales Alastruey <ylatuya@gmail.com>
Date: Tue, 8 Jan 2019 16:50:09 +0100
Subject: [PATCH] configure: add support for configuring dlltool

In a multilib toolchain dlltool has to be configured
with the correct architecture options.
This option allows configuring dlltool this way:
--dlltool="x86_64-w64-mingw32-dlltool --as-flags=--32 -m i386"
---
 configure | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index bb9e8c5..6ae9e4c 100755
--- a/configure
+++ b/configure
@@ -364,6 +364,7 @@ Toolchain options:
   --pkg-config-flags=FLAGS pass additional flags to pkgconf []
   --ranlib=RANLIB          use ranlib RANLIB [$ranlib_default]
   --doxygen=DOXYGEN        use DOXYGEN to generate API doc [$doxygen_default]
+  --dlltool=DLLTOOL        use dlltool DLLTOOL [$dlltool_default]
   --host-cc=HOSTCC         use host C compiler HOSTCC
   --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
   --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
@@ -2393,6 +2394,7 @@ CMDLINE_SET="
     valgrind
     windres
     x86asmexe
+    dlltool
 "
 
 CMDLINE_APPEND="
@@ -3509,6 +3511,7 @@ version_script='--version-script'
 objformat="elf32"
 x86asmexe_default="nasm"
 windres_default="windres"
+dlltool_default="dlltool"
 nvcc_default="nvcc"
 nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
 striptype="direct"
@@ -4048,6 +4051,7 @@ else
 fi
 strip_default="${cross_prefix}${strip_default}"
 windres_default="${cross_prefix}${windres_default}"
+dlltool_default="${cross_prefix}${dlltool_default}"
 
 sysinclude_default="${sysroot}/usr/include"
 
@@ -4484,7 +4488,7 @@ test -n "$cc_type" && enable $cc_type ||
 : ${dep_cc_default:=$cc}
 : ${ld_default:=$cc}
 : ${host_ld_default:=$host_cc}
-set_default ar as objcc dep_cc ld ln_s host_ld windres
+set_default ar as objcc dep_cc ld ln_s host_ld windres dlltool
 
 probe_cc as "$as"
 asflags_filter=$_flags_filter
@@ -5129,7 +5133,6 @@ case $target_os in
         SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
         SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--disable-auto-image-base $$(@:$(SLIBSUF)=.def)'
         enabled x86_64 && objformat="win64" || objformat="win32"
-        dlltool="${cross_prefix}dlltool"
         ranlib=:
         enable dos_paths
         check_ldflags -Wl,--nxcompat,--dynamicbase
-- 
2.7.4

