# Configure template for GNU M4. -*-Autoconf-*-
-# Copyright (C) 1991, 1993-1994, 2004-2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 1991, 1993-1994, 2004-2014, 2016-2017, 2020-2021 Free
+# Software Foundation, Inc.
#
# This file is part of GNU M4.
#
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
-AC_PREREQ([2.62])
+AC_PREREQ([2.64])
AC_INIT([GNU M4], m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[bug-m4@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([1.11.1 dist-bzip2 dist-xz color-tests parallel-tests
-silent-rules gnu])
+AM_INIT_AUTOMAKE([1.11.6 dist-bzip2 dist-xz color-tests parallel-tests
+silent-rules subdir-objects gnu])
+AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
m4_pattern_forbid([^M4_[A-Z]])
# M4 is single-threaded; so we can optimize gnulib code by using this:
gl_DISABLE_THREADS
+AC_DEFINE([GNULIB_REGEX_SINGLE_THREAD], [1], [Define to optimize regex.])
+AC_DEFINE([GNULIB_MBRTOWC_SINGLE_THREAD], [1], [Define to optimize mbrtowc.])
+AC_DEFINE([GNULIB_WCHAR_SINGLE_LOCALE], [1], [Define to optimize mbrtowc.])
AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([--enable-gcc-warnings],
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
esac
gl_gcc_warnings=$enableval],
- [gl_gcc_warnings=no]
+ [if test -f "$srcdir"/.tarball-version; then
+ gl_gcc_warnings=no
+ else
+ gl_gcc_warnings=yes
+ fi]
)
if test "$gl_gcc_warnings" = yes; then
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
AC_SUBST([WERROR_CFLAGS])
+ # We use '#pragma GCC diagnostic push' to silence some
+ # warnings, but older gcc doesn't support this.
+ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
+ [M4_cv_gcc_pragma_push_works], [
+ save_CFLAGS=$CFLAGS
+ CFLAGS='-Wunknown-pragmas -Werror'
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic pop
+ ]])],
+ [M4_cv_gcc_pragma_push_works=yes],
+ [M4_cv_gcc_pragma_push_works=no])
+ CFLAGS=$save_CFLAGS])
+
+ # This, $nw, is the list of warnings we disable.
nw=
- nw="$nw -Waggregate-return" # C90 is anachronistic
+ nw="$nw -Waggregate-return" # K&R is anachronistic
+ nw="$nw -Wtraditional-conversion" # K&R is anachronistic
+ nw="$nw -Wundef" # K&R is anachronistic
+ nw="$nw -Wtraditional" # K&R is anachronistic
nw="$nw -Wlong-long" # C90 is anachronistic
- nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
- nw="$nw -Wtraditional" # Warns on #elif which we use often
+ nw="$nw -Wvla" # gettext's use of VLAs is safe
nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
nw="$nw -Wpadded" # Our structs are not packed
- nw="$nw -Wredundant-decls" # Gnulib has multiple decls
- nw="$nw -Wformat-nonliteral" # Needed in builtin.c
- nw="$nw -Wunreachable-code" # Needed in output.c
nw="$nw -Wconversion" # Too many warnings for now
nw="$nw -Wsign-conversion" # Too many warnings for now
- nw="$nw -Wtraditional-conversion" # Too many warnings for now
nw="$nw -Wcast-qual" # Too many warnings for now
nw="$nw -Wswitch-enum" # Too many warnings for now
- # This, $nw, is the list of warnings we disable.
+ # gcc 4.4.6 complains enum-compare is C++ only; gcc 4.7.0 implies it in -Wall
+ nw="$nw -Wenum-compare"
+
+ # Gnulib uses '#pragma GCC diagnostic push' to silence some
+ # warnings, but older gcc doesn't support this.
+ AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
+ [M4_cv_gcc_pragma_push_works], [
+ save_CFLAGS=$CFLAGS
+ CFLAGS='-Wunknown-pragmas -Werror'
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic pop
+ ]])],
+ [M4_cv_gcc_pragma_push_works=yes],
+ [M4_cv_gcc_pragma_push_works=no])
+ CFLAGS=$save_CFLAGS])
+ if test $M4_cv_gcc_pragma_push_works = no; then
+ nw="$nw -Wmissing-prototypes"
+ nw="$nw -Wmissing-declarations"
+ nw="$nw -Wunreachable-code"
+ fi
gl_MANYWARN_ALL_GCC([ws])
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
gl_WARN_ADD([$w])
done
- gl_WARN_ADD([-fdiagnostics-show-option])
- gl_WARN_ADD([-funit-at-a-time])
+ # Gnulib turns on -Wformat=2, which implies -Wformat-nonliteral, but
+ # we temporarily override it in format.c if possible.
+ if test $M4_cv_gcc_pragma_push_works = no; then
+ gl_WARN_ADD([-Wno-format-nonliteral])
+ fi
AC_SUBST([WARN_CFLAGS])
- AC_DEFINE([_FORTIFY_SOURCE], [2],
- [enable compile-time and run-time bounds-checking, and some warnings])
+ AH_VERBATIM([FORTIFY_SOURCE],
+ [/* Enable compile-time and run-time bounds-checking, and some warnings,
+ without upsetting newer glibc. */
+ #if defined __OPTIMIZE__ && __OPTIMIZE__
+ # define _FORTIFY_SOURCE 2
+ #endif
+ ])
fi
# Tandem/NSK is broken - it has 'long long int' but not
with_syscmd_shell=/bin/sh
if test "$cross_compiling" != yes ; then
dnl Give mingw a default that is more likely to be available.
- AS_IF([AS_EXECUTABLE_P([/bin/sh])], [],
+ AS_IF([AS_EXECUTABLE_P([/bin/sh$EXEEXT])], [],
[if (cmd /c) 2>/dev/null; then with_syscmd_shell=cmd; fi])
dnl Too bad _AS_PATH_WALK is not public.
M4_save_IFS=$IFS; IFS=$PATH_SEPARATOR
AC_CONFIG_COMMANDS([stamp-h], [[test -z "$CONFIG_HEADERS" || date > stamp-h]])
+AS_CASE([$host], [*-*-os2*], [OS2_LDFLAGS="-Zargs-resp"])
+AC_SUBST([OS2_LDFLAGS])
+
+AM_GNU_GETTEXT([external], [need-formatstring-macros])
+AM_GNU_GETTEXT_VERSION([0.19.2])
+
AC_CONFIG_FILES([Makefile
doc/Makefile
lib/Makefile
+ po/Makefile.in
src/Makefile
tests/Makefile
checks/Makefile