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