summaryrefslogtreecommitdiff
path: root/tool/m4
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-22 19:05:02 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-22 20:13:46 +0900
commitad150a14598980095260add74474498a642ab5ba (patch)
tree8e55da0b74162d9d0875361784b66a9fc2772e99 /tool/m4
parent2c25427496322f420d9acc58500f2855c9e04a2a (diff)
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`.
Diffstat (limited to 'tool/m4')
-rw-r--r--tool/m4/ruby_try_cflags.m415
1 files changed, 15 insertions, 0 deletions
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([