From d0dc3f5c30ca0b8350b48ba032a65681bfa20bdb Mon Sep 17 00:00:00 2001 From: Lorry Date: Wed, 15 Aug 2012 09:31:11 +0100 Subject: Tarball conversion --- README | 165 ++ autoconf/Makefile.in | 14 + autoconf/configure.in | 181 ++ autoconf/header.in | 82 + autoconf/make/depend.mk~ | 18 + autoconf/make/filelist.mk~ | 53 + autoconf/make/link.mk | 11 + autoconf/make/modules.mk~ | 14 + autoconf/make/package.mk | 17 + autoconf/make/rules.mk | 43 + autoconf/make/unreal.mk | 213 ++ autoconf/make/vars.mk | 47 + autoconf/scripts/benchmark.sh | 39 + autoconf/scripts/depend.sh | 30 + autoconf/scripts/index.sh | 171 ++ autoconf/scripts/install.sh | 250 ++ autoconf/scripts/makemake.sh | 113 + autoconf/scripts/mkinstalldirs | 33 + autoconf/scripts/po2table.sh | 65 + autoconf/scripts/run-test.sh | 48 + configure | 5855 ++++++++++++++++++++++++++++++++++++++++ doc/COPYING | 171 ++ doc/INSTALL | 183 ++ doc/NEWS | 207 ++ doc/PACKAGE | 1 + doc/TODO | 23 + doc/VERSION | 1 + doc/lsm | 19 + doc/lsm.in | 19 + doc/pv.spec | 152 ++ doc/quickref.1.in | 459 ++++ doc/release-checklist | 22 + doc/spec.in | 152 ++ src/include/library/getopt.h | 38 + src/include/library/gettext.h | 53 + src/include/options.h | 56 + src/include/pv.h | 52 + src/library/getopt.c | 115 + src/library/gettext.c | 111 + src/main/help.c | 179 ++ src/main/main.c | 164 ++ src/main/options.c | 272 ++ src/main/remote.c | 208 ++ src/main/version.c | 37 + src/nls/de.po | 282 ++ src/nls/fr.po | 283 ++ src/nls/pl.po | 320 +++ src/nls/pt.po | 276 ++ src/nls/pv.pot | 271 ++ src/pv/cursor.c | 515 ++++ src/pv/display.c | 635 +++++ src/pv/file.c | 250 ++ src/pv/loop.c | 287 ++ src/pv/number.c | 206 ++ src/pv/signal.c | 290 ++ src/pv/transfer.c | 341 +++ tests/000-cat | 8 + tests/001-interval | 12 + tests/002-rate | 13 + tests/003-progress | 13 + tests/004-timer | 14 + tests/005-eta | 20 + tests/006-ratecount | 22 + tests/007-bytes | 10 + tests/008-numeric | 18 + tests/009-quiet | 9 + tests/010-pipe | 26 + tests/011-cksum | 26 + tests/012-averagerate | 24 + tests/013-1mboundary | 25 + tests/014-1mboundary2 | 25 + tests/015-cksumpipe | 53 + 72 files changed, 14430 insertions(+) create mode 100644 README create mode 100644 autoconf/Makefile.in create mode 100644 autoconf/configure.in create mode 100644 autoconf/header.in create mode 100644 autoconf/make/depend.mk~ create mode 100644 autoconf/make/filelist.mk~ create mode 100644 autoconf/make/link.mk create mode 100644 autoconf/make/modules.mk~ create mode 100644 autoconf/make/package.mk create mode 100644 autoconf/make/rules.mk create mode 100644 autoconf/make/unreal.mk create mode 100644 autoconf/make/vars.mk create mode 100755 autoconf/scripts/benchmark.sh create mode 100755 autoconf/scripts/depend.sh create mode 100755 autoconf/scripts/index.sh create mode 100755 autoconf/scripts/install.sh create mode 100755 autoconf/scripts/makemake.sh create mode 100755 autoconf/scripts/mkinstalldirs create mode 100755 autoconf/scripts/po2table.sh create mode 100755 autoconf/scripts/run-test.sh create mode 100755 configure create mode 100644 doc/COPYING create mode 100644 doc/INSTALL create mode 100644 doc/NEWS create mode 100644 doc/PACKAGE create mode 100644 doc/TODO create mode 100644 doc/VERSION create mode 100644 doc/lsm create mode 100644 doc/lsm.in create mode 100644 doc/pv.spec create mode 100644 doc/quickref.1.in create mode 100644 doc/release-checklist create mode 100644 doc/spec.in create mode 100644 src/include/library/getopt.h create mode 100644 src/include/library/gettext.h create mode 100644 src/include/options.h create mode 100644 src/include/pv.h create mode 100644 src/library/getopt.c create mode 100644 src/library/gettext.c create mode 100644 src/main/help.c create mode 100644 src/main/main.c create mode 100644 src/main/options.c create mode 100644 src/main/remote.c create mode 100644 src/main/version.c create mode 100644 src/nls/de.po create mode 100644 src/nls/fr.po create mode 100644 src/nls/pl.po create mode 100644 src/nls/pt.po create mode 100644 src/nls/pv.pot create mode 100644 src/pv/cursor.c create mode 100644 src/pv/display.c create mode 100644 src/pv/file.c create mode 100644 src/pv/loop.c create mode 100644 src/pv/number.c create mode 100644 src/pv/signal.c create mode 100644 src/pv/transfer.c create mode 100644 tests/000-cat create mode 100644 tests/001-interval create mode 100644 tests/002-rate create mode 100644 tests/003-progress create mode 100644 tests/004-timer create mode 100644 tests/005-eta create mode 100644 tests/006-ratecount create mode 100644 tests/007-bytes create mode 100644 tests/008-numeric create mode 100644 tests/009-quiet create mode 100644 tests/010-pipe create mode 100644 tests/011-cksum create mode 100644 tests/012-averagerate create mode 100644 tests/013-1mboundary create mode 100644 tests/014-1mboundary2 create mode 100644 tests/015-cksumpipe diff --git a/README b/README new file mode 100644 index 0000000..ddc234c --- /dev/null +++ b/README @@ -0,0 +1,165 @@ +Introduction +************ + +This is the README for `pv' ("Pipe Viewer"), a terminal-based tool for +monitoring the progress of data through a pipeline. It can be inserted into +any normal pipeline between two processes to give a visual indication of how +quickly data is passing through, how long it has taken, how near to +completion it is, and an estimate of how long it will be until completion. + + +Documentation +************* + +A manual page is included in this distribution. See `man ./doc/quickref.1', +or `man pv' after installation. + + +Compilation +*********** + +If you have downloaded `pv' from Subversion, first run "./generate.sh". + +To compile the package, type "sh ./configure", which should generate a +Makefile for your system. You may then type "make" to build everything. +Note that GNU `make' is required; this may be installed as `gmake' on some +systems, so if typing "make" gives an error, try "gmake" instead. + +See the file `doc/INSTALL' for more about the `configure' script. + +Developers note that you can do "./configure --enable-debugging" to cause +debugging support to be built in, and "--enable-profiling" builds in +profiling support (see "man gprof"). Also note that doing "make index" will +generate an HTML code index (using "ctags" and "cproto"); this index lists +all files used, all functions defined, and all TODOs marked in the code. + +Developers also note that the /* RATS */ comments are used to tell the RATS +tool that a potential trouble spot has been checked so it doesn't need to +warn about it. (RATS: Rough Auditing Tool for Security - home page +http://www.fortifysoftware.com/security-resources/rats.jsp) + + +Author +****** + +This package is copyright (C) 2012 Andrew Wood, and is being distributed +under the terms of the Artistic License 2.0. For more details, see the +file `doc/COPYING'. + +You can contact me by email at andrew.wood@ivarch.com or by using the +contact form on my web page at http://www.ivarch.com/. + +The `pv' home page is at: + + http://www.ivarch.com/programs/pv.shtml + +The latest version can always be found here. + +Credit is also due to: + + Kevin Coyner + - Debian package maintainer + + Jakub Hrozek + - Fedora package maintainer + + Cédric Delfosse + - previous Debian package maintainer + + Eduardo Aguiar + - provided Portuguese (Brazilian) translation + + Stéphane Lacasse + - provided French translation + + Marcos Kreinacke + - provided German translation + + Bartosz Feñski + - provided Polish translation along with Krystian Zubel + + Joshua Jensen + - reported RPM installation bug + + Boris Folgmann + - reported cursor handling bug + + Mathias Gumz + - reported NLS bug + + Daniel Roethlisberger + - submitted patch to use lockfiles for -c if terminal locking fails + + Adam Buchbinder + - lots of help with a Cygwin port of -c + + Mark Tomich + - suggested -B option + + Gert Menke + - reported bug when piping to dd with a large input buffer size + + Ville Herva + - informative bug report about rate limiting performance + + Elias Pipping + - patch to compile properly on Darwin 9; potential NULL deref report + + Patrick Collison + - similar patch for OS X + + Boris Lohner + - reported problem that "-L" does not complain if given non-numeric value + + Sebastian Kayser + - supplied testing for SIGPIPE, demonstrated internationalisation problem + + Laszlo Ersek + - reported shared memory leak on SIGINT with -c + + Phil Rutschman + - provided a patch for fully restoring terminal state on exit + + Henry Precheur + - reporting and suggestions for --rate-limit bug when rate is under 10 + + E. Rosten + - supplied patch for block buffering in line mode + + Kjetil Torgrim Homme + - reported compilation error with default CFLAGS on non-GCC compilers + + Alexandre de Verteuil + - reported bug in OS X build and supplied test environment to fix in + + Martin Baum + - supplied patch to return nonzero exit status if terminated by signal + + Sam Nelson + - supplied patch to fix trailing slash on DESTDIR + + Daniel Pape + - reported Cygwin installation problem due to DESTDIR + + Philipp Beckers + - ported to the Syabas PopcornHour A-100 series + + Henry Gebhard + - supplied patches to improve SI prefixes and add --average-rate + + Vladimir Kokarev, Alexander Leo + - reported that exit status did not reflect file errors + + Thomas Rachel + - submitted patches for IEEE1541 (MiB suffixes), 1+e03 bug + + Guillaume Marcais + - submitted speedup patch for line mode + + Moritz Barsnick + - submitted patch for compile warning in size calculation + + Pawel Piatek + - submitted RPM and patches for AIX + +----------------------------------------------------------------------------- diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in new file mode 100644 index 0000000..aee4384 --- /dev/null +++ b/autoconf/Makefile.in @@ -0,0 +1,14 @@ +# +# Files from which this is generated (inside directory `autoconf/make'): +# +# package.mk # package name and distribution details +# vars.mk # compilation, shell and linking variables +# filelist.mk~ # lists of files +# unreal.mk # phony targets +# modules.mk~ # module linking rules +# rules.mk # compilation rules +# link.mk # real top-level targets +# depend.mk~ # dependencies +# +# + diff --git a/autoconf/configure.in b/autoconf/configure.in new file mode 100644 index 0000000..b82ff6a --- /dev/null +++ b/autoconf/configure.in @@ -0,0 +1,181 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(src/main/version.c) + +dnl We're using C. +dnl +AC_LANG_C + +dnl Output a header file. +dnl +AC_CONFIG_HEADER(src/include/config.h:autoconf/header.in) + +dnl Set directory to check for Configure scripts in. +dnl +AC_CONFIG_AUX_DIR(autoconf/scripts) + +dnl Read in package details. +dnl +PACKAGE=`cat $srcdir/doc/PACKAGE` +VERSION=`cat $srcdir/doc/VERSION` +UCPACKAGE=`tr a-z A-Z < $srcdir/doc/PACKAGE` +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) +AC_SUBST(UCPACKAGE) +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") +AC_DEFINE_UNQUOTED(PROGRAM_NAME, "$PACKAGE") +AC_DEFINE_UNQUOTED(VERSION, "$VERSION") + +dnl Check for compile-time options. +dnl +AC_ARG_ENABLE(debugging, + [ --enable-debugging compile with debugging symbols], + if test "$enable_debugging" = "yes"; then + CFLAGS="-g -Wall" + fi +) +AC_ARG_ENABLE(profiling, + [ --enable-profiling compile with profiling support], + if test "$enable_profiling" = "yes"; then + CFLAGS="-pg $CFLAGS" + fi +) +LFS_SUPPORT="no" +AC_ARG_ENABLE(lfs, [ --disable-lfs disable LFS support], + if test "$enable_lfs" = "yes"; then + LFS_SUPPORT="yes" + fi, + LFS_SUPPORT="yes" +) +STATIC_NLS="no" +AC_ARG_ENABLE(static-nls, [ --enable-static-nls hardcode NLS with no support files], + if test "$enable_static_nls" = "yes"; then + STATIC_NLS="yes" + fi, + STATIC_NLS="no" +) +NLS_SUPPORT="no" +AC_ARG_ENABLE(nls, [ --disable-nls do not use Native Language Support], + if test "$enable_nls" = "yes"; then + NLS_SUPPORT="yes" + fi, + NLS_SUPPORT="yes" +) +SPLICE_SUPPORT="no" +AC_ARG_ENABLE(splice, [ --disable-splice do not use splice system call], + if test "$enable_splice" = "yes"; then + SPLICE_SUPPORT="yes" + fi, + SPLICE_SUPPORT="yes" +) + +dnl Check for various programs. +dnl +CFLAGS=${CFLAGS:-"-O"} +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_CHECK_PROG(DO_GZIP, gzip, gzip -f9, touch) + +dnl NLS stuff. +dnl +ALL_LINGUAS="de fr pl pt" +if test "$NLS_SUPPORT" = "yes"; then + AC_DEFINE(ENABLE_NLS) + AC_PATH_PROG(MSGFMT, msgfmt, NOMSGFMT) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AC_PATH_PROG(XGETTEXT, xgettext, xgettext) + if test "x$MSGFMT" = "xNOMSGFMT"; then + MSGFMT="" + STATIC_NLS="yes" + fi + if test "$STATIC_NLS" = "yes"; then + CATALOGS="" + NLSOBJ="src/nls/table.o" + else + AC_CHECK_LIB(intl, main) + AC_CHECK_LIB(i, main) + fi + CATOBJEXT=.mo + INSTOBJEXT=.mo + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES \$(srcdir)/src/nls/$lang.po" + CATALOGS="$CATALOGS src/nls/$lang$CATOBJEXT"; + done + if test "$STATIC_NLS" = "yes"; then + CATALOGS="" + else + AC_CHECK_FUNC(gettext, + [AC_DEFINE(HAVE_GETTEXT) + NLSOBJ="" + ], [CATALOGS=""; NLSOBJ="src/nls/table.o" + ] + ) + fi +fi +AC_CHECK_HEADERS(libintl.h) +AC_CHECK_HEADERS(locale.h) +AC_SUBST(MSGFMT) +AC_SUBST(GMSGFMT) +AC_SUBST(XGETTEXT) +AC_SUBST(CATOBJEXT) +AC_SUBST(INSTOBJEXT) +AC_SUBST(GMOFILES) +AC_SUBST(POFILES) +AC_SUBST(CATALOGS) +AC_SUBST(NLSOBJ) + +dnl Getopt checks. +dnl +AC_CHECK_FUNCS(getopt_long getopt) +AC_CHECK_HEADERS(getopt.h) + +dnl LFS checks. +dnl +if test "$LFS_SUPPORT" = "yes"; then + AC_CHECK_FUNCS(open64, AC_DEFINE(ENABLE_LARGEFILE)) +fi + +dnl Check for various header files and set various other macros. +dnl +AC_DEFINE(HAVE_CONFIG_H) +AC_HEADER_STDC +AC_CHECK_FUNCS(memcpy basename snprintf stat64) +AC_CHECK_HEADERS(limits.h sys/ipc.h sys/param.h libgen.h) + +if test "$SPLICE_SUPPORT" = "yes"; then + AC_CHECK_FUNCS(splice) +fi + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +AC_SUBST(INSTALL_DATA) + +dnl Fudging for separate build directories. +dnl +subdirs="" +for i in `find $srcdir/src -type d -print | sed s,$srcdir/,,`; do + subdirs="$subdirs $i" +done + +dnl Stitch together the Makefile fragments. +dnl +mk_segments="autoconf/Makefile.in" +for i in vars.mk package.mk filelist.mk~ unreal.mk modules.mk~ \ + rules.mk link.mk depend.mk~; do + mk_segments="$mk_segments:autoconf/make/$i" +done + +dnl Output files (and create build directory structure too). +dnl +AC_OUTPUT(Makefile:$mk_segments doc/lsm:doc/lsm.in + doc/quickref.1:doc/quickref.1.in + doc/$PACKAGE.spec:doc/spec.in + src/.dummy:doc/NEWS, + rm -f src/.dummy + for i in $subdirs; do + test -d $i || mkdir $i + done +, subdirs="$subdirs") + +dnl EOF diff --git a/autoconf/header.in b/autoconf/header.in new file mode 100644 index 0000000..6aad148 --- /dev/null +++ b/autoconf/header.in @@ -0,0 +1,82 @@ +/*!NOINDEX*/ +/* Define if you have standard C headers. */ +#undef STDC_HEADERS + +/* Define if you have "config.h" (yes, you have). */ +#undef HAVE_CONFIG_H + +/* Various other header files. */ +#undef HAVE_GETOPT_H +#undef HAVE_LIMITS_H +#undef HAVE_SYS_IPC_H +#undef HAVE_SYS_PARAM_H +#undef HAVE_LIBGEN_H + +/* Functions. */ +#undef HAVE_GETOPT +#undef HAVE_GETOPT_LONG +#undef HAVE_MEMCPY +#undef HAVE_BASENAME +#undef HAVE_SNPRINTF +#undef HAVE_STAT64 + +/* NLS stuff. */ +#undef ENABLE_NLS +#undef HAVE_LIBINTL_H +#undef HAVE_LOCALE_H +#undef HAVE_GETTEXT +#ifdef ENABLE_NLS +# include "library/gettext.h" +#else +# define _(String) (String) +# define N_(String) (String) +#endif + +#undef HAVE_SPLICE + +/* The name of the program. */ +#define PROGRAM_NAME "progname" + +/* The name of the package. */ +#define PACKAGE "" + +/* The current package version. */ +#define VERSION "0.0.0" + +/* Various identification and legal stuff. */ +#define COPYRIGHT_YEAR _("2012") +#define COPYRIGHT_HOLDER _("Andrew Wood ") +#define PROJECT_HOMEPAGE "http://www.ivarch.com/programs/" PROGRAM_NAME ".shtml" +#define BUG_REPORTS_TO _("Andrew Wood ") + +/* LFS support. */ +#undef ENABLE_LARGEFILE +#ifdef ENABLE_LARGEFILE +# define __USE_LARGEFILE64 1 +# define _LARGEFILE64_SOURCE 1 +#else +/* + * Some Macs have stat64 despite not having open64 while others don't have + * either, so here even if we don't have open64 or LFS is disabled, we have + * to check whether stat64 exists and only redefine it if it doesn't + * otherwise some Macs fail to compile. + */ +# ifdef __APPLE__ +# ifndef HAVE_STAT64 +# define stat64 stat +# define fstat64 fstat +# endif +# else +# define stat64 stat +# define fstat64 fstat +# endif +# define open64 open +# define lseek64 lseek +#endif + +#undef HAVE_IPC +#ifdef HAVE_SYS_IPC_H +#define HAVE_IPC 1 +#endif + +/* EOF */ diff --git a/autoconf/make/depend.mk~ b/autoconf/make/depend.mk~ new file mode 100644 index 0000000..d20ff3e --- /dev/null +++ b/autoconf/make/depend.mk~ @@ -0,0 +1,18 @@ +# +# Dependencies. +# + +src/pv/number.d src/pv/number.o: src/pv/number.c src/include/config.h src/include/library/gettext.h +src/pv/file.d src/pv/file.o: src/pv/file.c src/include/options.h src/include/config.h src/include/library/gettext.h +src/pv/display.d src/pv/display.o: src/pv/display.c src/include/config.h src/include/library/gettext.h src/include/options.h src/include/pv.h +src/pv/signal.d src/pv/signal.o: src/pv/signal.c src/include/pv.h src/include/config.h src/include/library/gettext.h +src/pv/loop.d src/pv/loop.o: src/pv/loop.c src/include/options.h src/include/pv.h src/include/config.h src/include/library/gettext.h +src/pv/cursor.d src/pv/cursor.o: src/pv/cursor.c src/include/options.h src/include/pv.h src/include/config.h src/include/library/gettext.h +src/pv/transfer.d src/pv/transfer.o: src/pv/transfer.c src/include/options.h src/include/config.h src/include/library/gettext.h +src/main/help.d src/main/help.o: src/main/help.c src/include/config.h src/include/library/gettext.h +src/main/options.d src/main/options.o: src/main/options.c src/include/config.h src/include/library/gettext.h src/include/options.h src/include/library/getopt.h src/include/pv.h +src/main/main.d src/main/main.o: src/main/main.c src/include/config.h src/include/library/gettext.h src/include/options.h src/include/pv.h +src/main/remote.d src/main/remote.o: src/main/remote.c src/include/config.h src/include/library/gettext.h src/include/options.h src/include/pv.h +src/main/version.d src/main/version.o: src/main/version.c src/include/config.h src/include/library/gettext.h +src/library/getopt.d src/library/getopt.o: src/library/getopt.c src/include/config.h src/include/library/gettext.h +src/library/gettext.d src/library/gettext.o: src/library/gettext.c src/include/config.h src/include/library/gettext.h diff --git a/autoconf/make/filelist.mk~ b/autoconf/make/filelist.mk~ new file mode 100644 index 0000000..d0e0d11 --- /dev/null +++ b/autoconf/make/filelist.mk~ @@ -0,0 +1,53 @@ +# Automatically generated file listings +# +# Creation time: Wed Jun 27 11:40:36 BST 2012 + +allsrc = src/pv/number.c \ +src/pv/file.c \ +src/pv/display.c \ +src/pv/signal.c \ +src/pv/loop.c \ +src/pv/cursor.c \ +src/pv/transfer.c \ +src/main/help.c \ +src/main/options.c \ +src/main/main.c \ +src/main/remote.c \ +src/main/version.c \ +src/library/getopt.c \ +src/library/gettext.c + +allobj = src/pv/number.o \ +src/pv/file.o \ +src/pv/display.o \ +src/pv/signal.o \ +src/pv/loop.o \ +src/pv/cursor.o \ +src/pv/transfer.o \ +src/main/help.o \ +src/main/options.o \ +src/main/main.o \ +src/main/remote.o \ +src/main/version.o \ +src/library/getopt.o \ +src/library/gettext.o \ +src/pv.o \ +src/nls.o \ +src/main.o \ +src/library.o + +alldep = src/pv/number.d \ +src/pv/file.d \ +src/pv/display.d \ +src/pv/signal.d \ +src/pv/loop.d \ +src/pv/cursor.d \ +src/pv/transfer.d \ +src/main/help.d \ +src/main/options.d \ +src/main/main.d \ +src/main/remote.d \ +src/main/version.d \ +src/library/getopt.d \ +src/library/gettext.d + diff --git a/autoconf/make/link.mk b/autoconf/make/link.mk new file mode 100644 index 0000000..9f861cd --- /dev/null +++ b/autoconf/make/link.mk @@ -0,0 +1,11 @@ +# +# Targets. +# + +$(package): src/main.o src/library.o src/pv.o @NLSOBJ@ + $(CC) $(LINKFLAGS) $(CFLAGS) -o $@ src/main.o src/library.o src/pv.o @NLSOBJ@ $(LIBS) + +$(package)-static: src/main.o src/library.o src/pv.o @NLSOBJ@ + $(CC) $(LINKFLAGS) $(CFLAGS) -static -o $@ src/main.o src/library.o src/pv.o @NLSOBJ@ $(LIBS) + +# EOF diff --git a/autoconf/make/modules.mk~ b/autoconf/make/modules.mk~ new file mode 100644 index 0000000..951772e --- /dev/null +++ b/autoconf/make/modules.mk~ @@ -0,0 +1,14 @@ +# Automatically generated module linking rules +# +# Creation time: Wed Jun 27 11:40:36 BST 2012 + +src/pv.o: src/pv/cursor.o src/pv/display.o src/pv/file.o src/pv/loop.o src/pv/number.o src/pv/signal.o src/pv/transfer.o + $(LD) $(LDFLAGS) -o $@ src/pv/cursor.o src/pv/display.o src/pv/file.o src/pv/loop.o src/pv/number.o src/pv/signal.o src/pv/transfer.o + +src/main.o: src/main/help.o src/main/main.o src/main/options.o src/main/remote.o src/main/version.o + $(LD) $(LDFLAGS) -o $@ src/main/help.o src/main/main.o src/main/options.o src/main/remote.o src/main/version.o + +src/library.o: src/library/getopt.o src/library/gettext.o + $(LD) $(LDFLAGS) -o $@ src/library/getopt.o src/library/gettext.o + + diff --git a/autoconf/make/package.mk b/autoconf/make/package.mk new file mode 100644 index 0000000..82036de --- /dev/null +++ b/autoconf/make/package.mk @@ -0,0 +1,17 @@ +# +# Package name, version, and distribution files. +# + +package = @PACKAGE@ +version = @VERSION@ +PACKAGE = @PACKAGE@ + +distfiles = \ +$(srcdir)/README \ +$(srcdir)/autoconf \ +$(srcdir)/configure \ +$(srcdir)/doc \ +$(srcdir)/src \ +$(srcdir)/tests + +# EOF diff --git a/autoconf/make/rules.mk b/autoconf/make/rules.mk new file mode 100644 index 0000000..96ed511 --- /dev/null +++ b/autoconf/make/rules.mk @@ -0,0 +1,43 @@ +# +# Compilation rules. +# + +.SUFFIXES: .c .d .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.c.d: + sh $(srcdir)/autoconf/scripts/depend.sh \ + $(CC) $< $(<:%.c=%) $(srcdir) $(CFLAGS) $(CPPFLAGS) > $@ + +# +# NLS stuff +# + +%.mo: %.po + $(MSGFMT) -o $@ $< + @touch $@ + @chmod 644 $@ + +%.gmo: %.po + rm -f $@ + $(GMSGFMT) -o $@ $< + @touch $@ + @chmod 644 $@ + +$(srcdir)/src/nls/$(PACKAGE).pot: $(allsrc) + $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(srcdir) \ + --add-comments --keyword=_ --keyword=N_ \ + $(allsrc) + if cmp -s $(PACKAGE).po $@; then \ + rm -f $(PACKAGE).po; \ + else \ + rm -f $@; \ + mv $(PACKAGE).po $@; \ + chmod 644 $@; \ + fi + +src/nls/table.c: $(POFILES) + sh $(srcdir)/autoconf/scripts/po2table.sh $(POFILES) > src/nls/table.c + diff --git a/autoconf/make/unreal.mk b/autoconf/make/unreal.mk new file mode 100644 index 0000000..3bb51c2 --- /dev/null +++ b/autoconf/make/unreal.mk @@ -0,0 +1,213 @@ +# +# Rules for all phony targets. +# + +.PHONY: all help make dep depend test check \ + clean depclean indentclean distclean cvsclean svnclean \ + index manhtml indent update-po \ + doc dist release \ + install uninstall \ + rpmbuild rpm srpm + +all: $(alltarg) $(CATALOGS) + +help: + @echo 'This Makefile has the following utility targets:' + @echo + @echo ' all build all binary targets' + @echo ' install install compiled package and manual' + @echo ' uninstall uninstall the package' + @echo ' check / test run standardised tests on the compiled binary' + @echo + @echo 'Developer targets:' + @echo + @echo ' make rebuild the Makefile (after adding new files)' + @echo ' dep / depend rebuild .d (dependency) files' + @echo ' clean remove .o (object) and .c~ (backup) files' + @echo ' depclean remove .d (dependency) files' + @echo ' indentclean remove files left over from "make indent"' + @echo ' distclean remove everything not distributed' + @echo ' cvsclean remove everything not in CVS/SVN' + @echo + @echo ' index generate an HTML index of source code' + @echo ' manhtml output HTML man page to stdout' + @echo ' indent reformat all source files with "indent"' + @echo ' update-po update the .po files' + @echo + @echo ' dist create a source tarball for distribution' + @echo ' rpm build a binary RPM (passes $$RPMFLAGS to RPM)' + @echo ' srpm build a source RPM (passes $$RPMFLAGS to RPM)' + @echo ' release dist+rpm+srpm' + @echo + +make: + echo > $(srcdir)/autoconf/make/filelist.mk~ + echo > $(srcdir)/autoconf/make/modules.mk~ + cd $(srcdir); \ + bash autoconf/scripts/makemake.sh \ + autoconf/make/filelist.mk~ \ + autoconf/make/modules.mk~ + sh ./config.status + +dep depend: $(alldep) + echo '#' > $(srcdir)/autoconf/make/depend.mk~ + echo '# Dependencies.' >> $(srcdir)/autoconf/make/depend.mk~ + echo '#' >> $(srcdir)/autoconf/make/depend.mk~ + echo >> $(srcdir)/autoconf/make/depend.mk~ + cat $(alldep) >> $(srcdir)/autoconf/make/depend.mk~ + sh ./config.status + +clean: + rm -f $(allobj) + +depclean: + rm -f $(alldep) + +indentclean: + cd $(srcdir) && for FILE in $(allsrc); do rm -f ./$${FILE}~; done + +update-po: $(srcdir)/src/nls/$(PACKAGE).pot + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + lang=$(srcdir)/`echo $$cat | sed 's/$(CATOBJEXT)$$//'`; \ + mv $$lang.po $$lang.old.po; \ + if $(MSGMERGE) $$lang.old.po $(srcdir)/src/nls/$(PACKAGE).pot > $$lang.po; then \ + rm -f $$lang.old.po; \ + else \ + echo "msgmerge for $$cat failed!"; \ + rm -f $$lang.po; \ + mv $$lang.old.po $$lang.po; \ + chmod 644 $$lang.po; \ + fi; \ + done + +distclean: clean depclean + rm -f $(alltarg) src/include/config.h + rm -rf $(package)-$(version).tar* $(package)-$(version) + rm -f *.html config.* + rm Makefile + +cvsclean svnclean: distclean + rm -f doc/lsm + rm -f doc/$(package).spec + rm -f doc/quickref.1 + rm -f configure + rm -f src/nls/*.gmo src/nls/*.mo + echo > $(srcdir)/autoconf/make/depend.mk~ + echo > $(srcdir)/autoconf/make/filelist.mk~ + echo > $(srcdir)/autoconf/make/modules.mk~ + +doc: + : + +index: + (cd $(srcdir); sh autoconf/scripts/index.sh $(srcdir)) > index.html + +manhtml: + @man2html ./doc/quickref.1 \ + | sed -e '1,/]*> ||ig' \ + -e 's|]*>\([^<]*\)|\1|ig' \ + -e '/

\)|\1

|ig' \ + -e 's/

