1 # Configure template for GNU Diffutils.
3 # Copyright (C) 1994-1995, 1998, 2001-2002, 2004, 2006, 2009-2013, 2015-2024
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 [https://www.gnu.org/software/diffutils/])
27 AC_CONFIG_SRCDIR([src/diff.c])
28 AC_CONFIG_AUX_DIR([build-aux])
29 AC_CONFIG_MACRO_DIR([m4])
31 AM_INIT_AUTOMAKE([1.11 dist-xz no-dist-gzip subdir-objects
32 color-tests parallel-tests])
33 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
35 AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
39 AM_MISSING_PROG([HELP2MAN], [help2man])
42 gl_USE_SYSTEM_EXTENSIONS
45 # Ensure VLAs are not used.
46 # Note -Wvla is implicitly added by gl_MANYWARN_ALL_GCC
47 AC_DEFINE([GNULIB_NO_VLA], [1], [Define to 1 to disable use of VLAs])
49 # diffutils is single-threaded; optimize for this.
50 AC_DEFINE([GNULIB_EXCLUDE_SINGLE_THREAD], [1],
51 ['exclude' code is called only from 1 thread.])
52 AC_DEFINE([GNULIB_MBRTOWC_SINGLE_THREAD], [1],
53 ['mbrtowc', 'mbrtoc32', 'regex' code is called only from 1 thread.])
54 AC_DEFINE([GNULIB_REGEX_SINGLE_THREAD], [1],
55 ['regex' code is called only from 1 thread.])
56 AC_DEFINE([GNULIB_WCHAR_SINGLE_LOCALE], [1],
57 [Locale-sensitive functions are called only after locale is set.])
59 AC_DEFINE([GNULIB_MBRTOC32_REGULAR], [1],
60 [Do not worry about rare encodings like CP864, EBCDIC, Johab, and Shift JIS
61 that glibc does not support.])
63 # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
64 # ------------------------------------------------
65 # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
66 # Otherwise, run RUN-IF-NOT-FOUND.
67 AC_DEFUN([gl_GCC_VERSION_IFELSE],
71 #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
74 # error "your version of gcc is older than $1.$2"
81 AC_ARG_ENABLE([gcc-warnings],
82 [AS_HELP_STRING([[--enable-gcc-warnings[=TYPE]]],
83 [control generation of GCC warnings. The TYPE 'no' disables
84 warnings (default for non-developer builds); 'yes' generates
85 cheap warnings if available (default for developer builds);
86 'expensive' in addition generates expensive-to-compute warnings
90 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
92 gl_gcc_warnings=$enableval],
94 # GCC provides fine-grained control over diagnostics which
95 # is used in gnulib for example to suppress warnings from
96 # certain sections of code. So if this is available and
97 # we're running from a git repo, then auto enable the warnings.
99 gl_GCC_VERSION_IFELSE([4], [6],
100 [test -d "$srcdir"/.git \
101 && ! test -f "$srcdir"/.tarball-version \
102 && gl_gcc_warnings=yes])]
105 if test $gl_gcc_warnings != no; then
106 gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
107 AC_SUBST([WERROR_CFLAGS])
110 AS_IF([test $gl_gcc_warnings != expensive],
111 [# -fanalyzer and related options slow GCC considerably.
112 ew="$ew -fanalyzer -Wno-analyzer-malloc-leak"])
114 # This, $nw, is the list of warnings we disable.
116 nw="$nw -Winline" # not a correctness warning
117 nw="$nw -Wstack-protector" # not a correctness warning
119 gl_MANYWARN_ALL_GCC([ws])
120 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
124 gl_WARN_ADD([-Wno-sign-compare]) # Too many false positives
125 gl_WARN_ADD([-Wno-format-nonliteral])
127 AC_SUBST([WARN_CFLAGS])
129 AH_VERBATIM([FORTIFY_SOURCE],
130 [/* Enable compile-time and run-time bounds-checking, and some warnings,
131 without upsetting glibc 2.15+. */
132 #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ \
133 && !defined __MINGW32__
134 # define _FORTIFY_SOURCE 2
137 AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
142 AC_DEFINE([DEFAULT_EDITOR_PROGRAM], ["ed"],
143 [Name of editor program, unless overridden.])
145 AC_PATH_PROG([PR_PROGRAM], [pr], [""])
146 AC_DEFINE_UNQUOTED([PR_PROGRAM], ["$PR_PROGRAM"], [Name of "pr" program.])
148 AC_CHECK_MEMBERS([struct stat.st_blksize])
149 AC_CHECK_MEMBERS([struct stat.st_rdev])
154 AC_CHECK_FUNCS_ONCE([sigaction sigprocmask])
155 if test $ac_cv_func_sigprocmask = no; then
156 AC_CHECK_FUNCS([sigblock])
160 # When .tarball-version exists, we're building from a tarball
161 # and must not make man/*.1 files depend on the generated src/version.c,
162 # because that would induce a requirement to run the help2man perl script.
163 # We are not yet prepared to make perl a build-from-tarball requirement.
164 # Hence, here we detect .tarball-version existence. When not present,
165 # we define a variable to be used in man/Makefile.am to induce the
166 # proper dependency (so that man/*.1 will be rebuilt upon any version change),
167 # but not when built from a tarball.
168 AC_SUBST([SRC_VERSION_C])
169 test -f $srcdir/.tarball-version \
171 || SRC_VERSION_C=../src/version.c
173 AM_GNU_GETTEXT([external], [need-ngettext])
174 AM_GNU_GETTEXT_VERSION([0.19.2])
175 XGETTEXT="AWK='$AWK' \$(SHELL) \$(top_srcdir)/exgettext $XGETTEXT"
178 Makefile doc/Makefile
182 gnulib-tests/Makefile