summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2024-11-19 00:45:39 +0100
committerMark Wielaard <[email protected]>2025-01-11 00:19:28 +0100
commitd5fe635875628a9de431c883c0e5037dec0f85f3 (patch)
treed70587cd48a43d5db07030c97043e6f182066cc1 /configure.ac
parent977c4dba220db572fe5ff43b6eb8b81673be0ef7 (diff)
Update minimum C compiler supported to C11 plus stdatomic.h
We were using a somewhat odd mix of gnu99 with a fallback atomics.h so we could build with gcc 4.7. Lets requires a compiler that can do at least C11 and has a stdatomic.h. So we can build against any C standard >= C11 (including C17 and C23). That means GCC 4.9+. GCC 4.9 was released in 2014. The lowest compiler version we check in the buildbots is currently GCC 8.3.0 (Debian old old stable, released in 2018). Also update the minimum autoconf version to 2.69. We would really like 2.70+ so we don't need the gnulib gnu11.m4. But 2.69 still seems in use on various stable systems. autoconf 2.70 was released end of 2020, autoconf 2.69 in 2012. * configure.ac (AC_PACKAGE_URL): Removed workaround for autoconf < 2.64. (AC_PREREQ): Update from 2.63 to 2.69. (AC_PROG_CC): Test for ac_cv_prog_cc_c11. (AC_CACHE_CHECK for stdatomic.h * config/eu.am (AM_CFLAGS): Remove -std=gnu99. * lib/Makefile.am (noinst_HEADERS): Remove atomics.h and stdatomic-fbsd.h. * lib/atomics.h: Removed. * lib/stdatomic-fbsd.h: Removed. * lib/dynamicsizehash_concurrent.h: Include stdatomic.h. * libdw/libdw_alloc.c: Likewise. * m4/.gitignore: Add !/std-gnu11.m4. * m4/std-gnu11.m4: New file from gnulib to provide AC_PROG_CC from autoconf 2.70. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac25
1 files changed, 9 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac
index 380ff060..1da2a12c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,12 +20,6 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
AC_INIT([elfutils],[0.192],[https://sourceware.org/bugzilla],[elfutils],[http://elfutils.org/])
-dnl Workaround for older autoconf < 2.64
-m4_ifndef([AC_PACKAGE_URL],
- [AC_DEFINE([PACKAGE_URL], ["http://elfutils.org/"],
- [Define to home page for this package])
- AC_SUBST([PACKAGE_URL], ["http://elfutils.org/"])])
-
LIBDEBUGINFOD_SONAME=libdebuginfod.so.1
AC_SUBST([LIBDEBUGINFOD_SONAME])
@@ -46,7 +40,7 @@ AC_CONFIG_AUX_DIR([config])
AC_CONFIG_FILES([config/Makefile])
AC_COPYRIGHT([Copyright (C) 1996-2024 The elfutils developers.])
-AC_PREREQ(2.63) dnl Minimum Autoconf version required.
+AC_PREREQ(2.69) dnl Minimum Autoconf version required.
dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
AM_INIT_AUTOMAKE([gnits 1.11 -Wno-portability dist-bzip2 no-dist-gzip parallel-tests])
@@ -88,7 +82,10 @@ AS_IF([test "$use_locks" = yes],
AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
-m4_version_prereq([2.70], [AC_PROG_CC], [AC_PROG_CC_C99])
+# Provided by gnulib's m4/std-gnu11.m4 for autoconf pre 2.70
+AC_PROG_CC
+AS_IF([test "x$ac_cv_prog_cc_c11" = "xno"],
+ [AC_MSG_ERROR([C11 support required])])
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_YACC
@@ -229,17 +226,13 @@ LDFLAGS="$save_LDFLAGS"])
AS_IF([test "x$ac_cv_tls" != xyes],
AC_MSG_ERROR([__thread support required]))
-dnl Before 4.9 gcc doesn't ship stdatomic.h, but the necessary atomics are
-dnl available by (at least) 4.7. So if the system doesn't have a stdatomic.h we
-dnl fall back on one copied from FreeBSD that handles the difference.
+dnl Although we test for C11 above that doesn't mean we have stdatomic.h
+dnl We need at least gcc 4.9+ for that.
AC_CACHE_CHECK([whether gcc provides stdatomic.h], ac_cv_has_stdatomic,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdatomic.h>]])],
ac_cv_has_stdatomic=yes, ac_cv_has_stdatomic=no)])
-AM_CONDITIONAL(HAVE_STDATOMIC_H, test "x$ac_cv_has_stdatomic" = xyes)
-AS_IF([test "x$ac_cv_has_stdatomic" = xyes], [AC_DEFINE(HAVE_STDATOMIC_H)])
-
-AH_TEMPLATE([HAVE_STDATOMIC_H], [Define to 1 if `stdatomic.h` is provided by the
- system, 0 otherwise.])
+AS_IF([test "x$ac_cv_has_stdatomic" = "xno"],
+ [AC_MSG_ERROR([stdatomic.h required])])
dnl This test must come as early as possible after the compiler configuration
dnl tests, because the choice of the file model can (in principle) affect