From 954afd1bc55b9b98e4e5099e3c49c3710514fdb8 Mon Sep 17 00:00:00 2001 From: 卜部昌平 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. --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) 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. -- cgit v1.2.3