Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
[coreutils.git] / configure.ac
blobcaf71b6111f277a12c8f8590c0a67fc04cd93d92
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_AIX
18 AC_MINIX
20 AC_CHECK_FUNCS(uname,
21         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uname\$(EXEEXT)"
22         MAN="$MAN uname.1")
23 AC_CHECK_FUNCS(chroot,
24         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS chroot\$(EXEEXT)"
25         MAN="$MAN chroot.1")
26 AC_CHECK_FUNCS(gethostid,
27         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS hostid\$(EXEEXT)"
28         MAN="$MAN hostid.1")
30 jm_MACROS
32 AC_HEADER_TIOCGWINSZ()
33 jm_WINSIZE_IN_PTEM
35 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
36 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
37 # enable the work-around code in fsusage.c.
38 AC_MSG_CHECKING([for statfs that truncates block counts])
39 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
40 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
41 #if !defined(sun) && !defined(__sun)
42 choke -- this is a workaround for a Sun-specific problem
43 #endif
44 #include <sys/types.h>
45 #include <sys/vfs.h>]],
46   [[struct statfs t; long c = *(t.f_spare);]])],
47   [fu_cv_sys_truncating_statfs=yes],
48   [fu_cv_sys_truncating_statfs=no])])
49 if test $fu_cv_sys_truncating_statfs = yes; then
50   AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
51 [  Define if the block counts reported by statfs may be truncated to 2GB
52    and the correct values may be stored in the f_spare array.
53    (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
54    SunOS 4.1.1 seems not to be affected.)])
56 AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
58 AC_MSG_CHECKING(whether localtime caches TZ)
59 AC_CACHE_VAL(utils_cv_localtime_cache,
60 [if test x$ac_cv_func_tzset = xyes; then
61 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
62 #if STDC_HEADERS
63 # include <stdlib.h>
64 #endif
65 extern char **environ;
66 unset_TZ ()
68   char **from, **to;
69   for (to = from = environ; (*to = *from); from++)
70     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
71       to++;
73 main()
75   time_t now = time ((time_t *) 0);
76   int hour_GMT0, hour_unset;
77   if (putenv ("TZ=GMT0") != 0)
78     exit (1);
79   hour_GMT0 = localtime (&now)->tm_hour;
80   unset_TZ ();
81   hour_unset = localtime (&now)->tm_hour;
82   if (putenv ("TZ=PST8") != 0)
83     exit (1);
84   if (localtime (&now)->tm_hour == hour_GMT0)
85     exit (1);
86   unset_TZ ();
87   if (localtime (&now)->tm_hour != hour_unset)
88     exit (1);
89   exit (0);
90 }]])],
91 [utils_cv_localtime_cache=no],
92 [utils_cv_localtime_cache=yes],
93 [# If we have tzset, assume the worst when cross-compiling.
94 utils_cv_localtime_cache=yes])
95 else
96         # If we lack tzset, report that localtime does not cache TZ,
97         # since we can't invalidate the cache if we don't have tzset.
98         utils_cv_localtime_cache=no
99 fi])dnl
100 AC_MSG_RESULT($utils_cv_localtime_cache)
101 if test $utils_cv_localtime_cache = yes; then
102   AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME])
105 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
106 AC_CHECK_FUNCS(initgroups)
107 if test $ac_cv_func_initgroups = no; then
108   AC_CHECK_LIB(os, initgroups)
111 AC_CHECK_FUNCS(syslog)
112 if test $ac_cv_func_syslog = no; then
113   # syslog is not in the default libraries.  See if it's in some other.
114   for lib in bsd socket inet; do
115     AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME])
116       LIBS="$LIBS -l$lib"; break])
117   done
120 AC_MSG_CHECKING(for 3-argument setpriority function)
121 AC_CACHE_VAL(utils_cv_func_setpriority,
122 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
123   #include <sys/resource.h>]], [[setpriority(0, 0, 0);]])],
124   [utils_cv_func_setpriority=yes],
125   [utils_cv_func_setpriority=no])])
126 AC_MSG_RESULT($utils_cv_func_setpriority)
127 if test $utils_cv_func_setpriority = yes; then
128   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
129   OPTIONAL_BIN_ZCRIPTS="$OPTIONAL_BIN_ZCRIPTS nohup"
130   MAN="$MAN nice.1 nohup.1"
131 else
132   AC_MSG_CHECKING(for nice function)
133   AC_CACHE_VAL(utils_cv_func_nice,
134     [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[nice();]])],
135                     [utils_cv_func_nice=yes],
136                     [utils_cv_func_nice=no])])
137   AC_MSG_RESULT($utils_cv_func_nice)
138   if test $utils_cv_func_nice = yes; then
139     AC_DEFINE(NICE_PRIORITY, 1, [FIXME])
140     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
141     OPTIONAL_BIN_ZCRIPTS="$OPTIONAL_BIN_ZCRIPTS nohup"
142     MAN="$MAN nice.1 nohup.1"
143   fi
146 AC_DEFUN(jm_DUMMY_1,
148   AC_REQUIRE([jm_PREREQ_READUTMP])
149   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
150     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS pinky\$(EXEEXT)"
151     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS users\$(EXEEXT)"
152     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS who\$(EXEEXT)"
153     MAN="$MAN pinky.1 users.1 who.1"
154   fi
156 jm_DUMMY_1
158 AC_MSG_CHECKING(ut_host in struct utmp)
159 AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
160 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
161 #include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],
162   [su_cv_func_ut_host_in_utmp=yes],
163   [su_cv_func_ut_host_in_utmp=no])])
164 AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
165 if test $su_cv_func_ut_host_in_utmp = yes; then
166   have_ut_host=1
167   AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
170 if test -z "$have_ut_host"; then
171   AC_MSG_CHECKING(ut_host in struct utmpx)
172   AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
173   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
174 #include <utmpx.h>]], [[struct utmpx ut; ut.ut_host;]])],
175     [su_cv_func_ut_host_in_utmpx=yes],
176     [su_cv_func_ut_host_in_utmpx=no])])
177   AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
178   if test $su_cv_func_ut_host_in_utmpx = yes; then
179     AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME])
180     AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
181   fi
184 GNULIB_BOOT_TIME(
185   [OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uptime\$(EXEEXT)"
186   MAN="$MAN uptime.1"])
188 AC_SYS_POSIX_TERMIOS()
189 jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
191 if test $ac_cv_sys_posix_termios = yes; then
192   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS stty\$(EXEEXT)" MAN="$MAN stty.1"
194   AC_MSG_CHECKING(whether termios.h needs _XOPEN_SOURCE)
195   AC_CACHE_VAL(su_cv_sys_termios_needs_xopen_source,
196   [AC_EGREP_CPP(yes, [#include <termios.h>
197 #ifdef IUCLC
199 #endif], su_cv_sys_termios_needs_xopen_source=no,
200    AC_EGREP_CPP(yes, [#define _XOPEN_SOURCE
201 #include <termios.h>
202 #ifdef IUCLC
204 #endif], su_cv_sys_termios_needs_xopen_source=yes,
205    su_cv_sys_termios_needs_xopen_source=no))])
206   AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source)
207   test $su_cv_sys_termios_needs_xopen_source = yes &&
208     AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME])
210   AC_MSG_CHECKING(c_line in struct termios)
211   AC_CACHE_VAL(su_cv_sys_c_line_in_termios,
212   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
213 #define _XOPEN_SOURCE
214 #endif
215 #include <sys/types.h>
216 #include <termios.h>]], [[struct termios t; t.c_line;]])],
217     [su_cv_sys_c_line_in_termios=yes],
218     [su_cv_sys_c_line_in_termios=no])])
219   AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
220   test $su_cv_sys_c_line_in_termios = yes \
221     && AC_DEFINE(HAVE_C_LINE, 1, [FIXME])
224 # FIXME: note that this macro appears above, too.
225 # I'm leaving it here for now.  This whole thing needs to be modernized...
226 jm_WINSIZE_IN_PTEM
228 jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H
230 if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no && \
231    test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
232   AC_MSG_CHECKING(TIOCGWINSZ in sys/pty.h)
233   AC_CACHE_VAL(su_cv_sys_tiocgwinsz_in_sys_pty_h,
234   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
235 #ifdef WINSIZE_IN_PTEM
236 # include <sys/stream.h>
237 # include <sys/ptem.h>
238 #endif
239 #include <sys/ioctl.h>
240 #include <sys/tty.h>
241 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
242     [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
243     [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
244   AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h)
246   test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
247       && AC_DEFINE(GWINSZ_IN_SYS_PTY, 1,
248                    [Define if your system defines TIOCGWINSZ in sys/pty.h.])
251 # For src/kill.c.
252 AC_CHECK_DECLS([strsignal, strtoimax, sys_siglist, _sys_siglist])
254 jm_LIB_CHECK
256 AM_GNU_GETTEXT([external], [need-ngettext])
257 AM_GNU_GETTEXT_VERSION(0.11.5)
259 AC_CONFIG_FILES(
260   Makefile
261   doc/Makefile
262   lib/Makefile
263   man/Makefile
264   m4/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/rm/Makefile
294   tests/rmdir/Makefile
295   tests/seq/Makefile
296   tests/sha1sum/Makefile
297   tests/shred/Makefile
298   tests/sort/Makefile
299   tests/stty/Makefile
300   tests/sum/Makefile
301   tests/tac/Makefile
302   tests/tail-2/Makefile
303   tests/tail/Makefile
304   tests/test/Makefile
305   tests/touch/Makefile
306   tests/tr/Makefile
307   tests/tsort/Makefile
308   tests/unexpand/Makefile
309   tests/uniq/Makefile
310   tests/wc/Makefile
311   )
312 AC_OUTPUT