bug-gnulib
[Top][All Lists]
Advanced

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

asm-underscore.m4 and MSVC


From: Bruno Haible
Subject: asm-underscore.m4 and MSVC
Date: Mon, 12 Sep 2011 01:41:31 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

The asm-underscore.m4 test currently determines
  #define ASM_SYMBOL_PREFIX ""
but on Win32 the correct result is
  #define ASM_SYMBOL_PREFIX "_"

The reason is that the test uses wrong command-line options to the compiler,
and expects the result in a .s file - whereas 'cl' creates a file with
suffix .asm.

This fixes it.


2011-09-11  Bruno Haible  <address@hidden>

        asm-underscore.m4: Support for MSVC.
        * m4/asm-underscore.m4 (gl_C_ASM): New macro.
        (gl_ASM_SYMBOL_PREFIX): Require it. Use its results.

--- m4/asm-underscore.m4.orig   Mon Sep 12 01:36:17 2011
+++ m4/asm-underscore.m4        Sun Sep 11 18:26:01 2011
@@ -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'
+    ])
+])
-- 
In memoriam Georgi Markov <http://en.wikipedia.org/wiki/Georgi_Markov>



reply via email to

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