From 8187a60ac362a1efc4ce3244ef845ccb1fb2e18c Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 19 Apr 2022 22:21:37 +0200 Subject: [PATCH] Add a configure test for -ansi and use it for none/tests/ansi --- configure.ac | 18 ++++++++++++++++++ none/tests/Makefile.am | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c627a9c17a..eda617fc58 100755 --- a/configure.ac +++ b/configure.ac @@ -2900,6 +2900,24 @@ AC_MSG_RESULT([no]) ]) CFLAGS=$safe_CFLAGS +AC_MSG_CHECKING([if gcc accepts -ansi]) + +safe_CFLAGS=$CFLAGS +CFLAGS="-ansi" + +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ + return 0; +]])], [ +ac_have_ansi=yes +AC_MSG_RESULT([yes]) +], [ +ac_have_ansi=no +AC_MSG_RESULT([no]) +]) +AM_CONDITIONAL([HAVE_ANSI], [test x$ac_have_ansi = xyes]) + +CFLAGS=$safe_CFLAGS + # Does this compiler support -no-pie? # On Ubuntu 16.10+, gcc produces position independent executables (PIE) by diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 2ac09e6202..727c2661bb 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -282,8 +282,8 @@ if ! VGCONF_OS_IS_DARWIN check_PROGRAMS += ppoll_alarm endif -# clang does not know -ansi -if ! COMPILER_IS_CLANG +# older (?) clang does not know -ansi +if HAVE_ANSI check_PROGRAMS += ansi endif -- 2.47.2