/
/ig' \ + -e 's/<[0-9A-Za-z_.-]\+@[0-9A-Za-z_.-]\+>//g' \ + -e 's|\(http://.*\)|\1|ig' \ + | sed -e '1,/
Index/,/
rpmrc + echo %_topdir `pwd`/rpm > rpmmacros + rm -rf rpm + mkdir rpm + mkdir rpm/SPECS rpm/BUILD rpm/SOURCES rpm/RPMS rpm/SRPMS + -cat /usr/lib/rpm/rpmrc /etc/rpmrc $$HOME/.rpmrc \ + | grep -hsv ^macrofiles \ + >> rpmrc + +rpm: + test -e $(package)-$(version).tar.gz || $(MAKE) dist + test -e rpmrc || $(MAKE) rpmbuild + rpmbuild $(RPMFLAGS) --rcfile=rpmrc -tb $(package)-$(version).tar.gz + mv rpm/RPMS/*/$(package)-*.rpm . + rm -rf rpm rpmmacros rpmrc + +srpm: + test -e $(package)-$(version).tar.gz || $(MAKE) dist + test -e rpmrc || $(MAKE) rpmbuild + rpmbuild $(RPMFLAGS) --rcfile=rpmrc -ts $(package)-$(version).tar.gz + mv rpm/SRPMS/*$(package)-*.rpm . + rm -rf rpm rpmmacros rpmrc + +release: dist rpm srpm + zcat $(package)-$(version).tar.gz | bzip2 > $(package)-$(version).tar.bz2 diff --git a/autoconf/make/vars.mk b/autoconf/make/vars.mk new file mode 100644 index 0000000..1a74541 --- /dev/null +++ b/autoconf/make/vars.mk @@ -0,0 +1,47 @@ +# +# Variables for Make. +# + +srcdir = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +infodir = @infodir@ +mandir = @mandir@ +etcdir = @prefix@/etc +datadir = @datadir@ +sbindir = @sbindir@ + +VPATH = $(srcdir) + +localedir = $(datadir)/locale +gnulocaledir = $(prefix)/share/locale + +CATALOGS = @CATALOGS@ +POFILES = @POFILES@ +GMSGFMT = @GMSGFMT@ +MSGFMT = @MSGFMT@ +XGETTEXT = @XGETTEXT@ +MSGMERGE = msgmerge +CATOBJEXT = @CATOBJEXT@ +INSTOBJEXT = @INSTOBJEXT@ + +@SET_MAKE@ +SHELL = /bin/sh +CC = @CC@ +DO_GZIP = @DO_GZIP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +UNINSTALL = rm -f + +LDFLAGS = -r +LINKFLAGS = @LDFLAGS@ +DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/src/include -Isrc/include $(DEFS) +LIBS = @LIBS@ + +alltarg = @PACKAGE@ + +# EOF diff --git a/autoconf/scripts/benchmark.sh b/autoconf/scripts/benchmark.sh new file mode 100755 index 0000000..37ef35d --- /dev/null +++ b/autoconf/scripts/benchmark.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Benchmark the read/write performance of pv by looking at the number of +# read() and write() calls and the average amount of data transferred each +# time, as suggested by Ville Herva . +# + +test_input=`mktemp /tmp/pvbench1XXXXXX` +strace_output=`mktemp /tmp/pvbench2XXXXXX` + +trap "rm -f ${test_input} ${strace_output}" 0 + +pv=${pv:-./pv} +test -x ${pv} || pv=pv + +dd if=/dev/zero of=${test_input} bs=1k count=1k >/dev/null 2>&1 + +echo -e "Buf(k)\tRate(k)\tReads\tRsize\tWrites\tWsize" + +for ((buffer=100; buffer<=1000; buffer+=100)); do + for ((rate=0; rate<=1000; rate+=100)); do + rateparm="-L ${rate}k" + test ${rate} -eq 0 && rateparm="" + strace -tt -o ${strace_output} \ + ${pv} ${rateparm} -B ${buffer}k \ + -f < ${test_input} > /dev/null 2>&1 + rdata=$( + awk '$2~/^read\(0,/{c++;t+=$NF}END{print c "\t" t/c}' \ + ${strace_output} + ) + wdata=$( + awk '$2~/^write\(1,/{c++;t+=$NF}END{print c "\t" t/c}' \ + ${strace_output} + ) + echo -e "${buffer}\t${rate}\t${rdata}\t${wdata}" + done +done + +# EOF diff --git a/autoconf/scripts/depend.sh b/autoconf/scripts/depend.sh new file mode 100755 index 0000000..f17f81e --- /dev/null +++ b/autoconf/scripts/depend.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# Generate dependencies for a C source file. +# + +CC=$1 +shift +file=$1 +shift +stem=$1 +shift +srcdir=$1 +abssrc=`echo $srcdir | sed ':1 +s,^\./,,g +t1'` +shift + +abssrc=`echo "$abssrc" | sed 's,\\.,\\\\.,g'` +srcdir=`echo "$srcdir" | sed 's,\\.,\\\\.,g'` + +$CC -M -MG $* $file \ +| sed -e 's, /[^ ]*,,g' -e "s,^.*\.o:,${stem}.d ${stem}.o:," \ + -e '/^ \\$/d' -e 's/ \\$//' \ + -e 's,'"$srcdir"'/,,g' -e 's,'"$abssrc"'/,,g' \ +| tr '\n' ' ' \ +| tr -s ' ' + +echo + +# EOF diff --git a/autoconf/scripts/index.sh b/autoconf/scripts/index.sh new file mode 100755 index 0000000..e0a0c07 --- /dev/null +++ b/autoconf/scripts/index.sh @@ -0,0 +1,171 @@ +#!/bin/ash +# +# Script to generate an HTML index of all C code from the current directory +# downwards (skipping directories ending in ~). The header comment in each +# file is listed, and each function's prototype and comment are given. A +# list of "TODO:" comments is also generated. +# +# Outputs the HTML on standard output. +# +# If a parameter is given, it is the prefix to put before any "view file" +# links, eg ".." to link to "../dir/file.c" instead of "dir/file.c". +# +# Skips any files containing the string !NOINDEX. +# +# Requires ctags and cproto. +# + +OFFS=$1 + + +# Convert the given string to HTML-escaped values (<, >, & escaped) on +# stdout. +# +html_safe () { + echo "$*" \ + | sed -e 's|&|\&|g;s|<|\<|g;s|>|\>|g' +} + + +# Convert the given string to HTML-escaped values (<, >, & escaped) on +# stdout, also adding a
to the end of each line. +# +html_safebr () { + echo "$*" \ + | sed -e 's|&|\&|g;s|<|\<|g;s|>|\>|g;s/$/
/' +} + +ALLFILES=`find . -name '*~' -prune -o -type f -name '*.c' \ + -exec grep -FL '!NOINDEX' /dev/null '{}' ';'` + +CTAGDATA=`echo "$ALLFILES" \ + | ctags -nRf- -L- --c-types=f \ + | sed 's/ .\// /;s/;" .*$//'` + +FILELIST=`echo "$CTAGDATA" | cut -d ' ' -f 2 | sort | uniq` + +echo '' +echo 'Source Code Index' +echo '' +echo '

Source Code Index

' +echo '

' + +echo '

File Listing

' +echo '

    ' +echo "$FILELIST" \ +| sed -e \ + 's|^.*$|
  • \0
  • |' +echo '

' + +for FILE in $FILELIST; do + + DIR=`dirname $FILE` + FUNCDEFS=`cproto -f1 -I. -Isrc/include -I$DIR $FILE 2>/dev/null \ + | sed -n 's/^.*[ *]\([^ *(]*\)(.*$/\1/p'` + FILEHEAD="`sed -n -e \ + '1,/\*\//{/\/\*/,/\*\//{s/^[\/ *]//;s/^\*[\/]*//;p;};}' \ + < $FILE`" + FILESHORTDESC=`echo "$FILEHEAD" | sed -n '1,/^ *$/{/^ *[^ ]*/p;}'` + FILELONGDESC=`echo "$FILEHEAD" | sed '1,/^ *$/d'` + + echo '


' + echo '

' + echo '' + echo '' + echo '' + echo '
' + echo ''"$FILE"' - '`html_safe "$FILESHORTDESC"`'

' + echo '

[View File]

' + echo '

' + echo "`html_safebr "$FILELONGDESC"`" + echo '

' + + if [ -n "$FUNCDEFS" ]; then + echo '

Functions defined:

' + echo '

    ' + echo "$FUNCDEFS" \ + | sed 's|^.*$|\0|' \ + | sed 's/^/
  • /;s|$|
  • |' + echo '

' + fi + + echo '

[' + echo 'Top |' + echo 'To Do |' + echo 'Functions ]

' +done + +echo '

Function Listing

' +echo '

    ' +echo "$CTAGDATA" | while read FUNC FILE LINENUM REST; do + echo -n '
  • ' + echo -n ''"$FUNC"' ' + echo '['"$FILE"']
  • ' +done +echo '

' + +echo "$CTAGDATA" | while read FUNC FILE LINENUM REST; do + + FUNCDEF=`sed -n "$LINENUM,/{/p" < $FILE \ + | tr '\n' ' ' \ + | tr -d '{'` + + LASTCOMLINE=`sed -n '1,'"$LINENUM"'{/\/\*/=;}' < $FILE | sed -n '$p'` + [ -z "$LASTCOMLINE" ] && LASTCOMLINE=1 + LASTENDFUNCLINE=`sed -n '1,'"$LINENUM"'{/}/=;}' < $FILE | sed -n '$p'` + [ -z "$LASTENDFUNCLINE" ] && LASTENDFUNCLINE=1 + FUNCHEAD="`sed -n -e \ + "$LASTCOMLINE,"'/\*\//{h;s/^[\/ *]//;s/^\*[\/]*//;p;x;/\*\//q;}' \ + < $FILE`" + [ "$LASTCOMLINE" -le "$LASTENDFUNCLINE" ] && FUNCHEAD="" + + echo '


' + echo '

' + echo -n '' + echo -n "$FUNC"' ' + echo -n '[' + echo "$FILE"']' + echo '

' + + echo '

'"`html_safe "$FUNCDEF"`"'

' + + echo '

' + echo "`html_safebr "$FUNCHEAD"`" + echo '

' + + echo '

[' + echo 'Top |' + echo 'To Do |' + echo 'Files ]

' +done + +echo '

To Do Listing

