-xdev is an option, not a test. Fixes Savannah bug 11192.
[findutils.git] / configure.in
blobd2b1851e26954aee5650336a6e074046ba3dcd97
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(find/pred.c)
3 AM_CONFIG_HEADER(config.h)
4 AC_CANONICAL_HOST
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.9-CVS)
12 AC_SUBST(INCLUDES)dnl
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
19    very expensive.]))
21 dnl Checks for programs.
22 AC_PROG_CC
23 AC_PROG_CPP
25 AC_AIX
26 AC_PROG_CC_STDC
28 dnl AC_MINIX
29 dnl for gnulib
30 gl_EARLY
31 dnl gl_EARLY calls AC_GNU_SOURCE anyway.
34 AC_ISC_POSIX
35 AM_C_PROTOTYPES
37 AC_PROG_INSTALL
38 AC_PROG_RANLIB
39 dnl AC_PROG_LIBTOOL
40 AC_PROG_MAKE_SET
41 AC_SYS_LARGEFILE
44 gl_INIT
46 dnl Try to get a POSIX.1 environment.
48 dnl Checks for libraries.  If getpwnam() isn't present in the 
49 dnl C library, try -lsun.
50 AC_CHECK_FUNC(getpwnam, [],
51 [AC_CHECK_LIB(sun, getpwnam)])
53 dnl Checks for header files.
54 AC_HEADER_STDC
55 AC_CHECK_HEADERS(fcntl.h string.h limits.h unistd.h errno.h stdlib.h stddef.h)
56 AC_CHECK_HEADERS(unistd.h sys/types.h inttypes.h fcntl.h locale.h stdint.h)
57 AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h)
58 AC_HEADER_MAJOR
59 AC_HEADER_DIRENT
60 AC_HEADER_STAT
61 AC_HEADER_SYS_WAIT
63 AC_MSG_CHECKING(how to get filesystem type)
64 fstype=no
65 # The order of these tests is important.
66 AC_TRY_CPP([#include <sys/statvfs.h>
67 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS, 1, [Define to use SVR4 statvfs to get filesystem type.]) fstype=SVR4)
68 if test $fstype = no; then
69 AC_TRY_CPP([#include <sys/statfs.h>
70 #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS, 1, [Define to use SVR3.2 statfs to get filesystem type.]) fstype=SVR3)
72 if test $fstype = no; then
73 AC_TRY_CPP([#include <sys/statfs.h>
74 #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS, 1, [Define to use AIX3 statfs to get filesystem type.]) fstype=AIX)
76 if test $fstype = no; then  
77 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)
79 if test $fstype = no; then  
80 AC_TRY_CPP([#include <mntent.h>], AC_DEFINE(FSTYPE_MNTENT, 1, [Define to use 4.3BSD getmntent to get filesystem type.]) fstype=4.3BSD)
82 if test $fstype = no; then  
83 AC_TRY_CPP([#include <sys/mount.h>
84 #include <sys/fs_types.h>], AC_DEFINE(FSTYPE_GETMNT, 1, [Define to use Ultrix getmnt to get filesystem type.]) fstype=Ultrix)
86 AC_MSG_RESULT($fstype)
88 dnl Checks for typedefs, structures, and compiler characteristics.
90 AC_TYPE_UID_T
91 AC_TYPE_SIZE_T
92 AC_CHECK_TYPE(ssize_t, int)
93 AC_TYPE_PID_T
94 AC_CHECK_TYPE(ino_t, unsigned long)
95 AC_CHECK_TYPE(dev_t, unsigned long)
96 AC_TYPE_MODE_T
97 AC_STRUCT_ST_BLOCKS
98 AC_CHECK_MEMBERS([struct stat.st_rdev])
99 AC_STRUCT_TM
100 AC_STRUCT_TIMEZONE
102 dnl Checks for library functions that are provided by gnulib.
103 AC_FUNC_STRFTIME
104 AC_REPLACE_FUNCS(memcmp memset stpcpy strdup strstr strtol strtoul)
105 AC_CHECK_FUNCS(fchdir getcwd strerror endgrent endpwent setlocale)
106 AC_FUNC_VPRINTF
107 AC_FUNC_ALLOCA
108 AC_FUNC_CLOSEDIR_VOID
110 dnl We don't just use AC_FUNC_GETMNTENT directly because it 
111 dnl will try to use -lsun on platforms which have getmntent() in the 
112 dnl C library, for example UNICOS.
113 AC_CHECK_FUNC(getmntent, [], [AC_FUNC_GETMNTENT])
114 AC_CHECK_FUNCS(getmntent)
115 AC_CHECK_FUNCS(setmntent endmntent)
117 dnl Linux, 4.3BSD, etc.
118 AC_CHECK_TYPE([struct mntent],
119 [AC_DEFINE([HAVE_STRUCT_MNTENT],1,[Set if you have struct mntent])
120 AC_CHECK_MEMBERS([struct mntent.mnt_type, struct mntent.mnt_dir],,,[#include <mntent.h>])],,
121 [#include <mntent.h>])
123 dnl Solaris
124 AC_CHECK_TYPE([struct mnttab],
125 [AC_DEFINE([HAVE_STRUCT_MNTTAB],1,[Set if you have struct mnttab])
126 AC_CHECK_MEMBERS([struct mnttab.mnt_fstype,struct mnttab.mnt_mountp],,,
128 #include <stdio.h>
129 #include <sys/mnttab.h>])],,
131 #include <stdio.h>
132 #include <sys/mnttab.h>])
134 AC_DEFUN([jy_FUNC_GETMNTENT_ARGTYPES],
135 AC_MSG_CHECKING([how to call getmntent()])
136 AC_COMPILE_IFELSE(
137         [AC_LANG_PROGRAM(
138 [AC_INCLUDES_DEFAULT
139 #if HAVE_MNTENT_H
140 # include <mntent.h>
141 #endif
143 #if HAVE_SYS_MNTTAB_H
144 # include <stdio.h>
145 # include <sys/mnttab.h>
146 #endif
147 #if HAVE_STRUCT_MNTTAB
148   typedef struct mnttab MMM;
149 #elif HAVE_STRUCT_MNTENT
150   typedef struct mntent MMM;
151 #endif
153 [extern int getmntent(FILE*,MMM *);])],
154 AC_DEFINE([GETMNTENT_RETURNS_INT],1,[Set if getmntent() returns int])
155 AC_DEFINE([GETMNTENT_REQUIRES_STRUCT_PTR],1,[Set if the second argument to getmntent() is a pointer to struct])
156 AC_MSG_RESULT([takes two arguments and returns int])
158 dnl First try failed.
159 AC_COMPILE_IFELSE(
160         [AC_LANG_PROGRAM(
161 [AC_INCLUDES_DEFAULT
162 #if HAVE_MNTENT_H
163 # include <mntent.h>
164 #endif
166 #if HAVE_SYS_MNTTAB_H
167 # include <stdio.h>
168 # include <sys/mnttab.h>
169 #endif
170 #if HAVE_STRUCT_MNTTAB
171   typedef struct mnttab MMM;
172 #elif HAVE_STRUCT_MNTENT
173   typedef struct mntent MMM;
174 #endif
176 [extern MMM* getmntent(FILE *);])],
177 AC_DEFINE([GETMNTENT_RETURNS_STRUCT],1,[Set if getmntent() returns a struct pointer])
178 AC_MSG_RESULT([takes just one argument and returns a struct pointer]),
179 AC_MSG_ERROR([I can't figure out how to use your getmntent() function.]))))
182 jy_FUNC_GETMNTENT_ARGTYPES
184 dnl Checks for library functions that are provided by findlib.
185 FINDLIB_REPLACE_FUNCS(waitpid strspn)
186 FINDLIB_REPLACE_FUNCS(forcefindlib)
188 dnl gl_XALLOC
189 gl_FUNC_ALLOCA
192 AC_PREREQ(2.13)
194 # Define intmax_t to 'signed long' or 'signed long long'
195 # if it is not already defined in <stdint.h> or <inttypes.h>.
196 dnl Derived from gnulib's uintmax_t which was from Paul Eggert.
197 AC_DEFUN([jy_AC_TYPE_INTMAX_T],
199   if test $ac_cv_header_inttypes_h = no && test $ac_cv_header_stdint_h = no; then
200     AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
201     test $ac_cv_type_long_long = yes \
202       && ac_type='long long' \
203       || ac_type='long'
204     AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
205       [Define to signed long or signed long long
206        if <stdint.h> and <inttypes.h> don't define.])
207   else
208     AC_DEFINE(HAVE_INTMAX_T, 1,
209       [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
210   fi
213 jy_AC_TYPE_INTMAX_T
214 jy_SORTZ
217 AC_CHECK_MEMBER(struct dirent.d_type,,,[                   
218 #include <sys/types.h>
219 #include <dirent.h>])
222 dnl internationalization macros
223 AM_GNU_GETTEXT([external])
225 # This is necessary so that .o files in LIBOBJS are also built via
226 # the ANSI2KNR-filtering rules.
227 #LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
228 ##AC_CONFIG_SUBDIRS(gnulib)
229 AC_CONFIG_FILES(gnulib/Makefile gnulib/lib/Makefile gnulib/m4/Makefile)
230 AC_CONFIG_FILES(m4/Makefile)
231 AC_OUTPUT(
232         Makefile 
233         find/Makefile find/testsuite/Makefile
234         xargs/Makefile xargs/testsuite/Makefile
235         locate/Makefile locate/testsuite/Makefile
236          po/Makefile.in po/Makefile
237         doc/Makefile lib/Makefile
238         )
239 dnl intl/Makefile