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.
This commit is contained in:
卜部昌平 2020-08-21 23:31:28 +09:00
Родитель 7263fd6ff4
Коммит 954afd1bc5
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -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.