add packaging
[platform/upstream/findutils.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([GNU findutils], 4.5.14, [bug-findutils@gnu.org])
3 AC_CONFIG_AUX_DIR(build-aux)
4 AM_INIT_AUTOMAKE
5
6 AC_CONFIG_SRCDIR([find/pred.c])
7 AC_CONFIG_HEADERS([config.h])
8 AC_CANONICAL_HOST
9 AC_CONFIG_MACRO_DIR(gl/m4)
10
11 dnl Set of available languages.
12 ALL_LINGUAS="be bg cs ca da de el eo es et fi fr ga gl hr hu id it ja ko lg lt ms nl pl pt pt_BR ro ru rw sk sl sr sv tr uk vi zh_CN zh_TW"
13
14 AC_SUBST(AUXDIR,$ac_aux_dir)
15 dnl check for --with-fts
16 FIND_WITH_FTS
17
18 AC_ARG_ENABLE(id-cache,
19 [  --enable-id-cache       cache all UIDs & GIDs; avoid if using NIS or Hesiod],
20   AC_DEFINE([CACHE_IDS], 1, [Define if you want find -nouser and -nogroup to make tables of
21    used UIDs and GIDs at startup instead of using getpwuid or
22    getgrgid when needed.  Speeds up -nouser and -nogroup unless you
23    are running NIS or Hesiod, which make password and group calls
24    very expensive.]))
25
26 AC_ARG_ENABLE(debug,
27         AS_HELP_STRING(--enable-debug,Enable debugging output which is likely to be interesting to people debugging findutils),
28         [ac_cv_debug=$enableval],[ac_cv_debug=no])
29
30 AC_ARG_ENABLE(leaf-optimisation,
31         AS_HELP_STRING(--enable-leaf-optimisation,Enable an optimisation which saves lstat calls to identify subdirectories on filesystems having traditional Unix semantics),
32         [ac_cv_leaf_optimisation=$enableval],[ac_cv_leaf_optimisation=yes])
33
34 AC_ARG_ENABLE(d_type-optimization,
35         AS_HELP_STRING(--enable-d_type-optimization,Make use of the file type data returned in struct dirent.d_type by readdir()),
36         [ac_cv_d_type=$enableval],[ac_cv_d_type=yes])
37
38 dnl This one has no default, because otherwise we would have to say
39 dnl both --enable-d_type-optimisation=no and --enable-d_type-optimization=no
40 dnl to turn it off.
41 AC_ARG_ENABLE(d_type-optimisation,
42         AS_HELP_STRING(--enable-d_type-optimisation,Synonym for --enable-d_type-optimization),
43         [ac_cv_d_type=$enableval],[])
44
45
46 AC_MSG_CHECKING([whether debug output should be produced])
47 if test x$ac_cv_debug = xno; then
48    AC_MSG_RESULT([no])
49 else
50    AC_MSG_RESULT([yes])
51    AC_DEFINE([DEBUG], 1, [Define if you want to see find's innards])
52    AC_DEFINE([DEBUG_STAT], 1, [Define if you want to see a message every time find calls the stat() system call])
53 fi
54
55 AC_MSG_CHECKING([for leaf optimisation])
56 if test x$ac_cv_leaf_optimisation = xno; then
57    AC_MSG_RESULT([no])
58 else
59    AC_MSG_RESULT([yes])
60    AC_DEFINE([LEAF_OPTIMISATION], 1, [Define if you want to use the leaf optimisation (this can still be turned off with -noleaf)])
61 fi
62
63 AC_ARG_VAR([DEFAULT_ARG_SIZE], [Default size of arguments to child processes
64 of find and xargs, 128k if unspecified])
65 if test -n "$DEFAULT_ARG_SIZE"; then
66    AC_DEFINE_UNQUOTED([DEFAULT_ARG_SIZE], [$DEFAULT_ARG_SIZE],
67      [If defined, the default argument size used in child processes])
68 fi
69
70
71
72 dnl Checks for programs.
73 AC_PROG_CC
74 AC_PROG_CPP
75
76 dnl for gnulib
77 gl_EARLY
78
79 AC_PROG_INSTALL
80 AC_CHECK_TOOLS([AR], [ar])
81 AC_CHECK_TOOLS([RANLIB], [ranlib], [:])
82 dnl AC_PROG_LIBTOOL
83 AC_PROG_MAKE_SET
84 AC_SYS_LARGEFILE
85
86
87 gl_INIT
88
89 dnl Enable various GCC warnings.
90 gl_MANYWARN_ALL_GCC([warnings])
91 # Set up the list of the pointless, undesired warnings.
92 nw=
93 nw="$nw -Wsystem-headers"       # Don't let system headers trigger warnings
94 nw="$nw -Wundef"                # All compiler preprocessors support #if UNDEF
95 nw="$nw -Wtraditional"          # All compilers nowadays support ANSI C
96 nw="$nw -Wconversion"           # These warnings usually don't point to mistakes.
97 nw="$nw -Wsign-conversion"      # Likewise.
98 nw="$nw -Wc++-compat"           # malloc returns void* and a cast would be ugly.
99 # Warnings we might enable in the future, but not yet (because they generate a
100 # lot of noise).
101 marginal=""
102 marginal="$marginal -Wtraditional-conversion"
103 marginal="$marginal -Wpadded"
104 marginal="$marginal -Wformat-nonliteral"
105 marginal="$marginal -Wunreachable-code"
106 marginal="$marginal -Wunused-parameter"
107 excluded_warnings="$nw $marginal"
108
109 # Enable all GCC warnings not in this list.
110 gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$excluded_warnings])
111
112 AC_ARG_ENABLE(compiler-warnings,
113   AS_HELP_STRING(--enable-compiler-warnings,Enable many compiler warnings),
114   [
115     for w in $warnings
116     do
117       gl_WARN_ADD([$w])
118     done
119   ]
120   )
121
122 dnl Older versions of gl/m4/nls.m4 provide AM_MKINSTALLDIRS.
123 dnl The current version of gnulib does not, but the version of
124 dnl po/Makefile.in.in that comes with gettext-0.14.6 expects
125 dnl that @MKINSTALLDIRS@ will be expanded.
126 AM_MKINSTALLDIRS
127
128 dnl lib/regexprops needs to be a native program, because we need to
129 dnl run it in order to generate the documentation about the properties
130 dnl of regular expressions.  See lib/Makefile.am.
131 AM_CONDITIONAL(CROSS_COMPILING, [[test "x$cross_compiling" = xyes]])
132
133 dnl Try to get a POSIX.1 environment.
134
135 dnl Checks for libraries.  If getpwnam() isn't present in the
136 dnl C library, try -lsun.
137 AC_CHECK_FUNC(getpwnam, [],
138 [AC_CHECK_LIB(sun, getpwnam)])
139
140 AC_CHECK_LIB([m],[modf],[FINDLIBS="-lm $FINDLIBS"]
141   AC_DEFINE_UNQUOTED([HAVE_MODF_IN_LIBM],1,[modf is defined in -lm]))
142 AC_CHECK_LIB([m],[fabs],[FINDLIBS="-lm $FINDLIBS"]
143   AC_DEFINE_UNQUOTED([HAVE_FABS_IN_LIBM],1,[fabs is defined in -lm]))
144 AC_SUBST([FINDLIBS])
145
146 dnl Checks for header files.
147 AC_HEADER_STDC
148 AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h)
149 dnl fdleak.c needs sys/resource.h because it calls getrlimit(2).
150 AC_CHECK_HEADERS(sys/resource.h)
151 AC_HEADER_MAJOR
152 dnl TODO: it's possible gnulib eliminates the need for AC_HEADER_DIRENT.
153 AC_HEADER_DIRENT
154 AC_HEADER_STAT
155 AC_HEADER_SYS_WAIT
156
157
158 dnl Checks for typedefs, structures, and compiler characteristics.
159
160 AC_TYPE_UID_T
161 AC_TYPE_SIZE_T
162 AC_CHECK_TYPE(ssize_t, int)
163 AC_TYPE_PID_T
164 AC_CHECK_TYPE(ino_t, unsigned long)
165 AC_CHECK_TYPE(dev_t, unsigned long)
166 AC_TYPE_MODE_T
167 AC_STRUCT_ST_BLOCKS
168 AC_CHECK_MEMBERS([struct stat.st_rdev])
169
170 dnl fdleak.c uses PROMOTED_MODE_T, which is defined by gnulib.
171 gl_PROMOTED_TYPE_MODE_T
172
173
174 AC_STRUCT_TM
175 AC_STRUCT_TIMEZONE
176
177 dnl Checks for library functions that are provided by gnulib.
178 AC_FUNC_STRFTIME
179 AC_REPLACE_FUNCS(memcmp memset stpcpy strdup strstr strtol strtoul)
180 AC_CHECK_FUNCS(fchdir getcwd strerror endgrent endpwent setlocale)
181 AC_CHECK_FUNCS(getrusage)
182 AC_FUNC_VPRINTF
183 AC_FUNC_ALLOCA
184 AC_FUNC_CLOSEDIR_VOID
185
186 dnl We don't just use AC_FUNC_GETMNTENT directly because it
187 dnl will try to use -lsun on platforms which have getmntent() in the
188 dnl C library, for example UNICOS.
189 AC_CHECK_FUNC(getmntent, [], [AC_FUNC_GETMNTENT])
190 AC_CHECK_FUNCS(getmntent)
191 AC_CHECK_FUNCS(setmntent endmntent)
192
193
194 dnl Checks for library functions that are provided by findlib.
195 FINDLIB_REPLACE_FUNCS(waitpid strspn)
196 FINDLIB_REPLACE_FUNCS(forcefindlib)
197
198
199 # Check for common but not-POSIX functions.
200 AC_CHECK_FUNCS(setgroups)
201
202
203 dnl gl_XALLOC
204 gl_FUNC_ALLOCA
205
206 dnl Use gl_INCLUDED_REGEX so that findutils will build on systems like
207 dnl Solaris, which lacks those functions in libc (see GNU Savannah bug
208 dnl #11710) (Sun Sep  4 20:15:11 2005: gl_INCLUDED_REGEX no longer seems
209 dnl to be available in gnulib CVS)
210 gl_REGEX
211
212 AC_PREREQ(2.59)
213
214 jy_SORTZ
215
216
217 AC_CHECK_MEMBER(struct dirent.d_type,,,[
218 #include <sys/types.h>
219 #include <dirent.h>])
220
221 jy_AC_ATTRIBUTE_NORETURN
222
223 dnl internationalization macros
224 AM_GNU_GETTEXT([external])
225 AM_GNU_GETTEXT_VERSION([0.18.1])
226
227 dnl regextype.c and regexprops.c are designed to be usable outside findutils,
228 dnl but findutils doesn't want to support all the regex types in gnulib,
229 dnl and wants to support an additional one (RE_SYNTAX_EMACS|RE_DOT_NEWLINE).
230 dnl Hence they need to know if they are being compiled into findutils or not.
231 AC_DEFINE([FINDUTILS], 1, [Define if we are compiling GNU findutils])
232 AC_DEFINE([ALREADY_INCLUDED_CONFIG_H], 1, [Define so that source code can verify that config.h was already included])
233
234 dnl Test support.
235 AM_PATH_PYTHON(,, [:])
236 AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
237 AC_CHECK_PROGS([FAKETIME],[faketime],[:])
238 AM_CONDITIONAL([HAVE_FAKETIME], [test "$FAKETIME" != :])
239
240 # This is necessary so that .o files in LIBOBJS are also built via
241 # the ANSI2KNR-filtering rules.
242 #LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
243
244 # Note that in the list below, po/Makefile.in should appear before
245 # po/Makefile, so that po/Makefile can be created even if po/Makefile.in
246 # starts off missing.
247 AC_CONFIG_FILES([
248 Makefile
249 build-aux/Makefile
250 doc/Makefile
251 find/Makefile
252 find/testsuite/Makefile
253 gl/Makefile
254 gl/lib/Makefile
255 lib/Makefile
256 locate/Makefile
257 locate/testsuite/Makefile
258 m4/Makefile
259 po/Makefile.in
260 po/Makefile
261 tests/Makefile
262 xargs/Makefile
263 xargs/testsuite/Makefile
264 ])
265 AC_OUTPUT
266 dnl intl/Makefile