With MSVC/clang, the configure output contains:

  checking whether C symbols are prefixed with underscore at the linker 
level... /usr/bin/grep: conftest.asm: No such file or directory
  no

This patch fixes it.


2020-08-15  Bruno Haible  <br...@clisp.org>

        Determine asm output option and filename suffix for MSVC/clang.
        * m4/asm-underscore.m4 (gl_C_ASM): Distinguish clang from cl and
        clang-cl.

diff --git a/m4/asm-underscore.m4 b/m4/asm-underscore.m4
index 09be5ee..6446e71 100644
--- a/m4/asm-underscore.m4
+++ b/m4/asm-underscore.m4
@@ -1,4 +1,4 @@
-# asm-underscore.m4 serial 4
+# asm-underscore.m4 serial 5
 dnl Copyright (C) 2010-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -63,8 +63,19 @@ AC_DEFUN([gl_C_ASM],
 MicrosoftCompiler
 #endif
     ],
-    [gl_asmext='asm'
-     gl_c_asm_opt='-c -Fa'
+    [dnl Microsoft's 'cl' and 'clang-cl' produce an .asm file, whereas 'clang'
+     dnl produces a .s file. Need to distinguish 'clang' and 'clang-cl'.
+     rm -f conftest*
+     echo 'int dummy;' > conftest.c
+     AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c) >/dev/null 2>&1
+     if test -f conftest.o; then
+       gl_asmext='s'
+       gl_c_asm_opt='-S'
+     else
+       gl_asmext='asm'
+       gl_c_asm_opt='-c -Fa'
+     fi
+     rm -f conftest*
     ],
     [gl_asmext='s'
      gl_c_asm_opt='-S'


Reply via email to