remove patches
[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 Free Software
4 # 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.61)
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 color-tests parallel-tests])
30 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
31
32 AC_CONFIG_HEADER([lib/config.h:lib/config.hin])
33
34 AC_PROG_AWK
35 AC_PROG_CC
36 AM_MISSING_PROG([HELP2MAN], [help2man])
37 AC_PROG_RANLIB
38 gl_EARLY
39 gl_USE_SYSTEM_EXTENSIONS
40 gl_INIT
41
42 AC_ARG_ENABLE([gcc-warnings],
43   [AS_HELP_STRING([--enable-gcc-warnings],
44                   [turn on lots of GCC warnings (for developers)])],
45   [case $enableval in
46      yes|no) ;;
47      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
48    esac
49    gl_gcc_warnings=$enableval],
50   [if test -d "$srcdir"/.git; then
51      gl_gcc_warnings=yes
52    else
53      gl_gcc_warnings=no
54    fi]
55 )
56
57 if test "$gl_gcc_warnings" = yes; then
58   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
59   AC_SUBST([WERROR_CFLAGS])
60
61   nw=
62   # This, $nw, is the list of warnings we disable.
63   nw="$nw -Wdeclaration-after-statement" # too useful to forbid
64   nw="$nw -Waggregate-return"       # anachronistic
65   nw="$nw -Wlong-long"              # C90 is anachronistic (lib/gethrxtime.h)
66   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
67   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
68   nw="$nw -Wtraditional"            # Warns on #elif which we use often
69   nw="$nw -Wcast-qual"              # Too many warnings for now
70   nw="$nw -Wconversion"             # Too many warnings for now
71   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
72   nw="$nw -Wsign-conversion"        # Too many warnings for now
73   nw="$nw -Wtraditional-conversion" # Too many warnings for now
74   nw="$nw -Wunreachable-code"       # Too many warnings for now
75   nw="$nw -Wpadded"                 # Our structs are not padded
76   nw="$nw -Wredundant-decls"        # openat.h declares e.g., mkdirat
77   nw="$nw -Wlogical-op"             # any use of fwrite provokes this
78   nw="$nw -Wformat-nonliteral"      # who.c and pinky.c strftime uses
79   nw="$nw -Wvla"                    # warnings in gettext.h
80   nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
81   nw="$nw -Wswitch-enum"            # Too many warnings for now
82   nw="$nw -Wswitch-default"         # Too many warnings for now
83   nw="$nw -Wstack-protector"        # not worth working around
84   # things I might fix soon:
85   nw="$nw -Wfloat-equal"            # sort.c, seq.c
86   nw="$nw -Wmissing-format-attribute" # copy.c
87   nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
88   nw="$nw -Winline"                 # system.h's readdir_ignoring_dot_and_dotdot
89   nw="$nw -Wstrict-overflow"        # expr.c, pr.c, tr.c, factor.c
90   nw="$nw -Wformat-extra-args"      # sdiff.c
91   # ?? -Wstrict-overflow
92
93   gl_MANYWARN_ALL_GCC([ws])
94   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
95   for w in $ws; do
96     gl_WARN_ADD([$w])
97   done
98   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
99   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
100   gl_WARN_ADD([-Wno-pointer-sign])     # Too many warnings for now
101   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
102   gl_WARN_ADD([-Wno-format-nonliteral])
103
104   # In spite of excluding -Wlogical-op above, it is enabled, as of
105   # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
106   gl_WARN_ADD([-Wno-logical-op])
107
108   gl_WARN_ADD([-fdiagnostics-show-option])
109   gl_WARN_ADD([-funit-at-a-time])
110
111   AC_SUBST([WARN_CFLAGS])
112
113   AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
114   AC_DEFINE([_FORTIFY_SOURCE], [2],
115     [enable compile-time and run-time bounds-checking, and some warnings])
116   AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
117
118   # We use a slightly smaller set of warning options for lib/.
119   # Remove the following and save the result in GNULIB_WARN_CFLAGS.
120   nw=
121   nw="$nw -Wunused-macros"
122   nw="$nw -Wmissing-prototypes"
123   nw="$nw -Wold-style-definition"
124   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
125   AC_SUBST([GNULIB_WARN_CFLAGS])
126 fi
127
128 AC_C_INLINE
129 AC_C_VARARRAYS
130
131 AC_DEFINE([DEFAULT_EDITOR_PROGRAM], ["ed"],
132   [Name of editor program, unless overridden.])
133
134 AC_PATH_PROG([PR_PROGRAM], [pr], [""])
135 AC_DEFINE_UNQUOTED([PR_PROGRAM], ["$PR_PROGRAM"], [Name of "pr" program.])
136
137 AC_CHECK_MEMBERS([struct stat.st_blksize])
138 AC_CHECK_MEMBERS([struct stat.st_rdev])
139 AC_HEADER_DIRENT
140 AC_HEADER_SYS_WAIT
141 AC_TYPE_PID_T
142
143 AC_CHECK_FUNCS_ONCE([sigaction sigprocmask strcasecoll stricoll])
144 if test $ac_cv_func_sigprocmask = no; then
145   AC_CHECK_FUNCS([sigblock])
146 fi
147 AC_FUNC_CLOSEDIR_VOID
148 AC_FUNC_FORK
149
150 # When .tarball-version exists, we're building from a tarball
151 # and must not make man/*.1 files depend on the generated src/version.c,
152 # because that would induce a requirement to run the help2man perl script.
153 # We are not yet prepared to make perl a build-from-tarball requirement.
154 # Hence, here we detect .tarball-version existence.  When not present,
155 # we define a variable to be used in man/Makefile.am to induce the
156 # proper dependency (so that man/*.1 will be rebuilt upon any version change),
157 # but not when built from a tarball.
158 AC_SUBST([SRC_VERSION_C])
159 test -f $srcdir/.tarball-version \
160   && SRC_VERSION_C= \
161   || SRC_VERSION_C=../src/version.c
162
163 AM_GNU_GETTEXT([external], [need-ngettext])
164 AM_GNU_GETTEXT_VERSION([0.18.2])
165 XGETTEXT="AWK='$AWK' \$(SHELL) \$(top_srcdir)/exgettext $XGETTEXT"
166
167 AC_CONFIG_FILES([
168   Makefile doc/Makefile
169   lib/Makefile
170   src/Makefile
171   tests/Makefile
172   gnulib-tests/Makefile
173   man/Makefile
174   po/Makefile.in
175 ])
176 AC_OUTPUT