2 # Process this file with autoconf to produce a configure script.
4 # Copyright (C) 1991, 1993-2006 Free Software Foundation, Inc.
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)
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.
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.
20 dnl Written by Jim Meyering.
22 AC_INIT([GNU coreutils],[6.0],[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])
29 AM_INIT_AUTOMAKE([1.9.6 gnits dist-bzip2])
31 gl_DEFAULT_POSIX2_VERSION
32 gl_USE_SYSTEM_EXTENSIONS
37 AC_PROG_GCC_TRADITIONAL
40 gl_IGNORE_UNUSED_LIBRARIES
44 OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uname\$(EXEEXT)"
46 AC_CHECK_FUNCS(chroot,
47 OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS chroot\$(EXEEXT)"
49 AC_CHECK_FUNCS(gethostid,
50 OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS hostid\$(EXEEXT)"
57 AC_MSG_CHECKING(whether localtime caches TZ)
58 AC_CACHE_VAL(utils_cv_localtime_cache,
59 [if test x$ac_cv_func_tzset = xyes; then
60 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
64 extern char **environ;
68 for (to = from = environ; (*to = *from); from++)
69 if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
74 time_t now = time ((time_t *) 0);
75 int hour_GMT0, hour_unset;
76 if (putenv ("TZ=GMT0") != 0)
78 hour_GMT0 = localtime (&now)->tm_hour;
80 hour_unset = localtime (&now)->tm_hour;
81 if (putenv ("TZ=PST8") != 0)
83 if (localtime (&now)->tm_hour == hour_GMT0)
86 if (localtime (&now)->tm_hour != hour_unset)
90 [utils_cv_localtime_cache=no],
91 [utils_cv_localtime_cache=yes],
92 [# If we have tzset, assume the worst when cross-compiling.
93 utils_cv_localtime_cache=yes])
95 # If we lack tzset, report that localtime does not cache TZ,
96 # since we can't invalidate the cache if we don't have tzset.
97 utils_cv_localtime_cache=no
99 AC_MSG_RESULT($utils_cv_localtime_cache)
100 if test $utils_cv_localtime_cache = yes; then
101 AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME])
104 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
105 AC_CHECK_FUNCS(initgroups)
106 if test $ac_cv_func_initgroups = no; then
107 AC_CHECK_LIB(os, initgroups)
110 AC_CHECK_FUNCS(syslog)
111 if test $ac_cv_func_syslog = no; then
112 # syslog is not in the default libraries. See if it's in some other.
113 for lib in bsd socket inet; do
114 AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME])
115 LIBS="$LIBS -l$lib"; break])
119 AC_CACHE_CHECK([for 3-argument setpriority function],
120 [utils_cv_func_setpriority],
123 [[#include <sys/time.h>
124 #include <sys/resource.h>
126 [[setpriority (0, 0, 0);]])],
127 [utils_cv_func_setpriority=yes],
128 [utils_cv_func_setpriority=no])])
129 if test $utils_cv_func_setpriority = no; then
130 AC_CHECK_FUNCS([nice])
132 case $utils_cv_func_setpriority,$ac_cv_func_nice in
134 OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
138 AC_DEFUN([coreutils_DUMMY_1],
140 AC_REQUIRE([gl_READUTMP])
141 if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
142 OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS pinky\$(EXEEXT)"
143 OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS users\$(EXEEXT)"
144 OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS who\$(EXEEXT)"
145 MAN="$MAN pinky.1 users.1 who.1"
150 AC_MSG_CHECKING(ut_host in struct utmp)
151 AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
152 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
153 #include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],
154 [su_cv_func_ut_host_in_utmp=yes],
155 [su_cv_func_ut_host_in_utmp=no])])
156 AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
157 if test $su_cv_func_ut_host_in_utmp = yes; then
159 AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
162 if test -z "$have_ut_host"; then
163 AC_MSG_CHECKING(ut_host in struct utmpx)
164 AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
165 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
166 #include <utmpx.h>]], [[struct utmpx ut; ut.ut_host;]])],
167 [su_cv_func_ut_host_in_utmpx=yes],
168 [su_cv_func_ut_host_in_utmpx=no])])
169 AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
170 if test $su_cv_func_ut_host_in_utmpx = yes; then
171 AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME])
172 AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
177 [OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uptime\$(EXEEXT)"
178 MAN="$MAN uptime.1"])
180 AC_SYS_POSIX_TERMIOS()
181 gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
183 if test $ac_cv_sys_posix_termios = yes; then
184 OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS stty\$(EXEEXT)" MAN="$MAN stty.1"
186 AC_MSG_CHECKING(whether termios.h needs _XOPEN_SOURCE)
187 AC_CACHE_VAL(su_cv_sys_termios_needs_xopen_source,
188 [AC_EGREP_CPP(yes, [#include <termios.h>
191 #endif], su_cv_sys_termios_needs_xopen_source=no,
192 AC_EGREP_CPP(yes, [#define _XOPEN_SOURCE
196 #endif], su_cv_sys_termios_needs_xopen_source=yes,
197 su_cv_sys_termios_needs_xopen_source=no))])
198 AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source)
199 test $su_cv_sys_termios_needs_xopen_source = yes &&
200 AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME])
202 AC_MSG_CHECKING(c_line in struct termios)
203 AC_CACHE_VAL(su_cv_sys_c_line_in_termios,
204 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
205 #define _XOPEN_SOURCE
207 #include <sys/types.h>
208 #include <termios.h>]], [[struct termios t; t.c_line;]])],
209 [su_cv_sys_c_line_in_termios=yes],
210 [su_cv_sys_c_line_in_termios=no])])
211 AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
212 test $su_cv_sys_c_line_in_termios = yes \
213 && AC_DEFINE(HAVE_C_LINE, 1, [FIXME])
216 # FIXME: note that this macro appears above, too.
217 # I'm leaving it here for now. This whole thing needs to be modernized...
220 gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
222 if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no && \
223 test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
224 AC_MSG_CHECKING(TIOCGWINSZ in sys/pty.h)
225 AC_CACHE_VAL(su_cv_sys_tiocgwinsz_in_sys_pty_h,
226 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
227 #ifdef WINSIZE_IN_PTEM
228 # include <sys/stream.h>
229 # include <sys/ptem.h>
231 #include <sys/ioctl.h>
233 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
234 [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
235 [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
236 AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h)
238 test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
239 && AC_DEFINE(GWINSZ_IN_SYS_PTY, 1,
240 [Define if your system defines TIOCGWINSZ in sys/pty.h.])
244 AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
246 #include <signal.h>])
248 # For src/kill.c and src/printf.c.
249 AC_CHECK_DECLS([strtoimax, strtoumax])
253 AM_GNU_GETTEXT([external], [need-formatstring-macros])
254 AM_GNU_GETTEXT_VERSION([0.15])
270 tests/dircolors/Makefile
273 tests/factor/Makefile
276 tests/install/Makefile
281 tests/md5sum/Makefile
287 tests/readlink/Makefile
291 tests/sha1sum/Makefile
297 tests/tail-2/Makefile
304 tests/unexpand/Makefile