Added the -I and -L options; also -E takes an argument which is not optional.
[findutils.git] / configure.in
blob440211e1035456e476a8de4c8a28f64b9cabb681
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.10-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 AC_ARG_ENABLE(debug,
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
27    AC_MSG_RESULT([no])
28 else
29    AC_MSG_RESULT([yes])
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.
37 AC_PROG_CC
38 AC_PROG_CPP
40 AC_AIX
41 AC_PROG_CC_STDC
43 dnl AC_MINIX
44 dnl for gnulib
45 gl_EARLY
46 dnl gl_EARLY calls AC_GNU_SOURCE anyway.
49 AC_ISC_POSIX
50 AM_C_PROTOTYPES
52 AC_PROG_INSTALL
53 AC_PROG_RANLIB
54 dnl AC_PROG_LIBTOOL
55 AC_PROG_MAKE_SET
56 AC_SYS_LARGEFILE
59 gl_INIT
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.
69 AC_HEADER_STDC
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)
73 AC_HEADER_MAJOR
74 AC_HEADER_DIRENT
75 AC_HEADER_STAT
76 AC_HEADER_SYS_WAIT
78 AC_MSG_CHECKING(how to get filesystem type)
79 fstype=no
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.
105 AC_TYPE_UID_T
106 AC_TYPE_SIZE_T
107 AC_CHECK_TYPE(ssize_t, int)
108 AC_TYPE_PID_T
109 AC_CHECK_TYPE(ino_t, unsigned long)
110 AC_CHECK_TYPE(dev_t, unsigned long)
111 AC_TYPE_MODE_T
112 AC_STRUCT_ST_BLOCKS
113 AC_CHECK_MEMBERS([struct stat.st_rdev])
114 AC_STRUCT_TM
115 AC_STRUCT_TIMEZONE
117 dnl Checks for library functions that are provided by gnulib.
118 AC_FUNC_STRFTIME
119 AC_REPLACE_FUNCS(memcmp memset stpcpy strdup strstr strtol strtoul)
120 AC_CHECK_FUNCS(fchdir getcwd strerror endgrent endpwent setlocale)
121 AC_FUNC_VPRINTF
122 AC_FUNC_ALLOCA
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>])
138 dnl Solaris
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],,,
143 #include <stdio.h>
144 #include <sys/mnttab.h>])],,
146 #include <stdio.h>
147 #include <sys/mnttab.h>])
149 AC_DEFUN([jy_FUNC_GETMNTENT_ARGTYPES],
150 AC_MSG_CHECKING([how to call getmntent()])
151 AC_COMPILE_IFELSE(
152         [AC_LANG_PROGRAM(
153 [AC_INCLUDES_DEFAULT
154 #if HAVE_MNTENT_H
155 # include <mntent.h>
156 #endif
158 #if HAVE_SYS_MNTTAB_H
159 # include <stdio.h>
160 # include <sys/mnttab.h>
161 #endif
162 #if HAVE_STRUCT_MNTTAB
163   typedef struct mnttab MMM;
164 #elif HAVE_STRUCT_MNTENT
165   typedef struct mntent MMM;
166 #endif
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.
174 AC_COMPILE_IFELSE(
175         [AC_LANG_PROGRAM(
176 [AC_INCLUDES_DEFAULT
177 #if HAVE_MNTENT_H
178 # include <mntent.h>
179 #endif
181 #if HAVE_SYS_MNTTAB_H
182 # include <stdio.h>
183 # include <sys/mnttab.h>
184 #endif
185 #if HAVE_STRUCT_MNTTAB
186   typedef struct mnttab MMM;
187 #elif HAVE_STRUCT_MNTENT
188   typedef struct mntent MMM;
189 #endif
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)
203 dnl gl_XALLOC
204 gl_FUNC_ALLOCA
207 AC_PREREQ(2.13)
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' \
218       || ac_type='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.])
222   else
223     AC_DEFINE(HAVE_INTMAX_T, 1,
224       [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
225   fi
228 jy_AC_TYPE_INTMAX_T
229 jy_SORTZ
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)
246 AC_OUTPUT(
247         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
253         )
254 dnl intl/Makefile