cvsimport
[findutils.git] / configure.ac
blobc0de7c5afe052a8bb860c16aa0dd577c6710f646
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([GNU findutils], 4.3.9-CVS, [bug-findutils@gnu.org])
3 AC_CONFIG_AUX_DIR(build-aux)
4 AM_INIT_AUTOMAKE
6 AC_CONFIG_SRCDIR([find/pred.c])
7 AC_CONFIG_HEADERS([config.h])
8 AC_CANONICAL_HOST
9 AC_CONFIG_MACRO_DIR(gnulib/m4)
11 dnl Set of available languages.
12 ALL_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"
14 AC_SUBST(INCLUDES)dnl
15 AC_SUBST(AUXDIR,$ac_aux_dir)
16 dnl check for --with-fts
17 FIND_WITH_FTS
19 AC_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.]))
27 AC_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])
31 AC_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])
35 AC_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])
39 dnl This one has no default, because otherwise we would have to say
40 dnl both --enable-d_type-optimisation=no and --enable-d_type-optimization=no
41 dnl to turn it off.
42 AC_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],[])
47 AC_MSG_CHECKING([whether debug output should be produced])
48 if test x$ac_cv_debug = xno; then
49    AC_MSG_RESULT([no])
50 else
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])
56 AC_MSG_CHECKING([for leaf optimisation])
57 if test x$ac_cv_leaf_optimisation = xno; then
58    AC_MSG_RESULT([no])
59 else
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)])
64 AC_ARG_VAR([DEFAULT_ARG_SIZE], [Default size of arguments to child processes
65 of find and xargs, 128k if unspecified])
66 if 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])
73 dnl Checks for programs.
74 AC_PROG_CC
75 AC_PROG_CPP
77 AC_AIX
80 dnl AC_MINIX
81 dnl for gnulib
82 gl_EARLY
83 dnl gl_EARLY calls AC_GNU_SOURCE anyway.
86 AC_ISC_POSIX
87 AM_C_PROTOTYPES
89 AC_PROG_INSTALL
90 AC_PROG_RANLIB
91 dnl AC_PROG_LIBTOOL
92 AC_PROG_MAKE_SET
93 AC_SYS_LARGEFILE
96 gl_INIT
100 dnl Older versions of gnulib/m4/nls.m4 provide AM_MKINSTALLDIRS.
101 dnl The current version of gnulib does not, but the version of
102 dnl po/Makefile.in.in that comes with gettext-0.14.6 expects
103 dnl that @MKINSTALLDIRS@ will be expanded.
104 AM_MKINSTALLDIRS
106 dnl lib/regexprops needs to be a native program, because we need to
107 dnl run it in order to generate the documentation about the properties
108 dnl of regular expressions.  See lib/Makefile.am.
109 AM_CONDITIONAL(CROSS_COMPILING, [[test "x$cross_compiling" = xyes]])
111 dnl Try to get a POSIX.1 environment.
113 dnl Checks for libraries.  If getpwnam() isn't present in the
114 dnl C library, try -lsun.
115 AC_CHECK_FUNC(getpwnam, [],
116 [AC_CHECK_LIB(sun, getpwnam)])
118 AC_CHECK_LIB([m],[modf],[FINDLIBS="-lm $FINDLIBS"]
119   AC_DEFINE_UNQUOTED(HAVE_MODF_IN_LIBM,1,[modf is defined in -lm]))
120 AC_CHECK_LIB([m],[fabs],[FINDLIBS="-lm $FINDLIBS"]
121   AC_DEFINE_UNQUOTED(HAVE_FABS_IN_LIBM,1,[fabs is defined in -lm]))
122 AC_SUBST([FINDLIBS])
124 dnl Checks for header files.
125 AC_HEADER_STDC
126 dnl Assume unistd.h is present - coreutils does too.
127 AC_CHECK_HEADERS(fcntl.h string.h limits.h errno.h stdlib.h stddef.h)
128 AC_CHECK_HEADERS(unistd.h sys/types.h inttypes.h fcntl.h locale.h stdint.h)
129 AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h)
130 dnl find.c needs sys/utsname.h because it calls uname(2).
131 AC_CHECK_HEADERS(sys/utsname.h)
132 AC_HEADER_MAJOR
133 AC_HEADER_DIRENT
134 AC_HEADER_STAT
135 AC_HEADER_SYS_WAIT
138 dnl Checks for typedefs, structures, and compiler characteristics.
140 AC_TYPE_UID_T
141 AC_TYPE_SIZE_T
142 AC_CHECK_TYPE(ssize_t, int)
143 AC_TYPE_PID_T
144 AC_CHECK_TYPE(ino_t, unsigned long)
145 AC_CHECK_TYPE(dev_t, unsigned long)
146 AC_TYPE_MODE_T
147 AC_STRUCT_ST_BLOCKS
148 AC_CHECK_MEMBERS([struct stat.st_rdev])
150 AC_MSG_CHECKING([whether we should use struct dirent.d_type, if available])
151 if test x$ac_cv_d_type = xno; then
152    AC_MSG_RESULT([no])
153 else
154    AC_MSG_RESULT([yes])
155    AC_DEFINE(USE_STRUCT_DIRENT_D_TYPE, 1,
156    [Defined if you specify --enable-d_type-optimisation to configure.])
157    AC_CHECK_MEMBERS([struct dirent.d_type],[
158    AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1,
159    [Define to 1 if your 'struct dirent' has a d_type member])],
160    [],[
161 #include <sys/types.h>
162 #include <dirent.h>])
166 AC_STRUCT_TM
167 AC_STRUCT_TIMEZONE
169 dnl Checks for library functions that are provided by gnulib.
170 AC_FUNC_STRFTIME
171 AC_REPLACE_FUNCS(memcmp memset stpcpy strdup strstr strtol strtoul)
172 AC_CHECK_FUNCS(fchdir getcwd strerror endgrent endpwent setlocale)
173 AC_FUNC_VPRINTF
174 AC_FUNC_ALLOCA
175 AC_FUNC_CLOSEDIR_VOID
177 dnl We don't just use AC_FUNC_GETMNTENT directly because it
178 dnl will try to use -lsun on platforms which have getmntent() in the
179 dnl C library, for example UNICOS.
180 AC_CHECK_FUNC(getmntent, [], [AC_FUNC_GETMNTENT])
181 AC_CHECK_FUNCS(getmntent)
182 AC_CHECK_FUNCS(setmntent endmntent)
185 dnl Checks for library functions that are provided by findlib.
186 FINDLIB_REPLACE_FUNCS(waitpid strspn)
187 FINDLIB_REPLACE_FUNCS(forcefindlib)
190 # Check for common but not-POSIX functions.
191 AC_CHECK_FUNCS(setgroups)
194 dnl gl_XALLOC
195 gl_FUNC_ALLOCA
197 dnl Use gl_INCLUDED_REGEX so that findutils will build on systems like
198 dnl Solaris, which lacks those functions in libc (see GNU Savannah bug
199 dnl #11710) (Sun Sep  4 20:15:11 2005: gl_INCLUDED_REGEX no longer seems
200 dnl to be available in gnulib CVS)
201 gl_REGEX
203 AC_PREREQ(2.59)
205 # Define intmax_t to 'signed long' or 'signed long long'
206 # if it is not already defined in <stdint.h> or <inttypes.h>.
207 dnl Derived from gnulib's uintmax_t which was from Paul Eggert.
208 AC_DEFUN([jy_AC_TYPE_INTMAX_T],
210   if test $ac_cv_header_inttypes_h = no && test $ac_cv_header_stdint_h = no; then
211     AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
212     test $ac_cv_type_long_long = yes \
213       && ac_type='long long' \
214       || ac_type='long'
215     AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
216       [Define to signed long or signed long long
217        if <stdint.h> and <inttypes.h> don't define.])
218   else
219     AC_DEFINE(HAVE_INTMAX_T, 1,
220       [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
221   fi
224 jy_AC_TYPE_INTMAX_T
225 jy_SORTZ
228 AC_CHECK_MEMBER(struct dirent.d_type,,,[
229 #include <sys/types.h>
230 #include <dirent.h>])
232 jy_AC_ATTRIBUTE_NORETURN
234 dnl internationalization macros
235 AM_GNU_GETTEXT([external])
236 AM_GNU_GETTEXT_VERSION(0.14.5)
238 dnl regextype.c and regexprops.c are designed to be usable outside findutils,
239 dnl but findutils doesn't want to support all the regex types in gnulib,
240 dnl and wants to support an additional one (RE_SYNTAX_EMACS|RE_DOT_NEWLINE).
241 dnl Hence they need to know if they are being compiled into findutils or not.
242 AC_DEFINE([FINDUTILS], 1, [Define if we are compiling GNU findutils])
243 AC_DEFINE([ALREADY_INCLUDED_CONFIG_H], 1, [Define so that source code can verify that config.h was already included])
245 # This is necessary so that .o files in LIBOBJS are also built via
246 # the ANSI2KNR-filtering rules.
247 #LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
248 ##AC_CONFIG_SUBDIRS(gnulib)
249 AC_CONFIG_FILES(gnulib/Makefile gnulib/lib/Makefile)
250 AC_CONFIG_FILES(m4/Makefile)
251 AC_CONFIG_FILES([Makefile
252          tests/Makefile build-aux/Makefile
253         find/Makefile find/testsuite/Makefile
254         xargs/Makefile xargs/testsuite/Makefile
255         locate/Makefile locate/testsuite/Makefile
256          po/Makefile.in po/Makefile
257         doc/Makefile lib/Makefile
258         ])
259 AC_OUTPUT
260 dnl intl/Makefile