Enable the 'Warning: filesystem XXX has recently been mounted' check on Solaris,...
[findutils.git] / configure.in
blobc1cc1d133c7f4a3373dd4775feb673c7fcee0b77
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.7-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 inttypes.h fcntl.h locale.h stdint.h)
57 AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.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)
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 sleep 2
186 dnl Checks for library functions that are provided by findlib.
187 FINDLIB_REPLACE_FUNCS(waitpid strspn)
188 FINDLIB_REPLACE_FUNCS(forcefindlib)
190 dnl gl_XALLOC
191 gl_FUNC_ALLOCA
194 AC_PREREQ(2.13)
196 # Define intmax_t to 'signed long' or 'signed long long'
197 # if it is not already defined in <stdint.h> or <inttypes.h>.
198 dnl Derived from gnulib's uintmax_t which was from Paul Eggert.
199 AC_DEFUN([jy_AC_TYPE_INTMAX_T],
201   if test $ac_cv_header_inttypes_h = no && test $ac_cv_header_stdint_h = no; then
202     AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
203     test $ac_cv_type_long_long = yes \
204       && ac_type='long long' \
205       || ac_type='long'
206     AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
207       [Define to signed long or signed long long
208        if <stdint.h> and <inttypes.h> don't define.])
209   else
210     AC_DEFINE(HAVE_INTMAX_T, 1,
211       [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
212   fi
215 jy_AC_TYPE_INTMAX_T
216 jy_SORTZ
218 dnl internationalization macros
219 AM_GNU_GETTEXT([external])
221 # This is necessary so that .o files in LIBOBJS are also built via
222 # the ANSI2KNR-filtering rules.
223 #LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
224 ##AC_CONFIG_SUBDIRS(gnulib)
225 AC_CONFIG_FILES(gnulib/Makefile gnulib/lib/Makefile gnulib/m4/Makefile)
226 AC_CONFIG_FILES(m4/Makefile)
227 AC_OUTPUT(
228         Makefile 
229         find/Makefile find/testsuite/Makefile
230         xargs/Makefile xargs/testsuite/Makefile
231         locate/Makefile locate/testsuite/Makefile
232         intl/Makefile po/Makefile.in po/Makefile
233         doc/Makefile lib/Makefile
234         )