*** empty log message ***
[coreutils.git] / configure.ac
blobb72e949d3ae43bbf3d7aef8f70cb9fb876404c52
1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
2 AC_INIT([GNU coreutils],[4.5.5],[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_AIX
18 AC_MINIX
20 AC_CHECK_FUNCS(uname,
21         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uname" MAN="$MAN uname.1")
22 AC_CHECK_FUNCS(chroot,
23         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS chroot" MAN="$MAN chroot.1")
24 AC_CHECK_FUNCS(gethostid,
25         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS hostid" MAN="$MAN hostid.1")
27 jm_MACROS
29 AC_HEADER_TIOCGWINSZ()
30 jm_WINSIZE_IN_PTEM
32 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
33 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
34 # enable the work-around code in fsusage.c.
35 AC_MSG_CHECKING([for statfs that truncates block counts])
36 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
37 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
38 #if !defined(sun) && !defined(__sun)
39 choke -- this is a workaround for a Sun-specific problem
40 #endif
41 #include <sys/types.h>
42 #include <sys/vfs.h>]],
43   [[struct statfs t; long c = *(t.f_spare);]])],
44   [fu_cv_sys_truncating_statfs=yes],
45   [fu_cv_sys_truncating_statfs=no])])
46 if test $fu_cv_sys_truncating_statfs = yes; then
47   AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
48 [  Define if the block counts reported by statfs may be truncated to 2GB
49    and the correct values may be stored in the f_spare array.
50    (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
51    SunOS 4.1.1 seems not to be affected.)])
53 AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
55 AC_MSG_CHECKING(whether localtime caches TZ)
56 AC_CACHE_VAL(utils_cv_localtime_cache,
57 [if test x$ac_cv_func_tzset = xyes; then
58 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
59 #if STDC_HEADERS
60 # include <stdlib.h>
61 #endif
62 extern char **environ;
63 unset_TZ ()
65   char **from, **to;
66   for (to = from = environ; (*to = *from); from++)
67     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
68       to++;
70 main()
72   time_t now = time ((time_t *) 0);
73   int hour_GMT0, hour_unset;
74   if (putenv ("TZ=GMT0") != 0)
75     exit (1);
76   hour_GMT0 = localtime (&now)->tm_hour;
77   unset_TZ ();
78   hour_unset = localtime (&now)->tm_hour;
79   if (putenv ("TZ=PST8") != 0)
80     exit (1);
81   if (localtime (&now)->tm_hour == hour_GMT0)
82     exit (1);
83   unset_TZ ();
84   if (localtime (&now)->tm_hour != hour_unset)
85     exit (1);
86   exit (0);
87 }]])],
88 [utils_cv_localtime_cache=no],
89 [utils_cv_localtime_cache=yes],
90 [# If we have tzset, assume the worst when cross-compiling.
91 utils_cv_localtime_cache=yes])
92 else
93         # If we lack tzset, report that localtime does not cache TZ,
94         # since we can't invalidate the cache if we don't have tzset.
95         utils_cv_localtime_cache=no
96 fi])dnl
97 AC_MSG_RESULT($utils_cv_localtime_cache)
98 if test $utils_cv_localtime_cache = yes; then
99   AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME])
102 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
103 AC_CHECK_FUNCS(initgroups)
104 if test $ac_cv_func_initgroups = no; then
105   AC_CHECK_LIB(os, initgroups)
108 AC_CHECK_FUNCS(syslog)
109 if test $ac_cv_func_syslog = no; then
110   # syslog is not in the default libraries.  See if it's in some other.
111   for lib in bsd socket inet; do
112     AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME])
113       LIBS="$LIBS -l$lib"; break])
114   done
117 AC_MSG_CHECKING(for 3-argument setpriority function)
118 AC_CACHE_VAL(utils_cv_func_setpriority,
119 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
120   #include <sys/resource.h>]], [[setpriority(0, 0, 0);]])],
121   [utils_cv_func_setpriority=yes],
122   [utils_cv_func_setpriority=no])])
123 AC_MSG_RESULT($utils_cv_func_setpriority)
124 if test $utils_cv_func_setpriority = yes; then
125   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice"
126   OPTIONAL_BIN_ZCRIPTS="$OPTIONAL_BIN_ZCRIPTS nohup"
127   MAN="$MAN nice.1 nohup.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"
138     OPTIONAL_BIN_ZCRIPTS="$OPTIONAL_BIN_ZCRIPTS nohup"
139     MAN="$MAN nice.1 nohup.1"
140   fi
143 AC_DEFUN(jm_DUMMY_1,
145   AC_REQUIRE([jm_PREREQ_READUTMP])
146   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
147     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS pinky users who"
148     MAN="$MAN pinky.1 users.1 who.1"
149   fi
151 jm_DUMMY_1
153 AC_MSG_CHECKING(ut_host in struct utmp)
154 AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
155 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
156 #include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],
157   [su_cv_func_ut_host_in_utmp=yes],
158   [su_cv_func_ut_host_in_utmp=no])])
159 AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
160 if test $su_cv_func_ut_host_in_utmp = yes; then
161   have_ut_host=1
162   AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
165 if test -z "$have_ut_host"; then
166   AC_MSG_CHECKING(ut_host in struct utmpx)
167   AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
168   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
169 #include <utmpx.h>]], [[struct utmpx ut; ut.ut_host;]])],
170     [su_cv_func_ut_host_in_utmpx=yes],
171     [su_cv_func_ut_host_in_utmpx=no])])
172   AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
173   if test $su_cv_func_ut_host_in_utmpx = yes; then
174     AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME])
175     AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
176   fi
179 GNULIB_BOOT_TIME(
180   [OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uptime" MAN="$MAN uptime.1"])
182 AC_SYS_POSIX_TERMIOS()
183 jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
185 if test $ac_cv_sys_posix_termios = yes; then
186   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS stty" MAN="$MAN stty.1"
188   AC_MSG_CHECKING(whether termios.h needs _XOPEN_SOURCE)
189   AC_CACHE_VAL(su_cv_sys_termios_needs_xopen_source,
190   [AC_EGREP_CPP(yes, [#include <termios.h>
191 #ifdef IUCLC
193 #endif], su_cv_sys_termios_needs_xopen_source=no,
194    AC_EGREP_CPP(yes, [#define _XOPEN_SOURCE
195 #include <termios.h>
196 #ifdef IUCLC
198 #endif], su_cv_sys_termios_needs_xopen_source=yes,
199    su_cv_sys_termios_needs_xopen_source=no))])
200   AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source)
201   test $su_cv_sys_termios_needs_xopen_source = yes &&
202     AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME])
204   AC_MSG_CHECKING(c_line in struct termios)
205   AC_CACHE_VAL(su_cv_sys_c_line_in_termios,
206   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
207 #define _XOPEN_SOURCE
208 #endif
209 #include <sys/types.h>
210 #include <termios.h>]], [[struct termios t; t.c_line;]])],
211     [su_cv_sys_c_line_in_termios=yes],
212     [su_cv_sys_c_line_in_termios=no])])
213   AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
214   test $su_cv_sys_c_line_in_termios = yes \
215     && AC_DEFINE(HAVE_C_LINE, 1, [FIXME])
218 # FIXME: note that this macro appears above, too.
219 # I'm leaving it here for now.  This whole thing needs to be modernized...
220 jm_WINSIZE_IN_PTEM
222 jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H
224 if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no && \
225    test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
226   AC_MSG_CHECKING(TIOCGWINSZ in sys/pty.h)
227   AC_CACHE_VAL(su_cv_sys_tiocgwinsz_in_sys_pty_h,
228   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
229 #ifdef WINSIZE_IN_PTEM
230 # include <sys/stream.h>
231 # include <sys/ptem.h>
232 #endif
233 #include <sys/ioctl.h>
234 #include <sys/tty.h>
235 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
236     [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
237     [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
238   AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h)
240   test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
241       && AC_DEFINE(GWINSZ_IN_SYS_PTY, 1,
242                    [Define if your system defines TIOCGWINSZ in sys/pty.h.])
245 # For src/kill.c.
246 AC_CHECK_DECLS([strsignal, strtoimax, sys_siglist, _sys_siglist])
248 jm_LIB_CHECK
250 AM_GNU_GETTEXT([external], [need-ngettext])
251 AM_GNU_GETTEXT_VERSION(0.11.5)
253 AC_CONFIG_FILES(
254   Makefile
255   doc/Makefile
256   lib/Makefile
257   man/Makefile
258   m4/Makefile
259   po/Makefile.in
260   src/Makefile
261   tests/Makefile
262   tests/basename/Makefile
263   tests/chgrp/Makefile
264   tests/chmod/Makefile
265   tests/chown/Makefile
266   tests/cp/Makefile
267   tests/cut/Makefile
268   tests/date/Makefile
269   tests/dd/Makefile
270   tests/dircolors/Makefile
271   tests/du/Makefile
272   tests/expr/Makefile
273   tests/factor/Makefile
274   tests/fmt/Makefile
275   tests/head/Makefile
276   tests/install/Makefile
277   tests/join/Makefile
278   tests/ln/Makefile
279   tests/ls-2/Makefile
280   tests/ls/Makefile
281   tests/md5sum/Makefile
282   tests/misc/Makefile
283   tests/mkdir/Makefile
284   tests/mv/Makefile
285   tests/od/Makefile
286   tests/pr/Makefile
287   tests/rm/Makefile
288   tests/rmdir/Makefile
289   tests/seq/Makefile
290   tests/sha1sum/Makefile
291   tests/shred/Makefile
292   tests/sort/Makefile
293   tests/stty/Makefile
294   tests/sum/Makefile
295   tests/tac/Makefile
296   tests/tail-2/Makefile
297   tests/tail/Makefile
298   tests/test/Makefile
299   tests/touch/Makefile
300   tests/tr/Makefile
301   tests/tsort/Makefile
302   tests/unexpand/Makefile
303   tests/uniq/Makefile
304   tests/wc/Makefile
305   )
306 AC_OUTPUT