From d39779c47620f9221f4a67f594f6e089c30ca0d6 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Fri, 21 Mar 2014 00:11:54 +0900 Subject: [PATCH] Fix a build problem with clang and --with-opt-dir. * configure.in: Fix a build problem with clang and --with-opt-dir. If ruby is configured with --with-opt-dir=dir when using clang as compiler, a warning `clang: warning: argument unused during compilation: '-I dir'` is emitted almost every time clang compiles a file. Unfortunately, RUBY_CHECK_PRINTF_PREFIX takes any output from the compiler as fatal error, and the check thus fails due to the warning. This is an attempt to fix the problem by adding a flag -Qunused-arguments to CFLAGS locally in the function to suppress the warning. --- ChangeLog | 12 ++++++++++++ configure.in | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 320767e..716d7ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Thu Mar 20 23:41:45 2014 Akinori MUSHA + + * configure.in: Fix a build problem with clang and --with-opt-dir. + If ruby is configured with --with-opt-dir=dir when using clang + as compiler, a warning `clang: warning: argument unused during + compilation: '-I dir'` is emitted almost every time clang + compiles a file. Unfortunately, RUBY_CHECK_PRINTF_PREFIX takes + any output from the compiler as fatal error, and the check thus + fails due to the warning. This is an attempt to fix the problem + by adding a flag -Qunused-arguments to CFLAGS locally in the + function to suppress the warning. + Thu Mar 20 16:53:07 2014 Koichi Sasada * gc.c (objspace_malloc_increase): should not invoke diff --git a/configure.in b/configure.in index e952cc7..55dea51 100644 --- a/configure.in +++ b/configure.in @@ -779,6 +779,8 @@ if test "$GCC:${warnflags+set}:no" = yes::no; then rb_cv_warnflags="$warnflags" warnflags= fi +RUBY_TRY_CFLAGS(-Qunused-arguments, [RUBY_APPEND_OPTIONS(rb_cv_wsuppress_flags, -Qunused-arguments)]) + if test "$GCC" = yes; then # -D_FORTIFY_SOURCE # When defined _FORTIFY_SOURCE, glibc enables some additional sanity @@ -1302,7 +1304,8 @@ AC_DEFINE_UNQUOTED(PACKED_STRUCT_UNALIGNED(x), $packed_struct_unaligned) AC_DEFUN([RUBY_CHECK_PRINTF_PREFIX], [ AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),[ [rb_cv_pri_prefix_]AS_TR_SH($1)=[NONE] - RUBY_WERROR_FLAG(for pri in $2; do + RUBY_WERROR_FLAG(RUBY_APPEND_OPTIONS(CFLAGS, $rb_cv_wsuppress_flags) + for pri in $2; do AC_TRY_COMPILE( [@%:@include @%:@include -- 1.8.5.5