*** empty log message ***
[coreutils.git] / configure.ac
blob1614dbefdacfe55bfa4810962ca487b88e736295
1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
2 AC_INIT([GNU coreutils],[4.5.11],[bug-coreutils@gnu.org])
3 AC_CONFIG_SRCDIR(src/ls.c)
5 AC_CONFIG_AUX_DIR(config)
6 AC_CONFIG_HEADERS([config.h:config.hin])
7 AC_CANONICAL_HOST
9 AM_INIT_AUTOMAKE([1.6b gnits dist-bzip2])
11 AC_GNU_SOURCE
12 jm_PERL
13 AC_PROG_CC
14 AC_PROG_CPP
15 AC_PROG_GCC_TRADITIONAL
16 AC_PROG_RANLIB
17 AC_PROG_LN_S
18 AC_AIX
19 AC_MINIX
21 AC_CHECK_FUNCS(uname,
22         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uname\$(EXEEXT)"
23         MAN="$MAN uname.1")
24 AC_CHECK_FUNCS(chroot,
25         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS chroot\$(EXEEXT)"
26         MAN="$MAN chroot.1")
27 AC_CHECK_FUNCS(gethostid,
28         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS hostid\$(EXEEXT)"
29         MAN="$MAN hostid.1")
31 jm_MACROS
33 AC_HEADER_TIOCGWINSZ()
34 jm_WINSIZE_IN_PTEM
36 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
37 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
38 # enable the work-around code in fsusage.c.
39 AC_MSG_CHECKING([for statfs that truncates block counts])
40 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
41 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
42 #if !defined(sun) && !defined(__sun)
43 choke -- this is a workaround for a Sun-specific problem
44 #endif
45 #include <sys/types.h>
46 #include <sys/vfs.h>]],
47   [[struct statfs t; long c = *(t.f_spare);]])],
48   [fu_cv_sys_truncating_statfs=yes],
49   [fu_cv_sys_truncating_statfs=no])])
50 if test $fu_cv_sys_truncating_statfs = yes; then
51   AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
52 [  Define if the block counts reported by statfs may be truncated to 2GB
53    and the correct values may be stored in the f_spare array.
54    (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
55    SunOS 4.1.1 seems not to be affected.)])
57 AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
59 AC_MSG_CHECKING(whether localtime caches TZ)
60 AC_CACHE_VAL(utils_cv_localtime_cache,
61 [if test x$ac_cv_func_tzset = xyes; then
62 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
63 #if STDC_HEADERS
64 # include <stdlib.h>
65 #endif
66 extern char **environ;
67 unset_TZ ()
69   char **from, **to;
70   for (to = from = environ; (*to = *from); from++)
71     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
72       to++;
74 main()
76   time_t now = time ((time_t *) 0);
77   int hour_GMT0, hour_unset;
78   if (putenv ("TZ=GMT0") != 0)
79     exit (1);
80   hour_GMT0 = localtime (&now)->tm_hour;
81   unset_TZ ();
82   hour_unset = localtime (&now)->tm_hour;
83   if (putenv ("TZ=PST8") != 0)
84     exit (1);
85   if (localtime (&now)->tm_hour == hour_GMT0)
86     exit (1);
87   unset_TZ ();
88   if (localtime (&now)->tm_hour != hour_unset)
89     exit (1);
90   exit (0);
91 }]])],
92 [utils_cv_localtime_cache=no],
93 [utils_cv_localtime_cache=yes],
94 [# If we have tzset, assume the worst when cross-compiling.
95 utils_cv_localtime_cache=yes])
96 else
97         # If we lack tzset, report that localtime does not cache TZ,
98         # since we can't invalidate the cache if we don't have tzset.
99         utils_cv_localtime_cache=no
100 fi])dnl
101 AC_MSG_RESULT($utils_cv_localtime_cache)
102 if test $utils_cv_localtime_cache = yes; then
103   AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME])
106 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
107 AC_CHECK_FUNCS(initgroups)
108 if test $ac_cv_func_initgroups = no; then
109   AC_CHECK_LIB(os, initgroups)
112 AC_CHECK_FUNCS(syslog)
113 if test $ac_cv_func_syslog = no; then
114   # syslog is not in the default libraries.  See if it's in some other.
115   for lib in bsd socket inet; do
116     AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME])
117       LIBS="$LIBS -l$lib"; break])
118   done
121 AC_MSG_CHECKING(for 3-argument setpriority function)
122 AC_CACHE_VAL(utils_cv_func_setpriority,
123 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
124   #include <sys/resource.h>]], [[setpriority(0, 0, 0);]])],
125   [utils_cv_func_setpriority=yes],
126   [utils_cv_func_setpriority=no])])
127 AC_MSG_RESULT($utils_cv_func_setpriority)
128 if test $utils_cv_func_setpriority = yes; then
129   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
130   OPTIONAL_BIN_ZCRIPTS="$OPTIONAL_BIN_ZCRIPTS nohup"
131   MAN="$MAN nice.1 nohup.1"
132 else
133   AC_MSG_CHECKING(for nice function)
134   AC_CACHE_VAL(utils_cv_func_nice,
135     [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[nice();]])],
136                     [utils_cv_func_nice=yes],
137                     [utils_cv_func_nice=no])])
138   AC_MSG_RESULT($utils_cv_func_nice)
139   if test $utils_cv_func_nice = yes; then
140     AC_DEFINE(NICE_PRIORITY, 1, [FIXME])
141     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
142     OPTIONAL_BIN_ZCRIPTS="$OPTIONAL_BIN_ZCRIPTS nohup"
143     MAN="$MAN nice.1 nohup.1"
144   fi
147 AC_DEFUN(jm_DUMMY_1,
149   AC_REQUIRE([jm_PREREQ_READUTMP])
150   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
151     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS pinky\$(EXEEXT)"
152     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS users\$(EXEEXT)"
153     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS who\$(EXEEXT)"
154     MAN="$MAN pinky.1 users.1 who.1"
155   fi
157 jm_DUMMY_1
159 AC_MSG_CHECKING(ut_host in struct utmp)
160 AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
161 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
162 #include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],
163   [su_cv_func_ut_host_in_utmp=yes],
164   [su_cv_func_ut_host_in_utmp=no])])
165 AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
166 if test $su_cv_func_ut_host_in_utmp = yes; then
167   have_ut_host=1
168   AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
171 if test -z "$have_ut_host"; then
172   AC_MSG_CHECKING(ut_host in struct utmpx)
173   AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
174   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
175 #include <utmpx.h>]], [[struct utmpx ut; ut.ut_host;]])],
176     [su_cv_func_ut_host_in_utmpx=yes],
177     [su_cv_func_ut_host_in_utmpx=no])])
178   AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
179   if test $su_cv_func_ut_host_in_utmpx = yes; then
180     AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME])
181     AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
182   fi
185 GNULIB_BOOT_TIME(
186   [OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uptime\$(EXEEXT)"
187   MAN="$MAN uptime.1"])
189 AC_SYS_POSIX_TERMIOS()
190 jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
192 if test $ac_cv_sys_posix_termios = yes; then
193   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS stty\$(EXEEXT)" MAN="$MAN stty.1"
195   AC_MSG_CHECKING(whether termios.h needs _XOPEN_SOURCE)
196   AC_CACHE_VAL(su_cv_sys_termios_needs_xopen_source,
197   [AC_EGREP_CPP(yes, [#include <termios.h>
198 #ifdef IUCLC
200 #endif], su_cv_sys_termios_needs_xopen_source=no,
201    AC_EGREP_CPP(yes, [#define _XOPEN_SOURCE
202 #include <termios.h>
203 #ifdef IUCLC
205 #endif], su_cv_sys_termios_needs_xopen_source=yes,
206    su_cv_sys_termios_needs_xopen_source=no))])
207   AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source)
208   test $su_cv_sys_termios_needs_xopen_source = yes &&
209     AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME])
211   AC_MSG_CHECKING(c_line in struct termios)
212   AC_CACHE_VAL(su_cv_sys_c_line_in_termios,
213   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
214 #define _XOPEN_SOURCE
215 #endif
216 #include <sys/types.h>
217 #include <termios.h>]], [[struct termios t; t.c_line;]])],
218     [su_cv_sys_c_line_in_termios=yes],
219     [su_cv_sys_c_line_in_termios=no])])
220   AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
221   test $su_cv_sys_c_line_in_termios = yes \
222     && AC_DEFINE(HAVE_C_LINE, 1, [FIXME])
225 # FIXME: note that this macro appears above, too.
226 # I'm leaving it here for now.  This whole thing needs to be modernized...
227 jm_WINSIZE_IN_PTEM
229 jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H
231 if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no && \
232    test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
233   AC_MSG_CHECKING(TIOCGWINSZ in sys/pty.h)
234   AC_CACHE_VAL(su_cv_sys_tiocgwinsz_in_sys_pty_h,
235   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
236 #ifdef WINSIZE_IN_PTEM
237 # include <sys/stream.h>
238 # include <sys/ptem.h>
239 #endif
240 #include <sys/ioctl.h>
241 #include <sys/tty.h>
242 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
243     [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
244     [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
245   AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h)
247   test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
248       && AC_DEFINE(GWINSZ_IN_SYS_PTY, 1,
249                    [Define if your system defines TIOCGWINSZ in sys/pty.h.])
252 # For src/kill.c.
253 AC_CHECK_DECLS([strsignal, strtoimax, sys_siglist, _sys_siglist])
255 jm_LIB_CHECK
257 AM_GNU_GETTEXT([external], [need-ngettext])
258 AM_GNU_GETTEXT_VERSION(0.11.5)
260 AC_CONFIG_FILES(
261   Makefile
262   doc/Makefile
263   lib/Makefile
264   man/Makefile
265   m4/Makefile
266   po/Makefile.in
267   src/Makefile
268   tests/Makefile
269   tests/basename/Makefile
270   tests/chgrp/Makefile
271   tests/chmod/Makefile
272   tests/chown/Makefile
273   tests/cp/Makefile
274   tests/cut/Makefile
275   tests/date/Makefile
276   tests/dd/Makefile
277   tests/dircolors/Makefile
278   tests/du/Makefile
279   tests/expr/Makefile
280   tests/factor/Makefile
281   tests/fmt/Makefile
282   tests/head/Makefile
283   tests/install/Makefile
284   tests/join/Makefile
285   tests/ln/Makefile
286   tests/ls-2/Makefile
287   tests/ls/Makefile
288   tests/md5sum/Makefile
289   tests/misc/Makefile
290   tests/mkdir/Makefile
291   tests/mv/Makefile
292   tests/od/Makefile
293   tests/pr/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/test/Makefile
306   tests/touch/Makefile
307   tests/tr/Makefile
308   tests/tsort/Makefile
309   tests/unexpand/Makefile
310   tests/uniq/Makefile
311   tests/wc/Makefile
312   )
313 AC_OUTPUT