grub/m4/asm-underscore.m4
Yves Blusseau 15c6926126 Use gnulib-tool to create gnulib source files.
* Add gnulib files generated by gnulib-tool in build-aux, m4 and
    grub-core/gnulib directories
    * .bzignore: Add **/.deps and autogenerated gnulib files
    * configure.ac: Assign auxiliary directory to build-aux, add invocation
    of gnulib macros, add grub-core/gnulib/Makefile
    * Makefile.am: Add gnulib directory in SUBDIRS (removing unnecessary .),
    include m4 directory to aclocal.
    * Makefile.util.def: Remove direct compilation of gnulib source files
    and use the new grub-core/gnulib/libgnu.a.
    * build-aux/config.rpath: move config.rpath from top directory to
    build-aux
    * conf/Makefile.common: Remove the macro _GL_UNUSED already defined
    in gnulib headers
    * conf/Makefile.extra-dist: Add m4/gnulib-cache.m4
    * grub-core/Makefile.core.def: Remove unnecessary extra_dist
    * grub-core/lib/posix_wrap/localcharset.h (locale_charset): Update
    header.
    * grub-core/lib/posix_wrap/langinfo.h (nl_langinfo): Return static
    string.
2010-09-20 12:35:33 +02:00

48 lines
1.7 KiB
Text

# asm-underscore.m4 serial 1
dnl Copyright (C) 2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible. Based on as-underscore.m4 in GNU clisp.
# gl_ASM_SYMBOL_PREFIX
# Tests for the prefix of C symbols at the assembly language level and the
# linker level. This prefix is either an underscore or empty. Defines the
# C macro USER_LABEL_PREFIX to this prefix, and sets ASM_SYMBOL_PREFIX to
# a stringified variant of this prefix.
AC_DEFUN([gl_ASM_SYMBOL_PREFIX],
[
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_CACHE_CHECK(
[whether C symbols are prefixed with underscore at the linker level],
[gl_cv_prog_as_underscore],
[cat > conftest.c <<EOF
#ifdef __cplusplus
extern "C" int foo (void);
#endif
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
gl_cv_prog_as_underscore=yes
else
gl_cv_prog_as_underscore=no
fi
rm -f conftest*
])
if test $gl_cv_prog_as_underscore = yes; then
USER_LABEL_PREFIX=_
else
USER_LABEL_PREFIX=
fi
AC_DEFINE_UNQUOTED([USER_LABEL_PREFIX], [$USER_LABEL_PREFIX],
[Define to the prefix of C symbols at the assembler and linker level,
either an underscore or empty.])
ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"'
AC_SUBST([ASM_SYMBOL_PREFIX])
])