summaryrefslogtreecommitdiff
path: root/configure.in
blob: 7c0d3bce62c41dc19b642d9197b309c10bd84d1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
dnl Process this file with autoconf to produce a configure script.
AC_INIT([GNU findutils], 4.3.2-CVS, [bug-findutils@gnu.org])
AM_INIT_AUTOMAKE

AC_CONFIG_SRCDIR([find/pred.c])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR(gnulib/m4)

dnl Set of available languages.
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 sk sl sr sv tr vi zh_CN zh_TW rw"

AC_SUBST(INCLUDES)dnl

dnl check for --with-fts
FIND_WITH_FTS

AC_ARG_ENABLE(id-cache,
[  --enable-id-cache       cache all UIDs & GIDs; avoid if using NIS or Hesiod],
  AC_DEFINE(CACHE_IDS, 1, [Define if you want find -nouser and -nogroup to make tables of
   used UIDs and GIDs at startup instead of using getpwuid or
   getgrgid when needed.  Speeds up -nouser and -nogroup unless you
   are running NIS or Hesiod, which make password and group calls
   very expensive.]))

AC_ARG_ENABLE(debug,
	AS_HELP_STRING(--enable-debug,Enable debugging output which is likely to be interesting to people debugging findutils),
	[ac_cv_debug=$enableval],[ac_cv_debug=no])

AC_ARG_ENABLE(leaf-optimisation,
	AS_HELP_STRING(--enable-leaf-optimisation,Enable an optimisation which saves lstat calls to identify subdirectories on filesystems having traditional Unix semantics),
	[ac_cv_leaf_optimisation=$enableval],[ac_cv_leaf_optimisation=yes])

AC_ARG_ENABLE(d_type-optimization,
	AS_HELP_STRING(--enable-d_type-optimization,Make use of the file type data returned in struct dirent.d_type by readdir()),
	[ac_cv_d_type=$enableval],[ac_cv_d_type=yes])

dnl This one has no default, because otherwise we would have to say 
dnl both --enable-d_type-optimisation=no and --enable-d_type-optimization=no
dnl to turn it off.
AC_ARG_ENABLE(d_type-optimisation,
	AS_HELP_STRING(--enable-d_type-optimisation,Synonym for --enable-d_type-optimization),
	[ac_cv_d_type=$enableval],[])


AC_MSG_CHECKING([whether debug output should be produced])
if test x$ac_cv_debug = xno; then
   AC_MSG_RESULT([no])
