## Common automake fragments for elfutils subdirectory makefiles.
##
## Copyright (C) 2010, 2014, 2016 Red Hat, Inc.
-## Copyright (C) 2023, 2025 Mark J. Wielaard <mark@klomp.org>
+## Copyright (C) 2023, 2025, 2026 Mark J. Wielaard <mark@klomp.org>
##
## This file is part of elfutils.
##
MISSING_PARAMETER_NAME_WARNING=
endif
+if HAVE_DEPRECATED_NON_PROTOTYPE_WARNING
+DEPRECATED_NON_PROTOTYPE_WARNING=-Wdeprecated-non-prototype
+else
+DEPRECATED_NON_PROTOTYPE_WARNING=
+endif
+
+if HAVE_FREE_LABELS_WARNING
+FREE_LABELS_WARNINGS=-Wfree-labels
+else
+FREE_LABELS_WARNING=
+endif
+
AM_CFLAGS = -Wall -Wshadow -Wformat=2 \
-Wold-style-definition -Wstrict-prototypes $(TRAMPOLINES_WARNING) \
$(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
$(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
$(USE_AFTER_FREE3_WARNING) $(MISSING_PARAMETER_NAME_WARNING) \
+ $(DEPRECATED_NON_PROTOTYPE_WARNING) $(FREE_LABELS_WARNING) \
$(if $($(*F)_no_Werror),,-Werror) \
$(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
$(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
dnl Configure input file for elfutils. -*-autoconf-*-
dnl
dnl Copyright (C) 1996-2019, 2025 Red Hat, Inc.
-dnl Copyright (C) 2022, 2023 Mark J. Wielaard <mark@klomp.org>
+dnl Copyright (C) 2022, 2023, 2026 Mark J. Wielaard <mark@klomp.org>
dnl
dnl This file is part of elfutils.
dnl
AM_CONDITIONAL(HAVE_MISSING_PARAMETER_NAME_WARNING,
[test "x$ac_cv_missing_parameter_name" != "xno"])
+AC_CACHE_CHECK([whether the compiler accepts -Wdeprecated-non-prototype], ac_cv_deprecated_non_prototype, [dnl
+old_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wdeprecated-non-prototype -Werror"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
+ ac_cv_deprecated_non_prototype=yes,
+ ac_cv_deprecated_non_prototype=no)
+CFLAGS="$old_CFLAGS"])
+AM_CONDITIONAL(HAVE_DEPRECATED_NON_PROTOTYPE_WARNING,
+ [test "x$ac_cv_deprecated_non_prototype" != "xno"])
+
+AC_CACHE_CHECK([whether the compiler accepts -Wfree_labels], ac_cv_free_labels, [dnl
+old_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wfree-labels -Werror"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
+ ac_cv_free_labels=yes,
+ ac_cv_free_labels=no)
+CFLAGS="$old_CFLAGS"])
+AM_CONDITIONAL(HAVE_FREE_LABELS_WARNING,
+ [test "x$ac_cv_free_labels" != "xno"])
+
AC_CACHE_CHECK([whether the compiler accepts -fno-addrsig], ac_cv_fno_addrsig, [dnl
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-addrsig -Werror"