1 # Configure template for GNU Diffutils.
3 # Copyright (C) 1994-1995, 1998, 2001-2002, 2004, 2006, 2009-2013, 2015-2021
4 # Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 AC_INIT([GNU diffutils],
22 m4_esyscmd([build-aux/git-version-gen .tarball-version]),
23 [bug-diffutils@gnu.org])
25 AC_CONFIG_SRCDIR([src/diff.c])
26 AC_CONFIG_AUX_DIR([build-aux])
27 AC_CONFIG_MACRO_DIR([m4])
29 AM_INIT_AUTOMAKE([1.11 dist-xz no-dist-gzip subdir-objects
30 color-tests parallel-tests])
31 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
33 AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
38 AM_MISSING_PROG([HELP2MAN], [help2man])
41 gl_USE_SYSTEM_EXTENSIONS
44 # Ensure VLAs are not used.
45 # Note -Wvla is implicitly added by gl_MANYWARN_ALL_GCC
46 AC_DEFINE([GNULIB_NO_VLA], [1], [Define to 1 to disable use of VLAs])
48 AC_ARG_ENABLE([gcc-warnings],
49 [AS_HELP_STRING([--enable-gcc-warnings],
50 [turn on lots of GCC warnings (for developers)])],
53 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
55 gl_gcc_warnings=$enableval],
56 [if test -d "$srcdir"/.git; then
63 if test "$gl_gcc_warnings" = yes; then
64 gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
65 AC_SUBST([WERROR_CFLAGS])
68 # This, $nw, is the list of warnings we disable.
69 nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
70 nw="$nw -Wstack-protector" # not worth working around
72 gl_MANYWARN_ALL_GCC([ws])
73 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
77 gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
78 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
79 gl_WARN_ADD([-Wno-format-nonliteral])
81 gl_WARN_ADD([-fdiagnostics-show-option])
82 gl_WARN_ADD([-funit-at-a-time])
83 gl_WARN_ADD([-fno-common])
85 AC_SUBST([WARN_CFLAGS])
87 AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
88 AC_DEFINE([_FORTIFY_SOURCE], [2],
89 [enable compile-time and run-time bounds-checking, and some warnings])
90 AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
92 # We use a slightly smaller set of warning options for lib/.
93 # Remove the following and save the result in GNULIB_WARN_CFLAGS.
95 nw="$nw -Wunused-macros"
96 nw="$nw -Wsuggest-attribute=pure"
97 nw="$nw -Wduplicated-branches" # Too many false alarms
99 # Avoid false alarm in lib/vasnprintf.c.
100 # https://lists.gnu.org/r/bug-gnulib/2021-01/msg00031.html
101 gl_WARN_ADD([-Wno-analyzer-null-argument])
103 gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
104 AC_SUBST([GNULIB_WARN_CFLAGS])
109 AC_DEFINE([DEFAULT_EDITOR_PROGRAM], ["ed"],
110 [Name of editor program, unless overridden.])
112 AC_PATH_PROG([PR_PROGRAM], [pr], [""])
113 AC_DEFINE_UNQUOTED([PR_PROGRAM], ["$PR_PROGRAM"], [Name of "pr" program.])
115 AC_CHECK_MEMBERS([struct stat.st_blksize])
116 AC_CHECK_MEMBERS([struct stat.st_rdev])
121 AC_CHECK_FUNCS_ONCE([sigaction sigprocmask strcasecoll stricoll])
122 if test $ac_cv_func_sigprocmask = no; then
123 AC_CHECK_FUNCS([sigblock])
125 AC_FUNC_CLOSEDIR_VOID
128 # When .tarball-version exists, we're building from a tarball
129 # and must not make man/*.1 files depend on the generated src/version.c,
130 # because that would induce a requirement to run the help2man perl script.
131 # We are not yet prepared to make perl a build-from-tarball requirement.
132 # Hence, here we detect .tarball-version existence. When not present,
133 # we define a variable to be used in man/Makefile.am to induce the
134 # proper dependency (so that man/*.1 will be rebuilt upon any version change),
135 # but not when built from a tarball.
136 AC_SUBST([SRC_VERSION_C])
137 test -f $srcdir/.tarball-version \
139 || SRC_VERSION_C=../src/version.c
141 AM_GNU_GETTEXT([external], [need-ngettext])
142 AM_GNU_GETTEXT_VERSION([0.19.2])
143 XGETTEXT="AWK='$AWK' \$(SHELL) \$(top_srcdir)/exgettext $XGETTEXT"
146 Makefile doc/Makefile
150 gnulib-tests/Makefile