summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 557bdc3562e5de233d1957ff180dfb3850410fe3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
dnl Process this file with autoconf to produce a configure script.
AC_INIT([GNU findutils], 4.5.20-git, [bug-findutils@gnu.org])
AC_CONFIG_AUX_DIR(build-aux)
AM_INIT_AUTOMAKE

AC_CONFIG_SRCDIR([find/pred.c])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR(gl/m4)

dnl Set of available languages.
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 nb nl pl pt pt_BR ro ru rw sk sl sr sv tr uk vi zh_CN zh_TW"

AC_SUBST(AUXDIR,$ac_aux_dir)
dnl check for --with-fts
FIND_WITH_FTS

AC_ARG_ENABLE(id-cache,
[  --enable-id-cache       This currently has no effect.],)

AC_ARG_ENABLE(debug,
	AS_HELP_STRING(--enable-debug,Enable debugging output which is likely to be interesting to people debugging findutils),
	[ac_cv_debug=$enableval],[ac_cv_debug=no])

AC_ARG_ENABLE(leaf-optimisation,
	AS_HELP_STRING(--enable-leaf-optimisation,Enable an optimisation which saves lstat calls to identify subdirectories on filesystems having traditional Unix semantics),
	[ac_cv_leaf_optimisation=$enableval],[ac_cv_leaf_optimisation=yes])

AC_ARG_ENABLE(d_type-optimization,
	AS_HELP_STRING(--enable-d_type-optimization,Make use of the file type data returned in struct dirent.d_type by readdir()),
	[ac_cv_d_type=$enableval],[ac_cv_d_type=yes])

dnl This one has no default, because otherwise we would have to say
dnl both --enable-d_type-optimisation=no and --enable-d_type-optimization=no
dnl to turn it off.
AC_ARG_ENABLE(d_type-optimisation,
	AS_HELP_STRING(--enable-d_type-optimisation,Synonym for --enable-d_type-optimization),
	[ac_cv_d_type=$enableval],[])


AC_MSG_CHECKING([whether debug output should be produced])
if test x$ac_cv_debug = xno; then
   AC_MSG_RESULT([no])
else
   AC_MSG_RESULT([yes])
   AC_DEFINE([DEBUG], 1, [Define if you want to see find's innards])
   AC_DEFINE([DEBUG_STAT], 1, [Define if you want to see a message every time find calls the stat() system call])
fi

AC_MSG_CHECKING([for leaf optimisation])
if test x$ac_cv_leaf_optimisation = xno; then
   AC_MSG_RESULT([no])
else
   AC_MSG_RESULT([yes])
   AC_DEFINE([LEAF_OPTIMISATION], 1, [Define if you want to use the leaf optimisation (this can still be turned off with -noleaf)])
fi

AC_ARG_VAR([DEFAULT_ARG_SIZE], [Default size of arguments to child processes
of find and xargs, 128k if unspecified])
if test -n "$DEFAULT_ARG_SIZE"; then
   AC_DEFINE_UNQUOTED([DEFAULT_ARG_SIZE], [$DEFAULT_ARG_SIZE],
     [If defined, the default argument size used in child processes])
fi



dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP

dnl for gnulib
gl_EARLY
AC_PROG_LN_S
AC_PROG_INSTALL
AC_CHECK_TOOLS([AR], [ar])
AC_CHECK_TOOLS([RANLIB], [ranlib], [:])
dnl AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_SYS_LARGEFILE


gl_INIT

dnl Enable various GCC warnings.
gl_MANYWARN_ALL_GCC([warnings])
# Set up the list of the pointless, undesired warnings.
nw=
nw="$nw -Wsystem-headers"       # Don't let system headers trigger warnings
nw="$nw -Wundef"                # All compiler preprocessors support #if UNDEF
nw="$nw -Wtraditional"          # All compilers nowadays support ANSI C
nw="$nw -Wconversion"           # These warnings usually don't point to mistakes.
nw="$nw -Wsign-conversion"      # Likewise.
nw="$nw -Wc++-compat"           # malloc returns void* and a cast would be ugly.
# Warnings we might enable in the future, but not yet (because they generate a
# lot of noise).
marginal=""
marginal="$marginal -Wtraditional-conversion"
marginal="$marginal -Wpadded"
marginal="$marginal -Wformat-nonliteral"
marginal="$marginal -Wunreachable-code"
marginal="$marginal -Wunused-parameter"
excluded_warnings="$nw $marginal"

# Enable all GCC warnings not in this list.
gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$excluded_warnings])

AC_ARG_ENABLE(compiler-warnings,
  AS_HELP_STRING(--enable-compiler-warnings,Enable many compiler warnings),
  [
    for w in $warnings
    do
      gl_WARN_ADD([$w])
    done
  ]
  )

dnl Older versions of gl/m4/nls.m4 provide AM_MKINSTALLDIRS.
dnl The current version of gnulib does not, but the version of
dnl po/Makefile.in.in that comes with gettext-0.14.6 expects
dnl that @MKINSTALLDIRS@ will be expanded.
AM_MKINSTALLDIRS

