# HG changeset patch # User Bruno Haible # Date 1315784504 -7200 # Node ID eb8d35d87eb5e5f4d563b17c5749410285b7f898 # Parent c20dc5d73f445e132ee60cf9350598fe4fa0892b asm-underscore.m4: Support for MSVC. * m4/asm-underscore.m4 (gl_C_ASM): New macro. (gl_ASM_SYMBOL_PREFIX): Require it. Use its results. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-09-11 Bruno Haible + + asm-underscore.m4: Support for MSVC. + * m4/asm-underscore.m4 (gl_C_ASM): New macro. + (gl_ASM_SYMBOL_PREFIX): Require it. Use its results. + 2011-09-11 Reuben Thomas Doc about crypt functions. diff --git a/m4/asm-underscore.m4 b/m4/asm-underscore.m4 --- a/m4/asm-underscore.m4 +++ b/m4/asm-underscore.m4 @@ -1,4 +1,4 @@ -# asm-underscore.m4 serial 1 +# asm-underscore.m4 serial 2 dnl Copyright (C) 2010-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -17,6 +17,7 @@ dnl We don't use GCC's __USER_LABEL_PREFIX__ here, because dnl 1. It works only for GCC. dnl 2. It is incorrectly defined on some platforms, in some GCC versions. + AC_REQUIRE([gl_C_ASM]) AC_CACHE_CHECK( [whether C symbols are prefixed with underscore at the linker level], [gl_cv_prog_as_underscore], @@ -27,8 +28,8 @@ int foo(void) { return 0; } EOF # Look for the assembly language name in the .s file. - AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c) >/dev/null 2>&1 - if grep _foo conftest.s >/dev/null ; then + AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 + if grep _foo conftest.$gl_asmext >/dev/null ; then gl_cv_prog_as_underscore=yes else gl_cv_prog_as_underscore=no @@ -46,3 +47,25 @@ ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"' AC_SUBST([ASM_SYMBOL_PREFIX]) ]) + +# gl_C_ASM +# Determines how to produce an assembly language file from C source code. +# Sets the variables: +# gl_asmext - the extension of assembly language output, +# gl_c_asm_opt - the C compiler option that produces assembly language output. + +AC_DEFUN([gl_C_ASM], +[ + AC_EGREP_CPP([MicrosoftCompiler], + [ +#ifdef _MSC_VER +MicrosoftCompiler +#endif + ], + [gl_asmext='asm' + gl_c_asm_opt='-c -Fa' + ], + [gl_asmext='s' + gl_c_asm_opt='-S' + ]) +])