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