]> Dogcows Code - chaz/tar/blob - configure.ac
ew option --with-rmt. New configuration variable DEFAULT_RMT_DIR. Removed DEFAULT_RMT...
[chaz/tar] / configure.ac
1 # Configure template for GNU tar.
2
3 # Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
4 # 2002, 2003, 2004 Free Software Foundation, Inc.
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA.
20
21 AC_INIT([GNU tar], [1.14.90], [bug-tar@gnu.org])
22 AC_CONFIG_SRCDIR([src/tar.c])
23 AC_CONFIG_AUX_DIR([config])
24 AC_CONFIG_HEADERS([config.h:config.hin])
25 AC_PREREQ([2.59])
26 AM_INIT_AUTOMAKE([1.8 gnits dist-bzip2 dist-shar std-options])
27
28 gl_USE_SYSTEM_EXTENSIONS
29 AC_PROG_CC
30 AC_EXEEXT
31 AC_PROG_RANLIB
32 AC_PROG_YACC
33 AC_SYS_LARGEFILE
34 AC_ISC_POSIX
35 AC_C_INLINE
36
37 AC_CHECK_HEADERS(fcntl.h linux/fd.h memory.h net/errno.h \
38 sgtty.h string.h \
39 sys/param.h sys/device.h sys/gentape.h \
40 sys/inet.h sys/io/trioctl.h \
41 sys/mtio.h sys/time.h sys/tprintf.h sys/tape.h \
42 unistd.h)
43
44 AC_CHECK_HEADERS([sys/buf.h], [], [],
45 [#if HAVE_SYS_PARAM_H
46 #include <sys/param.h>
47 #endif])
48
49 AC_HEADER_SYS_WAIT
50 AM_STDBOOL_H
51
52 enable_rmt() {
53 if test $ac_cv_header_sys_mtio_h = yes; then
54 AC_CACHE_CHECK(for remote tape header files, tar_cv_header_rmt,
55 [AC_TRY_CPP([
56 #if HAVE_SGTTY_H
57 # include <sgtty.h>
58 #endif
59 #include <sys/socket.h>],
60 tar_cv_header_rmt=yes, tar_cv_header_rmt=no)])
61 test $tar_cv_header_rmt = yes && RMT='rmt'
62 AC_SUBST(RMT)
63 fi
64 }
65
66 AC_CACHE_CHECK(which ioctl field to test for reversed bytes,
67 tar_cv_header_mtio_check_field,
68 [AC_EGREP_HEADER(mt_model, sys/mtio.h,
69 tar_cv_header_mtio_check_field=mt_model,
70 tar_cv_header_mtio_check_field=mt_type)])
71 AC_DEFINE_UNQUOTED(MTIO_CHECK_FIELD, $tar_cv_header_mtio_check_field,
72 [Define to mt_model (v.g., for DG/UX), else to mt_type.])
73
74 AC_HEADER_DIRENT
75 AC_HEADER_MAJOR
76 AC_HEADER_STAT
77 AC_HEADER_STDC
78 AC_STRUCT_ST_BLKSIZE
79 AC_STRUCT_ST_BLOCKS
80 AC_MSG_CHECKING([for st_fstype string in struct stat])
81 AC_CACHE_VAL(diff_cv_st_fstype_string,
82 [AC_TRY_COMPILE([#include <sys/types.h>
83 #include <sys/stat.h>], [struct stat s; s.st_fstype[0] = 'x';],
84 diff_cv_st_fstype_string=yes,
85 diff_cv_st_fstype_string=no)])
86 AC_MSG_RESULT($diff_cv_st_fstype_string)
87 if test $diff_cv_st_fstype_string = yes; then
88 AC_DEFINE(HAVE_ST_FSTYPE_STRING, 1,
89 [Define if struct stat has a char st_fstype[] member.])
90 fi
91
92 AC_TYPE_SIGNAL
93 AC_TYPE_MODE_T
94 AC_TYPE_PID_T
95 AC_TYPE_OFF_T
96 AC_TYPE_SIZE_T
97 AC_TYPE_UID_T
98 AC_CHECK_TYPE(major_t, , AC_DEFINE(major_t, int,
99 [Type of major device numbers.]))
100 AC_CHECK_TYPE(minor_t, , AC_DEFINE(minor_t, int,
101 [Type of minor device numbers.]))
102 AC_CHECK_TYPE(dev_t, unsigned)
103 AC_CHECK_TYPE(ino_t, unsigned)
104
105 gt_TYPE_SSIZE_T
106 gl_AC_TYPE_INTMAX_T
107 jm_AC_TYPE_UINTMAX_T
108
109 # gnulib modules
110 tar_GNULIB
111
112
113 AC_CHECK_MEMBERS([struct stat.st_spare1, struct stat.st_atim.tv_nsec, struct stat.st_atimespec.tv_nsec, struct stat.st_atimensec], , ,
114 [
115 #include <sys/types.h>
116 #include <sys/stat.h>])
117
118 # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
119 # programs in the package would end up linked with that potentially-shared
120 # library, inducing unnecessary run-time overhead.
121
122 # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
123 # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
124 tar_save_LIBS=$LIBS
125 LIB_CLOCK_GETTIME=
126 AC_SEARCH_LIBS(clock_gettime, [rt posix4])
127 case "$ac_cv_search_clock_gettime" in
128 -l*) LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime;;
129 esac
130 AC_SUBST(LIB_CLOCK_GETTIME)
131 AC_CHECK_FUNCS(clock_gettime)
132 LIBS=$tar_save_LIBS
133
134 AC_CHECK_FUNCS(fsync lstat mkfifo readlink strerror symlink setlocale utimes)
135 AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
136 AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
137 AC_CHECK_DECLS([time],,, [#include <time.h>])
138
139 # Set LIB_SETSOCKOPT to -lnsl -lsocket if necessary.
140 tar_save_LIBS=$LIBS
141 LIB_SETSOCKOPT=
142 AC_SEARCH_LIBS(setsockopt, [socket], ,
143 [AC_SEARCH_LIBS(setsockopt, [socket], , , [-lnsl])])
144 AC_SEARCH_LIBS(setsockopt, [nsl])
145
146 case "$ac_cv_search_setsockopt" in
147 -l*) LIB_SETSOCKOPT=$ac_cv_search_setsockopt
148 esac
149 AC_SUBST(LIB_SETSOCKOPT)
150 LIBS=$tar_save_LIBS
151
152 AC_REPLACE_FUNCS(waitpid)
153
154 AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH,
155 [if test -n "$RSH"; then
156 tar_cv_path_RSH=$RSH
157 else
158 tar_cv_path_RSH=no
159 for ac_file in /usr/ucb/rsh /usr/bin/remsh /usr/bin/rsh /usr/bsd/rsh \
160 /usr/bin/nsh /usr/bin/rcmd
161 do
162 # Prefer a non-symlink rsh to a symlink one, so that binaries built
163 # on AIX 4.1.4, where /usr/ucb/rsh is a symlink to /usr/bin/rsh
164 # will run on AIX 4.3.0, which has only /usr/bin/rsh.
165 if test -f $ac_file; then
166 if (test -h $ac_file) 2>/dev/null; then
167 test $tar_cv_path_RSH = no && tar_cv_path_RSH=$ac_file
168 else
169 tar_cv_path_RSH=$ac_file
170 break
171 fi
172 fi
173 done
174 fi])
175 if test $tar_cv_path_RSH = no; then
176 AC_CHECK_HEADERS(netdb.h)
177 else
178 AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$tar_cv_path_RSH",
179 [Define to the full path of your rsh, if any.])
180 fi
181
182 AC_MSG_CHECKING(for default archive format)
183
184 AC_ARG_VAR([DEFAULT_ARCHIVE_FORMAT],
185 [Set the default archive format. Allowed values are: V7, OLDGNU, USTAR, POSIX, GNU. Default is GNU])
186
187 if test -z "$DEFAULT_ARCHIVE_FORMAT"; then
188 DEFAULT_ARCHIVE_FORMAT="GNU"
189 fi
190 case $DEFAULT_ARCHIVE_FORMAT in
191 V7|OLDGNU|USTAR|POSIX|GNU) ;;
192 *) AC_MSG_ERROR(Invalid format name);;
193 esac
194 AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE_FORMAT, ${DEFAULT_ARCHIVE_FORMAT}_FORMAT,
195 [By default produce archives of this format])
196 AC_MSG_RESULT($DEFAULT_ARCHIVE_FORMAT)
197
198 AC_MSG_CHECKING(for default archive)
199
200 AC_ARG_VAR([DEFAULT_ARCHIVE],
201 [Set the name of the default archive (default: -)])
202 if test -z "$DEFAULT_ARCHIVE"; then
203 DEFAULT_ARCHIVE=-
204 else
205 if test -z "`ls $DEFAULT_ARCHIVE 2>/dev/null`"; then
206 AC_MSG_WARN(DEFAULT_ARCHIVE \`$DEFAULT_ARCHIVE' not found on this system)
207 fi
208 # FIXME: Look for DEFTAPE in <sys/mtio.h>.
209 # FIXME: Let DEVICE_PREFIX be configured from the environment.
210 # FIXME: Rearrange, here.
211 case $DEFAULT_ARCHIVE in
212 *[[0-7][lmh]])
213 AC_DEFINE(DENSITY_LETTER, 1,
214 [[Define to 1 if density may be indicated by [lmh] at end of device.]])
215 device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7][lmh]$//'`
216 ;;
217 *[[0-7]])
218 device_prefix=`echo $DEFAULT_ARCHIVE | sed 's/[0-7]$//'`
219 ;;
220 *)
221 device_prefix=
222 ;;
223 esac
224 case "$device_prefix" in
225 ?*)
226 AC_DEFINE_UNQUOTED(DEVICE_PREFIX, "$device_prefix",
227 [Define to a string giving the prefix of the default device, without the part specifying the unit and density.])
228 ;;
229 esac
230 fi
231 AC_DEFINE_UNQUOTED(DEFAULT_ARCHIVE, "$DEFAULT_ARCHIVE",
232 [Define to a string giving the full name of the default archive file.])
233 AC_MSG_RESULT($DEFAULT_ARCHIVE)
234
235 AC_ARG_VAR([DEFAULT_BLOCKING],
236 [Define default blocking factor (default: 20)])
237 AC_MSG_CHECKING(for default blocking)
238 DEFAULT_BLOCKING=${DEFAULT_BLOCKING-20}
239 AC_DEFINE_UNQUOTED(DEFAULT_BLOCKING, $DEFAULT_BLOCKING,
240 [Define to a number giving the default blocking size for archives.])
241 AC_MSG_RESULT($DEFAULT_BLOCKING)
242
243 AC_ARG_VAR([DEFAULT_RMT_DIR],
244 [Define full file name of the directory where to install `rmt'. (default: $(libexecdir))])
245 if test "x$DEFAULT_RMT_DIR" != x; then
246 DEFAULT_RMT_COMMAND=$DEFAULT_RMT_DIR/rmt
247 else
248 DEFAULT_RMT_DIR='$(libexecdir)'
249 fi
250
251 AC_MSG_CHECKING([whether to build rmt])
252 AC_ARG_WITH([rmt],
253 AC_HELP_STRING([--with-rmt=FILE],
254 [Use FILE as the default `rmt' program. Do not build included copy of `rmt'.]),
255 [case $withval in
256 yes|no) AC_MSG_ERROR([Invalid argument to --with-rmt]);;
257 /*) DEFAULT_RMT_COMMAND=$withval
258 AC_MSG_RESULT([no, use $withval instead]);;
259 *) AC_MSG_ERROR([Argument to --with-rmt must be an absolute file name]);;
260 esac],
261 [AC_MSG_RESULT([yes])
262 enable_rmt
263 if test "$RMT" = ""; then
264 AC_MSG_WARN([not building rmt, required header files are missing])
265 fi])
266
267 AC_SUBST(DEFAULT_RMT_COMMAND)
268 if test "x$DEFAULT_RMT_COMMAND" != x; then
269 AC_DEFINE_UNQUOTED(DEFAULT_RMT_COMMAND, "$DEFAULT_RMT_COMMAND",
270 [Define full file name of rmt program.])
271 fi
272
273
274 # Gettext.
275 AM_GNU_GETTEXT([external], [need-ngettext])
276 AM_GNU_GETTEXT_VERSION(0.12.1)
277
278 # Iconv
279 AM_ICONV
280 AC_CHECK_HEADERS(iconv.h)
281 AC_CHECK_TYPE(iconv_t,:,
282 AC_DEFINE(iconv_t, int,
283 [Conversion descriptor type]),
284 [
285 #ifdef HAVE_ICONV_H
286 # include <iconv.h>
287 #endif
288 ])
289
290 AC_SUBST(BACKUP_LIBEXEC_SCRIPTS)
291 AC_SUBST(BACKUP_SBIN_SCRIPTS)
292 AC_ARG_ENABLE(backup-scripts,
293 AC_HELP_STRING([--enable-backup-scripts],
294 [Create and install backup and restore scripts]),
295 [case $enableval in
296 yes) BACKUP_LIBEXEC_SCRIPTS='$(BACKUP_LIBEXEC_SCRIPTS_LIST)'
297 BACKUP_SBIN_SCRIPTS='$(BACKUP_SBIN_SCRIPTS_LIST)'
298 ;;
299 esac])
300
301 AC_SUBST(BACKUP_SED_COND)
302 if date +%Y-%m-%d 2>/dev/null >&2; then
303 BACKUP_SED_COND='/^\#ELSE_DATE_FORMAT_OK/,/^\#ENDIF_DATE_FORMAT_OK/d;/^\#IF_DATE_FORMAT_OK/d'
304 else
305 BACKUP_SED_COND='/^\#IF_DATE_FORMAT_OK/,/^\#ELSE_DATE_FORMAT_OK/d;/^\#ENDIF_DATE_FORMAT_OK/d'
306 fi
307
308
309 AC_OUTPUT([Makefile\
310 doc/Makefile\
311 lib/Makefile\
312 po/Makefile.in\
313 scripts/Makefile\
314 src/Makefile\
315 tests/Makefile\
316 tests/preset])
This page took 0.051717 seconds and 5 git commands to generate.