aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-08-21 23:31:28 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-08-22 00:45:39 +0900
commit954afd1bc55b9b98e4e5099e3c49c3710514fdb8 (patch)
tree3bed082a8e23c51bdc81feac28b63c42f30d5f86 /configure.ac
parent7263fd6ff42821d7a8713bebbb7fccf170f16347 (diff)
downloadruby-954afd1bc55b9b98e4e5099e3c49c3710514fdb8.tar.gz
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.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac6
1 files changed, 6 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 484849599d..df14655627 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,6 +176,9 @@ AS_CASE(["${target_os}"],
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])
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.