1 dnl Process this file with autoconf to produce a configure script.
3 AM_CONFIG_HEADER(config.h)
5 AC_CONFIG_MACRO_DIR(gnulib/m4)
7 dnl Set of available languages.
8 ALL_LINGUAS="da de es et fr gl id it ko nl pl pt_BR ru sv tr sk"
10 AM_INIT_AUTOMAKE(findutils, 4.2.10-CVS)
13 AC_ARG_ENABLE(id-cache,
14 [ --enable-id-cache cache all UIDs & GIDs; avoid if using NIS or Hesiod],
15 AC_DEFINE(CACHE_IDS, 1, [Define if you want find -nouser and -nogroup to make tables of
16 used UIDs and GIDs at startup instead of using getpwuid or
17 getgrgid when needed. Speeds up -nouser and -nogroup unless you
18 are running NIS or Hesiod, which make password and group calls
22 AC_HELP_STRING([--enable-debug],[Enable debugging output which is likely to be interesting to people debugging findutils]),
23 [ac_cv_debug=$withval],[ac_cv_debug=no])
25 AC_MSG_CHECKING([whether debug output should be produced])
26 if test x$ac_cv_debug = x; then
30 AC_DEFINE(DEBUG, 1, [Define if you want to see find's innards])
31 AC_DEFINE(DEBUG_STAT, 1, [Define if you want to see a message every time find calls the stat() system call])
36 dnl Checks for programs.
46 dnl gl_EARLY calls AC_GNU_SOURCE anyway.
61 dnl Try to get a POSIX.1 environment.
63 dnl Checks for libraries. If getpwnam() isn't present in the
64 dnl C library, try -lsun.
65 AC_CHECK_FUNC(getpwnam, [],
66 [AC_CHECK_LIB(sun, getpwnam)])
68 dnl Checks for header files.
70 AC_CHECK_HEADERS(fcntl.h string.h limits.h unistd.h errno.h stdlib.h stddef.h)
71 AC_CHECK_HEADERS(unistd.h sys/types.h inttypes.h fcntl.h locale.h stdint.h)
72 AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h)
78 AC_MSG_CHECKING(how to get filesystem type)
80 # The order of these tests is important.
81 AC_TRY_CPP([#include <sys/statvfs.h>
82 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS, 1, [Define to use SVR4 statvfs to get filesystem type.]) fstype=SVR4)
83 if test $fstype = no; then
84 AC_TRY_CPP([#include <sys/statfs.h>
85 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS, 1, [Define to use SVR3.2 statfs to get filesystem type.]) fstype=SVR3)
87 if test $fstype = no; then
88 AC_TRY_CPP([#include <sys/statfs.h>
89 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS, 1, [Define to use AIX3 statfs to get filesystem type.]) fstype=AIX)
91 if test $fstype = no; then
92 AC_EGREP_HEADER(f_type;, sys/mount.h, AC_DEFINE(FSTYPE_STATFS, 1, [Define to use 4.4BSD and OSF1 statfs to get filesystem type.]) fstype=4.4BSD/OSF1)
94 if test $fstype = no; then
95 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT, 1, [Define to use 4.3BSD getmntent to get filesystem type.]) fstype=4.3BSD)
97 if test $fstype = no; then
98 AC_TRY_CPP([#include <sys/mount.h>
99 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT, 1, [Define to use Ultrix getmnt to get filesystem type.]) fstype=Ultrix)
101 AC_MSG_RESULT($fstype)
103 dnl Checks for typedefs, structures, and compiler characteristics.
107 AC_CHECK_TYPE(ssize_t, int)
109 AC_CHECK_TYPE(ino_t, unsigned long)
110 AC_CHECK_TYPE(dev_t, unsigned long)
113 AC_CHECK_MEMBERS([struct stat.st_rdev])
117 dnl Checks for library functions that are provided by gnulib.
119 AC_REPLACE_FUNCS(memcmp memset stpcpy strdup strstr strtol strtoul)
120 AC_CHECK_FUNCS(fchdir getcwd strerror endgrent endpwent setlocale)
123 AC_FUNC_CLOSEDIR_VOID
125 dnl We don't just use AC_FUNC_GETMNTENT directly because it
126 dnl will try to use -lsun on platforms which have getmntent() in the
127 dnl C library, for example UNICOS.
128 AC_CHECK_FUNC(getmntent, [], [AC_FUNC_GETMNTENT])
129 AC_CHECK_FUNCS(getmntent)
130 AC_CHECK_FUNCS(setmntent endmntent)
132 dnl Linux, 4.3BSD, etc.
133 AC_CHECK_TYPE([struct mntent],
134 [AC_DEFINE([HAVE_STRUCT_MNTENT],1,[Set if you have struct mntent])
135 AC_CHECK_MEMBERS([struct mntent.mnt_type, struct mntent.mnt_dir],,,[#include <mntent.h>])],,
136 [#include <mntent.h>])
139 AC_CHECK_TYPE([struct mnttab],
140 [AC_DEFINE([HAVE_STRUCT_MNTTAB],1,[Set if you have struct mnttab])
141 AC_CHECK_MEMBERS([struct mnttab.mnt_fstype,struct mnttab.mnt_mountp],,,
144 #include <sys/mnttab.h>])],,
147 #include <sys/mnttab.h>])
149 AC_DEFUN([jy_FUNC_GETMNTENT_ARGTYPES],
150 AC_MSG_CHECKING([how to call getmntent()])
158 #if HAVE_SYS_MNTTAB_H
160 # include <sys/mnttab.h>
162 #if HAVE_STRUCT_MNTTAB
163 typedef struct mnttab MMM;
164 #elif HAVE_STRUCT_MNTENT
165 typedef struct mntent MMM;
168 [extern int getmntent(FILE*,MMM *);])],
169 AC_DEFINE([GETMNTENT_RETURNS_INT],1,[Set if getmntent() returns int])
170 AC_DEFINE([GETMNTENT_REQUIRES_STRUCT_PTR],1,[Set if the second argument to getmntent() is a pointer to struct])
171 AC_MSG_RESULT([takes two arguments and returns int])
173 dnl First try failed.
181 #if HAVE_SYS_MNTTAB_H
183 # include <sys/mnttab.h>
185 #if HAVE_STRUCT_MNTTAB
186 typedef struct mnttab MMM;
187 #elif HAVE_STRUCT_MNTENT
188 typedef struct mntent MMM;
191 [extern MMM* getmntent(FILE *);])],
192 AC_DEFINE([GETMNTENT_RETURNS_STRUCT],1,[Set if getmntent() returns a struct pointer])
193 AC_MSG_RESULT([takes just one argument and returns a struct pointer]),
194 AC_MSG_ERROR([I can't figure out how to use your getmntent() function.]))))
197 jy_FUNC_GETMNTENT_ARGTYPES
199 dnl Checks for library functions that are provided by findlib.
200 FINDLIB_REPLACE_FUNCS(waitpid strspn)
201 FINDLIB_REPLACE_FUNCS(forcefindlib)
209 # Define intmax_t to 'signed long' or 'signed long long'
210 # if it is not already defined in <stdint.h> or <inttypes.h>.
211 dnl Derived from gnulib's uintmax_t which was from Paul Eggert.
212 AC_DEFUN([jy_AC_TYPE_INTMAX_T],
214 if test $ac_cv_header_inttypes_h = no && test $ac_cv_header_stdint_h = no; then
215 AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
216 test $ac_cv_type_long_long = yes \
217 && ac_type='long long' \
219 AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
220 [Define to signed long or signed long long
221 if <stdint.h> and <inttypes.h> don't define.])
223 AC_DEFINE(HAVE_INTMAX_T, 1,
224 [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
232 AC_CHECK_MEMBER(struct dirent.d_type,,,[
233 #include <sys/types.h>
234 #include <dirent.h>])
237 dnl internationalization macros
238 AM_GNU_GETTEXT([external])
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 ##AC_CONFIG_SUBDIRS(gnulib)
244 AC_CONFIG_FILES(gnulib/Makefile gnulib/lib/Makefile gnulib/m4/Makefile)
245 AC_CONFIG_FILES(m4/Makefile)
248 find/Makefile find/testsuite/Makefile
249 xargs/Makefile xargs/testsuite/Makefile
250 locate/Makefile locate/testsuite/Makefile
251 po/Makefile.in po/Makefile
252 doc/Makefile lib/Makefile