cvsimport
[findutils.git] / configure.ac
Commit [+]AuthorDateLineData
09ef63fd jay2007-11-25 11:36:10 +00001dnl Process this file with autoconf to produce a configure script.
5d1dc92b jay2008-03-16 20:43:37 +00002AC_INIT([GNU findutils], 4.5.0-CVS, [bug-findutils@gnu.org])
09ef63fd jay2007-11-25 11:36:10 +00003AC_CONFIG_AUX_DIR(build-aux)
4AM_INIT_AUTOMAKE
5
6AC_CONFIG_SRCDIR([find/pred.c])
7AC_CONFIG_HEADERS([config.h])
8AC_CANONICAL_HOST
9AC_CONFIG_MACRO_DIR(gnulib/m4)
10
11dnl Set of available languages.
12ALL_LINGUAS="be bg ca da de el eo es et fi fr ga gl hr hu id it ja ko lg ms nl pl pt pt_BR ro ru rw sk sl sr sv tr uk vi zh_CN zh_TW"
13
14AC_SUBST(INCLUDES)dnl
15AC_SUBST(AUXDIR,$ac_aux_dir)
16dnl check for --with-fts
17FIND_WITH_FTS
18
19AC_ARG_ENABLE(id-cache,
20[ --enable-id-cache cache all UIDs & GIDs; avoid if using NIS or Hesiod],
21 AC_DEFINE(CACHE_IDS, 1, [Define if you want find -nouser and -nogroup to make tables of
22 used UIDs and GIDs at startup instead of using getpwuid or
23 getgrgid when needed. Speeds up -nouser and -nogroup unless you
24 are running NIS or Hesiod, which make password and group calls
25 very expensive.]))
26
27AC_ARG_ENABLE(debug,
28 AS_HELP_STRING(--enable-debug,Enable debugging output which is likely to be interesting to people debugging findutils),
29 [ac_cv_debug=$enableval],[ac_cv_debug=no])
30
31AC_ARG_ENABLE(leaf-optimisation,
32 AS_HELP_STRING(--enable-leaf-optimisation,Enable an optimisation which saves lstat calls to identify subdirectories on filesystems having traditional Unix semantics),
33 [ac_cv_leaf_optimisation=$enableval],[ac_cv_leaf_optimisation=yes])
34
35AC_ARG_ENABLE(d_type-optimization,
36 AS_HELP_STRING(--enable-d_type-optimization,Make use of the file type data returned in struct dirent.d_type by readdir()),
37 [ac_cv_d_type=$enableval],[ac_cv_d_type=yes])
38
39dnl This one has no default, because otherwise we would have to say
40dnl both --enable-d_type-optimisation=no and --enable-d_type-optimization=no
41dnl to turn it off.
42AC_ARG_ENABLE(d_type-optimisation,
43 AS_HELP_STRING(--enable-d_type-optimisation,Synonym for --enable-d_type-optimization),
44 [ac_cv_d_type=$enableval],[])
45
46
47AC_MSG_CHECKING([whether debug output should be produced])
48if test x$ac_cv_debug = xno; then
49 AC_MSG_RESULT([no])
50else
51 AC_MSG_RESULT([yes])
52 AC_DEFINE(DEBUG, 1, [Define if you want to see find's innards])
53 AC_DEFINE(DEBUG_STAT, 1, [Define if you want to see a message every time find calls the stat() system call])
54fi
55
56AC_MSG_CHECKING([for leaf optimisation])
57if test x$ac_cv_leaf_optimisation = xno; then
58 AC_MSG_RESULT([no])
59else
60 AC_MSG_RESULT([yes])
61 AC_DEFINE(LEAF_OPTIMISATION, 1, [Define if you want to use the leaf optimisation (this can still be turned off with -noleaf)])
62fi
63
64AC_ARG_VAR([DEFAULT_ARG_SIZE], [Default size of arguments to child processes
65of find and xargs, 128k if unspecified])
66if test -n "$DEFAULT_ARG_SIZE"; then
67 AC_DEFINE_UNQUOTED([DEFAULT_ARG_SIZE], [$DEFAULT_ARG_SIZE],
68 [If defined, the default argument size used in child processes])
69fi
70
71
72
73dnl Checks for programs.
74AC_PROG_CC
75AC_PROG_CPP
76
09ef63fd jay2007-11-25 11:36:10 +000077dnl for gnulib
78gl_EARLY
09ef63fd jay2007-11-25 11:36:10 +000079
09ef63fd jay2007-11-25 11:36:10 +000080AM_C_PROTOTYPES
81
82AC_PROG_INSTALL
83AC_PROG_RANLIB
84dnl AC_PROG_LIBTOOL
85AC_PROG_MAKE_SET
86AC_SYS_LARGEFILE
87
88
89gl_INIT
90
91
92
93dnl Older versions of gnulib/m4/nls.m4 provide AM_MKINSTALLDIRS.
94dnl The current version of gnulib does not, but the version of
95dnl po/Makefile.in.in that comes with gettext-0.14.6 expects
96dnl that @MKINSTALLDIRS@ will be expanded.
97AM_MKINSTALLDIRS
98
99dnl lib/regexprops needs to be a native program, because we need to
100dnl run it in order to generate the documentation about the properties
101dnl of regular expressions. See lib/Makefile.am.
102AM_CONDITIONAL(CROSS_COMPILING, [[test "x$cross_compiling" = xyes]])
103
104dnl Try to get a POSIX.1 environment.
105
106dnl Checks for libraries. If getpwnam() isn't present in the
107dnl C library, try -lsun.
108AC_CHECK_FUNC(getpwnam, [],
109[AC_CHECK_LIB(sun, getpwnam)])
110
111AC_CHECK_LIB([m],[modf],[FINDLIBS="-lm $FINDLIBS"]
112 AC_DEFINE_UNQUOTED(HAVE_MODF_IN_LIBM,1,[modf is defined in -lm]))
113AC_CHECK_LIB([m],[fabs],[FINDLIBS="-lm $FINDLIBS"]
114 AC_DEFINE_UNQUOTED(HAVE_FABS_IN_LIBM,1,[fabs is defined in -lm]))
115AC_SUBST([FINDLIBS])
116
117dnl Checks for header files.
118AC_HEADER_STDC
119dnl Assume unistd.h is present - coreutils does too.
120AC_CHECK_HEADERS(fcntl.h string.h limits.h errno.h stdlib.h stddef.h)
121AC_CHECK_HEADERS(unistd.h sys/types.h inttypes.h fcntl.h locale.h stdint.h)
122AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h)
123dnl find.c needs sys/utsname.h because it calls uname(2).
124AC_CHECK_HEADERS(sys/utsname.h)
125AC_HEADER_MAJOR
126AC_HEADER_DIRENT
127AC_HEADER_STAT
128AC_HEADER_SYS_WAIT
129
130
131dnl Checks for typedefs, structures, and compiler characteristics.
132
133AC_TYPE_UID_T
134AC_TYPE_SIZE_T
135AC_CHECK_TYPE(ssize_t, int)
136AC_TYPE_PID_T
137AC_CHECK_TYPE(ino_t, unsigned long)
138AC_CHECK_TYPE(dev_t, unsigned long)
139AC_TYPE_MODE_T
140AC_STRUCT_ST_BLOCKS
141AC_CHECK_MEMBERS([struct stat.st_rdev])
142
143AC_MSG_CHECKING([whether we should use struct dirent.d_type, if available])
144if test x$ac_cv_d_type = xno; then
145 AC_MSG_RESULT([no])
146else
147 AC_MSG_RESULT([yes])
148 AC_DEFINE(USE_STRUCT_DIRENT_D_TYPE, 1,
149 [Defined if you specify --enable-d_type-optimisation to configure.])
150 AC_CHECK_MEMBERS([struct dirent.d_type],[
151 AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1,
152 [Define to 1 if your 'struct dirent' has a d_type member])],
153 [],[
154#include <sys/types.h>
155#include <dirent.h>])
156fi
157
158
159AC_STRUCT_TM
160AC_STRUCT_TIMEZONE
161
162dnl Checks for library functions that are provided by gnulib.
163AC_FUNC_STRFTIME
164AC_REPLACE_FUNCS(memcmp memset stpcpy strdup strstr strtol strtoul)
165AC_CHECK_FUNCS(fchdir getcwd strerror endgrent endpwent setlocale)
166AC_FUNC_VPRINTF
167AC_FUNC_ALLOCA
168AC_FUNC_CLOSEDIR_VOID
169
170dnl We don't just use AC_FUNC_GETMNTENT directly because it
171dnl will try to use -lsun on platforms which have getmntent() in the
172dnl C library, for example UNICOS.
173AC_CHECK_FUNC(getmntent, [], [AC_FUNC_GETMNTENT])
174AC_CHECK_FUNCS(getmntent)
175AC_CHECK_FUNCS(setmntent endmntent)
176
177
178dnl Checks for library functions that are provided by findlib.
179FINDLIB_REPLACE_FUNCS(waitpid strspn)
180FINDLIB_REPLACE_FUNCS(forcefindlib)
181
182
183# Check for common but not-POSIX functions.
184AC_CHECK_FUNCS(setgroups)
185
186
187dnl gl_XALLOC
188gl_FUNC_ALLOCA
189
190dnl Use gl_INCLUDED_REGEX so that findutils will build on systems like
191dnl Solaris, which lacks those functions in libc (see GNU Savannah bug
192dnl #11710) (Sun Sep 4 20:15:11 2005: gl_INCLUDED_REGEX no longer seems
193dnl to be available in gnulib CVS)
194gl_REGEX
195
196AC_PREREQ(2.59)
197
09ef63fd jay2007-11-25 11:36:10 +0000198jy_SORTZ
199
200
201AC_CHECK_MEMBER(struct dirent.d_type,,,[
202#include <sys/types.h>
203#include <dirent.h>])
204
205jy_AC_ATTRIBUTE_NORETURN
206
207dnl internationalization macros
208AM_GNU_GETTEXT([external])
209AM_GNU_GETTEXT_VERSION(0.14.5)
210
211dnl regextype.c and regexprops.c are designed to be usable outside findutils,
212dnl but findutils doesn't want to support all the regex types in gnulib,
213dnl and wants to support an additional one (RE_SYNTAX_EMACS|RE_DOT_NEWLINE).
214dnl Hence they need to know if they are being compiled into findutils or not.
215AC_DEFINE([FINDUTILS], 1, [Define if we are compiling GNU findutils])
216AC_DEFINE([ALREADY_INCLUDED_CONFIG_H], 1, [Define so that source code can verify that config.h was already included])
217
218# This is necessary so that .o files in LIBOBJS are also built via
219# the ANSI2KNR-filtering rules.
220#LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
221##AC_CONFIG_SUBDIRS(gnulib)
222AC_CONFIG_FILES(gnulib/Makefile gnulib/lib/Makefile)
223AC_CONFIG_FILES(m4/Makefile)
224AC_CONFIG_FILES([Makefile
225 tests/Makefile build-aux/Makefile
226 find/Makefile find/testsuite/Makefile
227 xargs/Makefile xargs/testsuite/Makefile
228 locate/Makefile locate/testsuite/Makefile
229 po/Makefile.in po/Makefile
230 doc/Makefile lib/Makefile
231 ])
232AC_OUTPUT
233dnl intl/Makefile