From 5bf8db785f3442e6e53270da6e51bcd6ea963aa5 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Fri, 12 Dec 2025 02:12:17 +0900 Subject: [PATCH] [configure] Prefer '-std=gnu99' to '-std=c99'. FreeType2 uses GCC extensions like 'typeof()', thus XX_ANSIFLAGS should prefer '-std=gnu99' to '-std=c99'. * builds/unix/configure.raw: To collect flags for XX_ANSIFLAGS, test '-std=gnu99' too. If '-std=gnu99' works, preceding '-std=c99' is removed from XX_ANSIFLAGS. --- builds/unix/configure.raw | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index 45a9be6e4..b12aef310 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -189,7 +189,10 @@ if test "x$GCC" = xyes; then *) XX_ANSIFLAGS="" - for a in "-pedantic" "-std=c99" + # FreeType2 uses GNU extension '__typeof__()', + # which is prohibited in strict C99 mode. + # Test -std=gnu99 is safe to use. + for a in "-pedantic" "-std=c99" "-std=gnu99" do AC_MSG_CHECKING([$CC compiler flag ${a} to assure ANSI C99 works correctly]) orig_CFLAGS="${CFLAGS}" @@ -214,6 +217,10 @@ if test "x$GCC" = xyes; then [AC_MSG_RESULT([no])]) CFLAGS="${orig_CFLAGS}" done + + # if both of -std=c99 and -std=gnu99 are acceptable, + # use -std=gnu99 only. + XX_ANSIFLAGS=`echo ${XX_ANSIFLAGS} | sed 's/-std=c99 -std=gnu99/-std=gnu99/'` ;; esac else