configure: export extern_prefix to use with makedef

Message ID 20171116141749.9540-1-jamrial@gmail.com
State New
Headers show

Commit Message

James Almer Nov. 16, 2017, 2:17 p.m.
No point in trying to guess it from within makedef when configure
already did it before.

Fixes linking failures on x86_32 when "arch" isn't one of the values
makedef was expecting.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 compat/windows/makedef | 29 ++---------------------------
 configure              |  3 ++-
 2 files changed, 4 insertions(+), 28 deletions(-)

Comments

James Almer Nov. 16, 2017, 2:22 p.m. | #1
On 11/16/2017 11:17 AM, James Almer wrote:
> No point in trying to guess it from within makedef when configure
> already did it before.
> 
> Fixes linking failures on x86_32 when "arch" isn't one of the values
> makedef was expecting.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  compat/windows/makedef | 29 ++---------------------------
>  configure              |  3 ++-
>  2 files changed, 4 insertions(+), 28 deletions(-)

Right, i should remember to look at existing patches in the ML before
writing and sending stuff myself.

Patch obviously dropped for being a duplicate of one sent hours ago.

Patch

diff --git a/compat/windows/makedef b/compat/windows/makedef
index 0cd169c15c..e4eeb56877 100755
--- a/compat/windows/makedef
+++ b/compat/windows/makedef
@@ -58,33 +58,8 @@  fi
 IFS='
 '
 
-# Determine if we're building for x86 or x86_64 and
-# set the symbol prefix accordingly.
-prefix=""
-if [ -n "$NM" ]; then
-    case $ARCH in
-    *86)
-        prefix="_"
-        ;;
-    *)
-        ;;
-    esac
-else
-    arch=$(dumpbin -headers ${libname} |
-           tr '\t' ' ' |
-           grep '^ \+.\+machine \+(.\+)' |
-           head -1 |
-           sed -e 's/^ \{1,\}.\{1,\} \{1,\}machine \{1,\}(\(.\{3,5\}\)).*/\1/')
-
-    if [ "${arch}" = "x86" ]; then
-        prefix="_"
-    else
-        if [ "${arch}" != "ARM" ] && [ "${arch}" != "x64" ] && [ "${arch}" != "ARM64" ]; then
-            echo "Unknown machine type." >&2
-            exit 1
-        fi
-    fi
-fi
+# Symbol prefix, guessed by configure
+prefix=$EXTERN_PREFIX
 
 started=0
 regex="none"
diff --git a/configure b/configure
index 3bad7fb72c..221f9fd127 100755
--- a/configure
+++ b/configure
@@ -3898,7 +3898,7 @@  case $target_os in
         SLIB_INSTALL_LINKS=
         SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
         SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
-        SLIB_CREATE_DEF_CMD='ARCH="$(ARCH)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
+        SLIB_CREATE_DEF_CMD='AR="$(AR_CMD)" NM="$(NM_CMD)" EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
         SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-auto-image-base $$(@:$(SLIBSUF)=.def)'
         enabled x86_64 && objformat="win64" || objformat="win32"
         ranlib=:
@@ -5257,6 +5257,7 @@  LIBNAME=$LIBNAME
 SLIBPREF=$SLIBPREF
 SLIBSUF=$SLIBSUF
 EXESUF=$EXESUF
+EXTERN_PREFIX=$extern_prefix
 EXTRA_VERSION=$extra_version
 CCDEP=$CCDEP
 CCDEP_FLAGS=$CCDEP_FLAGS