* configure.ac: Move nm checks to the end.

Call grub_PROG_NM_WORKS.
	* acinclude.m4: New check grub_PROG_NM_WORKS.
	Use $TARGET_CFLAGS -c when compiling test binary.
This commit is contained in:
Vladimir Serbinenko 2013-11-14 17:39:01 +01:00
parent 1326b9ae2a
commit 20aea9492f
3 changed files with 40 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2013-11-14 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Move nm checks to the end.
Call grub_PROG_NM_WORKS.
* acinclude.m4: New check grub_PROG_NM_WORKS.
Use $TARGET_CFLAGS -c when compiling test binary.
2013-11-14 Colin Watson <cjwatson@ubuntu.com>
* util/getroot.c (grub_util_biosdisk_get_grub_dev) [__GNU__]: Remove

View File

@ -134,6 +134,29 @@ if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
fi
])
dnl Check nm
AC_DEFUN([grub_PROG_NM_WORKS],
[AC_MSG_CHECKING([whether nm works])
AC_CACHE_VAL(grub_cv_prog_nm_works,
[
nm_works_tmp_dir="$(mktemp -d "./confXXXXXX")"
AC_LANG_CONFTEST([AC_LANG_PROGRAM([[]], [[]])])
$TARGET_CC $TARGET_CFLAGS -c conftest.c -o "$nm_works_tmp_dir/ef"
if $TARGET_NM -P "$nm_works_tmp_dir/ef" > /dev/null; then
grub_cv_prog_nm_works=yes
else
grub_cv_prog_nm_minus_p=no
fi
rm "$nm_works_tmp_dir/ef"
rmdir "$nm_works_tmp_dir"
])
AC_MSG_RESULT([$grub_cv_prog_nm_works])
if test "x$grub_cv_prog_nm_works" != xyes; then
AC_MSG_ERROR([nm does not work])
fi
])
dnl Supply -P to nm
AC_DEFUN([grub_PROG_NM_MINUS_P],
[AC_MSG_CHECKING([whether nm accepts -P])
@ -141,13 +164,14 @@ AC_CACHE_VAL(grub_cv_prog_nm_minus_p,
[
nm_minus_p_tmp_dir="$(mktemp -d "./confXXXXXX")"
AC_LANG_CONFTEST([AC_LANG_PROGRAM([[]], [[]])])
$TARGET_CC conftest.c -o "$nm_minus_p_tmp_dir/ef"
$TARGET_CC $TARGET_CFLAGS -c conftest.c -o "$nm_minus_p_tmp_dir/ef"
if $TARGET_NM -P "$nm_minus_p_tmp_dir/ef" 2>&1 > /dev/null; then
grub_cv_prog_nm_minus_p=yes
else
grub_cv_prog_nm_minus_p=no
fi
rm "$nm_minus_p_tmp_dir/ef"
rmdir "$nm_minus_p_tmp_dir"
])
AC_MSG_RESULT([$grub_cv_prog_nm_minus_p])
@ -165,13 +189,14 @@ AC_CACHE_VAL(grub_cv_prog_nm_defined_only,
[
nm_defined_only_tmp_dir="$(mktemp -d "./confXXXXXX")"
AC_LANG_CONFTEST([AC_LANG_PROGRAM([[]], [[]])])
$TARGET_CC conftest.c -o "$nm_defined_only_tmp_dir/ef"
$TARGET_CC $TARGET_CFLAGS -c conftest.c -o "$nm_defined_only_tmp_dir/ef"
if $TARGET_NM --defined-only "$nm_defined_only_tmp_dir/ef" 2>&1 > /dev/null; then
grub_cv_prog_nm_defined_only=yes
else
grub_cv_prog_nm_defined_only=no
fi
rm "$nm_defined_only_tmp_dir/ef"
rmdir "$nm_defined_only_tmp_dir"
])
AC_MSG_RESULT([$grub_cv_prog_nm_defined_only])

View File

@ -463,11 +463,6 @@ CPPFLAGS="$TARGET_CPPFLAGS"
LDFLAGS="$TARGET_LDFLAGS"
LIBS=""
grub_PROG_NM_MINUS_P
grub_PROG_NM_DEFINED_ONLY
AC_SUBST(TARGET_NMFLAGS_MINUS_P)
AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
# debug flags.
WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Wattributes -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
@ -859,6 +854,12 @@ if test "x$target_cpu" = xi386; then
grub_I386_ASM_ADDR32
fi
grub_PROG_NM_WORKS
grub_PROG_NM_MINUS_P
grub_PROG_NM_DEFINED_ONLY
AC_SUBST(TARGET_NMFLAGS_MINUS_P)
AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
if test "$platform" != emu; then
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
SAVED_CPPFLAGS="$CPPFLAGS"