dnl lib/regexprops needs to be a native program, because we need to
dnl run it in order to generate the documentation about the properties
dnl of regular expressions.  See lib/Makefile.am.
AM_CONDITIONAL(CROSS_COMPILING, [[test "x$cross_compiling" = xyes]])

dnl Try to get a POSIX.1 environment.

dnl Checks for libraries.  If getpwnam() isn't present in the
dnl C library, try -lsun.
AC_CHECK_FUNC(getpwnam, [],
[AC_CHECK_LIB(sun, getpwnam)])

AC_CHECK_LIB([m],[modf],[FINDLIBS="-lm $FINDLIBS"]
  AC_DEFINE_UNQUOTED([HAVE_MODF_IN_LIBM],1,[modf is defined in -lm]))
AC_CHECK_LIB([m],[fabs],[FINDLIBS="-lm $FINDLIBS"]
  AC_DEFINE_UNQUOTED([HAVE_FABS_IN_LIBM],1,[fabs is defined in -lm]))
AC_SUBST([FINDLIBS])

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h)
dnl fdleak.c needs sys/resource.h because it calls getrlimit(2).
AC_CHECK_FUNCS(getrlimit)
AC_HEADER_MAJOR
dnl TODO: it's possible gnulib eliminates the need for AC_HEADER_DIRENT.
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_SYS_WAIT


dnl Checks for typedefs, structures, and compiler characteristics.

AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPE(ssize_t, int)
AC_TYPE_PID_T
AC_CHECK_TYPE(ino_t, unsigned long)
AC_CHECK_TYPE(dev_t, unsigned long)
AC_TYPE_MODE_T
AC_STRUCT_ST_BLOCKS
AC_CHECK_MEMBERS([struct stat.st_rdev])

dnl fdleak.c uses PROMOTED_MODE_T, which is defined by gnulib.
gl_PROMOTED_TYPE_MODE_T


AC_STRUCT_TM
AC_STRUCT_TIMEZONE

dnl Checks for library functions that are provided by gnulib.
AC_FUNC_STRFTIME
AC_REPLACE_FUNCS(memcmp memset stpcpy strdup strstr strtol strtoul)
AC_CHECK_FUNCS(fchdir getcwd strerror endgrent endpwent setlocale)
AC_CHECK_FUNCS(getrusage)
AC_FUNC_VPRINTF
AC_FUNC_ALLOCA
AC_FUNC_CLOSEDIR_VOID

dnl We don't just use AC_FUNC_GETMNTENT directly because it
dnl will try to use -lsun on platforms which have getmntent() in the
dnl C library, for example UNICOS.
AC_CHECK_FUNC(getmntent, [], [AC_FUNC_GETMNTENT])
AC_CHECK_FUNCS(getmntent)
AC_CHECK_FUNCS(setmntent endmntent)


dnl Checks for library functions that are provided by findlib.
FINDLIB_REPLACE_FUNCS(waitpid strspn)
FINDLIB_REPLACE_FUNCS(forcefindlib)


# Check for common but not-POSIX functions.
AC_CHECK_FUNCS(setgroups)


dnl gl_XALLOC
gl_FUNC_ALLOCA

dnl Use gl_INCLUDED_REGEX so that findutils will build on systems like
dnl Solaris, which lacks those functions in libc (see GNU Savannah bug
dnl #11710) (Sun Sep  4 20:15:11 2005: gl_INCLUDED_REGEX no longer seems
dnl to be available in gnulib CVS)
gl_REGEX

AC_PREREQ(2.59)

jy_SORTZ


AC_CHECK_MEMBER(struct dirent.d_type,,,[
#include <sys/types.h>
#include <dirent.h>])

jy_AC_ATTRIBUTE_NORETURN

dnl internationalization macros
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.3])

dnl regextype.c and regexprops.c are designed to be usable outside findutils,
dnl but findutils doesn't want to support all the regex types in gnulib,
dnl and wants to support an additional one (RE_SYNTAX_EMACS|RE_DOT_NEWLINE).
dnl Hence they need to know if they are being compiled into findutils or not.
AC_DEFINE([FINDUTILS], 1, [Define if we are compiling GNU findutils])
AC_DEFINE([ALREADY_INCLUDED_CONFIG_H], 1, [Define so that source code can verify that config.h was already included])

dnl Test support.
AM_PATH_PYTHON(,, [:])
AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
AC_CHECK_PROGS([FAKETIME],[faketime],[:])
AM_CONDITIONAL([HAVE_FAKETIME], [test "$FAKETIME" != :])

# This is necessary so that .o files in LIBOBJS are also built via
# the ANSI2KNR-filtering rules.
#LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`

# Note that in the list below, po/Makefile.in should appear before
# po/Makefile, so that po/Makefile can be created even if po/Makefile.in
# starts off missing.
AC_CONFIG_FILES([
Makefile
build-aux/Makefile
doc/Makefile
find/Makefile
find/testsuite/Makefile
gl/Makefile
gl/lib/Makefile
lib/Makefile
locate/Makefile
locate/testsuite/Makefile
m4/Makefile
po/Makefile.in
po/Makefile
tests/Makefile
xargs/Makefile
xargs/testsuite/Makefile
])
AC_OUTPUT
dnl intl/Makefile