From 02f20f35b8474cf897e18245f4f105db3fd574e5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 15 Aug 2020 18:39:06 +0200 Subject: [PATCH] Determine asm output option and filename suffix for MSVC/clang. * m4/asm-underscore.m4 (gl_C_ASM): Distinguish clang from cl and clang-cl. --- ChangeLog | 6 ++++++ m4/asm-underscore.m4 | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0eb4f96325..e23e06dd43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-08-15 Bruno Haible + + 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 doc: Update for MSVC/clang. diff --git a/m4/asm-underscore.m4 b/m4/asm-underscore.m4 index 09be5eefb6..6446e71af1 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' -- 2.39.5