From ad150a14598980095260add74474498a642ab5ba Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 22 Jan 2022 19:05:02 +0900 Subject: [PATCH] Override `AC_C_PROGRAM` on old autoconf Autoconf 2.69 fails to detect `-Werror=old-style-definition` due to the old style definition of `main`. --- tool/m4/ruby_try_cflags.m4 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tool/m4/ruby_try_cflags.m4 b/tool/m4/ruby_try_cflags.m4 index f2c6a3094e..228fe65245 100644 --- a/tool/m4/ruby_try_cflags.m4 +++ b/tool/m4/ruby_try_cflags.m4 @@ -1,4 +1,19 @@ dnl -*- Autoconf -*- +dnl +dnl Autoconf 2.67 fails to detect `-Werror=old-style-definition` due +dnl to the old style definition of `main`. +m4_version_prereq([2.70], [], [ +m4_define([AC_LANG_PROGRAM(C)], +[$1 +int +main (void) +{ +$2 + ; + return 0; +}]) +])dnl +dnl AC_DEFUN([RUBY_TRY_CFLAGS], [ AC_MSG_CHECKING([whether ]$1[ is accepted as CFLAGS]) RUBY_WERROR_FLAG([