.
[coreutils.git] / configure.ac
blob4e0c9b2a2767ba5979885b58c844fcb4854ed5e2
1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
2 AC_INIT([GNU coreutils],[5.1.0],[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])
8 AM_INIT_AUTOMAKE([1.8 gnits dist-bzip2])
10 gl_USE_SYSTEM_EXTENSIONS
11 jm_PERL
12 AC_PROG_CC
13 AC_PROG_CPP
14 AC_PROG_GCC_TRADITIONAL
15 AC_PROG_RANLIB
16 AC_PROG_LN_S
17 AC_CANONICAL_HOST
19 AC_CHECK_FUNCS(uname,
20         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uname\$(EXEEXT)"
21         MAN="$MAN uname.1")
22 AC_CHECK_FUNCS(chroot,
23         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS chroot\$(EXEEXT)"
24         MAN="$MAN chroot.1")
25 AC_CHECK_FUNCS(gethostid,
26         OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS hostid\$(EXEEXT)"
27         MAN="$MAN hostid.1")
29 jm_MACROS
31 AC_HEADER_TIOCGWINSZ()
32 jm_WINSIZE_IN_PTEM
34 AC_MSG_CHECKING(whether localtime caches TZ)
35 AC_CACHE_VAL(utils_cv_localtime_cache,
36 [if test x$ac_cv_func_tzset = xyes; then
37 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <time.h>
38 #if STDC_HEADERS
39 # include <stdlib.h>
40 #endif
41 extern char **environ;
42 unset_TZ ()
44   char **from, **to;
45   for (to = from = environ; (*to = *from); from++)
46     if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
47       to++;
49 main()
51   time_t now = time ((time_t *) 0);
52   int hour_GMT0, hour_unset;
53   if (putenv ("TZ=GMT0") != 0)
54     exit (1);
55   hour_GMT0 = localtime (&now)->tm_hour;
56   unset_TZ ();
57   hour_unset = localtime (&now)->tm_hour;
58   if (putenv ("TZ=PST8") != 0)
59     exit (1);
60   if (localtime (&now)->tm_hour == hour_GMT0)
61     exit (1);
62   unset_TZ ();
63   if (localtime (&now)->tm_hour != hour_unset)
64     exit (1);
65   exit (0);
66 }]])],
67 [utils_cv_localtime_cache=no],
68 [utils_cv_localtime_cache=yes],
69 [# If we have tzset, assume the worst when cross-compiling.
70 utils_cv_localtime_cache=yes])
71 else
72         # If we lack tzset, report that localtime does not cache TZ,
73         # since we can't invalidate the cache if we don't have tzset.
74         utils_cv_localtime_cache=no
75 fi])dnl
76 AC_MSG_RESULT($utils_cv_localtime_cache)
77 if test $utils_cv_localtime_cache = yes; then
78   AC_DEFINE(LOCALTIME_CACHE, 1, [FIXME])
81 # SCO-ODT-3.0 is reported to need -los to link programs using initgroups
82 AC_CHECK_FUNCS(initgroups)
83 if test $ac_cv_func_initgroups = no; then
84   AC_CHECK_LIB(os, initgroups)
87 AC_CHECK_FUNCS(syslog)
88 if test $ac_cv_func_syslog = no; then
89   # syslog is not in the default libraries.  See if it's in some other.
90   for lib in bsd socket inet; do
91     AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG, 1, [FIXME])
92       LIBS="$LIBS -l$lib"; break])
93   done
96 AC_MSG_CHECKING(for 3-argument setpriority function)
97 AC_CACHE_VAL(utils_cv_func_setpriority,
98 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
99   #include <sys/resource.h>]], [[setpriority(0, 0, 0);]])],
100   [utils_cv_func_setpriority=yes],
101   [utils_cv_func_setpriority=no])])
102 AC_MSG_RESULT($utils_cv_func_setpriority)
103 if test $utils_cv_func_setpriority = yes; then
104   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
105   MAN="$MAN nice.1"
106 else
107   AC_MSG_CHECKING(for nice function)
108   AC_CACHE_VAL(utils_cv_func_nice,
109     [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[nice();]])],
110                     [utils_cv_func_nice=yes],
111                     [utils_cv_func_nice=no])])
112   AC_MSG_RESULT($utils_cv_func_nice)
113   if test $utils_cv_func_nice = yes; then
114     AC_DEFINE(NICE_PRIORITY, 1, [FIXME])
115     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS nice\$(EXEEXT)"
116     MAN="$MAN nice.1"
117   fi
120 AC_DEFUN(jm_DUMMY_1,
122   AC_REQUIRE([gl_READUTMP])
123   if test $ac_cv_header_utmp_h = yes || test $ac_cv_header_utmpx_h = yes; then
124     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS pinky\$(EXEEXT)"
125     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS users\$(EXEEXT)"
126     OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS who\$(EXEEXT)"
127     MAN="$MAN pinky.1 users.1 who.1"
128   fi
130 jm_DUMMY_1
132 AC_MSG_CHECKING(ut_host in struct utmp)
133 AC_CACHE_VAL(su_cv_func_ut_host_in_utmp,
134 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
135 #include <utmp.h>]], [[struct utmp ut; ut.ut_host;]])],
136   [su_cv_func_ut_host_in_utmp=yes],
137   [su_cv_func_ut_host_in_utmp=no])])
138 AC_MSG_RESULT($su_cv_func_ut_host_in_utmp)
139 if test $su_cv_func_ut_host_in_utmp = yes; then
140   have_ut_host=1
141   AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
144 if test -z "$have_ut_host"; then
145   AC_MSG_CHECKING(ut_host in struct utmpx)
146   AC_CACHE_VAL(su_cv_func_ut_host_in_utmpx,
147   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
148 #include <utmpx.h>]], [[struct utmpx ut; ut.ut_host;]])],
149     [su_cv_func_ut_host_in_utmpx=yes],
150     [su_cv_func_ut_host_in_utmpx=no])])
151   AC_MSG_RESULT($su_cv_func_ut_host_in_utmpx)
152   if test $su_cv_func_ut_host_in_utmpx = yes; then
153     AC_DEFINE(HAVE_UTMPX_H, 1, [FIXME])
154     AC_DEFINE(HAVE_UT_HOST, 1, [FIXME])
155   fi
158 GNULIB_BOOT_TIME(
159   [OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uptime\$(EXEEXT)"
160   MAN="$MAN uptime.1"])
162 AC_SYS_POSIX_TERMIOS()
163 jm_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
165 if test $ac_cv_sys_posix_termios = yes; then
166   OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS stty\$(EXEEXT)" MAN="$MAN stty.1"
168   AC_MSG_CHECKING(whether termios.h needs _XOPEN_SOURCE)
169   AC_CACHE_VAL(su_cv_sys_termios_needs_xopen_source,
170   [AC_EGREP_CPP(yes, [#include <termios.h>
171 #ifdef IUCLC
173 #endif], su_cv_sys_termios_needs_xopen_source=no,
174    AC_EGREP_CPP(yes, [#define _XOPEN_SOURCE
175 #include <termios.h>
176 #ifdef IUCLC
178 #endif], su_cv_sys_termios_needs_xopen_source=yes,
179    su_cv_sys_termios_needs_xopen_source=no))])
180   AC_MSG_RESULT($su_cv_sys_termios_needs_xopen_source)
181   test $su_cv_sys_termios_needs_xopen_source = yes &&
182     AC_DEFINE(TERMIOS_NEEDS_XOPEN_SOURCE, 1, [FIXME])
184   AC_MSG_CHECKING(c_line in struct termios)
185   AC_CACHE_VAL(su_cv_sys_c_line_in_termios,
186   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if TERMIOS_NEEDS_XOPEN_SOURCE
187 #define _XOPEN_SOURCE
188 #endif
189 #include <sys/types.h>
190 #include <termios.h>]], [[struct termios t; t.c_line;]])],
191     [su_cv_sys_c_line_in_termios=yes],
192     [su_cv_sys_c_line_in_termios=no])])
193   AC_MSG_RESULT($su_cv_sys_c_line_in_termios)
194   test $su_cv_sys_c_line_in_termios = yes \
195     && AC_DEFINE(HAVE_C_LINE, 1, [FIXME])
198 # FIXME: note that this macro appears above, too.
199 # I'm leaving it here for now.  This whole thing needs to be modernized...
200 jm_WINSIZE_IN_PTEM
202 jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H
204 if test $jm_cv_sys_tiocgwinsz_needs_termios_h = no && \
205    test $jm_cv_sys_tiocgwinsz_needs_sys_ioctl_h = no; then
206   AC_MSG_CHECKING(TIOCGWINSZ in sys/pty.h)
207   AC_CACHE_VAL(su_cv_sys_tiocgwinsz_in_sys_pty_h,
208   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
209 #ifdef WINSIZE_IN_PTEM
210 # include <sys/stream.h>
211 # include <sys/ptem.h>
212 #endif
213 #include <sys/ioctl.h>
214 #include <sys/tty.h>
215 #include <sys/pty.h>]], [[int x = TIOCGWINSZ;]])],
216     [su_cv_sys_tiocgwinsz_in_sys_pty_h=yes],
217     [su_cv_sys_tiocgwinsz_in_sys_pty_h=no])])
218   AC_MSG_RESULT($su_cv_sys_tiocgwinsz_in_sys_pty_h)
220   test $su_cv_sys_tiocgwinsz_in_sys_pty_h = yes \
221       && AC_DEFINE(GWINSZ_IN_SYS_PTY, 1,
222                    [Define if your system defines TIOCGWINSZ in sys/pty.h.])
225 # For src/kill.c.
226 AC_CHECK_DECLS([strsignal, strtoimax, sys_siglist, _sys_siglist, __sys_siglist])
228 jm_LIB_CHECK
230 AM_GNU_GETTEXT([external], [need-ngettext])
231 AM_GNU_GETTEXT_VERSION(0.11.5)
233 AC_CONFIG_FILES(
234   Makefile
235   doc/Makefile
236   lib/Makefile
237   man/Makefile
238   m4/Makefile
239   po/Makefile.in
240   src/Makefile
241   tests/Makefile
242   tests/basename/Makefile
243   tests/chgrp/Makefile
244   tests/chmod/Makefile
245   tests/chown/Makefile
246   tests/cp/Makefile
247   tests/cut/Makefile
248   tests/date/Makefile
249   tests/dd/Makefile
250   tests/dircolors/Makefile
251   tests/du/Makefile
252   tests/expr/Makefile
253   tests/factor/Makefile
254   tests/fmt/Makefile
255   tests/head/Makefile
256   tests/install/Makefile
257   tests/join/Makefile
258   tests/ln/Makefile
259   tests/ls-2/Makefile
260   tests/ls/Makefile
261   tests/md5sum/Makefile
262   tests/misc/Makefile
263   tests/mkdir/Makefile
264   tests/mv/Makefile
265   tests/od/Makefile
266   tests/pr/Makefile
267   tests/rm/Makefile
268   tests/rmdir/Makefile
269   tests/seq/Makefile
270   tests/sha1sum/Makefile
271   tests/shred/Makefile
272   tests/sort/Makefile
273   tests/stty/Makefile
274   tests/sum/Makefile
275   tests/tac/Makefile
276   tests/tail-2/Makefile
277   tests/tail/Makefile
278   tests/test/Makefile
279   tests/touch/Makefile
280   tests/tr/Makefile
281   tests/tsort/Makefile
282   tests/unexpand/Makefile
283   tests/uniq/Makefile
284   tests/wc/Makefile
285   )
286 AC_OUTPUT