' +echo '

    ' +for FILE in $FILELIST; do + + TODOLINES=`sed -n \ + -e '/\/\*.*\*\//!{/\/\*/,/\*\//{/TODO:/{=;};};}' \ + -e '/\/\*.*\*\//{/TODO:/{=;};}' \ + < $FILE` + + [ -z "$TODOLINES" ] && continue + + echo -n '
  • ' + echo ''"$FILE"'' + echo '
      ' + + for NUM in $TODOLINES; do + TODO=`sed -n "$NUM"'{s/^.*TODO://;s/\*\/.*$//;p;}' < $FILE` + echo "
    • [$NUM] `html_safe "$TODO"`
    • " + done + + echo '
  • ' +done + +echo '' + +# EOF diff --git a/autoconf/scripts/install.sh b/autoconf/scripts/install.sh new file mode 100755 index 0000000..ebc6691 --- /dev/null +++ b/autoconf/scripts/install.sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/autoconf/scripts/makemake.sh b/autoconf/scripts/makemake.sh new file mode 100755 index 0000000..3eca6c6 --- /dev/null +++ b/autoconf/scripts/makemake.sh @@ -0,0 +1,113 @@ +#!/bin/sh +# +# Generate Makefile dependencies inclusion and module target file "depend.mk~" +# by scanning the directory "src" for files ending in ".c" and ".d", and for +# subdirectories not starting with "_". +# +# Modules live inside subdirectories called [^_]* - i.e. a directory "foo" will +# have a rule created which links all code inside it to "foo.o". +# +# The directory "src/include" is never scanned; neither are CVS or SVN +# directories. +# + +outlist=$1 +outlink=$2 + +FIND=find +GREP=grep +which gfind 2>/dev/null | grep /gfind >/dev/null && FIND=gfind +which ggrep 2>/dev/null | grep /ggrep >/dev/null && GREP=ggrep + +echo '# Automatically generated file listings' > $outlist +echo '#' >> $outlist +echo "# Creation time: `date`" >> $outlist +echo >> $outlist + +echo '# Automatically generated module linking rules' > $outlink +echo '#' >> $outlink +echo "# Creation time: `date`" >> $outlink +echo >> $outlink + +echo -n "Scanning for source files: " + +allsrc=`$FIND src -type f -name "*.c" -print` +allobj=`echo $allsrc | tr ' ' '\n' | sed 's/\.c$/.o/'` +alldep=`echo $allsrc | tr ' ' '\n' | sed 's/\.c$/.d/'` + +echo `echo $allsrc | wc -w | tr -d ' '` found + +echo -n "Scanning for modules: " + +modules=`$FIND src -type d -print \ + | $GREP -v '^src$' \ + | $GREP -v '/_' \ + | $GREP -v '^src/include' \ + | $GREP -v 'CVS' \ + | $GREP -v '.svn' \ + | while read DIR; do \ + CONTENT=\$(/bin/ls -d \$DIR/* \ + | $GREP -v '.po$' \ + | $GREP -v '.gmo$' \ + | $GREP -v '.mo$' \ + | $GREP -v '.h$' \ + | sed -n '$p'); \ + [ -n "\$CONTENT" ] || continue; \ + echo \$DIR; \ + done + ` + +echo up to `echo $modules | wc -w | tr -d ' '` found + +echo "Writing module linking rules" + +echo -n [ +for i in $modules; do echo -n ' '; done +echo -n -e ']\r[' + +for i in $modules; do + echo -n '.' + allobj="$allobj $i.o" + deps="" + for j in $i/*.c; do + [ -f $j ] || continue + newobj=`echo $j | sed -e 's@\.c$@.o@'` + deps="$deps $newobj" + done + for j in $i/*; do + [ -d "$j" ] || continue + [ `basename $j` = "CVS" ] && continue + [ `basename $j` = ".svn" ] && continue + CONTENT=`/bin/ls -d $j/* \ + | $GREP -v '.po$' \ + | $GREP -v '.gmo$' \ + | $GREP -v '.mo$' \ + | $GREP -v '.h$' \ + | sed -n '$p'` + [ -n "$CONTENT" ] || continue + deps="$deps $j.o" + done + [ -n "$deps" ] || continue + echo "$i.o: $deps" >> $outlink + echo ' $(LD) $(LDFLAGS) -o $@' "$deps" >> $outlink + echo >> $outlink +done + +echo ']' + +echo "Listing source, object and dependency files" + +echo -n "allsrc = " >> $outlist +echo $allsrc | sed 's,src/nls/cat-id-tbl.c,,' | sed -e 's/ / \\!/g'\ +| tr '!' '\n' >> $outlist +echo >> $outlist +echo -n "allobj = " >> $outlist +echo $allobj | sed -e 's/ / \\!/g' | tr '!' '\n' >> $outlist +echo >> $outlist +echo -n "alldep = " >> $outlist +echo $alldep | sed -e 's/ / \\!/g' | tr '!' '\n' >> $outlist + +echo >> $outlist +echo >> $outlink + +# EOF diff --git a/autoconf/scripts/mkinstalldirs b/autoconf/scripts/mkinstalldirs new file mode 100755 index 0000000..ff059dd --- /dev/null +++ b/autoconf/scripts/mkinstalldirs @@ -0,0 +1,33 @@ +#!/bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" || errstatus=$? + chmod 755 $pathcomp 2>/dev/null + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/autoconf/scripts/po2table.sh b/autoconf/scripts/po2table.sh new file mode 100755 index 0000000..aca396e --- /dev/null +++ b/autoconf/scripts/po2table.sh @@ -0,0 +1,65 @@ +#!/bin/sh +# +# Messy script to convert all of the given .po files to a single C file on +# stdout. + +cat < + +struct msgtable_s { + char *msgid; + char *msgstr; +}; + + +struct msgtable_s *minigettext__gettable(char *lang) +{ + if (lang == 0) + return 0; + +EOF + +for POFILE; do + LANG=`basename "$POFILE" | sed 's/.po$//'` + echo " if (strncmp(lang, \"$LANG\", 2) == 0) {" + echo " static struct msgtable_s data[] = {"; + + awk 'BEGIN{i=0;s=0;} + /^msgid[ ]+/ { + if (s) print " }, "; + print " {"; + print " " substr($0,7); + i=1; + s=0; + } + /^msgstr[ ]+/ { + print " ,"; + i=0;s=1; + print " " substr($0,8); + } + /^[ ]*"/ { + if (i||s) print " " $0; + } + END {if (i||s) print " }\n";} + ' < "$POFILE" + echo ' , { 0, 0 } };' + echo " return data;" + echo " }" +done + +cat </dev/null 2>&1; then + TMP1=`mktemp` + TMP2=`mktemp` +fi + +export PROG TMP1 TMP2 # variables used by test scripts + +FAIL=0 + +test -n "$TESTS" || TESTS=`ls "$SRCDIR/tests" | sort -n` + +for SCRIPT in $TESTS; do + test -f "$SCRIPT" || SCRIPT="$SRCDIR/tests/$SCRIPT" + test -f "$SCRIPT" || SCRIPT=`ls "$SRCDIR/tests/$SCRIPT"*` + test -f "$SCRIPT" || continue + + echo `basename "$SCRIPT"`: " " | cut -b1-20 | sed 's/-/ - /' | tr "\n" ' ' + + STATUS=0 + sh -e "$SCRIPT" || STATUS=1 + test $STATUS -eq 1 && FAIL=1 + + test $STATUS -eq 1 && echo "FAILED" || echo "OK" +done + +rm -f $TMP1 $TMP2 + +exit $FAIL + +# EOF diff --git a/configure b/configure new file mode 100755 index 0000000..ec2fab5 --- /dev/null +++ b/configure @@ -0,0 +1,5855 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59. +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="src/main/version.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PACKAGE VERSION UCPACKAGE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE DO_GZIP MSGFMT GMSGFMT XGETTEXT CPP EGREP CATOBJEXT INSTOBJEXT GMOFILES POFILES CATALOGS NLSOBJ LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-debugging compile with debugging symbols + --enable-profiling compile with profiling support + --disable-lfs disable LFS support + --enable-static-nls hardcode NLS with no support files + --disable-nls do not use Native Language Support + --disable-splice do not use splice system call + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ac_config_headers="$ac_config_headers src/include/config.h:autoconf/header.in" + + +ac_aux_dir= +for ac_dir in autoconf/scripts $srcdir/autoconf/scripts; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in autoconf/scripts $srcdir/autoconf/scripts" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in autoconf/scripts $srcdir/autoconf/scripts" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + +PACKAGE=`cat $srcdir/doc/PACKAGE` +VERSION=`cat $srcdir/doc/VERSION` +UCPACKAGE=`tr a-z A-Z < $srcdir/doc/PACKAGE` + + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PROGRAM_NAME "$PACKAGE" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + + +# Check whether --enable-debugging or --disable-debugging was given. +if test "${enable_debugging+set}" = set; then + enableval="$enable_debugging" + if test "$enable_debugging" = "yes"; then + CFLAGS="-g -Wall" + fi + +fi; +# Check whether --enable-profiling or --disable-profiling was given. +if test "${enable_profiling+set}" = set; then + enableval="$enable_profiling" + if test "$enable_profiling" = "yes"; then + CFLAGS="-pg $CFLAGS" + fi + +fi; +LFS_SUPPORT="no" +# Check whether --enable-lfs or --disable-lfs was given. +if test "${enable_lfs+set}" = set; then + enableval="$enable_lfs" + if test "$enable_lfs" = "yes"; then + LFS_SUPPORT="yes" + fi +else + LFS_SUPPORT="yes" + +fi; +STATIC_NLS="no" +# Check whether --enable-static-nls or --disable-static-nls was given. +if test "${enable_static_nls+set}" = set; then + enableval="$enable_static_nls" + if test "$enable_static_nls" = "yes"; then + STATIC_NLS="yes" + fi +else + STATIC_NLS="no" + +fi; +NLS_SUPPORT="no" +# Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + if test "$enable_nls" = "yes"; then + NLS_SUPPORT="yes" + fi +else + NLS_SUPPORT="yes" + +fi; +SPLICE_SUPPORT="no" +# Check whether --enable-splice or --disable-splice was given. +if test "${enable_splice+set}" = set; then + enableval="$enable_splice" + if test "$enable_splice" = "yes"; then + SPLICE_SUPPORT="yes" + fi +else + SPLICE_SUPPORT="yes" + +fi; + +CFLAGS=${CFLAGS:-"-O"} +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Extract the first word of "gzip", so it can be a program name with args. +set dummy gzip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_DO_GZIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$DO_GZIP"; then + ac_cv_prog_DO_GZIP="$DO_GZIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DO_GZIP="gzip -f9" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_DO_GZIP" && ac_cv_prog_DO_GZIP="touch" +fi +fi +DO_GZIP=$ac_cv_prog_DO_GZIP +if test -n "$DO_GZIP"; then + echo "$as_me:$LINENO: result: $DO_GZIP" >&5 +echo "${ECHO_T}$DO_GZIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + +ALL_LINGUAS="de fr pl pt" +if test "$NLS_SUPPORT" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define ENABLE_NLS 1 +_ACEOF + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_MSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="NOMSGFMT" + ;; +esac +fi +MSGFMT=$ac_cv_path_MSGFMT + +if test -n "$MSGFMT"; then + echo "$as_me:$LINENO: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT + +if test -n "$GMSGFMT"; then + echo "$as_me:$LINENO: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $XGETTEXT in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_XGETTEXT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT="xgettext" + ;; +esac +fi +XGETTEXT=$ac_cv_path_XGETTEXT + +if test -n "$XGETTEXT"; then + echo "$as_me:$LINENO: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "x$MSGFMT" = "xNOMSGFMT"; then + MSGFMT="" + STATIC_NLS="yes" + fi + if test "$STATIC_NLS" = "yes"; then + CATALOGS="" + NLSOBJ="src/nls/table.o" + else + + +echo "$as_me:$LINENO: checking for main in -lintl" >&5 +echo $ECHO_N "checking for main in -lintl... $ECHO_C" >&6 +if test "${ac_cv_lib_intl_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_intl_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_intl_main=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_intl_main" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_main" >&6 +if test $ac_cv_lib_intl_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBINTL 1 +_ACEOF + + LIBS="-lintl $LIBS" + +fi + + +echo "$as_me:$LINENO: checking for main in -li" >&5 +echo $ECHO_N "checking for main in -li... $ECHO_C" >&6 +if test "${ac_cv_lib_i_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-li $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +int +main () +{ +main (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_i_main=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_i_main=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_i_main" >&5 +echo "${ECHO_T}$ac_cv_lib_i_main" >&6 +if test $ac_cv_lib_i_main = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBI 1 +_ACEOF + + LIBS="-li $LIBS" + +fi + + fi + CATOBJEXT=.mo + INSTOBJEXT=.mo + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES \$(srcdir)/src/nls/$lang.po" + CATALOGS="$CATALOGS src/nls/$lang$CATOBJEXT"; + done + if test "$STATIC_NLS" = "yes"; then + CATALOGS="" + else + echo "$as_me:$LINENO: checking for gettext" >&5 +echo $ECHO_N "checking for gettext... $ECHO_C" >&6 +if test "${ac_cv_func_gettext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define gettext to an innocuous variant, in case declares gettext. + For example, HP-UX 11i declares gettimeofday. */ +#define gettext innocuous_gettext + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gettext (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gettext + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gettext (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gettext) || defined (__stub___gettext) +choke me +#else +char (*f) () = gettext; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gettext; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gettext=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gettext=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gettext" >&5 +echo "${ECHO_T}$ac_cv_func_gettext" >&6 +if test $ac_cv_func_gettext = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_GETTEXT 1 +_ACEOF + + NLSOBJ="" + +else + CATALOGS=""; NLSOBJ="src/nls/table.o" + + +fi + + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in libintl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in locale.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + + + + + + +for ac_func in getopt_long getopt +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_header in getopt.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +if test "$LFS_SUPPORT" = "yes"; then + +for ac_func in open64 +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + cat >>confdefs.h <<\_ACEOF +#define ENABLE_LARGEFILE 1 +_ACEOF + +fi +done + +fi + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CONFIG_H 1 +_ACEOF + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + + + +for ac_func in memcpy basename snprintf stat64 +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + +for ac_header in limits.h sys/ipc.h sys/param.h libgen.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +if test "$SPLICE_SUPPORT" = "yes"; then + +for ac_func in splice +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +fi + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +subdirs="" +for i in `find $srcdir/src -type d -print | sed s,$srcdir/,,`; do + subdirs="$subdirs $i" +done + +mk_segments="autoconf/Makefile.in" +for i in vars.mk package.mk filelist.mk~ unreal.mk modules.mk~ \ + rules.mk link.mk depend.mk~; do + mk_segments="$mk_segments:autoconf/make/$i" +done + + ac_config_files="$ac_config_files Makefile:$mk_segments doc/lsm:doc/lsm.in doc/quickref.1:doc/quickref.1.in doc/$PACKAGE.spec:doc/spec.in src/.dummy:doc/NEWS" + ac_config_commands="$ac_config_commands default" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +subdirs="$subdirs" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile:$mk_segments" ;; + "doc/lsm" ) CONFIG_FILES="$CONFIG_FILES doc/lsm:doc/lsm.in" ;; + "doc/quickref.1" ) CONFIG_FILES="$CONFIG_FILES doc/quickref.1:doc/quickref.1.in" ;; + "doc/$PACKAGE.spec" ) CONFIG_FILES="$CONFIG_FILES doc/$PACKAGE.spec:doc/spec.in" ;; + "src/.dummy" ) CONFIG_FILES="$CONFIG_FILES src/.dummy:doc/NEWS" ;; + "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "src/include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/include/config.h:autoconf/header.in" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@UCPACKAGE@,$UCPACKAGE,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@DO_GZIP@,$DO_GZIP,;t t +s,@MSGFMT@,$MSGFMT,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@XGETTEXT@,$XGETTEXT,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@CATOBJEXT@,$CATOBJEXT,;t t +s,@INSTOBJEXT@,$INSTOBJEXT,;t t +s,@GMOFILES@,$GMOFILES,;t t +s,@POFILES@,$POFILES,;t t +s,@CATALOGS@,$CATALOGS,;t t +s,@NLSOBJ@,$NLSOBJ,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + default ) rm -f src/.dummy + for i in $subdirs; do + test -d $i || mkdir $i + done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + + diff --git a/doc/COPYING b/doc/COPYING new file mode 100644 index 0000000..a1afc69 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,171 @@ +This package is free software, and is being distributed under the terms +of the Artistic License 2.0. + +---------------------------------------------------------- + +Artistic License 2.0 + +Copyright (c) 2000-2006, The Perl Foundation. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. Preamble + +This license establishes the terms under which a given free software +Package may be copied, modified, distributed, and/or redistributed. The +intent is that the Copyright Holder maintains some artistic control +over the development of that Package while still keeping the Package +available as open source and free software. + +You are always permitted to make arrangements wholly outside of this +license directly with the Copyright Holder of a given Package. If the +terms of this license do not permit the full use that you propose to +make of the Package, you should contact the Copyright Holder and seek +a different licensing arrangement. Definitions + +"Copyright Holder" means the individual(s) or organization(s) named in +the copyright notice for the entire Package. + +"Contributor" means any party that has contributed code or other material +to the Package, in accordance with the Copyright Holder's procedures. + +"You" and "your" means any person who would like to copy, distribute, +or modify the Package. + +"Package" means the collection of files distributed by the Copyright +Holder, and derivatives of that collection and/or of those files. A given +Package may consist of either the Standard Version, or a Modified Version. + +"Distribute" means providing a copy of the Package or making it accessible +to anyone else, or in the case of a company or organization, to others +outside of your company or organization. + +"Distributor Fee" means any fee that you charge for Distributing this +Package or providing support for this Package to another party. It does +not mean licensing fees. + +"Standard Version" refers to the Package if it has not been modified, +or has been modified only in ways explicitly requested by the Copyright +Holder. + +"Modified Version" means the Package, if it has been changed, and such +changes were not explicitly requested by the Copyright Holder. + +"Original License" means this Artistic License as Distributed with the +Standard Version of the Package, in its current version or as it may be +modified by The Perl Foundation in the future. + +"Source" form means the source code, documentation source, and +configuration files for the Package. + +"Compiled" form means the compiled bytecode, object code, binary, or any +other form resulting from mechanical transformation or translation of +the Source form. Permission for Use and Modification Without Distribution + +(1) You are permitted to use the Standard Version and create and use +Modified Versions for any purpose without restriction, provided that you +do not Distribute the Modified Version. Permissions for Redistribution +of the Standard Version + +(2) You may Distribute verbatim copies of the Source form of the Standard +Version of this Package in any medium without restriction, either gratis +or for a Distributor Fee, provided that you duplicate all of the original +copyright notices and associated disclaimers. At your discretion, such +verbatim copies may or may not include a Compiled form of the Package. + +(3) You may apply any bug fixes, portability changes, and other +modifications made available from the Copyright Holder. The resulting +Package will still be considered the Standard Version, and as such will +be subject to the Original License. Distribution of Modified Versions +of the Package as Source + +(4) You may Distribute your Modified Version as Source (either gratis +or for a Distributor Fee, and with or without a Compiled form of the +Modified Version) provided that you clearly document how it differs +from the Standard Version, including, but not limited to, documenting +any non-standard features, executables, or modules, and provided that +you do at least ONE of the following: + +(a) make the Modified Version available to the Copyright Holder of the +Standard Version, under the Original License, so that the Copyright Holder +may include your modifications in the Standard Version. +(b) ensure that installation of your Modified Version does not prevent the +user installing or running the Standard Version. In addition, the Modified +Version must bear a name that is different from the name of the Standard +Version. +(c) allow anyone who receives a copy of the Modified Version to make +the Source form of the Modified Version available to others under +(i) the Original License or +(ii) a license that permits the licensee to freely copy, modify and +redistribute the Modified Version using the same licensing terms that apply +to the copy that the licensee received, and requires that the Source form of +the Modified Version, and of any works derived from it, be made freely +available in that license fees are prohibited but Distributor Fees are +allowed. Distribution of Compiled Forms of the Standard Version or Modified +Versions without the Source + +(5) You may Distribute Compiled forms of the Standard Version without +the Source, provided that you include complete instructions on how to +get the Source of the Standard Version. Such instructions must be valid +at the time of your distribution. If these instructions, at any time +while you are carrying out such distribution, become invalid, you must +provide new instructions on demand or cease further distribution. If +you provide valid instructions or cease distribution within thirty days +after you become aware that the instructions are invalid, then you do +not forfeit any of your rights under this license. + +(6) You may Distribute a Modified Version in Compiled form without the +Source, provided that you comply with Section 4 with respect to the +Source of the Modified Version. Aggregating or Linking the Package + +(7) You may aggregate the Package (either the Standard Version or +Modified Version) with other packages and Distribute the resulting +aggregation provided that you do not charge a licensing fee for the +Package. Distributor Fees are permitted, and licensing fees for other +components in the aggregation are permitted. The terms of this license +apply to the use and Distribution of the Standard or Modified Versions +as included in the aggregation. + +(8) You are permitted to link Modified and Standard Versions with other +works, to embed the Package in a larger work of your own, or to build +stand-alone binary or bytecode versions of applications that include the +Package, and Distribute the result without restriction, provided the +result does not expose a direct interface to the Package. Items That +are Not Considered Part of a Modified Version + +(9) Works (including, but not limited to, modules and scripts) that +merely extend or make use of the Package, do not, by themselves, cause +the Package to be a Modified Version. In addition, such works are not +considered parts of the Package itself, and are not subject to the terms +of this license. General Provisions + +(10) Any use, modification, and distribution of the Standard or Modified +Versions is governed by this Artistic License. By using, modifying or +distributing the Package, you accept this license. Do not use, modify, +or distribute the Package, if you do not accept this license. + +(11) If your Modified Version has been derived from a Modified Version +made by someone other than you, you are nevertheless required to ensure +that your Modified Version complies with the requirements of this license. + +(12) This license does not grant you the right to use any trademark, +service mark, tradename, or logo of the Copyright Holder. + +(13) This license includes the non-exclusive, worldwide, free-of-charge +patent license to make, have made, use, offer to sell, sell, import +and otherwise transfer the Package with respect to any patent claims +licensable by the Copyright Holder that are necessarily infringed by the +Package. If you institute patent litigation (including a cross-claim or +counterclaim) against any party alleging that the Package constitutes +direct or contributory patent infringement, then this Artistic License +to you shall terminate on the date that such litigation is filed. + +(14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT +HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT +PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER +OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR +CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------- diff --git a/doc/INSTALL b/doc/INSTALL new file mode 100644 index 0000000..50dbe43 --- /dev/null +++ b/doc/INSTALL @@ -0,0 +1,183 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/doc/NEWS b/doc/NEWS new file mode 100644 index 0000000..02a3630 --- /dev/null +++ b/doc/NEWS @@ -0,0 +1,207 @@ +1.3.4 - 27 June 2012 + - new "--disable-splice" configure script option + - fixed line mode size count with multiple files (Moritz Barsnick) + - fixes for AIX core dumps (Pawel Piatek) + +1.3.1 - 9 June 2012 + - do not use splice() if the write buffer is not empty (Thomas Rachel) + - added test 15 (pipe transfers), and new test script + +1.3.0 - 5 June 2012 + - added Tiger build patch from Olle Jonsson + - fix 1024-boundary display garble (Debian bug #586763) + - use splice(2) where available (Debian bug #601683) + - added known bugs section of the manual page + - fixed average rate test, 12 (Andrew Macheret) + - use IEEE1541 units (Thomas Rachel) + - bug with rate limit under 10 fixed (Henry Precheur) + - speed up PV line mode (patch: Guillaume Marcais) + - remove LD=ld from vars.mk to fix cross-compilation (paintitgray/PV#1291) + +1.2.0 - 14 December 2010 + - integrated improved SI prefixes and --average-rate (Henry Gebhardt) + - return nonzero if exiting due to SIGTERM (Martin Baum) + - patch from Phil Rutschman to restore terminal properly on exit + - fix i18n especially for --help (Sebastian Kayser) + - refactored pv_display + - we now have a coherent, documented, exit status + - modified pipe test and new cksum test from Sebastian Kayser + - default CFLAGS to just "-O" for non-GCC (Kjetil Torgrim Homme) + - LFS compile fix for OS X 10.4 (Alexandre de Verteuil) + - remove DESTDIR / suffix (Sam Nelson, Daniel Pape) + - fixed potential NULL deref in transfer (Elias Pipping / LLVM/Clang) + +1.1.4 - 6 March 2008 + - patch from Elias Pipping correcting compilation failure on Darwin 9 + - patch from Patrick Collison correcting similar problems on OS X + - trap SIGINT/SIGHUP/SIGTERM so we clean up IPCs on exit (Laszlo Ersek) + - abort if numeric option, eg -L, has non-numeric value (Boris Lohner) + +1.1.0 - 30 August 2007 + - new option --remote (-R) to control an already-running process + - new option --line-mode (-l) to count lines instead of bytes + - fix for "-L" to be less resource intensive + - fix for input/output equivalence check on Mac OS X + - fix for size calculation in pipelines on Mac OS X + - fixed "make uninstall" + - removed /debian directory at request of new Debian maintainer + +1.0.1 - 4 August 2007 + - licensing change from Artistic to Artistic 2.0 + - removed the "-l" / "--license" option + +1.0.0 - 2 August 2007 + - act more like "cat" - just skip unreadable files, don't abort + - removed text version of manual page, and obsolete Info file generation + - code cleanup and separation of PV internals from CLI front-end + +0.9.9 - 5 February 2007 + - new option --buffer-size (-B) suggested by Mark Tomich + - build fix: HP/UX largefile compile fix from Timo Savinen + - maintain better buffer filling during transfers + - workaround: pv /dev/zero | dd bs=1M count=1k bug (reported by Gert Menke) + - dropped support for the Texinfo manual + +0.9.6 - 27 February 2006 + - bugfix: key_t incompatibility with Cygwin + - bugfix: interval (-i) parameter parses numbers after decimal point + - build fix: use static NLS if msgfmt is unavailable + - on the final update, blank out the now-zero ETA + +0.9.2 - 1 September 2005 + - Daniel Roethlisberger patch: use lockfiles if terminal locking fails + +0.9.1 - 16 June 2005 + - minor RPM spec file fix for Fedora Core 4 + +0.9.0 - 15 November 2004 + - minor NLS bugfix + +0.8.9 - 6 November 2004 + - decimal values now accepted for rate and size, eg "-L 1.23M" + - code cleanup + - developers: "make help" now lists Makefile targets + +0.8.6 - 29 June 2004 + - use uu_lock() for terminal locking on FreeBSD + +0.8.5 - 2 May 2004 + - cursor positioning (-c) reliability improved on systems with IPC + - minor fix: made test 005 more reliable + - new option --height (-H) + +0.8.2 - 24 April 2004 + - allow k,m,g,t suffixes on numbers + - added "srpm" and "release" Makefile targets + +0.8.1 - 19 April 2004 + - bugfix in cursor positioning (-c) + +0.8.0 - 12 February 2004 + - replaced GNU getopt with my library code + - replaced GNU gettext with my very minimal replacement + - use DESTDIR instead of RPM_BUILD_ROOT for optional installation prefix + - looked for flaws using RATS, cleaned up code + +0.7.0 - 8 February 2004 + - display buffer management fixes (thanks Cédric Delfosse) + - replaced --enable-debug with --enable-debugging and --enable-profiling + +0.6.4 - 14 January 2004 + - fixed minor bug in RPM installation + - bugfix in "make index" (only of interest to developers) + +0.6.3 - 22 December 2003 + - fixed transient bug that reported "resource unavailable" occasionally + +0.6.2 - 6 August 2003 + - block devices now have their size read correctly, so pv /dev/hda1 works + - minor code cleanups (mainly removal of CVS "Id" tags) + +0.6.0 - 3 August 2003 + - doing ^Z then "bg" then "fg" now continues displaying + +0.5.9 - 23 July 2003 + - fix for test 007 when not in C locale + - fix for build process to use CPPFLAGS + - fix for build process to use correct i18n libraries + - fix for build process - more portable sed in dependency generator + - fix for install process - remember to mkinstalldirs before installing + - fixes for building on Mac OS X + +0.5.3 - 4 May 2003 + - added Polish translation thanks to Bartosz Feñski + and Krystian Zubel + - moved doc/debian to ./debian at insistence of common sense + - minor Solaris 8 compatibility fixes + - seems to compile and test OK on Mac OS X + +0.5.0 - 15 April 2003 + - added French translation thanks to Stéphane Lacasse + + - added German translation thanks to Marcos Kreinacke + + - switched LGPL reference from "Library" to "Lesser" + +0.4.9 - 18 February 2003 + - support for >2GB files added where available (Debian bug #180986) + - added doc/debian dir (from Cédric Delfosse) + - added "make rpm" and "make deb" targets to build RPM and Debian packages + - added a "make pv-static" rule to build a statically linked version + +0.4.5 - 13 December 2002 + - added Portuguese (Brazilian) translation thanks to Eduardo Aguiar + +0.4.4 - 7 December 2002 + - pause/resume support - don't count time while stopped + - stop output when resumed in the background + - terminal size change support + - bugfix: <=> indicator no longer sticks at right hand edge + +0.4.0 - 27 November 2002 + - allow decimal interval values, eg 0.1, 0.5, etc + - some simple tests added (`make check') + - smoother throughput limiting (--rate-limit), now done in 0.1sec chunks + - bounds-check interval values (-i) - max update interval now 10 minutes + - more reliable non-blocking output to keep display updated + - no longer rely on atoll() + - don't output final blank line if --numeric + - use fcntl() instead of flock() for Solaris compatibility + +0.3.0 - 25 November 2002 + - handle broken output pipe gracefully + - continue updating display even when output pipe is blocking + +0.2.6 - 21 October 2002 + - we now ignore EINTR on select() + - variable-size buffer (still need to add code to change size) + - added (tentative) support for internationalisation + - removed superfluous --no-progress, etc options + - optimised transfer by using bigger buffers, based on st_blksize + - added --wait option to wait until transfer begins before showing progress + - added --rate-limit option to limit rate to a maximum throughput + - added --quiet option (no output at all) to be used with --rate-limit + +0.2.5 - 23 July 2002 + - added [FILE]... arguments, like `cat' + - function separation in code + - some bug fixes related to numeric overflow + +0.2.3 - 19 July 2002 + - Texinfo manual written, man page updated + - byte counter added + +0.2.0 - 18 July 2002 + - ETA counter added + - screen width estimation added + - progress bar added + +0.1.0 - 17 July 2002 + - main loop created + - rate counter added + - elapsed time counter added + - percentage calculation added + +0.0.1 - 16 July 2002 + - package created + - first draft of man page written diff --git a/doc/PACKAGE b/doc/PACKAGE new file mode 100644 index 0000000..f1345ae --- /dev/null +++ b/doc/PACKAGE @@ -0,0 +1 @@ +pv diff --git a/doc/TODO b/doc/TODO new file mode 100644 index 0000000..96d31ee --- /dev/null +++ b/doc/TODO @@ -0,0 +1,23 @@ +Things still to do: + + - (#1293) check transfer buffer usage on large memory systems + - (#1292) make "pv -R PID" not kill process if PID is not PV + - (#1284) fix install on OSes without man page .gz (Bob Friesenhahn) + - (#1283) integrate Sami Liedes patch for numeric with timer and bytes + - (#1286) option for process title (Martin Sarsale) as "pv - name:FooProcess -xyz - transferred: 1.3GB - 500KB/s - running: 10:15:30s" + - (#1288) fix -c answerback on Solaris 10 (Bob Friesenhahn) + - (#1289) add -O to allow ordering of -pterb output, eg -bertp (Vladimir Pal) (http://unixstuff.ru), idea by Vladimir Ermakov + - (#1290) look at effect of O_SYNC or fsync on performance + - (#1282) fix cursor positioning (-c) lockfiles when O_EXLOCK is unavailable + - (#1282) fix cursor positioning (-c) to use semaphores instead of locking + - (#1279) fix cursor positioning with multiple pipelines under Cygwin + - (#1281) option (-x?) to use xterm title line for status (Joachim Haga) + - (#1287) if the first pv exits, should the second become IPC leader? + + - add development support for http://clang.llvm.org/StaticAnalysis.html + - stats for avg/min/max/stddev throughput (Venky.N.Iyer) + - option to enable O_DIRECT (Romain Kang) + - pv-ify a command line (Will Entriken) - "pv FOO | BAR | BAZ" + - get more translations + +Any assistance would be appreciated. diff --git a/doc/VERSION b/doc/VERSION new file mode 100644 index 0000000..d0149fe --- /dev/null +++ b/doc/VERSION @@ -0,0 +1 @@ +1.3.4 diff --git a/doc/lsm b/doc/lsm new file mode 100644 index 0000000..4cf4cdf --- /dev/null +++ b/doc/lsm @@ -0,0 +1,19 @@ +Begin3 +Title: pv +Version: 1.3.4 +Entered-date: 27JUN12 +Description: A tool for monitoring the progress of data through a + pipeline. It can be inserted into any normal pipeline + between two processes to give a visual indication of how + quickly data is passing through, how long it has taken, how + near to completion it is, and an estimate of how long it + will be until completion. +Keywords: progress bar, console, pipe, transfer rate +Author: Andrew Wood +Maintained-by: Andrew Wood +Primary-site: http://www.ivarch.com/programs/pv.shtml +Alternate-site: +Original-site: +Platforms: +Copying-policy: Artistic 2.0 +End diff --git a/doc/lsm.in b/doc/lsm.in new file mode 100644 index 0000000..d4baf3c --- /dev/null +++ b/doc/lsm.in @@ -0,0 +1,19 @@ +Begin3 +Title: @PACKAGE@ +Version: @VERSION@ +Entered-date: 27JUN12 +Description: A tool for monitoring the progress of data through a + pipeline. It can be inserted into any normal pipeline + between two processes to give a visual indication of how + quickly data is passing through, how long it has taken, how + near to completion it is, and an estimate of how long it + will be until completion. +Keywords: progress bar, console, pipe, transfer rate +Author: Andrew Wood +Maintained-by: Andrew Wood +Primary-site: http://www.ivarch.com/programs/@PACKAGE@.shtml +Alternate-site: +Original-site: +Platforms: +Copying-policy: Artistic 2.0 +End diff --git a/doc/pv.spec b/doc/pv.spec new file mode 100644 index 0000000..0a466f8 --- /dev/null +++ b/doc/pv.spec @@ -0,0 +1,152 @@ +Summary: Monitor the progress of data through a pipe +Name: pv +Version: 1.3.4 +Release: 1%{?dist} +License: Artistic 2.0 +Group: Development/Tools +Source: http://www.ivarch.com/programs/sources/pv-1.3.4.tar.gz +Url: http://www.ivarch.com/programs/pv.shtml +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: gettext + +%description +PV ("Pipe Viewer") is a tool for monitoring the progress of data through a +pipeline. It can be inserted into any normal pipeline between two processes +to give a visual indication of how quickly data is passing through, how long +it has taken, how near to completion it is, and an estimate of how long it +will be until completion. + +%prep +%setup -q + +%build +%configure +make %{?_smp_mflags} + +%install +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" +mkdir -p "$RPM_BUILD_ROOT"%{_bindir} +mkdir -p "$RPM_BUILD_ROOT"%{_mandir}/man1 +mkdir -p "$RPM_BUILD_ROOT"/usr/share/locale + +make DESTDIR="$RPM_BUILD_ROOT" install +%find_lang %{name} + +%check +make test + +%clean +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" + +%files -f %{name}.lang +%defattr(-, root, root) +%{_bindir}/%{name} +%{_mandir}/man1/%{name}.1.gz + +%doc README doc/NEWS doc/TODO doc/COPYING + +%changelog +* Wed Jun 27 2012 Andrew Wood 1.3.4-1 +- new "--disable-splice" configure script option +- fixed line mode size count with multiple files (Moritz Barsnick) +- fixes for AIX core dumps (Pawel Piatek) + +* Sat Jun 9 2012 Andrew Wood 1.3.1-1 +- do not use splice() if the write buffer is not empty (Thomas Rachel) +- added test 15 (pipe transfers), and new test script + +* Tue Jun 5 2012 Andrew Wood 1.3.0-1 +- added Tiger build patch from Olle Jonsson. +- fix 1024-boundary display garble (Debian bug #586763). +- use splice(2) where available (Debian bug #601683). +- added known bugs section of the manual page. +- fixed average rate test, 12 (Andrew Macheret). +- use IEEE1541 units (Thomas Rachel). +- bug with rate limit under 10 fixed (Henry Precheur). +- speed up PV line mode (patch: Guillaume Marcais). +- remove LD=ld from vars.mk to fix cross-compilation (paintitgray/PV#1291). + +* Tue Dec 14 2010 Andrew Wood 1.2.0-1 +- Integrated improved SI prefixes and --average-rate (Henry Gebhardt). +- Return nonzero if exiting due to SIGTERM (Martin Baum). +- Patch from Phil Rutschman to restore terminal properly on exit. +- Fix i18n especially for --help (Sebastian Kayser). +- Refactored pv_display. +- We now have a coherent, documented, exit status. +- Modified pipe test and new cksum test from Sebastian Kayser. +- Default CFLAGS to just "-O" for non-GCC (Kjetil Torgrim Homme). +- LFS compile fix for OS X 10.4 (Alexandre de Verteuil). +- Remove DESTDIR / suffix (Sam Nelson, Daniel Pape). +- Fixed potential NULL deref in transfer (Elias Pipping / LLVM/Clang). + +* Thu Mar 6 2008 Andrew Wood 1.1.4-1 +- Trap SIGINT/SIGHUP/SIGTERM so we clean up IPCs on exit (Laszlo Ersek). +- Abort if numeric option, eg -L, has non-numeric value (Boris Lohner). +- Compilation fixes for Darwin 9 and OS X. + +* Thu Aug 30 2007 Andrew Wood 1.1.0-1 +- New option "-R" to remotely control another pv process. +- New option "-l" to count lines instead of bytes. +- Performance improvement for "-L" (rate) option. +- Some Mac OS X fixes, and packaging cleanups. + +* Sat Aug 4 2007 Andrew Wood 1.0.1-1 +- Changed license from Artistic to Artistic 2.0. +- Removed "--license" option. + +* Thu Aug 2 2007 Andrew Wood 1.0.0-1 +- We now act more like "cat" - just skip unreadable files, don't abort. +- Various code cleanups were done. + +* Mon Feb 5 2007 Andrew Wood 0.9.9-1 +- New option "-B" to set the buffer size, and a workaround for problems +- piping to dd(1). + +* Mon Feb 27 2006 Andrew Wood +- Minor bugfixes, and on the final update, blank out the now-zero ETA. + +* Thu Sep 1 2005 Andrew Wood +- Terminal locking now uses lockfiles if the terminal itself cannot be locked. + +* Thu Jun 16 2005 Andrew Wood +- A minor problem with the spec file was fixed. + +* Mon Nov 15 2004 Andrew Wood +- A minor bug in the NLS code was fixed. + +* Sat Nov 6 2004 Andrew Wood +- Code cleanups and minor usability fixes. + +* Tue Jun 29 2004 Andrew Wood +- A port of the terminal locking code to FreeBSD. + +* Sun May 2 2004 Andrew Wood +- Major reliability improvements to the cursor positioning. + +* Sat Apr 24 2004 Andrew Wood +- Rate and size parameters can now take suffixes such as "k", "m" etc. + +* Mon Apr 19 2004 Andrew Wood +- A bug in the cursor positioning was fixed. + +* Thu Feb 12 2004 Andrew Wood +- Code cleanups and portability fixes. + +* Sun Feb 8 2004 Andrew Wood +- The display buffer is now dynamically allocated, fixing an overflow bug. + +* Wed Jan 14 2004 Andrew Wood +- A minor bug triggered when installing the RPM was fixed. + +* Mon Dec 22 2003 Andrew Wood +- Fixed a minor bug that occasionally reported "resource unavailable". + +* Wed Aug 6 2003 Andrew Wood +- Block devices now have their size read correctly, so pv /dev/hda1 works +- Minor code cleanups (mainly removal of CVS "Id" tags) + +* Sun Aug 3 2003 Andrew Wood +- Doing ^Z then "bg" then "fg" now continues displaying + +* Tue Jul 16 2002 Andrew Wood +- First draft of spec file created. diff --git a/doc/quickref.1.in b/doc/quickref.1.in new file mode 100644 index 0000000..bae8ecc --- /dev/null +++ b/doc/quickref.1.in @@ -0,0 +1,459 @@ +.TH @UCPACKAGE@ 1 "June 2012" Linux "User Manuals" +.SH NAME +@PACKAGE@ \- monitor the progress of data through a pipe +.SH SYNOPSIS +.B @PACKAGE@ +[\fIOPTION\fR] +[\fIFILE\fR]... +.br +.B @PACKAGE@ +[\fI\-h\fR|\fI\-V\fR] + + +.SH DESCRIPTION +.B @PACKAGE@ +allows a user to see the progress of data through a pipeline, by giving +information such as time elapsed, percentage completed (with progress bar), +current throughput rate, total data transferred, and ETA. + +To use it, insert it in a pipeline between two processes, with the +appropriate options. Its standard input will be passed through to its +standard output and progress will be shown on standard error. + +.B @PACKAGE@ +will copy each supplied +.B FILE +in turn to standard output +.BR "" "(" - +means standard input), or if no +.BR FILE s +are specified just standard input is copied. This is the same behaviour +as +.BR cat (1). + +A simple example to watch how quickly a file is transferred using +.BR nc (1): + +.RS +.B @PACKAGE@ file | nc -w 1 somewhere.com 3000 +.RE + +A similar example, transferring a file from another process and passing the +expected size to +.BR @PACKAGE@ : + +.RS +.B cat file | @PACKAGE@ -s 12345 | nc -w 1 somewhere.com 3000 +.RE + +A more complicated example using numeric output to feed into the +.BR dialog (1) +program for a full-screen progress display: + +.RS +.B (tar cf - . \e +.br +.B " | @PACKAGE@ -n -s $(du -sb . | awk '{print $1}') \e" +.br +.B " | gzip -9 > out.tgz) 2>&1 \e" +.br +.B | dialog --gauge 'Progress' 7 70 +.RE + +Frequent use of this third form is not recommended as it may cause the +programmer to overheat. + + +.SH OPTIONS +.B @PACKAGE@ +takes many options, which are divided into display switches, output +modifiers, and general options. + + +.SH DISPLAY SWITCHES +If no display switches are specified, +.B @PACKAGE@ +behaves as if +.BR \-p ", " \-t ", " \-e ", " \-r ", and " \-b +had been given (i.e. everything except average rate is switched on). +Otherwise, only those display types that are explicitly switched on will be +shown. +.TP +.B \-p, \-\-progress +Turn the progress bar on. If standard input is not a file and no +size was given (with the +.B \-s +modifier), the progress bar cannot indicate how close to completion the +transfer is, so it will just move left and right to indicate that data is +moving. +.TP +.B \-t, \-\-timer +Turn the timer on. This will display the total elapsed time that +.B @PACKAGE@ +has been running for. +.TP +.B \-e, \-\-eta +Turn the ETA timer on. This will attempt to guess, based on previous +transfer rates and the total data size, how long it will be before +completion. This option will have no effect if the total data size cannot +be determined. +.TP +.B \-r, \-\-rate +Turn the rate counter on. This will display the current rate of data +transfer. +.TP +.B \-a, \-\-average\-rate +Turn the average rate counter on. This will display the average rate of +data transfer so far. +.TP +.B \-b, \-\-bytes +Turn the total byte counter on. This will display the total amount of +data transferred so far. +.TP +.B \-n, \-\-numeric +Numeric output. Instead of giving a visual indication of progress, +.B @PACKAGE@ +will give an integer percentage, one per line, on standard error, suitable +for piping (via convoluted redirection) into +.BR dialog (1). +Note that +.B \-f +is not required if +.B \-n +is being used. +.TP +.B \-q, \-\-quiet +No output. Useful if the +.B \-L +option is being used on its own to just limit the transfer rate of a pipe. + + +.SH OUTPUT MODIFIERS +.TP +.B \-W, \-\-wait +Wait until the first byte has been transferred before showing any progress +information or calculating any ETAs. Useful if the program you are piping to +or from requires extra information before it starts, eg piping data into +.BR gpg (1) +or +.BR mcrypt (1) +which require a passphrase before data can be processed. +.TP +.B \-s SIZE, \-\-size SIZE +Assume the total amount of data to be transferred is +.B SIZE +bytes when calculating percentages and ETAs. The same suffixes of "k", "m" +etc can be used as with +.BR -L . +.TP +.B \-l, \-\-line\-mode +Instead of counting bytes, count lines (newline characters). The progress +bar will only move when a new line is found, and the value passed to the +.B \-s +option will be interpreted as a line count. +.TP +.B \-i SEC, \-\-interval SEC +Wait +.B SEC +seconds between updates. The default is to update every second. +Note that this can be a decimal such as 0.1. +.TP +.B \-w WIDTH, \-\-width WIDTH +Assume the terminal is +.B WIDTH +characters wide, instead of trying to work it out (or assuming 80 if it +cannot be guessed). +.TP +.B \-H HEIGHT, \-\-height HEIGHT +Assume the terminal is +.B HEIGHT +rows high, instead of trying to work it out (or assuming 25 if it +cannot be guessed). +.TP +.B \-N NAME, \-\-name NAME +Prefix the output information with +.BR NAME . +Useful in conjunction with +.B \-c +if you have a complicated pipeline and you want to be able to tell different +parts of it apart. +.TP +.B \-f, \-\-force +Force output. Normally, +.B @PACKAGE@ +will not output any visual display if standard error is not a terminal. +This option forces it to do so. +.TP +.B \-c, \-\-cursor +Use cursor positioning escape sequences instead of just using carriage +returns. This is useful in conjunction with +.B \-N +(name) if you are using multiple +.B @PACKAGE@ +invocations in a single, long, pipeline. + + +.SH DATA TRANSFER MODIFIERS +.TP +.B \-L RATE, \-\-rate-limit RATE +Limit the transfer to a maximum of +.B RATE +bytes per second. A suffix of "k", "m", "g", or "t" can be added to denote +kilobytes (*1024), megabytes, and so on. +.TP +.B \-B BYTES, \-\-buffer-size BYTES +Use a transfer buffer size of +.B BYTES +bytes. A suffix of "k", "m", "g", or "t" can be added to denote +kilobytes (*1024), megabytes, and so on. The default buffer size is the +block size of the input file's filesystem multiplied by 32 (512kb max), or +400kb if the block size cannot be determined. +.TP +.B \-R PID, \-\-remote PID +If +.B PID +is an instance of +.B @PACKAGE@ +that is already running, +.B \-R PID +will cause that instance to act as though it had been given +this instance's command line instead. For example, if +.B @PACKAGE@ -L 123k +is running with process ID 9876, then running +.B @PACKAGE@ -R 9876 -L 321k +will cause it to start using a rate limit of 321k instead of 123k. +Note that some options cannot be changed while running, such as +.BR \-c , +.BR \-l , +and +.BR \-f . +.TP +.B "" +.B NOTE: +Specifying a +.I PID +that is not another +.B @PACKAGE@ +process may cause that process to exit, because it will be sent a signal. + +.SH GENERAL OPTIONS +.TP +.B \-h, \-\-help +Print a usage message on standard output and exit successfully. +.TP +.B \-V, \-\-version +Print version information on standard output and exit successfully. + + +.SH EXIT STATUS +An exit status of 1 indicates a problem with the +.B \-R +option. + +Any other exit status is a bitmask of the following: + +.TP +.B 2 +One or more files could not be accessed, +.BR stat (2)ed, +or opened. +.TP +.B 4 +An input file was the same as the output file. +.TP +.B 8 +Internal error with closing a file or moving to the next file. +.TP +.B 16 +There was an error while transferring data from one or more input files. +.TP +.B 32 +A signal was caught that caused an early exit. +.TP +.B 64 +Memory allocation failed. + +A zero exit status indicates no problems. + + + +.SH AUTHORS +Andrew Wood +.br +.I http://www.ivarch.com/ + +Kevin Coyner +.br +(Debian package maintainer) + +Jakub Hrozek +.br +(Fedora package maintainer) + +Cedric Delfosse +.br +(previous Debian package maintainer) + +Eduardo Aguiar +.br +(provided Portuguese [Brazilian] translation) + +Stephane Lacasse +.br +(provided French translation) +.br +.I http://gorfou.ca/ + +Marcos Kreinacke +.br +(provided German translation) + +Bartosz Fenski +.br +(provided Polish translation, along with Krystian Zubel) +.br +.I http://skawina.eu.org/ + +Joshua Jensen +.br +(reported RPM installation bug) + +Boris Folgmann +.br +(reported cursor handling bug) +.br +.I http://www.folgmann.com/en/ + +Mathias Gumz +.br +(reported NLS bug) + +Daniel Roethlisberger +.br +(submitted patch to use lockfiles for -c if terminal locking fails) + +Adam Buchbinder +.br +(lots of help with a Cygwin port of -c) + +Mark Tomich +.br +(suggested -B option) +.br +.I http://metuchen.dyndns.org + +Gert Menke +.br +(reported bug when piping to dd with a large input buffer size) + +Ville Herva +.br +(informative bug report about rate limiting performance) + +Elias Pipping +.br +(patch to compile properly on Darwin 9; potential NULL deref report) + +Patrick Collison +.br +(similar patch for OS X) + +Boris Lohner +.br +(reported problem that -L does not complain if given non-numeric value) + +Sebastian Kayser +.br +(supplied testing for SIGPIPE, demonstrated internationalisation problem) + +Laszlo Ersek +.br +(reported shared memory leak on SIGINT with -c) +.br +.I http://phptest11.atw.hu/ + +Phil Rutschman +.br +(provided a patch for fully restoring terminal state on exit) +.br +.I http://bandgap.rsnsoft.com/ + +Henry Precheur +.br +(reporting and suggestions for --rate-limit bug when rate is under 10) +.br +.I http://henry.precheur.org/ + +E. Rosten +.br +(supplied patch for block buffering in line mode) +.br +.I http://mi.eng.cam.ac.uk/~er258/ + +Kjetil Torgrim Homme +.br +(reported compilation error with default CFLAGS on non-GCC compilers) + +Alexandre de Verteuil +.br +(reported bug in OS X build and supplied test environment to fix in) + +Martin Baum +.br +(supplied patch to return nonzero exit status if terminated by signal) + +Sam Nelson +.br +(supplied patch to fix trailing slash on DESTDIR) +.br +.I http://www.siliconfuture.net/ + +Daniel Pape +.br +(reported Cygwin installation problem due to DESTDIR) + +Henry Gebhardt +.br +(supplied patches to improve SI prefixes and add --average-rate) + +Vladimir Kokarev +.br +Alexander Leo +.br +(reported that exit status did not reflect file errors) + +Thomas Rachel +.br +(submitted patches for IEEE1541 (MiB suffixes), 1+e03 bug) + +Guillaume Marcais +.br +(submitted speedup patch for line mode) + +Moritz Barsnick +.br +(submitted patch for compile warning in size calculation) + +Pawel Piatek +.br +(submitted RPM and patches for AIX) + + +.SH BUGS +Known bugs: +.TP +.B * +The +.B -c +option does not seem to work correctly on Solaris 10 or Cygwin. +.P +If you find any other bugs, please contact the primary author, either by +email or by using the contact form on the web site. + +.SH "SEE ALSO" +.BR cat (1), +.BR dialog (1) + + +.SH LICENSE +This is free software, distributed under the ARTISTIC 2.0 license. diff --git a/doc/release-checklist b/doc/release-checklist new file mode 100644 index 0000000..222cdfb --- /dev/null +++ b/doc/release-checklist @@ -0,0 +1,22 @@ +Before releasing a new version, go through this checklist: + + - check for patches from http://packages.qa.debian.org/p/pv.html + - bump doc/VERSION + - bump doc/lsm.in + - check doc/NEWS is up to date + - check doc/spec.in is up to date (changelog) + - check manual is up to date + - make indent indentclean + - make update-po + - make test + - commit to SVN + - wipe build directory, re-run generate.sh and configure + - make release + - make manhtml | tidy -asxhtml | sed -e '1,//d' -e '/<\/body>/,$d' + - update HTML for todo and news + - copy and sign tar.gz to HTML directory + - upload package files to Google Code + - submit new release to Freshmeat + - upload HTML + - check validator results for project page and manual + - upload package files to SourceForge diff --git a/doc/spec.in b/doc/spec.in new file mode 100644 index 0000000..dc77291 --- /dev/null +++ b/doc/spec.in @@ -0,0 +1,152 @@ +Summary: Monitor the progress of data through a pipe +Name: @PACKAGE@ +Version: @VERSION@ +Release: 1%{?dist} +License: Artistic 2.0 +Group: Development/Tools +Source: http://www.ivarch.com/programs/sources/@PACKAGE@-@VERSION@.tar.gz +Url: http://www.ivarch.com/programs/pv.shtml +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: gettext + +%description +PV ("Pipe Viewer") is a tool for monitoring the progress of data through a +pipeline. It can be inserted into any normal pipeline between two processes +to give a visual indication of how quickly data is passing through, how long +it has taken, how near to completion it is, and an estimate of how long it +will be until completion. + +%prep +%setup -q + +%build +%configure +make %{?_smp_mflags} + +%install +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" +mkdir -p "$RPM_BUILD_ROOT"%{_bindir} +mkdir -p "$RPM_BUILD_ROOT"%{_mandir}/man1 +mkdir -p "$RPM_BUILD_ROOT"/usr/share/locale + +make DESTDIR="$RPM_BUILD_ROOT" install +%find_lang %{name} + +%check +make test + +%clean +[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT" + +%files -f %{name}.lang +%defattr(-, root, root) +%{_bindir}/%{name} +%{_mandir}/man1/%{name}.1.gz + +%doc README doc/NEWS doc/TODO doc/COPYING + +%changelog +* Wed Jun 27 2012 Andrew Wood 1.3.4-1 +- new "--disable-splice" configure script option +- fixed line mode size count with multiple files (Moritz Barsnick) +- fixes for AIX core dumps (Pawel Piatek) + +* Sat Jun 9 2012 Andrew Wood 1.3.1-1 +- do not use splice() if the write buffer is not empty (Thomas Rachel) +- added test 15 (pipe transfers), and new test script + +* Tue Jun 5 2012 Andrew Wood 1.3.0-1 +- added Tiger build patch from Olle Jonsson. +- fix 1024-boundary display garble (Debian bug #586763). +- use splice(2) where available (Debian bug #601683). +- added known bugs section of the manual page. +- fixed average rate test, 12 (Andrew Macheret). +- use IEEE1541 units (Thomas Rachel). +- bug with rate limit under 10 fixed (Henry Precheur). +- speed up PV line mode (patch: Guillaume Marcais). +- remove LD=ld from vars.mk to fix cross-compilation (paintitgray/PV#1291). + +* Tue Dec 14 2010 Andrew Wood 1.2.0-1 +- Integrated improved SI prefixes and --average-rate (Henry Gebhardt). +- Return nonzero if exiting due to SIGTERM (Martin Baum). +- Patch from Phil Rutschman to restore terminal properly on exit. +- Fix i18n especially for --help (Sebastian Kayser). +- Refactored pv_display. +- We now have a coherent, documented, exit status. +- Modified pipe test and new cksum test from Sebastian Kayser. +- Default CFLAGS to just "-O" for non-GCC (Kjetil Torgrim Homme). +- LFS compile fix for OS X 10.4 (Alexandre de Verteuil). +- Remove DESTDIR / suffix (Sam Nelson, Daniel Pape). +- Fixed potential NULL deref in transfer (Elias Pipping / LLVM/Clang). + +* Thu Mar 6 2008 Andrew Wood 1.1.4-1 +- Trap SIGINT/SIGHUP/SIGTERM so we clean up IPCs on exit (Laszlo Ersek). +- Abort if numeric option, eg -L, has non-numeric value (Boris Lohner). +- Compilation fixes for Darwin 9 and OS X. + +* Thu Aug 30 2007 Andrew Wood 1.1.0-1 +- New option "-R" to remotely control another @PACKAGE@ process. +- New option "-l" to count lines instead of bytes. +- Performance improvement for "-L" (rate) option. +- Some Mac OS X fixes, and packaging cleanups. + +* Sat Aug 4 2007 Andrew Wood 1.0.1-1 +- Changed license from Artistic to Artistic 2.0. +- Removed "--license" option. + +* Thu Aug 2 2007 Andrew Wood 1.0.0-1 +- We now act more like "cat" - just skip unreadable files, don't abort. +- Various code cleanups were done. + +* Mon Feb 5 2007 Andrew Wood 0.9.9-1 +- New option "-B" to set the buffer size, and a workaround for problems +- piping to dd(1). + +* Mon Feb 27 2006 Andrew Wood +- Minor bugfixes, and on the final update, blank out the now-zero ETA. + +* Thu Sep 1 2005 Andrew Wood +- Terminal locking now uses lockfiles if the terminal itself cannot be locked. + +* Thu Jun 16 2005 Andrew Wood +- A minor problem with the spec file was fixed. + +* Mon Nov 15 2004 Andrew Wood +- A minor bug in the NLS code was fixed. + +* Sat Nov 6 2004 Andrew Wood +- Code cleanups and minor usability fixes. + +* Tue Jun 29 2004 Andrew Wood +- A port of the terminal locking code to FreeBSD. + +* Sun May 2 2004 Andrew Wood +- Major reliability improvements to the cursor positioning. + +* Sat Apr 24 2004 Andrew Wood +- Rate and size parameters can now take suffixes such as "k", "m" etc. + +* Mon Apr 19 2004 Andrew Wood +- A bug in the cursor positioning was fixed. + +* Thu Feb 12 2004 Andrew Wood +- Code cleanups and portability fixes. + +* Sun Feb 8 2004 Andrew Wood +- The display buffer is now dynamically allocated, fixing an overflow bug. + +* Wed Jan 14 2004 Andrew Wood +- A minor bug triggered when installing the RPM was fixed. + +* Mon Dec 22 2003 Andrew Wood +- Fixed a minor bug that occasionally reported "resource unavailable". + +* Wed Aug 6 2003 Andrew Wood +- Block devices now have their size read correctly, so pv /dev/hda1 works +- Minor code cleanups (mainly removal of CVS "Id" tags) + +* Sun Aug 3 2003 Andrew Wood +- Doing ^Z then "bg" then "fg" now continues displaying + +* Tue Jul 16 2002 Andrew Wood +- First draft of spec file created. diff --git a/src/include/library/getopt.h b/src/include/library/getopt.h new file mode 100644 index 0000000..162c83a --- /dev/null +++ b/src/include/library/getopt.h @@ -0,0 +1,38 @@ +/* + * Replacement getopt function's header file. Include this AFTER config.h. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifndef _LIBRARY_GETOPT_H +#define _LIBRARY_GETOPT_H 1 + +#ifdef HAVE_GETOPT_H +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HAVE_GETOPT + +int minigetopt(int, char **, char *); +extern char *minioptarg; +extern int minioptind, miniopterr, minioptopt; + +#define getopt minigetopt /* Flawfinder: ignore */ +#define optarg minioptarg +#define optind minioptind +#define opterr miniopterr +#define optopt minioptopt + +#endif /* !HAVE_GETOPT */ + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBRARY_GETOPT_H */ + +/* EOF */ diff --git a/src/include/library/gettext.h b/src/include/library/gettext.h new file mode 100644 index 0000000..67e6d1e --- /dev/null +++ b/src/include/library/gettext.h @@ -0,0 +1,53 @@ +/* + * Replacement gettext library header file. Include this within config.h, + * like this: + * + * #ifdef ENABLE_NLS + * # include "library/gettext.h" + * #else + * # define _(String) (String) + * # define N_(String) (String) + * #endif + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifndef _LIBRARY_GETTEXT_H +#define _LIBRARY_GETTEXT_H 1 + +#ifdef HAVE_GETTEXT +# ifdef HAVE_LIBINTL_H +# include +# endif +# ifdef HAVE_LOCALE_H +# include +# endif +# define _(String) gettext (String) +# define N_(String) (String) +#else +# define _(String) minigettext (String) +# define N_(String) (String) +# define setlocale minisetlocale +# define bindtextdomain minibindtextdomain +# define textdomain minitextdomain +# ifndef LC_ALL +# define LC_ALL "" +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +char *minisetlocale(char *, char *); +char *minibindtextdomain(char *, char *); +char *minitextdomain(char *); +char *minigettext(char *); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBRARY_GETTEXT_H */ + +/* EOF */ diff --git a/src/include/options.h b/src/include/options.h new file mode 100644 index 0000000..549aed0 --- /dev/null +++ b/src/include/options.h @@ -0,0 +1,56 @@ +/* + * Global program option structure and the parsing function prototype. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifndef _OPTIONS_H +#define _OPTIONS_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +struct opts_s; +typedef struct opts_s *opts_t; + +struct opts_s { /* structure describing run-time options */ + char *program_name; /* name the program is running as */ + unsigned char do_nothing; /* exit-without-doing-anything flag */ + unsigned char progress; /* progress bar flag */ + unsigned char timer; /* timer flag */ + unsigned char eta; /* ETA flag */ + unsigned char rate; /* rate counter flag */ + unsigned char average_rate; /* average rate counter flag */ + unsigned char bytes; /* bytes transferred flag */ + unsigned char force; /* force-if-not-terminal flag */ + unsigned char cursor; /* whether to use cursor positioning */ + unsigned char numeric; /* numeric output only */ + unsigned char wait; /* wait for transfer before display */ + unsigned char linemode; /* count lines instead of bytes */ + unsigned char no_op; /* do nothing other than pipe data */ + unsigned long long rate_limit; /* rate limit, in bytes per second */ + unsigned long long buffer_size;/* buffer size, in bytes (0=default) */ + unsigned int remote; /* PID of pv to update settings of */ + unsigned long long size; /* total size of data */ + double interval; /* interval between updates */ + unsigned int width; /* screen width */ + unsigned int height; /* screen height */ + char *name; /* process name, if any */ + int argc; /* number of non-option arguments */ + char **argv; /* array of non-option arguments */ + char *current_file; /* current file being read */ + unsigned char exit_status; /* exit status to give (0=OK) */ +}; + +extern opts_t opts_parse(int, char **); +extern void opts_free(opts_t); + + +#ifdef __cplusplus +} +#endif + +#endif /* _OPTIONS_H */ + +/* EOF */ diff --git a/src/include/pv.h b/src/include/pv.h new file mode 100644 index 0000000..a79586a --- /dev/null +++ b/src/include/pv.h @@ -0,0 +1,52 @@ +/* + * Functions used across the program. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifndef _PV_H +#define _PV_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _OPTIONS_H +struct opts_s; +typedef struct opts_s *opts_t; +#endif + +double pv_getnum_d(char *); +int pv_getnum_i(char *); +long long pv_getnum_ll(char *); +int pv_getnum_check(char *, int); + +void pv_screensize(opts_t); +void pv_calc_total_size(opts_t); + +int pv_main_loop(opts_t); +void pv_display(opts_t, long double, long long, long long); +long pv_transfer(opts_t, int, int *, int *, unsigned long long, long *); +void pv_set_buffer_size(unsigned long long, int); +int pv_next_file(opts_t, int, int); + +void pv_crs_fini(opts_t); +void pv_crs_init(opts_t); +void pv_crs_update(opts_t, char *); +#ifdef HAVE_IPC +void pv_crs_needreinit(void); +#endif + +void pv_sig_allowpause(void); +void pv_sig_checkbg(void); +void pv_sig_init(void); +void pv_sig_nopause(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* _PV_H */ + +/* EOF */ diff --git a/src/library/getopt.c b/src/library/getopt.c new file mode 100644 index 0000000..fb8410e --- /dev/null +++ b/src/library/getopt.c @@ -0,0 +1,115 @@ +/* + * Small reimplementation of getopt(). + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#include "config.h" +#include +#include +#include + +#ifndef HAVE_GETOPT + +char *minioptarg = NULL; +int minioptind = 0; +int miniopterr = 1; +int minioptopt = 0; + + +/* + * Minimalist getopt() clone, which handles short options only and doesn't + * permute argv[]. + */ +int minigetopt(int argc, char **argv, char *optstring) +{ + static int nextchar = 0; + int optchar; + int i; + + if ((minioptind == 0) && (argc > 0)) + minioptind++; + + if ((nextchar > 0) && (argv[minioptind][nextchar] == 0)) { + minioptind++; + nextchar = 0; + } + + if (minioptind >= argc) + return -1; + + /* + * End of options if arg doesn't start with "-" + */ + if (argv[minioptind][0] != '-') + return -1; + + /* + * End of options if arg is just "-" + */ + if (argv[minioptind][1] == 0) + return -1; + + /* + * End of options if arg is "--", but don't include the "--" in the + * non-option arguments + */ + if ((argv[minioptind][1] == '-') && (argv[minioptind][2] == 0)) { + minioptind++; + return -1; + } + + if (nextchar == 0) + nextchar = 1; + + optchar = argv[minioptind][nextchar++]; + + for (i = 0; optstring[i] != 0 && optstring[i] != optchar; i++) { + } + + if (optstring[i] == 0) { + minioptopt = optchar; + if (miniopterr) + fprintf(stderr, "%s: invalid option -- %c\n", + argv[0], optchar); + return '?'; + } + + if (optstring[i + 1] != ':') { + minioptarg = NULL; + return optchar; + } + + /* + * At this point we've got an option that takes an argument. + */ + + /* + * Next character isn't 0, so the argument is within this array + * element (i.e. "-dFOO"). + */ + if (argv[minioptind][nextchar] != 0) { + minioptarg = &(argv[minioptind][nextchar]); + nextchar = 0; + minioptind++; + return optchar; + } + + /* + * Argument is in the next array element (i.e. "-d FOO"). + */ + nextchar = 0; + minioptind++; + if (minioptind >= argc) { + fprintf(stderr, "%s: option `-%c' requires an argument\n", + argv[0], optchar); + return ':'; + } + minioptarg = argv[minioptind++]; + + return optchar; +} + +#endif /* HAVE_GETOPT */ + +/* EOF */ diff --git a/src/library/gettext.c b/src/library/gettext.c new file mode 100644 index 0000000..b964fde --- /dev/null +++ b/src/library/gettext.c @@ -0,0 +1,111 @@ +/* + * Very minimal (and stupid) implementation of gettext, with a fixed lookup + * table. + * + * This library ONLY handles gettext(), and that only for the basic form (it + * translates strings to other strings with no other modification, so %2$d + * style constructs are not dealt with). The setlocale(), bindtextdomain(), + * and textdomain() functions are ignored. + * + * To use this library, create a function that, given a language string, + * returns a struct msg_table_s[] of msgid and msgstr pairs, with the end + * of the table being marked by a NULL msgid. The po2table.sh script will do + * this. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#include "config.h" +#include +#include +#include + +#ifndef HAVE_GETTEXT + +struct msgtable_s { + char *msgid; + char *msgstr; +}; + +#if ENABLE_NLS +struct msgtable_s *minigettext__gettable(char *); +#else /* ENABLE_NLS */ +struct msgtable_s *minigettext__gettable(char *a) +{ + return NULL; +} +#endif /* ENABLE_NLS */ + +char *minisetlocale(char *a, char *b) +{ + return NULL; +} + + +char *minibindtextdomain(char *a, char *b) +{ + return NULL; +} + + +char *minitextdomain(char *a) +{ + return NULL; +} + + +char *minigettext(char *msgid) +{ + static struct msgtable_s *table = NULL; + static int tried_lang = 0; + char *lang; + int i; + + if (msgid == NULL) + return msgid; + + if (tried_lang == 0) { + lang = getenv("LANGUAGE"); /* RATS: ignore */ + if (lang) + table = minigettext__gettable(lang); + + if (table == NULL) { + lang = getenv("LANG"); /* RATS: ignore */ + if (lang) + table = minigettext__gettable(lang); + } + + if (table == NULL) { + lang = getenv("LC_ALL"); /* RATS: ignore */ + if (lang) + table = minigettext__gettable(lang); + } + + if (table == NULL) { + lang = getenv("LC_MESSAGES"); /* RATS: ignore */ + if (lang) + table = minigettext__gettable(lang); + } + + tried_lang = 1; + } + + if (table == NULL) + return msgid; + + for (i = 0; table[i].msgid; i++) { + if (strcmp(table[i].msgid, msgid) == 0) { + if (table[i].msgstr == 0) + return msgid; + if (table[i].msgstr[0] == 0) + return msgid; + return table[i].msgstr; + } + } + + return msgid; +} + +#endif /* HAVE_GETTEXT */ + +/* EOF */ diff --git a/src/main/help.c b/src/main/help.c new file mode 100644 index 0000000..2d1b927 --- /dev/null +++ b/src/main/help.c @@ -0,0 +1,179 @@ +/* + * Output command-line help to stdout. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#define N_(String) (String) + +struct optdesc_s { + char *optshort; + char *optlong; + char *param; + char *description; +}; + + +/* + * Display command-line help. + */ +void display_help(void) +{ + struct optdesc_s optlist[] = { + {"-p", "--progress", 0, + N_("show progress bar")}, + {"-t", "--timer", 0, + N_("show elapsed time")}, + {"-e", "--eta", 0, + N_("show estimated time of arrival (completion)")}, + {"-r", "--rate", 0, + N_("show data transfer rate counter")}, + {"-a", "--average-rate", 0, + N_("show data transfer average rate counter")}, + {"-b", "--bytes", 0, + N_("show number of bytes transferred")}, + {"-f", "--force", 0, + N_("output even if standard error is not a terminal")}, + {"-n", "--numeric", 0, + N_("output percentages, not visual information")}, + {"-q", "--quiet", 0, + N_("do not output any transfer information at all")}, + {"-c", "--cursor", 0, + N_("use cursor positioning escape sequences")}, + {"-W", "--wait", 0, + N_("display nothing until first byte transferred")}, + {"-s", "--size", N_("SIZE"), + N_("set estimated data size to SIZE bytes")}, + {"-l", "--line-mode", 0, + N_("count lines instead of bytes")}, + {"-i", "--interval", N_("SEC"), + N_("update every SEC seconds")}, + {"-w", "--width", N_("WIDTH"), + N_("assume terminal is WIDTH characters wide")}, + {"-H", "--height", N_("HEIGHT"), + N_("assume terminal is HEIGHT rows high")}, + {"-N", "--name", N_("NAME"), + N_("prefix visual information with NAME")}, + {"", 0, 0, 0}, + {"-L", "--rate-limit", N_("RATE"), + N_("limit transfer to RATE bytes per second")}, + {"-B", "--buffer-size", N_("BYTES"), + N_("use a buffer size of BYTES")}, + {"-R", "--remote", N_("PID"), + N_("update settings of process PID")}, + {"", 0, 0, 0}, + {"-h", "--help", 0, + N_("show this help and exit")}, + {"-V", "--version", 0, + N_("show version information and exit")}, + {0, 0, 0, 0} + }; + int i, col1max = 0, tw = 77; + char *optbuf; + + printf(_("Usage: %s [OPTION] [FILE]..."), /* RATS: ignore */ + PROGRAM_NAME); + printf("\n%s\n\n", + _ + ("Concatenate FILE(s), or standard input, to standard output,\n" + "with monitoring.")); + + for (i = 0; optlist[i].optshort; i++) { + int width = 0; + char *param; + + width = 2 + strlen(optlist[i].optshort); /* RATS: ignore */ +#ifdef HAVE_GETOPT_LONG + if (optlist[i].optlong) + width += 2 + strlen(optlist[i].optlong); /* RATS: ignore */ +#endif + param = optlist[i].param; + if (param) + param = _(param); + if (param) + width += 1 + strlen(param); /* RATS: ignore */ + + if (width > col1max) + col1max = width; + } + + col1max++; + + optbuf = malloc(col1max + 16); + if (optbuf == NULL) { + fprintf(stderr, "%s: %s\n", PROGRAM_NAME, strerror(errno)); + exit(1); + } + + for (i = 0; optlist[i].optshort; i++) { + char *param; + char *description; + char *start; + char *end; + + if (optlist[i].optshort[0] == 0) { + printf("\n"); + continue; + } + + param = optlist[i].param; + if (param) + param = _(param); + description = optlist[i].description; + if (description) + description = _(description); + + sprintf(optbuf, "%s%s%s%s%s", /* RATS: ignore (checked) */ + optlist[i].optshort, +#ifdef HAVE_GETOPT_LONG + optlist[i].optlong ? ", " : "", + optlist[i].optlong ? optlist[i].optlong : "", +#else + "", "", +#endif + param ? " " : "", param ? param : ""); + + printf(" %-*s ", col1max - 2, optbuf); + + if (description == NULL) { + printf("\n"); + continue; + } + + start = description; + + while (strlen(start) /* RATS: ignore */ >tw - col1max) { + end = start + tw - col1max; + while ((end > start) && (end[0] != ' ')) + end--; + if (end == start) { + end = start + tw - col1max; + } else { + end++; + } + printf("%.*s\n%*s ", (int) (end - start), start, + col1max, ""); + if (end == start) + end++; + start = end; + } + + printf("%s\n", start); + } + + printf("\n"); + printf(_("Please report any bugs to %s."), /* RATS: ignore */ + BUG_REPORTS_TO); + printf("\n"); +} + +/* EOF */ diff --git a/src/main/main.c b/src/main/main.c new file mode 100644 index 0000000..04bb816 --- /dev/null +++ b/src/main/main.c @@ -0,0 +1,164 @@ +/* + * Main program entry point - read the command line options, then perform + * the appropriate actions. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "options.h" +#include "pv.h" + +/* #undef MAKE_STDOUT_NONBLOCKING */ + +#include +#include +#include +#include +#include + + +int remote_set(opts_t opts); +void remote_sig_init(opts_t opts); + + +/* + * Process command-line arguments and set option flags, then call functions + * to initialise, and finally enter the main loop. + */ +int main(int argc, char **argv) +{ + struct termios t, t_save; + opts_t opts; + int retcode = 0; + +#ifdef ENABLE_NLS + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); +#endif + + opts = opts_parse(argc, argv); + if (!opts) + return 1; + if (opts->do_nothing) { + opts_free(opts); + return 0; + } + + if (opts->remote > 0) { + if (opts->width < 0) + opts->width = 80; + if (opts->height < 0) + opts->height = 25; + if (opts->width > 999999) + opts->width = 999999; + if (opts->height > 999999) + opts->height = 999999; + if ((opts->interval != 0) && (opts->interval < 0.1)) + opts->interval = 0.1; + if (opts->interval > 600) + opts->interval = 600; + retcode = remote_set(opts); + opts_free(opts); + return retcode; + } + + /* + * If no files were given, pretend "-" was given (stdin). + */ + if (opts->argc == 0) { + opts->argv[opts->argc++] = "-"; + } + + if (opts->size == 0) { + pv_calc_total_size(opts); + } + + if (opts->size < 1) + opts->eta = 0; + + if ((isatty(STDERR_FILENO) == 0) + && (opts->force == 0) + && (opts->numeric == 0)) { + opts->no_op = 1; + } + + if (opts->width == 0) { + int tmpheight; + tmpheight = opts->height; + pv_screensize(opts); + if (tmpheight > 0) + opts->height = tmpheight; + } + + if (opts->height == 0) { + int tmpwidth; + tmpwidth = opts->width; + pv_screensize(opts); + if (tmpwidth > 0) + opts->width = tmpwidth; + } + + /* + * Width and height bounds checking (and defaults). + */ + if (opts->width < 1) + opts->width = 80; + + if (opts->height < 1) + opts->height = 25; + + if (opts->width > 999999) + opts->width = 999999; + + if (opts->height > 999999) + opts->height = 999999; + + /* + * Interval must be at least 0.1 second, and at most 10 minutes. + */ + if (opts->interval < 0.1) + opts->interval = 0.1; + if (opts->interval > 600) + opts->interval = 600; + +#ifdef MAKE_STDOUT_NONBLOCKING + /* + * Try and make standard output use non-blocking I/O. + * + * Note that this can cause problems with (broken) applications + * such as dd. + */ + fcntl(STDOUT_FILENO, F_SETFL, + O_NONBLOCK | fcntl(STDOUT_FILENO, F_GETFL)); +#endif /* MAKE_STDOUT_NONBLOCKING */ + + /* + * Set terminal option TOSTOP so we get signal SIGTTOU if we try to + * write to the terminal while backgrounded. + * + * Also, save the current terminal attributes for later restoration. + */ + tcgetattr(STDERR_FILENO, &t); + t_save = t; + t.c_lflag |= TOSTOP; + tcsetattr(STDERR_FILENO, TCSANOW, &t); + + opts->current_file = "(stdin)"; + + pv_sig_init(); + remote_sig_init(opts); + + retcode = pv_main_loop(opts); + + opts_free(opts); + + tcsetattr(STDERR_FILENO, TCSANOW, &t_save); + + return retcode; +} + +/* EOF */ diff --git a/src/main/options.c b/src/main/options.c new file mode 100644 index 0000000..3b180cf --- /dev/null +++ b/src/main/options.c @@ -0,0 +1,272 @@ +/* + * Parse command-line options. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "options.h" +#include "library/getopt.h" +#include "pv.h" + +#include +#include +#include +#include +#include + + +void display_help(void); +void display_version(void); + + +/* + * Free an opts_t object. + */ +void opts_free(opts_t opts) +{ + if (!opts) + return; + if (opts->argv) + free(opts->argv); + free(opts); +} + + +/* + * Parse the given command-line arguments into an opts_t object, handling + * "help", "license" and "version" options internally. + * + * Returns an opts_t, or 0 on error. + * + * Note that the contents of *argv[] (i.e. the command line parameters) + * aren't copied anywhere, just the pointers are copied, so make sure the + * command line data isn't overwritten or argv[1] free()d or whatever. + */ +opts_t opts_parse(int argc, char **argv) +{ +#ifdef HAVE_GETOPT_LONG + struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"version", 0, 0, 'V'}, + {"progress", 0, 0, 'p'}, + {"timer", 0, 0, 't'}, + {"eta", 0, 0, 'e'}, + {"rate", 0, 0, 'r'}, + {"average-rate", 0, 0, 'a'}, + {"bytes", 0, 0, 'b'}, + {"force", 0, 0, 'f'}, + {"numeric", 0, 0, 'n'}, + {"quiet", 0, 0, 'q'}, + {"cursor", 0, 0, 'c'}, + {"wait", 0, 0, 'W'}, + {"size", 1, 0, 's'}, + {"line-mode", 0, 0, 'l'}, + {"interval", 1, 0, 'i'}, + {"width", 1, 0, 'w'}, + {"height", 1, 0, 'H'}, + {"name", 1, 0, 'N'}, + {"rate-limit", 1, 0, 'L'}, + {"buffer-size", 1, 0, 'B'}, + {"remote", 1, 0, 'R'}, + {0, 0, 0, 0} + }; + int option_index = 0; +#endif + char *short_options = "hVpterabfnqcWs:li:w:H:N:L:B:R:"; + int c, numopts; + opts_t opts; + + opts = calloc(1, sizeof(*opts)); + if (!opts) { + fprintf(stderr, /* RATS: ignore */ + _("%s: option structure allocation failed (%s)"), + argv[0], strerror(errno)); + fprintf(stderr, "\n"); + return 0; + } + + opts->program_name = argv[0]; + + opts->argc = 0; + opts->argv = calloc(argc + 1, sizeof(char *)); + if (!opts->argv) { + fprintf(stderr, /* RATS: ignore */ + _ + ("%s: option structure argv allocation failed (%s)"), + argv[0], strerror(errno)); + fprintf(stderr, "\n"); + opts_free(opts); + return 0; + } + + numopts = 0; + + opts->interval = 1; + + do { +#ifdef HAVE_GETOPT_LONG + c = getopt_long(argc, argv, /* RATS: ignore */ + short_options, long_options, + &option_index); +#else + c = getopt(argc, argv, short_options); /* RATS: ignore */ +#endif + if (c < 0) + continue; + + /* + * Check that any numeric arguments are of the right type. + */ + switch (c) { + case 's': + case 'w': + case 'H': + case 'L': + case 'B': + case 'R': + if (pv_getnum_check(optarg, 0)) { + fprintf(stderr, "%s: -%c: %s\n", argv[0], + c, _("integer argument expected")); + opts_free(opts); + return 0; + } + break; + case 'i': + if (pv_getnum_check(optarg, 1)) { + fprintf(stderr, "%s: -%c: %s\n", argv[0], + c, _("numeric argument expected")); + opts_free(opts); + return 0; + } + break; + default: + break; + } + + /* + * Parse each command line option. + */ + switch (c) { + case 'h': + display_help(); + opts->do_nothing = 1; + return opts; + break; + case 'V': + display_version(); + opts->do_nothing = 1; + return opts; + break; + case 'p': + opts->progress = 1; + numopts++; + break; + case 't': + opts->timer = 1; + numopts++; + break; + case 'e': + opts->eta = 1; + numopts++; + break; + case 'r': + opts->rate = 1; + numopts++; + break; + case 'a': + opts->average_rate = 1; + numopts++; + break; + case 'b': + opts->bytes = 1; + numopts++; + break; + case 'f': + opts->force = 1; + break; + case 'n': + opts->numeric = 1; + numopts++; + break; + case 'q': + opts->no_op = 1; + numopts++; + break; + case 'c': + opts->cursor = 1; + break; + case 'W': + opts->wait = 1; + break; + case 's': + opts->size = pv_getnum_ll(optarg); + break; + case 'l': + opts->linemode = 1; + break; + case 'i': + opts->interval = pv_getnum_d(optarg); + break; + case 'w': + opts->width = pv_getnum_i(optarg); + break; + case 'H': + opts->height = pv_getnum_i(optarg); + break; + case 'N': + opts->name = optarg; + break; + case 'L': + opts->rate_limit = pv_getnum_ll(optarg); + break; + case 'B': + opts->buffer_size = pv_getnum_ll(optarg); + break; + case 'R': + opts->remote = pv_getnum_i(optarg); + break; + default: +#ifdef HAVE_GETOPT_LONG + fprintf(stderr, /* RATS: ignore (OK) */ + _("Try `%s --help' for more information."), + argv[0]); +#else + fprintf(stderr, /* RATS: ignore (OK) */ + _("Try `%s -h' for more information."), + argv[0]); +#endif + fprintf(stderr, "\n"); + opts_free(opts); + return 0; + break; + } + + } while (c != -1); + + /* + * Default options: -pterb + */ + if (numopts == 0) { + opts->progress = 1; + opts->timer = 1; + opts->eta = 1; + opts->rate = 1; + opts->bytes = 1; + } + + /* + * Store remaining command-line arguments. + */ + while (optind < argc) { + opts->argv[opts->argc++] = argv[optind++]; + } + + opts->exit_status = 0; + + return opts; +} + +/* EOF */ diff --git a/src/main/remote.c b/src/main/remote.c new file mode 100644 index 0000000..4be342d --- /dev/null +++ b/src/main/remote.c @@ -0,0 +1,208 @@ +/* + * Remote-control functions. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "options.h" +#include "pv.h" + +#include +#include +#include +#include +#include +#include +#include +#include + + +struct remote_msg { + long mtype; + unsigned char progress; /* progress bar flag */ + unsigned char timer; /* timer flag */ + unsigned char eta; /* ETA flag */ + unsigned char rate; /* rate counter flag */ + unsigned char average_rate; /* average rate counter flag */ + unsigned char bytes; /* bytes transferred flag */ + unsigned long long rate_limit; /* rate limit, in bytes per second */ + unsigned long long buffer_size; /* buffer size, in bytes (0=default) */ + unsigned long long size; /* total size of data */ + double interval; /* interval between updates */ + unsigned int width; /* screen width */ + unsigned int height; /* screen height */ + char name[256]; /* RATS: ignore */ +}; + + +static opts_t remote__opts = NULL; + + +/* + * Return a key for use with msgget() which will be unique to the current + * user. + * + * We can't just use ftok() because the queue needs to be user-specific + * so that a user cannot send messages to another user's process, and we + * can't easily find out the terminal a given process is connected to in a + * cross-platform way. + */ +static key_t remote__genkey(opts_t opts) +{ + int uid; + key_t key; + + uid = geteuid(); + if (uid < 0) + uid = 0; + + key = ftok("/tmp", 'P') | uid; + + return key; +} + + +/* + * Return a message queue ID that is unique to the current user and the + * given process ID, or -1 on error. + */ +static int remote__msgget(opts_t opts) +{ + return msgget(remote__genkey(opts), IPC_CREAT | 0600); +} + + +/* + * Set the options of a remote process by setting up an IPC message queue, + * sending a message containing the new options, and then sending a SIGUSR1 + * so the process knows it has a message to read. + * + * Returns nonzero on error. + */ +int remote_set(opts_t opts) +{ + struct remote_msg msgbuf; + int msgid; + + memset(&msgbuf, 0, sizeof(msgbuf)); + msgbuf.mtype = opts->remote; + msgbuf.progress = opts->progress; + msgbuf.timer = opts->timer; + msgbuf.eta = opts->eta; + msgbuf.rate = opts->rate; + msgbuf.average_rate = opts->average_rate; + msgbuf.rate_limit = opts->rate_limit; + msgbuf.buffer_size = opts->buffer_size; + msgbuf.size = opts->size; + msgbuf.interval = opts->interval; + msgbuf.width = opts->width; + msgbuf.height = opts->height; + if (opts->name != NULL) { + strncpy(msgbuf.name, opts->name, sizeof(msgbuf.name) - 1); + } + + msgid = remote__msgget(opts); + if (msgid < 0) { + fprintf(stderr, "%s: %s\n", opts->program_name, + strerror(errno)); + return 1; + } + + if (msgsnd(msgid, &msgbuf, sizeof(msgbuf) - sizeof(long), 0) != 0) { + fprintf(stderr, "%s: %s\n", opts->program_name, + strerror(errno)); + return 1; + } + + if (kill(opts->remote, SIGUSR1) != 0) { + fprintf(stderr, "%s: %s\n", opts->program_name, + strerror(errno)); + return 1; + } + + return 0; +} + + +/* + * Handle SIGUSR1 by replacing the current process's options with those + * being passed in via IPC message. The message queue is deleted afterwards. + */ +static void remote__sig_usr1(int s) +{ + struct remote_msg msgbuf; + struct msqid_ds qbuf; + ssize_t got; + int msgid; + + memset(&msgbuf, 0, sizeof(msgbuf)); + + msgid = remote__msgget(remote__opts); + if (msgid < 0) { + return; + } + + got = + msgrcv(msgid, &msgbuf, sizeof(msgbuf) - sizeof(long), getpid(), + IPC_NOWAIT); + if (got < 0) { + msgctl(msgid, IPC_RMID, &qbuf); + return; + } + + if (msgctl(msgid, IPC_RMID, &qbuf) == 0) { + if (qbuf.msg_qnum < 1) { + msgctl(msgid, IPC_RMID, &qbuf); + } + } + + if ((got < 1) || (remote__opts == NULL)) { + return; + } + + + remote__opts->progress = msgbuf.progress; + remote__opts->timer = msgbuf.timer; + remote__opts->eta = msgbuf.eta; + remote__opts->rate = msgbuf.rate; + remote__opts->average_rate = msgbuf.average_rate; + + if (msgbuf.rate_limit > 0) + remote__opts->rate_limit = msgbuf.rate_limit; + if (msgbuf.buffer_size > 0) { + remote__opts->buffer_size = msgbuf.buffer_size; + pv_set_buffer_size(msgbuf.buffer_size, 1); + } + if (msgbuf.size > 0) + remote__opts->size = msgbuf.size; + if (msgbuf.interval > 0) + remote__opts->interval = msgbuf.interval; + if (msgbuf.width > 0) + remote__opts->width = msgbuf.width; + if (msgbuf.height > 0) + remote__opts->height = msgbuf.height; + if (msgbuf.name[0] != 0) + remote__opts->name = strdup(msgbuf.name); +} + + +/* + * Initialise handling of SIGUSR1 so that remote control messages can be + * processed correctly. + */ +void remote_sig_init(opts_t opts) +{ + struct sigaction sa; + + remote__opts = opts; + + sa.sa_handler = remote__sig_usr1; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGUSR1, &sa, NULL); +} + +/* EOF */ diff --git a/src/main/version.c b/src/main/version.c new file mode 100644 index 0000000..77d0943 --- /dev/null +++ b/src/main/version.c @@ -0,0 +1,37 @@ +/* + * Output version information to stdout. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + + +/* + * Display current package version. + */ +void display_version(void) +{ + printf(_("%s %s - Copyright(C) %s %s"), /* RATS: ignore */ + PROGRAM_NAME, VERSION, COPYRIGHT_YEAR, COPYRIGHT_HOLDER); + printf("\n\n"); + printf(_("Web site: %s"), /* RATS: ignore */ + PROJECT_HOMEPAGE); + printf("\n\n"); + printf("%s", + _("This program is free software, and is being distributed " + "under the\nterms of the Artistic License 2.0.")); + printf("\n\n"); + printf("%s", + _ + ("This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.")); + printf("\n\n"); +} + +/* EOF */ diff --git a/src/nls/de.po b/src/nls/de.po new file mode 100644 index 0000000..9de208d --- /dev/null +++ b/src/nls/de.po @@ -0,0 +1,282 @@ +msgid "" +msgstr "" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-06-26 10:37+0100\n" +"Content-Type: text/plain; charset=iso-8859-15\n" +"Date: 1999-06-01 15:18:29+0100\n" +"From: Andrew Wood \n" +"Xgettext-Options: --default-domain=pkgbuild --directory=./.pkgdir --add-" +"comments --keyword=_ --keyword=N_\n" +"Files: src/getopt/getopt.c src/getopt/getopt1.c src/version.c src/main/init." +"c src/main/help.c src/main/xpmptr.c src/guts/load.c src/guts/stop.c src/guts/" +"configure.c src/guts/make.c src/guts/install.c src/guts/prefs.c src/ui/" +"generate.c src/ui/main.c src/ui/xpm.c src/ui/status.c src/ui/activate.c src/" +"ui/handlers/main.c src/ui/handlers/package.c src/ui/handlers/prefs.c src/ui/" +"handlers/dirsel.c src/ui/handlers/popup.c src/ui/handlers/help.c src/ui/" +"textout.c src/ui/report.c src/ui/callback.c src/nls/intl/bindtextdom.c src/" +"nls/intl/dcgettext.c src/nls/intl/dgettext.c src/nls/intl/finddomain.c src/" +"nls/intl/gettext.c src/nls/intl/loadmsgcat.c src/nls/intl/localealias.c src/" +"nls/intl/textdomain.c src/nls/intl-cat/cat-compat.c src/nls/intl-gett/intl-" +"compat.c\n" + +#: src/pv/file.c:178 +msgid "failed to close file" +msgstr "Datei konnte nicht geschlossen werden" + +#: src/pv/file.c:202 +msgid "failed to read file" +msgstr "Datei konnte nicht gelesen werden" + +#: src/pv/file.c:212 +msgid "failed to stat file" +msgstr "Dateiinformationen konnten nicht gelesen werden" + +#: src/pv/file.c:222 +msgid "failed to stat output file" +msgstr "Dateiinformationen für Ausgabe-Datei konnten nicht gelesen werden" + +#: src/pv/file.c:244 +msgid "input file is output file" +msgstr "Eingabe-Datei ist Ausgabe-Datei" + +#: src/pv/display.c:100 +msgid "yzafpnum kMGTPEZY" +msgstr "" + +#: src/pv/display.c:350 src/pv/transfer.c:94 +msgid "buffer allocation failed" +msgstr "Puffer konnte nicht allokiert werden" + +#: src/pv/display.c:404 +msgid "B" +msgstr "B" + +#: src/pv/display.c:432 src/pv/display.c:441 +msgid "/s" +msgstr "" + +#: src/pv/display.c:432 src/pv/display.c:441 +msgid "B/s" +msgstr "" + +#: src/pv/display.c:463 +msgid "ETA" +msgstr "ETA" + +#: src/pv/cursor.c:233 src/pv/cursor.c:249 src/pv/cursor.c:310 +msgid "failed to open terminal" +msgstr "Terminal konnte nicht geöffnet werden" + +#: src/pv/cursor.c:241 +msgid "failed to lock terminal" +msgstr "Terminal konnte nicht geöffnet werden" + +#: src/pv/transfer.c:156 +msgid "select call failed" +msgstr "select-Aufruf fehlgeschlagen" + +#: src/pv/transfer.c:204 +msgid "read failed" +msgstr "read-Aufruf fehlgeschlagen" + +#: src/pv/transfer.c:285 +msgid "write failed" +msgstr "write-Aufruf fehlgeschlagen" + +#: src/main/help.c:33 +msgid "show progress bar" +msgstr "Fortschritts-Anzeige" + +#: src/main/help.c:35 +msgid "show elapsed time" +msgstr "zeige die verstrichene Zeit an" + +#: src/main/help.c:37 +msgid "show estimated time of arrival (completion)" +msgstr "zeige die erwartete Zeit bis zum Ende an" + +#: src/main/help.c:39 +msgid "show data transfer rate counter" +msgstr "zeige die Datentransferrate an" + +#: src/main/help.c:41 +msgid "show data transfer average rate counter" +msgstr "" + +#: src/main/help.c:43 +msgid "show number of bytes transferred" +msgstr "zeige die Anzahl von Bytes, die transferiert worden sind" + +#: src/main/help.c:45 +msgid "output even if standard error is not a terminal" +msgstr "" +"Ausgabe auch dann erzwingen, wenn der Fehlerausgabe-Kanal kein Terminal ist" + +#: src/main/help.c:47 +msgid "output percentages, not visual information" +msgstr "Ausgabe von Prozent-Angaben statt visueller Darstellung" + +#: src/main/help.c:49 +msgid "do not output any transfer information at all" +msgstr "sämtliche Transferinformationen unterdrücken" + +#: src/main/help.c:51 +msgid "use cursor positioning escape sequences" +msgstr "benutze Escape-Sequenzen zur Cursor-Positionierung" + +#: src/main/help.c:53 +msgid "display nothing until first byte transferred" +msgstr "keine Ausgabe bevor das erste Byte übertragen wurde" + +#: src/main/help.c:54 +msgid "SIZE" +msgstr "" + +#: src/main/help.c:55 +msgid "set estimated data size to SIZE bytes" +msgstr "setze erwartete Daten-Länge auf SIZE Byte" + +#: src/main/help.c:57 +msgid "count lines instead of bytes" +msgstr "" + +#: src/main/help.c:58 +msgid "SEC" +msgstr "" + +#: src/main/help.c:59 +msgid "update every SEC seconds" +msgstr "aktualisiere Ausgabe nach SEC Sekunden Intervall" + +#: src/main/help.c:60 +msgid "WIDTH" +msgstr "" + +#: src/main/help.c:61 +msgid "assume terminal is WIDTH characters wide" +msgstr "setze Terminal-Breite auf WIDTH Zeichen" + +#: src/main/help.c:62 +msgid "HEIGHT" +msgstr "" + +#: src/main/help.c:63 +msgid "assume terminal is HEIGHT rows high" +msgstr "setze Terminal-Breite auf WIDTH Zeichen" + +#: src/main/help.c:64 +msgid "NAME" +msgstr "" + +#: src/main/help.c:65 +msgid "prefix visual information with NAME" +msgstr "setze den NAMEn für visuelle Darstellung" + +#: src/main/help.c:67 +msgid "RATE" +msgstr "" + +#: src/main/help.c:68 +msgid "limit transfer to RATE bytes per second" +msgstr "beschränke die Transferrate auf RATE Byte pro Sekunde" + +#: src/main/help.c:69 +msgid "BYTES" +msgstr "" + +#: src/main/help.c:70 +msgid "use a buffer size of BYTES" +msgstr "" + +#: src/main/help.c:71 +msgid "PID" +msgstr "" + +#: src/main/help.c:72 +msgid "update settings of process PID" +msgstr "" + +#: src/main/help.c:75 +msgid "show this help and exit" +msgstr "zeige diese Hilfe und beende" + +#: src/main/help.c:77 +msgid "show version information and exit" +msgstr "zeige Versionsinformationen und beende" + +#: src/main/help.c:83 +#, c-format +msgid "Usage: %s [OPTION] [FILE]..." +msgstr "Syntax: %s [OPTION] [DATEI]..." + +#: src/main/help.c:87 +msgid "" +"Concatenate FILE(s), or standard input, to standard output,\n" +"with monitoring." +msgstr "" +"Verbindet DATEI(en) oder den Standard-Eingabe-Kanal mit dem\n" +"Standard-Ausgabe-Kanal und misst den Datenstrom." + +#: src/main/help.c:174 +#, c-format +msgid "Please report any bugs to %s." +msgstr "Bitte senden Sie Fehlerberichte an %s." + +#. RATS: ignore +#: src/main/options.c:85 +#, c-format +msgid "%s: option structure allocation failed (%s)" +msgstr "%s: `option' konnte nicht allokiert werden (%s)" + +#: src/main/options.c:98 +#, c-format +msgid "%s: option structure argv allocation failed (%s)" +msgstr "%s: `option' (argv) konnte nicht allokiert werden (%s)" + +#: src/main/options.c:132 +msgid "integer argument expected" +msgstr "" + +#: src/main/options.c:140 +msgid "numeric argument expected" +msgstr "" + +#. RATS: ignore (OK) +#: src/main/options.c:234 +#, c-format +msgid "Try `%s --help' for more information." +msgstr "`%s --help' zeigt weitere Informationen an." + +#. RATS: ignore (OK) +#: src/main/options.c:238 +#, fuzzy, c-format +msgid "Try `%s -h' for more information." +msgstr "`%s -h' zeigt weitere Informationen an." + +#: src/main/version.c:19 +#, c-format +msgid "%s %s - Copyright(C) %s %s" +msgstr "%s %s - Copyright(C) %s %s" + +#: src/main/version.c:22 +#, c-format +msgid "Web site: %s" +msgstr "Web-Site: %s" + +#: src/main/version.c:26 +msgid "" +"This program is free software, and is being distributed under the\n" +"terms of the Artistic License 2.0." +msgstr "" +"Dieses Programm ist freie Software und wird unter den Bedingungen\n" +"der Artistic License verbreitet." + +#: src/main/version.c:31 +msgid "" +"This program is distributed in the hope that it will be useful,\n" +"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +msgstr "" +"Dieses Programm wird verbreitet unter der Annahme dass es nützlich ist,\n" +"aber OHNE JEGLICHE GARANTIE; insbesondere ohne der impliziten Garantie\n" +"einer MARKTGÄNGIGKEIT oder EIGNUNG ZU EINEM BESTIMMTEN ZWECK." diff --git a/src/nls/fr.po b/src/nls/fr.po new file mode 100644 index 0000000..8b16fa6 --- /dev/null +++ b/src/nls/fr.po @@ -0,0 +1,283 @@ +msgid "" +msgstr "" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-06-26 10:37+0100\n" +"Content-Type: text/plain; charset=ISO-8859-15\n" +"Date: 1999-06-01 15:18:29+0100\n" +"From: Andrew Wood \n" +"Xgettext-Options: --default-domain=pkgbuild --directory=./.pkgdir --add-" +"comments --keyword=_ --keyword=N_\n" +"Files: src/getopt/getopt.c src/getopt/getopt1.c src/version.c src/main/init." +"c src/main/help.c src/main/xpmptr.c src/guts/load.c src/guts/stop.c src/guts/" +"configure.c src/guts/make.c src/guts/install.c src/guts/prefs.c src/ui/" +"generate.c src/ui/main.c src/ui/xpm.c src/ui/status.c src/ui/activate.c src/" +"ui/handlers/main.c src/ui/handlers/package.c src/ui/handlers/prefs.c src/ui/" +"handlers/dirsel.c src/ui/handlers/popup.c src/ui/handlers/help.c src/ui/" +"textout.c src/ui/report.c src/ui/callback.c src/nls/intl/bindtextdom.c src/" +"nls/intl/dcgettext.c src/nls/intl/dgettext.c src/nls/intl/finddomain.c src/" +"nls/intl/gettext.c src/nls/intl/loadmsgcat.c src/nls/intl/localealias.c src/" +"nls/intl/textdomain.c src/nls/intl-cat/cat-compat.c src/nls/intl-gett/intl-" +"compat.c\n" + +#: src/pv/file.c:178 +msgid "failed to close file" +msgstr "la fermeture du fichier a échoué" + +#: src/pv/file.c:202 +msgid "failed to read file" +msgstr "la lecture du fichier a échoué" + +#: src/pv/file.c:212 +msgid "failed to stat file" +msgstr "échec à statuer sur le fichier" + +#: src/pv/file.c:222 +msgid "failed to stat output file" +msgstr "échec à statuer sur le fichier de sortie" + +#: src/pv/file.c:244 +msgid "input file is output file" +msgstr "fichiers d'entré et de sortie sont les mêmes" + +#: src/pv/display.c:100 +msgid "yzafpnum kMGTPEZY" +msgstr "" + +#: src/pv/display.c:350 src/pv/transfer.c:94 +msgid "buffer allocation failed" +msgstr "l'allocation de mémoire tampon a échoué" + +#: src/pv/display.c:404 +msgid "B" +msgstr "O" + +#: src/pv/display.c:432 src/pv/display.c:441 +msgid "/s" +msgstr "/s" + +#: src/pv/display.c:432 src/pv/display.c:441 +#, fuzzy +msgid "B/s" +msgstr "O/s" + +#: src/pv/display.c:463 +msgid "ETA" +msgstr "ETA" + +#: src/pv/cursor.c:233 src/pv/cursor.c:249 src/pv/cursor.c:310 +msgid "failed to open terminal" +msgstr "l'ouverture du terminal a échoué" + +#: src/pv/cursor.c:241 +msgid "failed to lock terminal" +msgstr "l'ouverture du terminal a échoué" + +#: src/pv/transfer.c:156 +msgid "select call failed" +msgstr "appel de sélection a échoué" + +#: src/pv/transfer.c:204 +msgid "read failed" +msgstr "la lecture a échoué" + +#: src/pv/transfer.c:285 +msgid "write failed" +msgstr "l'écriture a échoué" + +#: src/main/help.c:33 +msgid "show progress bar" +msgstr "affiche la barre de progression" + +#: src/main/help.c:35 +msgid "show elapsed time" +msgstr "affiche le temps écoulé" + +#: src/main/help.c:37 +msgid "show estimated time of arrival (completion)" +msgstr "affiche l'heure approximative de l'achèvement de la tâche" + +#: src/main/help.c:39 +msgid "show data transfer rate counter" +msgstr "affiche le taux de tranfert des données" + +#: src/main/help.c:41 +msgid "show data transfer average rate counter" +msgstr "" + +#: src/main/help.c:43 +msgid "show number of bytes transferred" +msgstr "affiche le nombre d'octets transférés" + +#: src/main/help.c:45 +msgid "output even if standard error is not a terminal" +msgstr "imprime vers la sortie d'erreur même si ce n'est pas un terminal" + +#: src/main/help.c:47 +msgid "output percentages, not visual information" +msgstr "imprime en pourcentage, pas les informations visuelles" + +#: src/main/help.c:49 +msgid "do not output any transfer information at all" +msgstr "n'afficher aucune information de transfert" + +#: src/main/help.c:51 +msgid "use cursor positioning escape sequences" +msgstr "utiliser les séquences d'échappements de positionnement de curseur" + +#: src/main/help.c:53 +msgid "display nothing until first byte transferred" +msgstr "ne rien afficher avant qu'au moins un octet soit tranféré" + +#: src/main/help.c:54 +msgid "SIZE" +msgstr "TAILLE" + +#: src/main/help.c:55 +msgid "set estimated data size to SIZE bytes" +msgstr "ajuste la taille estimée des données à TAILLE octets" + +#: src/main/help.c:57 +msgid "count lines instead of bytes" +msgstr "compte les lignes au lieu des octets" + +#: src/main/help.c:58 +msgid "SEC" +msgstr "SEC" + +#: src/main/help.c:59 +msgid "update every SEC seconds" +msgstr "mise-à-jour toute les SEC secondes" + +#: src/main/help.c:60 +msgid "WIDTH" +msgstr "LARGEUR" + +#: src/main/help.c:61 +msgid "assume terminal is WIDTH characters wide" +msgstr "présumer la largeur du terminal à LARGEUR caractères" + +#: src/main/help.c:62 +msgid "HEIGHT" +msgstr "HAUTEUR" + +#: src/main/help.c:63 +msgid "assume terminal is HEIGHT rows high" +msgstr "présumer la hauteur du terminal à HAUTEUR lignes" + +#: src/main/help.c:64 +msgid "NAME" +msgstr "NOM" + +#: src/main/help.c:65 +msgid "prefix visual information with NAME" +msgstr "préfixer les informations visuelles avec NOM" + +#: src/main/help.c:67 +msgid "RATE" +msgstr "TAUX" + +#: src/main/help.c:68 +msgid "limit transfer to RATE bytes per second" +msgstr "limite le taux de transfer à TAUX octets par seconde" + +#: src/main/help.c:69 +msgid "BYTES" +msgstr "OCTETS" + +#: src/main/help.c:70 +msgid "use a buffer size of BYTES" +msgstr "Utiliser une mémoire tampon de OCTETS octets" + +#: src/main/help.c:71 +msgid "PID" +msgstr "PID" + +#: src/main/help.c:72 +msgid "update settings of process PID" +msgstr "mettre-à-jour la configuration du processus PID" + +#: src/main/help.c:75 +msgid "show this help and exit" +msgstr "afficher cette aide puis quitter" + +#: src/main/help.c:77 +msgid "show version information and exit" +msgstr "afficher la version puis quitter" + +#: src/main/help.c:83 +#, c-format +msgid "Usage: %s [OPTION] [FILE]..." +msgstr "Utilisation : %s [OPTIONS] [FICHIER]..." + +#: src/main/help.c:87 +msgid "" +"Concatenate FILE(s), or standard input, to standard output,\n" +"with monitoring." +msgstr "" +"Concatène FICHIER(s), ou l'entrée standard, sur la sortie standard\n" +"avec monitorage." + +#: src/main/help.c:174 +#, c-format +msgid "Please report any bugs to %s." +msgstr "SVP rapporter touts bogues à %s." + +#. RATS: ignore +#: src/main/options.c:85 +#, c-format +msgid "%s: option structure allocation failed (%s)" +msgstr "%s: l'allocation pour la structure d'une option a echoué (%s)" + +#: src/main/options.c:98 +#, c-format +msgid "%s: option structure argv allocation failed (%s)" +msgstr "%s: l'allocation pour la structure de l'option argv a echoué (%s)" + +#: src/main/options.c:132 +msgid "integer argument expected" +msgstr "Valeur entière attendue" + +#: src/main/options.c:140 +msgid "numeric argument expected" +msgstr "Valeur numérique attendue" + +#. RATS: ignore (OK) +#: src/main/options.c:234 +#, c-format +msgid "Try `%s --help' for more information." +msgstr "Essayez `%s --help' pour plus d'information." + +#. RATS: ignore (OK) +#: src/main/options.c:238 +#, fuzzy, c-format +msgid "Try `%s -h' for more information." +msgstr "Essayez `%s -h' pour plus d'information." + +#: src/main/version.c:19 +#, c-format +msgid "%s %s - Copyright(C) %s %s" +msgstr "%s %s - Copyright(C) %s %s" + +#: src/main/version.c:22 +#, c-format +msgid "Web site: %s" +msgstr "Site Web: %s" + +#: src/main/version.c:26 +msgid "" +"This program is free software, and is being distributed under the\n" +"terms of the Artistic License 2.0." +msgstr "" +"Ce programme est un logiciel libre et est distribué sous les termes\n" +"anglophone de la Licence Artistique 2.0 (Artistic License 2.0)." + +#: src/main/version.c:31 +msgid "" +"This program is distributed in the hope that it will be useful,\n" +"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +msgstr "" +"Ce programme est distribué dans l'espoir qu'il sera utile, mais\n" +"SANS GARANTIE AUCUNE; ni même de garantie sous-entendu que le\n" +"programme soit COMMERCIALISABLE ou APPLICABLE À UNE TÂCHE\n" +"PARTICULIÈRE." diff --git a/src/nls/pl.po b/src/nls/pl.po new file mode 100644 index 0000000..abe621c --- /dev/null +++ b/src/nls/pl.po @@ -0,0 +1,320 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-06-26 10:37+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Transfer-Encoding: 8bit\n" + +# "Przewidywany czas ukoñczenia" for ETA is too long +#: src/pv/file.c:178 +msgid "failed to close file" +msgstr "nie uda³o siê zamkn±æ pliku" + +#: src/pv/file.c:202 +msgid "failed to read file" +msgstr "nie uda³o siê odczytaæ pliku" + +#: src/pv/file.c:212 +msgid "failed to stat file" +msgstr "nie uda³o siê wykonaæ operacji stat na pliku" + +#: src/pv/file.c:222 +msgid "failed to stat output file" +msgstr "nie uda³o siê wykonaæ operacji stat na pliku wyj¶ciowym" + +#: src/pv/file.c:244 +msgid "input file is output file" +msgstr "plik wej¶ciowy jest zarazem plikiem wyj¶ciowym" + +#: src/pv/display.c:100 +msgid "yzafpnum kMGTPEZY" +msgstr "" + +#: src/pv/display.c:350 src/pv/transfer.c:94 +msgid "buffer allocation failed" +msgstr "nie uda³o siê zaalokowaæ bufora" + +#: src/pv/display.c:404 +msgid "B" +msgstr "B" + +#: src/pv/display.c:432 src/pv/display.c:441 +msgid "/s" +msgstr "/s" + +#: src/pv/display.c:432 src/pv/display.c:441 +msgid "B/s" +msgstr "B/s" + +#: src/pv/display.c:463 +msgid "ETA" +msgstr "ETA" + +#: src/pv/cursor.c:233 src/pv/cursor.c:249 src/pv/cursor.c:310 +msgid "failed to open terminal" +msgstr "nie uda³o siê otworzyæ terminala" + +#: src/pv/cursor.c:241 +msgid "failed to lock terminal" +msgstr "nie uda³o siê otworzyæ terminala" + +#: src/pv/transfer.c:156 +msgid "select call failed" +msgstr "nie uda³o siê wywo³aæ funkcji select" + +#: src/pv/transfer.c:204 +msgid "read failed" +msgstr "b³±d odczytu" + +#: src/pv/transfer.c:285 +msgid "write failed" +msgstr "b³±d zapisu" + +#: src/main/help.c:33 +msgid "show progress bar" +msgstr "poka¿ pasek postêpu" + +#: src/main/help.c:35 +msgid "show elapsed time" +msgstr "poka¿ up³ywaj±cy czas" + +#: src/main/help.c:37 +msgid "show estimated time of arrival (completion)" +msgstr "poka¿ szacowany czas ukoñczenia" + +#: src/main/help.c:39 +msgid "show data transfer rate counter" +msgstr "poka¿ licznik prêdko¶ci przesy³ania" + +#: src/main/help.c:41 +msgid "show data transfer average rate counter" +msgstr "" + +#: src/main/help.c:43 +msgid "show number of bytes transferred" +msgstr "poka¿ ilo¶æ przes³anych bajtów" + +#: src/main/help.c:45 +msgid "output even if standard error is not a terminal" +msgstr "poka¿ wyj¶cie nawet gdy b³êdy nie s± typu terminal" + +#: src/main/help.c:47 +msgid "output percentages, not visual information" +msgstr "w¶wietl wyj¶cie procentowo, bez graficznej prezentacji" + +#: src/main/help.c:49 +msgid "do not output any transfer information at all" +msgstr "nie wy¶wietlaj ¿adnych informacji o przesy³aniu" + +#: src/main/help.c:51 +msgid "use cursor positioning escape sequences" +msgstr "u¿ywaj sekwencji escape do pozycjonowania" + +#: src/main/help.c:53 +msgid "display nothing until first byte transferred" +msgstr "nie wy¶wietlaj nic a¿ do pierwszego przes³anego bajtu" + +#: src/main/help.c:54 +msgid "SIZE" +msgstr "WARTO¦Æ" + +#: src/main/help.c:55 +msgid "set estimated data size to SIZE bytes" +msgstr "ustaw oczekiwany rozmiar danych na WARTO¦Æ bajtów" + +#: src/main/help.c:57 +msgid "count lines instead of bytes" +msgstr "" + +#: src/main/help.c:58 +msgid "SEC" +msgstr "WARTO¦Æ" + +#: src/main/help.c:59 +msgid "update every SEC seconds" +msgstr "aktualizuj co ka¿de WARTO¦Æ sekund" + +#: src/main/help.c:60 +msgid "WIDTH" +msgstr "WARTO¦Æ" + +#: src/main/help.c:61 +msgid "assume terminal is WIDTH characters wide" +msgstr "przyjmij, ¿e terminal ma szeroko¶æ WARTO¦Æ znaków" + +#: src/main/help.c:62 +msgid "HEIGHT" +msgstr "" + +#: src/main/help.c:63 +msgid "assume terminal is HEIGHT rows high" +msgstr "przyjmij, ¿e terminal ma szeroko¶æ WARTO¦Æ znaków" + +#: src/main/help.c:64 +msgid "NAME" +msgstr "NAZWA" + +#: src/main/help.c:65 +msgid "prefix visual information with NAME" +msgstr "poprzed¼ informacje prefiksem NAZWA" + +#: src/main/help.c:67 +msgid "RATE" +msgstr "" + +#: src/main/help.c:68 +msgid "limit transfer to RATE bytes per second" +msgstr "ogranicz przesy³ane dane do RATE bajtów na sekundê" + +#: src/main/help.c:69 +msgid "BYTES" +msgstr "" + +#: src/main/help.c:70 +msgid "use a buffer size of BYTES" +msgstr "" + +#: src/main/help.c:71 +msgid "PID" +msgstr "" + +#: src/main/help.c:72 +msgid "update settings of process PID" +msgstr "" + +#: src/main/help.c:75 +msgid "show this help and exit" +msgstr "wy¶wietl te informacje z pomoc± i wyjd¼" + +#: src/main/help.c:77 +msgid "show version information and exit" +msgstr "wy¶wietl informacje o wersji i wyjd¼" + +#: src/main/help.c:83 +#, c-format +msgid "Usage: %s [OPTION] [FILE]..." +msgstr "Sposób u¿ycia: %s [OPCJA] [PLIK]..." + +#: src/main/help.c:87 +msgid "" +"Concatenate FILE(s), or standard input, to standard output,\n" +"with monitoring." +msgstr "" +"£±czenie PLIK(ów) lub wej¶cia standardowego, do wyj¶cia standardowego\n" +"z monitoringiem." + +#: src/main/help.c:174 +#, c-format +msgid "Please report any bugs to %s." +msgstr "Proszê przesy³aæ zg³oszenia b³êdów do %s." + +#. RATS: ignore +#: src/main/options.c:85 +#, c-format +msgid "%s: option structure allocation failed (%s)" +msgstr "%s: nie uda³o siê zaalokowaæ struktur opcji (%s)" + +#: src/main/options.c:98 +#, c-format +msgid "%s: option structure argv allocation failed (%s)" +msgstr "%s: nie uda³o siê zaalokowaæ struktur opcji argv (%s)" + +#: src/main/options.c:132 +msgid "integer argument expected" +msgstr "" + +#: src/main/options.c:140 +msgid "numeric argument expected" +msgstr "" + +#. RATS: ignore (OK) +#: src/main/options.c:234 +#, c-format +msgid "Try `%s --help' for more information." +msgstr "Spróbuj `%s --help' by uzyskaæ wiêcej informacji" + +#. RATS: ignore (OK) +#: src/main/options.c:238 +#, fuzzy, c-format +msgid "Try `%s -h' for more information." +msgstr "Spróbuj `%s -h' by uzyskaæ wiêcej informacji" + +#: src/main/version.c:19 +#, c-format +msgid "%s %s - Copyright(C) %s %s" +msgstr "%s %s - Prawa autorskie (C) %s %s" + +#: src/main/version.c:22 +#, c-format +msgid "Web site: %s" +msgstr "Strona WWW: %s" + +#: src/main/version.c:26 +msgid "" +"This program is free software, and is being distributed under the\n" +"terms of the Artistic License 2.0." +msgstr "" + +#: src/main/version.c:31 +msgid "" +"This program is distributed in the hope that it will be useful,\n" +"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +msgstr "" + +#~ msgid "G" +#~ msgstr "GB" + +#~ msgid "M" +#~ msgstr "MB" + +#~ msgid "k" +#~ msgstr "kB" + +#~ msgid "GB" +#~ msgstr "GB" + +#~ msgid "MB" +#~ msgstr "MB" + +#~ msgid "kB" +#~ msgstr "kB" + +#~ msgid "M/s" +#~ msgstr "MB/s" + +#~ msgid "k/s" +#~ msgstr "kB/s" + +#~ msgid "/s " +#~ msgstr "B/s" + +#~ msgid "GB/s" +#~ msgstr "GB/s" + +#~ msgid "MB/s" +#~ msgstr "MB/s" + +#~ msgid "kB/s" +#~ msgstr "kB/s" + +#~ msgid "For more information, please run `%s --license'." +#~ msgstr "By uzyskaæ wiêcej informacji wprowad¼ `%s --license'." + +#~ msgid "For more information, please run `%s -l'." +#~ msgstr "By uzyskaæ wiêcej informacji wprowad¼ `%s -l'." + +#~ msgid "show the license this program is distributed under" +#~ msgstr "wy¶wietl informacje o licencji pod któr± program jest rozprowadzany" + +#~ msgid "%s %s - Copyright (C) %s %s" +#~ msgstr "%s %s - Prawa autorskie (C) %s %s" diff --git a/src/nls/pt.po b/src/nls/pt.po new file mode 100644 index 0000000..46ccb43 --- /dev/null +++ b/src/nls/pt.po @@ -0,0 +1,276 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-06-26 10:37+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-15\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/pv/file.c:178 +msgid "failed to close file" +msgstr "erro fechando o arquivo" + +#: src/pv/file.c:202 +msgid "failed to read file" +msgstr "erro lendo o arquivo" + +#: src/pv/file.c:212 +msgid "failed to stat file" +msgstr "erro obtendo informações do arquivo" + +#: src/pv/file.c:222 +msgid "failed to stat output file" +msgstr "erro obtendo informações do arquivo de saída" + +#: src/pv/file.c:244 +msgid "input file is output file" +msgstr "os arquivos de entrada e saída são o mesmo" + +#: src/pv/display.c:100 +msgid "yzafpnum kMGTPEZY" +msgstr "" + +#: src/pv/display.c:350 src/pv/transfer.c:94 +msgid "buffer allocation failed" +msgstr "erro alocando o buffer" + +#: src/pv/display.c:404 +msgid "B" +msgstr "" + +#: src/pv/display.c:432 src/pv/display.c:441 +msgid "/s" +msgstr "" + +#: src/pv/display.c:432 src/pv/display.c:441 +msgid "B/s" +msgstr "B/s" + +#: src/pv/display.c:463 +msgid "ETA" +msgstr "ETA" + +#: src/pv/cursor.c:233 src/pv/cursor.c:249 src/pv/cursor.c:310 +msgid "failed to open terminal" +msgstr "erro abrindo o terminal" + +#: src/pv/cursor.c:241 +msgid "failed to lock terminal" +msgstr "erro abrindo o terminal" + +#: src/pv/transfer.c:156 +msgid "select call failed" +msgstr "erro na chamada da função select" + +#: src/pv/transfer.c:204 +msgid "read failed" +msgstr "erro de leitura" + +#: src/pv/transfer.c:285 +msgid "write failed" +msgstr "erro de gravação" + +#: src/main/help.c:33 +msgid "show progress bar" +msgstr "exibe barra de progressão" + +#: src/main/help.c:35 +msgid "show elapsed time" +msgstr "exibe tempo passado" + +#: src/main/help.c:37 +msgid "show estimated time of arrival (completion)" +msgstr "exibe o tempo estimado de término" + +#: src/main/help.c:39 +msgid "show data transfer rate counter" +msgstr "exibe a taxa de transferência" + +#: src/main/help.c:41 +msgid "show data transfer average rate counter" +msgstr "" + +#: src/main/help.c:43 +msgid "show number of bytes transferred" +msgstr "exibe a quantidade de bytes transferidos" + +#: src/main/help.c:45 +msgid "output even if standard error is not a terminal" +msgstr "gera dados mesmo que a saída de erro seja redirecionada" + +#: src/main/help.c:47 +msgid "output percentages, not visual information" +msgstr "exibe apenas as porcentagens, sem informações visuais" + +#: src/main/help.c:49 +msgid "do not output any transfer information at all" +msgstr "executa programa sem exibir quaisquer informações" + +#: src/main/help.c:51 +msgid "use cursor positioning escape sequences" +msgstr "utiliza caracteres de escape para posicionar o cursor" + +#: src/main/help.c:53 +msgid "display nothing until first byte transferred" +msgstr "não exibe nada até iniciar o processamento" + +#: src/main/help.c:54 +msgid "SIZE" +msgstr "" + +#: src/main/help.c:55 +msgid "set estimated data size to SIZE bytes" +msgstr "seta a quantidade estimada de dados em SIZE bytes" + +#: src/main/help.c:57 +msgid "count lines instead of bytes" +msgstr "" + +#: src/main/help.c:58 +msgid "SEC" +msgstr "" + +#: src/main/help.c:59 +msgid "update every SEC seconds" +msgstr "atualiza informações a cada SEC segundos" + +#: src/main/help.c:60 +msgid "WIDTH" +msgstr "" + +#: src/main/help.c:61 +msgid "assume terminal is WIDTH characters wide" +msgstr "assume que terminal possui WIDTH caracteres de largura" + +#: src/main/help.c:62 +msgid "HEIGHT" +msgstr "" + +#: src/main/help.c:63 +msgid "assume terminal is HEIGHT rows high" +msgstr "assume que terminal possui WIDTH caracteres de largura" + +#: src/main/help.c:64 +msgid "NAME" +msgstr "" + +#: src/main/help.c:65 +msgid "prefix visual information with NAME" +msgstr "exibe NAME antes das demais informações" + +#: src/main/help.c:67 +msgid "RATE" +msgstr "" + +#: src/main/help.c:68 +msgid "limit transfer to RATE bytes per second" +msgstr "limita a transferência a RATE bytes por segundo" + +#: src/main/help.c:69 +msgid "BYTES" +msgstr "" + +#: src/main/help.c:70 +msgid "use a buffer size of BYTES" +msgstr "" + +#: src/main/help.c:71 +msgid "PID" +msgstr "" + +#: src/main/help.c:72 +msgid "update settings of process PID" +msgstr "" + +#: src/main/help.c:75 +msgid "show this help and exit" +msgstr "exibe esta tela de ajuda e termina" + +#: src/main/help.c:77 +msgid "show version information and exit" +msgstr "exibe a versão e termina" + +#: src/main/help.c:83 +#, c-format +msgid "Usage: %s [OPTION] [FILE]..." +msgstr "Uso: %s [OPÇÕES] [ARQUIVOS]..." + +#: src/main/help.c:87 +msgid "" +"Concatenate FILE(s), or standard input, to standard output,\n" +"with monitoring." +msgstr "" +"Concatena ARQUIVO(s) ou a entrada padrão e grava na saída padrão,\n" +"com monitoramento." + +#: src/main/help.c:174 +#, c-format +msgid "Please report any bugs to %s." +msgstr "Por favor, reporte quaisquer defeitos para %s." + +#. RATS: ignore +#: src/main/options.c:85 +#, c-format +msgid "%s: option structure allocation failed (%s)" +msgstr "%s: erro na alocação da estrutura de opções (%s)" + +#: src/main/options.c:98 +#, c-format +msgid "%s: option structure argv allocation failed (%s)" +msgstr "%s: erro na alocação da estrutura de opções argv (%s)" + +#: src/main/options.c:132 +msgid "integer argument expected" +msgstr "" + +#: src/main/options.c:140 +msgid "numeric argument expected" +msgstr "" + +#. RATS: ignore (OK) +#: src/main/options.c:234 +#, c-format +msgid "Try `%s --help' for more information." +msgstr "Tente `%s --help' para maiores informações." + +#. RATS: ignore (OK) +#: src/main/options.c:238 +#, fuzzy, c-format +msgid "Try `%s -h' for more information." +msgstr "Tente `%s -h' para maiores informações." + +#: src/main/version.c:19 +#, c-format +msgid "%s %s - Copyright(C) %s %s" +msgstr "%s %s - Copyright(C) %s %s" + +#: src/main/version.c:22 +#, c-format +msgid "Web site: %s" +msgstr "Site: %s" + +#: src/main/version.c:26 +msgid "" +"This program is free software, and is being distributed under the\n" +"terms of the Artistic License 2.0." +msgstr "" +"Este programa é um software livre, distribuído sob os termos da\n" +"Licença Artística." + +#: src/main/version.c:31 +msgid "" +"This program is distributed in the hope that it will be useful,\n" +"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +msgstr "" +"Este programa é distribuído com o intuito de que seja útil,\n" +"porém SEM QUAISQUER GARANTIAS; sem inclusive as garantias implícitas de\n" +"COMERCIALIZAÇÃO e ADEQUAÇÃO A OBJETIVOS PARTICULARES." diff --git a/src/nls/pv.pot b/src/nls/pv.pot new file mode 100644 index 0000000..6947454 --- /dev/null +++ b/src/nls/pv.pot @@ -0,0 +1,271 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-06-26 10:37+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/pv/file.c:178 +msgid "failed to close file" +msgstr "" + +#: src/pv/file.c:202 +msgid "failed to read file" +msgstr "" + +#: src/pv/file.c:212 +msgid "failed to stat file" +msgstr "" + +#: src/pv/file.c:222 +msgid "failed to stat output file" +msgstr "" + +#: src/pv/file.c:244 +msgid "input file is output file" +msgstr "" + +#: src/pv/display.c:100 +msgid "yzafpnum kMGTPEZY" +msgstr "" + +#: src/pv/display.c:350 src/pv/transfer.c:94 +msgid "buffer allocation failed" +msgstr "" + +#: src/pv/display.c:404 +msgid "B" +msgstr "" + +#: src/pv/display.c:432 src/pv/display.c:441 +msgid "/s" +msgstr "" + +#: src/pv/display.c:432 src/pv/display.c:441 +msgid "B/s" +msgstr "" + +#: src/pv/display.c:463 +msgid "ETA" +msgstr "" + +#: src/pv/cursor.c:233 src/pv/cursor.c:249 src/pv/cursor.c:310 +msgid "failed to open terminal" +msgstr "" + +#: src/pv/cursor.c:241 +msgid "failed to lock terminal" +msgstr "" + +#: src/pv/transfer.c:156 +msgid "select call failed" +msgstr "" + +#: src/pv/transfer.c:204 +msgid "read failed" +msgstr "" + +#: src/pv/transfer.c:285 +msgid "write failed" +msgstr "" + +#: src/main/help.c:33 +msgid "show progress bar" +msgstr "" + +#: src/main/help.c:35 +msgid "show elapsed time" +msgstr "" + +#: src/main/help.c:37 +msgid "show estimated time of arrival (completion)" +msgstr "" + +#: src/main/help.c:39 +msgid "show data transfer rate counter" +msgstr "" + +#: src/main/help.c:41 +msgid "show data transfer average rate counter" +msgstr "" + +#: src/main/help.c:43 +msgid "show number of bytes transferred" +msgstr "" + +#: src/main/help.c:45 +msgid "output even if standard error is not a terminal" +msgstr "" + +#: src/main/help.c:47 +msgid "output percentages, not visual information" +msgstr "" + +#: src/main/help.c:49 +msgid "do not output any transfer information at all" +msgstr "" + +#: src/main/help.c:51 +msgid "use cursor positioning escape sequences" +msgstr "" + +#: src/main/help.c:53 +msgid "display nothing until first byte transferred" +msgstr "" + +#: src/main/help.c:54 +msgid "SIZE" +msgstr "" + +#: src/main/help.c:55 +msgid "set estimated data size to SIZE bytes" +msgstr "" + +#: src/main/help.c:57 +msgid "count lines instead of bytes" +msgstr "" + +#: src/main/help.c:58 +msgid "SEC" +msgstr "" + +#: src/main/help.c:59 +msgid "update every SEC seconds" +msgstr "" + +#: src/main/help.c:60 +msgid "WIDTH" +msgstr "" + +#: src/main/help.c:61 +msgid "assume terminal is WIDTH characters wide" +msgstr "" + +#: src/main/help.c:62 +msgid "HEIGHT" +msgstr "" + +#: src/main/help.c:63 +msgid "assume terminal is HEIGHT rows high" +msgstr "" + +#: src/main/help.c:64 +msgid "NAME" +msgstr "" + +#: src/main/help.c:65 +msgid "prefix visual information with NAME" +msgstr "" + +#: src/main/help.c:67 +msgid "RATE" +msgstr "" + +#: src/main/help.c:68 +msgid "limit transfer to RATE bytes per second" +msgstr "" + +#: src/main/help.c:69 +msgid "BYTES" +msgstr "" + +#: src/main/help.c:70 +msgid "use a buffer size of BYTES" +msgstr "" + +#: src/main/help.c:71 +msgid "PID" +msgstr "" + +#: src/main/help.c:72 +msgid "update settings of process PID" +msgstr "" + +#: src/main/help.c:75 +msgid "show this help and exit" +msgstr "" + +#: src/main/help.c:77 +msgid "show version information and exit" +msgstr "" + +#: src/main/help.c:83 +#, c-format +msgid "Usage: %s [OPTION] [FILE]..." +msgstr "" + +#: src/main/help.c:87 +msgid "" +"Concatenate FILE(s), or standard input, to standard output,\n" +"with monitoring." +msgstr "" + +#: src/main/help.c:174 +#, c-format +msgid "Please report any bugs to %s." +msgstr "" + +#. RATS: ignore +#: src/main/options.c:85 +#, c-format +msgid "%s: option structure allocation failed (%s)" +msgstr "" + +#: src/main/options.c:98 +#, c-format +msgid "%s: option structure argv allocation failed (%s)" +msgstr "" + +#: src/main/options.c:132 +msgid "integer argument expected" +msgstr "" + +#: src/main/options.c:140 +msgid "numeric argument expected" +msgstr "" + +#. RATS: ignore (OK) +#: src/main/options.c:234 +#, c-format +msgid "Try `%s --help' for more information." +msgstr "" + +#. RATS: ignore (OK) +#: src/main/options.c:238 +#, c-format +msgid "Try `%s -h' for more information." +msgstr "" + +#: src/main/version.c:19 +#, c-format +msgid "%s %s - Copyright(C) %s %s" +msgstr "" + +#: src/main/version.c:22 +#, c-format +msgid "Web site: %s" +msgstr "" + +#: src/main/version.c:26 +msgid "" +"This program is free software, and is being distributed under the\n" +"terms of the Artistic License 2.0." +msgstr "" + +#: src/main/version.c:31 +msgid "" +"This program is distributed in the hope that it will be useful,\n" +"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." +msgstr "" diff --git a/src/pv/cursor.c b/src/pv/cursor.c new file mode 100644 index 0000000..0c6fc5b --- /dev/null +++ b/src/pv/cursor.c @@ -0,0 +1,515 @@ +/* + * Cursor positioning functions. + * + * If IPC is available, then a shared memory segment is used to co-ordinate + * cursor positioning across multiple instances of `pv'. The shared memory + * segment contains an integer which is the original "y" co-ordinate of the + * first `pv' process. + * + * However, some OSes (FreeBSD and MacOS X so far) don't allow locking of a + * terminal, so we try to use a lockfile if terminal locking doesn't work, + * and finally abort if even that is unavailable. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#include "options.h" +#include "pv.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef HAVE_IPC +#include +#include +#include +# ifdef HAVE_SYS_PARAM_H +# include +# endif +# ifdef HAVE_LIBGEN_H +# include +# endif +#endif /* HAVE_IPC */ + + +#ifdef HAVE_IPC +static int pv_crs__shmid = -1; /* ID of our shared memory segment */ +static int pv_crs__pvcount = 1; /* number of `pv' processes in total */ +static int pv_crs__pvmax = 0; /* highest number of `pv's seen */ +static int *pv_crs__y_top = 0; /* pointer to Y coord of topmost `pv' */ +static int pv_crs__y_lastread = 0; /* last value of __y_top seen */ +static int pv_crs__y_offset = 0; /* our Y offset from this top position */ +static int pv_crs__needreinit = 0; /* set if we need to reinit cursor pos */ +static int pv_crs__noipc = 0; /* set if we can't use IPC */ +#endif /* HAVE_IPC */ +static int pv_crs__uselockfile = 0; /* set if we used a lockfile */ +static int pv_crs__lock_fd = -1; /* fd of lockfile, -1 if none open */ +static int pv_crs__y_start = 0; /* our initial Y coordinate */ + + +/* + * Lock the terminal on the given file descriptor by creating and locking a + * per-euid, per-tty, lockfile in ${TMPDIR:-${TMP:-/tmp}}. + */ +static void pv_crs__lock_lockfile(int fd) +{ +#ifdef O_EXLOCK + char *ttydev; + char *tmpdir; +#ifndef MAXPATHLEN +#define MAXPATHLEN 4096 +#endif + char lockfile[MAXPATHLEN + 1]; /* RATS: ignore */ + + pv_crs__uselockfile = 1; + + ttydev = ttyname(fd); /* RATS: ignore */ + if (!ttydev) { +#ifdef HAVE_IPC + pv_crs__noipc = 1; +#endif + return; + } + + tmpdir = (char *) getenv("TMPDIR"); /* RATS: ignore */ + if (!tmpdir) + tmpdir = (char *) getenv("TMP"); /* RATS: ignore */ + if (!tmpdir) + tmpdir = "/tmp"; + +#ifdef HAVE_SNPRINTF + snprintf(lockfile, MAXPATHLEN, "%s/pv-%s-%i.lock", + tmpdir, basename(ttydev), geteuid()); +#else + sprintf(lockfile, /* RATS: ignore */ + "%.*s/pv-%8s-%i.lock", + MAXPATHLEN - 64, tmpdir, basename(ttydev), geteuid()); +#endif + + pv_crs__lock_fd = + open(lockfile, O_RDWR | O_EXLOCK | O_CREAT | O_NOFOLLOW, 0600); +#ifdef HAVE_IPC + if (pv_crs__lock_fd < 0) + pv_crs__noipc = 1; +#endif + +#else /* !O_EXLOCK */ + + pv_crs__uselockfile = 1; +#ifdef HAVE_IPC + pv_crs__noipc = 1; +#endif + +#endif /* O_EXLOCK */ +} + + +/* + * Lock the terminal on the given file descriptor, falling back to using a + * lockfile if the terminal itself cannot be locked. + */ +static void pv_crs__lock(int fd) +{ + struct flock lock; + + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 1; + while (fcntl(fd, F_SETLKW, &lock) < 0) { + if (errno != EINTR) { + pv_crs__lock_lockfile(fd); + return; + } + } +} + + +/* + * Unlock the terminal on the given file descriptor. If pv_crs__lock used + * lockfile locking, unlock the lockfile. + */ +static void pv_crs__unlock(int fd) +{ + struct flock lock; + + if (pv_crs__uselockfile) { + if (pv_crs__lock_fd >= 0) + close(pv_crs__lock_fd); + pv_crs__lock_fd = -1; + } else { + lock.l_type = F_UNLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 1; + fcntl(fd, F_SETLK, &lock); + } +} + + +#ifdef HAVE_IPC +/* + * Get the current number of processes attached to our shared memory + * segment, i.e. find out how many `pv' processes in total are running in + * cursor mode (including us), and store it in pv_crs__pvcount. If this is + * larger than pv_crs__pvmax, update pv_crs__pvmax. + */ +static void pv_crs__ipccount(void) +{ + struct shmid_ds buf; + + buf.shm_nattch = 0; + + shmctl(pv_crs__shmid, IPC_STAT, &buf); + pv_crs__pvcount = buf.shm_nattch; + + if (pv_crs__pvcount > pv_crs__pvmax) + pv_crs__pvmax = pv_crs__pvcount; +} +#endif /* HAVE_IPC */ + + +/* + * Get the current cursor Y co-ordinate by sending the ECMA-48 CPR code to + * the terminal connected to the given file descriptor. + */ +static int pv_crs__get_ypos(int terminalfd) +{ + struct termios tty; + struct termios old_tty; + char cpr[32]; /* RATS: ignore (checked) */ + int ypos; + + tcgetattr(terminalfd, &tty); + tcgetattr(terminalfd, &old_tty); + tty.c_lflag &= ~(ICANON | ECHO); + tcsetattr(terminalfd, TCSANOW | TCSAFLUSH, &tty); + write(terminalfd, "\033[6n", 4); + memset(cpr, 0, sizeof(cpr)); + read(terminalfd, cpr, 6); /* RATS: ignore (OK) */ + ypos = pv_getnum_i(cpr + 2); + tcsetattr(terminalfd, TCSANOW | TCSAFLUSH, &old_tty); + + return ypos; +} + + +#ifdef HAVE_IPC +/* + * Initialise the IPC data, returning nonzero on error. + * + * To do this, we attach to the shared memory segment (creating it if it + * does not exist). If we are the only process attached to it, then we + * initialise it with the current cursor position. + * + * There is a race condition here: another process could attach before we've + * had a chance to check, such that no process ends up getting an "attach + * count" of one, and so no initialisation occurs. So, we lock the terminal + * with pv_crs__lock() while we are attaching and checking. + */ +static int pv_crs__ipcinit(opts_t opts, char *ttyfile, int terminalfd) +{ + key_t key; + + /* + * Base the key for the shared memory segment on our current tty, so + * we don't end up interfering in any way with instances of `pv' + * running on another terminal. + */ + key = ftok(ttyfile, 'p'); + if (key == -1) { + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, + _("failed to open terminal"), strerror(errno)); + return 1; + } + + pv_crs__lock(terminalfd); + if (pv_crs__noipc) { + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, + _("failed to lock terminal"), strerror(errno)); + return 1; + } + + pv_crs__shmid = shmget(key, sizeof(int), 0600 | IPC_CREAT); + if (pv_crs__shmid < 0) { + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, + _("failed to open terminal"), strerror(errno)); + pv_crs__unlock(terminalfd); + return 1; + } + + pv_crs__y_top = shmat(pv_crs__shmid, 0, 0); + + pv_crs__ipccount(); + + /* + * If nobody else is attached to the shared memory segment, we're + * the first, so we need to initialise the shared memory with our + * current Y cursor co-ordinate. + */ + if (pv_crs__pvcount < 2) { + pv_crs__y_start = pv_crs__get_ypos(terminalfd); + *pv_crs__y_top = pv_crs__y_start; + pv_crs__y_lastread = pv_crs__y_start; + } + + pv_crs__y_offset = pv_crs__pvcount - 1; + if (pv_crs__y_offset < 0) + pv_crs__y_offset = 0; + + /* + * If anyone else had attached to the shared memory segment, we need + * to read the top Y co-ordinate from it. + */ + if (pv_crs__pvcount > 1) { + pv_crs__y_start = *pv_crs__y_top; + pv_crs__y_lastread = pv_crs__y_start; + } + + pv_crs__unlock(terminalfd); + + return 0; +} +#endif /* HAVE_IPC */ + + +/* + * Initialise the terminal for cursor positioning. + */ +void pv_crs_init(opts_t opts) +{ + char *ttyfile; + int fd; + + if (!opts->cursor) + return; + + ttyfile = ttyname(STDERR_FILENO); /* RATS: ignore (unimportant) */ + if (!ttyfile) { + opts->cursor = 0; + return; + } + + fd = open(ttyfile, O_RDWR); /* RATS: ignore (no race) */ + if (fd < 0) { + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, + _("failed to open terminal"), strerror(errno)); + opts->cursor = 0; + return; + } +#ifdef HAVE_IPC + if (pv_crs__ipcinit(opts, ttyfile, fd)) { + opts->cursor = 0; + close(fd); + return; + } + + /* + * If we are not using IPC, then we need to get the current Y + * co-ordinate. If we are using IPC, then the pv_crs__ipcinit() + * function takes care of this in a more multi-process-friendly way. + */ + if (pv_crs__noipc) { +#else /* ! HAVE_IPC */ + if (1) { +#endif /* HAVE_IPC */ + /* + * Get current cursor position + 1. + */ + pv_crs__lock(fd); + pv_crs__y_start = pv_crs__get_ypos(fd); + pv_crs__unlock(fd); + + if (pv_crs__y_start < 1) + opts->cursor = 0; + } + + close(fd); +} + + +#ifdef HAVE_IPC +/* + * Set the "we need to reinitialise cursor positioning" flag. + */ +void pv_crs_needreinit(void) +{ + pv_crs__needreinit += 2; + if (pv_crs__needreinit > 3) + pv_crs__needreinit = 3; +} +#endif + + +#ifdef HAVE_IPC +/* + * Reinitialise the cursor positioning code (called if we are backgrounded + * then foregrounded again). + */ +void pv_crs_reinit(void) +{ + pv_crs__lock(STDERR_FILENO); + + pv_crs__needreinit--; + if (pv_crs__y_offset < 1) + pv_crs__needreinit = 0; + + if (pv_crs__needreinit > 0) { + pv_crs__unlock(STDERR_FILENO); + return; + } + + pv_crs__y_start = pv_crs__get_ypos(STDERR_FILENO); + + if (pv_crs__y_offset < 1) + *pv_crs__y_top = pv_crs__y_start; + pv_crs__y_lastread = pv_crs__y_start; + + pv_crs__unlock(STDERR_FILENO); +} +#endif + + +/* + * Output a single-line update, moving the cursor to the correct position to + * do so. + */ +void pv_crs_update(opts_t opts, char *str) +{ + char pos[32]; /* RATS: ignore (checked OK) */ + int y; + +#ifdef HAVE_IPC + if (!pv_crs__noipc) { + if (pv_crs__needreinit) + pv_crs_reinit(); + + pv_crs__ipccount(); + if (pv_crs__y_lastread != *pv_crs__y_top) { + pv_crs__y_start = *pv_crs__y_top; + pv_crs__y_lastread = pv_crs__y_start; + } + + if (pv_crs__needreinit > 0) + return; + } +#endif /* HAVE_IPC */ + + y = pv_crs__y_start; + +#ifdef HAVE_IPC + /* + * If the screen has scrolled, or is about to scroll, due to + * multiple `pv' instances taking us near the bottom of the screen, + * scroll the screen (only if we're the first `pv'), and then move + * our initial Y co-ordinate up. + */ + if (((pv_crs__y_start + pv_crs__pvmax) > opts->height) + && (!pv_crs__noipc) + ) { + int offs; + + offs = ((pv_crs__y_start + pv_crs__pvmax) - opts->height); + + pv_crs__y_start -= offs; + if (pv_crs__y_start < 1) + pv_crs__y_start = 1; + + /* + * Scroll the screen if we're the first `pv'. + */ + if (pv_crs__y_offset == 0) { + pv_crs__lock(STDERR_FILENO); + + sprintf(pos, "\033[%d;1H", opts->height); + write(STDERR_FILENO, pos, strlen(pos)); + for (; offs > 0; offs--) { + write(STDERR_FILENO, "\n", 1); + } + + pv_crs__unlock(STDERR_FILENO); + } + } + + if (!pv_crs__noipc) + y = pv_crs__y_start + pv_crs__y_offset; +#endif /* HAVE_IPC */ + + /* + * Keep the Y co-ordinate within sensible bounds, so we can never + * overflow the "pos" buffer. + */ + if ((y < 1) || (y > 999999)) + y = 1; + sprintf(pos, "\033[%d;1H", y); + + pv_crs__lock(STDERR_FILENO); + + write(STDERR_FILENO, pos, strlen(pos)); /* RATS: ignore */ + write(STDERR_FILENO, str, strlen(str)); /* RATS: ignore */ + + pv_crs__unlock(STDERR_FILENO); +} + + +/* + * Reposition the cursor to a final position. + */ +void pv_crs_fini(opts_t opts) +{ + char pos[32]; /* RATS: ignore (checked OK) */ + int y; + + y = pv_crs__y_start; + +#ifdef HAVE_IPC + if ((pv_crs__pvmax > 0) && (!pv_crs__noipc)) + y += pv_crs__pvmax - 1; +#endif /* HAVE_IPC */ + + if (y > opts->height) + y = opts->height; + + /* + * Absolute bounds check. + */ + if ((y < 1) || (y > 999999)) + y = 1; + + sprintf(pos, "\033[%d;1H\n", y); /* RATS: ignore */ + + pv_crs__lock(STDERR_FILENO); + + write(STDERR_FILENO, pos, strlen(pos)); /* RATS: ignore */ + +#ifdef HAVE_IPC + pv_crs__ipccount(); + shmdt((void *) pv_crs__y_top); + + /* + * If we are the last instance detaching from the shared memory, + * delete it so it's not left lying around. + */ + if (pv_crs__pvcount < 2) + shmctl(pv_crs__shmid, IPC_RMID, 0); + +#endif /* HAVE_IPC */ + + pv_crs__unlock(STDERR_FILENO); +} + +/* EOF */ diff --git a/src/pv/display.c b/src/pv/display.c new file mode 100644 index 0000000..5a39bf7 --- /dev/null +++ b/src/pv/display.c @@ -0,0 +1,635 @@ +/* + * Display functions. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include "options.h" +#include "pv.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* + * Fill in opts->width and opts->height with the current terminal size, + * if possible. + */ +void pv_screensize(opts_t opts) +{ +#ifdef TIOCGWINSZ + struct winsize wsz; + + if (isatty(STDERR_FILENO)) { + if (ioctl(STDERR_FILENO, TIOCGWINSZ, &wsz) == 0) { + opts->width = wsz.ws_col; + opts->height = wsz.ws_row; + } + } +#endif +} + + +/* + * Calculate the percentage transferred so far and return it. + */ +static long pv__calc_percentage(long long so_far, const long long total) +{ + if (total < 1) + return 0; + + so_far *= 100; + so_far /= total; + + return (long) so_far; +} + + +/* + * Given how many bytes have been transferred, the total byte count to + * transfer, and how long it's taken so far in seconds, return the estimated + * number of seconds until completion. + */ +static long pv__calc_eta(const long long so_far, const long long total, + const long elapsed) +{ + long long amount_left; + + if (so_far < 1) + return 0; + + amount_left = total - so_far; + amount_left *= (long long) elapsed; + amount_left /= so_far; + + return (long) amount_left; +} + +/* + * Given a long double value, it is divided or multiplied by the ratio until + * a value in the range 1.0 to 999.999... is found. The string "prefix" to + * is updated to the corresponding SI prefix. + * + * If "is_bytes" is 1, then the second byte of "prefix" is set to "i" to + * denote MiB etc (IEEE1541). Thus "prefix" should be at least 3 bytes long + * (to include the terminating null). + * + * Submitted by Henry Gebhardt and then + * modified. Further changed after input from Thomas Rachel. + */ +static void pv__si_prefix(long double *value, char *prefix, + const long double ratio, int is_bytes) +{ + static char *pfx = NULL; + static char const *pfx_middle = NULL; + char const *i; + long double cutoff; + + if (pfx == NULL) { + pfx = _("yzafpnum kMGTPEZY"); + } + + if (pfx_middle == NULL) { + /* + * We can't assign this in the declaration above because + * that wouldn't be constant, so we do it here. + */ + pfx_middle = strchr(pfx, ' '); + } + i = pfx_middle; + + prefix[0] = ' '; /* Make the prefix start blank. */ + prefix[1] = 0; + + /* + * Force an empty prefix if the value is zero to avoid "0yB". + */ + if (*value == 0.0) + return; + + cutoff = ratio * 0.97; + + while ((*value > cutoff) && (*(i += 1) != '\0')) { + *value /= ratio; + prefix[0] = *i; + } + + while ((*value < 1.0) && ((i -= 1) != (pfx - 1))) { + *value *= ratio; + prefix[0] = *i; + } + + if (is_bytes && prefix[0] != ' ') { + prefix[1] = 'i'; + prefix[2] = 0; + } +} + + +/* + * Put a string in "buffer" (max length "bufsize") containing "amount" + * formatted such that it's 3 or 4 digits followed by an SI suffix and then + * whichever of "suffix_basic" or "suffix_bytes" is appropriate (whether + * "is_bytes" is 0 for non-byte amounts or 1 for byte amounts). If + * "is_bytes" is 1 then the SI units are KiB, MiB etc and the divisor is + * 1024 instead of 1000. + * + * The "format" string is in sprintf format and must contain exactly one % + * parameter (a %s) which will expand to the string described above. + */ +static void pv__sizestr(char *buffer, int bufsize, char *format, + long double amount, char *suffix_basic, + char *suffix_bytes, int is_bytes) +{ + char sizestr_buffer[256]; /* RATS: ignore (big enough) */ + char si_prefix[8] = " "; /* RATS: ignore (big enough) */ + long double divider; + long double display_amount; + char *suffix; + + if (is_bytes) { + suffix = suffix_bytes; + divider = 1024.0; + } else { + suffix = suffix_basic; + divider = 1000.0; + } + + display_amount = amount; + + pv__si_prefix(&display_amount, si_prefix, divider, is_bytes); + + /* Make sure we don't overrun our buffer. */ + if (display_amount > 100000) + display_amount = 100000; + + /* Fix for display of "1.01e+03" instead of "1010" */ + if (display_amount > 99.9) { + sprintf(sizestr_buffer, "%4ld%.2s%.16s", + (long) display_amount, si_prefix, suffix); + } else { + /* + * AIX blows up with %4.3Lg%.2s%.16s for some reason, so we + * write display_amount separately first. + */ + char str_disp[64]; + sprintf(str_disp, "%4.3Lg", display_amount); + sprintf(sizestr_buffer, "%s%.2s%.16s", str_disp, + si_prefix, suffix); + } + + snprintf(buffer, bufsize, format, sizestr_buffer); +} + + +/* + * Structure to hold the internal data for a single display. + */ +struct pv_display_state { + long percentage; + long double prev_elapsed_sec; + long double prev_rate; + long double prev_trans; + char *outbuffer; + long outbufsize; + int prev_width; /* screen width last time we were called */ + int prev_length; /* length of last string we output */ + opts_t opts; +}; + + +/* + * Initialise the given display structure from the given option set. Note + * that this copies the given "opts" pointer, not the underlying structure, + * so if "opts" is freed, the state's copy is invalidated and must not be + * used. + */ +static void pv__state_init(struct pv_display_state *state, opts_t opts) +{ + if (state == NULL) + return; + memset(state, 0, sizeof(struct pv_display_state)); + state->opts = opts; +} + + +/* + * Return a pointer to a string (which must not be freed), containing status + * information formatted according to the state held within the given + * structure, where "elapsed_sec" is the seconds elapsed since the transfer + * started, "bytes_since_last" is the number of bytes transferred since the + * last update, and "total_bytes" is the total number of bytes transferred + * so far. + * + * If "bytes_since_last" is negative, this is the final update so the rate + * is given as an an average over the whole transfer; otherwise the current + * rate is shown. + * + * In line mode, "bytes_since_last" and "total_bytes" are in lines, not bytes. + * + * If "total_bytes" is negative, then free all allocated memory and return + * NULL. + */ +static char *pv__format(struct pv_display_state *state, + long double elapsed_sec, + long long bytes_since_last, long long total_bytes) +{ + long double time_since_last, rate, average_rate; + long eta; + int component_count; + int static_portion_size; + char str_transferred[128]; /* RATS: ignore (big enough) */ + char str_timer[128]; /* RATS: ignore (big enough) */ + char str_rate[128]; /* RATS: ignore (big enough) */ + char str_average_rate[128]; /* RATS: ignore (big enough) */ + char str_eta[128]; /* RATS: ignore (big enough) */ + int output_length; + + /* Quick sanity check - state must exist */ + if (state == NULL) + return NULL; + + /* Negative total transfer - free memory and exit */ + if (total_bytes < 0) { + if (state->outbuffer) + free(state->outbuffer); + state->outbuffer = NULL; + return NULL; + } + + /* + * In case the time since the last update is very small, we keep + * track of amount transferred since the last update, and just keep + * adding to that until a reasonable amount of time has passed to + * avoid rate spikes or division by zero. + */ + time_since_last = elapsed_sec - state->prev_elapsed_sec; + if (time_since_last <= 0.01) { + rate = state->prev_rate; + state->prev_trans += bytes_since_last; + } else { + rate = + ((long double) bytes_since_last + + state->prev_trans) / time_since_last; + state->prev_elapsed_sec = elapsed_sec; + state->prev_trans = 0; + } + state->prev_rate = rate; + + /* + * We only calculate the overall average rate if this is the last + * update or if the average rate display is enabled. Otherwise it's + * not worth the extra CPU cycles. + */ + if ((bytes_since_last < 0) || (state->opts->average_rate)) { + /* Sanity check to avoid division by zero */ + if (elapsed_sec < 0.000001) + elapsed_sec = 0.000001; + average_rate = + ((long double) total_bytes) / + (long double) elapsed_sec; + if (bytes_since_last < 0) + rate = average_rate; + } + + if (state->opts->size <= 0) { + /* + * If we don't know the total size of the incoming data, + * then for a percentage, we gradually increase the + * percentage completion as data arrives, to a maximum of + * 200, then reset it - we use this if we can't calculate + * it, so that the numeric percentage output will go + * 0%-100%, 100%-0%, 0%-100%, and so on. + */ + if (rate > 0) + state->percentage += 2; + if (state->percentage > 199) + state->percentage = 0; + } else if (state->opts->numeric || state->opts->progress) { + /* + * If we do know the total size, and we're going to show + * the percentage (numeric mode or a progress bar), + * calculate the percentage completion. + */ + state->percentage = + pv__calc_percentage(total_bytes, state->opts->size); + } + + /* + * Reallocate output buffer if width changes. + */ + if (state->outbuffer != NULL + && state->outbufsize < (state->opts->width * 2)) { + free(state->outbuffer); + state->outbuffer = NULL; + state->outbufsize = 0; + } + + /* + * Allocate output buffer if there isn't one. + */ + if (state->outbuffer == NULL) { + state->outbufsize = (2 * state->opts->width) + 80; + if (state->opts->name) + state->outbufsize += strlen(state->opts->name); /* RATS: ignore */ + state->outbuffer = malloc(state->outbufsize + 16); + if (state->outbuffer == NULL) { + fprintf(stderr, "%s: %s: %s\n", + state->opts->program_name, + _("buffer allocation failed"), + strerror(errno)); + state->opts->exit_status |= 64; + return NULL; + } + state->outbuffer[0] = 0; + } + + /* In numeric output mode, our output is just a number. */ + if (state->opts->numeric) { + if (state->percentage > 100) { + /* As mentioned above, we go 0-100, then 100-0. */ + sprintf(state->outbuffer, "%ld\n", + 200 - state->percentage); + } else { + sprintf(state->outbuffer, "%ld\n", + state->percentage); + } + return state->outbuffer; + } + + /* + * First, work out what components we will be putting in the output + * buffer, and for those that don't depend on the total width + * available (i.e. all but the progress bar), prepare their strings + * to be placed in the output buffer. + */ + + /* We start off with no components. */ + component_count = 0; + static_portion_size = 0; + str_transferred[0] = 0; + str_timer[0] = 0; + str_rate[0] = 0; + str_average_rate[0] = 0; + str_eta[0] = 0; + + /* If we're showing a name, add it to the list and the length. */ + if (state->opts->name) { + int name_length; + + name_length = strlen(state->opts->name); + if (name_length < 9) + name_length = 9; + if (name_length > 500) + name_length = 500; + + component_count++; + static_portion_size += name_length + 1; /* +1 for ":" */ + } + + /* If we're showing bytes transferred, set up the display string. */ + if (state->opts->bytes) { + pv__sizestr(str_transferred, sizeof(str_transferred), "%s", + (long double) total_bytes, "", _("B"), + state->opts->linemode ? 0 : 1); + component_count++; + static_portion_size += strlen(str_transferred); + } + + /* Timer - set up the display string. */ + if (state->opts->timer) { + /* + * Bounds check, so we don't overrun the prefix buffer. This + * does mean that the timer will stop at a 100,000 hours, + * but since that's 11 years, it shouldn't be a problem. + */ + if (elapsed_sec > (long double) 360000000.0L) + elapsed_sec = (long double) 360000000.0L; + + sprintf(str_timer, "%ld:%02ld:%02ld", + ((long) elapsed_sec) / 3600, + (((long) elapsed_sec) / 60) % 60, + ((long) elapsed_sec) % 60); + + component_count++; + static_portion_size += strlen(str_timer); + } + + /* Rate - set up the display string. */ + if (state->opts->rate) { + pv__sizestr(str_rate, sizeof(str_rate), "[%s]", rate, + _("/s"), _("B/s"), + state->opts->linemode ? 0 : 1); + component_count++; + static_portion_size += strlen(str_rate); + } + + /* Average rate - set up the display string. */ + if (state->opts->average_rate) { + pv__sizestr(str_average_rate, sizeof(str_average_rate), + "[%s]", average_rate, _("/s"), _("B/s"), + state->opts->linemode ? 0 : 1); + component_count++; + static_portion_size += strlen(str_average_rate); + } + + /* ETA (only if size is known) - set up the display string. */ + if (state->opts->eta && state->opts->size > 0) { + eta = + pv__calc_eta(total_bytes, state->opts->size, + elapsed_sec); + + if (eta < 0) + eta = 0; + + /* + * Bounds check, so we don't overrun the suffix buffer. This + * means the ETA will always be less than 100,000 hours. + */ + if (eta > (long) 360000000L) + eta = (long) 360000000L; + + sprintf(str_eta, "%.16s %ld:%02ld:%02ld", _("ETA"), + eta / 3600, (eta / 60) % 60, eta % 60); + + /* + * If this is the final update, show a blank space where the + * ETA used to be. + */ + if (bytes_since_last < 0) { + int i; + for (i = 0; i < sizeof(str_eta) && str_eta[i] != 0; + i++) { + str_eta[i] = ' '; + } + } + + component_count++; + static_portion_size += strlen(str_eta); + } + + /* + * We now have all the static portions built; all that is left is + * the dynamically sized progress bar. So now we assemble the + * output buffer, inserting the progress bar at the appropriate + * point with the appropriate width. + */ + + state->outbuffer[0] = 0; + + if (state->opts->name) { + sprintf(state->outbuffer, "%9s:", state->opts->name); /* RATS: ignore (OK) */ + } +#define PV_APPEND(x) if (x[0] != 0) { \ + if (state->outbuffer[0] != 0) \ + strcat(state->outbuffer, " "); \ + strcat(state->outbuffer, x); \ + } + + PV_APPEND(str_transferred); + PV_APPEND(str_timer); + PV_APPEND(str_rate); + PV_APPEND(str_average_rate); + + if (state->opts->progress) { + char pct[16]; /* RATS: ignore (big enough) */ + int available_width, i; + + if (state->outbuffer[0] != 0) + strcat(state->outbuffer, " "); + strcat(state->outbuffer, "["); + + if (state->opts->size > 0) { + if (state->percentage < 0) + state->percentage = 0; + if (state->percentage > 100000) + state->percentage = 100000; + sprintf(pct, "%2ld%%", state->percentage); + available_width = + state->opts->width - static_portion_size - + component_count - strlen(pct) - 3; + + for (i = 0; + i < + (available_width * state->percentage) / 100 - + 1; i++) { + if (i < available_width) + strcat(state->outbuffer, "="); + } + if (i < available_width) { + strcat(state->outbuffer, ">"); + i++; + } + for (; i < available_width; i++) { + strcat(state->outbuffer, " "); + } + strcat(state->outbuffer, "] "); + strcat(state->outbuffer, pct); /* RATS: ignore (OK) */ + } else { + int p = state->percentage; + available_width = + state->opts->width - static_portion_size - + component_count - 5; + if (p > 100) + p = 200 - p; + for (i = 0; i < (available_width * p) / 100; i++) { + if (i < available_width) + strcat(state->outbuffer, " "); + } + strcat(state->outbuffer, "<=>"); + for (; i < available_width; i++) { + strcat(state->outbuffer, " "); + } + strcat(state->outbuffer, "]"); + } + } + + PV_APPEND(str_eta); + + /* + * If the size of our output shrinks, we need to keep appending + * spaces at the end, so that we don't leave dangling bits behind. + */ + output_length = strlen(state->outbuffer); + if ((output_length < state->prev_length) + && (state->opts->width >= state->prev_width)) { + char spaces[32]; /* RATS: ignore (bounded below) */ + int spaces_to_add; + spaces_to_add = state->prev_length - output_length; + /* Upper boundary on number of spaces */ + if (spaces_to_add > 15) { + spaces_to_add = 15; + } + output_length += spaces_to_add; + spaces[spaces_to_add] = 0; + while (--spaces_to_add >= 0) { + spaces[spaces_to_add] = ' '; + } + strcat(state->outbuffer, /* RATS: ignore (OK) */ spaces); + } + state->prev_width = state->opts->width; + state->prev_length = output_length; + + return state->outbuffer; +} + + +/* + * Output status information on standard error, where "esec" is the seconds + * elapsed since the transfer started, "sl" is the number of bytes transferred + * since the last update, and "tot" is the total number of bytes transferred + * so far. + * + * If "sl" is negative, this is the final update so the rate is given as an + * an average over the whole transfer; otherwise the current rate is shown. + * + * In line mode, "sl" and "tot" are in lines, not bytes. + * + * If "opts" is NULL, then free all allocated memory and return. + */ +void pv_display(opts_t opts, long double esec, long long sl, long long tot) +{ + static struct pv_display_state state; + static int initialised = 0; + char *display; + + if (!initialised) { + pv__state_init(&state, opts); + initialised = 1; + } + + if (opts == NULL) { + if (initialised) + (void) pv__format(&state, 0, 0, -1); + initialised = 0; + return; + } + + pv_sig_checkbg(); + + display = pv__format(&state, esec, sl, tot); + if (display == NULL) + return; + + if (opts->numeric) { + write(STDERR_FILENO, display, strlen(display)); /* RATS: ignore */ + } else if (opts->cursor) { + pv_crs_update(opts, display); + } else { + write(STDERR_FILENO, display, strlen(display)); /* RATS: ignore */ + write(STDERR_FILENO, "\r", 1); + } +} + +/* EOF */ diff --git a/src/pv/file.c b/src/pv/file.c new file mode 100644 index 0000000..4eadec2 --- /dev/null +++ b/src/pv/file.c @@ -0,0 +1,250 @@ +/* + * Functions for opening and closing files. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#define _GNU_SOURCE 1 +#include + +#include +#include "options.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* + * Try to work out the total size of all data by adding up the sizes of all + * input files. If any of the input files are of indeterminate size (i.e. + * they are a pipe), the total size is set to zero. + * + * Any files that cannot be stat()ed or that access() says we can't read + * will cause a warning to be output and will be removed from the list. + * + * In line mode, any files that pass the above checks will then be read to + * determine how many lines they contain, and the total size will be set to + * the total line count. Only regular files will be read. + */ +void pv_calc_total_size(opts_t opts) +{ + struct stat64 sb; + int rc, i, j, fd; + + opts->size = 0; + rc = 0; + + if (opts->argc < 1) { + if (fstat64(STDIN_FILENO, &sb) == 0) + opts->size = sb.st_size; + return; + } + + for (i = 0; i < opts->argc; i++) { + if (strcmp(opts->argv[i], "-") == 0) { + rc = fstat64(STDIN_FILENO, &sb); + if (rc != 0) { + opts->size = 0; + return; + } + } else { + rc = stat64(opts->argv[i], &sb); + if (rc == 0) + rc = access(opts->argv[i], R_OK); + } + + if (rc != 0) { + fprintf(stderr, "%s: %s: %s\n", opts->program_name, + opts->argv[i], strerror(errno)); + for (j = i; j < opts->argc - 1; j++) { + opts->argv[j] = opts->argv[j + 1]; + } + opts->argc--; + i--; + opts->exit_status |= 2; + continue; + } + + if (S_ISBLK(sb.st_mode)) { + /* + * Get the size of block devices by opening + * them and seeking to the end. + */ + if (strcmp(opts->argv[i], "-") == 0) { + fd = open64("/dev/stdin", O_RDONLY); + } else { + fd = open64(opts->argv[i], O_RDONLY); + } + if (fd >= 0) { + opts->size += lseek64(fd, 0, SEEK_END); + close(fd); + } else { + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, opts->argv[i], + strerror(errno)); + opts->exit_status |= 2; + } + } else if (S_ISREG(sb.st_mode)) { + opts->size += sb.st_size; + } else { + opts->size = 0; + } + } + + if (!opts->linemode) + return; + + opts->size = 0; + + for (i = 0; i < opts->argc; i++) { + fd = -1; + + if (strcmp(opts->argv[i], "-") == 0) { + rc = fstat64(STDIN_FILENO, &sb); + if ((rc != 0) || (!S_ISREG(sb.st_mode))) { + opts->size = 0; + return; + } + fd = dup(STDIN_FILENO); + } else { + rc = stat64(opts->argv[i], &sb); + if ((rc != 0) || (!S_ISREG(sb.st_mode))) { + opts->size = 0; + return; + } + fd = open64(opts->argv[i], O_RDONLY); + } + + if (fd < 0) { + fprintf(stderr, "%s: %s: %s\n", opts->program_name, + opts->argv[i], strerror(errno)); + opts->size = 0; + opts->exit_status |= 2; + return; + } + + while (1) { + unsigned char scanbuf[1024]; /* RATS: ignore (OK) */ + int numread, j; + + numread = read(fd, /* RATS: ignore (OK) */ scanbuf, + sizeof(scanbuf)); + if (numread < 0) { + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, opts->argv[i], + strerror(errno)); + opts->exit_status |= 2; + break; + } else if (numread == 0) { + break; + } + for (j = 0; j < numread; j++) { + if (scanbuf[j] == '\n') + opts->size++; + } + } + + lseek64(fd, 0, SEEK_SET); + close(fd); + } +} + + +/* + * Close the given file descriptor and open the next one, whose number in + * the list is "filenum", returning the new file descriptor (or negative on + * error). It is an error if the next input file is the same as the file + * stdout is pointing to. + */ +int pv_next_file(opts_t opts, int filenum, int oldfd) +{ + struct stat64 isb; + struct stat64 osb; + int fd; + + if (oldfd > 0) { + if (close(oldfd)) { + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, + _("failed to close file"), + strerror(errno)); + opts->exit_status |= 8; + return -1; + } + } + + if (filenum >= opts->argc) { + opts->exit_status |= 8; + return -1; + } + + if (filenum < 0) { + opts->exit_status |= 8; + return -1; + } + + if (strcmp(opts->argv[filenum], "-") == 0) { + fd = STDIN_FILENO; + } else { + fd = open64(opts->argv[filenum], O_RDONLY); + if (fd < 0) { + fprintf(stderr, "%s: %s: %s: %s\n", + opts->program_name, + _("failed to read file"), + opts->argv[filenum], strerror(errno)); + opts->exit_status |= 2; + return -1; + } + } + + if (fstat64(fd, &isb)) { + fprintf(stderr, "%s: %s: %s: %s\n", + opts->program_name, + _("failed to stat file"), + opts->argv[filenum], strerror(errno)); + close(fd); + opts->exit_status |= 2; + return -1; + } + + if (fstat64(STDOUT_FILENO, &osb)) { + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, + _("failed to stat output file"), strerror(errno)); + close(fd); + opts->exit_status |= 2; + return -1; + } + + /* + * Check that this new input file is not the same as stdout's + * destination. This restriction is ignored for anything other + * than a regular file or block device. + */ + if (isb.st_dev != osb.st_dev) + return fd; + if (isb.st_ino != osb.st_ino) + return fd; + if (isatty(fd)) + return fd; + if ((!S_ISREG(isb.st_mode)) && (!S_ISBLK(isb.st_mode))) + return fd; + + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, + _("input file is output file"), opts->argv[filenum]); + close(fd); + opts->exit_status |= 4; + return -1; +} + +/* EOF */ diff --git a/src/pv/loop.c b/src/pv/loop.c new file mode 100644 index 0000000..8812eff --- /dev/null +++ b/src/pv/loop.c @@ -0,0 +1,287 @@ +/* + * Main program entry point - read the command line options, then perform + * the appropriate actions. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#include "options.h" +#include "pv.h" + +#define _GNU_SOURCE 1 +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define RATE_GRANULARITY 100000 /* usec between -L rate chunks */ + +extern struct timeval pv_sig_toffset; +extern sig_atomic_t pv_sig_newsize; +extern sig_atomic_t pv_sig_abort; + + +/* + * Add the given number of microseconds (which may be negative) to the given + * timeval. + */ +static void pv_timeval_add_usec(struct timeval *val, long usec) +{ + val->tv_usec += usec; + while (val->tv_usec < 0) { + val->tv_sec--; + val->tv_usec += 1000000; + } + while (val->tv_usec >= 1000000) { + val->tv_sec++; + val->tv_usec -= 1000000; + } +} + + +/* + * Pipe data from a list of files to standard output, giving information + * about the transfer on standard error according to the given options. + * + * Returns nonzero on error. + */ +int pv_main_loop(opts_t opts) +{ + long written, lineswritten; + long long total_written, since_last, cansend; + long double target; + int eof_in, eof_out, final_update; + struct timeval start_time, next_update, next_ratecheck, cur_time; + struct timeval init_time; + long double elapsed; + struct stat64 sb; + int fd, n; + + /* + * "written" is ALWAYS bytes written by the last transfer. + * + * "lineswritten" is the lines written by the last transfer, + * but is only updated in line mode. + * + * "total_written" is the total bytes written since the start, + * or in line mode, the total lines written since the start. + * + * "since_last" is the bytes written since the last display, + * or in line mode, the lines written since the last display. + * + * The remaining variables are all unchanged by linemode. + */ + + fd = -1; + + pv_crs_init(opts); + + eof_in = 0; + eof_out = 0; + total_written = 0; + since_last = 0; + + gettimeofday(&start_time, NULL); + gettimeofday(&cur_time, NULL); + + next_update.tv_sec = start_time.tv_sec; + next_update.tv_usec = start_time.tv_usec; + pv_timeval_add_usec(&next_update, + (long) (1000000.0 * opts->interval)); + + next_ratecheck.tv_sec = start_time.tv_sec; + next_ratecheck.tv_usec = start_time.tv_usec; + + target = 0; + cansend = 0; + final_update = 0; + n = 0; + + fd = pv_next_file(opts, n, -1); + if (fd < 0) { + return opts->exit_status; + } + + if (fstat64(fd, &sb) == 0) { + pv_set_buffer_size(sb.st_blksize * 32, 0); + } + + if (opts->buffer_size > 0) { + pv_set_buffer_size(opts->buffer_size, 1); + } + + while ((!(eof_in && eof_out)) || (!final_update)) { + + if (pv_sig_abort) + break; + + if (opts->rate_limit > 0) { + gettimeofday(&cur_time, NULL); + if ((cur_time.tv_sec > next_ratecheck.tv_sec) + || (cur_time.tv_sec == next_ratecheck.tv_sec + && cur_time.tv_usec >= + next_ratecheck.tv_usec)) { + target += + ((long double) (opts->rate_limit)) / + (long double) (1000000 / + RATE_GRANULARITY); + pv_timeval_add_usec(&next_ratecheck, + RATE_GRANULARITY); + } + cansend = target; + } + + written = + pv_transfer(opts, fd, &eof_in, &eof_out, cansend, + &lineswritten); + if (written < 0) + return opts->exit_status; + + if (opts->linemode) { + since_last += lineswritten; + total_written += lineswritten; + if (opts->rate_limit > 0) + target -= lineswritten; + } else { + since_last += written; + total_written += written; + if (opts->rate_limit > 0) + target -= written; + } + + if (eof_in && eof_out && n < (opts->argc - 1)) { + n++; + fd = pv_next_file(opts, n, fd); + if (fd < 0) + return opts->exit_status; + eof_in = 0; + eof_out = 0; + } + + gettimeofday(&cur_time, NULL); + + if (eof_in && eof_out) { + final_update = 1; + next_update.tv_sec = cur_time.tv_sec - 1; + } + + if (opts->no_op) + continue; + + /* + * If -W was given, we don't output anything until we have + * written a byte (or line, in line mode), at which point + * we then count time as if we started when the first byte + * was received. + */ + if (opts->wait) { + if (opts->linemode) { + if (lineswritten < 1) + continue; + } else { + if (written < 1) + continue; + } + + opts->wait = 0; + + /* + * Reset the timer offset counter now that data + * transfer has begun, otherwise if we had been + * stopped and started (with ^Z / SIGTSTOP) + * previously (while waiting for data), the timers + * will be wrongly offset. + * + * While we reset the offset counter we must disable + * SIGTSTOP so things don't mess up. + */ + pv_sig_nopause(); + gettimeofday(&start_time, NULL); + pv_sig_toffset.tv_sec = 0; + pv_sig_toffset.tv_usec = 0; + pv_sig_allowpause(); + + next_update.tv_sec = start_time.tv_sec; + next_update.tv_usec = start_time.tv_usec; + pv_timeval_add_usec(&next_update, + (long) (1000000.0 * + opts->interval)); + } + + if ((cur_time.tv_sec < next_update.tv_sec) + || (cur_time.tv_sec == next_update.tv_sec + && cur_time.tv_usec < next_update.tv_usec)) { + continue; + } + + pv_timeval_add_usec(&next_update, + (long) (1000000.0 * opts->interval)); + + if (next_update.tv_sec < cur_time.tv_sec) { + next_update.tv_sec = cur_time.tv_sec; + next_update.tv_usec = cur_time.tv_usec; + } else if (next_update.tv_sec == cur_time.tv_sec + && next_update.tv_usec < cur_time.tv_usec) { + next_update.tv_usec = cur_time.tv_usec; + } + + init_time.tv_sec = + start_time.tv_sec + pv_sig_toffset.tv_sec; + init_time.tv_usec = + start_time.tv_usec + pv_sig_toffset.tv_usec; + if (init_time.tv_usec >= 1000000) { + init_time.tv_sec++; + init_time.tv_usec -= 1000000; + } + if (init_time.tv_usec < 0) { + init_time.tv_sec--; + init_time.tv_usec += 1000000; + } + + elapsed = cur_time.tv_sec - init_time.tv_sec; + elapsed += + (cur_time.tv_usec - init_time.tv_usec) / 1000000.0; + + if (final_update) + since_last = -1; + + if (pv_sig_newsize) { + pv_sig_newsize = 0; + pv_screensize(opts); + } + + pv_display(opts, elapsed, since_last, total_written); + + since_last = 0; + } + + if (opts->cursor) { + pv_crs_fini(opts); + } else { + if ((!opts->numeric) && (!opts->no_op)) + write(STDERR_FILENO, "\n", 1); + } + + /* + * Free up the buffers used by the display and data transfer + * routines. + */ + pv_display(0, 0, 0, 0); + pv_transfer(0, -1, 0, 0, 0, NULL); + + if (pv_sig_abort) + opts->exit_status |= 32; + + return opts->exit_status; +} + +/* EOF */ diff --git a/src/pv/number.c b/src/pv/number.c new file mode 100644 index 0000000..0495b13 --- /dev/null +++ b/src/pv/number.c @@ -0,0 +1,206 @@ +/* + * Functions for converting strings to numbers. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + +/* + * This function is used instead of the macro from because + * including causes weird versioned glibc dependencies on certain + * Red Hat systems, complicating package management. + */ +static int pv__isdigit(char c) +{ + return ((c >= '0') && (c <= '9')); +} + + +/* + * Return the numeric value of "str", as a long long. + */ +long long pv_getnum_ll(char *str) +{ + long long n = 0; + long long decimal = 0; + int decdivisor = 1; + int shift = 0; + + while (str[0] != 0 && (!pv__isdigit(str[0]))) + str++; + + for (; pv__isdigit(str[0]); str++) { + n = n * 10; + n += (str[0] - '0'); + } + + /* + * If a decimal value was given, skip the decimal part. + */ + if ((str[0] == '.') || (str[0] == ',')) { + str++; + for (; pv__isdigit(str[0]); str++) { + if (decdivisor < 10000) { + decimal = decimal * 10; + decimal += (str[0] - '0'); + decdivisor = decdivisor * 10; + } + } + } + + /* + * Parse any units given (K=KiB=*1024, M=MiB=1024KiB, G=GiB=1024MiB, + * T=TiB=1024GiB). + */ + if (str[0]) { + while ((str[0] == ' ') || (str[0] == '\t')) + str++; + switch (str[0]) { + case 'k': + case 'K': + shift = 10; + break; + case 'm': + case 'M': + shift = 20; + break; + case 'g': + case 'G': + shift = 30; + break; + case 't': + case 'T': + shift = 40; + break; + default: + break; + } + } + + /* + * Binary left-shift the supplied number by "shift" times, i.e. + * apply the given units (KiB, MiB, etc) to it, but never shift left + * more than 30 at a time to avoid overflows. + */ + while (shift > 0) { + int shiftby; + + shiftby = shift; + if (shiftby > 30) + shiftby = 30; + + n = n << shiftby; + decimal = decimal << shiftby; + shift -= shiftby; + } + + /* + * Add any decimal component. + */ + decimal = decimal / decdivisor; + n += decimal; + + return n; +} + + +/* + * Return the numeric value of "str", as a double. + */ +double pv_getnum_d(char *str) +{ + double n = 0.0; + double step = 1; + + while (str[0] != 0 && (!pv__isdigit(str[0]))) + str++; + + for (; pv__isdigit(str[0]); str++) { + n = n * 10; + n += (str[0] - '0'); + } + + if ((str[0] != '.') && (str[0] != ',')) + return n; + + str++; + + for (; pv__isdigit(str[0]) && step < 1000000; str++) { + step = step * 10; + n += (str[0] - '0') / step; + } + + return n; +} + + +/* + * Return the numeric value of "str", as an int. + */ +int pv_getnum_i(char *str) +{ + return (int) pv_getnum_ll(str); +} + + +/* + * Return nonzero if the given string is not a valid integer (type=0) or + * double (type=1). + */ +int pv_getnum_check(char *str, int type) +{ + if (!str) + return 1; + + while ((str[0] == ' ') || (str[0] == '\t')) + str++; + + if (!pv__isdigit(str[0])) + return 1; + + for (; pv__isdigit(str[0]); str++); + + if (str[0] == '.') { + if (type == 0) + return 1; + str++; + for (; pv__isdigit(str[0]); str++); + } + + if (str[0] == 0) + return 0; + + /* + * Suffixes are not allowed for doubles, only for integers. + */ + if (type == 1) + return 1; + + while ((str[0] == ' ') || (str[0] == '\t')) + str++; + switch (str[0]) { + case 'k': + case 'K': + case 'm': + case 'M': + case 'g': + case 'G': + case 't': + case 'T': + str++; + break; + default: + return 1; + } + + if (str[0]) + return 1; + + return 0; +} + +/* EOF */ diff --git a/src/pv/signal.c b/src/pv/signal.c new file mode 100644 index 0000000..a22137b --- /dev/null +++ b/src/pv/signal.c @@ -0,0 +1,290 @@ +/* + * Signal handling functions. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#include "pv.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +static int pv__sig_old_stderr; /* see pv__sig_ttou() */ +static struct timeval pv__sig_tstp_time; /* see pv__sig_tstp() / __cont() */ + +struct timeval pv_sig_toffset; /* total time spent stopped */ +sig_atomic_t pv_sig_newsize = 0; /* whether we need to get term size again */ +sig_atomic_t pv_sig_abort = 0; /* whether we need to abort right now */ + +#ifdef HAVE_IPC +void pv_crs_needreinit(void); +#endif + + +/* + * Handle SIGTTOU (tty output for background process) by redirecting stderr + * to /dev/null, so that we can be stopped and backgrounded without messing + * up the terminal. We store the old stderr file descriptor so that on a + * subsequent SIGCONT we can try writing to the terminal again, in case we + * get backgrounded and later get foregrounded again. + */ +static void pv__sig_ttou(int s) +{ + int fd; + + fd = open("/dev/null", O_RDWR); /* RATS: ignore (no race) */ + if (fd < 0) + return; + + if (pv__sig_old_stderr == -1) + pv__sig_old_stderr = dup(STDERR_FILENO); + + dup2(fd, STDERR_FILENO); + close(fd); +} + + +/* + * Handle SIGTSTP (stop typed at tty) by storing the time the signal + * happened for later use by pv__sig_cont(), and then stopping the process. + */ +static void pv__sig_tstp(int s) +{ + gettimeofday(&pv__sig_tstp_time, NULL); + raise(SIGSTOP); +} + + +/* + * Handle SIGCONT (continue if stopped) by adding the elapsed time since the + * last SIGTSTP to the elapsed time offset, and by trying to write to the + * terminal again (by replacing the /dev/null stderr with the old stderr). + */ +static void pv__sig_cont(int s) +{ + struct timeval tv; + struct termios t; + + pv_sig_newsize = 1; + + if (pv__sig_tstp_time.tv_sec == 0) { + tcgetattr(STDERR_FILENO, &t); + t.c_lflag |= TOSTOP; + tcsetattr(STDERR_FILENO, TCSANOW, &t); +#ifdef HAVE_IPC + pv_crs_needreinit(); +#endif + return; + } + + gettimeofday(&tv, NULL); + + pv_sig_toffset.tv_sec += (tv.tv_sec - pv__sig_tstp_time.tv_sec); + pv_sig_toffset.tv_usec += (tv.tv_usec - pv__sig_tstp_time.tv_usec); + if (pv_sig_toffset.tv_usec >= 1000000) { + pv_sig_toffset.tv_sec++; + pv_sig_toffset.tv_usec -= 1000000; + } + if (pv_sig_toffset.tv_usec < 0) { + pv_sig_toffset.tv_sec--; + pv_sig_toffset.tv_usec += 1000000; + } + + pv__sig_tstp_time.tv_sec = 0; + pv__sig_tstp_time.tv_usec = 0; + + if (pv__sig_old_stderr != -1) { + dup2(pv__sig_old_stderr, STDERR_FILENO); + close(pv__sig_old_stderr); + pv__sig_old_stderr = -1; + } + + tcgetattr(STDERR_FILENO, &t); + t.c_lflag |= TOSTOP; + tcsetattr(STDERR_FILENO, TCSANOW, &t); + +#ifdef HAVE_IPC + pv_crs_needreinit(); +#endif +} + + +/* + * Handle SIGWINCH (window size changed) by setting a flag. + */ +static void pv__sig_winch(int s) +{ + pv_sig_newsize = 1; +} + + +/* + * Handle termination signals by setting the abort flag. + */ +static void pv__sig_term(int s) +{ + pv_sig_abort = 1; +} + + +/* + * Initialise signal handling. + */ +void pv_sig_init(void) +{ + struct sigaction sa; + + pv__sig_old_stderr = -1; + pv__sig_tstp_time.tv_sec = 0; + pv__sig_tstp_time.tv_usec = 0; + pv_sig_toffset.tv_sec = 0; + pv_sig_toffset.tv_usec = 0; + + /* + * Ignore SIGPIPE, so we don't die if stdout is a pipe and the other + * end closes unexpectedly. + */ + sa.sa_handler = SIG_IGN; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGPIPE, &sa, NULL); + + /* + * Handle SIGTTOU by continuing with output switched off, so that we + * can be stopped and backgrounded without messing up the terminal. + */ + sa.sa_handler = pv__sig_ttou; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGTTOU, &sa, NULL); + + /* + * Handle SIGTSTP by storing the time the signal happened for later + * use by pv__sig_cont(), and then stopping the process. + */ + sa.sa_handler = pv__sig_tstp; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGTSTP, &sa, NULL); + + /* + * Handle SIGCONT by adding the elapsed time since the last SIGTSTP + * to the elapsed time offset, and by trying to write to the + * terminal again. + */ + sa.sa_handler = pv__sig_cont; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGCONT, &sa, NULL); + + /* + * Handle SIGWINCH by setting a flag to let the main loop know it + * has to reread the terminal size. + */ + sa.sa_handler = pv__sig_winch; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGWINCH, &sa, NULL); + + /* + * Handle SIGINT, SIGHUP, SIGTERM by setting a flag to let the + * main loop know it should quit now. + */ + sa.sa_handler = pv__sig_term; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGINT, &sa, NULL); + + sa.sa_handler = pv__sig_term; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGHUP, &sa, NULL); + + sa.sa_handler = pv__sig_term; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGTERM, &sa, NULL); +} + + +/* + * Stop reacting to SIGTSTP and SIGCONT. + */ +void pv_sig_nopause(void) +{ + struct sigaction sa; + + sa.sa_handler = SIG_IGN; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGTSTP, &sa, NULL); + + sa.sa_handler = SIG_DFL; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGCONT, &sa, NULL); +} + + +/* + * Start catching SIGTSTP and SIGCONT again. + */ +void pv_sig_allowpause(void) +{ + struct sigaction sa; + + sa.sa_handler = pv__sig_tstp; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGTSTP, &sa, NULL); + + sa.sa_handler = pv__sig_cont; + sigemptyset(&(sa.sa_mask)); + sa.sa_flags = 0; + sigaction(SIGCONT, &sa, NULL); +} + + +/* + * If we have redirected stderr to /dev/null, check every second or so to + * see whether we can write to the terminal again - this is so that if we + * get backgrounded, then foregrounded again, we start writing to the + * terminal again. + */ +void pv_sig_checkbg(void) +{ + static time_t next_check = 0; + struct termios t; + + if (time(NULL) < next_check) + return; + + next_check = time(NULL) + 1; + + if (pv__sig_old_stderr == -1) + return; + + dup2(pv__sig_old_stderr, STDERR_FILENO); + close(pv__sig_old_stderr); + pv__sig_old_stderr = -1; + + tcgetattr(STDERR_FILENO, &t); + t.c_lflag |= TOSTOP; + tcsetattr(STDERR_FILENO, TCSANOW, &t); + +#ifdef HAVE_IPC + pv_crs_needreinit(); +#endif +} + +/* EOF */ diff --git a/src/pv/transfer.c b/src/pv/transfer.c new file mode 100644 index 0000000..55d61b5 --- /dev/null +++ b/src/pv/transfer.c @@ -0,0 +1,341 @@ +/* + * Functions for transferring between file descriptors. + * + * Copyright 2012 Andrew Wood, distributed under the Artistic License 2.0. + */ + +#include "options.h" + +#define BUFFER_SIZE 409600 +#define BUFFER_SIZE_MAX 524288 + +#define MAXIMISE_BUFFER_FILL 1 + +#define _GNU_SOURCE 1 /* for splice() */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +static unsigned long long pv__bufsize = BUFFER_SIZE; + + +/* + * Set the buffer size for transfers. + */ +void pv_set_buffer_size(unsigned long long sz, int force) +{ + if ((sz > BUFFER_SIZE_MAX) && (!force)) + sz = BUFFER_SIZE_MAX; + pv__bufsize = sz; +} + + +/* + * Transfer some data from "fd" to standard output, timing out after 9/100 + * of a second. If opts->rate_limit is >0, only up to "allowed" bytes can + * be written. The variables that "eof_in" and "eof_out" point to are used + * to flag that we've finished reading and writing respectively. + * + * Returns the number of bytes written, or negative on error (in which case + * opts->exit_status is updated). In line mode, the number of lines written + * will be put into *lineswritten. + * + * If "opts" is NULL, then the transfer buffer is freed, and zero is + * returned. + */ +long pv_transfer(opts_t opts, int fd, int *eof_in, int *eof_out, + unsigned long long allowed, long *lineswritten) +{ + static unsigned char *buf = NULL; + static unsigned long long buf_alloced = 0; + static unsigned long in_buffer = 0; + static unsigned long bytes_written = 0; + struct timeval tv; + fd_set readfds; + fd_set writefds; + int max_fd; + long to_write, written; + ssize_t r, w; +#ifdef HAVE_SPLICE + static int splice_failed_fd = -1; + int splice_used = 0; +#endif + int n; + + if (opts == NULL) { + if (buf) + free(buf); + buf = NULL; + in_buffer = 0; + bytes_written = 0; + return 0; + } + + if (buf == NULL) { + buf_alloced = pv__bufsize; + buf = (unsigned char *) malloc(pv__bufsize + 32); + if (buf == NULL) { + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, + _("buffer allocation failed"), + strerror(errno)); + opts->exit_status |= 64; + return -1; + } + } + + /* + * Reallocate the buffer if the buffer size has changed mid-transfer. + */ + if (buf_alloced < pv__bufsize) { + unsigned char *newptr; + newptr = + realloc( /* RATS: ignore */ buf, pv__bufsize + 32); + if (newptr == NULL) { + pv__bufsize = buf_alloced; + } else { + buf = newptr; + buf_alloced = pv__bufsize; + } + } + + if ((opts->linemode) && (lineswritten != NULL)) + *lineswritten = 0; + + tv.tv_sec = 0; + tv.tv_usec = 90000; + + FD_ZERO(&readfds); + FD_ZERO(&writefds); + + max_fd = 0; + + if ((!(*eof_in)) && (in_buffer < pv__bufsize)) { + FD_SET(fd, &readfds); + if (fd > max_fd) + max_fd = fd; + } + + to_write = in_buffer - bytes_written; + if (opts->rate_limit > 0) { + if (to_write > allowed) { + to_write = allowed; + } + } + + if ((!(*eof_out)) && (to_write > 0)) { + FD_SET(STDOUT_FILENO, &writefds); + if (STDOUT_FILENO > max_fd) + max_fd = STDOUT_FILENO; + } + + if ((*eof_in) && (*eof_out)) + return 0; + + n = select(max_fd + 1, &readfds, &writefds, NULL, &tv); + + if (n < 0) { + if (errno == EINTR) + return 0; + fprintf(stderr, "%s: %s: %s: %d: %s\n", + opts->program_name, opts->current_file, + _("select call failed"), n, strerror(errno)); + opts->exit_status |= 16; + return -1; + } + + written = 0; + + if (FD_ISSET(fd, &readfds)) { +#ifdef HAVE_SPLICE + splice_used = 0; + if ((!opts->linemode) && (fd != splice_failed_fd) + && (to_write == 0)) { + r = splice(fd, NULL, STDOUT_FILENO, NULL, allowed, + SPLICE_F_MORE); + splice_used = 1; + if ((r < 0) && (errno == EINVAL)) { + splice_failed_fd = fd; + splice_used = 0; + } else if (r > 0) { + written = r; + } else { + /* EOF might not really be EOF, it seems */ + splice_used = 0; + } + } + if (splice_used == 0) { + r = read( /* RATS: ignore (checked OK) */ fd, + buf + in_buffer, pv__bufsize - in_buffer); + } +#else + r = read( /* RATS: ignore (checked OK) */ fd, + buf + in_buffer, pv__bufsize - in_buffer); +#endif /* HAVE_SPLICE */ + if (r < 0) { + /* + * If a read error occurred but it was EINTR or + * EAGAIN, just wait a bit and then return zero, + * since this was a transient error. + */ + if ((errno == EINTR) || (errno == EAGAIN)) { + tv.tv_sec = 0; + tv.tv_usec = 10000; + select(0, NULL, NULL, NULL, &tv); + return 0; + } + fprintf(stderr, "%s: %s: %s: %s\n", + opts->program_name, + opts->current_file, + _("read failed"), strerror(errno)); + opts->exit_status |= 16; + *eof_in = 1; + if (bytes_written >= in_buffer) + *eof_out = 1; + } else if (r == 0) { + *eof_in = 1; + if (bytes_written >= in_buffer) + *eof_out = 1; + } else { +#ifdef HAVE_SPLICE + if (splice_used == 0) + in_buffer += r; +#else + in_buffer += r; +#endif /* HAVE_SPLICE */ + + } + } + + /* + * In line mode, only write up to and including the last newline, + * so that we're writing output line-by-line. + */ + if ((to_write > 0) && (opts->linemode)) { + /* + * Guillaume Marcais: use strrchr to find last \n + */ + unsigned char save; + char *start; + char *end; + + save = buf[bytes_written + to_write]; + buf[bytes_written + to_write] = 0; + + start = (char *) (buf + bytes_written); + end = strrchr(start, '\n'); + buf[bytes_written + to_write] = save; + + if (end != NULL) { + to_write = (end - start) + 1; + } + } + + if (FD_ISSET(STDOUT_FILENO, &writefds) +#ifdef HAVE_SPLICE + && (splice_used == 0) +#endif /* HAVE_SPLICE */ + && (in_buffer > bytes_written) + && (to_write > 0)) { + + signal(SIGALRM, SIG_IGN); /* RATS: ignore */ + alarm(1); + + w = write(STDOUT_FILENO, buf + bytes_written, to_write); + + alarm(0); + + if (w < 0) { + /* + * If a write error occurred but it was EINTR or + * EAGAIN, just wait a bit and then return zero, + * since this was a transient error. + */ + if ((errno == EINTR) || (errno == EAGAIN)) { + tv.tv_sec = 0; + tv.tv_usec = 10000; + select(0, NULL, NULL, NULL, &tv); + return 0; + } + /* + * SIGPIPE means we've finished. Don't output an + * error because it's not really our error to report. + */ + if (errno == EPIPE) { + *eof_in = 1; + *eof_out = 1; + return 0; + } + fprintf(stderr, "%s: %s: %s\n", + opts->program_name, + _("write failed"), strerror(errno)); + opts->exit_status |= 16; + *eof_out = 1; + written = -1; + } else if (w == 0) { + *eof_out = 1; + } else { + if ((opts->linemode) && (lineswritten != NULL)) { + /* + * Guillaume Marcais: use strchr to count \n + */ + unsigned char save; + char *ptr; + long lines = 0; + + save = buf[bytes_written + w]; + buf[bytes_written + w] = 0; + ptr = (char *) (buf + bytes_written - 1); + + while ((ptr = + strchr((char *) (ptr + 1), '\n'))) + ++lines; + + *lineswritten += lines; + buf[bytes_written + w] = save; + } + bytes_written += w; + written += w; + if (bytes_written >= in_buffer) { + bytes_written = 0; + in_buffer = 0; + if (*eof_in) + *eof_out = 1; + } + } + } +#ifdef MAXIMISE_BUFFER_FILL + /* + * Rotate the written bytes out of the buffer so that it can be + * filled up completely by the next read. + */ + if (bytes_written > 0) { + if (bytes_written < in_buffer) { + memmove(buf, buf + bytes_written, + in_buffer - bytes_written); + in_buffer -= bytes_written; + bytes_written = 0; + } else { + bytes_written = 0; + in_buffer = 0; + } + } +#endif /* MAXIMISE_BUFFER_FILL */ + return written; +} + +/* EOF */ diff --git a/tests/000-cat b/tests/000-cat new file mode 100644 index 0000000..1b07549 --- /dev/null +++ b/tests/000-cat @@ -0,0 +1,8 @@ +#!/bin/sh +# +# Check that data can be just passed straight through. + +VALUE=`echo TESTING | $PROG 2>/dev/null` || exit 1 +test "$VALUE" = "TESTING" + +# EOF diff --git a/tests/001-interval b/tests/001-interval new file mode 100644 index 0000000..2903cb8 --- /dev/null +++ b/tests/001-interval @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Check that the update interval can be set. + +sleep 1 | $PROG -f -i 0.1 >/dev/null 2>$TMP1 + +# There should be more than 6 lines of output. +# +NUM=`tr '\r' '\n' < $TMP1 | wc -l | tr -d ' '` +test $NUM -gt 6 + +# EOF diff --git a/tests/002-rate b/tests/002-rate new file mode 100644 index 0000000..2609ce4 --- /dev/null +++ b/tests/002-rate @@ -0,0 +1,13 @@ +#!/bin/sh +# +# A simple test of rate limiting. + +# Transfer 102 bytes at 100 bytes/sec. It should take at least 1 second. +# +START=`date +%S` +dd if=/dev/zero bs=102 count=1 2>/dev/null | $PROG -L 100 2>/dev/null | cat >/dev/null +END=`date +%S` + +test $START -ne $END + +# EOF diff --git a/tests/003-progress b/tests/003-progress new file mode 100644 index 0000000..d6438f7 --- /dev/null +++ b/tests/003-progress @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Check that the progress bar moves when data is coming in. + +dd if=/dev/zero bs=100 count=1 2>/dev/null \ +| $PROG -f -p -i 0.1 -L 500 >/dev/null 2>$TMP1 + +# There should be more than 2 different lines of output. +# +NUM=`tr '\r' '\n' < $TMP1 | sort | uniq -u | wc -l | tr -d ' '` +test $NUM -gt 2 + +# EOF diff --git a/tests/004-timer b/tests/004-timer new file mode 100644 index 0000000..ab1c134 --- /dev/null +++ b/tests/004-timer @@ -0,0 +1,14 @@ +#!/bin/sh +# +# Check that the elapsed time counter does count up. + +# Transfer a zero amount of data, but take 3 seconds to do it. +# +(sleep 3 | $PROG -f -t >/dev/null) 2>&1 | tr '\r' '\n' > $TMP1 + +# Count the number of different timer values; it should be >1. +# +NUM=`sort < $TMP1 | uniq -u | wc -l | tr -d ' '` +test $NUM -gt 1 + +# EOF diff --git a/tests/005-eta b/tests/005-eta new file mode 100644 index 0000000..0f0eb40 --- /dev/null +++ b/tests/005-eta @@ -0,0 +1,20 @@ +#!/bin/sh +# +# Check that the estimated time counter counts. + +dd if=/dev/zero bs=100 count=1 2>/dev/null \ +| $PROG -f -e -s 100 -i 0.1 -L 25 >/dev/null 2>$TMP1 + +# Count the number of different ETA values there have been. +# +NUM=`tr '\r' '\n' < $TMP1 | tr -d ' ' | sed '/^$/d' | sort | uniq | wc -l | tr -d ' '` + +# 3 or less - not OK, since it should have taken 4 seconds. +# +test $NUM -gt 3 || exit 1 + +# 8 or more - not OK, since even on a heavily loaded system that's too long. +# +test $NUM -lt 8 + +# EOF diff --git a/tests/006-ratecount b/tests/006-ratecount new file mode 100644 index 0000000..1d4ea86 --- /dev/null +++ b/tests/006-ratecount @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Check that the transfer rate counter changes. + +# Transfer 200 bytes as two 100-byte blocks with a 2-second gap between. +# +(dd if=/dev/zero bs=100 count=1 2>/dev/null; + sleep 2; + dd if=/dev/zero bs=100 count=1 2>/dev/null; +) | $PROG -f -i 0.5 -r >/dev/null 2>$TMP1 + +# Count the number of different rates output. +# +NUM=`tr '\r' '\n' < $TMP1 | sort | uniq -u | wc -l | tr -d ' '` + +# There should be more than 2 different rates counted (around 100 bytes/sec +# for the each block, 0 bytes/sec for the gap in the middle, and around 50 +# bytes/sec for the average time reported at the end). +# +test $NUM -gt 2 + +# EOF diff --git a/tests/007-bytes b/tests/007-bytes new file mode 100644 index 0000000..ca0cfc6 --- /dev/null +++ b/tests/007-bytes @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Check that the byte counter counts. + +dd if=/dev/zero bs=100 count=1 2>/dev/null \ +| LANG=C $PROG -f -b >/dev/null 2>$TMP1 +NUM=`tr '\r' '\n' < $TMP1 | tr -d ' '` +test "$NUM" = "100B" + +# EOF diff --git a/tests/008-numeric b/tests/008-numeric new file mode 100644 index 0000000..baa44f2 --- /dev/null +++ b/tests/008-numeric @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Check that numeric output outputs some percentages. + +# Process 100 bytes at 100 bytes per second, updating every 0.1 seconds for +# around 10 output lines. +# +dd if=/dev/zero bs=100 count=1 2>/dev/null \ +| $PROG -s 100 -n -i 0.1 -L 100 >/dev/null 2>$TMP1 + +# The number of output lines should be >8 and <13, and the final percentage +# should be 100. +# +test `wc -l < $TMP1` -gt 8 +test `wc -l < $TMP1` -lt 13 +test `sed -n '$p' < $TMP1` -eq 100 + +# EOF diff --git a/tests/009-quiet b/tests/009-quiet new file mode 100644 index 0000000..a75da36 --- /dev/null +++ b/tests/009-quiet @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Check that the -q option shuts everything up. + +dd if=/dev/zero bs=1000 count=5 2>/dev/null \ +| $PROG -f -q -i 0.1 -L 5000 >/dev/null 2>$TMP1 +test ! -s $TMP1 + +# EOF diff --git a/tests/010-pipe b/tests/010-pipe new file mode 100644 index 0000000..8e569dd --- /dev/null +++ b/tests/010-pipe @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Check that there is no SIGPIPE or dropped data on bigger data transfers. + +# We nead GNU head. On some platforms it is named ghead instead of head. +HEAD=head +for p in `echo $PATH | tr ':' '\n'` +do + if test -x $p/ghead + then + HEAD=$p/ghead + break + fi +done + +# Don't use dd. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=324308 +COUNT1=100000000 +#COUNT2=`$PROG -B 100000 -q /dev/zero | $HEAD -c $COUNT1 | wc -c | tr -d ' '` +# Remove \n to fix the test on AIX +COUNT2=`$PROG -B 100000 -q /dev/zero | $HEAD -c $COUNT1 | tr -d '\n' | wc -c | tr -d ' '` + +#echo "[$COUNT1] [$COUNT2]" + +test "x$COUNT1" = "x$COUNT2" + +# EOF diff --git a/tests/011-cksum b/tests/011-cksum new file mode 100644 index 0000000..beb8443 --- /dev/null +++ b/tests/011-cksum @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Transfer a large chunk of data through pv and check data correctness +# afterwards. + +rm -f $TMP1 $TMP2 2>/dev/null + +# exit on non-zero return codes +set -e + +# generate some data +dd if=/dev/urandom of=$TMP1 bs=1024 count=10240 2>/dev/null + +CKSUM1=`cksum $TMP1 | awk '{print $1}'` + +# read through pv and test afterwards +$PROG -B 100000 -q $TMP1 > $TMP2 + +CKSUM2=`cksum $TMP2 | awk '{print $1}'` + +test "x$CKSUM1" = "x$CKSUM2" + +# clean up +rm -f $TMP1 $TMP2 2>/dev/null + +# EOF diff --git a/tests/012-averagerate b/tests/012-averagerate new file mode 100644 index 0000000..89b77be --- /dev/null +++ b/tests/012-averagerate @@ -0,0 +1,24 @@ +#!/bin/sh +# +# Check that the average transfer rate counter changes, but not more than it +# should. + +# Transfer 210 bytes as 100 bytes, a 1 second gap, 110 bytes, and another 1 +# second gap. +# +(dd if=/dev/zero bs=100 count=1 2>/dev/null; + sleep 1; + dd if=/dev/zero bs=110 count=1 2>/dev/null; + sleep 1; +) | $PROG -f -i 0.5 -a >/dev/null 2>$TMP1 + +# Count the number of rates output that are below 80. +# +NUM=`tr '\r' '\n' < $TMP1 | tr -dc '0-9.\n' | sed '/^$/d' | awk '$1<80{print}' | wc -l | tr -d ' '` + +# Nearly all of the output rates should be above 80 since the average rate +# will always be around 100 bytes per second, except for pauses. +# +test $NUM -lt 2 + +# EOF diff --git a/tests/013-1mboundary b/tests/013-1mboundary new file mode 100644 index 0000000..89e2523 --- /dev/null +++ b/tests/013-1mboundary @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Check that the bytes count doesn't increase the line length as it passes +# 1MiB, described here: +# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586763 + +# Transfer 1500kB of data in a bursty fashion. +# +(dd if=/dev/zero bs=1k count=999; + sleep 1; + dd if=/dev/zero bs=1k count=1; + sleep 1; + dd if=/dev/zero bs=1k count=500; + sleep 1; +) 2>/dev/null | ($PROG -btef -s 1500k >/dev/null) 2>$TMP1 + +# Count how many different line lengths we've seen. +# +NUM=`tr '\r' '\n' < $TMP1 | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l` + +# There should only be one length (not counting 0). +# +test $NUM -eq 1 || { echo; tr '\r' '\n' < $TMP1; exit 1; } + +# EOF diff --git a/tests/014-1mboundary2 b/tests/014-1mboundary2 new file mode 100644 index 0000000..00738cc --- /dev/null +++ b/tests/014-1mboundary2 @@ -0,0 +1,25 @@ +#!/bin/sh +# +# Same as test 13 (1mboundary) but for rate, not bytes transferred. + +# Transfer 1500kB of data in a bursty fashion. +# +(dd if=/dev/zero bs=1k count=999; + sleep 1; + dd if=/dev/zero bs=1k count=1; + sleep 1; + dd if=/dev/zero bs=3 count=1; + sleep 1; + dd if=/dev/zero bs=1k count=500; + sleep 1; +) 2>/dev/null | ($PROG -rtef -s 1500k >/dev/null) 2>$TMP1 + +# Count how many different line lengths we've seen. +# +NUM=`tr '\r' '\n' < $TMP1 | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l` + +# There should only be one length (not counting 0). +# +test $NUM -eq 1 || { echo; tr '\r' '\n' < $TMP1; exit 1; } + +# EOF diff --git a/tests/015-cksumpipe b/tests/015-cksumpipe new file mode 100644 index 0000000..665d729 --- /dev/null +++ b/tests/015-cksumpipe @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Transfer a large chunk of data through pv using pipes, sending it in a +# bursty fashion, and check data correctness afterwards. + +rm -f $TMP1 $TMP2 2>/dev/null + +# exit on non-zero return codes +set -e + +# generate some data +dd if=/dev/urandom of=$TMP1 bs=1024 count=10240 2>/dev/null + +CKSUM1=`cksum $TMP1 | awk '{print $1}'` + +# read through pv and test afterwards +( +dd if=$TMP1 bs=1 count=9000 +sleep 1 +dd if=$TMP1 bs=1 skip=9000 count=1240 +sleep 1 +dd if=$TMP1 bs=1024 skip=10 count=1014 +sleep 1 +dd if=$TMP1 bs=1024 skip=1024 count=1024 +sleep 1 +dd if=$TMP1 bs=1024 skip=2048 +) 2>/dev/null | $PROG -q -L 2M | cat > $TMP2 + +CKSUM2=`cksum $TMP2 | awk '{print $1}'` + +test "x$CKSUM1" = "x$CKSUM2" + +# same again but with one less pipe +( +dd if=$TMP1 bs=1 count=9000 +sleep 1 +dd if=$TMP1 bs=1 skip=9000 count=1240 +sleep 1 +dd if=$TMP1 bs=1024 skip=10 count=1014 +sleep 1 +dd if=$TMP1 bs=1024 skip=1024 count=1024 +sleep 1 +dd if=$TMP1 bs=1024 skip=2048 +) 2>/dev/null | $PROG -q -L 2M > $TMP2 + +CKSUM2=`cksum $TMP2 | awk '{print $1}'` + +test "x$CKSUM1" = "x$CKSUM2" + +# clean up +rm -f $TMP1 $TMP2 2>/dev/null + +# EOF -- cgit v1.2.1