else
   AC_MSG_RESULT([yes])
   AC_DEFINE(DEBUG, 1, [Define if you want to see find's innards])
   AC_DEFINE(DEBUG_STAT, 1, [Define if you want to see a message every time find calls the stat() system call])
fi

AC_MSG_CHECKING([for leaf optimisation])
if test x$ac_cv_leaf_optimisation = xno; then
   AC_MSG_RESULT([no])
else
   AC_MSG_RESULT([yes])
   AC_DEFINE(LEAF_OPTIMISATION, 1, [Define if you want to use the leaf optimisation (this can still be turned off with -noleaf)])
fi



dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP

AC_AIX


dnl AC_MINIX
dnl for gnulib
gl_EARLY
dnl gl_EARLY calls AC_GNU_SOURCE anyway.


AC_ISC_POSIX
AM_C_PROTOTYPES

AC_PROG_INSTALL
AC_PROG_RANLIB
dnl AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_SYS_LARGEFILE


gl_INIT

dnl lib/regexprops needs to be a native program, because we need to 
dnl run it in order to generate the documentation about the properties
dnl of regular expressions.  See lib/Makefile.am.
AM_CONDITIONAL(CROSS_COMPILING, [[test "x$cross_compiling" = xyes]])

dnl Try to get a POSIX.1 environment.

dnl Checks for libraries.  If getpwnam() isn't present in the 
dnl C library, try -lsun.
AC_CHECK_FUNC(getpwnam, [],
[AC_CHECK_LIB(sun, getpwnam)])

dnl Checks for header files.
AC_HEADER_STDC
dnl Assume unistd.h is present - coreutils does too.
AC_CHECK_HEADERS(fcntl.h string.h limits.h errno.h stdlib.h stddef.h)
AC_CHECK_HEADERS(unistd.h sys/types.h inttypes.h fcntl.h locale.h stdint.h)
AC_CHECK_HEADERS(sys/param.h mntent.h sys/mnttab.h sys/mntio.h sys/mkdev.h)
dnl find.c needs sys/utsname.h because it calls uname(2).
AC_CHECK_HEADERS(sys/utsname.h)
AC_HEADER_MAJOR
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_HEADER_SYS_WAIT


dnl Checks for typedefs, structures, and compiler characteristics.

AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_CHECK_TYPE(ssize_t, int)
AC_TYPE_PID_T
AC_CHECK_TYPE(ino_t, unsigned long)
AC_CHECK_TYPE(dev_t, unsigned long)
AC_TYPE_MODE_T
AC_STRUCT_ST_BLOCKS
AC_CHECK_MEMBERS([struct stat.st_rdev])

AC_MSG_CHECKING([whether we should use struct dirent.d_type, if available])
if test x$ac_cv_d_type = xno; then
   AC_MSG_RESULT([no])
else
   AC_MSG_RESULT([yes])
   AC_DEFINE(USE_STRUCT_DIRENT_D_TYPE, 1,
   [Defined if you specify --enable-d_type-optimisation to configure.])
   AC_CHECK_MEMBERS([struct dirent.d_type],[
   AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1,
   [Define to 1 if your 'struct dirent' has a d_type member])],
   [],[
#include <sys/types.h>
#include <dirent.h>])
fi


AC_STRUCT_TM
AC_STRUCT_TIMEZONE

dnl Checks for library functions that are provided by gnulib.
AC_FUNC_STRFTIME
AC_REPLACE_FUNCS(memcmp memset stpcpy strdup strstr strtol strtoul)
AC_CHECK_FUNCS(fchdir getcwd strerror endgrent endpwent setlocale)
AC_FUNC_VPRINTF
AC_FUNC_ALLOCA
AC_FUNC_CLOSEDIR_VOID

dnl We don't just use AC_FUNC_GETMNTENT directly because it 
dnl will try to use -lsun on platforms which have getmntent() in the 
dnl C library, for example UNICOS.
AC_CHECK_FUNC(getmntent, [], [AC_FUNC_GETMNTENT])
AC_CHECK_FUNCS(getmntent)
AC_CHECK_FUNCS(setmntent endmntent)


dnl Checks for library functions that are provided by findlib.
FINDLIB_REPLACE_FUNCS(waitpid strspn)
FINDLIB_REPLACE_FUNCS(forcefindlib)

dnl gl_XALLOC
gl_FUNC_ALLOCA

dnl Use gl_INCLUDED_REGEX so that findutils will build on systems like
dnl Solaris, which lacks those functions in libc (see GNU Savannah bug
dnl #11710) (Sun Sep  4 20:15:11 2005: gl_INCLUDED_REGEX no longer seems
dnl to be available in gnulib CVS)
gl_REGEX

AC_PREREQ(2.59)

# Define intmax_t to 'signed long' or 'signed long long'
# if it is not already defined in <stdint.h> or <inttypes.h>.
dnl Derived from gnulib's uintmax_t which was from Paul Eggert.
AC_DEFUN([jy_AC_TYPE_INTMAX_T],
[
  if test $ac_cv_header_inttypes_h = no && test $ac_cv_header_stdint_h = no; then
    AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
    test $ac_cv_type_long_long = yes \
      && ac_type='long long' \
      || ac_type='long'
    AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
      [Define to signed long or signed long long
       if <stdint.h> and <inttypes.h> don't define.])
  else
    AC_DEFINE(HAVE_INTMAX_T, 1,
      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
  fi
])

jy_AC_TYPE_INTMAX_T
jy_SORTZ


AC_CHECK_MEMBER(struct dirent.d_type,,,[		   
#include <sys/types.h>
#include <dirent.h>])


dnl internationalization macros
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.14.5)

dnl regextype.c and regexprops.c are designed to be usable outside findutils,
dnl but findutils doesn't want to support all the regex types in gnulib,
dnl and wants to support an additional one (RE_SYNTAX_EMACS|RE_DOT_NEWLINE).
dnl Hence they need to know if they are being compiled into findutils or not.
AC_DEFINE([FINDUTILS], 1, [Define if we are compiling GNU findutils])


# This is necessary so that .o files in LIBOBJS are also built via
# the ANSI2KNR-filtering rules.
#LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`
##AC_CONFIG_SUBDIRS(gnulib)
AC_CONFIG_FILES(gnulib/Makefile gnulib/lib/Makefile)
AC_CONFIG_FILES(m4/Makefile)
AC_CONFIG_FILES([Makefile 
	find/Makefile find/testsuite/Makefile
	xargs/Makefile xargs/testsuite/Makefile
	locate/Makefile locate/testsuite/Makefile
	 po/Makefile.in po/Makefile
	doc/Makefile lib/Makefile
	])
AC_OUTPUT
dnl intl/Makefile