Bump to 3.10
[platform/upstream/diffutils.git] / configure.ac
1 # Configure template for GNU Diffutils.
2
3 # Copyright (C) 1994-1995, 1998, 2001-2002, 2004, 2006, 2009-2013, 2015-2023
4 # Free Software Foundation, Inc.
5
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.
10
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.
15
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/>.
18
19 AC_PREREQ([2.64])
20
21 AC_INIT([GNU diffutils],
22         m4_esyscmd([build-aux/git-version-gen .tarball-version]),
23         [bug-diffutils@gnu.org])
24
25 AC_CONFIG_SRCDIR([src/diff.c])
26 AC_CONFIG_AUX_DIR([build-aux])
27 AC_CONFIG_MACRO_DIR([m4])
28
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.
32
33 AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
34
35 AC_PROG_AWK
36 AC_PROG_CC
37 AM_PROG_CC_C_O
38 AM_MISSING_PROG([HELP2MAN], [help2man])
39 AC_PROG_RANLIB
40 gl_EARLY
41 gl_USE_SYSTEM_EXTENSIONS
42 gl_INIT
43
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])
47
48 AC_ARG_ENABLE([gcc-warnings],
49   [AS_HELP_STRING([--enable-gcc-warnings],
50                   [turn on lots of GCC warnings (for developers)])],
51   [case $enableval in
52      yes|no) ;;
53      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
54    esac
55    gl_gcc_warnings=$enableval],
56   [if test -d "$srcdir"/.git; then
57      gl_gcc_warnings=yes
58    else
59      gl_gcc_warnings=no
60    fi]
61 )
62
63 if test "$gl_gcc_warnings" = yes; then
64   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
65   AC_SUBST([WERROR_CFLAGS])
66
67   nw=
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
71
72   gl_MANYWARN_ALL_GCC([ws])
73   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
74   for w in $ws; do
75     gl_WARN_ADD([$w])
76   done
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])
80
81   gl_WARN_ADD([-fdiagnostics-show-option])
82   gl_WARN_ADD([-funit-at-a-time])
83   gl_WARN_ADD([-fno-common])
84
85   AC_SUBST([WARN_CFLAGS])
86
87   AC_DEFINE([GCC_LINT], [1],
88     [Define to 1 if the compiler is checking for lint.])
89   AC_DEFINE([_FORTIFY_SOURCE], [2],
90     [enable compile-time and run-time bounds-checking, and some warnings])
91   AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
92
93   # We use a slightly smaller set of warning options for lib/.
94   # Remove the following and save the result in GNULIB_WARN_CFLAGS.
95   nw=
96   nw="$nw -Wunused-macros"
97   nw="$nw -Wsuggest-attribute=pure"
98   nw="$nw -Wduplicated-branches"    # Too many false alarms
99
100   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
101   AC_SUBST([GNULIB_WARN_CFLAGS])
102 fi
103
104 AC_C_INLINE
105
106 AC_DEFINE([DEFAULT_EDITOR_PROGRAM], ["ed"],
107   [Name of editor program, unless overridden.])
108
109 AC_PATH_PROG([PR_PROGRAM], [pr], [""])
110 AC_DEFINE_UNQUOTED([PR_PROGRAM], ["$PR_PROGRAM"], [Name of "pr" program.])
111
112 AC_CHECK_MEMBERS([struct stat.st_blksize])
113 AC_CHECK_MEMBERS([struct stat.st_rdev])
114 AC_HEADER_DIRENT
115 AC_HEADER_SYS_WAIT
116 AC_TYPE_PID_T
117
118 AC_CHECK_FUNCS_ONCE([sigaction sigprocmask strcasecoll stricoll])
119 if test $ac_cv_func_sigprocmask = no; then
120   AC_CHECK_FUNCS([sigblock])
121 fi
122 AC_FUNC_CLOSEDIR_VOID
123 AC_FUNC_FORK
124
125 # When .tarball-version exists, we're building from a tarball
126 # and must not make man/*.1 files depend on the generated src/version.c,
127 # because that would induce a requirement to run the help2man perl script.
128 # We are not yet prepared to make perl a build-from-tarball requirement.
129 # Hence, here we detect .tarball-version existence.  When not present,
130 # we define a variable to be used in man/Makefile.am to induce the
131 # proper dependency (so that man/*.1 will be rebuilt upon any version change),
132 # but not when built from a tarball.
133 AC_SUBST([SRC_VERSION_C])
134 test -f $srcdir/.tarball-version \
135   && SRC_VERSION_C= \
136   || SRC_VERSION_C=../src/version.c
137
138 AM_GNU_GETTEXT([external], [need-ngettext])
139 AM_GNU_GETTEXT_VERSION([0.19.2])
140 XGETTEXT="AWK='$AWK' \$(SHELL) \$(top_srcdir)/exgettext $XGETTEXT"
141
142 AC_CONFIG_FILES([
143   Makefile doc/Makefile
144   lib/Makefile
145   src/Makefile
146   tests/Makefile
147   gnulib-tests/Makefile
148   man/Makefile
149   po/Makefile.in
150 ])
151 AC_OUTPUT