]> Savannah Git Hosting - gnulib.git/commitdiff
Determine asm output option and filename suffix for MSVC/clang.
authorBruno Haible <bruno@clisp.org>
Sat, 15 Aug 2020 16:39:06 +0000 (18:39 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 15 Aug 2020 16:39:06 +0000 (18:39 +0200)
* m4/asm-underscore.m4 (gl_C_ASM): Distinguish clang from cl and
clang-cl.

ChangeLog
m4/asm-underscore.m4

index 0eb4f96325dd5b9841ab6a2ed0fc7e30a51ce160..e23e06dd43341849db8be26b50ada9bb9951b04f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-08-15  Bruno Haible  <bruno@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.
+
 2020-08-15  Bruno Haible  <bruno@clisp.org>
 
        doc: Update for MSVC/clang.
index 09be5eefb6d44424c84cbad8ad84e285e46fe890..6446e71af1e74e04246e49d4ab38fcf36b030304 100644 (file)
@@ -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'