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