[前][次][番号順一覧][スレッド一覧]

ruby-changes:62677

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Sat, 22 Aug 2020 00:45:56 +0900 (JST)
Subject: [ruby-changes:62677] 954afd1bc5 (master): protect CFLAGS from being smashed by AC_PROG_CC

https://git.ruby-lang.org/ruby.git/commit/?id=954afd1bc5

From 954afd1bc55b9b98e4e5099e3c49c3710514fdb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Fri, 21 Aug 2020 23:31:28 +0900
Subject: protect CFLAGS from being smashed by AC_PROG_CC

AC_PROG_CC_C99 calls AC_PROC_CC, which calls _AC_PROG_CC_G, which sets
default CFLAGS, whose contents are not customisable.  We don't welcome
this behaviour.

The exact same thing happens for CXXFLAGS in AC_PROG_CXX.

diff --git a/configure.ac b/configure.ac
index 4848495..df14655 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,6 +176,9 @@ AS_CASE(["${target_os}"], https://github.com/ruby/ruby/blob/trunk/configure.ac#L176
     ac_cv_prog_ac_ct_OBJCOPY=":"
 ])
 
+rb_test_CFLAGS=${CFLAGS+yes}
+rb_test_CXXFLAGS=${CXXFLAGS+yes}
+
 # BSD's ports and MacPorts prefix GNU binutils with 'g'
 AC_PROG_CC_C99
 AC_PROG_CXX
@@ -189,6 +192,9 @@ AC_CHECK_TOOLS([OBJCOPY], [gobjcopy objcopy]) https://github.com/ruby/ruby/blob/trunk/configure.ac#L192
 AC_CHECK_TOOLS([OBJDUMP], [gobjdump objdump])
 AC_CHECK_TOOLS([STRIP],   [gstrip strip], [:])
 
+AS_IF([test ! $rb_test_CFLAGS], [AS_UNSET(CFLAGS)]); AS_UNSET(rb_test_CFLAGS)
+AS_IF([test ! $rb_test_CXXFLAGS], [AS_UNSET(CXXFLAGS)]); AS_UNSET(rb_save_CXXFLAGS)
+
 test x"$target_alias" = x &&
 target_os=`echo $target_os | sed 's/linux-gnu$/linux/;s/linux-gnu/linux-/'`
 ac_install_sh='' # unusable for extension libraries.
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]