Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: assorted build system improvements, 2021-11 edition #10032

Merged
merged 11 commits into from
Nov 13, 2021
Prev Previous commit
Next Next commit
build: adjust compiler/C11 bits for autoconf 2.70+
`autoconf` finally arrived in the 2010s and tries to do ISO C11.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
  • Loading branch information
eqvinox committed Nov 11, 2021
commit 5b2184597185d015bc4db168079510266840c022
24 changes: 17 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ AM_PROG_CC_C_O
dnl remove autoconf default "-g -O2"
CFLAGS="$orig_cflags"
CXXFLAGS="$orig_cxxflags"
AC_PROG_CC_C99
dnl NB: see C11 below

dnl Some special handling for ICC later on
if test "$CC" = "icc"; then
Expand Down Expand Up @@ -254,12 +252,24 @@ if test "$cc_is_icc" = "yes"; then
AC_C_FLAG([-diag-error 10006])
fi

dnl AC_PROG_CC_C99 may change CC to include -std=gnu99 or something
ac_cc="$CC"
CC="${CC% -std=gnu99}"
CC="${CC% -std=c99}"
dnl autoconf 2.69 AC_PROG_CC_C99 is "state of the art"
dnl autoconf 2.70 AC_PROG_CC_C99 is deprecated and AC_PROC_CC tries to do C11
m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.70]), [-1], [dnl
dnl autoconf < 2.70
AC_PROG_CC_C99

AC_C_FLAG([-std=gnu11], [CC="$ac_cc"], [CC="$CC -std=gnu11"])
dnl AC_PROG_CC_C99 may change CC to include -std=gnu99 or something
ac_cc="$CC"
CC="${CC% -std=gnu99}"
CC="${CC% -std=c99}"

AC_C_FLAG([-std=gnu11], [CC="$ac_cc"], [CC="$CC -std=gnu11"])
], [
dnl autoconf >= 2.70
if test "$ac_cv_prog_cc_c11" = "no"; then
AC_MSG_ERROR([ISO C11 compiler support (with GNU extensions) is required.])
fi
])

dnl if the user has specified any CFLAGS, override our settings
if test "$enable_gcov" = "yes"; then
Expand Down