commit b4ec432515e95e86ec9d711833b8cb34d0912546 Author: tstack Date: Sun Sep 13 18:07:32 2009 -0700 first commit diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..a4b34144 --- /dev/null +++ b/INSTALL @@ -0,0 +1,229 @@ +Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +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, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + 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 you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' 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. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +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 support 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' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + 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 machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +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. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--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. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..197a8e2c --- /dev/null +++ b/Makefile.am @@ -0,0 +1,6 @@ + +ACLOCAL_AMFLAGS = -I . + +SUBDIRS = src test + +noinst_SCRIPTS = TESTS_ENVIRONMENT diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 00000000..998338bd --- /dev/null +++ b/Makefile.in @@ -0,0 +1,615 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/TESTS_ENVIRONMENT.in \ + $(top_srcdir)/configure INSTALL config.guess config.sub \ + depcomp install-sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/ax_sqlite3.m4 \ + $(top_srcdir)/lnav.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = TESTS_ENVIRONMENT +SCRIPTS = $(noinst_SCRIPTS) +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CFLAGS_PG = @CFLAGS_PG@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSES_LIB = @CURSES_LIB@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCRE_CFLAGS = @PCRE_CFLAGS@ +PCRE_LIBS = @PCRE_LIBS@ +RANLIB = @RANLIB@ +READLINE_CFLAGS = @READLINE_CFLAGS@ +READLINE_LIBS = @READLINE_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOCI_CXXFLAGS = @SOCI_CXXFLAGS@ +SOCI_LIBS = @SOCI_LIBS@ +SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ +SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ +SQLITE3_LIBS = @SQLITE3_LIBS@ +SQLITE3_VERSION = @SQLITE3_VERSION@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +abssrcdir = @abssrcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +ACLOCAL_AMFLAGS = -I . +SUBDIRS = src test +noinst_SCRIPTS = TESTS_ENVIRONMENT +all: all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +TESTS_ENVIRONMENT: $(top_builddir)/config.status $(srcdir)/TESTS_ENVIRONMENT.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(SCRIPTS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/TESTS_ENVIRONMENT.in b/TESTS_ENVIRONMENT.in new file mode 100644 index 00000000..381d25c8 --- /dev/null +++ b/TESTS_ENVIRONMENT.in @@ -0,0 +1,103 @@ +#! /bin/sh + +top_srcdir="@abssrcdir@" +export top_srcdir + +# The top build directory, derived from the path to this script. +top_builddir=`dirname $0` + + +# The full path of the test case +test_file=$1 +# The base name of the test case +test_file_base=`basename $1` +# The current test number for shell based tests. +test_num=0 + +## BEGIN Functions + +LAST_TEST="" + +# +# Run a test case and capture its standard out and standard err. +# +# Usage: run_test [ ...] +# +# Example: +# +# To run rktimes and capture all of its stdio output: +# +# run_test rktimes -V +# +run_test() { + LAST_TEST="test: $@" + "$@" > ${test_file_base}_${test_num}.tmp 2>&1 +} + +# +# Check the output generated by a run_test() call. +# +# Usage: check_output {Expected output on stdin} +# +# Example: +# +# To check the output of 'rktimes -V' and print out 'Unable to get version?' +# if the output doesn't match: +# +# run_test rktimes -V +# check_output "Unable to get version?" < +# +# Example: +# +# To check the output of 'cbhey -l' for 'IDL:Foobar:1.0' and print out +# 'Unable to list supported interfaces?' if it is not found: +# +# run_test cbhey -l +# grep_output_for "IDL:Foobar:1.0" "Unable to list supported interface?" +# +grep_output_for() { + if grep -q $1 ${test_file_base}_${test_num}.tmp > /dev/null 2>&1; then + : + else + echo "${test_file_base}_${test_num}.tmp: $2" + exit 1 + fi + test_num=`expr ${test_num} \+ 1` +} + +on_error_fail_with() { + if test $? -ne 0; then + echo $1 > /dev/stderr + exit 1 + fi +} + +## END Functions + + +# Finally, run the test... + +if test -x $1 && test `basename $1 .sh` == `basename $1`; then + exec $* +else + # Shell script + shift + . ${test_file} +fi diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 00000000..c712034c --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,882 @@ +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 13 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.60])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([ax_sqlite3.m4]) +m4_include([lnav.m4]) diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..ea70c976 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,6 @@ +#! /bin/sh + +aclocal -I . +autoheader -I . +automake --add-missing --copy --foreign +autoconf diff --git a/ax_sqlite3.m4 b/ax_sqlite3.m4 new file mode 100644 index 00000000..95768094 --- /dev/null +++ b/ax_sqlite3.m4 @@ -0,0 +1,154 @@ +dnl $Id: ax_sqlite3.m4,v 1.2 2006/08/30 14:28:55 mloskot Exp $ +dnl +dnl @synopsis AX_LIB_SQLITE3([MINIMUM-VERSION]) +dnl +dnl Test for the SQLite 3 library of a particular version (or newer) +dnl +dnl This macro takes only one optional argument, required version +dnl of SQLite 3 library. If required version is not passed, +dnl 3.0.0 is used in the test of existance of SQLite 3. +dnl +dnl If no intallation prefix to the installed SQLite library is given +dnl the macro searches under /usr, /usr/local, and /opt. +dnl +dnl This macro calls: +dnl +dnl AC_SUBST(SQLITE3_CFLAGS) +dnl AC_SUBST(SQLITE3_LDFLAGS) +dnl AC_SUBST(SQLITE3_LIBS) +dnl AC_SUBST(SQLITE3_VERSION) +dnl +dnl And sets: +dnl +dnl HAVE_SQLITE3 +dnl +dnl @category InstalledPackages +dnl @category Cxx +dnl @author Mateusz Loskot +dnl @version $Date: 2006/08/30 14:28:55 $ +dnl @license AllPermissive +dnl +dnl $Id: ax_sqlite3.m4,v 1.2 2006/08/30 14:28:55 mloskot Exp $ +dnl +AC_DEFUN([AX_LIB_SQLITE3], +[ + AC_ARG_WITH([sqlite3], + AC_HELP_STRING( + [--with-sqlite3=@<:@ARG@:>@], + [use SQLite 3 library @<:@default=yes@:>@, optionally specify the prefix for sqlite3 library] + ), + [ + if test "$withval" = "no"; then + WANT_SQLITE3="no" + elif test "$withval" = "yes"; then + WANT_SQLITE3="yes" + ac_sqlite3_path="" + else + WANT_SQLITE3="yes" + ac_sqlite3_path="$withval" + fi + ], + [WANT_SQLITE3="yes"] + ) + + SQLITE3_CFLAGS="" + SQLITE3_LDFLAGS="" + SQLITE3_LIBS="" + SQLITE3_VERSION="" + + if test "x$WANT_SQLITE3" = "xyes"; then + + ac_sqlite3_header="sqlite3.h" + + sqlite3_version_req=ifelse([$1], [], [3.0.0], [$1]) + sqlite3_version_req_shorten=`expr $sqlite3_version_req : '\([[0-9]]*\.[[0-9]]*\)'` + sqlite3_version_req_major=`expr $sqlite3_version_req : '\([[0-9]]*\)'` + sqlite3_version_req_minor=`expr $sqlite3_version_req : '[[0-9]]*\.\([[0-9]]*\)'` + sqlite3_version_req_micro=`expr $sqlite3_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` + if test "x$sqlite3_version_req_micro" = "x" ; then + sqlite3_version_req_micro="0" + fi + + sqlite3_version_req_number=`expr $sqlite3_version_req_major \* 1000000 \ + \+ $sqlite3_version_req_minor \* 1000 \ + \+ $sqlite3_version_req_micro` + + AC_MSG_CHECKING([for SQLite3 library >= $sqlite3_version_req]) + + if test "$ac_sqlite3_path" != ""; then + ac_sqlite3_ldflags="-L$ac_sqlite3_path/lib" + ac_sqlite3_cppflags="-I$ac_sqlite3_path/include" + else + for ac_sqlite3_path_tmp in /usr /usr/local /opt ; do + if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \ + && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then + ac_sqlite3_path=$ac_sqlite3_path_tmp + ac_sqlite3_ldflags="-I$ac_sqlite3_path_tmp/include" + ac_sqlite3_cppflags="-L$ac_sqlite3_path_tmp/lib" + break; + fi + done + fi + + ac_sqlite3_ldflags="$ac_sqlite3_ldflags" + ac_sqlite3_libs="-lsqlite3" + + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $ac_sqlite3_cppflags" + + AC_LANG_PUSH(C++) + AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM([[@%:@include ]], + [[ +#if (SQLITE_VERSION_NUMBER >= $sqlite3_version_req_number) +// Everything is okay +#else +# error SQLite version is too old +#endif + ]] + ) + ], + [ + AC_MSG_RESULT([yes]) + success="yes" + ], + [ + AC_MSG_RESULT([not found]) + succees="no" + ] + ) + AC_LANG_POP([C++]) + + CPPFLAGS="$saved_CPPFLAGS" + + if test "$success" = "yes"; then + + SQLITE3_CFLAGS="$ac_sqlite3_cppflags" + SQLITE3_LDFLAGS="$ac_sqlite3_ldflags" + SQLITE3_LIBS="$ac_sqlite3_libs" + + ac_sqlite3_header_path="$ac_sqlite3_path/include/$ac_sqlite3_header" + + dnl Retrieve SQLite release version + if test "x$ac_sqlite3_header_path" != "x"; then + ac_sqlite3_version=`cat $ac_sqlite3_header_path \ + | grep '#define.*SQLITE_VERSION.*\"' | sed -e 's/.* "//' \ + | sed -e 's/"//'` + if test $ac_sqlite3_version != ""; then + SQLITE3_VERSION=$ac_sqlite3_version + else + AC_MSG_WARN([Can not find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!]) + fi + fi + + AC_DEFINE([HAVE_SQLITE3], [], [sqlite3]) + fi + fi + + AC_SUBST(SQLITE3_CFLAGS) + AC_SUBST(SQLITE3_LDFLAGS) + AC_SUBST(SQLITE3_LIBS) + AC_SUBST(SQLITE3_VERSION) +]) + diff --git a/config.guess b/config.guess new file mode 100755 index 00000000..fd30ab03 --- /dev/null +++ b/config.guess @@ -0,0 +1,1354 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-07-23' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# This shell variable is my proudest work .. or something. --bje + +set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; +(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) + || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; +dummy=$tmpdir/dummy ; +files="$dummy.c $dummy.o $dummy.rel $dummy" ; +trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $files ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; +unset files' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + eval $set_cc_for_build + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + 3-1307) + UNAME_MACHINE="alphaev7" + ;; + esac + fi + rm -f $dummy.s $dummy && rmdir $tmpdir + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy && rmdir $tmpdir + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i386-pc-interix3 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c && rmdir $tmpdir + test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +rm -f $dummy.c $dummy && rmdir $tmpdir + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +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` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.sub b/config.sub new file mode 100755 index 00000000..9ff085ef --- /dev/null +++ b/config.sub @@ -0,0 +1,1460 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-07-03' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipstx39 | mipstx39el \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 00000000..eb306d74 --- /dev/null +++ b/configure @@ -0,0 +1,8719 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.61 for lnav 0.1.0. +# +# Report bugs to . +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 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 more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# 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 + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 +IFS=$as_save_IFS + + ;; +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_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +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) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + 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=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # 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 after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, 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 + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\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 sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +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$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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'" + + + +exec 7<&0 &1 + +# 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` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME='lnav' +PACKAGE_TARNAME='lnav' +PACKAGE_VERSION='0.1.0' +PACKAGE_STRING='lnav 0.1.0' +PACKAGE_BUGREPORT='timothyshanestack@gmail.com' + +ac_unique_file="src/lnav.cc" +ac_default_prefix=/usr/ +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef 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 +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +am__isrc +CYGPATH_W +PACKAGE +VERSION +ACLOCAL +AUTOCONF +AUTOMAKE +AUTOHEADER +MAKEINFO +install_sh +STRIP +INSTALL_STRIP_PROGRAM +mkdir_p +AWK +SET_MAKE +am__leading_dot +AMTAR +am__tar +am__untar +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +abssrcdir +CXX +CXXFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CXX +EXEEXT +OBJEXT +DEPDIR +am__include +am__quote +AMDEP_TRUE +AMDEP_FALSE +AMDEPBACKSLASH +CXXDEPMODE +am__fastdepCXX_TRUE +am__fastdepCXX_FALSE +CFLAGS_PG +RANLIB +LN_S +CC +CFLAGS +ac_ct_CC +CCDEPMODE +am__fastdepCC_TRUE +am__fastdepCC_FALSE +CPP +GREP +EGREP +OBJCOPY +HAVE_OBJCOPY_TRUE +HAVE_OBJCOPY_FALSE +CURSES_LIB +PCRE_LIBS +PCRE_CFLAGS +READLINE_LIBS +READLINE_CFLAGS +SQLITE3_CFLAGS +SQLITE3_LDFLAGS +SQLITE3_LIBS +SQLITE3_VERSION +CXXCPP +SOCI_LIBS +SOCI_CXXFLAGS +HAVE_SOCI_TRUE +HAVE_SOCI_FALSE +HAVE_LIBSQLITE3_TRUE +HAVE_LIBSQLITE3_FALSE +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CXX +CXXFLAGS +LDFLAGS +LIBS +CPPFLAGS +CCC +CC +CFLAGS +CPP +CXXCPP' + + +# 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. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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 + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$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 ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -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'` + 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 ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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'` + 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; }; } + 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 directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +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 + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# 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 lnav 0.1.0 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 \`..'] + +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] + --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] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/lnav] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of lnav 0.1.0:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-profiling Compile with gprof(1) profiling support + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-ncurses Force the use of ncurses over curses + --with-pcre[=prefix] compile xmlpcre part (via libpcre check) + --with-readline[=prefix] compile xmlreadline part (via libreadline check) + --with-sqlite3=[ARG] use SQLite 3 library [default=yes], optionally + specify the prefix for sqlite3 library + --with-soci[=prefix] compile soci part (via libsoci check) + +Some influential environment variables: + CXX C++ compiler command + CXXFLAGS C++ compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CC C compiler command + CFLAGS C compiler flags + CPP C preprocessor + CXXCPP 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. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested 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 + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +lnav configure 0.1.0 +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 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 +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by lnav $as_me 0.1.0, which was +generated by GNU Autoconf 2.61. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +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` +/usr/bin/hostinfo = `(/usr/bin/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 +IFS=$as_save_IFS + +} >&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_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_arg'" + ;; + 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: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +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, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r 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 -f -r conftest* 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 -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +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 $ac_precious_vars; 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 + + + +am__api_version='1.10' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; 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 \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS + + +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. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + 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 build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm -f conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +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_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$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 + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=lnav + VERSION=0.1.0 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; 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_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; 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_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + +case x$srcdir in +x/*) + abssrcdir=$srcdir + ;; +*) + abssrcdir=`pwd`/$srcdir + ;; +esac + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + 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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then + 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 + +# Check that 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' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 that 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 { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + 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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) 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_cxx_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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + 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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CXXFLAGS="" + 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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + 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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + 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 +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +{ echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CXX" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + +#CFLAGS=`echo $CFLAGS | sed 's/-O2//g'` +#CXXFLAGS=`echo $CXXFLAGS | sed 's/-O2//g'` + +# Check whether --enable-profiling was given. +if test "${enable_profiling+set}" = set; then + enableval=$enable_profiling; +fi + + +{ echo "$as_me:$LINENO: checking gprof(4) profiling support" >&5 +echo $ECHO_N "checking gprof(4) profiling support... $ECHO_C" >&6; } +if test x"${enable_profiling}" = x"yes" ; then + CFLAGS="$CFLAGS -pg -gstabs" + CXXFLAGS="$CXXFLAGS -pg -gstabs" + LDFLAGS="$LDFLAGS -pg" +else + enable_profiling=no +fi +{ echo "$as_me:$LINENO: result: $enable_profiling" >&5 +echo "${ECHO_T}$enable_profiling" >&6; } + + + +# 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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS + + +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. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + 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' + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; 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_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; 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_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6; } +fi + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$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 + + +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS + +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS + +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 + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS + +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 +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS + +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.exe + 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS + +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.exe +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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS + +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 + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +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` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +{ 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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core 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 +{ 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 + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + 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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + 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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + 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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +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 ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=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 -std 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 -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 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 +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +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 + +depcc="$CC" am_compiler_list= + +{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 nonexistent 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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 nonexistent 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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_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_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core 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 +#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)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 core.conftest.* 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 { as_var=$as_ac_Header; eval "test \"\${$as_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. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&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 + + +{ echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6; } +if test "${ac_cv_type_off_t+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 +typedef off_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_off_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of off_t" >&5 +echo $ECHO_N "checking size of off_t... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +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 + typedef off_t ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + 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 + typedef off_t ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 + typedef off_t ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + 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 + typedef off_t ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + 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 + typedef off_t ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_off_t=$ac_lo;; +'') if test "$ac_cv_type_off_t" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (off_t) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_off_t=0 + fi ;; +esac +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 + typedef off_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_off_t=`cat conftest.val` +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 ) +if test "$ac_cv_type_off_t" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (off_t) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_off_t=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_OFF_T $ac_cv_sizeof_off_t +_ACEOF + + +{ echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } +if test "${ac_cv_type_size_t+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 +typedef size_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of size_t" >&5 +echo $ECHO_N "checking size of size_t... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +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 + typedef size_t ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + 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 + typedef size_t ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + 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 + typedef size_t ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + 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 + typedef size_t ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + 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 + typedef size_t ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_size_t=$ac_lo;; +'') if test "$ac_cv_type_size_t" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (size_t) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_size_t=0 + fi ;; +esac +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 + typedef size_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_size_t=`cat conftest.val` +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 ) +if test "$ac_cv_type_size_t" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (size_t) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_size_t=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_size_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t +_ACEOF + + + +# Extract the first word of "objcopy", so it can be a program name with args. +set dummy objcopy; 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_OBJCOPY+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$OBJCOPY"; then + ac_cv_prog_OBJCOPY="$OBJCOPY" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJCOPY="objcopy" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +OBJCOPY=$ac_cv_prog_OBJCOPY +if test -n "$OBJCOPY"; then + { echo "$as_me:$LINENO: result: $OBJCOPY" >&5 +echo "${ECHO_T}$OBJCOPY" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + if test x"$OBJCOPY" != x""; then + HAVE_OBJCOPY_TRUE= + HAVE_OBJCOPY_FALSE='#' +else + HAVE_OBJCOPY_TRUE='#' + HAVE_OBJCOPY_FALSE= +fi + + +{ echo "$as_me:$LINENO: checking for library containing openpty" >&5 +echo $ECHO_N "checking for library containing openpty... $ECHO_C" >&6; } +if test "${ac_cv_search_openpty+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char openpty (); +int +main () +{ +return openpty (); + ; + return 0; +} +_ACEOF +for ac_lib in '' util; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_openpty=$ac_res +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_openpty+set}" = set; then + break +fi +done +if test "${ac_cv_search_openpty+set}" = set; then + : +else + ac_cv_search_openpty=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_search_openpty" >&5 +echo "${ECHO_T}$ac_cv_search_openpty" >&6; } +ac_res=$ac_cv_search_openpty +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + + +for ac_header in pty.h util.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 timothyshanestack@gmail.com ## +## ------------------------------------------ ## +_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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&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 + + + +# Check whether --with-ncurses was given. +if test "${with_ncurses+set}" = set; then + withval=$with_ncurses; +fi + + mp_save_LIBS="$LIBS" + CURSES_LIB="" + if test "$with_ncurses" != yes + then + { echo "$as_me:$LINENO: checking for working curses" >&5 +echo $ECHO_N "checking for working curses... $ECHO_C" >&6; } +if test "${mp_cv_curses+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + LIBS="$LIBS -lcurses" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + mp_cv_curses=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + mp_cv_curses=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $mp_cv_curses" >&5 +echo "${ECHO_T}$mp_cv_curses" >&6; } + if test "$mp_cv_curses" = yes + then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CURSES_H +_ACEOF + + CURSES_LIB="-lcurses" + fi + fi + if test ! "$CURSES_LIB" + then + { echo "$as_me:$LINENO: checking for working ncurses" >&5 +echo $ECHO_N "checking for working ncurses... $ECHO_C" >&6; } +if test "${mp_cv_ncurses+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + LIBS="$mp_save_LIBS -lncurses" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + mp_cv_ncurses=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + mp_cv_ncurses=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $mp_cv_ncurses" >&5 +echo "${ECHO_T}$mp_cv_ncurses" >&6; } + if test "$mp_cv_ncurses" = yes + then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_NCURSES_H +_ACEOF + + CURSES_LIB="-lncurses" + fi + fi + LIBS="$mp_save_LIBS" + + +{ echo "$as_me:$LINENO: checking lib pcre" >&5 +echo $ECHO_N "checking lib pcre... $ECHO_C" >&6; } + +# Check whether --with-pcre was given. +if test "${with_pcre+set}" = set; then + withval=$with_pcre; +else + with_pcre="yes" +fi + +if test ".$with_pcre" = ".no" ; then + { echo "$as_me:$LINENO: result: disabled" >&5 +echo "${ECHO_T}disabled" >&6; } + { { echo "$as_me:$LINENO: error: pcre required to build" >&5 +echo "$as_me: error: pcre required to build" >&2;} + { (exit 1); exit 1; }; } +else + { echo "$as_me:$LINENO: result: (testing)" >&5 +echo "${ECHO_T}(testing)" >&6; } + +{ echo "$as_me:$LINENO: checking for pcre_study in -lpcre" >&5 +echo $ECHO_N "checking for pcre_study in -lpcre... $ECHO_C" >&6; } +if test "${ac_cv_lib_pcre_pcre_study+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcre $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pcre_study (); +int +main () +{ +return pcre_study (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_pcre_pcre_study=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_pcre_pcre_study=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_pcre_pcre_study" >&5 +echo "${ECHO_T}$ac_cv_lib_pcre_pcre_study" >&6; } +if test $ac_cv_lib_pcre_pcre_study = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPCRE 1 +_ACEOF + + LIBS="-lpcre $LIBS" + +fi + + + +for ac_header in pcre.h pcre/pcre.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 timothyshanestack@gmail.com ## +## ------------------------------------------ ## +_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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&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 "$ac_cv_lib_pcre_pcre_study" = "yes" ; then + PCRE_LIBS="-lpcre" + { echo "$as_me:$LINENO: checking lib pcre" >&5 +echo $ECHO_N "checking lib pcre... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: $PCRE_LIBS" >&5 +echo "${ECHO_T}$PCRE_LIBS" >&6; } + + else + OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$with_pcre/lib" + OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_pcre/include" + +{ echo "$as_me:$LINENO: checking for pcre_compile in -lpcre" >&5 +echo $ECHO_N "checking for pcre_compile in -lpcre... $ECHO_C" >&6; } +if test "${ac_cv_lib_pcre_pcre_compile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcre $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pcre_compile (); +int +main () +{ +return pcre_compile (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_pcre_pcre_compile=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_pcre_pcre_compile=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_pcre_pcre_compile" >&5 +echo "${ECHO_T}$ac_cv_lib_pcre_pcre_compile" >&6; } +if test $ac_cv_lib_pcre_pcre_compile = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPCRE 1 +_ACEOF + + LIBS="-lpcre $LIBS" + +fi + + CPPFLAGS="$OLDCPPFLAGS" + LDFLAGS="$OLDLDFLAGS" + if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then + { echo "$as_me:$LINENO: result: .setting PCRE_LIBS -L$with_pcre/lib -lpcre" >&5 +echo "${ECHO_T}.setting PCRE_LIBS -L$with_pcre/lib -lpcre" >&6; } + PCRE_LIBS="-L$with_pcre/lib -lpcre" + test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include" + { echo "$as_me:$LINENO: checking lib pcre" >&5 +echo $ECHO_N "checking lib pcre... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: $PCRE_LIBS" >&5 +echo "${ECHO_T}$PCRE_LIBS" >&6; } + + else + { echo "$as_me:$LINENO: checking lib pcre" >&5 +echo $ECHO_N "checking lib pcre... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: no, (WARNING)" >&5 +echo "${ECHO_T}no, (WARNING)" >&6; } + { { echo "$as_me:$LINENO: error: pcre required to build" >&5 +echo "$as_me: error: pcre required to build" >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi + + + +{ echo "$as_me:$LINENO: checking lib readline" >&5 +echo $ECHO_N "checking lib readline... $ECHO_C" >&6; } + +# Check whether --with-readline was given. +if test "${with_readline+set}" = set; then + withval=$with_readline; +else + with_readline="yes" +fi + +if test ".$with_readline" = ".no" ; then + { echo "$as_me:$LINENO: result: disabled" >&5 +echo "${ECHO_T}disabled" >&6; } + { { echo "$as_me:$LINENO: error: readline required to build" >&5 +echo "$as_me: error: readline required to build" >&2;} + { (exit 1); exit 1; }; } +else + if test ".$with_readline" = ".yes"; then + OLD_LIBS="$LIBS" + +{ echo "$as_me:$LINENO: checking for readline in -lreadline" >&5 +echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6; } +if test "${ac_cv_lib_readline_readline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lreadline -ltermcap $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char readline (); +int +main () +{ +return readline (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_readline_readline=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_readline_readline=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5 +echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6; } +if test $ac_cv_lib_readline_readline = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBREADLINE 1 +_ACEOF + + LIBS="-lreadline $LIBS" + +fi + + LIBS="$OLD_LIBS" + if test "$ac_cv_lib_readline_readline" = "yes"; then + READLINE_LIBS="-lreadline" + { echo "$as_me:$LINENO: checking lib readline" >&5 +echo $ECHO_N "checking lib readline... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: $READLINE_LIBS" >&5 +echo "${ECHO_T}$READLINE_LIBS" >&6; } + + else + { echo "$as_me:$LINENO: checking lib readline" >&5 +echo $ECHO_N "checking lib readline... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: no, (WARNING)" >&5 +echo "${ECHO_T}no, (WARNING)" >&6; } + { { echo "$as_me:$LINENO: error: readline required to build" >&5 +echo "$as_me: error: readline required to build" >&2;} + { (exit 1); exit 1; }; } + fi + else + LIBS="$LIBS $with_readline/lib/libreadline.a" + OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_readline/include" + + +for ac_header in readline.h readline/readline.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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 timothyshanestack@gmail.com ## +## ------------------------------------------ ## +_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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&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 + + CPPFLAGS="$OLDCPPFLAGS" + READLINE_LIBS="$with_readline/lib/libreadline.a" + test -d "$with_readline/include" && READLINE_CFLAGS="-I$with_readline/include" + { echo "$as_me:$LINENO: checking lib readline" >&5 +echo $ECHO_N "checking lib readline... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: $READLINE_LIBS" >&5 +echo "${ECHO_T}$READLINE_LIBS" >&6; } + + fi +fi + + + + + + + +# Check whether --with-sqlite3 was given. +if test "${with_sqlite3+set}" = set; then + withval=$with_sqlite3; + if test "$withval" = "no"; then + WANT_SQLITE3="no" + elif test "$withval" = "yes"; then + WANT_SQLITE3="yes" + ac_sqlite3_path="" + else + WANT_SQLITE3="yes" + ac_sqlite3_path="$withval" + fi + +else + WANT_SQLITE3="yes" + +fi + + + SQLITE3_CFLAGS="" + SQLITE3_LDFLAGS="" + SQLITE3_LIBS="" + SQLITE3_VERSION="" + + if test "x$WANT_SQLITE3" = "xyes"; then + + ac_sqlite3_header="sqlite3.h" + + sqlite3_version_req="3.0.0" + sqlite3_version_req_shorten=`expr $sqlite3_version_req : '\([0-9]*\.[0-9]*\)'` + sqlite3_version_req_major=`expr $sqlite3_version_req : '\([0-9]*\)'` + sqlite3_version_req_minor=`expr $sqlite3_version_req : '[0-9]*\.\([0-9]*\)'` + sqlite3_version_req_micro=`expr $sqlite3_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'` + if test "x$sqlite3_version_req_micro" = "x" ; then + sqlite3_version_req_micro="0" + fi + + sqlite3_version_req_number=`expr $sqlite3_version_req_major \* 1000000 \ + \+ $sqlite3_version_req_minor \* 1000 \ + \+ $sqlite3_version_req_micro` + + { echo "$as_me:$LINENO: checking for SQLite3 library >= $sqlite3_version_req" >&5 +echo $ECHO_N "checking for SQLite3 library >= $sqlite3_version_req... $ECHO_C" >&6; } + + if test "$ac_sqlite3_path" != ""; then + ac_sqlite3_ldflags="-L$ac_sqlite3_path/lib" + ac_sqlite3_cppflags="-I$ac_sqlite3_path/include" + else + for ac_sqlite3_path_tmp in /usr /usr/local /opt ; do + if test -f "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header" \ + && test -r "$ac_sqlite3_path_tmp/include/$ac_sqlite3_header"; then + ac_sqlite3_path=$ac_sqlite3_path_tmp + ac_sqlite3_ldflags="-I$ac_sqlite3_path_tmp/include" + ac_sqlite3_cppflags="-L$ac_sqlite3_path_tmp/lib" + break; + fi + done + fi + + ac_sqlite3_ldflags="$ac_sqlite3_ldflags" + ac_sqlite3_libs="-lsqlite3" + + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $ac_sqlite3_cppflags" + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + +#if (SQLITE_VERSION_NUMBER >= $sqlite3_version_req_number) +// Everything is okay +#else +# error SQLite version is too old +#endif + + + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + success="yes" + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + { echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6; } + succees="no" + + +fi + +rm -f core 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 + + + CPPFLAGS="$saved_CPPFLAGS" + + if test "$success" = "yes"; then + + SQLITE3_CFLAGS="$ac_sqlite3_cppflags" + SQLITE3_LDFLAGS="$ac_sqlite3_ldflags" + SQLITE3_LIBS="$ac_sqlite3_libs" + + ac_sqlite3_header_path="$ac_sqlite3_path/include/$ac_sqlite3_header" + + if test "x$ac_sqlite3_header_path" != "x"; then + ac_sqlite3_version=`cat $ac_sqlite3_header_path \ + | grep '#define.*SQLITE_VERSION.*\"' | sed -e 's/.* "//' \ + | sed -e 's/"//'` + if test $ac_sqlite3_version != ""; then + SQLITE3_VERSION=$ac_sqlite3_version + else + { echo "$as_me:$LINENO: WARNING: Can not find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!" >&5 +echo "$as_me: WARNING: Can not find SQLITE_VERSION macro in sqlite3.h header to retrieve SQLite version!" >&2;} + fi + fi + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SQLITE3 +_ACEOF + + fi + fi + + + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_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; } +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.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 nonexistent 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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.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_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.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 nonexistent 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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.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 \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +{ echo "$as_me:$LINENO: checking lib soci" >&5 +echo $ECHO_N "checking lib soci... $ECHO_C" >&6; } + +# Check whether --with-soci was given. +if test "${with_soci+set}" = set; then + withval=$with_soci; +else + with_soci="yes" +fi + +if test ".$with_soci" = ".no" ; then + { echo "$as_me:$LINENO: result: disabled" >&5 +echo "${ECHO_T}disabled" >&6; } + { { echo "$as_me:$LINENO: error: soci required to build" >&5 +echo "$as_me: error: soci required to build" >&2;} + { (exit 1); exit 1; }; } +else + { echo "$as_me:$LINENO: result: (testing)" >&5 +echo "${ECHO_T}(testing)" >&6; } + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +for ac_header in soci/soci.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.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_cxx_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 timothyshanestack@gmail.com ## +## ------------------------------------------ ## +_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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&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 + + 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 "$ac_cv_header_soci_soci_h" = "yes" ; then + if test ".$with_soci" == ".yes"; then + with_soci="/usr/local/include" + fi + SOCI_CXXFLAGS="-I${with_soci}/soci -I${with_soci}/soci/sqlite3" + SOCI_LIBS="-lsoci_sqlite3-gcc-3_0 -lsoci_core-gcc-3_0" + fi +fi + + + + if test x"$SOCI_CXXFLAGS" != x""; then + HAVE_SOCI_TRUE= + HAVE_SOCI_FALSE='#' +else + HAVE_SOCI_TRUE='#' + HAVE_SOCI_FALSE= +fi + + + if + test -n "$SQLITE3_CFLAGS" -a -n "$SQLITE3_LDFLAGS"; then + HAVE_LIBSQLITE3_TRUE= + HAVE_LIBSQLITE3_FALSE='#' +else + HAVE_LIBSQLITE3_TRUE='#' + HAVE_LIBSQLITE3_FALSE= +fi + + +case "$host_os" in + darwin*) + +cat >>confdefs.h <<\_ACEOF +#define _APPLE_C_SOURCE +_ACEOF + + ;; + *) + +cat >>confdefs.h <<\_ACEOF +#define _XOPEN_SOURCE 500 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _BSD_SOURCE +_ACEOF + + ;; +esac + +ac_config_headers="$ac_config_headers src/config.h" + +ac_config_files="$ac_config_files Makefile" + +ac_config_files="$ac_config_files TESTS_ENVIRONMENT" + +ac_config_files="$ac_config_files src/Makefile" + +ac_config_files="$ac_config_files test/Makefile" + + +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, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + 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 "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + 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}' + +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_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${HAVE_OBJCOPY_TRUE}" && test -z "${HAVE_OBJCOPY_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HAVE_OBJCOPY\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HAVE_OBJCOPY\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${HAVE_SOCI_TRUE}" && test -z "${HAVE_SOCI_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HAVE_SOCI\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HAVE_SOCI\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${HAVE_LIBSQLITE3_TRUE}" && test -z "${HAVE_LIBSQLITE3_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HAVE_LIBSQLITE3\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HAVE_LIBSQLITE3\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${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 more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# 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 + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 +IFS=$as_save_IFS + + ;; +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_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +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) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # 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 after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, 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 + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\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 sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +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$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by lnav $as_me 0.1.0, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +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 and configuration settings, 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="\\ +lnav config.status 0.1.0 +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +_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 + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --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;; + --he | --h) + # Conflict between --help and --header + { 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 ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { 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" + ac_need_defaults=false ;; + + 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 CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "TESTS_ENVIRONMENT") CONFIG_FILES="$CONFIG_FILES TESTS_ENVIRONMENT" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; + + *) { { 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 against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$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 "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for 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 + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +am__isrc!$am__isrc$ac_delim +CYGPATH_W!$CYGPATH_W$ac_delim +PACKAGE!$PACKAGE$ac_delim +VERSION!$VERSION$ac_delim +ACLOCAL!$ACLOCAL$ac_delim +AUTOCONF!$AUTOCONF$ac_delim +AUTOMAKE!$AUTOMAKE$ac_delim +AUTOHEADER!$AUTOHEADER$ac_delim +MAKEINFO!$MAKEINFO$ac_delim +install_sh!$install_sh$ac_delim +STRIP!$STRIP$ac_delim +INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim +mkdir_p!$mkdir_p$ac_delim +AWK!$AWK$ac_delim +SET_MAKE!$SET_MAKE$ac_delim +am__leading_dot!$am__leading_dot$ac_delim +AMTAR!$AMTAR$ac_delim +am__tar!$am__tar$ac_delim +am__untar!$am__untar$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +abssrcdir!$abssrcdir$ac_delim +CXX!$CXX$ac_delim +CXXFLAGS!$CXXFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CXX!$ac_ct_CXX$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +DEPDIR!$DEPDIR$ac_delim +am__include!$am__include$ac_delim +am__quote!$am__quote$ac_delim +AMDEP_TRUE!$AMDEP_TRUE$ac_delim +AMDEP_FALSE!$AMDEP_FALSE$ac_delim +AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim +CXXDEPMODE!$CXXDEPMODE$ac_delim +am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim +am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim +CFLAGS_PG!$CFLAGS_PG$ac_delim +RANLIB!$RANLIB$ac_delim +LN_S!$LN_S$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +CCDEPMODE!$CCDEPMODE$ac_delim +am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim +am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +OBJCOPY!$OBJCOPY$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +HAVE_OBJCOPY_TRUE!$HAVE_OBJCOPY_TRUE$ac_delim +HAVE_OBJCOPY_FALSE!$HAVE_OBJCOPY_FALSE$ac_delim +CURSES_LIB!$CURSES_LIB$ac_delim +PCRE_LIBS!$PCRE_LIBS$ac_delim +PCRE_CFLAGS!$PCRE_CFLAGS$ac_delim +READLINE_LIBS!$READLINE_LIBS$ac_delim +READLINE_CFLAGS!$READLINE_CFLAGS$ac_delim +SQLITE3_CFLAGS!$SQLITE3_CFLAGS$ac_delim +SQLITE3_LDFLAGS!$SQLITE3_LDFLAGS$ac_delim +SQLITE3_LIBS!$SQLITE3_LIBS$ac_delim +SQLITE3_VERSION!$SQLITE3_VERSION$ac_delim +CXXCPP!$CXXCPP$ac_delim +SOCI_LIBS!$SOCI_LIBS$ac_delim +SOCI_CXXFLAGS!$SOCI_CXXFLAGS$ac_delim +HAVE_SOCI_TRUE!$HAVE_SOCI_TRUE$ac_delim +HAVE_SOCI_FALSE!$HAVE_SOCI_FALSE$ac_delim +HAVE_LIBSQLITE3_TRUE!$HAVE_LIBSQLITE3_TRUE$ac_delim +HAVE_LIBSQLITE3_FALSE!$HAVE_LIBSQLITE3_FALSE$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 20; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# 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 + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # 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. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$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'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$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'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +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&@top_builddir@&$ac_top_builddir_sub&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + :H) + # + # CONFIG_HEADER + # +_ACEOF + +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #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. +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : +do + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines conftest.tail + +echo "ac_result=$ac_in" >>$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF + if test x"$ac_file" != x-; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + 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 + rm -f $ac_file + mv "$tmp/config.h" $ac_file + fi + else + echo "/* $configure_input */" + cat "$ac_result" + fi + rm -f "$tmp/out12" +# Compute $ac_file's index in $config_headers. +_am_arg=$ac_file +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 +echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$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'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + + esac +done # for ac_tag + + +{ (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/configure.in b/configure.in new file mode 100644 index 00000000..d32717e6 --- /dev/null +++ b/configure.in @@ -0,0 +1,84 @@ + +AC_INIT(lnav, 0.1.0, timothyshanestack@gmail.com) +AC_CONFIG_SRCDIR([src/lnav.cc]) +AM_INIT_AUTOMAKE(lnav, 0.1.0) + +AC_PREFIX_DEFAULT(/usr/) + +AC_CANONICAL_HOST + +dnl abssrcdir is the absolute path to the source base (regardless of where +dnl you are building it) +case x$srcdir in +x/*) + abssrcdir=$srcdir + ;; +*) + abssrcdir=`pwd`/$srcdir + ;; +esac +AC_SUBST(abssrcdir) + +AC_PROG_CXX + +#CFLAGS=`echo $CFLAGS | sed 's/-O2//g'` +#CXXFLAGS=`echo $CXXFLAGS | sed 's/-O2//g'` + +AC_ARG_ENABLE([profiling], + AS_HELP_STRING([--enable-profiling], + [Compile with gprof(1) profiling support])) + +AC_MSG_CHECKING(gprof(4) profiling support) +if test x"${enable_profiling}" = x"yes" ; then + CFLAGS="$CFLAGS -pg -gstabs" + CXXFLAGS="$CXXFLAGS -pg -gstabs" + LDFLAGS="$LDFLAGS -pg" +else + enable_profiling=no +fi +AC_MSG_RESULT($enable_profiling) + +AC_SUBST(CFLAGS_PG) + +AC_PROG_INSTALL +AC_PROG_RANLIB +AC_PROG_LN_S +AC_PROG_MAKE_SET + +AC_CHECK_SIZEOF(off_t) +AC_CHECK_SIZEOF(size_t) + +AC_CHECK_PROG(OBJCOPY, objcopy, objcopy) +AM_CONDITIONAL(HAVE_OBJCOPY, test x"$OBJCOPY" != x"") + +AC_SEARCH_LIBS(openpty, util) +AC_CHECK_HEADERS(pty.h util.h) + +MP_WITH_CURSES() +AX_PATH_LIB_PCRE([], [AC_MSG_ERROR([pcre required to build])]) +AX_PATH_LIB_READLINE([], [AC_MSG_ERROR([readline required to build])]) + +AX_LIB_SQLITE3("3.0.0") +AX_PATH_LIB_SOCI([], [AC_MSG_ERROR([soci required to build])]) +AM_CONDITIONAL(HAVE_SOCI, test x"$SOCI_CXXFLAGS" != x"") + +AM_CONDITIONAL(HAVE_LIBSQLITE3, [ + test -n "$SQLITE3_CFLAGS" -a -n "$SQLITE3_LDFLAGS"]) + +case "$host_os" in + darwin*) + AC_DEFINE([_APPLE_C_SOURCE], [], [Needed for the 'timezone' variable]) + ;; + *) + AC_DEFINE([_XOPEN_SOURCE], [500], [Need pread]) + AC_DEFINE([_BSD_SOURCE], [], [Need pread]) + ;; +esac + +AM_CONFIG_HEADER([src/config.h]) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([TESTS_ENVIRONMENT]) +AC_CONFIG_FILES([src/Makefile]) +AC_CONFIG_FILES([test/Makefile]) + +AC_OUTPUT diff --git a/depcomp b/depcomp new file mode 100755 index 00000000..807b991f --- /dev/null +++ b/depcomp @@ -0,0 +1,423 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. We will use -o /dev/null later, + # however we can't do the remplacement now because + # `-o $object' might simply not be used + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/install-sh b/install-sh new file mode 100755 index 00000000..11870f1b --- /dev/null +++ b/install-sh @@ -0,0 +1,251 @@ +#!/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 + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + 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" ] || [ -d "$src" ] + then + : + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + : + 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 + : + 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 + : + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; 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 + : + 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 :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;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/lnav.cfg b/lnav.cfg new file mode 100644 index 00000000..8537a257 --- /dev/null +++ b/lnav.cfg @@ -0,0 +1,543 @@ + +# +# General options +# + +# The type of line endings +newlines = lf # auto/lf/crlf/cr + +# The original size of tabs in the input +input_tab_size = 8 # number + +# The size of tabs in the output (only used if align_with_tabs=true) +output_tab_size = 8 # number + +# The ascii value of the string escape char, usually 92 (\). (Pawn) +string_escape_char = 92 # number + +# +# Indenting +# + +# The number of columns to indent per level (usually 2, 3, 4, or 8) +indent_columns = 4 # number + +# How to use tabs when indenting code +# 0=spaces only +# 1=indent with tabs, align with spaces +# 2=indent and align with tabs +indent_with_tabs = 2 # number + +# Whether to indent strings broken by '\' so that they line up +indent_align_string = false # false/true + +# Spaces to indent '{' from level +indent_brace = 0 # number + +# Whether braces are indented to the body level +indent_braces = false # false/true + +# Disabled indenting function braces if indent_braces is true +indent_braces_no_func = false # false/true + +# Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. +indent_brace_parent = false # false/true + +# Whether the 'namespace' body is indented +indent_namespace = false # false/true + +# Whether the 'class' body is indented +indent_class = true # false/true + +# Whether to indent the stuff after a leading class colon +indent_class_colon = true # false/true + +# Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) +indent_func_call_param = false # false/true + +# The number of spaces to indent a continued '->' or '.' +# Usually set to indent_columns. +indent_member = 0 # number + +# Spaces to indent single line ('//') comments on lines before code +indent_sing_line_comments = 0 # number + +# Spaces to indent 'case' from 'switch' +indent_switch_case = 0 # number + +# Spaces to indent 'case' body from 'case' +indent_case_body = 0 # number + +# Spaces to indent '{' from 'case' +indent_case_brace = 0 # number + +# Whether to indent comments found in first column +indent_col1_comment = false # false/true + +# How to indent goto labels (>0=absolute column where 1 is the leftmost column, <=0=subtract from brace indent) +indent_label = 1 # number + +# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) +indent_paren_nl = false # false/true + +# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) +indent_square_nl = false # false/true + +# +# Spacing options +# + +# Add or remove space around arithmetic operator '+', '-', '/', '*', etc +sp_arith = force # ignore/add/remove/force + +# Add or remove space around assignment operator '=', '+=', etc +sp_assign = force # ignore/add/remove/force + +# Add or remove space around boolean operators '&&' and '||' +sp_bool = force # ignore/add/remove/force + +# Add or remove space around compare operator '<', '>', '==', etc +sp_compare = force # ignore/add/remove/force + +# Add or remove space inside '(' and ')' +sp_inside_paren = remove # ignore/add/remove/force + +# Add or remove space between nested parens +sp_paren_paren = remove # ignore/add/remove/force + +# Add or remove space between ')' and '{' +sp_paren_brace = ignore # ignore/add/remove/force + +# Add or remove space before pointer star '*' +sp_before_ptr_star = force # ignore/add/remove/force + +# Add or remove space between pointer stars '*' +sp_between_ptr_star = remove # ignore/add/remove/force + +# Add or remove space after pointer star '*' +sp_after_ptr_star = remove # ignore/add/remove/force + +# Add or remove space before reference sign '&' +sp_before_byref = force # ignore/add/remove/force + +# Add or remove space after reference sign '&' +sp_after_byref = ignore # ignore/add/remove/force + +# Add or remove space before '<>' +sp_before_angle = remove # ignore/add/remove/force + +# Add or remove space after '<>' +sp_after_angle = force # ignore/add/remove/force + +# Add or remove space before '(' of 'if', 'for', 'switch', and 'while' +sp_before_sparen = force # ignore/add/remove/force + +# Add or remove space inside if-condition '(' and ')' +sp_inside_sparen = remove # ignore/add/remove/force + +# Add or remove space after ')' of 'if', 'for', 'switch', and 'while' +sp_after_sparen = force # ignore/add/remove/force + +# Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' +sp_sparen_brace = add # ignore/add/remove/force + +# Add or remove space before empty statement ';' on 'if', 'for' and 'while' +sp_special_semi = ignore # ignore/add/remove/force + +# Add or remove space before ';' +sp_before_semi = remove # ignore/add/remove/force + +# Add or remove space before '[' (except '[]') +sp_before_square = ignore # ignore/add/remove/force + +# Add or remove space before '[]' +sp_before_squares = ignore # ignore/add/remove/force + +# Add or remove space inside '[' and ']' +sp_inside_square = remove # ignore/add/remove/force + +# Add or remove space after ',' +sp_after_comma = force # ignore/add/remove/force + +# Add or remove space between 'operator' and operator sign +sp_after_operator = ignore # ignore/add/remove/force + +# Add or remove space after cast +sp_after_cast = remove # ignore/add/remove/force + +# Add or remove space between 'sizeof' and '(' +sp_sizeof_paren = remove # ignore/add/remove/force + +# Add or remove space after the tag keyword (Pawn) +sp_after_tag = ignore # ignore/add/remove/force + +# Add or remove space inside enum '{' and '}' +sp_inside_braces_enum = force # ignore/add/remove/force + +# Add or remove space inside struct/union '{' and '}' +sp_inside_braces_struct = force # ignore/add/remove/force + +# Add or remove space inside '{' and '}' +sp_inside_braces = force # ignore/add/remove/force + +# Add or remove space inside '<' and '>' +sp_inside_angle = remove # ignore/add/remove/force + +# Add or remove space between return type and function name (a minimum of 1 is forced except for pointer return types) +sp_type_func = ignore # ignore/add/remove/force + +# Add or remove space between function name and '(' on function declaration +sp_func_proto_paren = remove # ignore/add/remove/force + +# Add or remove space between function name and '(' on function definition +sp_func_def_paren = remove # ignore/add/remove/force + +# Add or remove space inside empty function '()' +sp_inside_fparens = ignore # ignore/add/remove/force + +# Add or remove space inside function '(' and ')' +sp_inside_fparen = remove # ignore/add/remove/force + +# Add or remove space between ']' and '(' when part of a function call. +sp_square_fparen = ignore # ignore/add/remove/force + +# Add or remove space between ')' and '{' of function +sp_fparen_brace = add # ignore/add/remove/force + +# Add or remove space between function name and '(' on function calls +sp_func_call_paren = remove # ignore/add/remove/force + +# Add or remove space between a constructor/destructor and the open paren +sp_func_class_paren = remove # ignore/add/remove/force + +# Add or remove space between 'return' and '(' +sp_return_paren = add # ignore/add/remove/force + +# Add or remove space between macro and value +sp_macro = ignore # ignore/add/remove/force + +# Add or remove space between macro function ')' and value +sp_macro_func = ignore # ignore/add/remove/force + +# Add or remove space between 'else' and '{' if on the same line +sp_else_brace = ignore # ignore/add/remove/force + +# Add or remove space between '}' and 'else' if on the same line +sp_brace_else = ignore # ignore/add/remove/force + +# +# Code alignment (not left column spaces/tabs) +# + +# Whether to keep non-indenting tabs +align_keep_tabs = false # false/true + +# Whether to use tabs for alinging +align_with_tabs = false # false/true + +# Whether to bump out to the next tab when aligning +align_on_tabstop = false # false/true + +# Whether to left-align numbers +align_number_left = true # false/true + +# The span for aligning variable definitions (0=don't align) +align_var_def_span = 1 # number + +# Whether the pointer star is part of the variable name or not +align_var_def_star = true # false/true + +# The threshold for aligning variable definitions (0=no limit) +align_var_def_thresh = 12 # number + +# Whether to align the colon in struct bit fields +align_var_def_colon = true # false/true + +# Whether to align inline struct/enum/union variable definitions +align_var_def_inline = true # false/true + +# The span for aligning on '=' in assignments (0=don't align) +align_assign_span = 1 # number + +# The threshold for aligning on '=' in assignments (0=no limit) +align_assign_thresh = 12 # number + +# The span for aligning on '=' in enums (0=don't align) +align_enum_equ_span = 4 # number + +# The threshold for aligning on '=' in enums (0=no limit) +align_enum_equ_thresh = 0 # number + +# The span for aligning struct/union (0=don't align) +align_var_struct_span = 99 # number + +# The span for aligning struct initializer values (0=don't align) +align_struct_init_span = 3 # number + +# The minimum space between the type and the synonym of a typedef +align_typedef_gap = 1 # number + +# The span for aligning single-line typedefs (0=don't align) +align_typedef_span = 5 # number + +# Controls the positioning of the '*' in typedefs. Just try it. +# 0: Align on typdef type, ignore '*' +# 1: The '*' is part of type name: typedef int *pint; +# 2: The '*' is part of the type: typedef int * pint; +align_typedef_star_style = 1 # number + +# The span for aligning comments that end lines (0=don't align) +align_right_cmt_span = 3 # number + +# The span for aligning function prototypes (0=don't align) +align_func_proto_span = 0 # number + +# Whether to align macros wrapped with a backslash and a newline +align_nl_cont = true # false/true + +# The minimum space between label and value of a preprocessor define +align_pp_define_gap = 4 # number + +# The span for aligning on '#define' bodies (0=don't align) +align_pp_define_span = 3 # number + +# +# Newline adding and removing options +# + +# Try to limit code width to N number of columns +code_width = 0 # number + +# Whether to collapse empty blocks between '{' and '}' +nl_collapse_empty_body = true # false/true + +# Don't touch one-line function bodies inside a class xx { } body +nl_class_leave_one_liners = true # false/true + +# Add or remove newlines at the start of the file +nl_start_of_file = remove # ignore/add/remove/force + +# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' +nl_start_of_file_min = 0 # number + +# Add or remove newline at the end of the file +nl_end_of_file = force # ignore/add/remove/force + +# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') +nl_end_of_file_min = 1 # number + +# Add or remove newline between '=' and '{' +nl_assign_brace = remove # ignore/add/remove/force + +# The number of newlines after a block of variable definitions +nl_func_var_def_blk = 1 # number + +# Add or remove newline between function call and '(' +nl_fcall_brace = add # ignore/add/remove/force + +# Add or remove newline between 'enum' and '{' +nl_enum_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'struct and '{' +nl_struct_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'union' and '{' +nl_union_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'if' and '{' +nl_if_brace = remove # ignore/add/remove/force + +# Add or remove newline between '}' and 'else' +nl_brace_else = add # ignore/add/remove/force + +# Add or remove newline between 'else if' and '{' +# If set to ignore, nl_if_brace is used instead +nl_elseif_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'else' and '{' +nl_else_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'for' and '{' +nl_for_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'while' and '{' +nl_while_brace = remove # ignore/add/remove/force + +# Add or remove newline between 'do' and '{' +nl_do_brace = remove # ignore/add/remove/force + +# Add or remove newline between '}' and 'while' of 'do' statement +nl_brace_while = remove # ignore/add/remove/force + +# Add or remove newline between 'switch' and '{' +nl_switch_brace = remove # ignore/add/remove/force + +# Whether to put a newline before 'case' statement +nl_before_case = true # false/true + +# Whether to put a newline after 'case' statement +nl_after_case = false # false/true + +# Newline between namespace and { +nl_namespace_brace = ignore # ignore/add/remove/force + +# Add or remove newline between 'template<>' and 'class' +nl_template_class = add # ignore/add/remove/force + +# Add or remove newline between 'class' and '{' +nl_class_brace = remove # ignore/add/remove/force + +# Add or remove newline after each ',' in the constructor member initialization +nl_class_init_args = add # ignore/add/remove/force + +# Add or remove newline between return type and function name in definition +nl_func_type_name = ignore # ignore/add/remove/force + +# Add or remove newline after '(' in a function declaration +nl_func_decl_start = ignore # ignore/add/remove/force + +# Add or remove newline after each ',' in a function declaration +nl_func_decl_args = ignore # ignore/add/remove/force + +# Add or remove newline before the ')' in a function declaration +nl_func_decl_end = ignore # ignore/add/remove/force + +# Add or remove newline between function signature and '{' +nl_fdef_brace = add # ignore/add/remove/force + +# Whether to put a newline after 'return' statement +nl_after_return = true # false/true + +# Whether to put a newline after semicolons, except in 'for' statements +nl_after_semicolon = false # false/true + +# Whether to put a newline after brace open +nl_after_brace_open = false # false/true + +# Whether to alter newlines in '#define' macros +nl_define_macro = false # false/true + +# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' +nl_squeeze_ifdef = true # false/true + +# Add or remove newline before 'if' +nl_before_if = ignore # ignore/add/remove/force + +# Add or remove newline after 'if' +nl_after_if = ignore # ignore/add/remove/force + +# Add or remove newline before 'for' +nl_before_for = ignore # ignore/add/remove/force + +# Add or remove newline after 'for' +nl_after_for = ignore # ignore/add/remove/force + +# Add or remove newline before 'while' +nl_before_while = ignore # ignore/add/remove/force + +# Add or remove newline after 'while' +nl_after_while = ignore # ignore/add/remove/force + +# Add or remove newline before 'switch' +nl_before_switch = ignore # ignore/add/remove/force + +# Add or remove newline after 'switch' +nl_after_switch = ignore # ignore/add/remove/force + +# Add or remove newline before 'do' +nl_before_do = ignore # ignore/add/remove/force + +# Add or remove newline after 'do' +nl_after_do = ignore # ignore/add/remove/force + +# +# Positioning options +# + +# The position of boolean operators in wrapped expressions +pos_bool = trail # ignore/lead/trail + +# The position of colons between constructor and member initialization +pos_class_colon = lead # ignore/lead/trail + +# +# Blank line options +# + +# The maximum consecutive newlines +nl_max = 4 # number + +# The number of newlines after a function prototype, if followed by another function prototype +nl_after_func_proto = 0 # number + +# The number of newlines after a function prototype, if not followed by another function prototype +nl_after_func_proto_group = 2 # number + +# The number of newlines after '}' of the function body +nl_after_func_body = 2 # number + +# The minimum number of newlines before a multi-line comment (doesn't apply if after a brace open) +nl_before_block_comment = 2 # number + +# Whether to remove blank lines after '{' +eat_blanks_after_open_brace = true # false/true + +# Whether to remove blank lines before '}' +eat_blanks_before_close_brace = true # false/true + +# +# Code modifying options (non-whitespace) +# + +# Add or remove braces on single-line 'do' statement +mod_full_brace_do = add # ignore/add/remove/force + +# Add or remove braces on single-line 'for' statement +mod_full_brace_for = add # ignore/add/remove/force + +# Add or remove braces on single-line function defintions. (Pawn) +mod_full_brace_function = ignore # ignore/add/remove/force + +# Add or remove braces on single-line 'if' statement +mod_full_brace_if = add # ignore/add/remove/force + +# Don't remove braces around statements that span N newlines +mod_full_brace_nl = 0 # number + +# Add or remove braces on single-line 'while' statement +mod_full_brace_while = add # ignore/add/remove/force + +# Add or remove unnecessary paren on 'return' statement +mod_paren_on_return = remove # ignore/add/remove/force + +# Whether to change optional semicolons to real semicolons +mod_pawn_semicolon = false # false/true + +# +# Comment modifications +# + +# Whether to group cpp-comments that look like they are in a block +cmt_cpp_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined cpp-comment +cmt_cpp_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined cpp-comment +cmt_cpp_nl_end = false # false/true + +# Whether to change cpp-comments into c-comments +cmt_cpp_to_c = true # false/true + +# Whether to put a star on subsequent comment lines +cmt_star_cont = true # false/true + +# +# Preprocessor options +# + +# Add or remove indent of preprocessor directives +pp_indent = ignore # ignore/add/remove/force + +# Add or remove space between # and, say, define +pp_space = ignore # ignore/add/remove/force diff --git a/lnav.m4 b/lnav.m4 new file mode 100644 index 00000000..704e8f62 --- /dev/null +++ b/lnav.m4 @@ -0,0 +1,142 @@ +AC_DEFUN([AX_PATH_LIB_PCRE],[dnl +AC_MSG_CHECKING([lib pcre]) +AC_ARG_WITH(pcre, +[ --with-pcre[[=prefix]] compile xmlpcre part (via libpcre check)],, + with_pcre="yes") +if test ".$with_pcre" = ".no" ; then + AC_MSG_RESULT([disabled]) + m4_ifval($2,$2) +else + AC_MSG_RESULT([(testing)]) + AC_CHECK_LIB(pcre, pcre_study) + AC_CHECK_HEADERS(pcre.h pcre/pcre.h) + if test "$ac_cv_lib_pcre_pcre_study" = "yes" ; then + PCRE_LIBS="-lpcre" + AC_MSG_CHECKING([lib pcre]) + AC_MSG_RESULT([$PCRE_LIBS]) + m4_ifval($1,$1) + else + OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$with_pcre/lib" + OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_pcre/include" + AC_CHECK_LIB(pcre, pcre_compile) + CPPFLAGS="$OLDCPPFLAGS" + LDFLAGS="$OLDLDFLAGS" + if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then + AC_MSG_RESULT(.setting PCRE_LIBS -L$with_pcre/lib -lpcre) + PCRE_LIBS="-L$with_pcre/lib -lpcre" + test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include" + AC_MSG_CHECKING([lib pcre]) + AC_MSG_RESULT([$PCRE_LIBS]) + m4_ifval($1,$1) + else + AC_MSG_CHECKING([lib pcre]) + AC_MSG_RESULT([no, (WARNING)]) + m4_ifval($2,$2) + fi + fi +fi +AC_SUBST([PCRE_LIBS]) +AC_SUBST([PCRE_CFLAGS]) +]) + +AC_DEFUN([AX_PATH_LIB_READLINE],[dnl +AC_MSG_CHECKING([lib readline]) +AC_ARG_WITH(readline, +[ --with-readline[[=prefix]] compile xmlreadline part (via libreadline check)],, + with_readline="yes") +if test ".$with_readline" = ".no" ; then + AC_MSG_RESULT([disabled]) + m4_ifval($2,$2) +else + if test ".$with_readline" = ".yes"; then + OLD_LIBS="$LIBS" + AC_CHECK_LIB(readline, readline, [], [], [-ltermcap]) + LIBS="$OLD_LIBS" + if test "$ac_cv_lib_readline_readline" = "yes"; then + READLINE_LIBS="-lreadline" + AC_MSG_CHECKING([lib readline]) + AC_MSG_RESULT([$READLINE_LIBS]) + m4_ifval($1,$1) + else + AC_MSG_CHECKING([lib readline]) + AC_MSG_RESULT([no, (WARNING)]) + m4_ifval($2,$2) + fi + else + LIBS="$LIBS $with_readline/lib/libreadline.a" + OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_readline/include" + AC_CHECK_HEADERS(readline.h readline/readline.h) + CPPFLAGS="$OLDCPPFLAGS" + READLINE_LIBS="$with_readline/lib/libreadline.a" + test -d "$with_readline/include" && READLINE_CFLAGS="-I$with_readline/include" + AC_MSG_CHECKING([lib readline]) + AC_MSG_RESULT([$READLINE_LIBS]) + m4_ifval($1,$1) + fi +fi +AC_SUBST([READLINE_LIBS]) +AC_SUBST([READLINE_CFLAGS]) +]) + + +AC_DEFUN([MP_WITH_CURSES], + [AC_ARG_WITH(ncurses, [ --with-ncurses Force the use of ncurses over curses],,) + mp_save_LIBS="$LIBS" + CURSES_LIB="" + if test "$with_ncurses" != yes + then + AC_CACHE_CHECK([for working curses], mp_cv_curses, + [LIBS="$LIBS -lcurses" + AC_TRY_LINK( + [#include ], + [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], + mp_cv_curses=yes, mp_cv_curses=no)]) + if test "$mp_cv_curses" = yes + then + AC_DEFINE(HAVE_CURSES_H, [], [curses library]) + CURSES_LIB="-lcurses" + fi + fi + if test ! "$CURSES_LIB" + then + AC_CACHE_CHECK([for working ncurses], mp_cv_ncurses, + [LIBS="$mp_save_LIBS -lncurses" + AC_TRY_LINK( + [#include ], + [chtype a; int b=A_STANDOUT, c=KEY_LEFT; initscr(); ], + mp_cv_ncurses=yes, mp_cv_ncurses=no)]) + if test "$mp_cv_ncurses" = yes + then + AC_DEFINE(HAVE_NCURSES_H, [], [curses library]) + CURSES_LIB="-lncurses" + fi + fi + LIBS="$mp_save_LIBS" + AC_SUBST(CURSES_LIB) +])dnl + + +AC_DEFUN([AX_PATH_LIB_SOCI],[dnl +AC_MSG_CHECKING([lib soci]) +AC_ARG_WITH(soci, +[ --with-soci[[=prefix]] compile soci part (via libsoci check)],, + with_soci="yes") +if test ".$with_soci" = ".no" ; then + AC_MSG_RESULT([disabled]) + m4_ifval($2,$2) +else + AC_MSG_RESULT([(testing)]) + AC_LANG_PUSH([C++]) + AC_CHECK_HEADERS(soci/soci.h) + AC_LANG_POP([C++]) + if test "$ac_cv_header_soci_soci_h" = "yes" ; then + if test ".$with_soci" == ".yes"; then + with_soci="/usr/local/include" + fi + SOCI_CXXFLAGS="-I${with_soci}/soci -I${with_soci}/soci/sqlite3" + SOCI_LIBS="-lsoci_sqlite3-gcc-3_0 -lsoci_core-gcc-3_0" + fi +fi +AC_SUBST([SOCI_LIBS]) +AC_SUBST([SOCI_CXXFLAGS]) +]) diff --git a/missing b/missing new file mode 100755 index 00000000..6a37006e --- /dev/null +++ b/missing @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1Help2man' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 00000000..8ab885ec --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,99 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) # -h for help + echo "${usage}" 1>&2; exit 0 ;; + -m ) # -m PERM arg + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + dirmode="${1}" + shift ;; + -- ) shift; break ;; # stop option processing + -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option + * ) break ;; # first non-opt arg + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in +0) exit 0 ;; +esac + +case $dirmode in +'') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi ;; +*) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 3 +# End: +# mkinstalldirs ends here diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 00000000..e79cf25e --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,82 @@ + +bin_PROGRAMS = lnav + +noinst_LIBRARIES = libdiag.a + +if HAVE_OBJCOPY +help.txt.term: help.txt + cat $< > $@ + /bin/echo -en '\000' >> $@ + +help.o: help.txt.term + objcopy -I binary -O elf64-x86-64 -Bi386 \ + --redefine-sym _binary_help_txt_term_start=help_text_start \ + --redefine-sym _binary_help_txt_term_end=help_text_end \ + --redefine-sym _binary_help_txt_term_size=help_text_size \ + $< $@ + +HELP_O = help.o +HELP_SRC = +else +HELP_O = +HELP_SRC = help.cc +endif + +AM_LDFLAGS = \ + $(SQLITE3_LDFLAGS) + +AM_CPPFLAGS = \ + $(SQLITE3_CFLAGS) \ + $(SOCI_CXXFLAGS) + +LDADD = \ + libdiag.a \ + $(READLINE_LIBS) \ + $(CURSES_LIB) \ + $(HELP_O) \ + $(SOCI_LIBS) \ + /usr/lib/libsqlite3.a \ + -ldl \ + -lz \ + -lpcrecpp + +noinst_HEADERS = \ + bookmarks.hh \ + grep_proc.hh \ + help.hh \ + hist_source.hh \ + line_buffer.hh \ + listview_curses.hh \ + log_format.hh \ + logfile.hh \ + logfile_sub_source.hh \ + readline_curses.hh \ + statusview_curses.hh \ + piper_proc.hh \ + textview_curses.hh \ + view_curses.hh \ + vt52_curses.hh \ + log_vtab_impl.hh + +libdiag_a_SOURCES = \ + bookmarks.cc \ + grep_proc.cc \ + hist_source.cc \ + line_buffer.cc \ + listview_curses.cc \ + log_format.cc \ + logfile.cc \ + logfile_sub_source.cc \ + readline_curses.cc \ + statusview_curses.cc \ + piper_proc.cc \ + textview_curses.cc \ + view_curses.cc \ + vt52_curses.cc \ + log_vtab_impl.cc + +lnav_SOURCES = lnav.cc $(HELP_SRC) + +uncrusty: + (cd $(srcdir) && uncrustify -c ../lnav.cfg --replace $(SOURCES) \ + $(HEADERS)) diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 00000000..3fcb2601 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,580 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = lnav$(EXEEXT) +subdir = src +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/ax_sqlite3.m4 \ + $(top_srcdir)/lnav.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libdiag_a_AR = $(AR) $(ARFLAGS) +libdiag_a_LIBADD = +am_libdiag_a_OBJECTS = bookmarks.$(OBJEXT) grep_proc.$(OBJEXT) \ + hist_source.$(OBJEXT) line_buffer.$(OBJEXT) \ + listview_curses.$(OBJEXT) log_format.$(OBJEXT) \ + logfile.$(OBJEXT) logfile_sub_source.$(OBJEXT) \ + readline_curses.$(OBJEXT) statusview_curses.$(OBJEXT) \ + piper_proc.$(OBJEXT) textview_curses.$(OBJEXT) \ + view_curses.$(OBJEXT) vt52_curses.$(OBJEXT) \ + log_vtab_impl.$(OBJEXT) +libdiag_a_OBJECTS = $(am_libdiag_a_OBJECTS) +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am__lnav_SOURCES_DIST = lnav.cc help.cc +@HAVE_OBJCOPY_FALSE@am__objects_1 = help.$(OBJEXT) +am_lnav_OBJECTS = lnav.$(OBJEXT) $(am__objects_1) +lnav_OBJECTS = $(am_lnav_OBJECTS) +lnav_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +@HAVE_OBJCOPY_TRUE@am__DEPENDENCIES_2 = help.o +lnav_DEPENDENCIES = libdiag.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_1) /usr/lib/libsqlite3.a +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +SOURCES = $(libdiag_a_SOURCES) $(lnav_SOURCES) +DIST_SOURCES = $(libdiag_a_SOURCES) $(am__lnav_SOURCES_DIST) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CFLAGS_PG = @CFLAGS_PG@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSES_LIB = @CURSES_LIB@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCRE_CFLAGS = @PCRE_CFLAGS@ +PCRE_LIBS = @PCRE_LIBS@ +RANLIB = @RANLIB@ +READLINE_CFLAGS = @READLINE_CFLAGS@ +READLINE_LIBS = @READLINE_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOCI_CXXFLAGS = @SOCI_CXXFLAGS@ +SOCI_LIBS = @SOCI_LIBS@ +SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ +SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ +SQLITE3_LIBS = @SQLITE3_LIBS@ +SQLITE3_VERSION = @SQLITE3_VERSION@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +abssrcdir = @abssrcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LIBRARIES = libdiag.a +@HAVE_OBJCOPY_FALSE@HELP_O = +@HAVE_OBJCOPY_TRUE@HELP_O = help.o +@HAVE_OBJCOPY_FALSE@HELP_SRC = help.cc +@HAVE_OBJCOPY_TRUE@HELP_SRC = +AM_LDFLAGS = \ + $(SQLITE3_LDFLAGS) + +AM_CPPFLAGS = \ + $(SQLITE3_CFLAGS) \ + $(SOCI_CXXFLAGS) + +LDADD = \ + libdiag.a \ + $(READLINE_LIBS) \ + $(CURSES_LIB) \ + $(HELP_O) \ + $(SOCI_LIBS) \ + /usr/lib/libsqlite3.a \ + -ldl \ + -lz \ + -lpcrecpp + +noinst_HEADERS = \ + bookmarks.hh \ + grep_proc.hh \ + help.hh \ + hist_source.hh \ + line_buffer.hh \ + listview_curses.hh \ + log_format.hh \ + logfile.hh \ + logfile_sub_source.hh \ + readline_curses.hh \ + statusview_curses.hh \ + piper_proc.hh \ + textview_curses.hh \ + view_curses.hh \ + vt52_curses.hh \ + log_vtab_impl.hh + +libdiag_a_SOURCES = \ + bookmarks.cc \ + grep_proc.cc \ + hist_source.cc \ + line_buffer.cc \ + listview_curses.cc \ + log_format.cc \ + logfile.cc \ + logfile_sub_source.cc \ + readline_curses.cc \ + statusview_curses.cc \ + piper_proc.cc \ + textview_curses.cc \ + view_curses.cc \ + vt52_curses.cc \ + log_vtab_impl.cc + +lnav_SOURCES = lnav.cc $(HELP_SRC) +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .cc .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status src/config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libdiag.a: $(libdiag_a_OBJECTS) $(libdiag_a_DEPENDENCIES) + -rm -f libdiag.a + $(libdiag_a_AR) libdiag.a $(libdiag_a_OBJECTS) $(libdiag_a_LIBADD) + $(RANLIB) libdiag.a +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +lnav$(EXEEXT): $(lnav_OBJECTS) $(lnav_DEPENDENCIES) + @rm -f lnav$(EXEEXT) + $(CXXLINK) $(lnav_OBJECTS) $(lnav_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bookmarks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grep_proc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hist_source.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line_buffer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listview_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lnav.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_format.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_vtab_impl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logfile_sub_source.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/piper_proc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readline_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/statusview_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/textview_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/view_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vt52_curses.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) config.h +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-noinstLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS + + +@HAVE_OBJCOPY_TRUE@help.txt.term: help.txt +@HAVE_OBJCOPY_TRUE@ cat $< > $@ +@HAVE_OBJCOPY_TRUE@ /bin/echo -en '\000' >> $@ + +@HAVE_OBJCOPY_TRUE@help.o: help.txt.term +@HAVE_OBJCOPY_TRUE@ objcopy -I binary -O elf64-x86-64 -Bi386 \ +@HAVE_OBJCOPY_TRUE@ --redefine-sym _binary_help_txt_term_start=help_text_start \ +@HAVE_OBJCOPY_TRUE@ --redefine-sym _binary_help_txt_term_end=help_text_end \ +@HAVE_OBJCOPY_TRUE@ --redefine-sym _binary_help_txt_term_size=help_text_size \ +@HAVE_OBJCOPY_TRUE@ $< $@ + +uncrusty: + (cd $(srcdir) && uncrustify -c ../lnav.cfg --replace $(SOURCES) \ + $(HEADERS)) +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/auto_fd.hh b/src/auto_fd.hh new file mode 100644 index 00000000..65a39fb9 --- /dev/null +++ b/src/auto_fd.hh @@ -0,0 +1,169 @@ +/** + * @file auto_fd.hh + */ + +#ifndef __auto_fd_hh +#define __auto_fd_hh + +#include +#include +#include + +#include +#include + +/** + * Resource management class for file descriptors. + * + * @see auto_ptr + */ +class auto_fd { +public: + /** + * Wrapper for the posix pipe(2) function that stores the file descriptor + * results in an auto_fd array. + * + * @param af An array of atleast two auto_fd elements, where the first + * contains the reader end of the pipe and the second contains the writer. + * @return The result of the pipe(2) function. + */ + static int pipe(auto_fd *af) + { + int retval, fd[2]; + + assert(fd != NULL); + + if ((retval = ::pipe(fd)) == 0) { + af[0] = fd[0]; + af[1] = fd[1]; + } + + return(retval); + }; + + /** + * Construct an auto_fd to manage the given file descriptor. + * + * @param fd The file descriptor to be managed. + */ + auto_fd(int fd = -1) + : af_fd(fd) + { + assert(fd >= -1); + assert(fd < FD_SETSIZE); + }; + + /** + * Non-const copy constructor. Management of the file descriptor will be + * transferred from the source to this object and the source will be + * cleared. + * + * @param af The source of the file descriptor. + */ + auto_fd(auto_fd &af) + : af_fd(af.release()) { }; + + /** + * Const copy constructor. The file descriptor from the source will be + * dup(2)'d and the new descriptor stored in this object. + * + * @param af The source of the file descriptor. + */ + auto_fd(const auto_fd &af) + : af_fd(-1) + { + if (af.af_fd != -1 && (this->af_fd = dup(af.af_fd)) == -1) { + throw std::bad_alloc(); + } + }; + + /** + * Destructor that will close the file descriptor managed by this object. + */ + ~auto_fd() { this->reset(); }; + + /** @return The file descriptor as a pain integer. */ + operator int(void) const { return(this->af_fd); }; + + /** + * Replace the current descriptor with the given one. The current + * descriptor will be closed. + * + * @param fd The file descriptor to store in this object. + * @return *this + */ + auto_fd &operator=(int fd) + { + assert(fd >= -1); + assert(fd < FD_SETSIZE); + + this->reset(fd); + return(*this); + }; + + /** + * Transfer management of the given file descriptor to this object. + * + * @param af The old manager of the file descriptor. + * @return *this + */ + auto_fd &operator=(auto_fd &af) + { + this->reset(af.release()); + return(*this); + }; + + /** + * Return a pointer that can be passed to functions that require an out + * parameter for file descriptors (e.g. openpty). + * + * @return A pointer to the internal integer. + */ + int *out(void) + { + this->reset(); + return(&this->af_fd); + }; + + /** + * Stop managing the file descriptor in this object and return its value. + * + * @return The file descriptor. + */ + int release(void) + { + int retval = this->af_fd; + + this->af_fd = -1; + return(retval); + }; + + /** + * @return The file descriptor. + */ + int get(void) const { return(this->af_fd); }; + + /** + * Closes the current file descriptor and replaces its value with the given + * one. + * + * @param fd The new file descriptor to be managed. + */ + void reset(int fd = -1) + { + assert(fd >= -1); + assert(fd < FD_SETSIZE); + + if (this->af_fd != fd) { + if (this->af_fd != -1) { + close(this->af_fd); + } + this->af_fd = fd; + } + }; + +private: + int af_fd; /*< The managed file descriptor. */ +}; + +#endif diff --git a/src/auto_mem.hh b/src/auto_mem.hh new file mode 100644 index 00000000..d16b084a --- /dev/null +++ b/src/auto_mem.hh @@ -0,0 +1,68 @@ +/** + * @file auto_mem.hh + */ + +#ifndef __auto_mem_hh +#define __auto_mem_hh + +#include +#include +#include + +#include + +/** + * Resource management class for memory allocated by a custom allocator. + * + * @param T The object type. + * @param auto_free The function to call to free the managed object. + */ +template +class auto_mem { + +public: + auto_mem(T *ptr = NULL) : am_ptr(ptr) { }; + + auto_mem(auto_mem &am) : am_ptr(am.release()) { }; + + ~auto_mem() { this->reset(); }; + + operator T *(void) const { return this->am_ptr; }; + + auto_mem &operator=(T *ptr) { + this->reset(ptr); + return *this; + }; + + auto_mem &operator=(auto_mem &am) { + this->reset(am.release()); + return *this; + }; + + T *release(void) { + T *retval = this->am_ptr; + + this->am_ptr = NULL; + return retval; + }; + + T *in(void) { return this->am_ptr; }; + + T **out(void) { + this->reset(); + return &this->am_ptr; + }; + + void reset(T *ptr = NULL) { + if (this->am_ptr != ptr) { + auto_free(this->am_ptr); + this->am_ptr = ptr; + } + }; + +private: + T *am_ptr; + +}; + +#endif diff --git a/src/auto_temp_file.hh b/src/auto_temp_file.hh new file mode 100644 index 00000000..ee02b4d5 --- /dev/null +++ b/src/auto_temp_file.hh @@ -0,0 +1,57 @@ + +#ifndef __auto_temp_file_hh +#define __auto_temp_file_hh + +#include + +#include + +class auto_temp_file { +public: + auto_temp_file(const char *cpat = NULL) { + this->reset(cpat); + }; + + auto_temp_file(auto_temp_file &atf) : atf_name(atf.release()) { }; + + ~auto_temp_file() { this->reset(); }; + + operator std::string(void) const { return this->atf_name; }; + + auto_temp_file &operator=(const char *cpat) { + this->reset(cpat); + return *this; + }; + + auto_temp_file &operator=(auto_temp_file &atf) { + this->reset(); + this->atf_name = atf.release(); + return *this; + }; + + std::string release(void) { + std::string retval = this->atf_name; + + this->atf_name.clear(); + return retval; + }; + + void reset(const char *cpat = NULL) { + if (!this->atf_name.empty()) { + unlink(this->atf_name.c_str()); + this->atf_name.clear(); + } + if (cpat != NULL) { + char *pat = (char *)alloca(strlen(cpat) + 1); /* XXX */ + + strcpy(pat, cpat); + mktemp(pat); + this->atf_name = pat; + } + }; + +private: + std::string atf_name; +}; + +#endif diff --git a/src/bookmarks.cc b/src/bookmarks.cc new file mode 100644 index 00000000..b4bc8e86 --- /dev/null +++ b/src/bookmarks.cc @@ -0,0 +1,42 @@ +/** + * @file bookmarks.cc + */ + +#include "bookmarks.hh" + +vis_line_t bookmark_vector::next(vis_line_t start) +{ + std::vector::iterator ub; + + vis_line_t retval(-1); + + assert(start >= -1); + + ub = upper_bound(this->begin(), this->end(), start); + if (ub != this->end()) { + retval = *ub; + } + + assert(retval == -1 || start < retval); + + return retval; +} + +vis_line_t bookmark_vector::prev(vis_line_t start) +{ + std::vector::iterator lb; + + vis_line_t retval(-1); + + assert(start >= 0); + + lb = lower_bound(this->begin(), this->end(), start); + if (lb != this->begin()) { + lb -= 1; + retval = *lb; + } + + assert(retval < start); + + return retval; +} diff --git a/src/bookmarks.hh b/src/bookmarks.hh new file mode 100644 index 00000000..677babfb --- /dev/null +++ b/src/bookmarks.hh @@ -0,0 +1,84 @@ +/** + * @file bookmarks.hh + */ + +#ifndef __bookmarks_hh +#define __bookmarks_hh + +#include + +#include +#include +#include + +#include "listview_curses.hh" + +/** + * Extension of the STL vector that is used to store bookmarks for + * files being viewed, where a bookmark is just a particular line in + * the file(s). The value-added over the standard vector are some + * methods for doing content-wise iteration. In other words, given a + * value that may or may not be in the vector, find the next or + * previous value that is in the vector. + * + * @note The vector is expected to be sorted. + */ +class bookmark_vector + : public std::vector { +public: + + /** + * Insert a bookmark into this vector, but only if it is not already in the + * vector. + * + * @param vl The line to bookmark. + */ + iterator insert_once(vis_line_t vl) + { + iterator lb, retval; + + assert(vl >= 0); + + lb = std::lower_bound(this->begin(), this->end(), vl); + if (lb == this->end() || *lb != vl) { + this->insert(lb, vl); + retval = this->end(); + } + else { + retval = lb; + } + + return retval; + }; + + /** + * @param start The value to start the search for the next bookmark. + * @return The next bookmark value in the vector or -1 if there are + * no more remaining bookmarks. If the 'start' value is a bookmark, + * the next bookmark is returned. If the 'start' value is not a + * bookmark, the next highest value in the vector is returned. + */ + vis_line_t next(vis_line_t start); + + /** + * @param start The value to start the search for the previous + * bookmark. + * @return The previous bookmark value in the vector or -1 if there + * are no more prior bookmarks. + * @see next + */ + vis_line_t prev(vis_line_t start); +}; + +/** + * Dummy type whose instances are used to distinguish between + * bookmarks maintained by different source modules. + */ +class bookmark_type_t { }; + +/** + * Map of bookmark types to bookmark vectors. + */ +typedef std::map bookmarks; + +#endif diff --git a/src/bottom_status_source.hh b/src/bottom_status_source.hh new file mode 100644 index 00000000..13d84aff --- /dev/null +++ b/src/bottom_status_source.hh @@ -0,0 +1,203 @@ + +#ifndef _bottom_status_source_hh +#define _bottom_status_source_hh + +#include + +class bottom_status_source + : public status_data_source, + public grep_proc_control +{ + +public: + + typedef listview_curses::action::mem_functor_t< + bottom_status_source> lv_functor_t; + typedef textview_curses::action::mem_functor_t< + bottom_status_source> tv_functor_t; + + typedef enum { + BSF_LINE_NUMBER, + BSF_PERCENT, + BSF_HITS, + BSF_WARNINGS, + BSF_ERRORS, + BSF_FILTERED, + BSF_LOADING, + + BSF__MAX + } field_t; + + bottom_status_source() + : bss_error(80, view_colors::VCR_ALERT_STATUS), + line_number_wire(*this, &bottom_status_source::update_line_number), + percent_wire(*this, &bottom_status_source::update_percent), + marks_wire(*this, &bottom_status_source::update_marks), + hits_wire(*this, &bottom_status_source::update_hits), + bss_hit_spinner(0), + bss_load_percent(0) { + this->bss_fields[BSF_LINE_NUMBER].set_width(8); + this->bss_fields[BSF_PERCENT].set_width(4); + this->bss_fields[BSF_HITS].set_width(16); + this->bss_fields[BSF_HITS].set_cylon(true); + this->bss_fields[BSF_WARNINGS].set_width(10); + this->bss_fields[BSF_ERRORS].set_width(10); + this->bss_fields[BSF_ERRORS].set_role(view_colors::VCR_ALERT_STATUS); + this->bss_fields[BSF_FILTERED].set_width(14); + this->bss_fields[BSF_LOADING].set_width(13); + this->bss_fields[BSF_LOADING].set_cylon(true); + this->bss_fields[BSF_LOADING].right_justify(true); + }; + + virtual ~bottom_status_source() { }; + + lv_functor_t line_number_wire; + lv_functor_t percent_wire; + lv_functor_t marks_wire; + tv_functor_t hits_wire; + + status_field &get_field(field_t id) { return this->bss_fields[id]; }; + + void grep_error(std::string msg) { + this->bss_error.set_value(msg); + }; + + size_t statusview_fields(void) { + size_t retval; + + if (this->bss_error.empty()) + retval = BSF__MAX; + else + retval = 1; + + return retval; + }; + + status_field &statusview_value_for_field(int field) { + if (this->bss_error.empty()) + return this->get_field((field_t)field); + else + return this->bss_error; + }; + + void update_line_number(listview_curses *lc) { + status_field &sf = this->bss_fields[BSF_LINE_NUMBER]; + + if (lc->get_inner_height() == 0) + sf.set_value("L0"); + else + sf.set_value("L%d", (int)lc->get_top()); + }; + + void update_percent(listview_curses *lc) { + status_field &sf = this->bss_fields[BSF_PERCENT]; + vis_line_t top = lc->get_top(); + vis_line_t bottom, height; + unsigned long width; + double percent; + + lc->get_dimensions(height, width); + + if (lc->get_inner_height() > 0) { + bottom = std::min(top + height - vis_line_t(1), + vis_line_t(lc->get_inner_height() - 1)); + percent = (double)(bottom + 1); + percent /= (double)lc->get_inner_height(); + percent *= 100.0; + } + else { + percent = 0.0; + } + sf.set_value("%3d%%", (int)percent); + }; + + void update_marks(listview_curses *lc) { + textview_curses *tc = static_cast(lc); + status_field &sfw = this->bss_fields[BSF_WARNINGS]; + status_field &sfe = this->bss_fields[BSF_ERRORS]; + bookmarks &bm = tc->get_bookmarks(); + unsigned long width; + vis_line_t height; + + tc->get_dimensions(height, width); + if (bm.find(&logfile_sub_source::BM_WARNINGS) != bm.end()) { + bookmark_vector &bv = bm[&logfile_sub_source::BM_WARNINGS]; + bookmark_vector::iterator iter; + + iter = lower_bound(bv.begin(), bv.end(), tc->get_top() + height); + sfw.set_value("%9dW", distance(iter, bv.end())); + } + else { + sfw.clear(); + } + + if (bm.find(&logfile_sub_source::BM_ERRORS) != bm.end()) { + bookmark_vector &bv = bm[&logfile_sub_source::BM_ERRORS]; + bookmark_vector::iterator iter; + + iter = lower_bound(bv.begin(), bv.end(), tc->get_top() + height); + sfe.set_value("%9dE", distance(iter, bv.end())); + } + else { + sfe.clear(); + } + }; + + void update_hits(textview_curses *tc) { + status_field &sf = this->bss_fields[BSF_HITS]; + view_colors::role_t new_role; + + if (tc->is_searching()) { + this->bss_hit_spinner += 1; + if (this->bss_hit_spinner % 2) + new_role = view_colors::VCR_ACTIVE_STATUS; + else + new_role = view_colors::VCR_ACTIVE_STATUS2; + sf.set_cylon(true); + } + else { + new_role = view_colors::VCR_STATUS; + sf.set_cylon(false); + } + sf.set_role(new_role); + this->bss_error.clear(); + sf.set_value("%9d hits", tc->get_match_count()); + }; + + void update_loading(off_t off, size_t total) { + status_field &sf = this->bss_fields[BSF_LOADING]; + + if (off == total) { + sf.set_role(view_colors::VCR_STATUS); + sf.clear(); + } + else { + int pct = ((double)off / (double)total) * 100.0; + + if (this->bss_load_percent != pct) { + + this->bss_load_percent = pct; + + sf.set_role(view_colors::VCR_ACTIVE_STATUS2); + sf.set_value(" Loading %2d%% ", pct); + } + } + }; + + void update_filtered(logfile_sub_source &lss) { + status_field &sf = this->bss_fields[BSF_FILTERED]; + + if (lss.get_filtered_count() == 0) + sf.clear(); + else + sf.set_value("%d Not Shown", lss.get_filtered_count()); + }; + +private: + status_field bss_error; + status_field bss_fields[BSF__MAX]; + int bss_hit_spinner; + int bss_load_percent; +}; + +#endif diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 00000000..b39a576e --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,103 @@ +/* src/config.h.in. Generated from configure.in by autoheader. */ + +/* curses library */ +#undef HAVE_CURSES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `pcre' library (-lpcre). */ +#undef HAVE_LIBPCRE + +/* Define to 1 if you have the `readline' library (-lreadline). */ +#undef HAVE_LIBREADLINE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* curses library */ +#undef HAVE_NCURSES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PCRE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PCRE_PCRE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_READLINE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_READLINE_READLINE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SOCI_SOCI_H + +/* sqlite3 */ +#undef HAVE_SQLITE3 + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UTIL_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of `off_t', as computed by sizeof. */ +#undef SIZEOF_OFF_T + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Needed for the 'timezone' variable */ +#undef _APPLE_C_SOURCE + +/* Need pread */ +#undef _BSD_SOURCE + +/* Need pread */ +#undef _XOPEN_SOURCE diff --git a/src/db_sub_source.hh b/src/db_sub_source.hh new file mode 100644 index 00000000..098e364e --- /dev/null +++ b/src/db_sub_source.hh @@ -0,0 +1,48 @@ + +#ifndef __db_sub_source_hh +#define __db_sub_source_hh + +#include +#include + +#include "hist_source.hh" + +class db_label_source : public hist_source::label_source { +public: + db_label_source() { }; + + ~db_label_source() { }; + + void hist_label_for_bucket(int bucket_start_value, + const hist_source::bucket_t &bucket, + std::string &label_out) { + /* + * start_value is the result rowid, each bucket type is a column value + * label_out should be the raw text output. + */ + + label_out.clear(); + if (bucket_start_value >= this->dls_rows.size()) + return; + for (int lpc = 0; lpc < this->dls_rows[bucket_start_value].size(); lpc++) { + label_out.append(this->dls_column_sizes[lpc] - this->dls_rows[bucket_start_value][lpc].length(), ' '); + label_out.append(this->dls_rows[bucket_start_value][lpc]); + } + }; + + void push_column(const char *colstr) { + int index = this->dls_rows.back().size(); + + this->dls_rows.back().push_back(colstr); + if (this->dls_rows.back().size() > this->dls_column_sizes.size()) { + this->dls_column_sizes.push_back(1); + } + this->dls_column_sizes[index] = + std::max(this->dls_column_sizes[index], strlen(colstr) + 1); + }; + + std::vector< std::vector< std::string > > dls_rows; + std::vector< size_t > dls_column_sizes; +}; + +#endif diff --git a/src/grep_proc.cc b/src/grep_proc.cc new file mode 100644 index 00000000..ad126f21 --- /dev/null +++ b/src/grep_proc.cc @@ -0,0 +1,339 @@ +/** + * @file grep_proc.cc + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "grep_proc.hh" + +#include "time_T.hh" + +using namespace std; + +grep_proc::grep_proc(pcre *code, + grep_proc_source &gps, + int &maxfd, + fd_set &readfds) + : gp_pcre(code), + gp_code(code), + gp_source(gps), + gp_pipe_offset(0), + gp_child(-1), + gp_child_started(false), + gp_maxfd(maxfd), + gp_readfds(readfds), + gp_last_line(0), + gp_sink(NULL), + gp_control(NULL) +{ + const char *errptr; + + this->gp_code_extra = pcre_study(code, 0, &errptr); + + assert(this->invariant()); +} + +grep_proc::~grep_proc() +{ + this->cleanup(); +} + +void grep_proc::handle_match(int line, + string &line_value, + int off, + int *matches, + int count) +{ + int lpc; + + if (off == 0) { + fprintf(stdout, "%d\n", line); + } + fprintf(stdout, "[%d:%d]\n", matches[0], matches[1]); + for (lpc = 1; lpc < count; lpc++) { + fprintf(stdout, + "(%d:%d)", + matches[lpc * 2], + matches[lpc * 2 + 1]); + fwrite(&(line_value.c_str()[matches[lpc * 2]]), + 1, + matches[lpc * 2 + 1] - + matches[lpc * 2], + stdout); + fputc('\n', stdout); + } +} + +void grep_proc::start(void) +{ + assert(this->invariant()); + + if (this->gp_child_started || this->gp_queue.empty()) { + return; + } + + auto_fd out_fd[2], err_fd[2]; + + /* Get ahold of some pipes for stdout and stderr. */ + if (auto_fd::pipe(out_fd) < 0) { + throw error(errno); + } + + if (auto_fd::pipe(err_fd) < 0) { + throw error(errno); + } + + if ((this->gp_child = fork()) < 0) { + throw error(errno); + } + + if (this->gp_child != 0) { + fcntl(out_fd[0], F_SETFL, O_NONBLOCK); + fcntl(out_fd[0], F_SETFD, 1); + this->gp_line_buffer.set_fd(out_fd[0]); + + fcntl(err_fd[0], F_SETFL, O_NONBLOCK); + fcntl(err_fd[0], F_SETFD, 1); + this->gp_err_pipe = err_fd[0]; + this->gp_child_started = true; + + FD_SET(this->gp_line_buffer.get_fd(), &this->gp_readfds); + FD_SET(this->gp_err_pipe, &this->gp_readfds); + this->gp_maxfd = std::max(this->gp_maxfd, + std::max(this->gp_line_buffer.get_fd(), + this->gp_err_pipe.get())); + this->gp_queue.clear(); + return; + } + + /* In the child... */ + + /* + * First, restore the default signal handlers so we don't hang around + * forever if there is a problem. + */ + signal(SIGINT, SIG_DFL); + signal(SIGTERM, SIG_DFL); + + /* Get rid of stdin, then */ + close(STDIN_FILENO); + open("/dev/null", O_RDONLY); + /* ... wire up the pipes. */ + dup2(out_fd[1].release(), STDOUT_FILENO); + /* dup2(err_fd[1].release(), STDERR_FILENO); */ + + this->child_init(); + + char outbuf[BUFSIZ * 2]; + string line_value; + + stdout = fdopen(STDOUT_FILENO, "w"); + /* Make sure buffering is on, not sure of the state in the parent. */ + if (setvbuf(stdout, outbuf, _IOFBF, BUFSIZ * 2) < 0) { + perror("setvbuf"); + } + line_value.reserve(BUFSIZ * 2); + while (!this->gp_queue.empty()) { + grep_line_t start_line = this->gp_queue.front().first; + grep_line_t stop_line = this->gp_queue.front().second; + bool done = false, got_first_hit = false; + int line; + + this->gp_queue.pop_front(); + if (start_line == -1) { + start_line = this->gp_last_line; + } + for (line = start_line; + (stop_line == -1 || line < stop_line) && !done; + line++) { + line_value.clear(); + done = !this->gp_source.grep_value_for_line(line, line_value); + if (!done) { + pcre_context_static<10> pc; + pcre_input pi(line_value); + + while (this->gp_pcre.match(pc, pi)) { + pcre_context::iterator pc_iter; + pcre_context::match_t *m; + + if (pi.pi_offset == 0) { + fprintf(stdout, "%d\n", line); + } + m = pc.all(); + fprintf(stdout, "[%d:%d]\n", m->m_begin, m->m_end); + for (pc_iter = pc.begin(); pc_iter != pc.end(); pc_iter++) { + fprintf(stdout, + "(%d:%d)", + pc_iter->m_begin, + pc_iter->m_end); + fwrite(pi.get_substr(pc_iter), + 1, + pc_iter->length(), + stdout); + fputc('\n', stdout); + } + } + + } + + if (((line + 1) % 10000) == 0) { + /* Periodically flush the buffer so the parent sees progress */ + this->child_batch(); + } + } + + fprintf(stdout, "%d\n", line - 1); + this->child_term(); + } + + exit(0); +} + +void grep_proc::cleanup(void) +{ + if (this->gp_child != -1 && this->gp_child != 0) { + int status; + + kill(this->gp_child, SIGTERM); + while (waitpid(this->gp_child, &status, 0) < 0 && (errno == EINTR)) { + ; + } + assert(!WIFSIGNALED(status) || WTERMSIG(status) != SIGABRT); + this->gp_child = -1; + this->gp_child_started = false; + + if (this->gp_sink) { + this->gp_sink->grep_end(*this); + } + } + + if (this->gp_err_pipe != -1) { + FD_CLR(this->gp_err_pipe, &this->gp_readfds); + this->gp_err_pipe.reset(); + } + + if (this->gp_line_buffer.get_fd() != -1) { + FD_CLR(this->gp_line_buffer.get_fd(), &this->gp_readfds); + } + + this->gp_pipe_offset = 0; + this->gp_line_buffer.reset(); + + assert(this->invariant()); + + if (!this->gp_queue.empty()) { + this->start(); + } +} + +void grep_proc::dispatch_line(char *line) +{ + int start, end, capture_start; + + assert(line != NULL); + + if (sscanf(line, "%d", this->gp_last_line.out()) == 1) { + /* Starting a new line with matches. */ + + assert(this->gp_last_line >= 0); + } + else if (sscanf(line, "[%d:%d]", &start, &end) == 2) { + assert(start >= 0); + assert(end >= 0); + + /* Pass the match offsets to the sink delegate. */ + if (this->gp_sink != NULL) { + this->gp_sink->grep_match(*this, this->gp_last_line, start, end); + } + } + else if (sscanf(line, "(%d:%d)%n", &start, &end, &capture_start) == 2) { + assert(start >= 0); + assert(end >= 0); + + /* Pass the match offsets to the sink delegate. */ + if (this->gp_sink != NULL) { + this->gp_sink->grep_capture(*this, + this->gp_last_line, + start, + end, + &line[capture_start]); + } + } + else { + fprintf(stderr, "bad line from child -- %s\n", line); + } +} + +void grep_proc::check_fd_set(fd_set &ready_fds) +{ + assert(this->invariant()); + + if (this->gp_err_pipe != -1 && FD_ISSET(this->gp_err_pipe, &ready_fds)) { + char buffer[1024 + 1]; + int rc; + + rc = read(this->gp_err_pipe, buffer, sizeof(buffer) - 1); + if (rc > 0) { + static const char *PREFIX = ": "; + + buffer[rc] = '\0'; + if (strncmp(buffer, PREFIX, strlen(PREFIX)) == 0) { + char *lf; + + if ((lf = strchr(buffer, '\n')) != NULL) { + *lf = '\0'; + } + if (this->gp_control != NULL) { + this->gp_control->grep_error(&buffer[strlen(PREFIX)]); + } + } + } + else if (rc == 0) { + FD_CLR(this->gp_err_pipe, &this->gp_readfds); + this->gp_err_pipe.reset(); + } + } + + if (this->gp_line_buffer.get_fd() != -1 && + FD_ISSET(this->gp_line_buffer.get_fd(), &ready_fds)) { + try { + static const int MAX_LOOPS = 100; + + int loop_count = 0; + size_t len; + char *line; + + while ((loop_count < MAX_LOOPS) && + (line = this->gp_line_buffer.read_line(this->gp_pipe_offset, + len)) != NULL) { + line[len] = '\0'; + this->dispatch_line(line); + loop_count += 1; + } + + if (this->gp_sink != NULL) { + this->gp_sink->grep_end_batch(*this); + } + + if ((off_t) this->gp_line_buffer.get_file_size() == + this->gp_pipe_offset) { + this->cleanup(); + } + } + catch (line_buffer::error & e) { + this->cleanup(); + } + } + + assert(this->invariant()); +} diff --git a/src/grep_proc.hh b/src/grep_proc.hh new file mode 100644 index 00000000..0e0ac84b --- /dev/null +++ b/src/grep_proc.hh @@ -0,0 +1,268 @@ +/** + * @file grep_proc.hh + */ + +#ifndef __grep_proc_hh +#define __grep_proc_hh + +#include +#include +#include +#include + +#ifdef HAVE_PCRE_H +#include +#elif HAVE_PCRE_PCRE_H +#include +#endif + +#include +#include +#include +#include + +#include "pcrepp.hh" +#include "auto_fd.hh" +#include "auto_mem.hh" +#include "strong_int.hh" +#include "line_buffer.hh" + +/** Strongly-typed integer for matched line numbers. */ +STRONG_INT_TYPE(int, grep_line); + +class grep_proc; + +/** + * Data source for lines to be searched using a grep_proc. + */ +class grep_proc_source { +public: + virtual ~grep_proc_source() { }; + + /** + * Get the value for a particular line in the source. + * + * @param line The line to retrieve. + * @param value_out The destination for the line value. + */ + virtual bool grep_value_for_line(int line, std::string &value_out) = 0; + + virtual std::string grep_source_name(void) { return ""; }; +}; + +class grep_proc_control { +public: + + virtual ~grep_proc_control() { }; + + /** @param msg The error encountered while attempting the grep. */ + virtual void grep_error(std::string msg) { }; +}; + +/** + * Sink for matches produced by a grep_proc instance. + */ +class grep_proc_sink { +public: + virtual ~grep_proc_sink() { }; + + /** Called at the start of a new grep run. */ + virtual void grep_begin(grep_proc &gp) { }; + + /** Called periodically between grep_begin and grep_end. */ + virtual void grep_end_batch(grep_proc &gp) { }; + + /** Called at the end of a grep run. */ + virtual void grep_end(grep_proc &gp) { }; + + /** + * Called when a match is found on 'line' and between [start, end). + * + * @param line The line number that matched. + * @param start The offset within the line where the match begins. + * @param end The offset of the character after the last character in the + * match. + */ + virtual void grep_match(grep_proc &gp, + grep_line_t line, + int start, + int end) = 0; + + /** + * Called for each captured substring in the line. + * + * @param line The line number that matched. + * @param start The offset within the line where the capture begins. + * @param end The offset of the character after the last character in the + * capture. + * @param capture The captured substring itself. + */ + virtual void grep_capture(grep_proc &gp, + grep_line_t line, + int start, + int end, + char *capture) { }; +}; + +/** + * "Grep" that runs in a separate process so it doesn't stall user-interaction. + * This class manages the child process and any interactions between the parent + * and child. The source data to be matched comes from the grep_proc_source + * delegate and the results are sent to the grep_proc_sink delegate in the + * parent process. + * + * Note: The "grep" executable is not actually used, instead we use the pcre(3) + * library directly. + */ +class grep_proc { +public: + class error + : public std::exception { +public: + error(int err) + : e_err(err) { }; + + int e_err; + }; + + /** + * Construct a grep_proc object. This involves compiling the regular + * expression and then forking off the child process. Note that both the + * parent and child return from this call and you must call the start() + * method immediately afterward to get things going. + * + * @param code The pcre code to run over the lines of input. + * @param gps The source of the data to match. + * @param readfds The file descriptor set for readable fds. + */ + grep_proc(pcre *code, + grep_proc_source &gps, + int &maxfd, + fd_set &readfds); + + virtual ~grep_proc(); + + /** @return The code passed in to the constructor. */ + pcre *get_code() { return this->gp_code; }; + + /** @param gpd The sink to send resuls to. */ + void set_sink(grep_proc_sink *gpd) + { + this->gp_sink = gpd; + if (gpd != NULL) { + this->gp_sink->grep_begin(*this); + } + }; + + /** @param gpd The sink to send results to. */ + void set_control(grep_proc_control *gpc) + { + this->gp_control = gpc; + }; + + /** @return The sink to send resuls to. */ + grep_proc_sink *get_sink() { return this->gp_sink; }; + + /** + * Queue a request to search the input between the given line numbers. + * + * @param start The line number to start the search at. + * @param stop The line number to stop the search at or -1 to read until + * the end-of-file. + */ + void queue_request(grep_line_t start = grep_line_t(0), + grep_line_t stop = grep_line_t(-1)) + { + assert(start != -1 || stop == -1); + assert(stop == -1 || start < stop); + + this->gp_queue.push_back(std::make_pair(start, stop)); + }; + + /** + * Start the search requests that have been queued up with queue_request. + */ + void start(void); + + /** + * Check the fd_set to see if there is any new data to be processed. + * + * @param ready_rfds The set of ready-to-read file descriptors. + */ + void check_fd_set(fd_set &ready_rfds); + + /** Check the invariants for this object. */ + bool invariant(void) + { + assert(this->gp_code != NULL); + if (this->gp_child_started) { + assert(this->gp_child > 0); + assert(this->gp_line_buffer.get_fd() != -1); + assert(FD_ISSET(this->gp_line_buffer.get_fd(), &this->gp_readfds)); + } + else { + assert(this->gp_pipe_offset == 0); + // assert(this->gp_child == -1); XXX doesnt work with static destr + assert(this->gp_line_buffer.get_fd() == -1); + } + + return true; + }; + +protected: + + /** + * Dispatch a line received from the child. + */ + void dispatch_line(char *line); + + /** + * Free any resources used by the object and make sure the child has been + * terminated. + */ + void cleanup(void); + + virtual void child_init(void) { }; + + virtual void child_batch(void) { fflush(stdout); }; + + virtual void child_term(void) { fflush(stdout); }; + + virtual void handle_match(int line, + std::string &line_value, + int off, + int *matches, + int count); + + pcrepp gp_pcre; + pcre *gp_code; /*< The compiled pattern. */ + auto_mem gp_code_extra; /*< Results of a pcre_study. */ + grep_proc_source & gp_source; /*< The data source delegate. */ + + auto_fd gp_err_pipe; /*< Standard error from the child. */ + line_buffer gp_line_buffer; /*< Standard out from the child. */ + off_t gp_pipe_offset; + + pid_t gp_child; /*< + * The child's pid or zero in the + * child. + */ + bool gp_child_started; /*< True if the child was start()'d. */ + int & gp_maxfd; + fd_set & gp_readfds; /*< + * Pointer to the read fd_set so we can + * clear our file descriptors later. + */ + + /** The queue of search requests. */ + std::deque > gp_queue; + grep_line_t gp_last_line; /*< + * The last line number received from + * the child. For multiple matches, + * the line number is only sent once. + */ + grep_proc_sink *gp_sink; /*< The sink delegate. */ + grep_proc_control *gp_control; /*< The control delegate. */ +}; + +#endif diff --git a/src/help.cc b/src/help.cc new file mode 100644 index 00000000..095dcc99 --- /dev/null +++ b/src/help.cc @@ -0,0 +1,19 @@ +#include "help.hh" + +typedef enum { + ME_FOO, + ME_BAR, +} my_enum_t; + +struct test { + int foo; + float other; +}; + +struct test bar; + +my_enum_t blather; + +static struct test baz; + +const char help_text_start[] = "Bah! No objcopy :("; diff --git a/src/help.hh b/src/help.hh new file mode 100644 index 00000000..8b0968d9 --- /dev/null +++ b/src/help.hh @@ -0,0 +1,16 @@ +/** + * @file help.hh + */ + +#ifndef __help_hh +#define __help_hh + +extern "C" { + /** + * The help message text. The value for this comes from the "help.txt" file, + * which gets linked into the executable by the Makefile. + */ + extern const char help_text_start[]; +} + +#endif diff --git a/src/help.txt b/src/help.txt new file mode 100644 index 00000000..2773b039 --- /dev/null +++ b/src/help.txt @@ -0,0 +1,239 @@ + + lnav - A fancy log file viewer + +DESCRIPTION +----------- + +The log file navigator, lnav, is an enhanced log file viewer that +takes advantage of any semantic information that can be gleaned from +the files being viewed, such as timestamps and log levels. Using this +extra semantic information, lnav can do things like interleaving +messages from different files, generate histograms of messages over +time, and providing hotkeys for navigating through the file. It is +hoped that these features will allow the user to quickly and +efficiently zero in on problems. + + +OPTIONS +------- + +Lnav takes a list of files to view and/or you can use the flag +arguments to load well-known log files, such as the syslog or apache +log files. The flag arguments are: + + -s Load the most recent syslog messages file. (Default) + -a Load all of the most recent log file types. + -r Load older rotated log files as well. + +When using the flag arguments, lnav will look for the files relative +to the current directory and its parent directories. In other words, +if you are working within a directory that has the well-known log +files, those will be preferred over any others. As an example, if you +are anywhere in a directory tree that was archived using 'pnlog +mailto', the log files within that tree will be loaded instead of the +files used by the local machine. + +Any files given on the command-line are scanned to determine their log +file format and to create an index for each line in the file. You do +not have to manually specify the log file format. The currently +supported formats are: syslog, apache, strace, tcsh history, and +generic log files with timestamps. + + +DISPLAY +------- + +The main part of the display shows the log lines from the files +interleaved based on time-of-day. The lines are "scrubbed" to remove +redundant/extraneous parts and highlighted to emphasize other parts. +New lines are automatically loaded as they are appended to the files +and, if you are viewing the bottom of the files, lnav will scroll down +to display the new lines, much like 'tail -f'. + +On color displays, the lines will be highlighted as follows: + + * Errors will be colored in red; + * warnings will be yellow; + * lines in even-numbered hours have their timestamps in bold white; + * boundaries between days will be underlined; and + * various color highlights will be applied to: SQL keywords, XML + tags, file and line numbers in Java backtraces, and + quoted strings. + +To give you an idea of where you are in the file spatially, the right +side of the display has a proportionally sized 'scrollbar' that +indicates your current position in the file. + +Above and below the main body are status lines that display: + + * the current time; + * the number of errors/warnings above and below your current + position; + * the number of search hits, which updates as more are found; + * the line number for the top line in the display; and + * the name of the file the top line was pulled from. + +Finally, the last line on the display is where you can enter search +patterns and execute internal commands, such as converting a +unix-timestamp into a human-readable date. + + +KEY BINDINGS +------------ + +To help navigate through the file there are many hotkeys that should +make it easy to zero-in on a specific section of the file or scan +through the file. + + ? View/leave this help message. + q Quit. + + home Move to the top of the file. + end Move to the end of the file. + space/pgdn Move down a page. + b/bs/pgup Move up a page. + j/cr/down-arrow Move down a line. + k/up-arrow Move up a line. + h/left-arrow Move to the left. + l/right-arrow Move to the right. + + e/E Move to the next/previous error. + w/W Move to the next/previous warning. + n/N Move to the next/previous search hit. + f/F Move to the next/previous entry in a different + file. + + o/O Move forward/backward 60 minutes from the current + position in the log file. + + d/D Move forward/backward 24 hours from the current + position in the log file. + + 1-6/Shift 1-6 Move to the next/previous n'th ten minute of the + hour. For example, '4' would move to the first + log line in the fortieth minute of the current + hour in the log. And, '6' would move to the next + hour boundary. + + 0/Shift 0 Move to the next/previous day boundary. + + m Mark/unmark the line at the top of the display. + The line will be highlighted with reverse video to + indicate that it is a user bookmark. You can use + the 'u' hotkey to iterate through marks you have + added. + + M Mark/unmark all the lines between the top of the + display and the last line marked/unmarked. + + J Mark/unmark the next line after the previously + marked line. + + K Like 'J' except it toggles the mark on the + previous line. + + c Copy the marked text to the X selection buffer. + + u/U Move forward/backward through any user bookmarks + you have added using the 'm' key. + + s Toggle "scrubbing" of the input file to + hide/reveal parts of the timestamp and other + excessive/redundant information in each log line. + + i View/leave a histogram of the log messages over + time. The histogram counts the number of + displayed log lines for each bucket of time. The + bars are layed out horizontally with colored + segments representing the different log levels. + You can use the 'z' hotkey to change the size of + the time buckets (e.g. ten minutes, one hour, one + day). + + I Switch between the log and histogram views while + keeping the time displayed at the top of each view + in sync. For example, if the top line in the log + view is "11:40", hitting 'I' will switch to the + histogram view and scrolled to display "11:00" at + the top (if the zoom level is hours). + + z/Shift Z Zoom in or out one step in the histogram view. + + / Start a search for the given regular expression. + The search is live, so when there is a pause in + typing, the currently running search will be + canceled and a new one started. History is + maintained for your searches so you can rerun them + easily. If there is an error encountered while + trying to interpret the expression, the error will + be displayed in red on the status line. While the + search is active, the 'hits' field in the status + line will be green, when finished it will turn + back to black. + + : Execute an internal command. The commands are + listed below. History is also supported in this + context as well as tab-completion for commands and + some arguments. The result of the command + replaces the command you typed. + + ; Execute an SQL query. Most supported log file + formats provide a sqlite virtual table backend + that can be used in queries. See the SQL section + below for more information. + +COMMANDS +-------- + + unix-time + Convert a unix-timestamp in seconds to a + human-readable form or vice-versa. + BEWARE OF TIMEZONE DIFFERENCES. + + current-time Print the current time in human-readable form and + as a unix-timestamp. + + goto Go to the given line number or N percent into the + file. + + highlight Highlight strings that match the given regular + expression. + + filter-in Only display lines that match the given regular + expression. This command can be used multiple + times to add more lines to the display. + + filter-out + Do not display lines that match the given regular + expression. This command can be used multiple + times to remove more lines from the display. If a + 'filter-in' expression is also active, it takes + priority and the filter-out will remove lines that + were matched by the 'filter-in'. + + disable-filter + Disable an active 'filter-in' or 'filter-out' + expression. + + enable-filter + Enable a inactive 'filter-in' or 'filter-out' + expression. + + graph Graph the value of numbers in the file(s) over + time. The given regular expression should capture + the number to be displayed. For example: + + my stats: (\d+\.\d+) + + Will graph all the "stats" values found in the + file. XXX This is still mostly a toy... + + append-to Append any marked lines to the given file. + + write-to Write any marked lines to the given file. + + +SQL +--- + +WRITE ME diff --git a/src/hist_source.cc b/src/hist_source.cc new file mode 100644 index 00000000..db9dadef --- /dev/null +++ b/src/hist_source.cc @@ -0,0 +1,147 @@ +#include "config.h" + +#include +#include + +#include "lnav_util.hh" +#include "hist_source.hh" + +using namespace std; + +hist_source::hist_source() + : hs_bucket_size(1), + hs_group_size(100), + hs_label_source(NULL), + hs_token_bucket(NULL) +{ } + +void hist_source::text_value_for_line(textview_curses &tc, + int row, + std::string &value_out, + bool no_scrub) +{ + int grow = row / (this->buckets_per_group() + 1); + int brow = row % (this->buckets_per_group() + 1); + + if (brow == 0) { + unsigned long width; + vis_line_t height; + + tc.get_dimensions(height, width); + value_out.insert((unsigned int)0, width, '-'); + this->hs_token_bucket = NULL; + } + else { + bucket_group_t bg = this->hs_group_keys[grow]; + bucket_count_t total(0); + bucket_t::iterator iter; + int bucket_index; + + bucket_index = brow - 1; + this->hs_token_bucket = &(this->hs_groups[bg][bucket_index]); + if (this->hs_label_source != NULL) { + this->hs_label_source-> + hist_label_for_bucket((bg * this->hs_group_size) + + (bucket_index * this->hs_bucket_size), + *this->hs_token_bucket, + value_out); + } + } +} + +void hist_source::text_attrs_for_line(textview_curses &tc, + int row, + string_attrs_t &value_out) +{ + if (this->hs_token_bucket != NULL) { + view_colors &vc = view_colors::singleton(); + unsigned long width, avail_width; + bucket_count_t total(0); + bucket_t::iterator iter; + vis_line_t height; + struct line_range lr; + + tc.get_dimensions(height, width); + avail_width = width - this->hs_token_bucket->size(); + + lr.lr_start = 0; + for (iter = this->hs_token_bucket->begin(); + iter != this->hs_token_bucket->end(); + iter++) { + double percent = (double)(iter->second - this->hs_min_count) / + (this->hs_max_count - this->hs_min_count); + int amount, attrs; + + attrs = vc. + reverse_attrs_for_role(this->get_role_for_type(iter->first)); + amount = (int)rint(percent * avail_width); + if (iter->second == 0.0) { + amount = 0; + } + else { + amount = max(1, amount); + } + + lr.lr_end = lr.lr_start + amount; + value_out[lr].insert(make_string_attr("style", attrs)); + + lr.lr_start = lr.lr_end; + } + } +} + +void hist_source::add_value(int value, bucket_type_t bt, bucket_count_t amount) +{ + bucket_group_t bg; + + bg = bucket_group_t(value / this->hs_group_size); + + bucket_array_t &ba = this->hs_groups[bg]; + + if (ba.empty()) { + ba.resize(this->buckets_per_group()); + } + + bucket_count_t &bc = ba[abs(value % this->hs_group_size) / + this->hs_bucket_size][bt]; + + bc += amount; +} + +void hist_source::analyze(void) +{ + std::map::iterator iter; + + this->hs_group_keys.clear(); + this->hs_min_count = 3.40282347e+38F; + this->hs_max_count = 0.0; + for (iter = this->hs_groups.begin(); + iter != this->hs_groups.end(); + iter++) { + bucket_array_t::iterator ba_iter; + + for (ba_iter = iter->second.begin(); + ba_iter != iter->second.end(); + ba_iter++) { + bucket_count_t total = 0.0; + bucket_t::iterator b_iter; + + for (b_iter = ba_iter->begin(); + b_iter != ba_iter->end(); + b_iter++) { + if (b_iter->second != 0.0 && + b_iter->second < this->hs_min_count) { + this->hs_min_count = b_iter->second; + } + total += b_iter->second; + } + if (total > this->hs_max_count) { + this->hs_max_count = total; + } + } + + this->hs_group_keys.push_back(iter->first); + } + + sort(this->hs_group_keys.begin(), this->hs_group_keys.end()); +} diff --git a/src/hist_source.hh b/src/hist_source.hh new file mode 100644 index 00000000..c98b2240 --- /dev/null +++ b/src/hist_source.hh @@ -0,0 +1,141 @@ +#ifndef __hist_source_hh +#define __hist_source_hh + +#include +#include +#include + +#include "strong_int.hh" +#include "textview_curses.hh" + +typedef float bucket_count_t; + +STRONG_INT_TYPE(int, bucket_group); +STRONG_INT_TYPE(int, bucket_type); + +class hist_source + : public text_sub_source { +public: + typedef std::map bucket_t; + + class label_source { +public: + virtual ~label_source() { }; + + virtual void hist_label_for_group(int group, + std::string &label_out) { }; + + virtual void hist_label_for_bucket(int bucket_start_value, + const bucket_t &bucket, + std::string &label_out) { }; + }; + + hist_source(); + virtual ~hist_source() { }; + + void set_bucket_size(int bs) { this->hs_bucket_size = bs; }; + int get_bucket_size(void) const { return this->hs_bucket_size; }; + + void set_group_size(int gs) { this->hs_group_size = gs; }; + int get_group_size(void) const { return this->hs_group_size; }; + + void set_label_source(label_source *hls) + { + this->hs_label_source = hls; + } + + label_source *get_label_source(void) + { + return this->hs_label_source; + }; + + int buckets_per_group(void) const + { + return this->hs_group_size / this->hs_bucket_size; + }; + + void clear(void) { this->hs_groups.clear(); }; + + size_t text_line_count() + { + return (this->buckets_per_group() + 1) * this->hs_groups.size(); + }; + + void set_role_for_type(bucket_type_t bt, view_colors::role_t role) + { + this->hs_type2role[bt] = role; + }; + const view_colors::role_t &get_role_for_type(bucket_type_t bt) + { + return this->hs_type2role[bt]; + }; + + void text_value_for_line(textview_curses &tc, + int row, + std::string &value_out, + bool no_scrub); + void text_attrs_for_line(textview_curses &tc, + int row, + string_attrs_t &value_out); + + int value_for_row(vis_line_t row) + { + int grow = row / (this->buckets_per_group() + 1); + int brow = row % (this->buckets_per_group() + 1); + int retval = 0; + + if (!this->hs_group_keys.empty()) { + bucket_group_t bg = this->hs_group_keys[grow]; + + if (brow > 0) { + brow -= 1; + } + retval = (bg * this->hs_group_size) + (brow * this->hs_bucket_size); + } + + return retval; + }; + + vis_line_t row_for_value(int value) + { + vis_line_t retval; + + if (!this->hs_group_keys.empty()) { + bucket_group_t bg(value / this->hs_group_size); + + std::vector::iterator lb; + + lb = lower_bound(this->hs_group_keys.begin(), + this->hs_group_keys.end(), + bg); + retval = vis_line_t(distance(this->hs_group_keys.begin(), lb) * + (this->buckets_per_group() + 1)); + retval += vis_line_t(1 + + (value % this->hs_group_size) / + this->hs_bucket_size); + } + + return retval; + }; + + void add_value(int value, bucket_type_t bt, bucket_count_t amount = 1.0); + void analyze(void); + +protected: + typedef std::vector bucket_array_t; + + std::map hs_type2role; + + std::map hs_groups; + std::vector hs_group_keys; + + int hs_bucket_size; /* hours */ + int hs_group_size; /* days */ + bucket_count_t hs_min_count; + bucket_count_t hs_max_count; + label_source *hs_label_source; + + bucket_t *hs_token_bucket; +}; + +#endif diff --git a/src/histview_curses.hh b/src/histview_curses.hh new file mode 100644 index 00000000..27c5bdc9 --- /dev/null +++ b/src/histview_curses.hh @@ -0,0 +1,77 @@ + +#ifndef __hist_controller_hh +#define __hist_controller_hh + +#include +#include + +#include "strong_int.hh" +#include "listview_curses.hh" + +STRONG_INT_TYPE(int, bucket_group); +STRONG_INT_TYPE(int, bucket_count); + +class hist_data_source { + +public: + virtual ~hist_data_source() { }; + + virtual int hist_values(void) = 0; + virtual void hist_value_for(int index, int &value_out) = 0; + +}; + +class hist_label_source { + +public: + virtual ~hist_label_source() { }; + + virtual void hist_label_for_group(int group, std::string &label_out) { }; + +}; + +class hist_controller : public list_data_source { + +public: + hist_controller(); + virtual ~hist_controller() { }; + + void set_bucket_size(int bs) { this->hv_bucket_size = bs; }; + int get_bucket_size(void) const { return this->hv_bucket_size; }; + + void set_group_size(int gs) { this->hv_group_size = gs; }; + int get_group_size(void) const { return this->hv_group_size; }; + + void set_data_source(hist_data_source *hds) { + this->hv_data_source = hds; + }; + hist_data_source *get_data_source(void) { return this->hv_data_source; }; + + void set_label_source(hist_label_source *hls) { + this->hv_label_source = hls; + } + hist_label_source *get_label_source(void) { + return this->hv_label_source; + }; + + size_t listview_rows(void) { + return (this->hv_group_size / this->hv_bucket_size) * + this->hv_groups.size(); + }; + + void listview_value_for_row(vis_line_t row, std::string &value_out); + + void reload_data(void); + +private: + typedef vector buckets_t; + + map hv_groups; + int hv_bucket_size; // hours + int hv_group_size; // days + hist_data_source *hv_data_source; + hist_label_source *hv_label_source; + +}; + +#endif diff --git a/src/line_buffer.cc b/src/line_buffer.cc new file mode 100644 index 00000000..3b627195 --- /dev/null +++ b/src/line_buffer.cc @@ -0,0 +1,328 @@ +/** + * @file line_buffer.cc + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include + +#include "line_buffer.hh" + +using namespace std; + +static const size_t DEFAULT_LINE_BUFFER_SIZE = 256 * 1024; +static const size_t MAX_LINE_BUFFER_SIZE = 2 * DEFAULT_LINE_BUFFER_SIZE; +static const size_t DEFAULT_INCREMENT = 1024; + +static set ALL_BUFFERS; + +/* + * XXX REMOVE ME + * + * The stock gzipped file code does not use pread, so we need to use a lock to + * get exclusive access to the file. In the future, we should just rewrite + * the gzipped file code to use pread. + */ +class lock_hack { +public: + class guard { + public: + + guard() : g_lock(lock_hack::singleton()) { + this->g_lock.lock(); + }; + + ~guard() { + this->g_lock.unlock(); + }; + + private: + lock_hack &g_lock; + }; + + static lock_hack &singleton() { + static lock_hack retval; + + return retval; + }; + + void lock() { + lockf(this->lh_fd, F_LOCK, 0); + }; + + void unlock() { + lockf(this->lh_fd, F_ULOCK, 0); + }; + +private: + + lock_hack() { + char lockname[64]; + + snprintf(lockname, sizeof(lockname), "/tmp/lnav.%d.lck", getpid()); + this->lh_fd = open(lockname, O_CREAT | O_RDWR, 0600); + unlink(lockname); + }; + + int lh_fd; +}; +/* XXX END */ + +line_buffer::line_buffer() + : lb_gz_file(NULL), + lb_file_size((size_t) - 1), + lb_file_offset(0), + lb_buffer_size(0), + lb_buffer_max(DEFAULT_LINE_BUFFER_SIZE), + lb_seekable(false) +{ + if ((this->lb_buffer = (char *)malloc(this->lb_buffer_max)) == NULL) { + throw bad_alloc(); + } + + ALL_BUFFERS.insert(this); + + assert(this->invariant()); +} + +line_buffer::~line_buffer() +{ + auto_fd fd = -1; + + this->set_fd(fd); + + ALL_BUFFERS.erase(this); +} + +void line_buffer::set_fd(auto_fd &fd) +throw (error) +{ + off_t newoff = 0; + + if (this->lb_gz_file) { + gzclose(this->lb_gz_file); + this->lb_gz_file = NULL; + } + + if (fd != -1) { + /* Sync the fd's offset with the object. */ + newoff = lseek(fd, 0, SEEK_CUR); + if (newoff == -1) { + if (errno != ESPIPE) { + throw error(errno); + } + + /* It's a pipe, start with a zero offset. */ + newoff = 0; + this->lb_seekable = false; + } + else { + char gz_id[2]; + + if (pread(fd, gz_id, sizeof(gz_id), 0) == sizeof(gz_id)) { + if (gz_id[0] == '\037' && gz_id[1] == '\213') { + lseek(fd, 0, SEEK_SET); + if ((this->lb_gz_file = gzdopen(dup(fd), "r")) == NULL) + throw bad_alloc(); + this->lb_gz_offset = lseek(this->lb_fd, 0, SEEK_CUR); + } + } + this->lb_seekable = true; + } + } + this->lb_file_offset = newoff; + this->lb_buffer_size = 0; + this->lb_fd = fd; + + assert(this->invariant()); +} + +void line_buffer::ensure_available(off_t start, size_t max_length) +throw (error) +{ + size_t prefill, available; + + /* The file is probably bogus if a line has gotten this big. */ + if (max_length > MAX_LINE_BUFFER_SIZE) { + throw error(EFBIG); + } + + if (start < this->lb_file_offset || + start > (off_t)(this->lb_file_offset + this->lb_buffer_size)) { + /* + * The request is outside the cached range, need to reload the + * whole thing. + */ + + prefill = 0; + if (lseek(this->lb_fd, start, SEEK_SET) == -1) { + throw error(errno); + } + + this->lb_file_offset = start; + this->lb_buffer_size = 0; + } + else { + /* The request is in the cached range. */ + prefill = start - this->lb_file_offset; + } + assert(this->lb_file_offset <= start); + assert(prefill <= this->lb_buffer_size); + + available = this->lb_buffer_max - this->lb_buffer_size; + assert(available <= this->lb_buffer_max); + + if (max_length > available) { + /* + * Need more space, move any existing data to the front of the + * buffer. + */ + this->lb_buffer_size -= prefill; + this->lb_file_offset += prefill; + memmove(&this->lb_buffer[0], + &this->lb_buffer[prefill], + this->lb_buffer_size); + + if (max_length > available) { + char *tmp, *old; + + /* Still need more space, try a realloc. */ + old = this->lb_buffer.release(); + tmp = (char *)realloc(old, + this->lb_buffer_max + + DEFAULT_LINE_BUFFER_SIZE); + if (tmp != NULL) { + this->lb_buffer = tmp; + this->lb_buffer_max += DEFAULT_LINE_BUFFER_SIZE; + } + else { + this->lb_buffer = old; + + throw error(ENOMEM); + } + } + } +} + +bool line_buffer::fill_range(off_t start, size_t max_length) +throw (error) +{ + bool retval = false; + + if (this->in_range(start) && this->in_range(start + max_length)) { + /* Cache already has the data, nothing to do. */ + retval = true; + } + else if (this->lb_fd != -1) { + int rc; + + /* Make sure there is enough space, then */ + this->ensure_available(start, max_length); + + /* ... read in the new data. */ + if (this->lb_gz_file) { + lock_hack::guard guard; + + lseek(this->lb_fd, this->lb_gz_offset, SEEK_SET); + gzseek(this->lb_gz_file, + this->lb_file_offset + this->lb_buffer_size, + SEEK_SET); + rc = gzread(this->lb_gz_file, + &this->lb_buffer[this->lb_buffer_size], + this->lb_buffer_max - this->lb_buffer_size); + this->lb_gz_offset = lseek(this->lb_fd, 0, SEEK_CUR); + } + else if (this->lb_seekable) { + rc = pread(this->lb_fd, + &this->lb_buffer[this->lb_buffer_size], + this->lb_buffer_max - this->lb_buffer_size, + this->lb_file_offset + this->lb_buffer_size); + } + else { + rc = read(this->lb_fd, + &this->lb_buffer[this->lb_buffer_size], + this->lb_buffer_max - this->lb_buffer_size); + } + switch (rc) { + case 0: + this->lb_file_size = this->lb_file_offset + this->lb_buffer_size; + if (start < (off_t) this->lb_file_size) { + retval = true; + } + break; + + case - 1: + switch (errno) { + case EINTR: + case EAGAIN: + break; + + default: + throw error(errno); + } + break; + + default: + this->lb_buffer_size += rc; + retval = true; + break; + } + + assert(this->lb_buffer_size <= this->lb_buffer_max); + } + + return retval; +} + +char *line_buffer::read_line(off_t &offset, size_t &len_out, char delim) +throw (error) +{ + size_t request_size = DEFAULT_INCREMENT; + char *retval = NULL; + int last_avail = 0; + + assert(this->lb_fd != -1); + + len_out = 0; + while ((retval == NULL) && this->fill_range(offset, request_size)) { + char *line_start, *lf; + + /* Find the data in the cache and */ + line_start = this->get_range(offset, len_out); + /* ... look for the end-of-line. */ + if (((lf = (char *)memchr(line_start, delim, len_out)) != NULL) || + ((offset + len_out) == this->lb_file_size)) { + if (lf != NULL) { + len_out = lf - line_start; + offset += 1; /* Skip the delimiter. */ + } + else { + /* + * Be nice and make sure there is room for the caller to + * add a NULL-terminator. + */ + this->ensure_available(offset, len_out + 1); + } + offset += len_out; + + retval = line_start; + } + else { + request_size += DEFAULT_INCREMENT; + } + } + + assert((retval == NULL) || + (retval >= this->lb_buffer && + retval < (this->lb_buffer + this->lb_buffer_size))); + assert(len_out <= this->lb_buffer_size); + assert(this->invariant()); + + return retval; +} diff --git a/src/line_buffer.hh b/src/line_buffer.hh new file mode 100644 index 00000000..7ca40c72 --- /dev/null +++ b/src/line_buffer.hh @@ -0,0 +1,185 @@ +/** + * @file line_buffer.hh + */ + +#ifndef __line_buffer_hh +#define __line_buffer_hh + +#include +#include +#include +#include +#include + +#include + +#include "auto_fd.hh" +#include "auto_mem.hh" + +/** + * Buffer for reading whole lines out of file descriptors. The class presents + * a stateless interface, callers specify the offset where a line starts and + * the class takes care of caching the surrounding range and locating the + * delimiter. + * + * XXX A bit of a wheel reinvention, but I'm not sure how well the libraries + * handle non-blocking I/O... + */ +class line_buffer { +public: + class error + : public std::exception { +public: + error(int err) + : e_err(err) { }; + + int e_err; + }; + + /** Construct an empty line_buffer. */ + line_buffer(); + + virtual ~line_buffer(); + + /** @param fd The file descriptor that data should be pulled from. */ + void set_fd(auto_fd &fd) throw (error); + + /** @return The file descriptor that data should be pulled from. */ + int get_fd() { return this->lb_fd; }; + + void set_file_size(size_t fs) { this->lb_file_size = fs; }; + + /** + * @return The size of the file or the amount of data pulled from a pipe. + */ + size_t get_file_size() { return this->lb_file_size; }; + + /** + * Read up to the end of file or a given delimiter. + * + * @param offset_inout The offset in the file to start reading from. On + * return, it contains the offset where the next line should start or one + * past the size of the file. + * @param len_out On return, contains the length of the line, not including + * the delimiter. + * @param delim The character that splits lines in the input, defaults to a + * line feed. + * @return The address in the internal buffer where the line starts. The + * line is not terminated, but this method ensures there is room to NULL + * terminate the line. If any modifications are made to the line, such as + * NULL termination, the invalidate() must be called before re-reading the + * line to refresh the buffer. + */ + char *read_line(off_t &offset_inout, size_t &len_out, char delim = '\n') + throw (error); + + /** + * Signal that the contents of the internal buffer have been modified and + * any attempts to re-read the currently cached line(s) should trigger + * another read from the file. + */ + void invalidate() + { + this->lb_file_offset += this->lb_buffer_size; + this->lb_buffer_size = 0; + }; + + /** Release any resources held by this object. */ + void reset() + { + this->lb_fd.reset(); + + this->lb_file_offset = 0; + this->lb_file_size = (size_t)-1; + this->lb_buffer_size = 0; + }; + + /** Check the invariants for this object. */ + bool invariant(void) + { + assert(this->lb_buffer != NULL); + assert(this->lb_buffer_size <= this->lb_buffer_max); + + return true; + }; + +private: + + /** + * @param off The file offset to check for in the buffer. + * @return True if the given offset is cached in the buffer. + */ + bool in_range(off_t off) + { + return this->lb_file_offset <= off && + off < (int)(this->lb_file_offset + this->lb_buffer_size); + }; + + /** + * Ensure there is enough room in the buffer to cache a range of data from + * the file. First, this method will check to see if there is enough room + * from where 'start' begins in the buffer to the maximum buffer size. If + * this is not enough, the currently cached data at 'start' will be moved + * to the beginning of the buffer, overwriting any cached data earlier in + * the file. Finally, if this is still not enough, the buffer will be + * reallocated to make more room. + * + * @param start The file offset of the start of the line. + * @param max_length The amount of data to be cached in the buffer. + */ + void ensure_available(off_t start, size_t max_length) throw (error); + + /** + * Fill the buffer with the given range of data from the file. + * + * @param start The file offset where data should start to be read from the + * file. + * @param max_length The maximum amount of data to read from the file. + * @return True if any data was read from the file. + */ + bool fill_range(off_t start, size_t max_length) throw (error); + + /** + * After a successful fill, the cached data can be retrieved with this + * method. + * + * @param start The file offset to retrieve cached data for. + * @param avail_out On return, the amount of data currently cached at the + * given offset. + * @return A pointer to the start of the cached data in the internal + * buffer. + */ + char *get_range(off_t start, size_t &avail_out) + { + int buffer_offset = start - this->lb_file_offset; + char *retval; + + assert(buffer_offset >= 0); + + retval = &this->lb_buffer[buffer_offset]; + avail_out = this->lb_buffer_size - buffer_offset; + + return retval; + }; + + auto_fd lb_fd; /*< The file to read data from. */ + gzFile lb_gz_file; + off_t lb_gz_offset; + + auto_mem lb_buffer; /*< The internal buffer where data is cached */ + + size_t lb_file_size; /*< + * The size of the file. When lb_fd refers to + * a pipe, this is set to the amount of data + * read from the pipe when EOF is reached. + */ + off_t lb_file_offset; /*< + * Data cached in the buffer comes from this + * offset in the file. + */ + size_t lb_buffer_size; /*< The amount of cached data in the buffer. */ + size_t lb_buffer_max; /*< The size of the buffer memory. */ + bool lb_seekable; +}; + +#endif diff --git a/src/listview_curses.cc b/src/listview_curses.cc new file mode 100644 index 00000000..13a65e7f --- /dev/null +++ b/src/listview_curses.cc @@ -0,0 +1,154 @@ +/** + * @file listview_curses.cc + */ + +#include "listview_curses.hh" + +using namespace std; + +listview_curses::listview_curses() + : lv_source(NULL), + lv_window(NULL), + lv_y(0), + lv_top(0), + lv_left(0), + lv_height(0), + lv_needs_update(true), + lv_show_scrollbar(true) +{ } + +listview_curses::~listview_curses() +{ } + +void listview_curses::reload_data(void) +{ + if (this->lv_source == NULL) { + this->lv_top = vis_line_t(0); + } + else if (this->lv_top >= this->get_inner_height()) { + this->lv_top = max(vis_line_t(0), + vis_line_t(this->get_inner_height() - 1)); + } + this->lv_needs_update = true; +} + +bool listview_curses::handle_key(int ch) +{ + vis_line_t height(0); + + unsigned long width; + bool retval = true; + + this->get_dimensions(height, width); + switch (ch) { + case 'l': + case KEY_RIGHT: + this->shift_left(width / 2); + break; + + case 'h': + case KEY_LEFT: + this->shift_left(-(width / 2)); + break; + + case '\r': + case 'j': + case KEY_DOWN: + this->shift_top(vis_line_t(1)); + break; + + case 'k': + case KEY_UP: + this->shift_top(vis_line_t(-1)); + break; + + case 'b': + case KEY_BACKSPACE: + case KEY_PPAGE: + this->shift_top(-height); + break; + + case ' ': + case KEY_NPAGE: + this->shift_top(height); + break; + + case KEY_HOME: + this->set_top(vis_line_t(0)); + break; + + case KEY_END: + case 'B': + this->set_top(max(vis_line_t(0), + max(this->lv_top, + vis_line_t(this->get_inner_height() - height + 1)))); + break; + + default: + retval = false; + break; + } + + return retval; +} + +void listview_curses::do_update(void) +{ + if (this->lv_window != NULL && this->lv_needs_update) { + vis_line_t y(this->lv_y), height, bottom, lines; + struct line_range lr; + unsigned long width; + size_t row_count; + + this->get_dimensions(height, width); + lr.lr_start = this->lv_left; + lr.lr_end = this->lv_left + width; + + row_count = this->get_inner_height(); + if (this->lv_top >= (int)row_count) { + this->lv_top = max(vis_line_t(0), vis_line_t(row_count) - height); + } + + lines = y + min(height, vis_line_t(row_count) - this->lv_top); + bottom = y + height; + for (; y < lines; ++y) { + vis_line_t row = this->lv_top + y - vis_line_t(this->lv_y); + attr_line_t al; + string line; + + this->lv_source->listview_value_for_row(*this, row, al); + this->mvwattrline(this->lv_window, y, 0, al, lr); + } + + /* Clear out any remaining lines on the display. */ + for (; y < bottom; ++y) { + wmove(this->lv_window, y, 0); + wclrtoeol(this->lv_window); + } + + if (this->lv_show_scrollbar) { + double progress = 1.0; + double coverage = 1.0; + + if (this->get_inner_height() > 0) { + progress = (double)this->lv_top / (double)this->get_inner_height(); + coverage = (double)height / (double)this->get_inner_height(); + } + + y = vis_line_t(this->lv_y) + + vis_line_t((int)(progress * (double)height)); + lines = y + min(height, vis_line_t((int)(coverage * (double)height))); + for (; y <= lines; ++y) { + char buffer; + + mvwinnstr(this->lv_window, y, width - 1, &buffer, 1); + wattron(this->lv_window, A_REVERSE); + mvwaddnstr(this->lv_window, y, width - 1, &buffer, 1); + wattroff(this->lv_window, A_REVERSE); + } + wmove(this->lv_window, this->lv_y + height - 1, 0); + } + + this->lv_needs_update = false; + } +} diff --git a/src/listview_curses.hh b/src/listview_curses.hh new file mode 100644 index 00000000..5b5cee0f --- /dev/null +++ b/src/listview_curses.hh @@ -0,0 +1,256 @@ +/** + * @file listview_curses.hh + */ + +#ifndef __listview_curses_hh +#define __listview_curses_hh + +#include +#include + +#include +#include + +#include "strong_int.hh" +#include "view_curses.hh" + +/** Strongly-typed for lines to be displayed. */ +STRONG_INT_TYPE(int, vis_line); + +class listview_curses; + +/** + * Data source for lines to be displayed by the listview_curses object. + */ +class list_data_source { +public: + virtual ~list_data_source() { }; + + /** @return The number of rows in the list. */ + virtual size_t listview_rows(const listview_curses &lv) = 0; + + /** + * Get the string value for a row in the list. + * + * @param row The row number. + * @param value_out The destination for the string value. + */ + virtual void listview_value_for_row(const listview_curses &lv, + vis_line_t row, + attr_line_t &value_out) = 0; +}; + +/** + * View that displays a list of lines that can optionally contain highlighting. + */ +class listview_curses + : public view_curses { +public: + typedef view_action action; + + /** Construct an empty list view. */ + listview_curses(); + + virtual ~listview_curses(); + + /** @param src The data source delegate. */ + void set_data_source(list_data_source *src) + { + this->lv_source = src; + if (this->lv_source != NULL) { + this->reload_data(); + } + }; + + /** @return The data source delegate. */ + list_data_source *get_data_source() { return this->lv_source; }; + + /** + * @param va The action to invoke when the view is scrolled. + * @todo Allow multiple observers. + */ + void set_scroll_action(action va) { this->lv_scroll = va; }; + + template + void set_scroll_action(action::mem_functor_t < _Receiver > *mf) + { + this->lv_scroll = action(mf); + }; + + void set_show_scrollbar(bool ss) { this->lv_show_scrollbar = ss; }; + bool get_show_scrollbar() { return this->lv_show_scrollbar; }; + + /** @param win The curses window this view is attached to. */ + void set_window(WINDOW *win) { this->lv_window = win; }; + + /** @return The curses window this view is attached to. */ + WINDOW *get_window() { return this->lv_window; }; + + void set_y(int y) + { + if (y != this->lv_y) { + this->lv_y = y; + this->lv_needs_update = true; + } + }; + int get_y() { return this->lv_y; }; + + /** + * Set the line number to be displayed at the top of the view. If the + * value is invalid, flash() will be called. If the value is valid, the + * new value will be set and the scroll action called. + * + * @param top The new value for top. + */ + void set_top(vis_line_t top) + { + if (top < 0 || (top > 0 && top >= this->get_inner_height())) { + flash(); + } + else if (this->lv_top != top) { + this->lv_top = top; + this->lv_scroll.invoke(this); + this->lv_needs_update = true; + } + }; + + /** @return The line number that is displayed at the top. */ + vis_line_t get_top() { return this->lv_top; }; + + vis_line_t get_bottom() + { + vis_line_t retval, height; + unsigned long width; + + this->get_dimensions(height, width); + retval = std::min(this->lv_top + height - vis_line_t(1), + vis_line_t(this->get_inner_height() - 1)); + + return retval; + }; + + /** + * Shift the value of top by the given value. + * + * @param offset The amount to change top by. + * @return The final value of top. + */ + vis_line_t shift_top(vis_line_t offset) + { + if (offset < 0 && this->lv_top == 0) { + flash(); + } + else { + this->set_top(std::max(vis_line_t(0), this->lv_top + offset)); + } + + return this->lv_top; + }; + + + /** + * Set the column number to be displayed at the left of the view. If the + * value is invalid, flash() will be called. If the value is valid, the + * new value will be set and the scroll action called. + * + * @param left The new value for left. + */ + void set_left(int left) + { + if (left >= 0 && this->lv_left != left) { + this->lv_left = left; + this->lv_scroll.invoke(this); + this->lv_needs_update = true; + } + }; + + /** @return The column number that is displayed at the left. */ + int get_left() { return this->lv_left; }; + + /** + * Shift the value of left by the given value. + * + * @param offset The amount to change top by. + * @return The final value of top. + */ + int shift_left(int offset) + { + this->set_left(std::max(0, this->lv_left + offset)); + + return this->lv_left; + }; + + /** + * Set the height of the view. A value greater than one is considered to + * be an absolute size. A value less than or equal to zero makes the + * height relative to the size of the enclosing window. + * + * @height The new height. + */ + void set_height(vis_line_t height) + { + if (this->lv_height != height) { + this->lv_height = height; + this->lv_needs_update = true; + } + }; + + /** @return The absolute or relative height of the window. */ + vis_line_t get_height() { return this->lv_height; }; + + int get_inner_height() const + { + return this->lv_source == NULL ? 0 : + this->lv_source->listview_rows(*this); + }; + + void set_needs_update() { this->lv_needs_update = true; }; + + /** + * Get the actual dimensions of the view. + * + * @param height_out The actual height of the view in lines. + * @param width_out The actual width of the view in columns. + */ + void get_dimensions(vis_line_t &height_out, unsigned long &width_out) + { + unsigned long height; + + getmaxyx(this->lv_window, height, width_out); + if (this->lv_height < 1) { + height_out = vis_line_t(height) + + this->lv_height - + vis_line_t(this->lv_y); + } + else { + height_out = this->lv_height; + } + }; + + /** This method should be called when the data source has changed. */ + void reload_data(void); + + /** + * @param ch The input to be handled. + * @return True if the key was eaten by this view. + */ + bool handle_key(int ch); + + /** + * Query the data source and draw the visible lines on the display. + */ + void do_update(void); + +protected: + list_data_source *lv_source; /*< The data source delegate. */ + action lv_scroll; /*< The scroll action. */ + WINDOW *lv_window; /*< The window that contains this view. */ + int lv_y; + vis_line_t lv_top; /*< The line at the top of the view. */ + int lv_left; /*< The column at the left of the view. */ + vis_line_t lv_height; /*< The abs/rel height of the view. */ + bool lv_needs_update; + bool lv_show_scrollbar; +}; + +#endif diff --git a/src/lnav.cc b/src/lnav.cc new file mode 100644 index 00000000..dececa2a --- /dev/null +++ b/src/lnav.cc @@ -0,0 +1,2412 @@ +#include "config.h" + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "help.hh" +#include "auto_temp_file.hh" +#include "logfile.hh" +#include "lnav_util.hh" +#include "listview_curses.hh" +#include "statusview_curses.hh" +#include "vt52_curses.hh" +#include "readline_curses.hh" +#include "textview_curses.hh" +#include "logfile_sub_source.hh" +#include "grep_proc.hh" +#include "bookmarks.hh" +#include "hist_source.hh" +#include "top_status_source.hh" +#include "bottom_status_source.hh" +#include "piper_proc.hh" +#include "log_vtab_impl.hh" +#include "db_sub_source.hh" +#include "pcrecpp.h" + +#include +#include + +using namespace std; +using namespace soci; + +typedef enum { + LNM_PAGING, + LNM_COMMAND, + LNM_SEARCH, + LNM_CAPTURE, + LNM_SQL, +} ln_mode_t; + +enum { + LNB_SYSLOG, + + LNB__MAX, + + LNB_ROTATED +}; + +typedef enum { + LNF_SYSLOG = (1L << LNB_SYSLOG), + + LNF_ROTATED = (1L << LNB_ROTATED), + + LNF__ALL = (LNF_SYSLOG) +} lnav_flags_t; + +static multimap DEFAULT_FILES; + +typedef enum { + LNV_LOG, + LNV_HELP, + LNV_HISTOGRAM, + LNV_GRAPH, + LNV_DB, + + LNV__MAX +} lnav_view_t; + +typedef enum { + LNS_TOP, + LNS_BOTTOM, + + LNS__MAX +} lnav_status_t; + +typedef enum { + LG_SEARCH, + LG_GRAPH, + LG_CAPTURE, + + LG__MAX +} lnav_grep_t; + +struct hist_level { + int hl_bucket_size; + int hl_group_size; +}; + +static struct hist_level HIST_ZOOM_VALUES[] = { + { 24 * 60 * 60, 7 * 24 * 60 * 60 }, + { 4 * 60 * 60, 24 * 60 * 60 }, + { 60 * 60, 24 * 60 * 60 }, + { 10 * 60, 60 * 60 }, + { 60, 60 * 60 }, +}; + +static const int HIST_ZOOM_LEVELS = sizeof(HIST_ZOOM_VALUES) / sizeof(struct hist_level); + +class grep_highlighter { +public: + grep_highlighter(auto_ptr < grep_proc > gp, + string hl_name, + textview_curses::highlight_map_t &hl_map) + : gh_code(gp->get_code()), + gh_grep_proc(gp), + gh_hl_name(hl_name), + gh_hl_map(hl_map) { }; + + ~grep_highlighter() + { + this->gh_hl_map.erase(this->gh_hl_map.find(this->gh_hl_name)); + }; + + grep_proc *get_grep_proc() { return this->gh_grep_proc.get(); }; + +private: + auto_mem gh_code; + auto_ptr gh_grep_proc; + string gh_hl_name; + textview_curses::highlight_map_t gh_hl_map; +}; + +class grapher + : public grep_proc_sink, + public hist_source { +public: + + grapher() + : gr_highlighter(NULL) + { + this->set_label_source(&this->gr_label_source); + }; + + grep_line_t at(int row) { return this->gr_lines[row]; }; + + void set_highlighter(textview_curses::highlighter *hl) + { + this->gr_highlighter = hl; + }; + + void grep_begin(grep_proc &gp) + { + this->clear(); + this->hs_type2role.clear(); + this->gr_lines.clear(); + this->gr_x = -1; + this->gr_next_field = bucket_type_t(0); + }; + + void grep_match(grep_proc &gp, grep_line_t line, int start, int end) { }; + + void grep_capture(grep_proc &gp, + grep_line_t line, + int start, + int end, + char *capture) + { + float amount = 1.0; + + if (this->gr_lines.empty() || this->gr_lines.back() != line) { + this->gr_next_field = bucket_type_t(0); + this->gr_x += 1; + this->gr_lines.push_back(line); + } + + if (this->gr_highlighter != NULL) { + if (this->hs_type2role.find(this->gr_next_field) == + this->hs_type2role.end()) { + this->hs_type2role[this->gr_next_field] = + this->gr_highlighter->get_role(this->gr_next_field); + } + } + sscanf(capture, "%f", &amount); + this->add_value(this->gr_x, this->gr_next_field, amount); + + ++ this->gr_next_field; + }; + + void grep_end_batch(grep_proc &gp) { this->analyze(); }; + void grep_end(grep_proc &gp) { this->analyze(); }; + +private: + + class label_source + : public hist_source::label_source { +public: + label_source() { }; + + void hist_label_for_bucket(int bucket_start_value, + const hist_source::bucket_t &bucket, + string &label_out) + { + hist_source::bucket_t::const_iterator iter; + float total = 0.0; + + for (iter = bucket.begin(); iter != bucket.end(); iter++) { + char buffer[64]; + + if (iter->second != 0.0) { + snprintf(buffer, sizeof(buffer), " % 10.2f", iter->second); + } + else { + snprintf(buffer, sizeof(buffer), " % 10s", "-"); + } + label_out += string(buffer); + } + }; + }; + + label_source gr_label_source; + textview_curses::highlighter *gr_highlighter; + vector gr_lines; + int gr_x; + bucket_type_t gr_next_field; +}; + +static struct { + const char *ld_program_name; + const char *ld_debug_log_name; + + set< pair > ld_file_names; + sig_atomic_t ld_looping; + sig_atomic_t ld_winched; + unsigned long ld_flags; + WINDOW *ld_window; + ln_mode_t ld_mode; + + statusview_curses ld_status[LNS__MAX]; + top_status_source ld_top_source; + bottom_status_source ld_bottom_source; + listview_curses::action::broadcaster ld_scroll_broadcaster; + + time_t ld_top_time; + time_t ld_bottom_time; + + stack ld_view_stack; + textview_curses ld_views[LNV__MAX]; + readline_curses *ld_rl_view; + + logfile_sub_source ld_log_source; + hist_source ld_hist_source; + int ld_hist_zoom; + + map ld_last_user_mark; + + grapher ld_graph_source; + + hist_source ld_db_source; + db_label_source ld_db_rows; + + int ld_max_fd; + fd_set ld_read_fds; + + auto_ptr ld_grep_child[LG__MAX]; + + auto_temp_file ld_db_file; + + log_vtab_manager *ld_vtab_manager; + session *ld_sql; +} lnav_data; + +class loading_observer + : public logfile_sub_source::observer { +public: + loading_observer() + : lo_last_offset(0), + lo_last_line(0) { }; + + void logfile_indexing(logfile &lf, off_t off, size_t total) + { + if (abs(off - this->lo_last_offset) > (128 * 1024) || off == total) { + lnav_data.ld_bottom_source.update_loading(off, total); + this->do_update(); + this->lo_last_offset = off; + } + + if (!lnav_data.ld_looping) { + throw logfile::error(lf.get_filename(), EINTR); + } + }; + + void logfile_sub_source_filtering(logfile_sub_source &lss, + content_line_t cl, + size_t total) + { + if (abs(cl - this->lo_last_line) > 1024 || cl == (total - 1)) { + lnav_data.ld_bottom_source.update_loading(cl, (total - 1)); + this->do_update(); + this->lo_last_line = cl; + } + + if (!lnav_data.ld_looping) { + throw logfile::error("", EINTR); + } + }; + +private: + void do_update(void) + { + lnav_data.ld_top_source.update_time(); + lnav_data.ld_status[LNS_TOP].do_update(); + lnav_data.ld_status[LNS_BOTTOM].do_update(); + refresh(); + }; + + off_t lo_last_offset; + content_line_t lo_last_line; +}; + +static void rebuild_hist(size_t old_count, bool force) +{ + textview_curses &hist_view = lnav_data.ld_views[LNV_HISTOGRAM]; + textview_curses &log_view = lnav_data.ld_views[LNV_LOG]; + logfile_sub_source &lss = lnav_data.ld_log_source; + size_t new_count = lss.text_line_count(); + hist_source &hs = lnav_data.ld_hist_source; + int zoom_level = lnav_data.ld_hist_zoom; + time_t old_time; + int lpc; + + old_time = hs.value_for_row(hist_view.get_top()); + hs.set_bucket_size(HIST_ZOOM_VALUES[zoom_level].hl_bucket_size); + hs.set_group_size(HIST_ZOOM_VALUES[zoom_level].hl_group_size); + if (force) { + hs.clear(); + } + for (lpc = old_count; lpc < new_count; lpc++) { + logline *ll = lss.find_line(lss.at(vis_line_t(lpc))); + + if (!(ll->get_level() & logline::LEVEL_CONTINUED)) { + hs.add_value(ll->get_time(), + bucket_type_t(ll->get_level() & + ~logline::LEVEL__FLAGS)); + } + } + hs.analyze(); + hist_view.reload_data(); + hist_view.set_top(hs.row_for_value(old_time)); +} + +static void rebuild_indexes(bool force) +{ + static loading_observer obs; + + logfile_sub_source &lss = lnav_data.ld_log_source; + textview_curses &log_view = lnav_data.ld_views[LNV_LOG]; + vis_line_t old_bottom(0), height(0); + + unsigned long width; + bool scroll_down; + size_t old_count; + time_t old_time; + + old_time = lnav_data.ld_top_time; + log_view.get_dimensions(height, width); + old_bottom = log_view.get_top() + height; + scroll_down = old_bottom > lss.text_line_count(); + if (force) { + old_count = 0; + } + else { + old_count = lss.text_line_count(); + } + if (lss.rebuild_index(&obs, force)) { + hist_source &hs = lnav_data.ld_hist_source; + size_t new_count = lss.text_line_count(); + grep_line_t start_line; + int lpc; + + log_view.reload_data(); + + if (scroll_down && new_count >= height) { + log_view.set_top(vis_line_t(new_count - height + 1)); + } + else if (!scroll_down && force) { + log_view.set_top(lss.find_from_time(old_time)); + } + + rebuild_hist(old_count, force); + + start_line = force ? grep_line_t(0) : grep_line_t(-1); + + for (lpc = 0; lpc < LG__MAX; lpc++) { + if (lnav_data.ld_grep_child[lpc].get() != NULL) { + lnav_data.ld_grep_child[lpc]->get_grep_proc()-> + queue_request(start_line); + lnav_data.ld_grep_child[lpc]->get_grep_proc()->start(); + } + } + } + + lnav_data.ld_bottom_source.update_filtered(lss); + lnav_data.ld_scroll_broadcaster.invoke(lnav_data.ld_view_stack.top()); +} + +class plain_text_source + : public text_sub_source { +public: + plain_text_source(string text) + { + size_t start = 0, end; + + while ((end = text.find('\n', start)) != string::npos) { + this->tds_lines.push_back(text.substr(start, end - start)); + start = end + 1; + } + this->tds_lines.push_back(text.substr(start)); + }; + + size_t text_line_count() + { + return this->tds_lines.size(); + }; + + void text_value_for_line(textview_curses &tc, + int row, + string &value_out, + bool no_scrub) + { + value_out = this->tds_lines[row]; + }; + +private: + vector tds_lines; +}; + +class time_label_source + : public hist_source::label_source { +public: + time_label_source() { }; + + void hist_label_for_bucket(int bucket_start_value, + const hist_source::bucket_t &bucket, + string &label_out) + { + hist_source::bucket_t::const_iterator iter; + int total = 0, errors = 0, warnings = 0; + time_t bucket_time = bucket_start_value; + struct tm *bucket_tm; + char buffer[128]; + int len; + + bucket_tm = gmtime((time_t *)&bucket_time); + if (bucket_tm) + strftime(buffer, sizeof(buffer), + " %a %b %d %H:%M ", + bucket_tm); + else { + fprintf(stderr, "bad time %d\n", bucket_start_value); + buffer[0] = '\0'; + } + for (iter = bucket.begin(); iter != bucket.end(); iter++) { + total += (int)iter->second; + switch (iter->first) { + case logline::LEVEL_ERROR: + case logline::LEVEL_CRITICAL: + errors += (int)iter->second; + break; + + case logline::LEVEL_WARNING: + warnings += (int)iter->second; + break; + } + } + + len = strlen(buffer); + snprintf(&buffer[len], sizeof(buffer) - len, + " %8d total %8d errors", + total, errors); + + label_out = string(buffer); + }; +}; + +static string get_current_dir(void) +{ + char cwd[FILENAME_MAX]; + string retval = "."; + + if (getcwd(cwd, sizeof(cwd)) == NULL) { + perror("getcwd"); + } + else { + retval = string(cwd); + } + + if (retval != "/") { + retval += "/"; + } + + return retval; +} + +static bool change_to_parent_dir(void) +{ + bool retval = false; + char cwd[3] = ""; + + getcwd(cwd, sizeof(cwd)); + if (strcmp(cwd, "/") != 0) { + if (chdir("..") == -1) { + perror("chdir('..')"); + } + else { + retval = true; + } + } + + return retval; +} + +static bool append_default_files(lnav_flags_t flag) +{ + bool retval = true; + + if (lnav_data.ld_flags & flag) { + pair::iterator, + multimap::iterator> range; + bool found = false; + + for (range = DEFAULT_FILES.equal_range(flag); + range.first != range.second && !found; + range.first++) { + string path = range.first->second; + struct stat st; + + if (access(path.c_str(), R_OK) == 0) { + path = get_current_dir() + range.first->second; + + if (lnav_data.ld_flags & LNF_ROTATED) { + glob_t gl; + + memset(&gl, 0, sizeof(gl)); + path += "*"; + if (glob(path.c_str(), 0, NULL, &gl) == 0) { + int lpc; + + for (lpc = 0; lpc < gl.gl_pathc; lpc++) { + lnav_data.ld_file_names.insert(make_pair(gl.gl_pathv[lpc], -1)); + } + globfree(&gl); + } + } + else { + lnav_data.ld_file_names.insert(make_pair(path, -1)); + } + found = true; + } + else if (stat(path.c_str(), &st) == 0) { + fprintf(stderr, + "error: cannot read -- %s%s\n", + get_current_dir().c_str(), + path.c_str()); + retval = false; + } + } + } + + return retval; +} + +static void sigint(int sig) +{ + lnav_data.ld_looping = false; +} + +static void sigwinch(int sig) +{ + lnav_data.ld_winched = true; +} + + +static void back_ten(int ten_minute) +{ + logfile_sub_source &lss = lnav_data.ld_log_source; + + time_t hour = rounddown_offset(lnav_data.ld_top_time, + 60 * 60, + ten_minute * 10 * 60); + vis_line_t line = lss.find_from_time(hour); + + --line; + lnav_data.ld_view_stack.top()->set_top(line); +} + +static bool toggle_view(textview_curses *toggle_tc) +{ + textview_curses *tc = lnav_data.ld_view_stack.top(); + bool retval = false; + + if (tc == toggle_tc) { + lnav_data.ld_view_stack.pop(); + } + else { + int lpc; + + for (lpc = 0; lpc < LG__MAX; lpc++) { + lnav_data.ld_grep_child[lpc].reset(); + } + lnav_data.ld_view_stack.push(toggle_tc); + retval = true; + } + tc = lnav_data.ld_view_stack.top(); + tc->set_needs_update(); + lnav_data.ld_scroll_broadcaster.invoke(tc); + + return retval; +} + +static void moveto_cluster(vis_line_t (bookmark_vector::*f)(vis_line_t), + bookmark_type_t *bt, + vis_line_t top) +{ + textview_curses *tc = lnav_data.ld_view_stack.top(); + + if (tc != &lnav_data.ld_views[LNV_LOG]) { + flash(); + } + else { + logfile_sub_source &lss = lnav_data.ld_log_source; + bookmarks &bm = tc->get_bookmarks(); + vis_line_t vl(-1), last_top(top); + + logline::level_t last_level; + bool done = false; + time_t last_time; + logline *ll; + + ll = lss.find_line(lss.at(top)); + last_time = ll->get_time(); + last_level = ll->get_level(); + while (vl == -1 && (top = (bm[bt].*f)(top)) != -1) { + ll = lss.find_line(lss.at(top)); + if (abs(last_top - top) > 1 || + ll->get_level() != last_level || + ll->get_time() != last_time) { + last_time = ll->get_time(); + last_level = ll->get_level(); + vl = top; + } + last_top = top; + } + while (vl > 0 && !done) { + ll = lss.find_line(lss.at(vis_line_t(vl - 1))); + if (ll->get_level() != last_level || ll->get_time() != last_time) { + done = true; + } + else { + --vl; + } + } + tc->set_top(vl); + } +} + +/* XXX For one, this code is kinda crappy. For two, we should probably link + * directly with X so we don't need to have xclip installed and it'll work if + * we're ssh'd into a box. + */ +static void copy_to_xclip(void) +{ + textview_curses *tc = lnav_data.ld_view_stack.top(); + bookmark_vector &bv = tc->get_bookmarks()[&textview_curses::BM_USER]; + bookmark_vector::iterator iter; + FILE *pfile = NULL; + string line; + + if ((pfile = popen("xclip -i > /dev/null", "w")) == NULL) { + flash(); + return; + } + + for (iter = bv.begin(); iter != bv.end(); iter++) { + tc->grep_value_for_line(*iter, line); + fprintf(pfile, "%s\n", line.c_str()); + } + + fclose(pfile); + pfile = NULL; +} + +static void handle_paging_key(int ch) +{ + textview_curses *tc = lnav_data.ld_view_stack.top(); + + logfile_sub_source &lss = lnav_data.ld_log_source; + bookmarks &bm = tc->get_bookmarks(); + + if (tc->handle_key(ch)) { + return; + } + + /* process the command keystroke */ + switch (ch) { + case 'q': + case 'Q': + lnav_data.ld_view_stack.pop(); + if (lnav_data.ld_view_stack.empty()) { + lnav_data.ld_looping = false; + } + else { + tc = lnav_data.ld_view_stack.top(); + tc->set_needs_update(); + } + break; + + case 'c': + copy_to_xclip(); + break; + + case 'e': + moveto_cluster(&bookmark_vector::next, + &logfile_sub_source::BM_ERRORS, + tc->get_top()); + break; + + case 'E': + moveto_cluster(&bookmark_vector::prev, + &logfile_sub_source::BM_ERRORS, + tc->get_top()); + break; + + case 'w': + moveto_cluster(&bookmark_vector::next, + &logfile_sub_source::BM_WARNINGS, + tc->get_top()); + break; + + case 'W': + moveto_cluster(&bookmark_vector::prev, + &logfile_sub_source::BM_WARNINGS, + tc->get_top()); + break; + + case 'n': + tc->set_top(bm[&textview_curses::BM_SEARCH].next(tc->get_top())); + break; + + case 'N': + tc->set_top(bm[&textview_curses::BM_SEARCH].prev(tc->get_top())); + break; + + case 'f': + if (tc == &lnav_data.ld_views[LNV_LOG]) { + tc->set_top(bm[&logfile_sub_source::BM_FILES].next(tc->get_top())); + } + break; + + case 'F': + if (tc == &lnav_data.ld_views[LNV_LOG]) { + tc->set_top(bm[&logfile_sub_source::BM_FILES].prev(tc->get_top())); + } + break; + +#if 0 + /* XXX superceded by 'I' ? */ + case 'j': + if (tc == &lnav_data.ld_views[LNV_HISTOGRAM]) { + time_t top_time; + + top_time = lnav_data.ld_hist_source.value_for_row(tc->get_top()); + + do { + lnav_data.ld_view_stack.pop(); + tc = lnav_data.ld_view_stack.top(); + } while (tc != &lnav_data.ld_views[LNV_LOG]); + tc->set_top(lss.find_from_time(top_time)); + tc->set_needs_update(); + } + else if (tc == &lnav_data.ld_views[LNV_GRAPH]) { + grapher &gr = lnav_data.ld_graph_source; + int row = gr.value_for_row(tc->get_top()); + + do { + lnav_data.ld_view_stack.pop(); + tc = lnav_data.ld_view_stack.top(); + } while (tc != &lnav_data.ld_views[LNV_LOG]); + tc->set_top(vis_line_t(gr.at(row))); + tc->set_needs_update(); + } + break; +#endif + + case 'z': + if (tc == &lnav_data.ld_views[LNV_HISTOGRAM]) { + if ((lnav_data.ld_hist_zoom + 1) >= HIST_ZOOM_LEVELS) { + flash(); + } + else { + hist_source &hs = lnav_data.ld_hist_source; + + lnav_data.ld_hist_zoom += 1; + rebuild_hist(0, true); + } + } + break; + + case 'Z': + if (tc == &lnav_data.ld_views[LNV_HISTOGRAM]) { + if (lnav_data.ld_hist_zoom == 0) { + flash(); + } + else { + hist_source &hs = lnav_data.ld_hist_source; + + lnav_data.ld_hist_zoom -= 1; + rebuild_hist(0, true); + } + } + break; + + case 'u': + tc->set_top(tc->get_bookmarks()[&textview_curses::BM_USER]. + next(tc->get_top())); + break; + + case 'U': + tc->set_top(tc->get_bookmarks()[&textview_curses::BM_USER]. + prev(tc->get_top())); + break; + + case 'm': + lnav_data.ld_last_user_mark[tc] = tc->get_top(); + tc->toggle_user_mark(lnav_data.ld_last_user_mark[tc]); + tc->reload_data(); + break; + case 'J': + // TODO: if they scroll up, we should start marking again from the top. + // We should also scroll down as the continue to mark stuff. If they + // move somewhere else in the file, we should also start marking from + // the top again. + if (lnav_data.ld_last_user_mark.find(tc) == lnav_data.ld_last_user_mark.end()) { + lnav_data.ld_last_user_mark[tc] = tc->get_top(); + } + else if (lnav_data.ld_last_user_mark[tc] + 1 > tc->get_bottom()) { + flash(); + break; // XXX + } + else { + lnav_data.ld_last_user_mark[tc] += 1; + } + tc->toggle_user_mark(lnav_data.ld_last_user_mark[tc]); + tc->reload_data(); + break; + case 'K': + // TODO: scroll up with the selection + if (lnav_data.ld_last_user_mark.find(tc) == lnav_data.ld_last_user_mark.end()) { + lnav_data.ld_last_user_mark[tc] = tc->get_top(); + } + + tc->toggle_user_mark(lnav_data.ld_last_user_mark[tc]); + if (lnav_data.ld_last_user_mark[tc] - 1 < 0) { + flash(); + } + else { + lnav_data.ld_last_user_mark[tc] -= 1; + } + tc->reload_data(); + break; + case 'M': + if (lnav_data.ld_last_user_mark.find(tc) == lnav_data.ld_last_user_mark.end()) { + flash(); + } + else { + int start_line = min((int)tc->get_top(), lnav_data.ld_last_user_mark[tc] + 1); + int end_line = max((int)tc->get_top(), lnav_data.ld_last_user_mark[tc] - 1); + + tc->toggle_user_mark(start_line, end_line); + tc->reload_data(); + } + break; + + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + { + int ten_minute = (ch - '0') * 10 * 60; + time_t hour = rounddown(lnav_data.ld_top_time + + (60 * 60) - + ten_minute + + 1, + 60 * 60); + vis_line_t line = lss.find_from_time(hour + ten_minute); + + tc->set_top(line); + } + break; + + case '!': + back_ten(1); + break; + + case '@': + back_ten(2); + break; + + case '#': + back_ten(3); + break; + + case '$': + back_ten(4); + break; + + case '%': + back_ten(5); + break; + + case '^': + back_ten(6); + break; + + case '0': + { + time_t first_time = lnav_data.ld_top_time; + int step = 24 * 60 * 60; + vis_line_t line = lss.find_from_time(roundup(first_time, step)); + + tc->set_top(line); + } + break; + + case ')': + { + time_t day = rounddown(lnav_data.ld_top_time, 24 * 60 * 60); + vis_line_t line = lss.find_from_time(day); + + --line; + tc->set_top(line); + } + break; + + case 'D': + case 'O': + if (tc->get_top() == 0) { + flash(); + } + else { + int step = ch == 'D' ? (24 * 60 * 60) : (60 * 60); + time_t top_time = lnav_data.ld_top_time; + vis_line_t line = lss.find_from_time(top_time - step); + + if (line != 0) { + --line; + } + tc->set_top(line); + } + break; + + case 'd': + case 'o': + { + int step = ch == 'd' ? (24 * 60 * 60) : (60 * 60); + vis_line_t line = lss.find_from_time(lnav_data.ld_top_time + step); + + tc->set_top(line); + } + break; + + case 's': + lnav_data.ld_log_source.toggle_scrub(); + tc->reload_data(); + break; + + case ':': + lnav_data.ld_mode = LNM_COMMAND; + lnav_data.ld_rl_view->focus(LNM_COMMAND, ":"); + break; + + case '/': + lnav_data.ld_mode = LNM_SEARCH; + lnav_data.ld_rl_view->focus(LNM_SEARCH, "/"); + break; + + case ';': + lnav_data.ld_mode = LNM_SQL; + lnav_data.ld_rl_view->focus(LNM_SQL, ";"); + break; + + case 'i': + toggle_view(&lnav_data.ld_views[LNV_HISTOGRAM]); + break; + + case 'I': + { + time_t tt = lnav_data.ld_top_time; + + if (toggle_view(&lnav_data.ld_views[LNV_HISTOGRAM])) { + hist_source &hs = lnav_data.ld_hist_source; + + tc = lnav_data.ld_view_stack.top(); + tc->set_top(hs.row_for_value(tt)); + } + } + break; + + case 'g': + toggle_view(&lnav_data.ld_views[LNV_GRAPH]); + break; + + case '?': + toggle_view(&lnav_data.ld_views[LNV_HELP]); + break; + + case '.': + toggle_view(&lnav_data.ld_views[LNV_DB]); + break; + + default: + // fprintf(stderr, "unhandled %d\n", ch); + flash(); + break; + } +} + +static void handle_rl_key(int ch) +{ + switch (ch) { + case KEY_PPAGE: + case KEY_NPAGE: + handle_paging_key(ch); + break; + + default: + lnav_data.ld_rl_view->handle_key(ch); + break; + } +} + +static string com_unix_time(string cmdline, vector &args) +{ + string retval = "error: expecting a unix time value"; + + if (args.size() == 0) { } + else if (args.size() >= 2) { + char ftime[128] = ""; + bool parsed = false; + struct tm log_time; + time_t u_time; + size_t millis; + char *rest; + + u_time = time(NULL); + log_time = *localtime( &u_time); + + log_time.tm_isdst = -1; + + args[1] = cmdline.substr(cmdline.find(args[1])); + if ((millis = args[1].find('.')) != string::npos || + (millis = args[1].find(',')) != string::npos) { + args[1] = args[1].erase(millis, 4); + } + if (((rest = strptime(args[1].c_str(), + "%b %d %H:%M:%S %Y", + &log_time)) != NULL && + (rest - args[1].c_str()) >= 20) || + ((rest = strptime(args[1].c_str(), + "%Y-%m-%d %H:%M:%S", + &log_time)) != NULL && + (rest - args[1].c_str()) >= 19)) { + u_time = mktime(&log_time); + parsed = true; + } + else if (sscanf(args[1].c_str(), "%ld", &u_time)) { + log_time = *localtime( &u_time); + + parsed = true; + } + if (parsed) { + int len; + + strftime(ftime, sizeof(ftime), + "%a %b %d %H:%M:%S %Y %z %Z", + localtime(&u_time)); + len = strlen(ftime); + snprintf(ftime + len, sizeof(ftime) - len, + " -- %ld\n", + u_time); + retval = string(ftime); + } + } + + return retval; +} + +static string com_current_time(string cmdline, vector &args) +{ + char ftime[128]; + string retval; + time_t u_time; + int len; + + u_time = time(NULL); + strftime(ftime, sizeof(ftime), + "%a %b %d %H:%M:%S %Y %z %Z", + localtime(&u_time)); + len = strlen(ftime); + snprintf(ftime + len, sizeof(ftime) - len, + " -- %ld\n", + u_time); + retval = string(ftime); + + return retval; +} + +static string com_goto(string cmdline, vector &args) +{ + string retval = "error: expecting line number/percentage"; + + if (args.size() == 0) { } + else if (args.size() > 1) { + textview_curses *tc = lnav_data.ld_view_stack.top(); + int line_number, consumed; + float value; + + if (sscanf(args[1].c_str(), "%f%n", &value, &consumed) == 1) { + if (args[1][consumed] == '%') { + line_number = (int) + ((double)tc->get_inner_height() * (value / 100.0)); + } + else { + line_number = (int)value; + } + tc->set_top(vis_line_t(line_number)); + + retval = ""; + } + } + + return retval; +} + +static string com_save_to(string cmdline, vector &args) +{ + FILE *outfile = NULL; + FILE *pfile = NULL; + char command[1024]; + const char *mode; + + if (args.size() == 0) { + args.push_back("filename"); + return ""; + } + + if (args.size() != 2) { + return "error: expecting file name"; + } + + snprintf(command, sizeof(command), "echo -n %s", args[1].c_str()); + if ((pfile = popen(command, "r")) == NULL) { + return "error: unable to compute file name"; + } + + fgets(command, sizeof(command), pfile); + fclose(pfile); + pfile = NULL; + + if (args[0] == "append-to") { + mode = "a"; + } + else if (args[0] == "write-to") { + mode = "w"; + } + + if ((outfile = fopen(command, mode)) == NULL) { + return "error: unable to open file -- " + string(command); + } + + textview_curses *tc = lnav_data.ld_view_stack.top(); + bookmark_vector &bv = tc->get_bookmarks()[&textview_curses::BM_USER]; + bookmark_vector::iterator iter; + string line; + + for (iter = bv.begin(); iter != bv.end(); iter++) { + tc->grep_value_for_line(*iter, line); + fprintf(outfile, "%s\n", line.c_str()); + } + + fclose(outfile); + outfile = NULL; + + return ""; +} + +static string com_highlight(string cmdline, vector &args) +{ + string retval = "error: expecting regular expression to highlight"; + + if (args.size() == 0) { } + else if (args.size() > 1) { + const char *errptr; + pcre *code; + int eoff; + + args[1] = cmdline.substr(cmdline.find(args[1])); + if ((code = pcre_compile(args[1].c_str(), + PCRE_CASELESS, + &errptr, + &eoff, + NULL)) == NULL) { + retval = "error: " + string(errptr); + } + else { + textview_curses *tc = lnav_data.ld_view_stack.top(); + textview_curses::highlighter hl(code, false); + + textview_curses::highlight_map_t &hm = tc->get_highlights(); + + hm[args[1]] = hl; + + retval = "info: highlight pattern now active"; + } + } + + return retval; +} + +static string com_graph(string cmdline, vector &args) +{ + string retval = "error: expecting regular expression to graph"; + + if (args.size() == 0) { + args.push_back("graph"); + } + else if (args.size() > 1) { + const char *errptr; + pcre *code; + int eoff; + + args[1] = cmdline.substr(cmdline.find(args[1])); + if ((code = pcre_compile(args[1].c_str(), + PCRE_CASELESS, + &errptr, + &eoff, + NULL)) == NULL) { + retval = "error: " + string(errptr); + } + else { + textview_curses &tc = lnav_data.ld_views[LNV_LOG]; + textview_curses::highlighter hl(code, true); + + textview_curses::highlight_map_t &hm = tc.get_highlights(); + + hm["(graph"] = hl; + lnav_data.ld_graph_source.set_highlighter(&hm["(graph"]); + + auto_ptr gp(new grep_proc(code, + tc, + lnav_data.ld_max_fd, + lnav_data.ld_read_fds)); + + gp->queue_request(); + gp->start(); + gp->set_sink(&lnav_data.ld_graph_source); + + auto_ptr + gh(new grep_highlighter(gp, "(graph", hm)); + lnav_data.ld_grep_child[LG_GRAPH] = gh; + + retval = ""; + } + } + + return retval; +} + +class pcre_filter + : public logfile_filter { +public: + pcre_filter(type_t type, string id, pcre *code) + : logfile_filter(type, id), + pf_code(code) { }; + virtual ~pcre_filter() { }; + + bool matches(string line) + { + static const int MATCH_COUNT = 30; + int matches[MATCH_COUNT], rc; + bool retval; + + rc = pcre_exec(this->pf_code, + NULL, + line.c_str(), + line.size(), + 0, + 0, + matches, + MATCH_COUNT); + retval = (rc >= 0); + +#if 0 + fprintf(stderr, " out %d %s\n", + retval, + line.c_str()); +#endif + + return retval; + }; + +protected: + auto_mem pf_code; +}; + +static string com_filter(string cmdline, vector &args) +{ + string retval = "error: expecting regular expression to filter out"; + + if (args.size() == 0) { + args.push_back("filter"); + } + else if (args.size() > 1) { + const char *errptr; + pcre *code; + int eoff; + + args[1] = cmdline.substr(cmdline.find(args[1])); + if ((code = pcre_compile(args[1].c_str(), + 0, + &errptr, + &eoff, + NULL)) == NULL) { + retval = "error: " + string(errptr); + } + else { + logfile_sub_source &lss = lnav_data.ld_log_source; + logfile_filter::type_t lt = (args[0] == "filter-out") ? + logfile_filter::EXCLUDE : logfile_filter::INCLUDE; + auto_ptr pf(new pcre_filter(lt, args[1], code)); + + lss.get_filters().push_back(pf.release()); + lnav_data.ld_rl_view-> + add_possibility(LNM_COMMAND, "enabled-filter", args[1]); + rebuild_indexes(true); + + retval = "info: filter now active"; + } + } + + return retval; +} + +static string com_enable_filter(string cmdline, vector &args) +{ + string retval = "error: expecting disabled filter to enable"; + + if (args.size() == 0) { + args.push_back("disabled-filter"); + } + else if (args.size() > 1) { + logfile_filter *lf; + bool found = false; + + args[1] = cmdline.substr(cmdline.find(args[1])); + lf = lnav_data.ld_log_source.get_filter(args[1]); + if (lf == NULL) { + retval = "error: no such filter -- " + args[1]; + } + else if (lf->is_enabled()) { + retval = "info: filter already enabled"; + } + else { + lf->enable(); + lnav_data.ld_rl_view-> + rem_possibility(LNM_COMMAND, "disabled-filter", args[1]); + lnav_data.ld_rl_view-> + add_possibility(LNM_COMMAND, "enabled-filter", args[1]); + rebuild_indexes(true); + retval = "info: filter enabled"; + } + } + + return retval; +} + +static string com_disable_filter(string cmdline, vector &args) +{ + string retval = "error: expecting enabled filter to disable"; + + if (args.size() == 0) { + args.push_back("enabled-filter"); + } + else if (args.size() > 1) { + logfile_filter *lf; + bool found = false; + + args[1] = cmdline.substr(cmdline.find(args[1])); + lf = lnav_data.ld_log_source.get_filter(args[1]); + if (lf == NULL) { + retval = "error: no such filter -- " + args[1]; + } + else if (!lf->is_enabled()) { + retval = "info: filter already disabled"; + } + else { + lf->disable(); + lnav_data.ld_rl_view-> + rem_possibility(LNM_COMMAND, "disabled-filter", args[1]); + lnav_data.ld_rl_view-> + add_possibility(LNM_COMMAND, "enabled-filter", args[1]); + rebuild_indexes(true); + retval = "info: filter disabled"; + } + } + + return retval; +} + +static string com_capture(string cmdline, vector &args) +{ + string retval = "error: expecting table name"; + + if (args.size() == 2) { + lnav_data.ld_mode = LNM_CAPTURE; + lnav_data.ld_rl_view->focus(LNM_CAPTURE, "index: "); + + retval = ""; + } + + return retval; +} + +static readline_context::command_map_t lnav_commands; + +static void rl_search(void *dummy, readline_curses *rc) +{ + static string last_search[LG__MAX]; + + string name; + int index; + + switch (lnav_data.ld_mode) { + case LNM_SEARCH: + index = LG_SEARCH; + name = "(search"; + break; + case LNM_CAPTURE: + index = LG_CAPTURE; + name = "(capture"; + break; + + case LNM_COMMAND: + return; + + case LNM_SQL: + try { + /* XXX need to use the sqlite api */ + session &sql = *lnav_data.ld_sql; + sql.prepare << rc->get_value(); + } + catch (soci::soci_error &e) { + lnav_data.ld_bottom_source. + grep_error(string("sql error: ") + e.what()); + } + return; + default: + assert(0); + break; + } + + auto_ptr &gc = lnav_data.ld_grep_child[index]; + + if ((gc.get() == NULL) || (rc->get_value() != last_search[index])) { + textview_curses *tc = lnav_data.ld_view_stack.top(); + const char *errptr; + pcre *code; + int eoff; + + if (rc->get_value().empty() && gc.get() != NULL) { + tc->grep_begin(*(gc->get_grep_proc())); + tc->grep_end(*(gc->get_grep_proc())); + } + gc.reset(); + + fprintf(stderr, "start search for: %s\n", rc->get_value().c_str()); + + if (rc->get_value().empty()) { + lnav_data.ld_bottom_source.grep_error(""); + } + else if ((code = pcre_compile(rc->get_value().c_str(), + PCRE_CASELESS, + &errptr, + &eoff, + NULL)) == NULL) { + lnav_data.ld_bottom_source. + grep_error("regexp error: " + string(errptr)); + } + else { + textview_curses::highlighter + hl(code, false, view_colors::VCR_SEARCH); + + textview_curses::highlight_map_t &hm = tc->get_highlights(); + hm[name] = hl; + + auto_ptr gp(new grep_proc(code, + *tc, + lnav_data.ld_max_fd, + lnav_data.ld_read_fds)); + + gp->queue_request(grep_line_t(tc->get_top())); + if (tc->get_top() > 0) { + gp->queue_request(grep_line_t(0), + grep_line_t(tc->get_top())); + } + gp->start(); + gp->set_sink(lnav_data.ld_view_stack.top()); + + tc->set_follow_search(true); + + auto_ptr gh(new grep_highlighter(gp, name, hm)); + gc = gh; + + last_search[index] = rc->get_value(); + } + } +} + +static void rl_callback(void *dummy, readline_curses *rc) +{ + switch (lnav_data.ld_mode) { + case LNM_COMMAND: + { + stringstream ss(rc->get_value()); + + vector args; + string buf, msg; + + lnav_data.ld_mode = LNM_PAGING; + while (ss >> buf) { + args.push_back(buf); + } + + if (args.size() > 0) { + readline_context::command_map_t::iterator iter; + + if ((iter = lnav_commands.find(args[0])) == + lnav_commands.end()) { + msg = "error: unknown command - " + args[0]; + } + else { + msg = iter->second(rc->get_value(), args); + } + } + rc->set_value(msg); + } + break; + + case LNM_SEARCH: + case LNM_CAPTURE: + rl_search(dummy, rc); + if (rc->get_value().size() > 0) { + lnav_data.ld_view_stack.top()->set_follow_search(false); + lnav_data.ld_rl_view-> + add_possibility(LNM_COMMAND, "filter", rc->get_value()); + rc->set_value("search: " + rc->get_value()); + } + lnav_data.ld_mode = LNM_PAGING; + break; + + case LNM_SQL: + try { + session &sql = *lnav_data.ld_sql; + + rowset rs = (sql.prepare << rc->get_value()); + db_label_source &dls = lnav_data.ld_db_rows; + hist_source &hs = lnav_data.ld_db_source; + bool header_done = false; + int row_number = 0; + char buffer[128]; + + hs.clear(); + dls.dls_rows.clear(); + for (rowset::const_iterator it = rs.begin(); + it != rs.end(); + ++it, row_number++) { + dls.dls_rows.resize(dls.dls_rows.size() + 1); + for(std::size_t lpc = 0; lpc != it->size(); ++lpc) { + const column_properties & props = it->get_properties(lpc); + double num_value = 0; + + if (!header_done) { + fprintf(stderr, "<%s> ", props.get_name().c_str()); + fprintf(stderr, " dt %d\n", props.get_data_type()); + hs.set_role_for_type(bucket_type_t(lpc), + view_colors::singleton(). + next_highlight()); + } + switch(props.get_data_type()) + { + case dt_string: + { + const char *str = it->get(lpc).c_str(); + int i; + + dls.push_column(str); + // XXX captures too much + if (sscanf(str, "%d", &i) == 1) { + num_value = i; + } + else { + sscanf(str, "%f", &num_value); + } + } + break; + case dt_double: + snprintf(buffer, sizeof(buffer), + "%f", + it->get(lpc)); + dls.push_column(buffer); + num_value = it->get(lpc); + break; + case dt_integer: + snprintf(buffer, sizeof(buffer), + "%d", + it->get(lpc)); + dls.push_column(buffer); + num_value = it->get(lpc); + break; + case dt_unsigned_long: + snprintf(buffer, sizeof(buffer), + "%ld", + it->get(lpc)); + dls.push_column(buffer); + num_value = it->get(lpc); + break; + case dt_long_long: + snprintf(buffer, sizeof(buffer), + "%lld", + it->get(lpc)); + dls.push_column(buffer); + num_value = it->get(lpc); + break; + case dt_date: + { + std::tm when = it->get(lpc); + + strftime(buffer, sizeof(buffer), + "%a, %d %b %Y %H:%M:%S %z", + &when); + dls.push_column(buffer); + } + break; + + default: + dls.push_column("XXX"); + break; + } + + hs.add_value(row_number, bucket_type_t(lpc), num_value); + } + header_done = true; + } + + rc->set_value(""); // XXX + + hs.analyze(); + lnav_data.ld_views[LNV_DB].reload_data(); + + toggle_view(&lnav_data.ld_views[LNV_DB]); + } + catch (soci::soci_error &e) { + rc->set_value(e.what()); + } + lnav_data.ld_mode = LNM_PAGING; + break; + } +} + +static void usage(void) +{ + const char *usage_msg = + "usage: %s [-habfso] [logfile1 logfile2 ...]\n" + "\n" + "A curses-based log file viewer that indexes log messages by type\n" + "and time to make it easier to navigate through files quickly.\n" + "\n" + "Key bindings:\n" + " ? View/leave the online help text.\n" + " q Quit the program.\n" + "\n" + "Options:\n" + " -h Print this message, then exit.\n" + " -s Load the most recent syslog messages file.\n" + " -a Load all of the most recent log file types.\n" + " -r Load older rotated log files as well.\n" + "\n" + "Optional arguments:\n" + " logfile1 The log files to view.\n" + "\n" + "Examples:\n" + " To load and follow the backend log file -\n" + " $ lnav\n" + "\n" + " To interleave the JBoss and backend log files -\n" + " $ lnav -bf\n"; + + fprintf(stderr, usage_msg, lnav_data.ld_program_name); +} + +static pcre *xpcre_compile(const char *pattern, int options = 0) +{ + const char *errptr; + pcre *retval; + int eoff; + + if ((retval = pcre_compile(pattern, + options, + &errptr, + &eoff, + NULL)) == NULL) { + fprintf(stderr, "internal error: failed to compile -- %s\n", pattern); + fprintf(stderr, "internal error: %s\n", errptr); + + exit(1); + } + + return retval; +} + +static void update_times(void *, listview_curses *lv) +{ + if (lv == &lnav_data.ld_views[LNV_LOG] && lv->get_inner_height() > 0) { + logfile_sub_source &lss = lnav_data.ld_log_source; + + lnav_data.ld_top_time = + lss.find_line(lss.at(lv->get_top()))->get_time(); + lnav_data.ld_bottom_time = + lss.find_line(lss.at(lv->get_bottom()))->get_time(); + } + if (lv == &lnav_data.ld_views[LNV_HISTOGRAM] && + lv->get_inner_height() > 0) { + hist_source &hs = lnav_data.ld_hist_source; + + lnav_data.ld_top_time = hs.value_for_row(lv->get_top()); + lnav_data.ld_bottom_time = hs.value_for_row(lv->get_bottom()); + } +} + +static void looper(void) +{ + int fd; + + fd = open(lnav_data.ld_debug_log_name, O_WRONLY | O_CREAT | O_APPEND, 0666); + dup2(fd, STDERR_FILENO); + close(fd); + fprintf(stderr, "startup\n"); + + try { + readline_context command_context(&lnav_commands); + + struct timeval last_check = { 0, 0 }; + readline_context search_context; + readline_context index_context; + textview_curses *tc; + readline_curses rlc; + int lpc; + + listview_curses::action::broadcaster &sb = + lnav_data.ld_scroll_broadcaster; + + rlc.add_context(LNM_COMMAND, command_context); + rlc.add_context(LNM_SEARCH, search_context); + rlc.add_context(LNM_CAPTURE, index_context); + rlc.add_context(LNM_SQL, index_context); + rlc.start(); + + lnav_data.ld_rl_view = &rlc; + + lnav_data.ld_rl_view-> + add_possibility(LNM_COMMAND, "graph", "\\d+(?:\\.\\d+)?"); + lnav_data.ld_rl_view-> + add_possibility(LNM_COMMAND, "graph", "([:= \\t]\\d+(?:\\.\\d+)?)"); + + (void)signal(SIGINT, sigint); + (void)signal(SIGTERM, sigint); + (void)signal(SIGWINCH, sigwinch); + + screen_curses sc; + + lnav_data.ld_window = sc.get_window(); + keypad(stdscr, TRUE); + (void)nonl(); + (void)cbreak(); + (void)noecho(); + (void)nodelay(lnav_data.ld_window, 1); + + define_key("\033Od", KEY_BEG); + define_key("\033Oc", KEY_END); + + view_colors::singleton().init(); + + rlc.set_window(lnav_data.ld_window); + rlc.set_y(-1); + rlc.set_perform_action(readline_curses::action(rl_callback)); + rlc.set_timeout_action(readline_curses::action(rl_search)); + + lnav_data.ld_view_stack.push(&lnav_data.ld_views[LNV_LOG]); + + tc = lnav_data.ld_view_stack.top(); + + for (lpc = 0; lpc < LNV__MAX; lpc++) { + lnav_data.ld_views[lpc].set_window(lnav_data.ld_window); + lnav_data.ld_views[lpc].set_y(1); + lnav_data.ld_views[lpc]. + set_height(vis_line_t(-(rlc.get_height() + 1 + 1))); + lnav_data.ld_views[lpc]. + set_scroll_action(sb.get_functor()); + lnav_data.ld_views[lpc]. + set_search_action(&lnav_data.ld_bottom_source.hits_wire); + } + + lnav_data.ld_status[LNS_TOP].set_top(0); + for (lpc = 0; lpc < LNS__MAX; lpc++) { + lnav_data.ld_status[lpc].set_window(lnav_data.ld_window); + } + lnav_data.ld_status[LNS_TOP]. + set_data_source(&lnav_data.ld_top_source); + lnav_data.ld_status[LNS_BOTTOM]. + set_data_source(&lnav_data.ld_bottom_source); + sb.push_back(view_action(update_times)); + sb.push_back(&lnav_data.ld_top_source.marks_wire); + sb.push_back(&lnav_data.ld_top_source.filename_wire); + sb.push_back(&lnav_data.ld_bottom_source.line_number_wire); + sb.push_back(&lnav_data.ld_bottom_source.percent_wire); + sb.push_back(&lnav_data.ld_bottom_source.marks_wire); + + { + vis_line_t top(0), height(0); + + unsigned long width; + + tc->get_dimensions(height, width); + top = vis_line_t(tc->get_inner_height()) - height + vis_line_t(1); + if (top > 0) { + tc->set_top(top); + } + } + + { + hist_source &hs = lnav_data.ld_hist_source; + + lnav_data.ld_hist_zoom = 2; + hs.set_role_for_type(bucket_type_t(logline::LEVEL_CRITICAL), + view_colors::VCR_ERROR); + hs.set_role_for_type(bucket_type_t(logline::LEVEL_ERROR), + view_colors::VCR_ERROR); + hs.set_role_for_type(bucket_type_t(logline::LEVEL_WARNING), + view_colors::VCR_WARNING); + hs.set_label_source(new time_label_source()); + } + + { + hist_source &hs = lnav_data.ld_graph_source; + + hs.set_bucket_size(1); + hs.set_group_size(100); + } + + { + hist_source &hs = lnav_data.ld_db_source; + + hs.set_bucket_size(1); + hs.set_group_size(100); + hs.set_label_source(&lnav_data.ld_db_rows); + } + + FD_ZERO(&lnav_data.ld_read_fds); + FD_SET(STDIN_FILENO, &lnav_data.ld_read_fds); + lnav_data.ld_max_fd = + max(STDIN_FILENO, rlc.update_fd_set(lnav_data.ld_read_fds)); + + while (lnav_data.ld_looping) { + fd_set ready_rfds = lnav_data.ld_read_fds; + struct timeval to = { 0, 330000 }; + int rc; + + lnav_data.ld_top_source.update_time(); + + for (lpc = 0; lpc < LNV__MAX; lpc++) { + lnav_data.ld_views[lpc] + .set_height(vis_line_t(-(rlc.get_height() + 1))); + } + lnav_data.ld_status[LNS_BOTTOM].set_top(-(rlc.get_height() + 1)); + + lnav_data.ld_view_stack.top()->do_update(); + lnav_data.ld_status[LNS_TOP].do_update(); + lnav_data.ld_status[LNS_BOTTOM].do_update(); + rlc.do_update(); + refresh(); + + rc = select(lnav_data.ld_max_fd + 1, + &ready_rfds, NULL, NULL, + &to); + + if (lnav_data.ld_grep_child[LG_SEARCH].get() != NULL) { + lnav_data.ld_bottom_source. + update_hits(lnav_data.ld_view_stack.top()); + } + + if (rc < 0) { + switch (errno) { + case EINTR: + break; + + default: + fprintf(stderr, "select %s\n", strerror(errno)); + lnav_data.ld_looping = false; + break; + } + } + else if (rc == 0) { + rebuild_indexes(false); + } + else { + if (FD_ISSET(STDIN_FILENO, &ready_rfds)) { + int ch; + + while ((ch = getch()) != ERR) { + switch (ch) { + case CEOF: + case KEY_RESIZE: + break; + + default: + switch (lnav_data.ld_mode) { + case LNM_PAGING: + handle_paging_key(ch); + break; + + case LNM_COMMAND: + case LNM_SEARCH: + case LNM_CAPTURE: + case LNM_SQL: + handle_rl_key(ch); + break; + + default: + assert(0); + break; + } + break; + } + } + } + for (lpc = 0; lpc < LG__MAX; lpc++) { + auto_ptr &gc = + lnav_data.ld_grep_child[lpc]; + + if (gc.get() != NULL) { + gc->get_grep_proc()->check_fd_set(ready_rfds); + if (lpc == LG_GRAPH) { + lnav_data.ld_views[LNV_GRAPH].reload_data(); + /* XXX */ + } + } + } + rlc.check_fd_set(ready_rfds); + } + + if (lnav_data.ld_winched) { + struct winsize size; + + fprintf(stderr, "WINCHED\n"); + + if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) { + resizeterm(size.ws_row, size.ws_col); + } + rlc.window_change(); + lnav_data.ld_view_stack.top()->set_needs_update(); + lnav_data.ld_winched = false; + } + } + } + catch (readline_curses::error & e) { + fprintf(stderr, "error: %s\n", strerror(e.e_err)); + } +} + +class access_log_table : public log_vtab_impl { +public: + + access_log_table() + : log_vtab_impl("access_log"), + alt_regex("([\\w\\.-]+) [\\w\\.-]+ ([\\w\\.-]+) " + "\\[[^\\]]+\\] \"(\\w+) ([^ \\?]+)(\\?[^ ]+)? " + "([\\w/\\.]+)\" (\\d+) " + "(\\d+|-) \"([^\"]+)\" \"([^\"]+)\".*") { + }; + + void get_columns(vector &cols) { + cols.push_back(vtab_column("c_ip", "text")); + cols.push_back(vtab_column("cs_username", "text")); + cols.push_back(vtab_column("cs_method", "text")); + cols.push_back(vtab_column("cs_uri_stem", "text")); + cols.push_back(vtab_column("cs_uri_query", "text")); + cols.push_back(vtab_column("cs_version", "text")); + cols.push_back(vtab_column("sc_status", "text")); + cols.push_back(vtab_column("sc_bytes", "int")); + cols.push_back(vtab_column("cs_referer", "text")); + cols.push_back(vtab_column("cs_user_agent", "text")); + }; + + void extract(const std::string &line, + int column, + sqlite_api::sqlite3_context *ctx) { + using namespace sqlite_api; + string c_ip, cs_username, cs_method, cs_uri_stem, cs_uri_query; + string cs_version, sc_status, cs_referer, cs_user_agent; + int sc_bytes = 0; + + if (!this->alt_regex.FullMatch(line, + &c_ip, + &cs_username, + &cs_method, + &cs_uri_stem, + &cs_uri_query, + &cs_version, + &sc_status, + &sc_bytes, + &cs_referer, + &cs_user_agent)) { + fprintf(stderr, "bad match! %s\n", line.c_str()); + } + switch (column) { + case 0: + sqlite3_result_text(ctx, + c_ip.c_str(), + c_ip.length(), + SQLITE_TRANSIENT); + break; + case 1: + sqlite3_result_text(ctx, + cs_username.c_str(), + cs_username.length(), + SQLITE_TRANSIENT); + break; + case 2: + sqlite3_result_text(ctx, + cs_method.c_str(), + cs_method.length(), + SQLITE_TRANSIENT); + break; + case 3: + sqlite3_result_text(ctx, + cs_uri_stem.c_str(), + cs_uri_stem.length(), + SQLITE_TRANSIENT); + break; + case 4: + sqlite3_result_text(ctx, + cs_uri_query.c_str(), + cs_uri_query.length(), + SQLITE_TRANSIENT); + break; + case 5: + sqlite3_result_text(ctx, + cs_version.c_str(), + cs_version.length(), + SQLITE_TRANSIENT); + break; + case 6: + sqlite3_result_text(ctx, + sc_status.c_str(), + sc_status.length(), + SQLITE_TRANSIENT); + break; + case 7: + sqlite3_result_int64(ctx, sc_bytes); + break; + case 8: + sqlite3_result_text(ctx, + cs_referer.c_str(), + cs_referer.length(), + SQLITE_TRANSIENT); + break; + case 9: + sqlite3_result_text(ctx, + cs_user_agent.c_str(), + cs_user_agent.length(), + SQLITE_TRANSIENT); + break; + } + }; + +private: + pcrecpp::RE alt_regex; +}; + +class strace_log_table : public log_vtab_impl { +public: + + strace_log_table() + : log_vtab_impl("strace_log"), + slt_regex("[0-9:.]* ([a-zA-Z_][a-zA-Z_0-9]*)\\(" + "(.*)\\)" + "\\s+= ([-xa-fA-F\\d\\?]+).*(?:<(\\d+\\.\\d+)>)?") { + }; + + void get_columns(vector &cols) { + cols.push_back(vtab_column("funcname", "text")); + cols.push_back(vtab_column("result", "text")); + cols.push_back(vtab_column("duration", "text")); + cols.push_back(vtab_column("arg0", "text")); + cols.push_back(vtab_column("arg1", "text")); + cols.push_back(vtab_column("arg2", "text")); + cols.push_back(vtab_column("arg3", "text")); + cols.push_back(vtab_column("arg4", "text")); + cols.push_back(vtab_column("arg5", "text")); + cols.push_back(vtab_column("arg6", "text")); + cols.push_back(vtab_column("arg7", "text")); + cols.push_back(vtab_column("arg8", "text")); + cols.push_back(vtab_column("arg9", "text")); + }; + + void extract(const std::string &line, + int column, + sqlite_api::sqlite3_context *ctx) { + using namespace sqlite_api; + string function, args, result, duration = "0"; + + if (!this->slt_regex.FullMatch(line, + &function, + &args, + &result, + &duration)) { + fprintf(stderr, "bad match! %s\n", line.c_str()); + } + switch (column) { + case 0: + sqlite3_result_text(ctx, + function.c_str(), + function.length(), + SQLITE_TRANSIENT); + break; + case 1: + sqlite3_result_text(ctx, + result.c_str(), + result.length(), + SQLITE_TRANSIENT); + break; + case 2: + sqlite3_result_text(ctx, + duration.c_str(), + duration.length(), + SQLITE_TRANSIENT); + break; + default: + { + const char *arg_start = args.c_str(); + int in_struct = 0, in_list = 0; + int lpc, argnum, curarg = 0; + bool in_quote = false; + + argnum = column - 3; + for (lpc = 0; lpc < args.length(); lpc++) { + switch (args[lpc]) { + case '{': + if (!in_quote) + in_struct += 1; + break; + case '"': + if (!in_quote) + in_quote = true; + else if (lpc > 0 && args[lpc - 1] != '\\') + in_quote = false; + break; + case ',': + if (!in_quote) { + if (curarg == argnum) { + sqlite3_result_text(ctx, + arg_start, + &(args.c_str()[lpc]) - + arg_start, + SQLITE_TRANSIENT); + return; + } + + curarg += 1; + arg_start = &(args.c_str()[lpc + 1]); + } + break; + } + } + if (curarg == argnum) { + sqlite3_result_text(ctx, + arg_start, + &(args.c_str()[lpc]) - + arg_start, + SQLITE_TRANSIENT); + } + else { + sqlite3_result_text(ctx, + "", + 0, + SQLITE_TRANSIENT); + } + } + break; + } + }; + +private: + pcrecpp::RE slt_regex; +}; + +int main(int argc, char *argv[]) +{ + int lpc, c, retval = EXIT_SUCCESS; + auto_ptr stdin_reader; + session sql(sqlite3, ":memory:"); + + lnav_data.ld_program_name = argv[0]; + + lnav_data.ld_sql = &sql; + lnav_data.ld_vtab_manager = + new log_vtab_manager(sql, lnav_data.ld_log_source); + + lnav_data.ld_vtab_manager->register_vtab(new log_vtab_impl("syslog_log")); + lnav_data.ld_vtab_manager->register_vtab(new log_vtab_impl("generic_log")); + lnav_data.ld_vtab_manager->register_vtab(new access_log_table()); + lnav_data.ld_vtab_manager->register_vtab(new strace_log_table()); + + DEFAULT_FILES.insert(make_pair(LNF_SYSLOG, string("var/log/messages"))); + + lnav_commands["unix-time"] = com_unix_time; + lnav_commands["current-time"] = com_current_time; + lnav_commands["goto"] = com_goto; + lnav_commands["graph"] = com_graph; + lnav_commands["highlight"] = com_highlight; + lnav_commands["filter-in"] = com_filter; + lnav_commands["filter-out"] = com_filter; + lnav_commands["append-to"] = com_save_to; + lnav_commands["write-to"] = com_save_to; + lnav_commands["enable-filter"] = com_enable_filter; + lnav_commands["disable-filter"] = com_disable_filter; + lnav_commands["capture-into"] = com_capture; + + lnav_data.ld_views[LNV_HELP]. + set_sub_source(new plain_text_source(help_text_start)); + lnav_data.ld_views[LNV_LOG]. + set_sub_source(&lnav_data.ld_log_source); + lnav_data.ld_views[LNV_HISTOGRAM]. + set_sub_source(&lnav_data.ld_hist_source); + lnav_data.ld_views[LNV_GRAPH]. + set_sub_source(&lnav_data.ld_graph_source); + lnav_data.ld_views[LNV_DB]. + set_sub_source(&lnav_data.ld_db_source); + + { + textview_curses::highlight_map_t &hm = + lnav_data.ld_views[LNV_LOG].get_highlights(); + + hm["(sql"] = textview_curses:: + highlighter(xpcre_compile("(?: alter | select | insert | update " + "| create " + "| from | where | order by " + "| group by )", PCRE_CASELESS)); + hm["(java"] = textview_curses:: + highlighter(xpcre_compile("(?:\\w+\\.java:\\d+)")); + hm["(xml"] = textview_curses:: + highlighter(xpcre_compile("<(/?[^ >]+)[^>]*>")); + hm["(stringd"] = textview_curses:: + highlighter(xpcre_compile("\".*(?(new piper_proc(STDIN_FILENO)); + lnav_data.ld_file_names.insert(make_pair("stdin", + stdin_reader->get_fd())); + if (dup2(STDOUT_FILENO, STDIN_FILENO) == -1) { + perror("cannot dup stdout to stdin"); + } + } + + if (lnav_data.ld_file_names.empty()) { + fprintf(stderr, "error: no log files given/found.\n"); + retval = EXIT_FAILURE; + } + + if (retval != EXIT_SUCCESS) { + usage(); + } + else { + try { + set< pair >::iterator iter; + + for (iter = lnav_data.ld_file_names.begin(); + iter != lnav_data.ld_file_names.end(); + iter++) { + logfile *lf = new logfile(iter->first, iter->second); + + lnav_data.ld_log_source.insert_file(lf); + } + + lnav_data.ld_db_file = "/tmp/lnav-db.XXXXXX"; + looper(); + } + catch (line_buffer::error & e) { + fprintf(stderr, "error: %s\n", strerror(e.e_err)); + } + catch (logfile::error & e) { + if (e.e_err != EINTR) { + fprintf(stderr, + "error: %s -- '%s'\n", + strerror(e.e_err), + e.e_filename.c_str()); + } + } + } + + return retval; +} diff --git a/src/lnav_util.hh b/src/lnav_util.hh new file mode 100644 index 00000000..08c681a7 --- /dev/null +++ b/src/lnav_util.hh @@ -0,0 +1,55 @@ +/** + * @file lnav_util.hh + * + * Dumping ground for useful functions with no other home. + */ + +#ifndef __lnav_util_hh +#define __lnav_util_hh + +#include + +/** + * Round down a number based on a given granularity. + * + * @param + * @param step The granularity. + */ +inline int rounddown(size_t size, int step) +{ + return (size - (size % step)); +} + +inline int rounddown_offset(size_t size, int step, int offset) +{ + return (size - ((size - offset) % step)); +} + +inline int roundup(size_t size, int step) +{ + int retval = size + step; + + retval -= (retval % step); + + return retval; +} + +inline time_t day_num(time_t ti) +{ + return ti / (24 * 60 * 60); +} + +inline time_t hour_num(time_t ti) +{ + return ti / (60 * 60); +} + +#if SIZEOF_OFF_T == 8 +#define FORMAT_OFF_T "%qd" +#elif SIZEOF_OFF_T == 4 +#define FORMAT_OFF_T "%ld" +#else +#error "off_t has unhandled size..." +#endif + +#endif diff --git a/src/log_format.cc b/src/log_format.cc new file mode 100644 index 00000000..e587255a --- /dev/null +++ b/src/log_format.cc @@ -0,0 +1,201 @@ + +#include "tables.h" +#include "log_format.hh" + +using namespace std; + +/* + * Supported formats: + * generic + * syslog + * apache + * tcpdump + * strace + * vstrace + * csv (?) + * file system (?) + * plugins + * vmstat + * iostat + */ + +static time_t BAD_DATE = -1; + +static time_t tm2sec(const struct tm *t) +{ + int year; + time_t days; + const int dayoffset[12] = + { 306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275 }; + + year = t->tm_year; + + if (year < 70 || ((sizeof(time_t) <= 4) && (year >= 138))) { + return BAD_DATE; + } + + /* shift new year to 1st March in order to make leap year calc easy */ + + if (t->tm_mon < 2) { + year--; + } + + /* Find number of days since 1st March 1900 (in the Gregorian calendar). */ + + days = year * 365 + year / 4 - year / 100 + (year / 100 + 3) / 4; + days += dayoffset[t->tm_mon] + t->tm_mday - 1; + days -= 25508; /* 1 jan 1970 is 25508 days since 1 mar 1900 */ + + days = ((days * 24 + t->tm_hour) * 60 + t->tm_min) * 60 + t->tm_sec; + + if (days < 0) { + return BAD_DATE; + } /* must have overflowed */ + else { + return days; + } /* must be a valid time */ +} + +const char *logline::level_names[LEVEL__MAX] = { + "unknown", + "trace", + "debug", + "info", + "warning", + "error", + "critical" +}; + +logline::level_t logline::string2level(const char *levelstr) +{ + logline::level_t retval = logline::LEVEL_UNKNOWN; + + if (strcasestr(levelstr, "TRACE")) { + retval = logline::LEVEL_TRACE; + } + else if (strcasestr(levelstr, "VERBOSE")) { + retval = logline::LEVEL_DEBUG; + } + else if (strcasestr(levelstr, "DEBUG")) { + retval = logline::LEVEL_DEBUG; + } + else if (strcasestr(levelstr, "INFO")) { + retval = logline::LEVEL_INFO; + } + else if (strcasestr(levelstr, "WARNING")) { + retval = logline::LEVEL_WARNING; + } + else if (strcasestr(levelstr, "ERROR")) { + retval = logline::LEVEL_ERROR; + } + else if (strcasestr(levelstr, "CRITICAL")) { + retval = logline::LEVEL_CRITICAL; + } + + return retval; +} + +vector log_format::lf_root_formats; + +vector &log_format::get_root_formats(void) +{ + return lf_root_formats; +} + +static bool next_format(const char *fmt[], int &index, int &locked_index) +{ + bool retval = true; + + if (locked_index == -1) { + index += 1; + if (fmt[index] == NULL) + retval = false; + } + else if (index == locked_index) { + retval = false; + } + else { + index = locked_index; + } + + return retval; +} + +int log_format::log_scanf(const char *line, + const char *fmt[], + int expected_matches, + const char *time_fmt[], + char *time_dest, + struct tm *tm_out, + time_t &time_out, + ...) +{ + static const char *std_time_fmt[] = { + "%Y-%m-%d %H:%M:%S", + "%Y-%m-%d %H:%M", + "%Y/%m/%d %H:%M:%S", + "%Y/%m/%d %H:%M", + + "%d/%b/%Y:%H:%M:%S %z", + + "%b %d %H:%M:%S", + + NULL, + }; + + int curr_fmt = -1, retval = 0; + va_list args; + + va_start(args, time_out); + + while (next_format(fmt, curr_fmt, this->lf_fmt_lock)) { + time_dest[0] = '\0'; + memset(tm_out, 0, sizeof(struct tm)); + + retval = vsscanf(line, fmt[curr_fmt], args); + if (retval < expected_matches) { + retval = 0; + continue; + } + + if (time_dest[0] == '\0') { + retval = 0; + } + else { + int curr_time_fmt = -1; + bool found = false; + + if (!time_fmt) + time_fmt = std_time_fmt; + + while (next_format(time_fmt, + curr_time_fmt, + this->lf_time_fmt_lock)) { + if (strptime(time_dest, + time_fmt[curr_time_fmt], + tm_out) != NULL) { + if (tm_out->tm_year < 70) { + tm_out->tm_year = 1970; + } + time_out = tm2sec(tm_out); + + this->lf_fmt_lock = curr_fmt; + this->lf_time_fmt_lock = curr_time_fmt; + + found = true; + break; + } + } + + if (!found) + retval = 0; + } + } + + va_end(args); + + return retval; +} + +// XXX +#include "log_format_impls.cc" diff --git a/src/log_format.hh b/src/log_format.hh new file mode 100644 index 00000000..a8412e5b --- /dev/null +++ b/src/log_format.hh @@ -0,0 +1,151 @@ + +#ifndef __log_format_hh +#define __log_format_hh + +#include +#include +#include + +#include +#include + +/** + * Metadata for a single line in a log file. + */ +class logline { +public: + + /** + * The logging level identifiers for a line(s). + */ + typedef enum { + LEVEL_UNKNOWN, + LEVEL_TRACE, + LEVEL_DEBUG, + LEVEL_INFO, + LEVEL_WARNING, + LEVEL_ERROR, + LEVEL_CRITICAL, + + LEVEL__MAX, + + LEVEL_MULTILINE = 0x40, /*< Start of a multiline entry. (Unused) */ + LEVEL_CONTINUED = 0x80, /*< Continuation of multiline entry. */ + + /** Mask of flags for the level field. */ + LEVEL__FLAGS = (LEVEL_MULTILINE | LEVEL_CONTINUED) + } level_t; + + static const char *level_names[LEVEL__MAX]; + + static level_t string2level(const char *levelstr); + + /** + * Construct a logline object with the given values. + * + * @param off The offset of the line in the file. + * @param t The timestamp for the line. + * @param millis The millisecond timestamp for the line. + * @param l The logging level. + */ + logline(off_t off, + time_t t, + uint16_t millis, + level_t l, + uint8_t m = 0) + : ll_offset(off), + ll_time(t), + ll_millis(millis), + ll_level(l), + ll_module(m) { }; + + /** @return The offset of the line in the file. */ + off_t get_offset() const { return this->ll_offset; }; + + /** @return The timestamp for the line. */ + time_t get_time() const { return this->ll_time; }; + + void set_time(time_t t) { this->ll_time = t; }; + + /** @return The millisecond timestamp for the line. */ + uint16_t get_millis() const { return this->ll_millis; }; + + void set_multiline(void) { this->ll_level |= LEVEL_MULTILINE; }; + + /** @param l The logging level. */ + void set_level(level_t l) { this->ll_level = l; }; + + /** @return The logging level. */ + level_t get_level() const { return (level_t)(this->ll_level & 0xff); }; + + const char *get_level_name() const { + return level_names[this->ll_level & 0x0f]; + }; + + uint8_t get_module() const { return this->ll_module; }; + + /** + * Compare loglines based on their timestamp. + */ + bool operator<(const logline &rhs) const + { + return this->ll_time < rhs.ll_time || + (this->ll_time == rhs.ll_time && + this->ll_millis < rhs.ll_millis); + }; + + bool operator<(const time_t &rhs) { return this->ll_time < rhs; }; + +private: + off_t ll_offset; + time_t ll_time; + uint16_t ll_millis; + uint8_t ll_level; + uint8_t ll_module; +}; + +class log_format { +public: + static std::vector &get_root_formats(void); + + template class register_root_format { + public: + register_root_format() { + log_format::lf_root_formats.push_back(new T()); + }; + }; + + log_format() : lf_fmt_lock(-1), lf_time_fmt_lock(-1) { }; + virtual ~log_format() { }; + + virtual void clear(void) { + this->lf_fmt_lock = -1; + this->lf_time_fmt_lock = -1; + }; + + virtual std::string get_name(void) = 0; + + virtual bool scan(std::vector< logline > &dst, + off_t offset, + char *prefix, + int len) = 0; + + virtual std::auto_ptr specialized(void) = 0; + +protected: + static std::vector lf_root_formats; + + int log_scanf(const char *line, + const char *fmt[], + int expected_matches, + const char *time_fmt[], + char *time_dest, + struct tm *tm_out, + time_t &time_out, + ...); + + int lf_fmt_lock; + int lf_time_fmt_lock; +}; + +#endif diff --git a/src/log_format_impls.cc b/src/log_format_impls.cc new file mode 100644 index 00000000..21e4d631 --- /dev/null +++ b/src/log_format_impls.cc @@ -0,0 +1,285 @@ + +#include + +#include "tables.h" +#include "log_format.hh" +#include "log_vtab_impl.hh" + +using namespace std; +using namespace soci; + +class access_log_format : public log_format { + string get_name() { return "access_log"; }; + + bool scan(vector < logline > &dst, + off_t offset, + char *prefix, + int len) { + static const char *log_fmt[] = { + "%*s %*s %*s [%63[^]]] \"%*[^\"]\" %d", + NULL + }; + + bool retval = false; + struct tm log_time; + int http_code = 0; + char timestr[64]; + time_t line_time; + + if (this->log_scanf(prefix, + log_fmt, + 2, + NULL, + timestr, + &log_time, + line_time, + + timestr, + &http_code)) { + logline::level_t ll = logline::LEVEL_UNKNOWN; + + if (http_code < 400) { + ll = logline::LEVEL_INFO; + } + else { + ll = logline::LEVEL_ERROR; + } + dst.push_back(logline(offset, + line_time, + 0, + ll)); + retval = true; + } + + return retval; + }; + + auto_ptr specialized() { + auto_ptr retval((log_format *)new access_log_format(*this)); + + return retval; + }; +}; + +log_format::register_root_format access_log_instance; + +class syslog_log_format : public log_format { + string get_name() { return "syslog_log"; }; + + bool scan(vector < logline > &dst, + off_t offset, + char *prefix, + int len) { + bool retval = false; + struct tm log_time; + short millis = 0; + time_t now; + char *rest; + + now = time(NULL); + log_time = *localtime(&now); + + log_time.tm_isdst = 0; + + if ((rest = strptime(prefix, + "%b %d %H:%M:%S", + &log_time)) != NULL) { + logline::level_t ll = logline::LEVEL_UNKNOWN; + time_t log_gmt; + + if (strcasestr(prefix, "failed") != NULL || + strcasestr(prefix, "failure") != NULL || + strcasestr(prefix, "error") != NULL) { + ll = logline::LEVEL_ERROR; + } + else if (strcasestr(prefix, "warn") != NULL || + strcasestr(prefix, "not responding") != NULL || + strcasestr(prefix, "init: cannot execute") != NULL) { + ll = logline::LEVEL_WARNING; + } + log_gmt = tm2sec(&log_time); + if (!dst.empty() && + ((dst.back().get_time() - log_gmt) > (24 * 60 * 60))) { + vector::iterator iter; + + for (iter = dst.begin(); iter != dst.end(); iter++) { + time_t ot = iter->get_time(); + struct tm *otm; + + otm = gmtime(&ot); + otm->tm_year -= 1; + iter->set_time(tm2sec(otm)); + } + } + dst.push_back(logline(offset, log_gmt, millis, ll)); + + retval = true; + } + + return retval; + }; + + auto_ptr specialized() { + auto_ptr retval((log_format *)new syslog_log_format(*this)); + + return retval; + }; +}; + +log_format::register_root_format syslog_instance; + +class tcsh_history_format : public log_format { + string get_name() { return "tcsh_history"; }; + + bool scan(vector < logline > &dst, + off_t offset, + char *prefix, + int len) { + bool retval = false; + time_t log_time; + + if (sscanf(prefix, "#+%d", &log_time) == 1) { + struct tm log_tm; + + memset(&log_tm, 0, sizeof(log_tm)); + log_tm = *localtime( &log_time); + + log_tm.tm_isdst = 0; + dst.push_back(logline(offset, + mktime(&log_tm) - timezone, + 0, + logline::LEVEL_UNKNOWN)); + + retval = true; + } + + return retval; + }; + + auto_ptr specialized() { + auto_ptr retval((log_format *) + new tcsh_history_format(*this)); + + return retval; + }; +}; + +log_format::register_root_format tcsh_instance; + +class generic_log_format : public log_format { + string get_name() { return "generic_log"; }; + + bool scan(vector < logline > &dst, + off_t offset, + char *prefix, + int len) { + static const char *log_fmt[] = { + "%63[0-9: ,-] %15s", + "[%63[0-9: -]] %15s", + "[%63[0-9: .-] %*s %15s", + "[%63[0-9: -]] (%*d) %15s", + NULL + }; + + bool retval = false; + struct tm log_time; + char timestr[64]; + time_t line_time; + char level[16]; + + if (this->log_scanf(prefix, + log_fmt, + 2, + NULL, + timestr, + &log_time, + line_time, + + timestr, + level)) { + dst.push_back(logline(offset, + line_time, + 0, + logline::string2level(level))); + retval = true; + } + + return retval; + }; + + auto_ptr specialized() { + auto_ptr retval((log_format *) + new generic_log_format(*this)); + + return retval; + }; +}; + +log_format::register_root_format generic_log_instance; + +class strace_log_format : public log_format { + string get_name() { return "strace_log"; }; + + bool scan(vector < logline > &dst, + off_t offset, + char *prefix, + int len) { + static const char *log_fmt[] = { + "%63[0-9:].%d", + NULL + }; + + static const char *time_fmt[] = { + "%H:%M:%S", + NULL + }; + + bool retval = false; + struct tm log_time; + char timestr[64]; + time_t line_time; + int usecs; + + if (this->log_scanf(prefix, + log_fmt, + 2, + time_fmt, + timestr, + &log_time, + line_time, + + timestr, + &usecs)) { + logline::level_t level = logline::LEVEL_UNKNOWN; + const char *eq; + + if ((eq = strrchr(prefix, '=')) != NULL) { + int rc; + + if (sscanf(eq, "= %d", &rc) == 1 && rc < 0) { + level = logline::LEVEL_ERROR; + } + } + + if (!dst.empty() && (line_time < dst.back().get_time())) { + line_time += (24 * 60 * 60); + } + dst.push_back(logline(offset, + line_time, + usecs / 1000, + level)); + retval = true; + } + + return retval; + }; + + auto_ptr specialized() { + auto_ptr retval((log_format *) + new strace_log_format(*this)); + + return retval; + }; +}; + +log_format::register_root_format strace_log_instance; diff --git a/src/log_vtab_impl.cc b/src/log_vtab_impl.cc new file mode 100644 index 00000000..b1f261ae --- /dev/null +++ b/src/log_vtab_impl.cc @@ -0,0 +1,307 @@ + +#include "config.h" + +#include "log_vtab_impl.hh" + +#include "logfile_sub_source.hh" + +using namespace std; +using namespace soci; +using namespace sqlite_api; + +static string declare_table_statement(log_vtab_impl *vi) +{ + std::vector cols; + std::vector::const_iterator iter; + std::ostringstream oss; + + oss << "CREATE TABLE unused (\n" + << " line_number int,\n" + << " path text,\n" + << " log_time datetime,\n" + << " level text,\n" + << " raw_line text"; + vi->get_columns(cols); + for (iter = cols.begin(); iter != cols.end(); iter++) { + oss << ",\n"; + oss << " " << iter->vc_name << " " << iter->vc_type; + } + oss << "\n);"; + + return oss.str(); +} + +struct vtab { + sqlite3_vtab base; + sqlite_api::sqlite3 *db; + logfile_sub_source *lss; + log_vtab_impl *vi; +}; + +struct vtab_cursor { + sqlite3_vtab_cursor base; + vis_line_t curr_line; +}; + +static int vt_destructor(sqlite3_vtab *p_svt); + +static int vt_create( sqlite_api::sqlite3 *db, + void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **pp_vt, + char **pzErr ) +{ + log_vtab_manager *vm = (log_vtab_manager *)pAux; + int rc = SQLITE_OK; + log_vtab_impl *vi; + vtab* p_vt; + + /* Allocate the sqlite3_vtab/vtab structure itself */ + p_vt = (vtab*)sqlite3_malloc(sizeof(*p_vt)); + + if(p_vt == NULL) + { + return SQLITE_NOMEM; + } + + p_vt->db = db; + + /* Declare the vtable's structure */ + p_vt->vi = vm->lookup_impl(argv[3]); + p_vt->lss = vm->get_source(); + rc = sqlite3_declare_vtab(db, declare_table_statement(p_vt->vi).c_str()); + + /* Success. Set *pp_vt and return */ + *pp_vt = &p_vt->base; + + return SQLITE_OK; +} + +static int vt_destructor(sqlite3_vtab *p_svt) +{ + vtab *p_vt = (vtab*)p_svt; + + /* Free the SQLite structure */ + sqlite3_free(p_vt); + + return SQLITE_OK; +} + +static int vt_connect( sqlite_api::sqlite3 *db, void *p_aux, + int argc, const char *const*argv, + sqlite3_vtab **pp_vt, char **pzErr ) +{ + return vt_create(db, p_aux, argc, argv, pp_vt, pzErr); +} + +static int vt_disconnect(sqlite3_vtab *pVtab) +{ + return vt_destructor(pVtab); +} + +static int vt_destroy(sqlite3_vtab *p_vt) +{ + return vt_destructor(p_vt); +} + +static int vt_next(sqlite3_vtab_cursor *cur); + +static int vt_open(sqlite3_vtab *p_svt, sqlite3_vtab_cursor **pp_cursor) +{ + vtab* p_vt = (vtab*)p_svt; + p_vt->base.zErrMsg = NULL; + + vtab_cursor *p_cur = + (vtab_cursor*)sqlite3_malloc(sizeof(vtab_cursor)); + + *pp_cursor = (sqlite3_vtab_cursor*)p_cur; + + p_cur->base.pVtab = p_svt; + p_cur->curr_line = vis_line_t(-1); + vt_next((sqlite3_vtab_cursor *)p_cur); + + return (p_cur ? SQLITE_OK : SQLITE_NOMEM); +} + +static int vt_close(sqlite3_vtab_cursor *cur) +{ + vtab_cursor *p_cur = (vtab_cursor*)cur; + + /* Free cursor struct. */ + sqlite3_free(p_cur); + + return SQLITE_OK; +} + +static int vt_eof(sqlite3_vtab_cursor *cur) +{ + vtab_cursor *vc = (vtab_cursor *)cur; + vtab *vt = (vtab *)cur->pVtab; + + return vc->curr_line == vt->lss->text_line_count(); +} + +static int vt_next(sqlite3_vtab_cursor *cur) +{ + vtab_cursor *vc = (vtab_cursor *)cur; + vtab *vt = (vtab *)cur->pVtab; + const string &format_name = vt->vi->get_name(); + bool done = false; + + do { + vc->curr_line = vc->curr_line + vis_line_t(1); + + if (vc->curr_line == vt->lss->text_line_count()) + break; + + content_line_t cl(vt->lss->at(vc->curr_line)); + logfile *lf = vt->lss->find(cl); + + log_format *format = lf->get_format(); + if (format != NULL && format->get_name() == format_name) { + done = true; + } + } + while (!done); + + return SQLITE_OK; +} + +static int vt_column(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int col) +{ + vtab_cursor *vc = (vtab_cursor *)cur; + vtab *vt = (vtab *)cur->pVtab; + + content_line_t cl(vt->lss->at(vc->curr_line)); + logfile *lf = vt->lss->find(cl); + logfile::iterator ll = lf->begin() + cl; + + /* Just return the ordinal of the column requested. */ + switch(col) + { + case 0: + { + sqlite3_result_int64( ctx, vc->curr_line ); + } + break; + case 1: + { + string &fn = lf->get_filename(); + + sqlite3_result_text( ctx, + fn.c_str(), + fn.length(), + SQLITE_STATIC ); + } + break; + case 2: + { + time_t line_time; + char buffer[64]; + + line_time = ll->get_time(); + strftime(buffer, sizeof(buffer), + "%F %T", + gmtime(&line_time)); + sqlite3_result_text(ctx, buffer, strlen(buffer), SQLITE_TRANSIENT); + } + break; + case 3: + { + const char *level_name = ll->get_level_name(); + + sqlite3_result_text(ctx, + level_name, + strlen(level_name), + SQLITE_STATIC); + } + break; + case 4: + { + string line; + + lf->read_line(ll, line); + sqlite3_result_text(ctx, + line.c_str(), + line.length(), + SQLITE_TRANSIENT); + } + break; + default: + { + logfile::iterator line_iter; + string line, value; + + line_iter = lf->begin() + cl; + lf->read_line(line_iter, line); + vt->vi->extract(line, col - 5, ctx); + } + break; + } + + return SQLITE_OK; +} + +static int vt_rowid(sqlite3_vtab_cursor *cur, sqlite_int64 *p_rowid) +{ + vtab_cursor *p_cur = (vtab_cursor*)cur; + + *p_rowid = p_cur->curr_line; + + return SQLITE_OK; +} + +static int vt_filter( sqlite3_vtab_cursor *p_vtc, + int idxNum, const char *idxStr, + int argc, sqlite3_value **argv ) +{ + return SQLITE_OK; +} + +static int vt_best_index(sqlite3_vtab *tab, sqlite3_index_info *p_info) +{ + return SQLITE_OK; +} + +static sqlite_api::sqlite3_module vtab_module = { + 0, /* iVersion */ + vt_create, /* xCreate - create a vtable */ + vt_connect, /* xConnect - associate a vtable with a connection */ + vt_best_index, /* xBestIndex - best index */ + vt_disconnect, /* xDisconnect - disassociate a vtable with a connection */ + vt_destroy, /* xDestroy - destroy a vtable */ + vt_open, /* xOpen - open a cursor */ + vt_close, /* xClose - close a cursor */ + vt_filter, /* xFilter - configure scan constraints */ + vt_next, /* xNext - advance a cursor */ + vt_eof, /* xEof - inidicate end of result set*/ + vt_column, /* xColumn - read data */ + vt_rowid, /* xRowid - read data */ + NULL, /* xUpdate - write data */ + NULL, /* xBegin - begin transaction */ + NULL, /* xSync - sync transaction */ + NULL, /* xCommit - commit transaction */ + NULL, /* xRollback - rollback transaction */ + NULL, /* xFindFunction - function overloading */ +}; + +log_vtab_manager::log_vtab_manager(soci::session &sql, logfile_sub_source &lss) + : vm_sql(sql), vm_source(lss) +{ + sqlite3_session_backend *be = (sqlite3_session_backend *)sql.get_backend(); + sqlite_api::sqlite3 *db = be->conn_; + + sqlite3_create_module(db, "log_vtab_impl", &vtab_module, this); +} + +void log_vtab_manager::register_vtab(log_vtab_impl *vi) { + if (this->vm_impls.find(vi->get_name()) == this->vm_impls.end()) { + this->vm_impls[vi->get_name()] = vi; + + vm_sql << "CREATE VIRTUAL TABLE " + << vi->get_name() + << " USING log_vtab_impl(" + << vi->get_name() + << ")"; + } +} diff --git a/src/log_vtab_impl.hh b/src/log_vtab_impl.hh new file mode 100644 index 00000000..366925a3 --- /dev/null +++ b/src/log_vtab_impl.hh @@ -0,0 +1,60 @@ + +#ifndef __vtab_impl_hh +#define __vtab_impl_hh + +#include + +#include +#include + +#include +#include + +class logfile_sub_source; + +class log_vtab_impl { +public: + struct vtab_column { + vtab_column(const char *name, const char *type) + : vc_name(name), vc_type(type) { }; + + const char *vc_name; + const char *vc_type; + }; + + log_vtab_impl(const std::string name) : vi_name(name) { }; + virtual ~log_vtab_impl() { }; + + const std::string &get_name(void) const { + return this->vi_name; + }; + + virtual void get_columns(std::vector &cols) { }; + + virtual void extract(const std::string &line, + int column, + sqlite_api::sqlite3_context *ctx) { + }; + +private: + const std::string vi_name; +}; + +class log_vtab_manager { +public: + log_vtab_manager(soci::session &sql, logfile_sub_source &lss); + + logfile_sub_source *get_source() { return &this->vm_source; }; + + void register_vtab(log_vtab_impl *vi); + log_vtab_impl *lookup_impl(std::string name) { + return this->vm_impls[name]; + }; + +private: + soci::session &vm_sql; + logfile_sub_source &vm_source; + std::map vm_impls; +}; + +#endif diff --git a/src/logfile.cc b/src/logfile.cc new file mode 100644 index 00000000..53a6ef28 --- /dev/null +++ b/src/logfile.cc @@ -0,0 +1,207 @@ +/** + * @file logfile.cc + */ + +#include "config.h" + +#include +#define __USE_GNU +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "logfile.hh" + +using namespace std; + +logfile::logfile(string filename, auto_fd fd) +throw (error) + : lf_filename(filename), + lf_index_time(0), + lf_index_size(0) +{ + int reserve_size = 100; + + assert(filename.size() > 0); + + if (fd == -1) { + char resolved_path[PATH_MAX]; + struct stat st; + + errno = 0; + if (realpath(filename.c_str(), resolved_path) == NULL) { + throw error(resolved_path, errno); + } + filename = resolved_path; + + if (stat(filename.c_str(), &st) == -1) { + throw error(filename, errno); + } + reserve_size = st.st_size / 100; + + if (!S_ISREG(st.st_mode)) { + throw error(filename, EINVAL); + } + + if ((fd = open(filename.c_str(), O_RDONLY)) == -1) { + throw error(filename, errno); + } + } + + this->lf_line_buffer.set_fd(fd); + this->lf_index.reserve(reserve_size); + + assert(this->invariant()); +} + +logfile::~logfile() +{ } + +void logfile::process_prefix(off_t offset, char *prefix, int len) +{ + bool found = false; + int lpc; + + if (this->lf_format.get() != NULL) { + /* We've locked onto a format, just use that scanner. */ + found = this->lf_format->scan(this->lf_index, offset, prefix, len); + } + else { + vector &root_formats = log_format::get_root_formats(); + vector::iterator iter; + + /* + * Try each scanner until we get a match. Fortunately, all the formats + * are sufficiently different that there are no ambiguities... + */ + for (iter = root_formats.begin(); + iter != root_formats.end() && !found; + iter++) { + (*iter)->clear(); + if ((*iter)->scan(this->lf_index, offset, prefix, len)) { +#if 0 + assert(this->lf_index.size() == 1 || + (this->lf_index[this->lf_index.size() - 2] < + this->lf_index[this->lf_index.size() - 1])); +#endif + + this->lf_format = + auto_ptr((*iter)->specialized()); + found = true; + } + } + } + + /* If the scanner didn't match, than we need to add it. */ + if (!found) { + logline::level_t last_level = logline::LEVEL_UNKNOWN; + time_t last_time = this->lf_index_time; + short last_millis = 0; + + if (!this->lf_index.empty()) { + logline &ll = this->lf_index.back(); + + /* + * Assume this line is part of the previous one(s) and copy the + * metadata over. + */ + ll.set_multiline(); + last_time = ll.get_time(); + last_millis = ll.get_millis(); + if (this->lf_format.get() != NULL) { + last_level = (logline::level_t) + (ll.get_level() | logline::LEVEL_CONTINUED); + } + } + this->lf_index.push_back(logline(offset, + last_time, + last_millis, + last_level)); + } +} + +bool logfile::rebuild_index(logfile_observer *lo) +throw (line_buffer::error) +{ + bool retval = false; + struct stat st; + + if (fstat(this->lf_line_buffer.get_fd(), &st) == -1) { + throw error(this->lf_filename, errno); + } + + /* Check for new data based on the file size. */ + if (this->lf_index_size < st.st_size) { + off_t last_off, off; + char *line; + size_t len; + + this->lf_line_buffer.set_file_size((size_t)-1); + if (this->lf_index.size() > 0) { + off = this->lf_index.back().get_offset(); + + /* + * Drop the last line we read since it might have been a partial + * read. + */ + this->lf_index.pop_back(); + } + else { + off = 0; + } + last_off = off; + while ((line = this->lf_line_buffer.read_line(off, len)) != NULL) { + line[len] = '\0'; + this->process_prefix(last_off, line, len); + last_off = off; + + if (lo != NULL) { + lo->logfile_indexing(*this, off, st.st_size); + } + } + + this->lf_line_buffer.invalidate(); + + /* + * The file can still grow between the above fstat and when we're + * doing the scanning, so use the line buffer's notion of the file + * size. + */ + this->lf_index_size = this->lf_line_buffer.get_file_size(); + + retval = true; + } + + this->lf_index_time = st.st_mtime; + + return retval; +} + +void logfile::read_line(logfile::iterator ll, string &line_out) +{ + try { + off_t off = ll->get_offset(); + const char *line; + size_t len; + + line_out.clear(); + if ((line = this->lf_line_buffer.read_line(off, len)) != NULL) { + line_out.append(line, len); + } + else { + /* XXX */ + } + } + catch (line_buffer::error & e) { + /* ... */ + } +} diff --git a/src/logfile.hh b/src/logfile.hh new file mode 100644 index 00000000..d8783f86 --- /dev/null +++ b/src/logfile.hh @@ -0,0 +1,173 @@ +/** + * @file logfile.hh + */ + +#ifndef __logfile_hh +#define __logfile_hh + +#include +#include +#include + +#include +#include +#include + +#include "line_buffer.hh" +#include "log_format.hh" + +class logfile; + +/** + * Observer interface for logfile indexing progress. + * + * @see logfile + */ +class logfile_observer { +public: + virtual ~logfile_observer() { }; + + /** + * @param lf The logfile object that is doing the indexing. + * @param off The current offset in the file being processed. + * @param total The total size of the file. + */ + virtual void logfile_indexing(logfile &lf, off_t off, size_t total) = 0; +}; + +/** + * Container for the lines in a log file and some metadata. + */ +class logfile { +public: + + class error { +public: + error(std::string filename, int err) + : e_filename(filename), + e_err(err) { }; + + std::string e_filename; + int e_err; + }; + + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; + + /** + * Construct a logfile with the given arguments. + * + * @param filename The name of the log file. + * @param fd The file descriptor for accessing the file or -1 if the + * constructor should open the file specified by 'filename'. The + * descriptor needs to be seekable. + */ + logfile(std::string filename, auto_fd fd = -1) throw (error); + + virtual ~logfile(); + + /** @return The filename as given in the constructor. */ + std::string &get_filename() { return this->lf_filename; }; + + /** + * @return The detected format, rebuild_index() must be called before this + * will return a value other than FORMAT_UNKNOWN. + */ + log_format *get_format() { return this->lf_format.get(); }; + + /** + * @return The last modified time of the file when the file was last + * indexed. + */ + time_t get_modified_time() { return this->lf_index_time; }; + + iterator begin() { return this->lf_index.begin(); } + + const_iterator begin() const { return this->lf_index.begin(); } + + iterator end() { return this->lf_index.end(); } + + const_iterator end() const { return this->lf_index.end(); } + + /** @return The number of lines in the index. */ + size_t size() { return this->lf_index.size(); } + + logline &operator[](int index) { return this->lf_index[index]; }; + + /** + * Read a line from the file. + * + * @param ll The line to read. + * @param line_out Storage to hold the line itself. + */ + void read_line(iterator ll, std::string &line_out); + + /** + * Read a line from the file. + * + * @param ll The line to read. + * @return The contents of the line as a string. + */ + std::string read_line(iterator ll) + { + std::string retval; + + this->read_line(ll, retval); + + return retval; + }; + + /** + * Index any new data in the log file. + * + * @param lo The observer object that will be called regularly during + * indexing. + * @return True if any new lines were indexed. + */ + bool rebuild_index(logfile_observer *lo = NULL) throw (line_buffer::error); + + bool operator<(const logfile &rhs) const + { + bool retval; + + if (this->lf_index.size() == 0) { + retval = true; + } + else if (rhs.lf_index.size() == 0) { + retval = false; + } + else { + retval = this->lf_index[0].get_time() < rhs.lf_index[0].get_time(); + } + + return retval; + }; + + /** Check the invariants for this object. */ + bool invariant(void) + { + assert(this->lf_filename.size() > 0); + + return true; + }; + +protected: + + /** + * Process a line from the file. + * + * @param offset The offset of the line in the file. + * @param prefix The contents of the line. + * @param len The length of the 'prefix' string. + */ + void process_prefix(off_t offset, char *prefix, int len); + + std::string lf_filename; + std::auto_ptr lf_format; + std::vector lf_index; + time_t lf_index_time; + size_t lf_index_size; + line_buffer lf_line_buffer; +}; + +#endif diff --git a/src/logfile_hist.hh b/src/logfile_hist.hh new file mode 100644 index 00000000..e641ee71 --- /dev/null +++ b/src/logfile_hist.hh @@ -0,0 +1,18 @@ + +#ifndef __logfile_hist_hh +#define __logfile_hist_hh + +#include + +class logfile_hist { + +public: + logfile_hist(); + virtual ~logfile_hist(); + +private: + + +}; + +#endif diff --git a/src/logfile_stats.hh b/src/logfile_stats.hh new file mode 100644 index 00000000..3a482a48 --- /dev/null +++ b/src/logfile_stats.hh @@ -0,0 +1,16 @@ + +#ifndef __logfile_stats_hh +#define __logfile_stats_hh + +class logfile_stats { + +public: + logfile_stats(); + virtual ~logfile_stats(); + +private: + + +}; + +#endif diff --git a/src/logfile_sub_source.cc b/src/logfile_sub_source.cc new file mode 100644 index 00000000..4fb6380a --- /dev/null +++ b/src/logfile_sub_source.cc @@ -0,0 +1,518 @@ + +#include "config.h" + +#include + +#include "lnav_util.hh" +#include "logfile_sub_source.hh" + + +using namespace std; + +#if 0 +// XXX +class logfile_scrub_map { +public: + + static logfile_scrub_map &singleton() + { + static logfile_scrub_map s_lsm; + + return s_lsm; + }; + + const pcre *include(logfile::format_t format) const + { + map::const_iterator iter; + pcre *retval = NULL; + + if ((iter = this->lsm_include.find(format)) != this->lsm_include.end()) { + retval = iter->second; + } + + return retval; + }; + + const pcre *exclude(logfile::format_t format) const + { + map::const_iterator iter; + pcre *retval = NULL; + + if ((iter = this->lsm_exclude.find(format)) != this->lsm_exclude.end()) { + retval = iter->second; + } + + return retval; + }; + +private: + + pcre *build_pcre(const char *pattern) + { + const char *errptr; + pcre *retval; + int eoff; + + retval = pcre_compile(pattern, PCRE_CASELESS, &errptr, &eoff, NULL); + if (retval == NULL) { + throw errptr; + } + + return retval; + }; + + logfile_scrub_map() + { + this->lsm_include[logfile::FORMAT_JBOSS] = this-> + build_pcre("\\d+-(\\d+-\\d+ \\d+:\\d+:\\d+),\\d+ [^ ]+( .*)"); + this->lsm_exclude[logfile::FORMAT_JBOSS] = this-> + build_pcre("(?:" + "\\[((?:[0-9a-zA-Z]+\\.)+)\\w+" + "|\\[[\\w: ]+ ((?:[0-9a-zA-Z]+\\.)+)\\w+[^ \\]]+" + "| ((?:[0-9a-zA-Z]+\\.)+)\\w+\\])"); + + this->lsm_include[logfile::FORMAT_SYSLOG] = this-> + build_pcre("(\\w+\\s[\\s\\d]\\d \\d+:\\d+:\\d+) \\w+( .*)"); + }; + + map lsm_include; + map lsm_exclude; +}; +#endif + +bookmark_type_t logfile_sub_source::BM_ERRORS; +bookmark_type_t logfile_sub_source::BM_WARNINGS; +bookmark_type_t logfile_sub_source::BM_FILES; + +logfile_sub_source::logfile_sub_source() + : lss_flags(0), + lss_filtered_count(0) +{ +} + +logfile_sub_source::~logfile_sub_source() +{ } + +logfile *logfile_sub_source::find(const char *fn, + content_line_t &line_base) +{ + std:: vector::iterator iter; + logfile *retval = NULL; + + line_base = content_line_t(0); + for (iter = this->lss_files.begin(); + iter != this->lss_files.end() && retval == NULL; + iter++) { + if (strcmp(iter->ld_file->get_filename().c_str(), fn) == 0) { + retval = iter->ld_file; + } + else { + line_base += content_line_t(iter->ld_file->size()); + } + } + + return retval; +} + +vis_line_t logfile_sub_source::find_from_time(time_t start) +{ + vector::iterator lb; + vis_line_t retval(-1); + + lb = lower_bound(this->lss_index.begin(), + this->lss_index.end(), + start, + logline_cmp(*this)); + if (lb != this->lss_index.end()) { + retval = vis_line_t(lb - this->lss_index.begin()); + } + + return retval; +} + +void logfile_sub_source::text_value_for_line(textview_curses &tc, + int row, + string &value_out, + bool raw) +{ + content_line_t line(0); + + size_t tab; + + line = this->lss_index[row]; + this->lss_token_file = this->find(line); + this->lss_token_line = this->lss_token_file->begin() + line; + this->lss_token_offset = 0; + this->lss_scrub_len = 0; + + if (raw) { + this->lss_token_file->read_line(this->lss_token_line, value_out); + return; + } + + this->lss_token_value = + this->lss_token_file->read_line(this->lss_token_line); + + while ((tab = this->lss_token_value.find('\t')) != string::npos) { + this->lss_token_value = this->lss_token_value.replace(tab, 1, 8, ' '); + } + + this->lss_token_date_end = 0; +#if 0 + if (!(this->lss_flags & F_NO_SCRUB)) { + log_format *format = this->lss_token_file->get_format(); + const pcre *scrubber = NULL; + int matches[60]; + int lpc, rc; + + // scrubber = logfile_scrub_map::singleton().include(format); + if (scrubber != NULL) { + memset(matches, 0, sizeof(matches)); + rc = pcre_exec(logfile_scrub_map:: + singleton().include(format), + NULL, + this->lss_token_value.c_str(), + this->lss_token_value.size(), + 0, + 0, + matches, + 60); + matches[1] = 0; + for (lpc = rc - 1; lpc >= 1; lpc--) { + int c_end = matches[lpc * 2]; + int c_start = matches[lpc * 2 - 1]; + + this->lss_token_value. + erase(this->lss_token_value.begin() + c_start, + this->lss_token_value.begin() + c_end); + } + + if (rc > 1) { + this->lss_token_date_end = 15; + } /* XXX */ + } + + scrubber = logfile_scrub_map::singleton().exclude(format); + if (scrubber != NULL) { + do { + rc = pcre_exec(logfile_scrub_map::singleton(). + exclude(format), + NULL, + this->lss_token_value.c_str(), + this->lss_token_value.size(), + 0, + 0, + matches, + 60); + for (lpc = rc - 1; lpc >= 1; lpc--) { + int c_start = matches[lpc * 2]; + int c_end = matches[lpc * 2 + 1]; + + if (c_start != -1 && c_end != -1) { + this->lss_token_value. + erase(this->lss_token_value.begin() + c_start, + this->lss_token_value.begin() + c_end); + } + } + } while (rc > 0); + } + } +#endif + + value_out = this->lss_token_value; +} + +void logfile_sub_source::text_attrs_for_line(textview_curses &lv, + int row, + string_attrs_t &value_out) +{ + view_colors &vc = view_colors::singleton(); + logline *next_line = NULL; + struct line_range lr; + int attrs = 0; + + switch (this->lss_token_line->get_level() & ~logline::LEVEL__FLAGS) { + case logline::LEVEL_CRITICAL: + case logline::LEVEL_ERROR: + attrs = vc.attrs_for_role(view_colors::VCR_ERROR); + break; + + case logline::LEVEL_WARNING: + attrs = vc.attrs_for_role(view_colors::VCR_WARNING); + break; + + default: + attrs = vc.attrs_for_role(view_colors::VCR_TEXT); + break; + } + + if ((row + 1) < (int)this->lss_index.size()) { + next_line = this->find_line(this->lss_index[row + 1]); + } + + if (next_line != NULL && + (day_num(next_line->get_time()) > + day_num(this->lss_token_line->get_time()))) { + attrs |= A_UNDERLINE; + } + + lr.lr_start = this->lss_token_date_end; + lr.lr_end = -1; + + value_out[lr].insert(make_string_attr("style", attrs)); + + lr.lr_start = 0; + lr.lr_end = -1; + value_out[lr].insert(make_string_attr("file", this->lss_token_file)); + + if (this->lss_token_date_end > 0 && + ((this->lss_token_line->get_time() / (60 * 60)) % 2) == 0) { + attrs = vc.attrs_for_role(view_colors::VCR_ALT_ROW); + lr.lr_start = 0; + lr.lr_end = this->lss_token_date_end; + + value_out[lr].insert(make_string_attr("style", attrs)); + } +} + +bool logfile_sub_source::rebuild_index(observer *obs, bool force) +{ + std::vector::iterator iter; + bool retval = force; + + for (iter = this->lss_files.begin(); + iter != this->lss_files.end(); + iter++) { + if (iter->ld_file->rebuild_index(obs)) { + retval = true; + } + if (force) { + iter->ld_lines_indexed = 0; + } + } + + if (retval || force) { + int file_index = 0; + string line_value; + + line_value.reserve(4 * 1024); + if (force) { + this->lss_index.clear(); + this->lss_filtered_count = 0; + } + + for (iter = this->lss_files.begin(); + iter != this->lss_files.end(); + iter++, file_index++) { + if (iter->ld_lines_indexed < iter->ld_file->size()) { + content_line_t con_line(file_index *MAX_LINES_PER_FILE + + iter->ld_lines_indexed); + + logfile_filter::type_t action = logfile_filter::INCLUDE; + content_line_t start_line(con_line + 1); + + logfile::iterator lf_iter; + int action_priority = -1; + + this->lss_index.reserve(this->lss_index.size() + + iter->ld_file->size() - + iter->ld_lines_indexed); + for (lf_iter = iter->ld_file->begin() + iter->ld_lines_indexed; + lf_iter != iter->ld_file->end(); + lf_iter++) { + int lpc; + + if (obs != NULL) { + obs->logfile_sub_source_filtering( + *this, + content_line_t(con_line % MAX_LINES_PER_FILE), + iter->ld_file->size()); + } + + if (!(lf_iter->get_level() & logline::LEVEL_CONTINUED)) { + if (action == logfile_filter::INCLUDE || + action == logfile_filter::MAYBE) { + while (start_line < con_line) { + this->lss_index.push_back(start_line); + ++start_line; + } + } + start_line = con_line; + action = logfile_filter::MAYBE; + action_priority = -1; + } + + for (lpc = 0; lpc < this->lss_filters.size(); lpc++) { + logfile_filter *filter = this->lss_filters[lpc]; + + if (filter->is_enabled()) { + bool matched; + + if (line_value.empty()) { + iter->ld_file->read_line(lf_iter, line_value); + } + matched = filter->matches(line_value); + + switch (filter->get_type()) { + case logfile_filter::INCLUDE: + if (lpc >= action_priority) { + if (matched) { + action = logfile_filter::INCLUDE; + } + else if (action == logfile_filter::MAYBE) { + action = logfile_filter::EXCLUDE; + } + action_priority = lpc; + } + break; + + case logfile_filter::EXCLUDE: + if (lpc >= action_priority) { + if (matched) { + action = logfile_filter::EXCLUDE; + } + action_priority = lpc; + } + break; + } + } + } + line_value.clear(); + + ++con_line; + } + + if (action == logfile_filter::INCLUDE || + action == logfile_filter::MAYBE) { + while (start_line < con_line) { + this->lss_index.push_back(start_line); + ++start_line; + } + } + + iter->ld_lines_indexed = iter->ld_file->size(); + + assert(iter->ld_lines_indexed < MAX_LINES_PER_FILE); + } + } + + stable_sort(this->lss_index.begin(), + this->lss_index.end(), + logline_cmp(*this)); + } + + return retval; +} + +void logfile_sub_source::text_update_marks(bookmarks &bm) +{ + logfile *last_file = NULL; + vis_line_t vl; + + bm[&BM_WARNINGS].clear(); + bm[&BM_ERRORS].clear(); + bm[&BM_FILES].clear(); + bm[&textview_curses::BM_USER].clear(); + + for (; vl < this->lss_index.size(); ++vl) { + content_line_t cl = this->lss_index[vl]; + logfile *lf; + + if (binary_search(this->lss_user_marks.begin(), + this->lss_user_marks.end(), + cl)) { + bm[&textview_curses::BM_USER].insert_once(vl); + } + + lf = this->find(cl); + + if (lf != last_file) { + bm[&BM_FILES].insert_once(vl); + } + + switch ((*lf)[cl].get_level() & ~logline::LEVEL_MULTILINE) { + case logline::LEVEL_WARNING: + bm[&BM_WARNINGS].insert_once(vl); + break; + + case logline::LEVEL_ERROR: + case logline::LEVEL_CRITICAL: + bm[&BM_ERRORS].insert_once(vl); + break; + + default: + break; + } + + last_file = lf; + } +} + +#if 0 +void logfile_sub_source::handle_scroll(listview_curses *lc) +{ + printf("hello, world!\n"); + return; + + vis_line_t top = lc->get_top(); + + if (this->lss_index.empty()) { + this->lss_top_time = -1; + this->lss_bottom_time = -1; + } + else { + time_t top_day, bottom_day, today, yesterday, now = time(NULL); + vis_line_t bottom(0), height(0); + + unsigned long width; + char status[32]; + logline *ll; + + today = day_num(now); + yesterday = today - 1; + + lc->get_dimensions(height, width); + + ll = this->find_line(this->lss_index[top]); + this->lss_top_time = ll->get_time(); + + bottom = min(top + height - vis_line_t(1), + vis_line_t(this->lss_index.size() - 1)); + + ll = this->find_line(this->lss_index[bottom]); + this->lss_bottom_time = ll->get_time(); + + top_day = day_num(this->lss_top_time); + bottom_day = day_num(this->lss_bottom_time); + if (top_day == today) { + snprintf(status, sizeof(status), "Today"); + } + else if (top_day == yesterday) { + snprintf(status, sizeof(status), "Yesterday"); + } + else { + strftime(status, sizeof(status), + "%a %b %d", + gmtime(&this->lss_top_time)); + } + if (top_day != bottom_day) { + int len = strlen(status); + + if (bottom_day == today) { + snprintf(&status[len], sizeof(status) - len, " - Today"); + } + else if (bottom_day == yesterday) { + snprintf(&status[len], sizeof(status) - len, " - Yesterday"); + } + else { + strftime(&status[len], sizeof(status) - len, + " - %b %d", + gmtime(&this->lss_bottom_time)); + } + } + + this->lss_date_field.set_value(string(status)); + } +} + +#endif diff --git a/src/logfile_sub_source.hh b/src/logfile_sub_source.hh new file mode 100644 index 00000000..034faa58 --- /dev/null +++ b/src/logfile_sub_source.hh @@ -0,0 +1,225 @@ +#ifndef __logfile_controller_hh +#define __logfile_controller_hh + +#include +#include +#include +#include +#include + +#include "strong_int.hh" +#include "logfile.hh" +#include "bookmarks.hh" +#include "textview_curses.hh" + +STRONG_INT_TYPE(int, content_line); + +class logfile_filter { +public: + typedef enum { + MAYBE, + INCLUDE, + EXCLUDE + } type_t; + + logfile_filter(type_t type, std::string id) + : lf_enabled(true), + lf_type(type), + lf_id(id) { }; + virtual ~logfile_filter() { }; + + type_t get_type(void) const { return this->lf_type; }; + std::string get_id(void) const { return this->lf_id; }; + + bool is_enabled(void) { return this->lf_enabled; }; + void enable(void) { this->lf_enabled = true; }; + void disable(void) { this->lf_enabled = false; }; + + virtual bool matches(std::string line) = 0; + +protected: + bool lf_enabled; + type_t lf_type; + std::string lf_id; +}; + +class logfile_sub_source + : public text_sub_source { +public: + + typedef std::vector filter_stack_t; + + class observer + : public logfile_observer { +public: + virtual void logfile_sub_source_filtering(logfile_sub_source &lss, + content_line_t cl, + size_t total) = 0; + }; + + static bookmark_type_t BM_ERRORS; + static bookmark_type_t BM_WARNINGS; + static bookmark_type_t BM_FILES; + + logfile_sub_source(); + virtual ~logfile_sub_source(); + + filter_stack_t &get_filters(void) + { + return this->lss_filters; + }; + + logfile_filter *get_filter(std::string id) + { + filter_stack_t::iterator iter; + logfile_filter *retval = NULL; + + for (iter = this->lss_filters.begin(); + iter != this->lss_filters.end() && (*iter)->get_id() != id; + iter++) { } + if (iter != this->lss_filters.end()) { + retval = *iter; + } + + return retval; + }; + + void toggle_scrub(void) { this->lss_flags ^= F_NO_SCRUB; }; + size_t text_line_count() + { + return this->lss_index.size(); + }; + void text_value_for_line(textview_curses &tc, + int row, + std::string &value_out, + bool raw); + + void text_attrs_for_line(textview_curses &tc, + int row, + string_attrs_t &value_out); + + void text_user_mark(int line, bool added) + { + content_line_t cl = this->lss_index[line]; + std::vector::iterator lb; + + lb = std::lower_bound(this->lss_user_marks.begin(), + this->lss_user_marks.end(), + cl); + if (added) { + this->lss_user_marks.insert(lb, cl); + } + else { + assert(lb != this->lss_user_marks.end()); + + this->lss_user_marks.erase(lb); + } + }; + + void insert_file(logfile *lf) + { + assert(lf->size() < MAX_LINES_PER_FILE); + + this->lss_files.push_back(logfile_data(lf)); + this->lss_index.clear(); + }; + bool rebuild_index(observer *obs = NULL, bool force = false); + + void text_update_marks(bookmarks &bm); + + int get_filtered_count() const { return this->lss_filtered_count; }; + + logfile *find(const char *fn, content_line_t &line_base); + + logfile *find(content_line_t &line) + { + logfile *retval; + + retval = this->lss_files[line / MAX_LINES_PER_FILE].ld_file; + line = content_line_t(line % MAX_LINES_PER_FILE); + + return retval; + }; + + logline *find_line(content_line_t line) + { + logline *retval = NULL; + logfile *lf = this->find(line); + + if (lf != NULL) { + logfile::iterator ll_iter = lf->begin() + line; + + retval = &(*ll_iter); + } + + return retval; + }; + + vis_line_t find_from_time(time_t start); + + content_line_t at(vis_line_t vl) { return this->lss_index[vl]; }; + +private: + static const int MAX_LINES_PER_FILE = 16 * 1024 * 1024; + + enum { + B_NO_SCRUB, + }; + + enum { + F_NO_SCRUB = (1L << B_NO_SCRUB), + }; + + struct logline_cmp { + logline_cmp(logfile_sub_source & lc) + : llss_controller(lc) { }; + bool operator()(const content_line_t &lhs, const content_line_t &rhs) + { + logline *ll_lhs = this->llss_controller.find_line(lhs); + logline *ll_rhs = this->llss_controller.find_line(rhs); + + return (*ll_lhs) < (*ll_rhs); + }; + bool operator()(const content_line_t &lhs, const time_t &rhs) + { + logline *ll_lhs = this->llss_controller.find_line(lhs); + + return ll_lhs->get_time() < rhs; + }; + + logfile_sub_source & llss_controller; + }; + + struct logfile_data { + logfile_data(logfile *lf = NULL) + : ld_file(lf), + ld_lines_indexed(0) { }; + + bool operator<(const logfile_data &rhs) + { + return (*this->ld_file) < (*rhs.ld_file); + }; + + logfile *ld_file; + size_t ld_lines_indexed; + }; + + unsigned long lss_flags; + std::vector lss_files; + + filter_stack_t lss_filters; + int lss_filtered_count; + + std::vector lss_index; + + std::vector lss_user_marks; + + logfile *lss_token_file; + std::string lss_token_value; + int lss_scrub_len; + int lss_token_offset; + int lss_token_date_end; + logfile::iterator lss_token_line; +}; + +#endif diff --git a/src/pcrepp.hh b/src/pcrepp.hh new file mode 100644 index 00000000..d1258718 --- /dev/null +++ b/src/pcrepp.hh @@ -0,0 +1,151 @@ + +#ifndef __pcrepp_hh +#define __pcrepp_hh + +#ifdef HAVE_PCRE_H +#include +#elif HAVE_PCRE_PCRE_H +#include +#else +#error "pcre.h not found?" +#endif + +#include +#include +#include + +#include "auto_mem.hh" + +class pcre_context { +public: + typedef struct { + int m_begin; + int m_end; + + int length() { return this->m_end - this->m_begin; }; + } match_t; + typedef match_t *iterator; + + + void set_count(int count) { + this->pc_count = count; + } + + match_t *all() { return pc_matches; }; + + iterator begin() { return pc_matches + 1; }; + iterator end() { return pc_matches + pc_count; }; + +protected: + pcre_context(match_t *matches) : pc_matches(matches) { }; + + match_t *pc_matches; + int pc_count; +}; + +template +class pcre_context_static : public pcre_context { +public: + pcre_context_static() + : pcre_context(this->pc_match_buffer) { }; + +private: + match_t pc_match_buffer[MAX_COUNT * 3 + 1]; +}; + +class pcre_input { +public: + pcre_input(const char *str, size_t off = 0, size_t len = -1) + : pi_string(str), pi_offset(off), pi_length(len), pi_next_offset(off) { + if (this->pi_length == -1) + this->pi_length = strlen(str); + }; + + pcre_input(std::string &str, size_t off = 0) + : pi_string(str.c_str()), pi_offset(off), pi_length(str.length()), + pi_next_offset(off) { + }; + + const char *get_string() const { return this->pi_string; }; + + const char *get_substr(pcre_context::iterator iter) const { + return &this->pi_string[iter->m_begin]; + }; + + size_t pi_offset; + size_t pi_next_offset; + size_t pi_length; +private: + const char *pi_string; +}; + +class pcrepp { +public: + class error : public std::exception { + public: + error(std::string msg, int offset) : + e_msg(msg), e_offset(offset) { }; + virtual ~error() throw () { }; + + virtual const char* what() const throw() { + return this->e_msg.c_str(); + }; + + const std::string e_msg; + int e_offset; + }; + + pcrepp(pcre *code) : p_code(code) { + const char *errptr; + + this->p_code_extra = pcre_study(this->p_code, 0, &errptr); + }; + + pcrepp(const char *pattern, int options = 0) { + const char *errptr; + int eoff; + + if ((this->p_code = pcre_compile(pattern, + options, + &errptr, + &eoff, + NULL)) == NULL) { + throw error(errptr, eoff); + } + + this->p_code_extra = pcre_study(this->p_code, 0, &errptr); + }; + + virtual ~pcrepp() { }; + + bool match(pcre_context &pc, pcre_input &pi, int options = 0) { + int count = 30; + int rc; + + pi.pi_offset = pi.pi_next_offset; + rc = pcre_exec(this->p_code, + this->p_code_extra, + pi.get_string(), + pi.pi_length, + pi.pi_offset, + options, + (int *)pc.all(), + count); + + if (rc <= 0) { } + else if (pc.all()->m_begin == pc.all()->m_end) + rc = 0; + else + pi.pi_next_offset = pc.all()->m_end; + + pc.set_count(rc); + + return rc > 0; + }; + +private: + pcre *p_code; + auto_mem p_code_extra; +}; + +#endif diff --git a/src/piper_proc.cc b/src/piper_proc.cc new file mode 100644 index 00000000..22f08b1a --- /dev/null +++ b/src/piper_proc.cc @@ -0,0 +1,65 @@ + +#include +#include +#include +#include +#include +#include + +#include "piper_proc.hh" + +using namespace std; + +piper_proc::piper_proc(int pipefd) + : pp_fd(-1), pp_child(-1) +{ + char piper_tmpname[PATH_MAX]; + const char *tmpdir; + + if ((tmpdir = getenv("TMPDIR")) == NULL) { + tmpdir = _PATH_VARTMP; + } + snprintf(piper_tmpname, sizeof(piper_tmpname), + "%s/lnav.piper.XXXXXX", + tmpdir); + if ((this->pp_fd = mkstemp(piper_tmpname)) == -1) { + throw error(errno); + } + + unlink(piper_tmpname); + this->pp_child = fork(); + switch (this->pp_child) { + case -1: + throw error(errno); + case 0: + { + char buffer[4096]; + off_t off = 0; + int rc; + + while ((rc = read(pipefd, buffer, sizeof(buffer))) > 0) { + int wrc = pwrite(this->pp_fd, buffer, rc, off); + + off += wrc; + } + } + exit(0); + break; + default: + break; + } +} + +piper_proc::~piper_proc() +{ + if (this->pp_child > 0) { + int status; + + kill(this->pp_child, SIGTERM); + while (waitpid(this->pp_child, &status, 0) < 0 && (errno == EINTR)) { + ; + } + + this->pp_child = -1; + } +} diff --git a/src/piper_proc.hh b/src/piper_proc.hh new file mode 100644 index 00000000..0c835c4a --- /dev/null +++ b/src/piper_proc.hh @@ -0,0 +1,30 @@ + +#ifndef __piper_proc_hh +#define __piper_proc_hh + +#include +#include + +class piper_proc { +public: + class error + : public std::exception { +public: + error(int err) + : e_err(err) { }; + + int e_err; + }; + + piper_proc(int pipefd); + virtual ~piper_proc(); + + int get_fd() const { return this->pp_fd; }; + +private: + std::string pp_filename; + int pp_fd; + pid_t pp_child; +}; + +#endif diff --git a/src/plugins.hh b/src/plugins.hh new file mode 100644 index 00000000..78f042aa --- /dev/null +++ b/src/plugins.hh @@ -0,0 +1,18 @@ + +#ifndef __plugins_hh +#define __plugins_hh + +#include + +class extension_point { +public: + extension_point(std::string name); + ~extension_point(); + + std::string get_name() { return this->ep_name; }; + +private: + std::string ep_name; +}; + +#endif diff --git a/src/readline_curses.cc b/src/readline_curses.cc new file mode 100644 index 00000000..e48b5630 --- /dev/null +++ b/src/readline_curses.cc @@ -0,0 +1,489 @@ +/** + * @file readline_curses.cc + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_PTY_H +#include +#endif + +#ifdef HAVE_UTIL_H +#include +#endif + +#include + +#include "auto_mem.hh" +#include "readline_curses.hh" + +using namespace std; + +static int got_line = 0; +static sig_atomic_t got_timeout = 0; +static sig_atomic_t got_winch = 0; +static readline_curses *child_this; + +readline_context *readline_context::loaded_context; +set *readline_context::arg_possibilities; + +static void sigalrm(int sig) +{ + got_timeout = 1; +} + +static void sigwinch(int sig) +{ + got_winch = 1; +} + +static void line_ready_tramp(char *line) +{ + child_this->line_ready(line); + add_history(line); + got_line = 1; + rl_callback_handler_remove(); +} + +char *readline_context::completion_generator(const char *text, int state) +{ + static vector matches; + + char *retval = NULL; + + if (state == 0) { + int len = strlen(text); + + matches.clear(); + if (arg_possibilities != NULL) { + set::iterator iter; + + for (iter = arg_possibilities->begin(); + iter != arg_possibilities->end(); + iter++) { + fprintf(stderr, " cmp %s %s\n", text, iter->c_str()); + if (strncmp(text, iter->c_str(), len) == 0) { + matches.push_back(*iter); + } + } + } + } + + if (!matches.empty()) { + retval = strdup(matches.back().c_str()); + matches.pop_back(); + } + + return retval; +} + +char **readline_context::attempted_completion(const char *text, + int start, + int end) +{ + char **retval = NULL; + + if (start == 0) { + arg_possibilities = &loaded_context->rc_possibilities["__command"]; + rl_completion_append_character = ' '; + } + else { + char *space; + string cmd; + + rl_completion_append_character = 0; + space = strchr(rl_line_buffer, ' '); + assert(space != NULL); + cmd = string(rl_line_buffer, 0, space - rl_line_buffer); + fprintf(stderr, "cmd %s\n", cmd.c_str()); + + vector &proto = loaded_context->rc_prototypes[cmd]; + + if (proto.size() == 0) { + arg_possibilities = NULL; + } + else if (proto[0] == "filename") { + return NULL; // XXX + } + else { + fprintf(stderr, "proto %s\n", proto[0].c_str()); + arg_possibilities = &(loaded_context->rc_possibilities[proto[0]]); + fprintf(stderr, "ag %p %d\n", + arg_possibilities, + arg_possibilities->size()); + } + } + + retval = rl_completion_matches(text, completion_generator); + if (retval == NULL) { + rl_attempted_completion_over = 1; + } + + return retval; +} + +readline_curses::readline_curses() + : rc_active_context(-1), + rc_child(-1) +{ + struct winsize ws; + int sp[2]; + + if (socketpair(PF_UNIX, SOCK_DGRAM, 0, sp) < 0) { + throw error(errno); + } + + this->rc_command_pipe[RCF_MASTER] = sp[RCF_MASTER]; + this->rc_command_pipe[RCF_SLAVE] = sp[RCF_SLAVE]; + + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1) { + throw error(errno); + } + + if (openpty(this->rc_pty[RCF_MASTER].out(), + this->rc_pty[RCF_SLAVE].out(), + NULL, + NULL, + &ws) < 0) { + throw error(errno); + } + + if ((this->rc_child = fork()) == -1) { + throw error(errno); + } + + if (this->rc_child == 0) { + char buffer[1024]; + + this->rc_command_pipe[RCF_MASTER].reset(); + this->rc_pty[RCF_MASTER].reset(); + + signal(SIGALRM, sigalrm); + signal(SIGWINCH, sigwinch); + + dup2(this->rc_pty[RCF_SLAVE], STDIN_FILENO); + dup2(this->rc_pty[RCF_SLAVE], STDOUT_FILENO); + + setenv("TERM", "vt52", 1); + + rl_initialize(); + + /* + * XXX Need to keep the input on a single line since the display screws + * up if it wraps around. + */ + strcpy(buffer, "set horizontal-scroll-mode on"); + rl_parse_and_bind(buffer); // NOTE: buffer is modified + + child_this = this; + } + else { + this->rc_command_pipe[RCF_SLAVE].reset(); + this->rc_pty[RCF_SLAVE].reset(); + } +} + +readline_curses::~readline_curses() +{ + if (this->rc_child == 0) { + exit(0); + } + else if (this->rc_child > 0) { + int status; + + kill(this->rc_child, SIGTERM); + this->rc_child = -1; + + while (wait(&status) < 0 && (errno == EINTR)) { + ; + } + } +} + +void readline_curses::start(void) +{ + if (this->rc_child != 0) { + return; + } + + map::iterator current_context; + fd_set rfds; + int maxfd; + + assert(!this->rc_contexts.empty()); + + rl_completer_word_break_characters = (char *)" \t\n"; /* XXX */ + + current_context = this->rc_contexts.end(); + + FD_ZERO(&rfds); + FD_SET(STDIN_FILENO, &rfds); + FD_SET(this->rc_command_pipe[RCF_SLAVE], &rfds); + + maxfd = max(STDIN_FILENO, this->rc_command_pipe[RCF_SLAVE].get()); + + while (1) { + fd_set ready_rfds = rfds; + int rc; + + rc = select(maxfd + 1, &ready_rfds, NULL, NULL, NULL); + if (rc < 0) { + switch (errno) { + case EINTR: + break; + } + } + else { + if (FD_ISSET(STDIN_FILENO, &ready_rfds)) { + struct itimerval itv; + + assert(current_context != this->rc_contexts.end()); + + itv.it_value.tv_sec = 0; + itv.it_value.tv_usec = KEY_TIMEOUT; + itv.it_interval.tv_sec = 0; + itv.it_interval.tv_usec = 0; + setitimer(ITIMER_REAL, &itv, NULL); + + rl_callback_read_char(); + if (RL_ISSTATE(RL_STATE_DONE) && !got_line) { + got_line = 1; + this->line_ready(""); + rl_callback_handler_remove(); + } + /* fprintf(stderr, " is done: %d\n", RL_ISSTATE(RL_STATE_DONE)); */ + } + if (FD_ISSET(this->rc_command_pipe[RCF_SLAVE], &ready_rfds)) { + char msg[1024 + 1]; + + /* fprintf(stderr, "rl cmd\n"); */ + if ((rc = read(this->rc_command_pipe[RCF_SLAVE], + msg, + sizeof(msg) - 1)) < 0) { + fprintf(stderr, "read\n"); + } + else { + int context, prompt_start = 0; + char type[32]; + + msg[rc] = '\0'; + if (sscanf(msg, "f:%d:%n", &context, &prompt_start) == 1 && + prompt_start != 0 && + (current_context = this->rc_contexts.find(context)) != + this->rc_contexts.end()) { + current_context->second->load(); + rl_callback_handler_install(&msg[prompt_start], + line_ready_tramp); + } + else if (sscanf(msg, + "ap:%d:%31[^:]:%n", + &context, + type, + &prompt_start) == 2) { + assert(this->rc_contexts[context] != NULL); + + this->rc_contexts[context]-> + add_possibility(string(type), + string(&msg[prompt_start])); + } + else if (sscanf(msg, + "rp:%d:%31[^:]:%n", + &context, + type, + &prompt_start) == 2) { + assert(this->rc_contexts[context] != NULL); + + this->rc_contexts[context]-> + rem_possibility(string(type), + string(&msg[prompt_start])); + } + else { + fprintf(stderr, "unhandled message: %s\n", msg); + } + } + } + } + + if (got_timeout) { + char msg[1024]; + + fprintf(stderr, "got timeout\n"); + got_timeout = 0; + snprintf(msg, sizeof(msg), "t:%s", rl_line_buffer); + write(this->rc_command_pipe[RCF_SLAVE], msg, strlen(msg)); + } + if (got_line) { + struct itimerval itv; + + got_line = 0; + itv.it_value.tv_sec = 0; + itv.it_value.tv_usec = 0; + itv.it_interval.tv_sec = 0; + itv.it_interval.tv_usec = 0; + if (setitimer(ITIMER_REAL, &itv, NULL) < 0) { + fprintf(stderr, "setitimer"); + } + current_context->second->save(); + current_context = this->rc_contexts.end(); + } + if (got_winch) { + struct winsize ws; + + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1) { + throw error(errno); + } + fprintf(stderr, "rl winched %d %d\n", ws.ws_row, ws.ws_col); + got_winch = 0; + rl_set_screen_size(ws.ws_row, ws.ws_col); + } + } +} + +void readline_curses::line_ready(const char *line) +{ + auto_mem expanded; + char msg[1024]; + int rc; + + rc = history_expand(rl_line_buffer, expanded.out()); + switch (rc) { +#if 0 + // TODO: fix clash between history and pcre metacharacters + case - 1: + /* XXX */ + snprintf(msg, sizeof(msg), + "e:unable to expand history -- %s", + expanded.in()); + break; +#endif + + case -1: + snprintf(msg, sizeof(msg), "d:%s", line); + break; + case 0: + case 1: + case 2: /* XXX */ + snprintf(msg, sizeof(msg), "d:%s", expanded.in()); + break; + } + write(this->rc_command_pipe[RCF_SLAVE], msg, strlen(msg)); +} + +void readline_curses::check_fd_set(fd_set &ready_rfds) +{ + int rc; + + if (FD_ISSET(this->rc_pty[RCF_MASTER], &ready_rfds)) { + char buffer[128]; + + rc = read(this->rc_pty[RCF_MASTER], buffer, sizeof(buffer)); + assert(rc != 0); + assert(rc != -1 && (errno != EINTR || errno != EIO)); + + { + int lpc; + + fprintf(stderr, "from child %d|", rc); + for (lpc = 0; lpc < rc; lpc++) { + fprintf(stderr, " %d", buffer[lpc]); + } + fprintf(stderr, "\n"); + } + + this->map_output(buffer, rc); + } + if (FD_ISSET(this->rc_command_pipe[RCF_MASTER], &ready_rfds)) { + char msg[1024 + 1]; + + rc = read(this->rc_command_pipe[RCF_MASTER], msg, sizeof(msg) - 1); + assert(rc != 0); + if (rc >= 2) { + string old_value = this->rc_value; + + msg[rc] = '\0'; + fprintf(stderr, "child command: %s\n", msg); + this->rc_value = string(&msg[2]); + switch (msg[0]) { + case 't': + if (this->rc_value != old_value) { + this->rc_timeout.invoke(this); + } + break; + + case 'd': + fprintf(stderr, "done!\n"); + this->rc_active_context = -1; + this->vc_past_lines.clear(); + this->rc_perform.invoke(this); + break; + } + } + } +} + +void readline_curses::handle_key(int ch) +{ + const char *bch; + int len; + + bch = this->map_input(ch, len); + write(this->rc_pty[RCF_MASTER], bch, len); + fprintf(stderr, "to child %d\n", bch[0]); + if (ch == '\t' || ch == '\r') { + this->vc_past_lines.clear(); + } +} + +void readline_curses::focus(int context, const char *prompt) +{ + char buffer[1024]; + + this->rc_active_context = context; + + snprintf(buffer, sizeof(buffer), "f:%d:%s", context, prompt); + write(this->rc_command_pipe[RCF_MASTER], buffer, strlen(buffer) + 1); + wmove(this->vc_window, this->get_actual_y(), 0); + wclrtoeol(this->vc_window); +} + +void readline_curses::add_possibility(int context, string type, string value) +{ + char buffer[1024]; + + snprintf(buffer, sizeof(buffer), + "ap:%d:%s:%s", + context, type.c_str(), value.c_str()); + write(this->rc_command_pipe[RCF_MASTER], buffer, strlen(buffer) + 1); +} + +void readline_curses::rem_possibility(int context, string type, string value) +{ + char buffer[1024]; + + snprintf(buffer, sizeof(buffer), + "rp:%d:%s:%s", + context, type.c_str(), value.c_str()); + write(this->rc_command_pipe[RCF_MASTER], buffer, strlen(buffer) + 1); +} + +void readline_curses::do_update(void) +{ + if (this->rc_active_context == -1) { + mvwprintw(this->vc_window, this->get_actual_y(), 0, + "%s", + this->rc_value.c_str()); + wclrtoeol(this->vc_window); + this->set_x(0); + } + vt52_curses::do_update(); +} diff --git a/src/readline_curses.hh b/src/readline_curses.hh new file mode 100644 index 00000000..19c0022f --- /dev/null +++ b/src/readline_curses.hh @@ -0,0 +1,175 @@ +/** + * @file readline_curses.hh + */ + +#ifndef __readline_curses_hh +#define __readline_curses_hh + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "auto_fd.hh" +#include "vt52_curses.hh" + +class readline_context { +public: + typedef std::string (*command_t)(std::string cmdline, + std::vector &args); + typedef std::map command_map_t; + + readline_context(command_map_t *commands = NULL) + { + if (commands != NULL) { + command_map_t::iterator iter; + + for (iter = commands->begin(); iter != commands->end(); iter++) { + std::string cmd = iter->first; + + this->rc_possibilities["__command"].insert(cmd); + iter->second(cmd, this->rc_prototypes[cmd]); + } + } + memset(&this->rc_history, 0, sizeof(this->rc_history)); + }; + + void load(void) + { + loaded_context = this; + rl_attempted_completion_function = attempted_completion; + history_set_history_state(&this->rc_history); + }; + + void save(void) + { + HISTORY_STATE *hs = history_get_history_state(); + + this->rc_history = *hs; + free(hs); + hs = NULL; + }; + + void add_possibility(std::string type, std::string value) + { + this->rc_possibilities[type].insert(value); + fprintf(stderr, "pos %d %p %s %s\n", + this->rc_possibilities[type].size(), + &this->rc_possibilities[type], + type.c_str(), + value.c_str()); + }; + + void rem_possibility(std::string type, std::string value) + { + this->rc_possibilities[type].erase(value); + }; + +private: + static char **attempted_completion(const char *text, int start, int end); + static char *completion_generator(const char *text, int state); + + static readline_context *loaded_context; + static std:: set *arg_possibilities; + + HISTORY_STATE rc_history; + std::map > rc_possibilities; + std::map > rc_prototypes; +}; + +class readline_curses + : public vt52_curses { +public: + typedef view_action action; + + class error + : public std::exception { +public: + error(int err) + : e_err(err) { }; + + int e_err; + }; + + static const int KEY_TIMEOUT = 750 * 1000; + + readline_curses(); + virtual ~readline_curses(); + + void add_context(int id, readline_context &rc) + { + this->rc_contexts[id] = &rc; + }; + + void set_perform_action(action va) { this->rc_perform = va; }; + void set_timeout_action(action va) { this->rc_timeout = va; }; + + void set_value(std::string value) { this->rc_value = value; }; + std::string get_value() { return this->rc_value; }; + + int update_fd_set(fd_set &readfds) + { + FD_SET(this->rc_pty[RCF_MASTER], &readfds); + FD_SET(this->rc_command_pipe[RCF_MASTER], &readfds); + + return std::max(this->rc_pty[RCF_MASTER].get(), + this->rc_command_pipe[RCF_MASTER].get()); + }; + + void handle_key(int ch); + + void check_fd_set(fd_set &ready_rfds); + + void focus(int context, const char *prompt); + + void start(void); + + void do_update(void); + + void window_change(void) + { + struct winsize ws; + + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1) { + throw error(errno); + } + if (ioctl(this->rc_pty[RCF_MASTER], TIOCSWINSZ, &ws) == -1) { + throw error(errno); + } + }; + + void line_ready(const char *line); + + void add_possibility(int context, std::string type, std::string value); + void rem_possibility(int context, std::string type, std::string value); + +private: + enum { + RCF_MASTER, + RCF_SLAVE, + + RCF_MAX_VALUE, + }; + + int rc_active_context; + pid_t rc_child; + auto_fd rc_pty[2]; + auto_fd rc_command_pipe[2]; + std::map rc_contexts; + std::string rc_value; + + action rc_perform; + action rc_timeout; +}; + +#endif diff --git a/src/status_controllers.hh b/src/status_controllers.hh new file mode 100644 index 00000000..a85578ab --- /dev/null +++ b/src/status_controllers.hh @@ -0,0 +1,8 @@ + +#ifndef __status_controllers_hh +#define __status_controllers_hh + +#include "listview_curses.hh" +#include "statusview_curses.hh" + +#endif diff --git a/src/statusview_curses.cc b/src/statusview_curses.cc new file mode 100644 index 00000000..09498476 --- /dev/null +++ b/src/statusview_curses.cc @@ -0,0 +1,48 @@ +#include "config.h" + +#include "statusview_curses.hh" + +using namespace std; + +void statusview_curses::do_update(void) +{ + int top, attrs, field, field_count, left = 1, right; + view_colors &vc = view_colors::singleton(); + unsigned long width, height; + + getmaxyx(this->sc_window, height, width); + top = this->sc_top < 0 ? height + this->sc_top : this->sc_top; + right = width - 2; + attrs = vc.attrs_for_role(view_colors::VCR_STATUS); + + wattron(this->sc_window, attrs); + wmove(this->sc_window, top, 0); + wclrtoeol(this->sc_window); + whline(this->sc_window, ' ', width); + wattroff(this->sc_window, attrs); + + field_count = this->sc_source->statusview_fields(); + for (field = 0; field < field_count; field++) { + status_field &sf = this->sc_source->statusview_value_for_field(field); + struct line_range lr = { 0, sf.get_width() }; + attr_line_t val; + string str; + int x; + + val = sf.get_value(); + if (sf.is_right_justified()) { + right -= 1 + sf.get_width(); + x = right; + } + else { + x = left; + left += sf.get_width() + 1; + } + this->mvwattrline(this->sc_window, + top, x, + val, + lr, + sf.get_role()); + } + wmove(this->sc_window, top + 1, 0); +} diff --git a/src/statusview_curses.hh b/src/statusview_curses.hh new file mode 100644 index 00000000..37a6538d --- /dev/null +++ b/src/statusview_curses.hh @@ -0,0 +1,162 @@ +/** + * @file statusview_curses.hh + */ + +#ifndef __statusview_curses_hh +#define __statusview_curses_hh + +#include + +#include +#include + +#include "view_curses.hh" + +/** + * Container for individual status values. + */ +class status_field { +public: + + /** + * @param width The maximum width of the field in characters. + * @param role The color role for this field, defaults to VCR_STATUS. + */ + status_field(int width = 1, + view_colors::role_t role = view_colors::VCR_STATUS) + : sf_width(width), + sf_right_justify(false), + sf_cylon(false), + sf_cylon_pos(0), + sf_role(role) { }; + + virtual ~status_field() { }; + + /** @param value The new value for this field. */ + void set_value(std::string value) { + if (value.size() > this->get_width()) { + if (value.size() <= 11) { + value.resize(11); + } + else { + static const std::string MIDSUB = " .. "; + + size_t half_width = this->get_width() / 2 - MIDSUB.size() / 2; + std::string abbrev; + + abbrev.append(value, 0, half_width); + abbrev.append(MIDSUB); + abbrev.append(value, + value.size() - half_width, + std::string::npos); + value = abbrev; + } + } + + this->sf_value = value; + + string_attrs_t &sa = this->sf_value.get_attrs(); + sa.clear(); + + if (this->sf_cylon) { + struct line_range lr = { this->sf_cylon_pos, + this->sf_width }; + + sa[lr].insert(make_string_attr("style", COLOR_PAIR(view_colors::VC_WHITE_ON_GREEN) | A_BOLD)); + + this->sf_cylon_pos += 1; + if (this->sf_cylon_pos > this->sf_width) + this->sf_cylon_pos = 0; + } + }; + + /** + * Set the new value for this field using a formatted string. + * + * @param fmt The format string. + * @param ... Arguments for the format. + */ + void set_value(const char *fmt, ...) + { + char buffer[128]; + va_list args; + + va_start(args, fmt); + vsnprintf(buffer, sizeof(buffer), fmt, args); + this->set_value(std::string(buffer)); + va_end(args); + }; + + /** @return The string value for this field. */ + attr_line_t &get_value() { return this->sf_value; }; + + void right_justify(bool yes) { this->sf_right_justify = yes; }; + bool is_right_justified(void) { return this->sf_right_justify; }; + + void set_cylon(bool yes) { this->sf_cylon = yes; }; + bool is_cylon(void) { return this->sf_cylon; }; + + /** @return True if this field's value is an empty string. */ + bool empty() { return this->sf_value.get_string().empty(); }; + + void clear() { this->sf_value.clear(); }; + + /** @param role The color role for this field. */ + void set_role(view_colors::role_t role) { this->sf_role = role; }; + /** @return The color role for this field. */ + view_colors::role_t get_role() { return this->sf_role; }; + + /** @param width The maximum display width, in characters. */ + void set_width(int width) { this->sf_width = width; }; + /** @param width The maximum display width, in characters. */ + int get_width() { return this->sf_width; }; + +protected: + int sf_width; /*< The maximum display width, in chars. */ + bool sf_right_justify; + bool sf_cylon; + int sf_cylon_pos; + attr_line_t sf_value; /*< The value to display for this field. */ + view_colors::role_t sf_role; /*< The color role for this field. */ +}; + +class telltale_field : public status_field { + +public: + +}; + +class status_data_source { +public: + virtual ~status_data_source() { }; + + virtual size_t statusview_fields(void) = 0; + virtual status_field &statusview_value_for_field(int field) = 0; +}; + +class statusview_curses + : public view_curses { +public: + statusview_curses() + : sc_window(NULL), + sc_top(0) { }; + virtual ~statusview_curses() { }; + + void set_data_source(status_data_source *src) { this->sc_source = src; }; + status_data_source *get_data_source() { return this->sc_source; }; + + void set_top(int top) { this->sc_top = top; }; + int get_top() { return this->sc_top; }; + + void set_window(WINDOW *win) { this->sc_window = win; }; + WINDOW *get_window() { return this->sc_window; }; + + void do_update(void); + +private: + status_data_source *sc_source; + WINDOW *sc_window; + int sc_top; +}; + +#endif diff --git a/src/strong_int.hh b/src/strong_int.hh new file mode 100644 index 00000000..e72b167e --- /dev/null +++ b/src/strong_int.hh @@ -0,0 +1,61 @@ +/** + * @file strong_int.hh + */ + +#ifndef __strong_int_hh +#define __strong_int_hh + +/** + * Template class for "strongly-typed" integers, in other words, integers that + * have different semantic meaning and cannot be easily used in place of one + * another. + * + * @param T The integer type. + * @param DISTINCT An class used solely to distinguish templates that have the + * same integer type. + */ +template +class strong_int { +public: + explicit strong_int(T v = 0) : value(v) { }; + operator const T & () const { return this->value; }; + strong_int operator+(const strong_int &rhs) { + return strong_int(this->value + rhs.value); + }; + strong_int operator-(const strong_int &rhs) { + return strong_int(this->value - rhs.value); + }; + strong_int operator/(const strong_int &rhs) { + return strong_int(this->value / rhs.value); + }; + strong_int &operator+=(const strong_int &rhs) { + this->value += rhs.value; + return *this; + }; + strong_int &operator-=(const strong_int &rhs) { + this->value -= rhs.value; + return *this; + }; + strong_int &operator-(void) { + this->value = -this->value; + return *this; + }; + strong_int &operator++(void) { this->value++; return *this; }; + strong_int &operator--(void) { this->value--; return *this; }; + T *out(void) { return &this->value; }; +private: + T value; +}; + +/** + * Macro that declares a strongly-typed integer and the empty class used as a + * distinguisher. + * + * @param T The integer type. + * @param name The name of the strongly-typed integer. + */ +#define STRONG_INT_TYPE(T, name) \ + class __##name##_distinct; \ + typedef strong_int name##_t + +#endif diff --git a/src/tables.h b/src/tables.h new file mode 100644 index 00000000..a5aa8e33 --- /dev/null +++ b/src/tables.h @@ -0,0 +1,63 @@ + +#ifndef __tables_h +#define __tables_h + +#define __table_str( x ) #x +#define __table_section( table, idx ) \ + __section__ ( ".tbl." __table_str ( table ) "." __table_str ( idx ) ) + +#define __table_section_start( table ) __table_section ( table, 00 ) +#define __table_section_end( table ) __table_section ( table, 99 ) + +#define __natural_alignment( type ) __aligned__ ( __alignof__ ( type ) ) + +/** + * Linker table entry. + * + * Declares a data structure to be part of a linker table. Use as + * e.g. + * + * @code + * + * struct my_foo __table ( foo, 01 ) = { + * ... + * }; + * + * @endcode + * + */ +#define __table( type, table, idx ) \ + __attribute__ (( __table_section ( table, idx ), \ + __natural_alignment ( type ) )) + +/** + * Linker table start marker. + * + * Declares a data structure (usually an empty data structure) to be + * the start of a linker table. Use as e.g. + * + * @code + * + * static struct foo_start[0] __table_start ( foo ); + * + * @endcode + * + */ +#define __table_start( type, table ) __table ( type, table, 00 ) + +/** + * Linker table end marker. + * + * Declares a data structure (usually an empty data structure) to be + * the end of a linker table. Use as e.g. + * + * @code + * + * static struct foo_end[0] __table_end ( foo ); + * + * @endcode + * + */ +#define __table_end( type, table ) __table ( type, table, 99 ) + +#endif diff --git a/src/textview_curses.cc b/src/textview_curses.cc new file mode 100644 index 00000000..da14e889 --- /dev/null +++ b/src/textview_curses.cc @@ -0,0 +1,260 @@ +#include "config.h" + +#include + +#include "lnav_util.hh" +#include "textview_curses.hh" + +using namespace std; + +bookmark_type_t textview_curses::BM_USER; +bookmark_type_t textview_curses::BM_SEARCH; + +class ansi_scrubber { + /* XXX move to view_curses.cc ; actually, move to it's own file and call + * from there. + */ +public: + static ansi_scrubber &singleton() + { + static ansi_scrubber s_as; + + return s_as; + } + + void scrub_value(string &str, string_attrs_t &sa) + { + int rc, matches[60]; + + do { + rc = pcre_exec(this->as_pcre, + NULL, + str.c_str(), + str.size(), + 0, + 0, + matches, + 60); + if (rc > 0) { + int c_start = matches[0]; + int c_end = matches[1]; + struct line_range lr; + bool has_attrs = false; + int attrs = 0; + int lpc; + + switch (str[matches[4]]) { + case 'm': + for (lpc = matches[2]; lpc != string::npos && lpc < matches[3];) { + int ansi_code = 0; + + if (sscanf(&(str[lpc]), "%d", &ansi_code) == 1) { + switch (ansi_code) { + case 1: + attrs |= A_BOLD; + break; + case 2: + attrs |= A_DIM; + break; + case 4: + attrs |= A_UNDERLINE; + break; + case 7: + attrs |= A_REVERSE; + break; + case 31: + attrs |= COLOR_PAIR(view_colors::VC_RED); + break; + case 32: + attrs |= COLOR_PAIR(view_colors::VC_GREEN); + break; + case 33: + attrs |= COLOR_PAIR(view_colors::VC_YELLOW); + break; + case 34: + attrs |= COLOR_PAIR(view_colors::VC_BLUE); + break; + case 35: + attrs |= COLOR_PAIR(view_colors::VC_MAGENTA); + break; + case 36: + attrs |= COLOR_PAIR(view_colors::VC_CYAN); + break; + case 37: + attrs |= COLOR_PAIR(view_colors::VC_WHITE); + break; + } + } + lpc = str.find(";", lpc); + if (lpc != string::npos) { + lpc += 1; + } + } + has_attrs = true; + break; + case 'C': + { + int spaces = 0; + + if (sscanf(&(str[matches[2]]), "%d", &spaces) == 1) { + str.insert(c_end, spaces, ' '); + } + } + break; + } + str.erase(str.begin() + c_start, str.begin() + c_end); + + if (has_attrs) { + lr.lr_start = c_start; + lr.lr_end = -1; + sa[lr].insert(make_string_attr("style", attrs)); + } + } + } while (rc > 0); + }; + +private: + pcre *build_pcre(const char *pattern) /* XXX refactor me */ + { + const char *errptr; + pcre *retval; + int eoff; + + retval = pcre_compile(pattern, 0, &errptr, &eoff, NULL); + if (retval == NULL) { + throw errptr; + } + + return retval; + }; + + ansi_scrubber() + { + this->as_pcre = this->build_pcre("\x1b\\[([\\d=;]*)([a-zA-Z])"); + }; + + pcre *as_pcre; +}; + +textview_curses::textview_curses() + : tc_searching(false), + tc_follow_search(false) +{ + this->set_data_source(this); +} + +textview_curses::~textview_curses() +{ } + +void textview_curses::reload_data(void) +{ + if (this->tc_sub_source != NULL) { + this->tc_sub_source->text_update_marks(this->tc_bookmarks); + } + this->listview_curses::reload_data(); +} + +void textview_curses::grep_begin(grep_proc &gp) +{ + this->tc_searching = true; + this->tc_match_count = 0; + this->tc_bookmarks[&BM_SEARCH].clear(); + + this->tc_search_action.invoke(this); + + listview_curses::reload_data(); +} + +void textview_curses::grep_end(grep_proc &gp) +{ + this->tc_searching = false; + this->tc_search_action.invoke(this); +} + +void textview_curses::grep_match(grep_proc &gp, + grep_line_t line, + int start, + int end) +{ + this->tc_match_count += 1; + this->tc_bookmarks[&BM_SEARCH].insert_once(vis_line_t(line)); + + listview_curses::reload_data(); +} + + +void textview_curses::listview_value_for_row(const listview_curses &lv, + vis_line_t row, + attr_line_t &value_out) +{ + bookmark_vector &bv = this->tc_bookmarks[&BM_USER]; + string_attrs_t &sa = value_out.get_attrs(); + string &str = value_out.get_string(); + highlight_map_t::iterator iter; + string::iterator str_iter; + + this->tc_sub_source->text_value_for_line(*this, row, str); + this->tc_sub_source->text_attrs_for_line(*this, row, sa); + + ansi_scrubber::singleton().scrub_value(str, sa); + + for (iter = this->tc_highlights.begin(); + iter != this->tc_highlights.end(); + iter++) { + int off, hcount = 0; + + for (off = 0; off < str.size(); ) { + int rc, matches[30]; + + rc = pcre_exec(iter->second.h_code, + NULL, + str.c_str(), + str.size(), + off, + 0, + matches, + 30); + if (rc > 0) { + struct line_range lr; + + if (rc == 2) { + lr.lr_start = matches[2]; + lr.lr_end = matches[3]; + } + else { + lr.lr_start = matches[0]; + lr.lr_end = matches[1]; + } + + if (lr.lr_end > lr.lr_start) { + sa[lr].insert(make_string_attr("style", iter->second. + get_attrs(hcount))); + hcount++; + + off = matches[1]; + } + else { + off += 1; + } + } + else { + off = str.size(); + } + } + } + + if (binary_search(bv.begin(), bv.end(), row)) { + string_attrs_t::iterator iter; + + for (iter = sa.begin(); iter != sa.end(); iter++) { + attrs_map_t &am = iter->second; + attrs_map_t::iterator am_iter; + + for (am_iter = am.begin(); am_iter != am.end(); am_iter++) { + if (am_iter->first == "style") { + am_iter->second.sa_int ^= A_REVERSE; + } + } + } + } +} diff --git a/src/textview_curses.hh b/src/textview_curses.hh new file mode 100644 index 00000000..305a509e --- /dev/null +++ b/src/textview_curses.hh @@ -0,0 +1,218 @@ +#ifndef __textview_curses_hh +#define __textview_curses_hh + +#include + +#include "grep_proc.hh" +#include "bookmarks.hh" +#include "listview_curses.hh" + +class textview_curses; + +class text_sub_source { +public: + virtual ~text_sub_source() { }; + + virtual void toggle_scrub(void) { }; + + virtual size_t text_line_count() = 0; + + virtual void text_value_for_line(textview_curses &tc, + int line, + std::string &value_out, + bool raw = false) = 0; + + virtual void text_attrs_for_line(textview_curses &tc, + int line, + string_attrs_t &value_out) { + }; + + virtual void text_update_marks(bookmarks &bm) { }; + + virtual void text_user_mark(int line, bool added) { }; +}; + +class textview_curses + : public listview_curses, + public list_data_source, + public grep_proc_source, + public grep_proc_sink { +public: + + typedef view_action action; + + static bookmark_type_t BM_USER; + static bookmark_type_t BM_SEARCH; + + struct highlighter { + highlighter() + : h_code(NULL), + h_multiple(false) { }; + highlighter(pcre *code, + bool multiple = false, + view_colors::role_t role = view_colors::VCR_NONE) + : h_code(code), + h_multiple(multiple) + { + if (!multiple) { + if (role == view_colors::VCR_NONE) { + this->h_roles. + push_back(view_colors::singleton().next_highlight()); + } + else { + this->h_roles.push_back(role); + } + } + }; + + view_colors::role_t get_role(int index) + { + view_colors &vc = view_colors::singleton(); + view_colors::role_t retval; + + if (this->h_multiple) { + while (index >= this->h_roles.size()) { + this->h_roles.push_back(vc.next_highlight()); + } + retval = this->h_roles[index]; + } + else { + retval = this->h_roles[0]; + } + + return retval; + }; + + int get_attrs(int index) + { + return view_colors::singleton(). + attrs_for_role(this->get_role(index)); + }; + + pcre *h_code; + bool h_multiple; + std::vector h_roles; + }; + + textview_curses(); + virtual ~textview_curses(); + + bookmarks &get_bookmarks(void) { return this->tc_bookmarks; }; + + void toggle_user_mark(int start_line, int end_line = -1) + { + if (end_line == -1) + end_line = start_line; + for (int curr_line = start_line; curr_line <= end_line; curr_line++) { + bookmark_vector &bv = this->tc_bookmarks[&BM_USER]; + bookmark_vector::iterator iter; + bool added = false; + + iter = bv.insert_once(vis_line_t(curr_line)); + if (iter == bv.end()) { + added = true; + } + else { + bv.erase(iter); + } + this->tc_sub_source->text_user_mark(curr_line, added); + } + }; + + void set_sub_source(text_sub_source *src) + { + this->tc_sub_source = src; + this->reload_data(); + }; + text_sub_source *get_sub_source(void) { return this->tc_sub_source; }; + + void set_search_action(action sa) { this->tc_search_action = sa; }; + + template + void set_search_action(action::mem_functor_t < _Receiver > *mf) + { + this->tc_search_action = action(mf); + }; + + void grep_end_batch(grep_proc &gp) + { + if (this->tc_follow_search && !this->tc_bookmarks[&BM_SEARCH].empty()) { + vis_line_t first_hit; + + first_hit = this->tc_bookmarks[&BM_SEARCH]. + next(vis_line_t(this->get_top() - 1)); + if (first_hit != -1) { + if (first_hit > 0) { + --first_hit; + } + this->set_top(first_hit); + } + } + this->tc_search_action.invoke(this); + }; + void grep_end(grep_proc &gp); + + size_t listview_rows(const listview_curses &lv) + { + return this->tc_sub_source == NULL ? 0 : + this->tc_sub_source->text_line_count(); + }; + + void listview_value_for_row(const listview_curses &lv, + vis_line_t line, + attr_line_t &value_out); + + bool grep_value_for_line(int line, std::string &value_out) + { + bool retval = false; + + if (line < this->tc_sub_source->text_line_count()) { + this->tc_sub_source->text_value_for_line(*this, + line, + value_out, + true); + retval = true; + } + + return retval; + }; + + void grep_begin(grep_proc &gp); + void grep_match(grep_proc &gp, + grep_line_t line, + int start, + int end); + + bool is_searching(void) { return this->tc_searching; }; + + void set_follow_search(bool fs) { this->tc_follow_search = fs; }; + + size_t get_match_count(void) + { + return this->tc_match_count; + }; + + typedef std::map highlight_map_t; + + highlight_map_t &get_highlights() { return this->tc_highlights; }; + + void reload_data(void); + +protected: + text_sub_source *tc_sub_source; + + bookmarks tc_bookmarks; + + vis_line_t tc_lview_top; + int tc_lview_left; + + int tc_match_count; + bool tc_searching; + bool tc_follow_search; + action tc_search_action; + + highlight_map_t tc_highlights; + highlight_map_t::iterator tc_current_highlight; +}; + +#endif diff --git a/src/time_T.hh b/src/time_T.hh new file mode 100644 index 00000000..5f6c11e2 --- /dev/null +++ b/src/time_T.hh @@ -0,0 +1,22 @@ + +#ifndef __time_t_hh +#define __time_t_hh + +#include +#include +#include + +#define timeit(_block) { \ + struct timeval _st, _en, _diff; \ +\ + gettimeofday(&_st, NULL); \ + { _block; } \ + gettimeofday(&_en, NULL); \ + timersub(&_en, &_st, &_diff); \ + fprintf(stderr, \ + "%s %d.%06d\n", \ + #_block, _diff.tv_sec, _diff.tv_usec); \ + fflush(stderr); \ +} + +#endif diff --git a/src/top_status_source.hh b/src/top_status_source.hh new file mode 100644 index 00000000..0c01cb32 --- /dev/null +++ b/src/top_status_source.hh @@ -0,0 +1,121 @@ + +#ifndef _top_status_source_hh +#define _top_status_source_hh + +#include + +#include "logfile_sub_source.hh" +#include "statusview_curses.hh" + +class top_status_source + : public status_data_source +{ + +public: + + typedef listview_curses::action::mem_functor_t< + top_status_source> lv_functor_t; + typedef textview_curses::action::mem_functor_t< + top_status_source> tv_functor_t; + + typedef enum { + TSF_TIME, + TSF_WARNINGS, + TSF_ERRORS, + TSF_FILENAME, + + TSF__MAX + } field_t; + + top_status_source() + : marks_wire(*this, &top_status_source::update_marks), + filename_wire(*this, &top_status_source::update_filename) { + this->tss_fields[TSF_TIME].set_width(24); + this->tss_fields[TSF_WARNINGS].set_width(10); + this->tss_fields[TSF_ERRORS].set_width(10); + this->tss_fields[TSF_ERRORS].set_role(view_colors::VCR_ALERT_STATUS); + this->tss_fields[TSF_FILENAME].set_width(35); // XXX + this->tss_fields[TSF_FILENAME].right_justify(true); + }; + + lv_functor_t marks_wire; + lv_functor_t filename_wire; + + size_t statusview_fields(void) { return TSF__MAX; }; + + status_field &statusview_value_for_field(int field) { + return this->tss_fields[field]; + }; + + void update_time(void) { + status_field &sf = this->tss_fields[TSF_TIME]; + time_t current_time = time(NULL); + char buffer[32]; + + strftime(buffer, sizeof(buffer), + "%a %b %d %H:%M:%S %Z", + localtime(¤t_time)); + sf.set_value(buffer); + }; + + void update_marks(listview_curses *lc) { + textview_curses *tc = dynamic_cast(lc); + status_field &sfw = this->tss_fields[TSF_WARNINGS]; + status_field &sfe = this->tss_fields[TSF_ERRORS]; + bookmarks &bm = tc->get_bookmarks(); + unsigned long width; + vis_line_t height; + + tc->get_dimensions(height, width); + if (bm.find(&logfile_sub_source::BM_WARNINGS) != bm.end()) { + bookmark_vector &bv = bm[&logfile_sub_source::BM_WARNINGS]; + bookmark_vector::iterator iter; + + iter = lower_bound(bv.begin(), bv.end(), tc->get_top()); + sfw.set_value("%9dW", distance(bv.begin(), iter)); + } + else { + sfw.clear(); + } + + if (bm.find(&logfile_sub_source::BM_ERRORS) != bm.end()) { + bookmark_vector &bv = bm[&logfile_sub_source::BM_ERRORS]; + bookmark_vector::iterator iter; + + iter = lower_bound(bv.begin(), bv.end(), tc->get_top()); + sfe.set_value("%9dE", distance(bv.begin(), iter)); + } + else { + sfe.clear(); + } + }; + + void update_filename(listview_curses *lc) { + if (lc->get_inner_height() > 0) { + status_field &sf = this->tss_fields[TSF_FILENAME]; + struct line_range lr = { 0, -1 }; + attrs_map_t::iterator iter; + string_attrs_t sa; + attr_line_t al; + + lc->get_data_source()-> + listview_value_for_row(*lc, lc->get_top(), al); + sa = al.get_attrs(); + iter = sa[lr].find("file"); + if (iter != sa[lr].end()) { + logfile *lf = (logfile *)iter->second.sa_ptr; + + sf.set_value(lf->get_filename()); + } + else { + sf.clear(); + } + } + }; + +private: + status_field tss_fields[TSF__MAX]; + +}; + +#endif diff --git a/src/top_sys_status_source.hh b/src/top_sys_status_source.hh new file mode 100644 index 00000000..aae1f9ee --- /dev/null +++ b/src/top_sys_status_source.hh @@ -0,0 +1,53 @@ + +#ifndef _top_sys_status_source_hh +#define _top_sys_status_source_hh + +#include + +#include "logfile_sub_source.hh" +#include "statusview_curses.hh" + +class top_sys_status_source + : public status_data_source +{ + +public: + + typedef enum { + TSF_CPU, + TSF_MEM, + TSF_TRAF, + + TSF__MAX + } field_t; + + top_sys_status_source() { + static std::string names[TSF__MAX] = { + "#CPU", + "#Mem", + "#Traf", + }; + + int lpc; + + for (lpc = 0; lpc < TSF__MAX; lpc++) { + this->tss_fields[lpc].set_width(5); + this->tss_fields[lpc].set_value(names[lpc]); + } + this->tss_fields[TSF_CPU].set_role(view_colors::VCR_WARN_STATUS); + this->tss_fields[TSF_MEM].set_role(view_colors::VCR_ALERT_STATUS); + this->tss_fields[TSF_TRAF].set_role(view_colors::VCR_ACTIVE_STATUS); + }; + + size_t statusview_fields(void) { return TSF__MAX; }; + + status_field &statusview_value_for_field(int field) { + return this->tss_fields[field]; + }; + +private: + telltale_field tss_fields[TSF__MAX]; + +}; + +#endif diff --git a/src/view_curses.cc b/src/view_curses.cc new file mode 100644 index 00000000..a9fea9d0 --- /dev/null +++ b/src/view_curses.cc @@ -0,0 +1,178 @@ +/** + * @file view_curses.cc + */ + +#include "config.h" + +#include + +#include "view_curses.hh" + +using namespace std; + +void view_curses::mvwattrline(WINDOW *window, + int y, + int x, + attr_line_t &al, + struct line_range &lr, + view_colors::role_t base_role) +{ + int text_attrs, attrs, line_width; + string_attrs_t &sa = al.get_attrs(); + string &line = al.get_string(); + string_attrs_t::iterator iter; + char *buffer; + + line_width = lr.length(); + buffer = (char *)alloca(line_width + 1); + + { + size_t tab; + + while ((tab = line.find('\t')) != string::npos) { + line = line.replace(tab, 1, 8, ' '); + } + while ((tab = line.find('\r')) != string::npos) { + line = line.replace(tab, 1, " "); + } + } + + text_attrs = view_colors::singleton().attrs_for_role(base_role); + attrs = text_attrs; + wmove(window, y, x); + wattron(window, attrs); + if (lr.lr_start < (int)line.size()) { + waddnstr(window, &line.c_str()[lr.lr_start], line_width); + } + if (lr.lr_end > line.size()) + whline(window, ' ', lr.lr_end - line.size()); + wattroff(window, attrs); + + for (iter = sa.begin(); iter != sa.end(); iter++) { + struct line_range attr_range = iter->first; + + assert(attr_range.lr_start >= 0); + assert(attr_range.lr_end >= -1); + + attr_range.lr_start = max(0, attr_range.lr_start - lr.lr_start); + if (attr_range.lr_end == -1) { + attr_range.lr_end = line_width; + } + else { + attr_range.lr_end = min((int)line_width, + attr_range.lr_end - lr.lr_start); + } + + if (attr_range.lr_end > 0) { + int awidth = attr_range.length(); + attrs_map_t &am = iter->second; + attrs_map_t::iterator am_iter; + + attrs = 0; + for (am_iter = am.begin(); am_iter != am.end(); am_iter++) { + if (am_iter->first == "style") { + attrs |= am_iter->second.sa_int; + } + } + + /* This silliness is brought to you by a buggy old curses lib. */ + mvwinnstr(window, y, x + attr_range.lr_start, buffer, awidth); + wattron(window, attrs); + mvwaddnstr(window, y, x + attr_range.lr_start, buffer, awidth); + wattroff(window, attrs); + } + + attrs = text_attrs; /* Reset attrs to regular text. */ + } +} + +view_colors &view_colors::singleton(void) +{ + static view_colors s_vc; + + return s_vc; +} + +view_colors::view_colors() + : vc_next_highlight(0) +{ + int lpc; + + /* Setup the mappings from roles to actual colors. */ + this->vc_role_colors[VCR_TEXT] = COLOR_PAIR(VC_WHITE) | A_DIM; + this->vc_role_colors[VCR_SEARCH] = + this->vc_role_colors[VCR_TEXT] | A_REVERSE; + this->vc_role_colors[VCR_OK] = COLOR_PAIR(VC_GREEN) | A_BOLD; + this->vc_role_colors[VCR_ERROR] = COLOR_PAIR(VC_RED) | A_BOLD; + this->vc_role_colors[VCR_WARNING] = COLOR_PAIR(VC_YELLOW) | A_BOLD; + this->vc_role_colors[VCR_ALT_ROW] = COLOR_PAIR(VC_WHITE) | A_BOLD; + + this->vc_role_colors[VCR_STATUS] = + COLOR_PAIR(VC_BLACK_ON_WHITE); + this->vc_role_colors[VCR_WARN_STATUS] = + COLOR_PAIR(VC_YELLOW_ON_WHITE) | A_BOLD; + this->vc_role_colors[VCR_ALERT_STATUS] = + COLOR_PAIR(VC_RED_ON_WHITE); + this->vc_role_colors[VCR_ACTIVE_STATUS] = + COLOR_PAIR(VC_GREEN_ON_WHITE); + this->vc_role_colors[VCR_ACTIVE_STATUS2] = + COLOR_PAIR(VC_GREEN_ON_WHITE) | A_BOLD; + + for (lpc = 0; lpc < VCR__MAX; lpc++) { + this->vc_role_reverse_colors[lpc] = + this->vc_role_colors[lpc] | A_REVERSE; + } + + /* + * Prime the highlight vector. The first HL_COLOR_COUNT color pairs are + * assumed to be the highlight colors. + */ + for (lpc = 1; lpc <= HL_COLOR_COUNT; lpc++) { + this->vc_role_colors[VCR__MAX + (lpc - 1) * 2] = COLOR_PAIR(lpc); + this->vc_role_colors[VCR__MAX + (lpc - 1) * 2 + 1] = + COLOR_PAIR(lpc) | A_BOLD; + + this->vc_role_reverse_colors[VCR__MAX + (lpc - 1) * 2] = + COLOR_PAIR(lpc + HL_COLOR_COUNT) | A_REVERSE; + this->vc_role_reverse_colors[VCR__MAX + (lpc - 1) * 2 + 1] = + COLOR_PAIR(lpc) | A_BOLD | A_REVERSE; + } +} + +void view_colors::init(void) +{ + if (has_colors()) { + start_color(); + + /* use_default_colors(); */ + init_pair(VC_BLUE, COLOR_BLUE, COLOR_BLACK); + init_pair(VC_CYAN, COLOR_CYAN, COLOR_BLACK); + init_pair(VC_GREEN, COLOR_GREEN, COLOR_BLACK); + init_pair(VC_MAGENTA, COLOR_MAGENTA, COLOR_BLACK); + + init_pair(VC_BLUE_ON_WHITE, COLOR_BLUE, COLOR_WHITE); + init_pair(VC_CYAN_ON_BLACK, COLOR_CYAN, COLOR_BLACK); + init_pair(VC_GREEN_ON_WHITE, COLOR_GREEN, COLOR_WHITE); + init_pair(VC_MAGENTA_ON_WHITE, COLOR_MAGENTA, COLOR_WHITE); + + init_pair(VC_RED, COLOR_RED, COLOR_BLACK); + init_pair(VC_YELLOW, COLOR_YELLOW, COLOR_BLACK); + init_pair(VC_WHITE, COLOR_WHITE, COLOR_BLACK); + + init_pair(VC_BLACK_ON_WHITE, COLOR_BLACK, COLOR_WHITE); + init_pair(VC_RED_ON_WHITE, COLOR_RED, COLOR_WHITE); + init_pair(VC_YELLOW_ON_WHITE, COLOR_YELLOW, COLOR_WHITE); + + init_pair(VC_WHITE_ON_GREEN, COLOR_WHITE, COLOR_GREEN); + } +} + +view_colors::role_t view_colors::next_highlight(void) +{ + role_t retval = (role_t)(VCR__MAX + this->vc_next_highlight); + + this->vc_next_highlight = (this->vc_next_highlight + 1) % + (HL_COLOR_COUNT * 2); + + return retval; +} diff --git a/src/view_curses.hh b/src/view_curses.hh new file mode 100644 index 00000000..d8c46b10 --- /dev/null +++ b/src/view_curses.hh @@ -0,0 +1,344 @@ +/** + * @file view_curses.hh + */ + +#ifndef __view_curses_hh +#define __view_curses_hh + +#include +#include + +#include + +#include +#include +#include +#include +#include + +class view_curses; + +class screen_curses { +public: + screen_curses() + : sc_main_window(initscr()) { }; + virtual ~screen_curses() { endwin(); }; + + WINDOW *get_window() { return this->sc_main_window; }; + +private: + WINDOW *sc_main_window; +}; + +struct line_range { + int lr_start; + int lr_end; + + int length() const { + return this->lr_end == -1 ? INT_MAX : this->lr_end - this->lr_start; + }; + + bool operator<(const struct line_range &rhs) const { + if (this->lr_start < rhs.lr_start) return true; + else if (this->lr_start > rhs.lr_start) return false; + + if (this->lr_end < rhs.lr_end) return true; + return false; + }; +}; + +typedef union { + void *sa_ptr; + int sa_int; +} string_attr_t; + +inline std::pair +make_string_attr(const std::string name, void *val) +{ + string_attr_t sa; + + sa.sa_ptr = val; + + return std::make_pair(name, sa); +} + +inline std::pair +make_string_attr(const std::string name, int val) +{ + string_attr_t sa; + + sa.sa_int = val; + + return std::make_pair(name, sa); +} + +typedef std::multimap attrs_map_t; +typedef std::map string_attrs_t; + +class attr_line_t { +public: + attr_line_t() { }; + + std::string &get_string() { return this->al_string; }; + + string_attrs_t &get_attrs() { return this->al_attrs; }; + + void operator=(const std::string &rhs) { this->al_string = rhs; }; + + void clear() { + this->al_string.clear(); + this->al_attrs.clear(); + }; + +private: + std::string al_string; + string_attrs_t al_attrs; +}; + +/** + * Class that encapsulates a method to execute and the object on which to + * execute it. + * + * @param _Sender The type of object that will be triggering an action. + */ +template +class view_action { +public: + + /** + * + * @param _Receiver The type of object that will be triggered by an action. + */ + template + class mem_functor_t { +public: + mem_functor_t(_Receiver &receiver, + void (_Receiver::*selector)(_Sender *)) + : mf_receiver(receiver), + mf_selector(selector) { }; + + void operator()(_Sender *sender) + { + (this->mf_receiver.*mf_selector)(sender); + }; + + static void invoke(mem_functor_t *self, _Sender *sender) + { + (*self)(sender); + }; + +private: + _Receiver & mf_receiver; + void (_Receiver::*mf_selector)(_Sender *); + }; + + class broadcaster + : public std::vector { +public: + + broadcaster() + : b_functor(*this, &broadcaster::invoke) { }; + virtual ~broadcaster() { }; + + void invoke(_Sender *sender) + { + typename std::vector::iterator iter; + + for (iter = this->begin(); iter != this->end(); iter++) { + (*iter).invoke(sender); + } + }; + + mem_functor_t *get_functor() + { + return &this->b_functor; + }; + +private: + mem_functor_t b_functor; + }; + + /** + * @param receiver The object to pass as the first argument to the selector + * function. + * @param selector The function to execute. The function should take two + * parameters, the first being the value of the receiver pointer and the + * second being the sender pointer as passed to invoke(). + */ + view_action(void (*invoker)(void *, _Sender *) = NULL) + : va_functor(NULL), + va_invoker(invoker) { }; + + template + view_action(mem_functor_t < _Receiver > *mf) + : va_functor(mf), + va_invoker((void (*)(void *, _Sender *)) + mem_functor_t<_Receiver>::invoke) { }; + + /** + * Performs a shallow copy of another view_action. + * + * @param va The view_action to copy the receiver and selector pointers + * from. + */ + view_action(const view_action &va) + : va_functor(va.va_functor), + va_invoker(va.va_invoker) { }; + + ~view_action() { }; + + /** + * @param rhs The view_action to shallow copy. + * @return *this + */ + view_action &operator=(const view_action &rhs) + { + this->va_functor = rhs.va_functor; + this->va_invoker = rhs.va_invoker; + + return *this; + }; + + /** + * Invoke the action by calling the selector function, if one is set. + * + * @param sender Pointer to the object that called this method. + */ + void invoke(_Sender *sender) + { + if (this->va_invoker != NULL) { + this->va_invoker(this->va_functor, sender); + } + }; + +private: + + /** The object to pass as the first argument to the selector function.*/ + void *va_functor; + /** The function to call when this action is invoke()'d. */ + void (*va_invoker)(void *functor, _Sender * sender); +}; + +/** + * Singleton used to manage the colorspace. + */ +class view_colors { +public: + + /** Roles that can be mapped to curses attributes using attrs_for_role() */ + typedef enum { + VCR_NONE = -1, + + VCR_TEXT, /*< Raw text. */ + VCR_SEARCH, /*< A search hit. */ + VCR_OK, + VCR_ERROR, /*< An error message. */ + VCR_WARNING, /*< A warning message. */ + VCR_ALT_ROW, /*< Highlight for alternating rows in a list */ + VCR_STATUS, /*< Normal status line text. */ + VCR_WARN_STATUS, + VCR_ALERT_STATUS, /*< Alert status line text. */ + VCR_ACTIVE_STATUS, /*< */ + VCR_ACTIVE_STATUS2, /*< */ + + VCR__MAX + } role_t; + + /** @return A reference to the singleton. */ + static view_colors &singleton(); + + /** + * Performs curses-specific initialization. The other methods can be + * called before this method, but the returned attributes cannot be used + * with curses code until this method is called. + */ + void init(void); + + /** + * @param role The role to retrieve character attributes for. + * @return The attributes to use for the given role. + */ + int attrs_for_role(role_t role) + { + assert(role >= 0); + assert(role < VCR__MAX + (HL_COLOR_COUNT * 2)); + + return this->vc_role_colors[role]; + }; + + int reverse_attrs_for_role(role_t role) + { + assert(role >= 0); + assert(role < VCR__MAX + (HL_COLOR_COUNT * 2)); + + return this->vc_role_reverse_colors[role]; + }; + + /** + * @return The next set of attributes to use for highlighting text. This + * method will iterate through eight-or-so attributes combinations so there + * is some variety in how text is highlighted. + */ + role_t next_highlight(void); + + enum { + VC_EMPTY = 0, /* XXX Dead color pair, doesn't work. */ + + VC_BLUE, + VC_CYAN, + VC_GREEN, + VC_MAGENTA, + + VC_BLUE_ON_WHITE, + VC_CYAN_ON_BLACK, + VC_GREEN_ON_WHITE, + VC_MAGENTA_ON_WHITE, + + VC_RED, + VC_YELLOW, + VC_WHITE, + + VC_BLACK_ON_WHITE, + VC_YELLOW_ON_WHITE, + VC_RED_ON_WHITE, + + VC_WHITE_ON_GREEN, + }; + +private: + + /** The number of colors used for highlighting. */ + static const int HL_COLOR_COUNT = 4; + + /** Private constructor that initializes the member fields. */ + view_colors(); + + /** Map of role IDs to attribute values. */ + int vc_role_colors[VCR__MAX + (HL_COLOR_COUNT * 2)]; + /** Map of role IDs to reverse-video attribute values. */ + int vc_role_reverse_colors[VCR__MAX + (HL_COLOR_COUNT * 2)]; + /** The index of the next highlight color to use. */ + int vc_next_highlight; +}; + +/** + * Interface for "view" classes that will update a curses(3) display. + */ +class view_curses { +public: + virtual ~view_curses() { }; + + /** + * Update the curses display. + */ + virtual void do_update(void) = 0; + + void mvwattrline(WINDOW *window, + int y, + int x, + attr_line_t &al, + struct line_range &lr, + view_colors::role_t base_role = view_colors::VCR_TEXT); +}; + +#endif diff --git a/src/vt52_curses.cc b/src/vt52_curses.cc new file mode 100644 index 00000000..18c8bef1 --- /dev/null +++ b/src/vt52_curses.cc @@ -0,0 +1,238 @@ +/** + * @file vt52_curses.cc + */ + +#include "config.h" + +#include +#include +#include + +#include + +#include "vt52_curses.hh" + +using namespace std; + +/** + * Singleton used to hold the mapping of ncurses keycodes to VT52 escape + * sequences. + */ +class vt52_escape_map { +public: + + /** @return The singleton. */ + static vt52_escape_map &singleton() + { + static vt52_escape_map s_vem; + + return s_vem; + }; + + /** + * @param ch The ncurses keycode. + * @return The null terminated VT52 escape sequence. + */ + const char *operator[](int ch) const + { + map < int, const char * >::const_iterator iter; + const char *retval = NULL; + + if ((iter = this->vem_map.find(ch)) != this->vem_map.end()) { + retval = iter->second; + } + + return retval; + }; + + const char *operator[](const char *seq) const + { + map < string, const char * >::const_iterator iter; + const char *retval = NULL; + + assert(seq != NULL); + + if ((iter = this->vem_input_map.find(seq)) != + this->vem_input_map.end()) { + retval = iter->second; + } + + return retval; + }; + +private: + + /** Construct the map with a few escape sequences. */ + vt52_escape_map() + { + static char area_buffer[1024]; + char *area = area_buffer; + + if (tgetent(NULL, "vt52") == ERR) { + perror("tgetent"); + } + this->vem_map[KEY_UP] = tgetstr("ku", &area); + this->vem_map[KEY_DOWN] = tgetstr("kd", &area); + this->vem_map[KEY_RIGHT] = tgetstr("kr", &area); + this->vem_map[KEY_LEFT] = tgetstr("kl", &area); + this->vem_map[KEY_HOME] = tgetstr("kh", &area); + this->vem_map[KEY_BACKSPACE] = "\010"; + this->vem_map[KEY_DC] = "\x4"; + + this->vem_map[KEY_BEG] = "\x1"; + this->vem_map[KEY_END] = "\x5"; + + this->vem_map[KEY_SLEFT] = tgetstr("#4", NULL); + if (this->vem_map[KEY_SLEFT] == NULL) { + this->vem_map[KEY_SLEFT] = "\033b"; + } + this->vem_map[KEY_SRIGHT] = tgetstr("%i", NULL); + if (this->vem_map[KEY_SRIGHT] == NULL) { + this->vem_map[KEY_SRIGHT] = "\033f"; + } + + this->vem_input_map[tgetstr("ce", &area)] = "ce"; + this->vem_input_map[tgetstr("kl", &area)] = "kl"; + tgetent(NULL, getenv("TERM")); + }; + + /** Map of ncurses keycodes to VT52 escape sequences. */ + map < int, const char * > vem_map; + map < string, const char * > vem_input_map; +}; + +vt52_curses::vt52_curses() + : vc_window(NULL), + vc_x(0), + vc_y(0), + vc_escape_len(0) +{ } + +vt52_curses::~vt52_curses() +{ } + +const char *vt52_curses::map_input(int ch, int &len_out) +{ + const char *esc, *retval; + + /* Check for an escape sequence, otherwise just return the char. */ + if ((esc = vt52_escape_map::singleton()[ch]) != NULL) { + retval = esc; + len_out = strlen(retval); + } + else { + this->vc_map_buffer = (char)ch; + retval = &this->vc_map_buffer;/* XXX probably shouldn't do this. */ + len_out = 1; + } + + assert(retval != NULL); + assert(len_out > 0); + + return retval; +} + +void vt52_curses::map_output(const char *output, int len) +{ + int y, lpc; + + assert(this->vc_window != NULL); + + y = this->get_actual_y(); + wmove(this->vc_window, y, this->vc_x); + for (lpc = 0; lpc < len; lpc++) { + if (this->vc_escape_len > 0) { + const char *cap; + + this->vc_escape[this->vc_escape_len] = output[lpc]; + this->vc_escape_len += 1; + this->vc_escape[this->vc_escape_len] = '\0'; + + if ((cap = vt52_escape_map::singleton()[this->vc_escape]) != NULL) { + if (strcmp(cap, "ce") == 0) { + wclrtoeol(this->vc_window); + this->vc_escape_len = 0; + } + else if (strcmp(cap, "kl") == 0) { + this->vc_x -= 1; + wmove(this->vc_window, y, this->vc_x); + this->vc_escape_len = 0; + } + } + } + else { + switch (output[lpc]) { + case STX: + this->vc_past_lines.clear(); + this->vc_x = 0; + wmove(this->vc_window, y, this->vc_x); + wclrtoeol(this->vc_window); + break; + + case BELL: + flash(); + break; + + case BACKSPACE: + this->vc_x -= 1; + wmove(this->vc_window, y, this->vc_x); + break; + + case ESCAPE: + this->vc_escape[0] = ESCAPE; + this->vc_escape_len = 1; + break; + + case '\n': + { + unsigned long width, height; + char *buffer; + + getmaxyx(this->vc_window, height, width); + + buffer = (char *)alloca(width); + this->vc_x = 0; + wmove(this->vc_window, y, this->vc_x); + + /* + * XXX Not sure why we need to subtract one from the width + * here, but otherwise it seems to spill over and screw up + * the next line when we're writing it back out in + * do_update(). + */ + winnstr(this->vc_window, buffer, width - 1); + this->vc_past_lines.push_back(buffer); + wclrtoeol(this->vc_window); + } + break; + + case '\r': + this->vc_x = 0; + wmove(this->vc_window, y, this->vc_x); + break; + + default: + mvwaddch(this->vc_window, y, this->vc_x, output[lpc]); + this->vc_x += 1; + break; + } + } + } +} + +void vt52_curses::do_update(void) +{ + list::iterator iter; + int y; + + y = this->get_actual_y() - (int)this->vc_past_lines.size(); + for (iter = this->vc_past_lines.begin(); + iter != this->vc_past_lines.end(); + iter++, y++) { + if (y >= 0) { + mvwprintw(this->vc_window, y, 0, "%s", iter->c_str()); + wclrtoeol(this->vc_window); + } + } + wmove(this->vc_window, y, this->vc_x); +} diff --git a/src/vt52_curses.hh b/src/vt52_curses.hh new file mode 100644 index 00000000..5ccfb399 --- /dev/null +++ b/src/vt52_curses.hh @@ -0,0 +1,134 @@ +/** + * @file vt52_curses.hh + */ + +#ifndef __vt52_curses_hh +#define __vt52_curses_hh + +#include +#include + +#undef set_window /* XXX term.h #defines this... */ + +#include +#include + +#include "view_curses.hh" + +/** + * VT52 emulator for curses, useful for mediating between curses and readline, + * which don't play well together. It is expected that a subclass of this + * class will fork off a child process that sends and receives VT52 keycodes(?) + * which is translated by this class into curses calls. + * + * VT52 seems to be the simplest terminal to emulate since we do not need to + * maintain the state of the screen, beyond past lines. For example, when + * inserting a character, VT52 moves the cursor to the insertion point, clears + * the rest of the line and then rewrites the rest of the line with the new + * character. This is in contrast to VT100 which moves the cursor to the + * insertion point and then sends a code to insert the character and relying + * on the terminal to shift the rest of the line to the right a character. + */ +class vt52_curses + : public view_curses { +public: + vt52_curses(); + virtual ~vt52_curses(); + + /** @param win The curses window this view is attached to. */ + void set_window(WINDOW *win) { this->vc_window = win; }; + + /** @return The curses window this view is attached to. */ + WINDOW *get_window() { return this->vc_window; }; + + /** + * Set the Y position of this view on the display. A value greater than + * zero is considered to be an absolute size. A value less than zero makes + * the position relative to the bottom of the enclosing window. + * + * @param y The Y position of the cursor on the curses display. + */ + void set_y(int y) { this->vc_y = y; }; + + /** @return The abs/rel Y position of the cursor on the curses display. */ + int get_y() { return this->vc_y; }; + + /** @param x The X position of the cursor on the curses display. */ + void set_x(int x) { this->vc_x = x; }; + + /** @return The X position of the cursor on the curses display. */ + int get_x() { return this->vc_x; }; + + /** + * @return The height of this view, which consists of a single line for + * input, plus any past lines of output, which will appear ABOVE the Y + * position for this view. + * @todo Kinda hardwired to the way readline works. + */ + int get_height() { return this->vc_past_lines.size() + 1; }; + + void set_max_height(int mh) { this->vc_max_height = mh; }; + int get_max_height() { return this->vc_max_height; }; + + /** + * Map an ncurses input keycode to a vt52 sequence. + * + * @param ch The input character. + * @param len_out The length of the returned sequence. + * @return The vt52 sequence to send to the child. + */ + const char *map_input(int ch, int &len_out); + + /** + * Map VT52 output to ncurses calls. + * + * @param output VT52 encoded output from the child process. + * @param len The length of the output array. + */ + void map_output(const char *output, int len); + + /** + * Paints any past lines and moves the cursor to the current X position. + */ + void do_update(void); + + const static char ESCAPE = 27; /*< VT52 Escape key value. */ + const static char BACKSPACE = 8; /*< VT52 Backspace key value. */ + const static char BELL = 7; /*< VT52 Bell value. */ + const static char STX = 2; /*< VT52 Start-of-text value. */ + +protected: + + /** @return The absolute Y position of this view. */ + int get_actual_y() + { + unsigned long width, height; + int retval; + + getmaxyx(this->vc_window, height, width); + if (this->vc_y < 0) { + retval = height + this->vc_y; + } + else { + retval = this->vc_y; + } + + return retval; + }; + + WINDOW *vc_window; /*< The window that contains this view. */ + int vc_x; /*< The X position of the cursor. */ + int vc_y; /*< The Y position of the cursor. */ + int vc_max_height; + char vc_escape[16]; /*< Storage for escape sequences. */ + int vc_escape_len; /*< The number of chars in vc_escape. */ + char vc_map_buffer; /*< + * Buffer returned by map_input for trivial + * translations (one-to-one). + */ + + /** Vector of past lines of output from the child. */ + std::list vc_past_lines; +}; + +#endif diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 00000000..c6ec363c --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,119 @@ + +TESTS_ENVIRONMENT = $(SHELL) $(top_builddir)/TESTS_ENVIRONMENT + +AM_CPPFLAGS = \ + -I$(top_srcdir)/src \ + $(SQLITE3_CFLAGS) \ + $(SOCI_CXXFLAGS) + +# AM_CFLAGS = -fprofile-arcs -ftest-coverage +# AM_CXXFLAGS = -fprofile-arcs -ftest-coverage + +if HAVE_SOCI +SOCI_TESTS = +else +SOCI_TESTS = +endif + +check_PROGRAMS = \ + drive_line_buffer \ + drive_grep_proc \ + drive_listview \ + drive_logfile \ + drive_vt52_curses \ + drive_readline_curses \ + slicer \ + scripty \ + test_auto_fd \ + test_auto_mem \ + test_bookmarks \ + test_grep_proc2 \ + $(SOCI_TESTS) \ + test_line_buffer2 \ + test_top_status + +AM_LDFLAGS = \ + $(SQLITE3_LDFLAGS) + +LDADD = -lz + +test_auto_fd_SOURCES = test_auto_fd.cc + +test_auto_mem_SOURCES = test_auto_mem.cc + +test_bookmarks_SOURCES = test_bookmarks.cc ../src/bookmarks.cc + +test_grep_proc2_SOURCES = \ + ../src/line_buffer.cc \ + ../src/grep_proc.cc \ + test_grep_proc2.cc +test_grep_proc2_LDADD = $(PCRE_LIBS) -lz + +test_line_buffer2_SOURCES = \ + ../src/line_buffer.cc \ + test_line_buffer2.cc + +test_top_status_SOURCES = \ + ../src/bookmarks.cc \ + ../src/logfile.cc \ + ../src/line_buffer.cc \ + ../src/log_format.cc \ + ../src/logfile_sub_source.cc \ + ../src/listview_curses.cc \ + ../src/textview_curses.cc \ + ../src/view_curses.cc \ + test_top_status.cc +test_top_status_LDADD = $(CURSES_LIB) -lz + +drive_line_buffer_SOURCES = \ + ../src/line_buffer.cc \ + drive_line_buffer.cc +drive_line_buffer_LDADD = $(CURSES_LIB) -lz + +drive_grep_proc_SOURCES = \ + ../src/line_buffer.cc \ + ../src/grep_proc.cc \ + drive_grep_proc.cc +drive_grep_proc_LDADD = $(PCRE_LIBS) -lz + +drive_listview_SOURCES = \ + ../src/listview_curses.cc \ + ../src/view_curses.cc \ + drive_listview.cc +drive_listview_LDADD = $(CURSES_LIB) -lz + +drive_logfile_SOURCES = \ + ../src/logfile.cc \ + ../src/log_format.cc \ + ../src/line_buffer.cc \ + drive_logfile.cc + +drive_vt52_curses_SOURCES = \ + ../src/vt52_curses.cc \ + drive_vt52_curses.cc +drive_vt52_curses_LDADD = $(CURSES_LIB) + +drive_readline_curses_SOURCES = \ + ../src/vt52_curses.cc \ + ../src/readline_curses.cc \ + drive_readline_curses.cc +drive_readline_curses_LDADD = $(CURSES_LIB) $(READLINE_LIBS) + +slicer_SOURCES = \ + ../src/line_buffer.cc \ + slicer.cc + +scripty_SOURCES = scripty.cc + +TESTS = test_bookmarks \ + test_auto_fd \ + test_auto_mem \ + test_line_buffer.sh \ + test_line_buffer2 \ + test_grep_proc.sh \ + test_grep_proc2 \ + $(SOCI_TESTS) \ + test_listview.sh \ + test_logfile.sh \ + test_vt52_curses.sh \ + test_top_status diff --git a/test/Makefile.in b/test/Makefile.in new file mode 100644 index 00000000..d3548d90 --- /dev/null +++ b/test/Makefile.in @@ -0,0 +1,867 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = drive_line_buffer$(EXEEXT) drive_grep_proc$(EXEEXT) \ + drive_listview$(EXEEXT) drive_logfile$(EXEEXT) \ + drive_vt52_curses$(EXEEXT) drive_readline_curses$(EXEEXT) \ + slicer$(EXEEXT) scripty$(EXEEXT) test_auto_fd$(EXEEXT) \ + test_auto_mem$(EXEEXT) test_bookmarks$(EXEEXT) \ + test_grep_proc2$(EXEEXT) $(am__EXEEXT_1) \ + test_line_buffer2$(EXEEXT) test_top_status$(EXEEXT) +TESTS = test_bookmarks$(EXEEXT) test_auto_fd$(EXEEXT) \ + test_auto_mem$(EXEEXT) test_line_buffer.sh \ + test_line_buffer2$(EXEEXT) test_grep_proc.sh \ + test_grep_proc2$(EXEEXT) $(am__EXEEXT_1) test_listview.sh \ + test_logfile.sh test_vt52_curses.sh test_top_status$(EXEEXT) +subdir = test +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/ax_sqlite3.m4 \ + $(top_srcdir)/lnav.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/src/config.h +CONFIG_CLEAN_FILES = +am__EXEEXT_1 = +am_drive_grep_proc_OBJECTS = line_buffer.$(OBJEXT) grep_proc.$(OBJEXT) \ + drive_grep_proc.$(OBJEXT) +drive_grep_proc_OBJECTS = $(am_drive_grep_proc_OBJECTS) +am__DEPENDENCIES_1 = +drive_grep_proc_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_drive_line_buffer_OBJECTS = line_buffer.$(OBJEXT) \ + drive_line_buffer.$(OBJEXT) +drive_line_buffer_OBJECTS = $(am_drive_line_buffer_OBJECTS) +drive_line_buffer_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_drive_listview_OBJECTS = listview_curses.$(OBJEXT) \ + view_curses.$(OBJEXT) drive_listview.$(OBJEXT) +drive_listview_OBJECTS = $(am_drive_listview_OBJECTS) +drive_listview_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_drive_logfile_OBJECTS = logfile.$(OBJEXT) log_format.$(OBJEXT) \ + line_buffer.$(OBJEXT) drive_logfile.$(OBJEXT) +drive_logfile_OBJECTS = $(am_drive_logfile_OBJECTS) +drive_logfile_LDADD = $(LDADD) +drive_logfile_DEPENDENCIES = +am_drive_readline_curses_OBJECTS = vt52_curses.$(OBJEXT) \ + readline_curses.$(OBJEXT) drive_readline_curses.$(OBJEXT) +drive_readline_curses_OBJECTS = $(am_drive_readline_curses_OBJECTS) +drive_readline_curses_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_drive_vt52_curses_OBJECTS = vt52_curses.$(OBJEXT) \ + drive_vt52_curses.$(OBJEXT) +drive_vt52_curses_OBJECTS = $(am_drive_vt52_curses_OBJECTS) +drive_vt52_curses_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_scripty_OBJECTS = scripty.$(OBJEXT) +scripty_OBJECTS = $(am_scripty_OBJECTS) +scripty_LDADD = $(LDADD) +scripty_DEPENDENCIES = +am_slicer_OBJECTS = line_buffer.$(OBJEXT) slicer.$(OBJEXT) +slicer_OBJECTS = $(am_slicer_OBJECTS) +slicer_LDADD = $(LDADD) +slicer_DEPENDENCIES = +am_test_auto_fd_OBJECTS = test_auto_fd.$(OBJEXT) +test_auto_fd_OBJECTS = $(am_test_auto_fd_OBJECTS) +test_auto_fd_LDADD = $(LDADD) +test_auto_fd_DEPENDENCIES = +am_test_auto_mem_OBJECTS = test_auto_mem.$(OBJEXT) +test_auto_mem_OBJECTS = $(am_test_auto_mem_OBJECTS) +test_auto_mem_LDADD = $(LDADD) +test_auto_mem_DEPENDENCIES = +am_test_bookmarks_OBJECTS = test_bookmarks.$(OBJEXT) \ + bookmarks.$(OBJEXT) +test_bookmarks_OBJECTS = $(am_test_bookmarks_OBJECTS) +test_bookmarks_LDADD = $(LDADD) +test_bookmarks_DEPENDENCIES = +am_test_grep_proc2_OBJECTS = line_buffer.$(OBJEXT) grep_proc.$(OBJEXT) \ + test_grep_proc2.$(OBJEXT) +test_grep_proc2_OBJECTS = $(am_test_grep_proc2_OBJECTS) +test_grep_proc2_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_test_line_buffer2_OBJECTS = line_buffer.$(OBJEXT) \ + test_line_buffer2.$(OBJEXT) +test_line_buffer2_OBJECTS = $(am_test_line_buffer2_OBJECTS) +test_line_buffer2_LDADD = $(LDADD) +test_line_buffer2_DEPENDENCIES = +am_test_top_status_OBJECTS = bookmarks.$(OBJEXT) logfile.$(OBJEXT) \ + line_buffer.$(OBJEXT) log_format.$(OBJEXT) \ + logfile_sub_source.$(OBJEXT) listview_curses.$(OBJEXT) \ + textview_curses.$(OBJEXT) view_curses.$(OBJEXT) \ + test_top_status.$(OBJEXT) +test_top_status_OBJECTS = $(am_test_top_status_OBJECTS) +test_top_status_DEPENDENCIES = $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +SOURCES = $(drive_grep_proc_SOURCES) $(drive_line_buffer_SOURCES) \ + $(drive_listview_SOURCES) $(drive_logfile_SOURCES) \ + $(drive_readline_curses_SOURCES) $(drive_vt52_curses_SOURCES) \ + $(scripty_SOURCES) $(slicer_SOURCES) $(test_auto_fd_SOURCES) \ + $(test_auto_mem_SOURCES) $(test_bookmarks_SOURCES) \ + $(test_grep_proc2_SOURCES) $(test_line_buffer2_SOURCES) \ + $(test_top_status_SOURCES) +DIST_SOURCES = $(drive_grep_proc_SOURCES) $(drive_line_buffer_SOURCES) \ + $(drive_listview_SOURCES) $(drive_logfile_SOURCES) \ + $(drive_readline_curses_SOURCES) $(drive_vt52_curses_SOURCES) \ + $(scripty_SOURCES) $(slicer_SOURCES) $(test_auto_fd_SOURCES) \ + $(test_auto_mem_SOURCES) $(test_bookmarks_SOURCES) \ + $(test_grep_proc2_SOURCES) $(test_line_buffer2_SOURCES) \ + $(test_top_status_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CFLAGS_PG = @CFLAGS_PG@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSES_LIB = @CURSES_LIB@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJCOPY = @OBJCOPY@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCRE_CFLAGS = @PCRE_CFLAGS@ +PCRE_LIBS = @PCRE_LIBS@ +RANLIB = @RANLIB@ +READLINE_CFLAGS = @READLINE_CFLAGS@ +READLINE_LIBS = @READLINE_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOCI_CXXFLAGS = @SOCI_CXXFLAGS@ +SOCI_LIBS = @SOCI_LIBS@ +SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ +SQLITE3_LDFLAGS = @SQLITE3_LDFLAGS@ +SQLITE3_LIBS = @SQLITE3_LIBS@ +SQLITE3_VERSION = @SQLITE3_VERSION@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +abssrcdir = @abssrcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +TESTS_ENVIRONMENT = $(SHELL) $(top_builddir)/TESTS_ENVIRONMENT +AM_CPPFLAGS = \ + -I$(top_srcdir)/src \ + $(SQLITE3_CFLAGS) \ + $(SOCI_CXXFLAGS) + +@HAVE_SOCI_FALSE@SOCI_TESTS = + +# AM_CFLAGS = -fprofile-arcs -ftest-coverage +# AM_CXXFLAGS = -fprofile-arcs -ftest-coverage +@HAVE_SOCI_TRUE@SOCI_TESTS = +AM_LDFLAGS = \ + $(SQLITE3_LDFLAGS) + +LDADD = -lz +test_auto_fd_SOURCES = test_auto_fd.cc +test_auto_mem_SOURCES = test_auto_mem.cc +test_bookmarks_SOURCES = test_bookmarks.cc ../src/bookmarks.cc +test_grep_proc2_SOURCES = \ + ../src/line_buffer.cc \ + ../src/grep_proc.cc \ + test_grep_proc2.cc + +test_grep_proc2_LDADD = $(PCRE_LIBS) -lz +test_line_buffer2_SOURCES = \ + ../src/line_buffer.cc \ + test_line_buffer2.cc + +test_top_status_SOURCES = \ + ../src/bookmarks.cc \ + ../src/logfile.cc \ + ../src/line_buffer.cc \ + ../src/log_format.cc \ + ../src/logfile_sub_source.cc \ + ../src/listview_curses.cc \ + ../src/textview_curses.cc \ + ../src/view_curses.cc \ + test_top_status.cc + +test_top_status_LDADD = $(CURSES_LIB) -lz +drive_line_buffer_SOURCES = \ + ../src/line_buffer.cc \ + drive_line_buffer.cc + +drive_line_buffer_LDADD = $(CURSES_LIB) -lz +drive_grep_proc_SOURCES = \ + ../src/line_buffer.cc \ + ../src/grep_proc.cc \ + drive_grep_proc.cc + +drive_grep_proc_LDADD = $(PCRE_LIBS) -lz +drive_listview_SOURCES = \ + ../src/listview_curses.cc \ + ../src/view_curses.cc \ + drive_listview.cc + +drive_listview_LDADD = $(CURSES_LIB) -lz +drive_logfile_SOURCES = \ + ../src/logfile.cc \ + ../src/log_format.cc \ + ../src/line_buffer.cc \ + drive_logfile.cc + +drive_vt52_curses_SOURCES = \ + ../src/vt52_curses.cc \ + drive_vt52_curses.cc + +drive_vt52_curses_LDADD = $(CURSES_LIB) +drive_readline_curses_SOURCES = \ + ../src/vt52_curses.cc \ + ../src/readline_curses.cc \ + drive_readline_curses.cc + +drive_readline_curses_LDADD = $(CURSES_LIB) $(READLINE_LIBS) +slicer_SOURCES = \ + ../src/line_buffer.cc \ + slicer.cc + +scripty_SOURCES = scripty.cc +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-checkPROGRAMS: + -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) +drive_grep_proc$(EXEEXT): $(drive_grep_proc_OBJECTS) $(drive_grep_proc_DEPENDENCIES) + @rm -f drive_grep_proc$(EXEEXT) + $(CXXLINK) $(drive_grep_proc_OBJECTS) $(drive_grep_proc_LDADD) $(LIBS) +drive_line_buffer$(EXEEXT): $(drive_line_buffer_OBJECTS) $(drive_line_buffer_DEPENDENCIES) + @rm -f drive_line_buffer$(EXEEXT) + $(CXXLINK) $(drive_line_buffer_OBJECTS) $(drive_line_buffer_LDADD) $(LIBS) +drive_listview$(EXEEXT): $(drive_listview_OBJECTS) $(drive_listview_DEPENDENCIES) + @rm -f drive_listview$(EXEEXT) + $(CXXLINK) $(drive_listview_OBJECTS) $(drive_listview_LDADD) $(LIBS) +drive_logfile$(EXEEXT): $(drive_logfile_OBJECTS) $(drive_logfile_DEPENDENCIES) + @rm -f drive_logfile$(EXEEXT) + $(CXXLINK) $(drive_logfile_OBJECTS) $(drive_logfile_LDADD) $(LIBS) +drive_readline_curses$(EXEEXT): $(drive_readline_curses_OBJECTS) $(drive_readline_curses_DEPENDENCIES) + @rm -f drive_readline_curses$(EXEEXT) + $(CXXLINK) $(drive_readline_curses_OBJECTS) $(drive_readline_curses_LDADD) $(LIBS) +drive_vt52_curses$(EXEEXT): $(drive_vt52_curses_OBJECTS) $(drive_vt52_curses_DEPENDENCIES) + @rm -f drive_vt52_curses$(EXEEXT) + $(CXXLINK) $(drive_vt52_curses_OBJECTS) $(drive_vt52_curses_LDADD) $(LIBS) +scripty$(EXEEXT): $(scripty_OBJECTS) $(scripty_DEPENDENCIES) + @rm -f scripty$(EXEEXT) + $(CXXLINK) $(scripty_OBJECTS) $(scripty_LDADD) $(LIBS) +slicer$(EXEEXT): $(slicer_OBJECTS) $(slicer_DEPENDENCIES) + @rm -f slicer$(EXEEXT) + $(CXXLINK) $(slicer_OBJECTS) $(slicer_LDADD) $(LIBS) +test_auto_fd$(EXEEXT): $(test_auto_fd_OBJECTS) $(test_auto_fd_DEPENDENCIES) + @rm -f test_auto_fd$(EXEEXT) + $(CXXLINK) $(test_auto_fd_OBJECTS) $(test_auto_fd_LDADD) $(LIBS) +test_auto_mem$(EXEEXT): $(test_auto_mem_OBJECTS) $(test_auto_mem_DEPENDENCIES) + @rm -f test_auto_mem$(EXEEXT) + $(CXXLINK) $(test_auto_mem_OBJECTS) $(test_auto_mem_LDADD) $(LIBS) +test_bookmarks$(EXEEXT): $(test_bookmarks_OBJECTS) $(test_bookmarks_DEPENDENCIES) + @rm -f test_bookmarks$(EXEEXT) + $(CXXLINK) $(test_bookmarks_OBJECTS) $(test_bookmarks_LDADD) $(LIBS) +test_grep_proc2$(EXEEXT): $(test_grep_proc2_OBJECTS) $(test_grep_proc2_DEPENDENCIES) + @rm -f test_grep_proc2$(EXEEXT) + $(CXXLINK) $(test_grep_proc2_OBJECTS) $(test_grep_proc2_LDADD) $(LIBS) +test_line_buffer2$(EXEEXT): $(test_line_buffer2_OBJECTS) $(test_line_buffer2_DEPENDENCIES) + @rm -f test_line_buffer2$(EXEEXT) + $(CXXLINK) $(test_line_buffer2_OBJECTS) $(test_line_buffer2_LDADD) $(LIBS) +test_top_status$(EXEEXT): $(test_top_status_OBJECTS) $(test_top_status_DEPENDENCIES) + @rm -f test_top_status$(EXEEXT) + $(CXXLINK) $(test_top_status_OBJECTS) $(test_top_status_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bookmarks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_grep_proc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_line_buffer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_listview.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_logfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_readline_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_vt52_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grep_proc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line_buffer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listview_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_format.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logfile.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logfile_sub_source.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readline_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scripty.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slicer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_auto_fd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_auto_mem.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bookmarks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_grep_proc2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_line_buffer2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_top_status.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/textview_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/view_curses.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vt52_curses.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +line_buffer.o: ../src/line_buffer.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT line_buffer.o -MD -MP -MF $(DEPDIR)/line_buffer.Tpo -c -o line_buffer.o `test -f '../src/line_buffer.cc' || echo '$(srcdir)/'`../src/line_buffer.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/line_buffer.Tpo $(DEPDIR)/line_buffer.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/line_buffer.cc' object='line_buffer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o line_buffer.o `test -f '../src/line_buffer.cc' || echo '$(srcdir)/'`../src/line_buffer.cc + +line_buffer.obj: ../src/line_buffer.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT line_buffer.obj -MD -MP -MF $(DEPDIR)/line_buffer.Tpo -c -o line_buffer.obj `if test -f '../src/line_buffer.cc'; then $(CYGPATH_W) '../src/line_buffer.cc'; else $(CYGPATH_W) '$(srcdir)/../src/line_buffer.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/line_buffer.Tpo $(DEPDIR)/line_buffer.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/line_buffer.cc' object='line_buffer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o line_buffer.obj `if test -f '../src/line_buffer.cc'; then $(CYGPATH_W) '../src/line_buffer.cc'; else $(CYGPATH_W) '$(srcdir)/../src/line_buffer.cc'; fi` + +grep_proc.o: ../src/grep_proc.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT grep_proc.o -MD -MP -MF $(DEPDIR)/grep_proc.Tpo -c -o grep_proc.o `test -f '../src/grep_proc.cc' || echo '$(srcdir)/'`../src/grep_proc.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/grep_proc.Tpo $(DEPDIR)/grep_proc.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/grep_proc.cc' object='grep_proc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o grep_proc.o `test -f '../src/grep_proc.cc' || echo '$(srcdir)/'`../src/grep_proc.cc + +grep_proc.obj: ../src/grep_proc.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT grep_proc.obj -MD -MP -MF $(DEPDIR)/grep_proc.Tpo -c -o grep_proc.obj `if test -f '../src/grep_proc.cc'; then $(CYGPATH_W) '../src/grep_proc.cc'; else $(CYGPATH_W) '$(srcdir)/../src/grep_proc.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/grep_proc.Tpo $(DEPDIR)/grep_proc.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/grep_proc.cc' object='grep_proc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o grep_proc.obj `if test -f '../src/grep_proc.cc'; then $(CYGPATH_W) '../src/grep_proc.cc'; else $(CYGPATH_W) '$(srcdir)/../src/grep_proc.cc'; fi` + +listview_curses.o: ../src/listview_curses.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT listview_curses.o -MD -MP -MF $(DEPDIR)/listview_curses.Tpo -c -o listview_curses.o `test -f '../src/listview_curses.cc' || echo '$(srcdir)/'`../src/listview_curses.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/listview_curses.Tpo $(DEPDIR)/listview_curses.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/listview_curses.cc' object='listview_curses.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o listview_curses.o `test -f '../src/listview_curses.cc' || echo '$(srcdir)/'`../src/listview_curses.cc + +listview_curses.obj: ../src/listview_curses.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT listview_curses.obj -MD -MP -MF $(DEPDIR)/listview_curses.Tpo -c -o listview_curses.obj `if test -f '../src/listview_curses.cc'; then $(CYGPATH_W) '../src/listview_curses.cc'; else $(CYGPATH_W) '$(srcdir)/../src/listview_curses.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/listview_curses.Tpo $(DEPDIR)/listview_curses.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/listview_curses.cc' object='listview_curses.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o listview_curses.obj `if test -f '../src/listview_curses.cc'; then $(CYGPATH_W) '../src/listview_curses.cc'; else $(CYGPATH_W) '$(srcdir)/../src/listview_curses.cc'; fi` + +view_curses.o: ../src/view_curses.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT view_curses.o -MD -MP -MF $(DEPDIR)/view_curses.Tpo -c -o view_curses.o `test -f '../src/view_curses.cc' || echo '$(srcdir)/'`../src/view_curses.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/view_curses.Tpo $(DEPDIR)/view_curses.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/view_curses.cc' object='view_curses.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o view_curses.o `test -f '../src/view_curses.cc' || echo '$(srcdir)/'`../src/view_curses.cc + +view_curses.obj: ../src/view_curses.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT view_curses.obj -MD -MP -MF $(DEPDIR)/view_curses.Tpo -c -o view_curses.obj `if test -f '../src/view_curses.cc'; then $(CYGPATH_W) '../src/view_curses.cc'; else $(CYGPATH_W) '$(srcdir)/../src/view_curses.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/view_curses.Tpo $(DEPDIR)/view_curses.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/view_curses.cc' object='view_curses.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o view_curses.obj `if test -f '../src/view_curses.cc'; then $(CYGPATH_W) '../src/view_curses.cc'; else $(CYGPATH_W) '$(srcdir)/../src/view_curses.cc'; fi` + +logfile.o: ../src/logfile.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT logfile.o -MD -MP -MF $(DEPDIR)/logfile.Tpo -c -o logfile.o `test -f '../src/logfile.cc' || echo '$(srcdir)/'`../src/logfile.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/logfile.Tpo $(DEPDIR)/logfile.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/logfile.cc' object='logfile.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o logfile.o `test -f '../src/logfile.cc' || echo '$(srcdir)/'`../src/logfile.cc + +logfile.obj: ../src/logfile.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT logfile.obj -MD -MP -MF $(DEPDIR)/logfile.Tpo -c -o logfile.obj `if test -f '../src/logfile.cc'; then $(CYGPATH_W) '../src/logfile.cc'; else $(CYGPATH_W) '$(srcdir)/../src/logfile.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/logfile.Tpo $(DEPDIR)/logfile.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/logfile.cc' object='logfile.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o logfile.obj `if test -f '../src/logfile.cc'; then $(CYGPATH_W) '../src/logfile.cc'; else $(CYGPATH_W) '$(srcdir)/../src/logfile.cc'; fi` + +log_format.o: ../src/log_format.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT log_format.o -MD -MP -MF $(DEPDIR)/log_format.Tpo -c -o log_format.o `test -f '../src/log_format.cc' || echo '$(srcdir)/'`../src/log_format.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/log_format.Tpo $(DEPDIR)/log_format.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/log_format.cc' object='log_format.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o log_format.o `test -f '../src/log_format.cc' || echo '$(srcdir)/'`../src/log_format.cc + +log_format.obj: ../src/log_format.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT log_format.obj -MD -MP -MF $(DEPDIR)/log_format.Tpo -c -o log_format.obj `if test -f '../src/log_format.cc'; then $(CYGPATH_W) '../src/log_format.cc'; else $(CYGPATH_W) '$(srcdir)/../src/log_format.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/log_format.Tpo $(DEPDIR)/log_format.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/log_format.cc' object='log_format.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o log_format.obj `if test -f '../src/log_format.cc'; then $(CYGPATH_W) '../src/log_format.cc'; else $(CYGPATH_W) '$(srcdir)/../src/log_format.cc'; fi` + +vt52_curses.o: ../src/vt52_curses.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vt52_curses.o -MD -MP -MF $(DEPDIR)/vt52_curses.Tpo -c -o vt52_curses.o `test -f '../src/vt52_curses.cc' || echo '$(srcdir)/'`../src/vt52_curses.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/vt52_curses.Tpo $(DEPDIR)/vt52_curses.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/vt52_curses.cc' object='vt52_curses.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vt52_curses.o `test -f '../src/vt52_curses.cc' || echo '$(srcdir)/'`../src/vt52_curses.cc + +vt52_curses.obj: ../src/vt52_curses.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vt52_curses.obj -MD -MP -MF $(DEPDIR)/vt52_curses.Tpo -c -o vt52_curses.obj `if test -f '../src/vt52_curses.cc'; then $(CYGPATH_W) '../src/vt52_curses.cc'; else $(CYGPATH_W) '$(srcdir)/../src/vt52_curses.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/vt52_curses.Tpo $(DEPDIR)/vt52_curses.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/vt52_curses.cc' object='vt52_curses.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vt52_curses.obj `if test -f '../src/vt52_curses.cc'; then $(CYGPATH_W) '../src/vt52_curses.cc'; else $(CYGPATH_W) '$(srcdir)/../src/vt52_curses.cc'; fi` + +readline_curses.o: ../src/readline_curses.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT readline_curses.o -MD -MP -MF $(DEPDIR)/readline_curses.Tpo -c -o readline_curses.o `test -f '../src/readline_curses.cc' || echo '$(srcdir)/'`../src/readline_curses.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/readline_curses.Tpo $(DEPDIR)/readline_curses.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/readline_curses.cc' object='readline_curses.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o readline_curses.o `test -f '../src/readline_curses.cc' || echo '$(srcdir)/'`../src/readline_curses.cc + +readline_curses.obj: ../src/readline_curses.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT readline_curses.obj -MD -MP -MF $(DEPDIR)/readline_curses.Tpo -c -o readline_curses.obj `if test -f '../src/readline_curses.cc'; then $(CYGPATH_W) '../src/readline_curses.cc'; else $(CYGPATH_W) '$(srcdir)/../src/readline_curses.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/readline_curses.Tpo $(DEPDIR)/readline_curses.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/readline_curses.cc' object='readline_curses.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o readline_curses.obj `if test -f '../src/readline_curses.cc'; then $(CYGPATH_W) '../src/readline_curses.cc'; else $(CYGPATH_W) '$(srcdir)/../src/readline_curses.cc'; fi` + +bookmarks.o: ../src/bookmarks.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bookmarks.o -MD -MP -MF $(DEPDIR)/bookmarks.Tpo -c -o bookmarks.o `test -f '../src/bookmarks.cc' || echo '$(srcdir)/'`../src/bookmarks.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/bookmarks.Tpo $(DEPDIR)/bookmarks.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/bookmarks.cc' object='bookmarks.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bookmarks.o `test -f '../src/bookmarks.cc' || echo '$(srcdir)/'`../src/bookmarks.cc + +bookmarks.obj: ../src/bookmarks.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bookmarks.obj -MD -MP -MF $(DEPDIR)/bookmarks.Tpo -c -o bookmarks.obj `if test -f '../src/bookmarks.cc'; then $(CYGPATH_W) '../src/bookmarks.cc'; else $(CYGPATH_W) '$(srcdir)/../src/bookmarks.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/bookmarks.Tpo $(DEPDIR)/bookmarks.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/bookmarks.cc' object='bookmarks.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bookmarks.obj `if test -f '../src/bookmarks.cc'; then $(CYGPATH_W) '../src/bookmarks.cc'; else $(CYGPATH_W) '$(srcdir)/../src/bookmarks.cc'; fi` + +logfile_sub_source.o: ../src/logfile_sub_source.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT logfile_sub_source.o -MD -MP -MF $(DEPDIR)/logfile_sub_source.Tpo -c -o logfile_sub_source.o `test -f '../src/logfile_sub_source.cc' || echo '$(srcdir)/'`../src/logfile_sub_source.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/logfile_sub_source.Tpo $(DEPDIR)/logfile_sub_source.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/logfile_sub_source.cc' object='logfile_sub_source.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o logfile_sub_source.o `test -f '../src/logfile_sub_source.cc' || echo '$(srcdir)/'`../src/logfile_sub_source.cc + +logfile_sub_source.obj: ../src/logfile_sub_source.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT logfile_sub_source.obj -MD -MP -MF $(DEPDIR)/logfile_sub_source.Tpo -c -o logfile_sub_source.obj `if test -f '../src/logfile_sub_source.cc'; then $(CYGPATH_W) '../src/logfile_sub_source.cc'; else $(CYGPATH_W) '$(srcdir)/../src/logfile_sub_source.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/logfile_sub_source.Tpo $(DEPDIR)/logfile_sub_source.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/logfile_sub_source.cc' object='logfile_sub_source.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o logfile_sub_source.obj `if test -f '../src/logfile_sub_source.cc'; then $(CYGPATH_W) '../src/logfile_sub_source.cc'; else $(CYGPATH_W) '$(srcdir)/../src/logfile_sub_source.cc'; fi` + +textview_curses.o: ../src/textview_curses.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT textview_curses.o -MD -MP -MF $(DEPDIR)/textview_curses.Tpo -c -o textview_curses.o `test -f '../src/textview_curses.cc' || echo '$(srcdir)/'`../src/textview_curses.cc +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/textview_curses.Tpo $(DEPDIR)/textview_curses.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/textview_curses.cc' object='textview_curses.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o textview_curses.o `test -f '../src/textview_curses.cc' || echo '$(srcdir)/'`../src/textview_curses.cc + +textview_curses.obj: ../src/textview_curses.cc +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT textview_curses.obj -MD -MP -MF $(DEPDIR)/textview_curses.Tpo -c -o textview_curses.obj `if test -f '../src/textview_curses.cc'; then $(CYGPATH_W) '../src/textview_curses.cc'; else $(CYGPATH_W) '$(srcdir)/../src/textview_curses.cc'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/textview_curses.Tpo $(DEPDIR)/textview_curses.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/textview_curses.cc' object='textview_curses.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o textview_curses.obj `if test -f '../src/textview_curses.cc'; then $(CYGPATH_W) '../src/textview_curses.cc'; else $(CYGPATH_W) '$(srcdir)/../src/textview_curses.cc'; fi` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/test/aftest.cc b/test/aftest.cc new file mode 100644 index 00000000..cc2163d4 --- /dev/null +++ b/test/aftest.cc @@ -0,0 +1,33 @@ + +#include +#include +#include + +#include "auto_fd.hh" + +void foo(int *fd) +{ + *fd = 2; +} + +int main(int argc, char *argv[]) +{ + { + auto_fd fd(open("/dev/null", O_WRONLY)); + auto_fd fd2; + + printf("1 fd %d\n", fd.get()); + fd = -1; + printf("2 fd %d\n", fd.get()); + + fd = open("/dev/null", O_WRONLY); + fd2 = fd; + printf("3 fd %d\n", fd.get()); + printf("4 fd2 %d\n", fd2.get()); + + foo(fd2.out()); + printf("5 fd2 %d\n", fd2.get()); + } + + printf("nfd %d\n", open("/dev/null", O_WRONLY)); +} diff --git a/test/drive_grep_proc.cc b/test/drive_grep_proc.cc new file mode 100644 index 00000000..3de34e05 --- /dev/null +++ b/test/drive_grep_proc.cc @@ -0,0 +1,128 @@ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include +#include + +#include "grep_proc.hh" +#include "line_buffer.hh" + +using namespace std; + +class my_source : public grep_proc_source { + +public: + my_source(auto_fd &fd) : ms_offset(0) { + this->ms_buffer.set_fd(fd); + }; + + bool grep_value_for_line(int line_number, string &value_out) { + bool retval = false; + + try { + size_t len; + char *line; + + if ((line = this->ms_buffer.read_line(this->ms_offset, + len)) != NULL) { + value_out = string(line, len); + retval = true; + } + } + catch (line_buffer::error &e) { + fprintf(stderr, + "error: source buffer error %d %s\n", + this->ms_buffer.get_fd(), + strerror(e.e_err)); + } + + return retval; + }; + +private: + line_buffer ms_buffer; + off_t ms_offset; + +}; + +class my_sink : public grep_proc_sink { + +public: + my_sink() : ms_finished(false) { }; + + void grep_match(grep_proc &gp, + grep_line_t line, + int start, + int end) { + printf("%d:%d:%d\n", (int)line, start, end); + }; + + void grep_capture(grep_proc &gp, + grep_line_t line, + int start, + int end, + char *capture) { + fprintf(stderr, "%d(%d:%d)%s\n", (int)line, start, end, capture); + }; + + void grep_end(grep_proc &gp) { + this->ms_finished = true; + }; + + bool ms_finished; +}; + +int main(int argc, char *argv[]) +{ + int retval = EXIT_SUCCESS; + const char *errptr; + auto_fd fd; + pcre *code; + int eoff; + + if (argc < 3) { + fprintf(stderr, "error: expecting pattern and file arguments\n"); + retval = EXIT_FAILURE; + } + else if ((fd = open(argv[2], O_RDONLY)) == -1) { + perror("open"); + retval = EXIT_FAILURE; + } + else if ((code = pcre_compile(argv[1], + PCRE_CASELESS, + &errptr, + &eoff, + NULL)) == NULL) { + fprintf(stderr, "error: invalid pattern -- %s\n", errptr); + } + else { + my_source ms(fd); + fd_set read_fds; + my_sink msink; + int maxfd; + + FD_ZERO(&read_fds); + + grep_proc gp(code, ms, maxfd, read_fds); + + gp.queue_request(); + gp.start(); + gp.set_sink(&msink); + + while (!msink.ms_finished) { + fd_set rfds = read_fds; + + select(maxfd + 1, &rfds, NULL, NULL, NULL); + + gp.check_fd_set(rfds); + } + } + + return retval; +} diff --git a/test/drive_line_buffer.cc b/test/drive_line_buffer.cc new file mode 100644 index 00000000..05c0efe2 --- /dev/null +++ b/test/drive_line_buffer.cc @@ -0,0 +1,156 @@ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include "lnav_util.hh" +#include "auto_fd.hh" +#include "line_buffer.hh" + +using namespace std; + +int main(int argc, char *argv[]) +{ + int c, rnd_iters = 5, retval = EXIT_SUCCESS; + vector > index; + auto_fd fd = STDIN_FILENO; + char delim = '\n'; + off_t offset = 0; + struct stat st; + + while ((c = getopt(argc, argv, "o:d:i:n:")) != -1) { + switch (c) { + case 'o': + if (sscanf(optarg, FORMAT_OFF_T, &offset) != 1) { + fprintf(stderr, + "error: offset is not an integer -- %s\n", + optarg); + retval = EXIT_FAILURE; + } + break; + case 'n': + if (sscanf(optarg, "%d", &rnd_iters) != 1) { + fprintf(stderr, + "error: offset is not an integer -- %s\n", + optarg); + retval = EXIT_FAILURE; + } + break; + case 'i': + { + FILE *file; + + if ((file = fopen(optarg, "r")) == NULL) { + perror("open"); + retval = EXIT_FAILURE; + } + else { + int line_number = 1, line_offset; + + while (fscanf(file, "%d", &line_offset) == 1) { + index.push_back( + make_pair(line_number, line_offset)); + line_number += 1; + } + fclose(file); + file = NULL; + } + } + break; + case 'd': + delim = optarg[0]; + break; + default: + retval = EXIT_FAILURE; + break; + } + } + + argc -= optind; + argv += optind; + + if (retval != EXIT_SUCCESS) { + } + else if ((argc == 0) && (index.size() > 0)) { + fprintf(stderr, "error: cannot randomize stdin\n"); + retval = EXIT_FAILURE; + } + else if ((argc > 0) && (fd = open(argv[0], O_RDONLY)) == -1) { + perror("open"); + retval = EXIT_FAILURE; + } + else if ((argc > 0) && (fstat(fd, &st) == -1)) { + perror("fstat"); + retval = EXIT_FAILURE; + } + else { + try { + off_t last_offset = offset; + line_buffer lb; + char *maddr; + char *line; + size_t len; + + lb.set_fd(fd); + if (index.size() == 0) { + while ((line = lb.read_line(offset, len, delim)) != NULL) { + line[len] = '\0'; + printf("%s", line); + if ((last_offset + len) < offset) + printf("%c", delim); + last_offset = offset; + } + } + else if ((maddr = (char *)mmap(NULL, + st.st_size, + PROT_READ, + MAP_FILE | MAP_PRIVATE, + lb.get_fd(), + 0)) == MAP_FAILED) { + perror("mmap"); + retval = EXIT_FAILURE; + } + else { + do { + int lpc; + + random_shuffle(index.begin(), index.end()); + for (lpc = 0; lpc < index.size(); lpc++) { + string line_str; + + offset = index[lpc].second; + line = lb.read_line(offset, len, delim); + + assert(offset >= 0); + assert(offset <= st.st_size); + assert(memcmp(line, + &maddr[index[lpc].second], + len) == 0); + } + + rnd_iters -= 1; + } while (rnd_iters); + + printf("All done\n"); + } + } + catch (line_buffer::error &e) { + fprintf(stderr, "error: %s\n", strerror(e.e_err)); + retval = EXIT_FAILURE; + } + } + + return retval; +} diff --git a/test/drive_listview.cc b/test/drive_listview.cc new file mode 100644 index 00000000..91230453 --- /dev/null +++ b/test/drive_listview.cc @@ -0,0 +1,95 @@ + +#include +#include +#include + +#include "listview_curses.hh" + +using namespace std; + +static listview_curses lv; + +class my_source : public list_data_source { + +public: + + my_source() : ms_rows(2) { }; + + size_t listview_rows(const listview_curses &lv) { + return this->ms_rows; + }; + + void listview_value_for_row(const listview_curses &lv, + vis_line_t row, + attr_line_t &value_out) { + if (row == 0) { + value_out = "Hello"; + } + else if (row == 1) { + value_out = "World!"; + } + else if (row < this->ms_rows) { + char buffer[32]; + + snprintf(buffer, sizeof(buffer), "%d", (int)row); + value_out = string(buffer); + } + else { + assert(0); + } + }; + + bool attrline_next_token(const view_curses &vc, + int line, + struct line_range &lr, + int &attrs_out) { + return false; + }; + + int ms_rows; + +}; + +int main(int argc, char *argv[]) +{ + int c, retval = EXIT_SUCCESS; + bool wait_for_input = false; + my_source ms; + WINDOW *win; + + win = initscr(); + lv.set_data_source(&ms); + lv.set_window(win); + noecho(); + + while ((c = getopt(argc, argv, "y:t:l:r:h:w")) != -1) { + switch (c) { + case 'y': + lv.set_y(atoi(optarg)); + break; + case 'h': + lv.set_height(vis_line_t(atoi(optarg))); + break; + case 't': + lv.set_top(vis_line_t(atoi(optarg))); + break; + case 'l': + lv.set_left(atoi(optarg)); + break; + case 'w': + wait_for_input = true; + break; + case 'r': + ms.ms_rows = atoi(optarg); + break; + } + } + + lv.do_update(); + refresh(); + if (wait_for_input) + getch(); + endwin(); + + return retval; +} diff --git a/test/drive_logfile.cc b/test/drive_logfile.cc new file mode 100644 index 00000000..5a658734 --- /dev/null +++ b/test/drive_logfile.cc @@ -0,0 +1,113 @@ + +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include "logfile.hh" + +using namespace std; + +typedef enum { + MODE_NONE, + MODE_ECHO, + MODE_LINE_COUNT, + MODE_TIMES, + MODE_LEVELS, +} dl_mode_t; + +time_t time(time_t *_unused) +{ + return 1194107018; +} + +int main(int argc, char *argv[]) +{ + int c, retval = EXIT_SUCCESS; + dl_mode_t mode = MODE_NONE; + string expected_format; + + while ((c = getopt(argc, argv, "ef:ltv")) != -1) { + switch (c) { + case 'f': + expected_format = optarg; + break; + case 'e': + mode = MODE_ECHO; + break; + case 'l': + mode = MODE_LINE_COUNT; + break; + case 't': + mode = MODE_TIMES; + break; + case 'v': + mode = MODE_LEVELS; + break; + } + } + + argc -= optind; + argv += optind; + + if (retval == EXIT_FAILURE) { + } + else if (argc == 0) { + fprintf(stderr, "error: expecting log file name\n"); + } + else { + logfile lf(argv[0]); + struct stat st; + + stat(argv[0], &st); + assert(strcmp(argv[0], lf.get_filename().c_str()) == 0); + + lf.rebuild_index(); + if (expected_format == "") { + assert(lf.get_format() == NULL); + } + else { + // printf("%s %s\n", lf.get_format()->get_name().c_str(), expected_format.c_str()); + assert(lf.get_format()->get_name() == expected_format); + } + assert(lf.get_modified_time() == st.st_mtime); + + switch (mode) { + case MODE_NONE: + break; + case MODE_ECHO: + for (logfile::iterator iter = lf.begin(); iter != lf.end(); iter++) { + printf("%s\n", lf.read_line(iter).c_str()); + } + break; + case MODE_LINE_COUNT: + printf("%d\n", lf.size()); + break; + case MODE_TIMES: + for (logfile::iterator iter = lf.begin(); iter != lf.end(); iter++) { + char buffer[1024]; + time_t lt; + + lt = iter->get_time(); + strftime(buffer, sizeof(buffer), + "%b %d %H:%M:%S %Y", + gmtime(<)); + printf("%s -- %03d\n", buffer, iter->get_millis()); + } + break; + case MODE_LEVELS: + for (logfile::iterator iter = lf.begin(); iter != lf.end(); iter++) { + printf("0x%02x\n", iter->get_level()); + } + break; + } + } + + return retval; +} diff --git a/test/drive_readline_curses.cc b/test/drive_readline_curses.cc new file mode 100644 index 00000000..9784c90d --- /dev/null +++ b/test/drive_readline_curses.cc @@ -0,0 +1,118 @@ + +#include +#include +#include +#include +#include +#include + +#include + +#include "readline_curses.hh" + +using namespace std; + +static readline_context::command_map_t COMMANDS; + +static struct { + bool dd_active; + readline_curses *dd_rl_view; + volatile sig_atomic_t dd_looping; +} drive_data; + +static void rl_callback(void *dummy, readline_curses *rc) +{ + string line = rc->get_value(); + + if (line == "quit") + drive_data.dd_looping = false; + fprintf(stderr, "callback\n"); + drive_data.dd_active = false; +} + +static void rl_timeout(void *dummy, readline_curses *rc) +{ + fprintf(stderr, "timeout\n"); +} + +int main(int argc, char *argv[]) +{ + int lpc, c, fd, maxfd, retval = EXIT_SUCCESS; + + fd = open("/tmp/lnav.err", O_WRONLY|O_CREAT|O_APPEND, 0666); + dup2(fd, STDERR_FILENO); + close(fd); + fprintf(stderr, "startup\n"); + + while ((c = getopt(argc, argv, "h")) != -1) { + switch (c) { + case 'h': + break; + default: + break; + } + } + + readline_context context(&COMMANDS); + readline_curses rlc; + bool done = false; + fd_set rfds; + + rlc.add_context(1, context); + rlc.start(); + + drive_data.dd_rl_view = &rlc; + + FD_ZERO(&rfds); + FD_SET(STDIN_FILENO, &rfds); + + screen_curses sc; + + keypad(stdscr, TRUE); + nonl(); + cbreak(); + noecho(); + nodelay(sc.get_window(), 1); + + rlc.set_window(sc.get_window()); + rlc.set_y(-1); + rlc.set_perform_action(readline_curses::action(rl_callback)); + rlc.set_timeout_action(readline_curses::action(rl_timeout)); + maxfd = max(STDIN_FILENO, rlc.update_fd_set(rfds)); + + drive_data.dd_looping = true; + while (drive_data.dd_looping) { + fd_set ready_rfds = rfds; + int rc; + + rlc.do_update(); + refresh(); + rc = select(maxfd + 1, &ready_rfds, NULL, NULL, NULL); + if (rc > 0) { + if (FD_ISSET(STDIN_FILENO, &ready_rfds)) { + int ch; + + while ((ch = getch()) != ERR) { + switch (ch) { + case CEOF: + case KEY_RESIZE: + break; + + default: + if (drive_data.dd_active) { + rlc.handle_key(ch); + } + else if (ch == ':') { + rlc.focus(1, ":"); + drive_data.dd_active = true; + } + break; + } + } + } + rlc.check_fd_set(ready_rfds); + } + } + + return retval; +} diff --git a/test/drive_vt52_curses.cc b/test/drive_vt52_curses.cc new file mode 100644 index 00000000..584e13d1 --- /dev/null +++ b/test/drive_vt52_curses.cc @@ -0,0 +1,76 @@ + +#include +#include +#include +#include +#include + +#include "view_curses.hh" +#include "vt52_curses.hh" + +int main(int argc, char *argv[]) +{ + int lpc, c, fd, retval = EXIT_SUCCESS; + vt52_curses vt; + + fd = open("/tmp/lnav.err", O_WRONLY|O_CREAT|O_APPEND, 0666); + dup2(fd, STDERR_FILENO); + close(fd); + fprintf(stderr, "startup\n"); + + while ((c = getopt(argc, argv, "y:")) != -1) { + switch (c) { + case 'y': + vt.set_y(atoi(optarg)); + break; + } + } + + for (lpc = 0; lpc < 1000; lpc++) { + int len; + + assert(vt.map_input(random(), len) != NULL); + assert(len > 0); + } + + tgetent(NULL, "vt52"); + { + static const char *CANNED_INPUT[] = { + "abc", + "\r", + tgetstr("ce", NULL), + "de", + "\n", + "1\n", + "2\n", + "3\n", + "4\n", + "5\n", + "6\n", + "7\n", + "8\n", + "9\n", + "abc", + "\x2", + "\a", + "ab\bcdef", + 0 + }; + + screen_curses sc; + + noecho(); + vt.set_window(sc.get_window()); + + for (lpc = 0; CANNED_INPUT[lpc]; lpc++) { + vt.map_output(CANNED_INPUT[lpc], strlen(CANNED_INPUT[lpc])); + vt.do_update(); + refresh(); + getch(); + } + + getch(); + } + + return retval; +} diff --git a/test/gp_test.cc b/test/gp_test.cc new file mode 100644 index 00000000..5f5eea19 --- /dev/null +++ b/test/gp_test.cc @@ -0,0 +1,79 @@ + +#include +#include +#include +#include +#include +#include + +#include "logfile.hh" +#include "grep_proc.hh" +#include "line_buffer.hh" + +class my_source : public grep_proc_source { + +public: + logfile *ms_lf; + + my_source(logfile *lf) : ms_lf(lf) { }; + + size_t grep_lines(void) { + return this->ms_lf->size(); + }; + + void grep_value_for_line(int line, + std::string &value_out, + int pass) { + value_out = this->ms_lf->read_line(this->ms_lf->begin() + line); + }; + +}; + +class my_sink : public grep_proc_sink { + +public: + + void grep_match(grep_line_t line, int start, int end) { + printf("%d - %d:%d\n", (int)line, start, end); + }; + +}; + +int main(int argc, char *argv[]) +{ + int retval = EXIT_SUCCESS; + auto_fd fd; + + fd = open("/tmp/gp.err", O_WRONLY|O_CREAT|O_APPEND, 0666); + dup2(fd, STDERR_FILENO); + fprintf(stderr, "startup\n"); + + if (argc < 2) { + fprintf(stderr, "error: no file given\n"); + } + else { + logfile lf(argv[1]); + lf.rebuild_index(); + my_source ms(&lf); + my_sink msink; + grep_proc gp("pnp", ms); + + gp.start(); + gp.set_sink(&msink); + + fd_set read_fds; + + int maxfd = gp.update_fd_set(read_fds); + + while (1) { + fd_set rfds = read_fds; + select(maxfd + 1, &rfds, NULL, NULL, NULL); + + gp.check_fd_set(rfds); + if (!FD_ISSET(maxfd, &read_fds)) + break; + } + } + + return retval; +} diff --git a/test/lb_test.cc b/test/lb_test.cc new file mode 100644 index 00000000..150ee2e8 --- /dev/null +++ b/test/lb_test.cc @@ -0,0 +1,38 @@ + +#include +#include +#include +#include +#include +#include + +#include "line_buffer.hh" + +int main(int argc, char *argv[]) +{ + int retval = EXIT_SUCCESS; + auto_fd fd; + + fd = open("/tmp/lb.err", O_WRONLY|O_CREAT|O_APPEND, 0666); + dup2(fd, STDERR_FILENO); + fprintf(stderr, "startup\n"); + + if (argc < 2) { + fprintf(stderr, "error: no file given\n"); + } + else if ((fd = open(argv[1], O_RDONLY)) == -1) { + perror("open"); + } + else { + const char *line; + line_buffer lb; + size_t len; + + lb.set_fd(fd); + while ((line = lb.read_line(len)) != NULL) { + printf("%s\n", line); + } + } + + return retval; +} diff --git a/test/listview_output.0 b/test/listview_output.0 new file mode 100644 index 00000000..039d0997 --- /dev/null +++ b/test/listview_output.0 @@ -0,0 +1 @@ +)07[?47hHello World!                         [?47l8 [?1l> \ No newline at end of file diff --git a/test/listview_output.1 b/test/listview_output.1 new file mode 100644 index 00000000..f7791565 --- /dev/null +++ b/test/listview_output.1 @@ -0,0 +1 @@ +)07[?47hWorld!              [?47l8 [?1l> \ No newline at end of file diff --git a/test/listview_output.2 b/test/listview_output.2 new file mode 100644 index 00000000..22b41700 --- /dev/null +++ b/test/listview_output.2 @@ -0,0 +1 @@ +)07[?47hello orld!                         [?47l8 [?1l> \ No newline at end of file diff --git a/test/listview_output.3 b/test/listview_output.3 new file mode 100644 index 00000000..a962d395 --- /dev/null +++ b/test/listview_output.3 @@ -0,0 +1 @@ +)07[?47horld!              [?47l8 [?1l> \ No newline at end of file diff --git a/test/listview_output.4 b/test/listview_output.4 new file mode 100644 index 00000000..e5d6a0d6 --- /dev/null +++ b/test/listview_output.4 @@ -0,0 +1,13 @@ +)07[?47h +Hello World! 2 3 4 5 6 7 8 9 10 11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 [?47l8 [?1l> \ No newline at end of file diff --git a/test/listview_output.5 b/test/listview_output.5 new file mode 100644 index 00000000..3ffb0641 --- /dev/null +++ b/test/listview_output.5 @@ -0,0 +1,13 @@ +)07[?47h +Hello World! 2 3 4 5 6 7 8 9 10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 [?47l8 [?1l> \ No newline at end of file diff --git a/test/listview_output.6 b/test/listview_output.6 new file mode 100644 index 00000000..80ebb9a9 --- /dev/null +++ b/test/listview_output.6 @@ -0,0 +1,13 @@ +)07[?47h +World! 2 3 4 5 6 7 8 9 10 11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 [?47l8 [?1l> \ No newline at end of file diff --git a/test/logfile_access_log.0 b/test/logfile_access_log.0 new file mode 100644 index 00000000..8c899e34 --- /dev/null +++ b/test/logfile_access_log.0 @@ -0,0 +1,3 @@ +192.168.202.254 - - [20/Jul/2009:22:59:26 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7" +192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7" +192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 3578929 "-" "gPXE/0.9.7" diff --git a/test/logfile_empty.0 b/test/logfile_empty.0 new file mode 100644 index 00000000..e69de29b diff --git a/test/logfile_syslog.0 b/test/logfile_syslog.0 new file mode 100644 index 00000000..312fa690 --- /dev/null +++ b/test/logfile_syslog.0 @@ -0,0 +1,4 @@ +Nov 3 09:23:38 veridian automount[7998]: lookup(file): lookup for foobar failed +Nov 3 09:23:38 veridian automount[16442]: attempting to mount entry /auto/opt +Nov 3 09:23:38 veridian automount[7999]: lookup(file): lookup for opt failed +Nov 3 09:47:02 veridian sudo: timstack : TTY=pts/6 ; PWD=/auto/wstimstack/rpms/lbuild/test ; USER=root ; COMMAND=/usr/bin/tail /var/log/messages diff --git a/test/logfile_syslog.1 b/test/logfile_syslog.1 new file mode 100644 index 00000000..0794a4dd --- /dev/null +++ b/test/logfile_syslog.1 @@ -0,0 +1,4 @@ +Dec 3 09:23:38 veridian automount[7998]: lookup(file): lookup for foobar failed +Dec 3 09:23:38 veridian automount[16442]: attempting to mount entry /auto/opt +Dec 3 09:23:38 veridian automount[7999]: lookup(file): lookup for opt failed +Jan 3 09:47:02 veridian sudo: timstack : TTY=pts/6 ; PWD=/auto/wstimstack/rpms/lbuild/test ; USER=root ; COMMAND=/usr/bin/tail /var/log/messages diff --git a/test/logfile_tcsh_history.0 b/test/logfile_tcsh_history.0 new file mode 100644 index 00000000..465d8515 --- /dev/null +++ b/test/logfile_tcsh_history.0 @@ -0,0 +1,4 @@ +#+1162490366 +./drive_vt52_curses +#+1162490385 +exit diff --git a/test/logfile_test.cc b/test/logfile_test.cc new file mode 100644 index 00000000..9c23006b --- /dev/null +++ b/test/logfile_test.cc @@ -0,0 +1,31 @@ + +#include +#include +#include + +#include "logfile.hh" + +int main(int argc, char *argv[]) +{ + int retval = EXIT_SUCCESS; + + try { + logfile::iterator iter; + logfile lf("test.log"); + + for (iter = lf.begin(); iter != lf.end(); iter++) { + printf("%qd %d -- %s\n", + iter->get_offset(), + iter->get_time(), + lf.read_line(iter).c_str()); + + assert(lf.find_after_time(iter->get_time()) != lf.end()); + assert(lf.find_after_time(iter->get_time() + 1000000) == lf.end()); + } + } + catch (logfile::error &e) { + printf("error: could not open log file -- %s\n", strerror(e.e_err)); + } + + return retval; +} diff --git a/test/logfile_with_a_really_long_name_to_test_a_bug_with_long_names.0 b/test/logfile_with_a_really_long_name_to_test_a_bug_with_long_names.0 new file mode 100644 index 00000000..8ab686ea --- /dev/null +++ b/test/logfile_with_a_really_long_name_to_test_a_bug_with_long_names.0 @@ -0,0 +1 @@ +Hello, World! diff --git a/test/rltest.cc b/test/rltest.cc new file mode 100644 index 00000000..73f2b351 --- /dev/null +++ b/test/rltest.cc @@ -0,0 +1,190 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "vt52_curses.hh" + +static const int KEY_TIMEOUT = 500 * 1000; + +static int got_line = 0; +static int got_timeout = 0; + +static void sigalrm(int sig) +{ + got_timeout = 1; +} + +static void line_ready(char *line) +{ + fprintf(stderr, "got line: %s\n", line); + add_history(line); + got_line = 1; +} + +static void child_readline(void) +{ + fd_set rfds; + + FD_ZERO(&rfds); + FD_SET(STDIN_FILENO, &rfds); + + rl_callback_handler_install("/", (void (*)())line_ready); + while (1) { + fd_set ready_rfds = rfds; + int rc; + + rc = select(STDIN_FILENO + 1, &ready_rfds, NULL, NULL, NULL); + if (rc < 0) { + switch (errno) { + case EINTR: + break; + } + } + else { + if (FD_ISSET(STDIN_FILENO, &ready_rfds)) { + struct itimerval itv; + + itv.it_value.tv_sec = 0; + itv.it_value.tv_usec = KEY_TIMEOUT; + itv.it_interval.tv_sec = 0; + itv.it_interval.tv_usec = 0; + setitimer(ITIMER_REAL, &itv, NULL); + + rl_callback_read_char(); + } + } + + if (got_timeout) { + fprintf(stderr, "got timeout\n"); + got_timeout = 0; + } + if (got_line) { + rl_callback_handler_remove(); + got_line = 0; + rl_callback_handler_install("/", (void (*)())line_ready); + } + } +} + +static void finish(int sig) +{ + endwin(); + exit(0); +} + +int main(int argc, char *argv[]) +{ + int fd, retval = EXIT_SUCCESS; + signal(SIGALRM, sigalrm); + + fd = open("/tmp/rltest.err", O_WRONLY|O_CREAT|O_APPEND, 0666); + dup2(fd, STDERR_FILENO); + fprintf(stderr, "startup\n"); + + if (0) { + while(1) { + char *ret = readline("/"); + + add_history(ret); + } + } + + (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ + + WINDOW *mainwin = initscr(); /* initialize the curses library */ + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + + if (fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK) < 0) + perror("fcntl"); + + { + int master, slave; + pid_t rl; + + if (openpty(&master, &slave, NULL, NULL, NULL) < 0) { + perror("openpty"); + } + else if ((rl = fork()) < 0) { + perror("fork"); + } + else if (rl == 0) { + close(master); + master = -1; + + dup2(slave, STDIN_FILENO); + dup2(slave, STDOUT_FILENO); + + setenv("TERM", "vt52", 1); + + child_readline(); + } + else { + vt52_curses vc(mainwin); + fd_set rfds; + + FD_ZERO(&rfds); + FD_SET(STDIN_FILENO, &rfds); + FD_SET(master, &rfds); + + while (1) { + fd_set ready_rfds = rfds; + int rc; + + rc = select(master + 1, &ready_rfds, NULL, NULL, NULL); + if (rc < 0) { + break; + } + else { + char buffer[1024]; + + if (FD_ISSET(STDIN_FILENO, &ready_rfds)) { + int ch; + + if ((ch = getch()) != ERR) { + const char *bch; + int len; + + bch = vc.map_input(ch, len); + + if (len > 0) { + fprintf(stderr, "stdin: %x\n", ch); + if (write(master, bch, len) < 0) + perror("write"); + } + } + } + if (FD_ISSET(master, &ready_rfds)) { + int lpc; + + rc = read(master, buffer, sizeof(buffer)); + + fprintf(stderr, "child: "); + for (lpc = 0; lpc < rc; lpc++) { + fprintf(stderr, "%x ", buffer[lpc]); + } + fprintf(stderr, "\n"); + + vc.map_output(buffer, rc); + } + } + refresh(); + } + } + } + + finish(0); + + return retval; +} diff --git a/test/scripty.cc b/test/scripty.cc new file mode 100644 index 00000000..ce2bcc1b --- /dev/null +++ b/test/scripty.cc @@ -0,0 +1,592 @@ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_PTY_H +#include +#endif + +#ifdef HAVE_UTIL_H +#include +#endif + +#include +#include + +#include "auto_fd.hh" + +using namespace std; + +class child_term { + +public: + class error : public std::exception { + public: + error(int err) : e_err(err) { }; + + int e_err; + }; + + child_term() { + struct winsize ws; + auto_fd slave; + + if (isatty(STDIN_FILENO) && + tcgetattr(STDIN_FILENO, &this->ct_termios) == -1) { + throw error(errno); + } + + if (isatty(STDOUT_FILENO) && + ioctl(STDOUT_FILENO, TIOCGWINSZ, &this->ct_winsize) == -1) { + throw error(errno); + } + + ws.ws_col = 80; + ws.ws_row = 24; + + if (openpty(this->ct_master.out(), + slave.out(), + NULL, + NULL, + &ws) < 0) { + throw error(errno); + } + + if ((this->ct_child = fork()) == -1) + throw error(errno); + + if (this->ct_child == 0) { + this->ct_master.reset(); + + dup2(slave, STDIN_FILENO); + dup2(slave, STDOUT_FILENO); + + setenv("TERM", "xterm-color", 1); + } + else { + slave.reset(); + } + }; + + virtual ~child_term() { + (void)this->wait_for_child(); + + if (isatty(STDIN_FILENO) && + tcsetattr(STDIN_FILENO, TCSANOW, &this->ct_termios) == -1) { + perror("tcsetattr"); + } + if (isatty(STDOUT_FILENO) && + ioctl(STDOUT_FILENO, TIOCSWINSZ, &this->ct_winsize) == -1) { + perror("ioctl"); + } + }; + + int wait_for_child(void) { + int retval = -1; + + if (this->ct_child > 0) { + kill(this->ct_child, SIGTERM); + this->ct_child = -1; + + while (wait(&retval) < 0 && (errno == EINTR)); + } + + return retval; + }; + + bool is_child() { return this->ct_child == 0; }; + pid_t get_child_pid() { return this->ct_child; }; + + int get_fd() { return this->ct_master; }; + +protected: + pid_t ct_child; + auto_fd ct_master; + struct termios ct_termios; + struct winsize ct_winsize; + +}; + +static int tty_raw(int fd) +{ + struct termios attr[1]; + + if (tcgetattr(fd, attr) == -1) + return -1; + + attr->c_lflag &= ~(ECHO | ICANON | IEXTEN); + attr->c_iflag &= ~(ICRNL | INPCK | ISTRIP | IXON); + attr->c_cflag &= ~(CSIZE | PARENB); + attr->c_cflag |= (CS8); + attr->c_oflag &= ~(OPOST); + attr->c_cc[VMIN] = 1; + attr->c_cc[VTIME] = 0; + + return tcsetattr(fd, TCSANOW, attr); +} + +typedef enum { + ET_READ, +} expect_type_t; + +struct expect { + expect_type_t e_type; + union { + char *b; + } e_arg; +}; + +typedef enum { + CT_SLEEP, + CT_WRITE, +} command_type_t; + +struct command { + command_type_t c_type; + union { + char *b; + } c_arg; +}; + +static struct { + const char *sd_program_name; + sig_atomic_t sd_looping; + + pid_t sd_child_pid; + + const char *sd_to_child_name; + FILE *sd_to_child; + + const char *sd_from_child_name; + FILE *sd_from_child; + + queue sd_replay; + queue sd_expected; +} scripty_data; + +static void dump_memory(FILE *dst, char *src, int len) +{ + int lpc; + + for (lpc = 0; lpc < len; lpc++) { + fprintf(dst, "%02x", src[lpc]); + } +} + +static char *hex2bits(const char *src) +{ + int len, pos = sizeof(int); + char *retval; + + len = strlen(src) / 2; + retval = new char[sizeof(int) + len]; + *((int *)retval) = len; + while (src[0]) { + int val; + + sscanf(src, "%2x", &val); + src += 2; + retval[pos] = (char)val; + pos += 1; + } + + return retval; +} + +static void sigchld(int sig) +{ + scripty_data.sd_looping = false; +} + +static void sigpass(int sig) +{ + kill(scripty_data.sd_child_pid, sig); +} + +static void usage(void) +{ + const char *usage_msg = + "usage: %s [-h] [-t to_child] [-f from_child] -- \n" + "\n" + "Recorder for TTY I/O from a child process." + "\n" + "Options:\n" + " -h Print this message, then exit.\n" + " -t The file where any input send to the child process\n" + " should be stored.\n" + " -f The file where any output from the child process\n" + " should be stored.\n"; + + fprintf(stderr, usage_msg, scripty_data.sd_program_name); +} + +int main(int argc, char *argv[]) +{ + int c, fd, retval = EXIT_SUCCESS; + bool passout = true; + FILE *file; + + scripty_data.sd_program_name = argv[0]; + scripty_data.sd_looping = true; + + while ((c = getopt(argc, argv, "ht:f:r:e:n")) != -1) { + switch (c) { + case 'h': + usage(); + exit(retval); + break; + case 't': + scripty_data.sd_to_child_name = optarg; + break; + case 'f': + scripty_data.sd_from_child_name = optarg; + break; + case 'e': + if ((file = fopen(optarg, "r")) == NULL) { + fprintf(stderr, "error: cannot open %s\n", optarg); + retval = EXIT_FAILURE; + } + else { + char line[32 * 1024]; + + while (fgets(line, sizeof(line), file)) { + char *sp; + + if (line[0] == '#' || (sp = strchr(line, ' ')) == NULL) { + } + else { + struct expect exp; + + *sp = '\0'; + sp += 1; + if (strcmp(line, "read") == 0) { + exp.e_type = ET_READ; + exp.e_arg.b = hex2bits(sp); + } + else { + fprintf(stderr, + "error: unknown command -- %s\n", + line); + retval = EXIT_FAILURE; + } + scripty_data.sd_expected.push(exp); + } + } + fclose(file); + file = NULL; + } + break; + case 'r': + if ((file = fopen(optarg, "r")) == NULL) { + fprintf(stderr, "error: cannot open %s\n", optarg); + retval = EXIT_FAILURE; + } + else { + char line[32 * 1024]; + + while (fgets(line, sizeof(line), file)) { + char *sp; + + if (line[0] == '#' || (sp = strchr(line, ' ')) == NULL) { + } + else { + struct command cmd; + + *sp = '\0'; + sp += 1; + if (strcmp(line, "sleep") == 0) { + cmd.c_type = CT_SLEEP; + } + else if (strcmp(line, "write") == 0) { + cmd.c_type = CT_WRITE; + cmd.c_arg.b = hex2bits(sp); + scripty_data.sd_replay.push(cmd); + } + else { + fprintf(stderr, + "error: unknown command -- %s\n", + line); + retval = EXIT_FAILURE; + } + } + } + fclose(file); + file = NULL; + } + break; + case 'n': + passout = false; + break; + default: + retval = EXIT_FAILURE; + break; + } + } + + argc -= optind; + argv += optind; + + if ((scripty_data.sd_to_child_name != NULL) && + (scripty_data.sd_to_child = + fopen(scripty_data.sd_to_child_name, "w")) == NULL) { + fprintf(stderr, + "error: unable to open %s -- %s\n", + scripty_data.sd_to_child_name, + strerror(errno)); + retval = EXIT_FAILURE; + } + + if (scripty_data.sd_from_child_name != NULL) { + if (strcmp(scripty_data.sd_from_child_name, "-") == 0) { + scripty_data.sd_from_child = stdout; + } + else if ((scripty_data.sd_from_child = + fopen(scripty_data.sd_from_child_name, "w")) == NULL) { + fprintf(stderr, + "error: unable from open %s -- %s\n", + scripty_data.sd_from_child_name, + strerror(errno)); + retval = EXIT_FAILURE; + } + } + + fd = open("/tmp/scripty.err", O_WRONLY|O_CREAT|O_APPEND, 0666); + dup2(fd, STDERR_FILENO); + close(fd); + fprintf(stderr, "startup\n"); + + if (scripty_data.sd_to_child != NULL) + fcntl(fileno(scripty_data.sd_to_child), F_SETFD, 1); + if (scripty_data.sd_from_child != NULL) + fcntl(fileno(scripty_data.sd_from_child), F_SETFD, 1); + + if (retval != EXIT_FAILURE) { + child_term ct; + + if (ct.is_child()) { + execvp(argv[0], argv); + perror("execvp"); + exit(-1); + } + else { + int maxfd, out_len = 0, exp_pos = 0, exp_len = 0; + bool got_expected = true; + struct timeval last, now; + char out_buffer[8192]; + fd_set read_fds; + char *exp_data = NULL; + + scripty_data.sd_child_pid = ct.get_child_pid(); + signal(SIGINT, sigpass); + signal(SIGTERM, sigpass); + + signal(SIGCHLD, sigchld); + + gettimeofday(&now, NULL); + last = now; + + FD_ZERO(&read_fds); + FD_SET(STDIN_FILENO, &read_fds); + FD_SET(ct.get_fd(), &read_fds); + + fprintf(stderr, "goin in the loop\n"); + + tty_raw(STDIN_FILENO); + + if (!scripty_data.sd_expected.empty()) { + struct expect exp = scripty_data.sd_expected.front(); + + scripty_data.sd_expected.pop(); + switch (exp.e_type) { + case ET_READ: + exp_pos = sizeof(int); + exp_len = *((int *)exp.e_arg.b) + sizeof(int); + exp_data = exp.e_arg.b; + break; + } + got_expected = false; + } + + maxfd = max(STDIN_FILENO, ct.get_fd()); + while (scripty_data.sd_looping) { + fd_set ready_rfds = read_fds; + struct timeval diff, to; + int rc; + + to.tv_sec = 0; + to.tv_usec = 10000; + rc = select(maxfd + 1, &ready_rfds, NULL, NULL, &to); + if (rc == 0) { + if (exp_data != NULL && exp_pos == exp_len && !got_expected) { + exp_data = NULL; + if (!scripty_data.sd_expected.empty()) { + struct expect exp = scripty_data.sd_expected.front(); + + delete [] exp_data; + scripty_data.sd_expected.pop(); + switch (exp.e_type) { + case ET_READ: + exp_pos = sizeof(int); + exp_len = *((int *)exp.e_arg.b) + sizeof(int); + exp_data = exp.e_arg.b; + break; + } + } + got_expected = true; + } + if (!scripty_data.sd_replay.empty() && got_expected) { + struct command cmd = scripty_data.sd_replay.front(); + int len; + + scripty_data.sd_replay.pop(); + fprintf(stderr, "replay %d\n", scripty_data.sd_replay.size()); + switch (cmd.c_type) { + case CT_SLEEP: + break; + case CT_WRITE: + len = *((int *)cmd.c_arg.b); + write(ct.get_fd(), + cmd.c_arg.b + sizeof(int), + len); + delete [] cmd.c_arg.b; + break; + } + got_expected = false; + } + } + else if (rc < 0) { + switch (errno) { + case EINTR: + break; + default: + fprintf(stderr, "select %s\n", strerror(errno)); + scripty_data.sd_looping = false; + break; + } + } + else { + char buffer[1024]; + + gettimeofday(&now, NULL); + timersub(&now, &last, &diff); + if (FD_ISSET(STDIN_FILENO, &ready_rfds)) { + rc = read(STDIN_FILENO, buffer, sizeof(buffer)); + if (rc < 0) { + scripty_data.sd_looping = false; + } + else if (rc == 0) { + FD_CLR(STDIN_FILENO, &read_fds); + } + else { + write(ct.get_fd(), buffer, rc); + if (scripty_data.sd_to_child != NULL) { + fprintf(scripty_data.sd_to_child, + "sleep %ld.%06d\n" + "write ", + diff.tv_sec, diff.tv_usec); + dump_memory(scripty_data.sd_to_child, + buffer, + rc); + fprintf(scripty_data.sd_to_child, "\n"); + } + if (scripty_data.sd_from_child != NULL) { + fprintf(stderr, "do write %d\n", out_len); + fprintf(scripty_data.sd_from_child, "read "); + dump_memory(scripty_data.sd_from_child, + out_buffer, + out_len); + fprintf(scripty_data.sd_from_child, "\n"); + fprintf(scripty_data.sd_from_child, + "# write "); + dump_memory(scripty_data.sd_from_child, + buffer, + rc); + fprintf(scripty_data.sd_from_child, "\n"); + out_len = 0; + } + } + } + if (FD_ISSET(ct.get_fd(), &ready_rfds)) { + rc = read(ct.get_fd(), buffer, sizeof(buffer)); + if (rc <= 0) { + scripty_data.sd_looping = false; + } + else { + if (passout) + write(STDOUT_FILENO, buffer, rc); + if (scripty_data.sd_from_child != NULL) { + fprintf(stderr, "got out %d\n", rc); + memcpy(&out_buffer[out_len], + buffer, + rc); + out_len += rc; + } + if (exp_data != NULL) { + int clen = min((exp_len - exp_pos), rc); + + fprintf(stderr, "cmp %d %d %d %d\n", exp_len, exp_pos, rc, clen); + if (memcmp(&exp_data[exp_pos], + buffer, + clen) == 0) { + exp_pos += clen; + fprintf(stderr, "exp %d %d\n", exp_pos, clen); + if (exp_pos == exp_len) { + exp_data = NULL; + if (!scripty_data.sd_expected.empty()) { + struct expect exp = scripty_data.sd_expected.front(); + + delete [] exp_data; + scripty_data.sd_expected.pop(); + switch (exp.e_type) { + case ET_READ: + exp_pos = sizeof(int); + exp_len = *((int *)exp.e_arg.b) + sizeof(int); + exp_data = exp.e_arg.b; + break; + } + } + got_expected = true; + } + } + else { + scripty_data.sd_looping = false; + retval = EXIT_FAILURE; + } + } + } + } + } + last = now; + } + } + + if (!scripty_data.sd_expected.empty()) + retval = EXIT_FAILURE; + + retval = ct.wait_for_child() || retval; + } + + if (scripty_data.sd_to_child != NULL) { + fclose(scripty_data.sd_to_child); + scripty_data.sd_to_child = NULL; + } + + if (scripty_data.sd_from_child != NULL) { + fclose(scripty_data.sd_from_child); + scripty_data.sd_from_child = NULL; + } + + return retval; +} diff --git a/test/si_test.cc b/test/si_test.cc new file mode 100644 index 00000000..647e4b8c --- /dev/null +++ b/test/si_test.cc @@ -0,0 +1,19 @@ + +#include +#include "strong_int.hh" + +class __dsi1_distinct; +typedef strong_int dsi1_t; +class __dsi2_distinct; +typedef strong_int dsi2_t; + +STRONG_INT_TYPE(int, dsi3); + +int main(int argc, char *argv[]) +{ + dsi1_t dsi1(0); + dsi2_t dsi2(1); + dsi3_t dsi3(2); + + printf("%d\n", sizeof(dsi1)); +} diff --git a/test/slicer.cc b/test/slicer.cc new file mode 100644 index 00000000..34dce1a9 --- /dev/null +++ b/test/slicer.cc @@ -0,0 +1,60 @@ + +#include +#include +#include +#include +#include + +#include +#include + +#include "line_buffer.hh" + +using namespace std; + +int main(int argc, char *argv[]) +{ + int retval = EXIT_SUCCESS; + vector index; + auto_fd fd; + + if (argc < 2) { + fprintf(stderr, "error: expecting file argument\n"); + retval = EXIT_FAILURE; + } + else if ((fd = open(argv[1], O_RDONLY)) == -1) { + perror("open"); + retval = EXIT_FAILURE; + } + else { + int line_number, start, end; + off_t offset = 0; + line_buffer lb; + char *line; + size_t len; + + lb.set_fd(fd); + index.push_back(offset); + while ((line = lb.read_line(offset, len)) != NULL) { + index.push_back(offset); + } + index.pop_back(); + + try { + while (scanf("%d:%d:%d", &line_number, &start, &end) == 3) { + string str; + + offset = index[line_number]; + line = lb.read_line(offset, len); + str = string(line, len); + str = str.substr(start, end); + printf("%s\n", str.c_str()); + } + } + catch (line_buffer::error &e) { + fprintf(stderr, "error: line buffer %s\n", strerror(e.e_err)); + } + } + + return retval; +} diff --git a/test/test_auto_fd.cc b/test/test_auto_fd.cc new file mode 100644 index 00000000..33da2b95 --- /dev/null +++ b/test/test_auto_fd.cc @@ -0,0 +1,55 @@ + +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#include "auto_fd.hh" + +int main(int argc, char *argv[]) +{ + int retval = EXIT_SUCCESS; + auto_fd fd1, fd2; + int tmp; + + assert(fd1 == -1); + tmp = open("/dev/null", O_RDONLY); + assert(tmp != -1); + fd1 = tmp; + fd1 = tmp; + assert(fcntl(tmp, F_GETFL) >= 0); + fd1 = fd2; + assert(fcntl(tmp, F_GETFL) == -1); + assert(errno == EBADF); + assert(fd1 == -1); + + tmp = open("/dev/null", O_RDONLY); + assert(tmp != -1); + fd1 = tmp; + *fd1.out() = STDOUT_FILENO; + assert(fcntl(tmp, F_GETFL) == -1); + assert(errno == EBADF); + + { + auto_fd fd_cp(const_cast(fd1)); + + assert(fd1 == STDOUT_FILENO); + assert(fd_cp != STDOUT_FILENO); + assert(fd_cp != -1); + + tmp = (int)fd_cp; + } + { + auto_fd fd_cp(const_cast(fd1)); + + assert(fd_cp == tmp); + } + assert(fd1.release() == STDOUT_FILENO); + assert(fd1 == -1); + + return retval; +} diff --git a/test/test_auto_mem.cc b/test/test_auto_mem.cc new file mode 100644 index 00000000..3f97c197 --- /dev/null +++ b/test/test_auto_mem.cc @@ -0,0 +1,59 @@ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "auto_mem.hh" + +struct my_data { + int dummy1; + int dummy2; +}; + +int free_count; +void *last_free; + +void my_free(void *mem) +{ + free_count += 1; + last_free = mem; +} + +int main(int argc, char *argv[]) +{ + int retval = EXIT_SUCCESS; + auto_mem md1, md2; + struct my_data md1_val, md2_val; + + md1 = &md1_val; + assert(free_count == 1); + md1 = md2; + assert(free_count == 2); + assert(last_free == &md1_val); + assert(md1 == NULL); + + md1 = &md2_val; + assert(free_count == 3); + assert(last_free == NULL); + *md1.out() = &md1_val; + assert(free_count == 4); + assert(last_free == &md2_val); + assert(md1.in() == &md1_val); + + { + auto_mem md_cp(md1); + + assert(md1 == NULL); + assert(free_count == 4); + assert(md_cp == &md1_val); + } + + assert(free_count == 5); + assert(last_free == &md1_val); + + return retval; +} diff --git a/test/test_bookmarks.cc b/test/test_bookmarks.cc new file mode 100644 index 00000000..ebee2202 --- /dev/null +++ b/test/test_bookmarks.cc @@ -0,0 +1,87 @@ + +#include "config.h" + +#include +#include +#include + +#include "bookmarks.hh" + +int main(int argc, char *argv[]) +{ + int lpc, retval = EXIT_SUCCESS; + bookmark_vector bv, bv_cp; + + bv.insert_once(vis_line_t(1)); + bv.insert_once(vis_line_t(1)); + assert(bv.size() == 1); + + bv.insert_once(vis_line_t(3)); + bv.insert_once(vis_line_t(2)); + assert(bv[0] == 1); + assert(bv[1] == 2); + assert(bv[2] == 3); + + bv.clear(); + assert(bv.next(vis_line_t(0)) == -1); + assert(bv.prev(vis_line_t(0)) == -1); + assert(bv.next(vis_line_t(100)) == -1); + assert(bv.prev(vis_line_t(100)) == -1); + + bv.insert_once(vis_line_t(2)); + + assert(bv.next(vis_line_t(0)) == 2); + assert(bv.next(vis_line_t(2)) == -1); + assert(bv.next(vis_line_t(3)) == -1); + + assert(bv.prev(vis_line_t(3)) == 2); + assert(bv.prev(vis_line_t(2)) == -1); + + bv.insert_once(vis_line_t(4)); + + assert(bv.next(vis_line_t(0)) == 2); + assert(bv.next(vis_line_t(2)) == 4); + assert(bv.next(vis_line_t(3)) == 4); + assert(bv.next(vis_line_t(4)) == -1); + + assert(bv.prev(vis_line_t(10)) == 4); + assert(bv.prev(vis_line_t(5)) == 4); + assert(bv.prev(vis_line_t(4)) == 2); + assert(bv.prev(vis_line_t(2)) == -1); + + bv.clear(); + + const int LINE_COUNT = 10000; + + for (lpc = 0; lpc < 1000; lpc++) { + bv.insert_once(vis_line_t(random() % LINE_COUNT)); + } + bv_cp = bv; + sort(bv_cp.begin(), bv_cp.end()); + assert(equal(bv.begin(), bv.end(), bv_cp.begin())); + unique(bv_cp.begin(), bv_cp.end()); + assert(equal(bv.begin(), bv.end(), bv_cp.begin())); + + { + vis_line_t last_line(-1); + + for (lpc = 0; lpc != -1; lpc = bv.next(vis_line_t(lpc))) { + assert(lpc >= 0); + assert(lpc < LINE_COUNT); + assert(last_line < lpc); + + last_line = vis_line_t(lpc); + } + + last_line = vis_line_t(10000); + for (lpc = LINE_COUNT - 1; lpc != -1; lpc = bv.prev(vis_line_t(lpc))) { + assert(lpc >= 0); + assert(lpc < LINE_COUNT); + assert(last_line > lpc); + + last_line = vis_line_t(lpc); + } + } + + return retval; +} diff --git a/test/test_capture_proc.cc b/test/test_capture_proc.cc new file mode 100644 index 00000000..7a8e798e --- /dev/null +++ b/test/test_capture_proc.cc @@ -0,0 +1,136 @@ + +#include "config.h" + +#include +#include +#include + +#include +#include + +#include "time_T.hh" +#include "auto_temp_file.hh" +#include "capture_proc.hh" + +using namespace std; +using namespace SOCI; + +static const int MS_LINE_COUNT = 4; + +static struct { + const char *ml_line; + const char *ml_direction; + int ml_value; +} MS_LINES[] = { + { "download rate: 1000\n", "download", 1000 }, + { "upload rate: 512\n", "upload", 512 }, + { "download rate: 1024\n", "download", 1024 }, + { "download rate: 2048\n", "download", 2048 }, +}; + +class my_source : public grep_proc_source { + +public: + my_source() { }; + + bool grep_value_for_line(int line_number, string &value_out) { + value_out = MS_LINES[line_number].ml_line; + + return true; + }; + + string grep_source_name(void) { + char name[1024]; + + snprintf(name, sizeof(name), "test-source.%d", getpid()); + return string(name); + }; +}; + +class my_sink : public grep_proc_sink { + +public: + my_sink() : ms_finished(false) { }; + + void grep_match(grep_proc &gp, + grep_line_t line, + int start, + int end) { + assert(0); + }; + + void grep_end(grep_proc &gp) { + this->ms_finished = true; + }; + + bool ms_finished; +}; + +static fd_set READFDS; +static int MAXFD; + +static void looper(grep_proc &gp) +{ + my_sink msink; + + gp.set_sink(&msink); + + while (!msink.ms_finished) { + fd_set rfds = READFDS; + + select(MAXFD + 1, &rfds, NULL, NULL, NULL); + + gp.check_fd_set(rfds); + } +} + +int main(int argc, char *argv[]) +{ + int eoff, retval = EXIT_SUCCESS; + const char *errptr; + pcre *code; + + FD_ZERO(&READFDS); + + code = pcre_compile("(?P\\w+) rate: (?P\\d+)", + PCRE_CASELESS, + &errptr, + &eoff, + NULL); + assert(code != NULL); + + try { + auto_temp_file db_file("/tmp/test_capture_proc-db.XXXXXX"); + my_source ms; + capture_proc cp("/tmp/foo", "test", code, ms, MAXFD, READFDS); + + fprintf(stderr, "got %s\n", cp.columns_list().c_str()); + cp.create_table(); + cp.queue_request(grep_line_t(0), grep_line_t(MS_LINE_COUNT)); + cp.start(); + looper(cp); + + { + Session sql(sqlite3, "/tmp/foo"); + int lpc, count; + + sql << "select count(*) from test", into(count); + assert(count > 0); + + Rowset rs = (sql.prepare << "select * from test"); + Rowset::const_iterator iter; + + for (iter = rs.begin(), lpc = 0; + iter != rs.end() && lpc < MS_LINE_COUNT; + ++iter, lpc++) { + assert(*iter == MS_LINES[lpc].ml_value); + } + } + } + catch (const exception &e) { + fprintf(stderr, "%s\n", e.what()); + retval = EXIT_FAILURE; + } + + return retval; +} diff --git a/test/test_grep_proc.sh b/test/test_grep_proc.sh new file mode 100644 index 00000000..8372c047 --- /dev/null +++ b/test/test_grep_proc.sh @@ -0,0 +1,47 @@ +#! /bin/sh + +cat > gp.dat </dev/null +} + +run_test grep_slice 'Hello' gp.dat + +check_output "grep_proc didn't find the right match?" < +#include +#include + +#include +#include + +#include "grep_proc.hh" + +using namespace std; + +static struct { + int l_number; + const char *l_value; +} MS_LINES[] = { + { 10, "" }, + { 11, "" }, + { 12, "" }, + { 13, "" }, + { 0, "" }, + { 1, "" }, + { 2, "" }, +}; + +class my_source : public grep_proc_source { + +public: + my_source() : ms_current_line(0) { }; + + bool grep_value_for_line(int line_number, string &value_out) { + bool retval = true; + + assert(line_number == MS_LINES[this->ms_current_line].l_number); + value_out = MS_LINES[this->ms_current_line].l_value; + + this->ms_current_line += 1; + + return retval; + }; + + int ms_current_line; +}; + +class my_sleeper_source : public grep_proc_source { + bool grep_value_for_line(int line_number, string &value_out) { + sleep(1000); + return true; + }; +}; + +class my_sink : public grep_proc_sink { + +public: + my_sink() : ms_finished(false) { }; + + void grep_match(grep_proc &gp, + grep_line_t line, + int start, + int end) { + }; + + void grep_end(grep_proc &gp) { + this->ms_finished = true; + }; + + bool ms_finished; +}; + +static fd_set READFDS; +static int MAXFD; + +static void looper(grep_proc &gp) +{ + my_sink msink; + + gp.set_sink(&msink); + + while (!msink.ms_finished) { + fd_set rfds = READFDS; + + select(MAXFD + 1, &rfds, NULL, NULL, NULL); + + gp.check_fd_set(rfds); + } +} + +int main(int argc, char *argv[]) +{ + int eoff, retval = EXIT_SUCCESS; + const char *errptr; + pcre *code; + + FD_ZERO(&READFDS); + + code = pcre_compile("foobar", + PCRE_CASELESS, + &errptr, + &eoff, + NULL); + assert(code != NULL); + + { + my_source ms; + grep_proc gp(code, ms, MAXFD, READFDS); + + gp.queue_request(grep_line_t(10), grep_line_t(14)); + gp.queue_request(grep_line_t(0), grep_line_t(3)); + gp.start(); + looper(gp); + } + + { + my_sleeper_source mss; + grep_proc *gp = new grep_proc(code, mss, MAXFD, READFDS); + int status; + + gp->queue_request(); + gp->start(); + + assert(wait3(&status, WNOHANG, NULL) == 0); + + delete gp; + + assert(wait(&status) == -1); + assert(errno == ECHILD); + } + + return retval; +} diff --git a/test/test_line_buffer.sh b/test/test_line_buffer.sh new file mode 100644 index 00000000..8d74a8e2 --- /dev/null +++ b/test/test_line_buffer.sh @@ -0,0 +1,43 @@ +#! /bin/sh + +run_test ./drive_line_buffer ${top_srcdir}/src/line_buffer.hh + +check_output "Line buffer output doesn't match input?" < \ + ${top_srcdir}/src/line_buffer.hh + +run_test ./drive_line_buffer < ${top_srcdir}/src/line_buffer.hh + +check_output "Line buffer output doesn't match input from pipe?" < \ + ${top_srcdir}/src/line_buffer.hh + +run_test ./drive_line_buffer -d " " ${top_srcdir}/src/line_buffer.hh + +check_output "Line buffer with delim output doesn't match input?" < \ + ${top_srcdir}/src/line_buffer.hh + +cat > lb.dat < lb-2.dat +grep -b '$' lb-2.dat | cut -f 1 -d : > lb.index +line_count=`wc -l lb-2.dat` + +run_test ./drive_line_buffer -i lb.index -n 100 lb-2.dat + +check_output "Random reads don't match input?" < +#include +#include +#include + +#include "auto_fd.hh" +#include "line_buffer.hh" + +static void single_line(const char *data, int lendiff) +{ + line_buffer lb; + auto_fd pi[2]; + off_t off = 0; + size_t len; + char *line; + + assert(auto_fd::pipe(pi) == 0); + write(pi[1], data, strlen(data)); + pi[1].reset(); + + lb.set_fd(pi[0]); + line = lb.read_line(off, len); + assert(line != NULL); + assert(off == strlen(data)); + assert(len == strlen(data) - lendiff); + + line = lb.read_line(off, len); + assert(line == NULL); + assert(lb.get_file_size() == strlen(data)); +} + +int main(int argc, char *argv[]) +{ + int retval = EXIT_SUCCESS; + + single_line("Dexter Morgan", 0); + single_line("Rudy Morgan\n", 1); + + return retval; +} diff --git a/test/test_listview.sh b/test/test_listview.sh new file mode 100644 index 00000000..41c1b262 --- /dev/null +++ b/test/test_listview.sh @@ -0,0 +1,36 @@ +#! /bin/sh + +run_test ./scripty -- ./drive_listview < /dev/null + +check_output "Listview doesn't match input?" < \ + ${srcdir}/listview_output.0 + +run_test ./scripty -- ./drive_listview -t 1 < /dev/null + +check_output "Listview didn't move down?" < \ + ${srcdir}/listview_output.1 + +run_test ./scripty -- ./drive_listview -l 1 < /dev/null + +check_output "Listview didn't move right?" < \ + ${srcdir}/listview_output.2 + +run_test ./scripty -- ./drive_listview -t 1 -l 1 < /dev/null + +check_output "Listview didn't move left and right?" < \ + ${srcdir}/listview_output.3 + +run_test ./scripty -- ./drive_listview -y 1 -r 50 < /dev/null + +check_output "Listview doesn't start down one line?" < \ + ${srcdir}/listview_output.4 + +run_test ./scripty -- ./drive_listview -y 1 -r 50 -h -1 < /dev/null + +check_output "Listview isn't shorter?" < \ + ${srcdir}/listview_output.5 + +run_test ./scripty -- ./drive_listview -y 1 -r 50 -h -1 -t 1 < /dev/null + +check_output "Listview didn't move down (2)?" < \ + ${srcdir}/listview_output.6 diff --git a/test/test_logfile.sh b/test/test_logfile.sh new file mode 100644 index 00000000..af20cb86 --- /dev/null +++ b/test/test_logfile.sh @@ -0,0 +1,82 @@ +#! /bin/sh + +run_test ./drive_logfile -f syslog_log ${srcdir}/logfile_syslog.0 + +on_error_fail_with "Didn't infer syslog log format?" + +run_test ./drive_logfile -f tcsh_history ${srcdir}/logfile_tcsh_history.0 + +on_error_fail_with "Didn't infer tcsh-history log format?" + +run_test ./drive_logfile -f access_log ${srcdir}/logfile_access_log.0 + +on_error_fail_with "Didn't infer access_log log format?" + + +run_test ./drive_logfile ${srcdir}/logfile_empty.0 + +on_error_fail_with "Didn't handle empty log?" + + +run_test ./drive_logfile -t -f syslog_log ${srcdir}/logfile_syslog.0 + +check_output "Syslog timestamp interpreted incorrectly?" < +#include + +#include "top_status_source.hh" + +using namespace std; + +static time_t current_time = 1; + +time_t time(time_t *arg) +{ + if (arg != NULL) + *arg = current_time; + + return current_time; +} + +int main(int argc, char *argv[]) +{ + int retval = EXIT_SUCCESS; + + top_status_source tss; + + { + status_field &sf = tss. + statusview_value_for_field(top_status_source::TSF_TIME); + attr_line_t val; + + tss.update_time(); + val = sf.get_value(); + assert(val.get_string() == sf.get_value().get_string()); + current_time += 2; + tss.update_time(); + assert(val.get_string() != sf.get_value().get_string()); + } + + return retval; +} diff --git a/test/test_vt52_curses.sh b/test/test_vt52_curses.sh new file mode 100644 index 00000000..1a5318d7 --- /dev/null +++ b/test/test_vt52_curses.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +run_test ./scripty -n -r ${srcdir}/vt52_curses_input.0 \ + -e ${srcdir}/vt52_curses_output.0 -- ./drive_vt52_curses < /dev/null + +on_error_fail_with "single line vt52 did not work?" + +run_test ./scripty -n -r ${srcdir}/vt52_curses_input.1 \ + -e ${srcdir}/vt52_curses_output.1 -- ./drive_vt52_curses -y 5 < /dev/null + +on_error_fail_with "vt52 doesn't maintain past lines?" diff --git a/test/vt52_curses_input.0 b/test/vt52_curses_input.0 new file mode 100644 index 00000000..59e93a88 --- /dev/null +++ b/test/vt52_curses_input.0 @@ -0,0 +1,38 @@ +sleep 2.051763 +write 31 +sleep 0.311858 +write 32 +sleep 0.295852 +write 33 +sleep 0.319916 +write 34 +sleep 0.327742 +write 35 +sleep 0.328183 +write 36 +sleep 0.335896 +write 37 +sleep 0.360085 +write 38 +sleep 0.336000 +write 39 +sleep 0.376058 +write 30 +sleep 0.840149 +write 61 +sleep 0.783892 +write 62 +sleep 0.415990 +write 63 +sleep 0.280001 +write 64 +sleep 0.191901 +write 65 +sleep 0.295949 +write 66 +sleep 0.775841 +write 67 +sleep 0.399883 +write 68 +sleep 0.304016 +write 69 diff --git a/test/vt52_curses_input.1 b/test/vt52_curses_input.1 new file mode 100644 index 00000000..9ee3226b --- /dev/null +++ b/test/vt52_curses_input.1 @@ -0,0 +1,38 @@ +sleep 1.124207 +write 31 +sleep 0.295830 +write 32 +sleep 0.487919 +write 33 +sleep 0.343913 +write 34 +sleep 0.303816 +write 35 +sleep 0.343703 +write 36 +sleep 0.295997 +write 37 +sleep 0.327862 +write 38 +sleep 0.295952 +write 39 +sleep 0.247670 +write 30 +sleep 0.911859 +write 61 +sleep 0.311780 +write 62 +sleep 0.407914 +write 63 +sleep 0.319836 +write 64 +sleep 0.199866 +write 65 +sleep 0.327904 +write 66 +sleep 0.359919 +write 67 +sleep 0.343907 +write 68 +sleep 0.288008 +write 69 diff --git a/test/vt52_curses_output.0 b/test/vt52_curses_output.0 new file mode 100644 index 00000000..99b89649 --- /dev/null +++ b/test/vt52_curses_output.0 @@ -0,0 +1,38 @@ +read 1b29301b371b5b3f3437681b5b313b3234721b5b6d1b5b346c1b5b481b5b324a616263 +# write 31 +read 0d +# write 32 +read 1b5b4a +# write 33 +read 6465 +# write 34 +read 0d1b5b4a +# write 35 +read +# write 36 +read +# write 37 +read +# write 38 +read +# write 39 +read +# write 30 +read +# write 61 +read +# write 62 +read +# write 63 +read +# write 64 +read 616263 +# write 65 +read 0d1b5b4a +# write 66 +read 07 +# write 67 +read 6163646566 +# write 68 +read +# write 69 diff --git a/test/vt52_curses_output.1 b/test/vt52_curses_output.1 new file mode 100644 index 00000000..dfbe7dd3 --- /dev/null +++ b/test/vt52_curses_output.1 @@ -0,0 +1,38 @@ +read 1b29301b371b5b3f3437681b5b313b3234721b5b6d1b5b346c1b5b481b5b324a1b5b3542616263 +# write 31 +read 0d +# write 32 +read 1b5b4a +# write 33 +read 6465 +# write 34 +read 0d1b5b3138420a1b5b313841 +# write 35 +read 1b5b3138420a1b5b313941310a08 +# write 36 +read 1b5b3138420a1b5b313941320a08 +# write 37 +read 1b5b3138420a1b5b313941330a08 +# write 38 +read 1b5b3138420a1b5b313941340a08 +# write 39 +read 1b5b3138420a1b5b313941350a08 +# write 30 +read 1b5b3138420a1b5b313941360a08 +# write 61 +read 1b5b3138420a1b5b313941370a08 +# write 62 +read 1b5b3138420a1b5b313941380a08 +# write 63 +read 1b5b3138420a1b5b313941390a08 +# write 64 +read 616263 +# write 65 +read 0d1b5b4a +# write 66 +read 07 +# write 67 +read 6163646566 +# write 68 +read +# write 69