(remove_dir): Return RM_ERROR, not `1',
[coreutils.git] / configure.ac
blob1c21abcc9c36279119b8788f8c12889d39b3c031
1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
3 dnl Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2005,
4 dnl 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
6 dnl This program is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 2, or (at your option)
9 dnl any later version.
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 dnl GNU General Public License for more details.
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with this program; if not, write to the Free Software Foundation,
18 dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 dnl Written by Jim Meyering.
22 AC_INIT([GNU coreutils],[5.3.1-cvs],[bug-coreutils@gnu.org])
23 AC_CONFIG_SRCDIR(src/ls.c)
25 AC_CONFIG_AUX_DIR(build-aux)
26 AC_CONFIG_HEADERS([config.h:config.hin])
28 AB_INIT()
29 AM_INIT_AUTOMAKE([1.8.3 gnits dist-bzip2])
31 gl_DEFAULT_POSIX2_VERSION
32 gl_USE_SYSTEM_EXTENSIONS
33 gl_PERL
34 AC_PROG_CC
35 AC_PROG_CPP
36 AC_PROG_GCC_TRADITIONAL
37 AC_PROG_RANLIB
38 AC_PROG_LN_S
41 AC_CHECK_FUNCS(uname,
42         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uname\$(EXEEXT)"
43         MAN="$MAN uname.1")
44 AC_CHECK_FUNCS(chroot,
45         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS chroot\$(EXEEXT)"
46         MAN="$MAN chroot.1")
47 AC_CHECK_FUNCS(gethostid,
48         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS hostid\$(EXEEXT)"
49         MAN="$MAN hostid.1")
51 gl_MACROS
53 gl_WINSIZE_IN_PTEM
55 AC_MSG_CHECKING(whether localtime caches TZ)
56 AC_CACHE_VAL(utils_cv_localtime_cache,
57 [if test x$ac_cv_func_tzset = xyes; then
58 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
59 #if STDC_HEADERS
60 # include <stdlib.h>
61 #endif
62 extern char **environ;
63 unset_TZ ()
65   char **from, **to;
66   for (to = from = environ; (*to = *from); from++)
67     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
68       to++;
70 main()
72   time_t now = time ((time_t *) 0);
73   int hour_GMT0, hour_unset;
74   if (putenv ("TZ=GMT0") != 0)
75     exit (1);
76   hour_GMT0 = localtime (&now)->tm_hour;
77   unset_TZ ();
78   hour_unset = localtime (&now)->tm_hour;
79   if (putenv ("TZ=PST8") != 0)
80     exit (1);
81   if (localtime (&now)->tm_hour == hour_GMT0)
82     exit (1);
83   unset_TZ ();
84   if (localtime (&now)->tm_hour != hour_unset)
85     exit (1);
86   exit (0);
87 }]])],
88 [utils_cv_localtime_cache=no],
89 [utils_cv_localtime_cache=yes],
90 [# If we have tzset, assume the worst when cross-compiling.
91 utils_cv_localtime_cache=yes])
92 else
93         # If we lack tzset, report that localtime does not cache TZ,
94         # since we can't invalidate the cache if we don't have tzset.
95         utils_cv_localtime_cache=no
96 fi])dnl
97 AC_MSG_RESULT($utils_cv_localtime_cache)
98 if test $utils_cv_localtime_cache = yes; then
99   AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME])
102 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
103 AC_CHECK_FUNCS(initgroups)
104 if test $ac_cv_func_initgroups = no; then
105   AC_CHECK_LIB(os, initgroups)
108 AC_CHECK_FUNCS(syslog)
109 if test $ac_cv_func_syslog = no; then
110   # syslog is not in the default libraries.  See if it's in some other.
111   for lib in bsd socket inet; do
112     AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME])
113       LIBS="$LIBS -l$lib"; break])
114   done
117 AC_CACHE_CHECK([for 3-argument setpriority function],
118   [utils_cv_func_setpriority],
119   [AC_LINK_IFELSE(
120     [AC_LANG_PROGRAM(
121        [[#include <sys/time.h>
122          #include <sys/resource.h>
123        ]],
124        [[setpriority (0, 0, 0);]])],
125     [utils_cv_func_setpriority=yes],
126     [utils_cv_func_setpriority=no])])
127 if test $utils_cv_func_setpriority = no; then
128   AC_CHECK_FUNCS([nice])
130 case $utils_cv_func_setpriority,$ac_cv_func_nice in
131 *yes*)
132   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
133   MAN="$MAN nice.1";;
134 esac
136 AC_DEFUN([coreutils_DUMMY_1],
138   AC_REQUIRE([gl_READUTMP])
139   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
140     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS pinky\$(EXEEXT)"
141     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS users\$(EXEEXT)"
142     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS who\$(EXEEXT)"
143     MAN="$MAN pinky.1 users.1 who.1"
144   fi
146 coreutils_DUMMY_1
148 AC_MSG_CHECKING(ut_host in struct utmp)
149 AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
150 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
151 #include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],
152   [su_cv_func_ut_host_in_utmp=yes],
153   [su_cv_func_ut_host_in_utmp=no])])
154 AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
155 if test $su_cv_func_ut_host_in_utmp = yes; then
156   have_ut_host=1
157   AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
160 if test -z "$have_ut_host"; then
161   AC_MSG_CHECKING(ut_host in struct utmpx)
162   AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
163   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
164 #include <utmpx.h>]], [[struct utmpx ut; ut.ut_host;]])],
165     [su_cv_func_ut_host_in_utmpx=yes],
166     [su_cv_func_ut_host_in_utmpx=no])])
167   AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
168   if test $su_cv_func_ut_host_in_utmpx = yes; then
169     AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME])
170     AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
171   fi
174 GNULIB_BOOT_TIME(
175   [OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uptime\$(EXEEXT)"
176   MAN="$MAN uptime.1"])
178 AC_SYS_POSIX_TERMIOS()
179 gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
181 if test $ac_cv_sys_posix_termios = yes; then
182   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS stty\$(EXEEXT)" MAN="$MAN stty.1"
184   AC_MSG_CHECKING(whether termios.h needs _XOPEN_SOURCE)
185   AC_CACHE_VAL(su_cv_sys_termios_needs_xopen_source,
186   [AC_EGREP_CPP(yes, [#include <termios.h>
187 #ifdef IUCLC
189 #endif], su_cv_sys_termios_needs_xopen_source=no,
190    AC_EGREP_CPP(yes, [#define _XOPEN_SOURCE
191 #include <termios.h>
192 #ifdef IUCLC
194 #endif], su_cv_sys_termios_needs_xopen_source=yes,
195    su_cv_sys_termios_needs_xopen_source=no))])
196   AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source)
197   test $su_cv_sys_termios_needs_xopen_source = yes &&
198     AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME])
200   AC_MSG_CHECKING(c_line in struct termios)
201   AC_CACHE_VAL(su_cv_sys_c_line_in_termios,
202   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
203 #define _XOPEN_SOURCE
204 #endif
205 #include <sys/types.h>
206 #include <termios.h>]], [[struct termios t; t.c_line;]])],
207     [su_cv_sys_c_line_in_termios=yes],
208     [su_cv_sys_c_line_in_termios=no])])
209   AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
210   test $su_cv_sys_c_line_in_termios = yes \
211     && AC_DEFINE(HAVE_C_LINE, 1, [FIXME])
214 # FIXME: note that this macro appears above, too.
215 # I'm leaving it here for now.  This whole thing needs to be modernized...
216 gl_WINSIZE_IN_PTEM
218 gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
220 if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no && \
221    test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
222   AC_MSG_CHECKING(TIOCGWINSZ in sys/pty.h)
223   AC_CACHE_VAL(su_cv_sys_tiocgwinsz_in_sys_pty_h,
224   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
225 #ifdef WINSIZE_IN_PTEM
226 # include <sys/stream.h>
227 # include <sys/ptem.h>
228 #endif
229 #include <sys/ioctl.h>
230 #include <sys/tty.h>
231 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
232     [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
233     [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
234   AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h)
236   test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
237       && AC_DEFINE(GWINSZ_IN_SYS_PTY, 1,
238                    [Define if your system defines TIOCGWINSZ in sys/pty.h.])
241 # For src/kill.c.
242 AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
243   [AC_INCLUDES_DEFAULT
244 #include <signal.h>])
246 # For src/kill.c and src/printf.c.
247 AC_CHECK_DECLS([strtoimax, strtoumax])
249 cu_LIB_CHECK
251 AM_GNU_GETTEXT([external], [need-ngettext])
252 AM_GNU_GETTEXT_VERSION(0.13.1)
254 AC_CONFIG_FILES(
255   Makefile
256   doc/Makefile
257   lib/Makefile
258   man/Makefile
259   po/Makefile.in
260   src/Makefile
261   tests/Makefile
262   tests/basename/Makefile
263   tests/chgrp/Makefile
264   tests/chmod/Makefile
265   tests/chown/Makefile
266   tests/cp/Makefile
267   tests/cut/Makefile
268   tests/dd/Makefile
269   tests/dircolors/Makefile
270   tests/du/Makefile
271   tests/expr/Makefile
272   tests/factor/Makefile
273   tests/fmt/Makefile
274   tests/head/Makefile
275   tests/install/Makefile
276   tests/join/Makefile
277   tests/ln/Makefile
278   tests/ls-2/Makefile
279   tests/ls/Makefile
280   tests/md5sum/Makefile
281   tests/misc/Makefile
282   tests/mkdir/Makefile
283   tests/mv/Makefile
284   tests/od/Makefile
285   tests/pr/Makefile
286   tests/readlink/Makefile
287   tests/rm/Makefile
288   tests/rmdir/Makefile
289   tests/seq/Makefile
290   tests/sha1sum/Makefile
291   tests/shred/Makefile
292   tests/sort/Makefile
293   tests/stty/Makefile
294   tests/sum/Makefile
295   tests/tac/Makefile
296   tests/tail-2/Makefile
297   tests/tail/Makefile
298   tests/tee/Makefile
299   tests/test/Makefile
300   tests/touch/Makefile
301   tests/tr/Makefile
302   tests/tsort/Makefile
303   tests/unexpand/Makefile
304   tests/uniq/Makefile
305   tests/wc/Makefile
306   )
307 AC_OUTPUT