bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

improve clang support (31)


From: Bruno Haible
Subject: improve clang support (31)
Date: Sat, 15 Aug 2020 18:46:57 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; )

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  <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.

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

[Prev in Thread] Current Thread [Next in Thread]