Version 6.7.
[coreutils.git] / configure.ac
blobfc8dbf7c2c202c9edca5b47a2d7e5fd2fee242b8
1 # -*- autoconf -*-
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)
9 # any later version.
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_PREREQ(2.60)
23 AC_INIT([GNU coreutils],[6.7],[bug-coreutils@gnu.org])
24 AC_CONFIG_SRCDIR(src/ls.c)
26 AC_CONFIG_AUX_DIR(build-aux)
27 AC_CONFIG_HEADERS([lib/config.h:lib/config.hin])
29 AB_INIT()
30 AM_INIT_AUTOMAKE([1.9.6 gnits dist-bzip2])
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_INIT
40 coreutils_MACROS
42 AC_CHECK_FUNCS(uname,
43         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uname\$(EXEEXT)"
44         MAN="$MAN uname.1")
45 AC_CHECK_FUNCS(chroot,
46         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS chroot\$(EXEEXT)"
47         MAN="$MAN chroot.1")
48 AC_CHECK_FUNCS(gethostid,
49         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS hostid\$(EXEEXT)"
50         MAN="$MAN hostid.1")
52 gl_WINSIZE_IN_PTEM
54 AC_MSG_CHECKING(whether localtime caches TZ)
55 AC_CACHE_VAL(utils_cv_localtime_cache,
56 [if test x$ac_cv_func_tzset = xyes; then
57 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
58 #if STDC_HEADERS
59 # include <stdlib.h>
60 #endif
61 extern char **environ;
62 void unset_TZ (void)
64   char **from, **to;
65   for (to = from = environ; (*to = *from); from++)
66     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
67       to++;
69 int main()
71   time_t now = time ((time_t *) 0);
72   int hour_GMT0, hour_unset;
73   if (putenv ("TZ=GMT0") != 0)
74     exit (1);
75   hour_GMT0 = localtime (&now)->tm_hour;
76   unset_TZ ();
77   hour_unset = localtime (&now)->tm_hour;
78   if (putenv ("TZ=PST8") != 0)
79     exit (1);
80   if (localtime (&now)->tm_hour == hour_GMT0)
81     exit (1);
82   unset_TZ ();
83   if (localtime (&now)->tm_hour != hour_unset)
84     exit (1);
85   exit (0);
86 }]])],
87 [utils_cv_localtime_cache=no],
88 [utils_cv_localtime_cache=yes],
89 [# If we have tzset, assume the worst when cross-compiling.
90 utils_cv_localtime_cache=yes])
91 else
92         # If we lack tzset, report that localtime does not cache TZ,
93         # since we can't invalidate the cache if we don't have tzset.
94         utils_cv_localtime_cache=no
95 fi])dnl
96 AC_MSG_RESULT($utils_cv_localtime_cache)
97 if test $utils_cv_localtime_cache = yes; then
98   AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME])
101 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
102 AC_CHECK_FUNCS(initgroups)
103 if test $ac_cv_func_initgroups = no; then
104   AC_CHECK_LIB(os, initgroups)
107 AC_CHECK_FUNCS(syslog)
108 if test $ac_cv_func_syslog = no; then
109   # syslog is not in the default libraries.  See if it's in some other.
110   for lib in bsd socket inet; do
111     AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME])
112       LIBS="$LIBS -l$lib"; break])
113   done
116 AC_CACHE_CHECK([for 3-argument setpriority function],
117   [utils_cv_func_setpriority],
118   [AC_LINK_IFELSE(
119     [AC_LANG_PROGRAM(
120        [[#include <sys/time.h>
121          #include <sys/resource.h>
122        ]],
123        [[setpriority (0, 0, 0);]])],
124     [utils_cv_func_setpriority=yes],
125     [utils_cv_func_setpriority=no])])
126 if test $utils_cv_func_setpriority = no; then
127   AC_CHECK_FUNCS([nice])
129 case $utils_cv_func_setpriority,$ac_cv_func_nice in
130 *yes*)
131   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
132   MAN="$MAN nice.1";;
133 esac
135 AC_DEFUN([coreutils_DUMMY_1],
137   AC_REQUIRE([gl_READUTMP])
138   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
139     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS pinky\$(EXEEXT)"
140     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS users\$(EXEEXT)"
141     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS who\$(EXEEXT)"
142     MAN="$MAN pinky.1 users.1 who.1"
143   fi
145 coreutils_DUMMY_1
147 AC_MSG_CHECKING(ut_host in struct utmp)
148 AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
149 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
150 #include <utmp.h>]], [[struct utmp ut; return !sizeof ut.ut_host;]])],
151   [su_cv_func_ut_host_in_utmp=yes],
152   [su_cv_func_ut_host_in_utmp=no])])
153 AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
154 if test $su_cv_func_ut_host_in_utmp = yes; then
155   have_ut_host=1
156   AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
159 if test -z "$have_ut_host"; then
160   AC_MSG_CHECKING(ut_host in struct utmpx)
161   AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
162   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
163 #include <utmpx.h>]], [[struct utmpx ut; return !sizeof ut.ut_host;]])],
164     [su_cv_func_ut_host_in_utmpx=yes],
165     [su_cv_func_ut_host_in_utmpx=no])])
166   AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
167   if test $su_cv_func_ut_host_in_utmpx = yes; then
168     AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME])
169     AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
170   fi
173 GNULIB_BOOT_TIME(
174   [OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uptime\$(EXEEXT)"
175   MAN="$MAN uptime.1"])
177 AC_SYS_POSIX_TERMIOS()
178 gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
180 if test $ac_cv_sys_posix_termios = yes; then
181   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS stty\$(EXEEXT)" MAN="$MAN stty.1"
183   AC_MSG_CHECKING(whether termios.h needs _XOPEN_SOURCE)
184   AC_CACHE_VAL(su_cv_sys_termios_needs_xopen_source,
185   [AC_EGREP_CPP(yes, [#include <termios.h>
186 #ifdef IUCLC
188 #endif], su_cv_sys_termios_needs_xopen_source=no,
189    AC_EGREP_CPP(yes, [#define _XOPEN_SOURCE
190 #include <termios.h>
191 #ifdef IUCLC
193 #endif], su_cv_sys_termios_needs_xopen_source=yes,
194    su_cv_sys_termios_needs_xopen_source=no))])
195   AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source)
196   test $su_cv_sys_termios_needs_xopen_source = yes &&
197     AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME])
199   AC_MSG_CHECKING(c_line in struct termios)
200   AC_CACHE_VAL(su_cv_sys_c_line_in_termios,
201   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
202 #define _XOPEN_SOURCE
203 #endif
204 #include <sys/types.h>
205 #include <termios.h>]], [[struct termios t; return !sizeof t.c_line;]])],
206     [su_cv_sys_c_line_in_termios=yes],
207     [su_cv_sys_c_line_in_termios=no])])
208   AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
209   test $su_cv_sys_c_line_in_termios = yes \
210     && AC_DEFINE(HAVE_C_LINE, 1, [FIXME])
213 # FIXME: note that this macro appears above, too.
214 # I'm leaving it here for now.  This whole thing needs to be modernized...
215 gl_WINSIZE_IN_PTEM
217 gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H
219 if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no && \
220    test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
221   AC_MSG_CHECKING(TIOCGWINSZ in sys/pty.h)
222   AC_CACHE_VAL(su_cv_sys_tiocgwinsz_in_sys_pty_h,
223   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
224 #ifdef WINSIZE_IN_PTEM
225 # include <sys/stream.h>
226 # include <sys/ptem.h>
227 #endif
228 #include <sys/ioctl.h>
229 #include <sys/tty.h>
230 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
231     [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
232     [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
233   AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h)
235   test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
236       && AC_DEFINE(GWINSZ_IN_SYS_PTY, 1,
237                    [Define if your system defines TIOCGWINSZ in sys/pty.h.])
240 # For src/kill.c.
241 AC_CHECK_DECLS([strsignal, sys_siglist, _sys_siglist, __sys_siglist], , ,
242   [AC_INCLUDES_DEFAULT
243 #include <signal.h>])
245 # For src/kill.c and src/printf.c.
246 AC_CHECK_DECLS([strtoimax, strtoumax])
248 cu_LIB_CHECK
250 AM_GNU_GETTEXT([external], [need-formatstring-macros])
251 AM_GNU_GETTEXT_VERSION([0.15])
253 AC_CONFIG_FILES(
254   Makefile
255   doc/Makefile
256   lib/Makefile
257   man/Makefile
258   po/Makefile.in
259   src/Makefile
260   tests/Makefile
261   tests/chgrp/Makefile
262   tests/chmod/Makefile
263   tests/chown/Makefile
264   tests/cp/Makefile
265   tests/cut/Makefile
266   tests/dd/Makefile
267   tests/dircolors/Makefile
268   tests/du/Makefile
269   tests/expr/Makefile
270   tests/factor/Makefile
271   tests/fmt/Makefile
272   tests/head/Makefile
273   tests/install/Makefile
274   tests/join/Makefile
275   tests/ln/Makefile
276   tests/ls-2/Makefile
277   tests/ls/Makefile
278   tests/md5sum/Makefile
279   tests/misc/Makefile
280   tests/mkdir/Makefile
281   tests/mv/Makefile
282   tests/od/Makefile
283   tests/pr/Makefile
284   tests/readlink/Makefile
285   tests/rm/Makefile
286   tests/rmdir/Makefile
287   tests/seq/Makefile
288   tests/sha1sum/Makefile
289   tests/shred/Makefile
290   tests/sort/Makefile
291   tests/stty/Makefile
292   tests/sum/Makefile
293   tests/tac/Makefile
294   tests/tail-2/Makefile
295   tests/tail/Makefile
296   tests/tee/Makefile
297   tests/test/Makefile
298   tests/touch/Makefile
299   tests/tr/Makefile
300   tests/tsort/Makefile
301   tests/unexpand/Makefile
302   tests/uniq/Makefile
303   tests/wc/Makefile
304   )
305 AC_OUTPUT