From: Ole Streicher Date: Sat, 15 Oct 2016 12:54:17 +0000 (+0100) Subject: Import xpa_2.1.18.orig.tar.gz X-Git-Tag: archive/raspbian/2.1.18-4+rpi1~11 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8b88c8ddb519face76d45c75c26303f0c8fe3d24;p=xpa.git Import xpa_2.1.18.orig.tar.gz [dgit import orig xpa_2.1.18.orig.tar.gz] --- 8b88c8ddb519face76d45c75c26303f0c8fe3d24 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa5260e --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +*.[oa] +*~ +*.so +*.bak +foo* +Makefile +a.out.dSYM/ +autom4te.cache/ +oxpa.h +xpa.pc +xpaaccess +xpaget +xpainfo +xpamb +xpans +xpaset +conf.h +config.status +config.cache +config.log diff --git a/BUGS b/BUGS new file mode 100644 index 0000000..24b2a08 --- /dev/null +++ b/BUGS @@ -0,0 +1,39 @@ +using xpans as proxy for xpaset/xpaget (as in chandra-ed): + +Currently, when xpans is used as a proxy connection, an xpaset or +xpaget command will return without waiting for the remote callback to +complete. This is because xpans sets the mode of XPASetFd()/XPAGetFd() +to "dofork=true", to ensure that the XPAClientLoopFork() in client.c +is used. That routine does not wait for the callback to complete. Instead +it forks the callback and then "fakes" the completion. Using the forked +loop and returning immediately prevents xpans from hanging during a long +xpaget/xpaset callback. + +But starting with ds9 7.0, this causes problems: two successive xpaset calls +which both process regions will hang the connection to ds9. For example, +in chandra-ed's zhds9 script, a new region is generated by refinepos, +then the old region is deleted and the new region is sent to ds9 for +display: + + # refinepos creates a new region ... + ${XPASET:-xpaset} -p $XPA regions deleteall + ${XPASET:-xpaset} $XPA regions < $OFILE + +This will hang the xpans connection to ds9, starting with ds9 7.0. Bill reports +that the region parsing got slightly slower with 7.0 because he is creating +a C++ object to pass to the lexer. Somehow that causes a race condition? + +To get around the problem, a delay is needed between the calls: + + ${XPASET:-xpaset} -p $XPA regions deleteall + # this is needed to avoid a race condition, due to the fact that + # xpaset returns immediately when run via xpans proxy + sleep 1 + ${XPASET:-xpaset} $XPA regions < $OFILE + +How can this be handled automatically? Ideally, one would like to +fork() or create a thread at the "right" place in xpans to handle the +xpaset/xpaget call so that it can wait for completion. But its unclear +what that place is: the XPAHandler() is calling the send or receive +callback and expects a status response, and how can fork() deal with that?? + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..5c50ba5 --- /dev/null +++ b/INSTALL @@ -0,0 +1,323 @@ +Quick Summary +============= + +To build and install the XPA package, simply execute: + + ./configure # site-specific configuration + make # build the software + make install # install it + make clean # clean up unneeded temp files + +We strongly recommend that you install in a directory other than the +default of /usr/local, so as not to require root access. To do this, +configure for a different install directory: + + ./configure --prefix= +e.g., + ./configure --prefix=/soft/saord + +Programs will be installed in /soft/saord/bin, libraries in /soft/saord/lib, +include files in /soft/saord/include, and man pages in /soft/saord/man. +Indeed, we do this at SAO and recommend it as a general rule, in order +to keep SAORD software in one place that does not conflict with other +installations. Note that you will need to add the bin directory to +your path and the man directory to MANPATH. + +The build ("make") takes only a minute or so on modern machines. To +monitor its progress and/or check for errors, redirect output to a file +and use the 'tail' command: + + make >& foo.log &; tail -f foo.log # csh +or + make 1>foo.log 2>&1 &; tail -f foo.log # sh, bash + + +Details of Installation +======================= + + NB: These are generic installation instructions, modified for XPA. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + `./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. + + 1. `cd' to the directory containing the package's source code and type + "./configure". This runs a configuration script created by GNU + autoconf, which configures XPA for your system and creates a + Makefile. The configure script allows you to customize the XPA + configuration for your site; for details on how you can do this, + type "./configure -help" or refer to the autoconf documentation (not + included here). The XPA "configure" script supports the following special + switch(es) in addition to the standard ones: + + --enable-shared=yes|link + + Build shared libraries in addition to the + default static library. There are two options: + + If the value is "yes", shared libraries are + built but not used to link xpa programs. + + If the value is "link", shared libraries are + used to link xpa programs. If therefore becomes + your responsibility to put the shared library + where it can be found (or use LD_LIBRARY_PATH). + + --enable-threaded-xpans + Build xpans to support separate threads for + handling name server requests and xpa proxy + callbacks. This is recommended if you are going + to enable proxy handling in xpans (-P), since + XPA long callbacks via proxy can interfere + with the name server functions. (You still have + to start xpans with -P 2 to use 2 threads.) + + --with-tcl= + Force build Tcl support using parameters found + in /tclConfig.sh. Configure will look for + the Tcl config script in standard places and + will enable Tcl support if found. It will abort + if tclConfig.sh points to a non-existent tcl.h + file (some versions of Linux have shown this + behavior). Use this switch to override the + standard locations or to force a build even + if tcl.h is not found (e.g. if you are going to + install tcl as part of a larger build). With + Tcl support enabled you can execute: + + make tclxpa + + to generate the XPA package as a shared Tcl + object, loadable using Tcl "package require". + Contact us with problems -- its been a bear to + get this even half-way right. + + --with-threads + If you are going to link XPA into a threaded + program, you need to specify --with-threads. + This add -D_REENTRANT to the compiler flags, + which tells gcc to use thread-safe versions of + global system variables such as errno. No code + changes are made to XPA. Please note that all + XPA calls must be in a single thread: XPA is + not thread-safe in and of itself but does work + in threaded programs. + + --with-gtk= + Build with support for adding xpa to a gtk + loop. The specified include directory must + contain the gtk directory which itself contains + gtk.h, e.g.: + + --with-gtk=/usr/local/include/gtk-1.2 + + which contains gtk/gtk.h + + Standard options are listed below. the most important of which + are --exec-prefix and --prefix (to specify where to install), and + --x-includes=DIR and --x-libraries=DIR (for non-standard X installations). + We recommend --prefix be set to a directory that will hold saord software + (e.g., --prefix=/soft/saord) in order to make management of our software + easier. + + NB: be sure to use only absolute path names (those starting with "/") + in the --prefix and --exec_prefix options. (The configure options we + use at SAO for various machines are given as examples in the script + file called "saoconfig" in this directory.) + + 2. Type `make' to compile the package. + This will create a library archive called libxpa.a. It also will create + the programs xpaget, xpaset, xpainfo, xpaaccess, xpans, and xpamb. It + also will create the libxpa.so shared object if requested using the + --enable-shared switch + + 3. You can build the libxpa.so shared library manually by executing: + + make shlib + + at this point. This will not contain Xt or Tcl routines. If Tcl support + has been enabled (see --with-tcl above), you can build a shared library + called libtclxpa.so that supports the tclxpa package (i.e. Tcl routines + are contained in it) by executing: + + make tclxpa + + This shared library will be loaded automatically with the Tcl command: + + package require tclxpa 2.1 + + assuming, of course, that your shared library can be found by Tcl. + + 4. Type "make install" to install XPA's libraries and binaries in + standard places. You'll need write permission on the installation + directories to do this. The installation directories are + determined by the "configure" script and may be specified with + the --prefix and --exec_prefix options to "configure". See the + Makefile for information on what directories were chosen; you + can override these choices by modifying the "prefix" and + "exec_prefix" variables in the Makefile. + + 5. There are .html help files in the doc directory. You can copy + these files to a more convenient location, if you like. We + did not automate this step because we did not know where to + copy these files by default. (NB: The help.html file is the + top level index file.) + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + +You also can use this facility to specify a compiler other than the default +gcc (if it exists). + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/lib', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH': + +e.g., + ./configure --prefix=/soft/saord + +Programs will be installed in /soft/saord/bin, libraries in /soft/saord/lib, +and include files in /soft/saord/include. We recommend this as a general rule, +in order to keep SAORD software in one place that does not conflict with other +installations. Note that you will need to add the bin directory to your path. + + You can specify separate installation prefixes for architecture-specific +files and architecture-independent files. If you give `configure' the option +`--exec-prefix=PATH', the package will use PATH as the prefix for installing +programs and libraries. Documentation and other data files will still use the +regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + +If you have questions, please contact us at: saord@cfa.harvard.edu. + + Eric Mandel diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a9c1e78 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +XPA is distributed under the terms of The MIT License (MIT), reproduced below. + +Copyright (c) 2014-2016 Smithsonian Institution + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..79c5fd9 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,558 @@ +# +# This file is a Makefile for XPA. If it has the name "Makefile.in" +# then it is a template for a Makefile; to generate the actual Makefile, +# run "./configure", which is a configuration script generated by the +# "autoconf" program (constructs like "@foo@" will get replaced in the +# actual Makefile. +# + +PACKAGE = @PACKAGE_NAME@ +VERSION = @PACKAGE_VERSION@ + +DISTNAME = xpa-${VERSION} +DISTDIR = ../export/${DISTNAME} +FTPDIR = ../ftp + +#---------------------------------------------------------------- +# Things you can change to personalize the Makefile for your own +# site (you can make these changes in either Makefile.in or +# Makefile, but changes to Makefile will get lost if you re-run +# the configuration script). +#---------------------------------------------------------------- + +# Default top-level directories in which to install architecture- +# specific files (exec_prefix) and machine-independent files such +# as scripts (prefix). The values specified here may be overridden +# at configure-time with the --exec-prefix and --prefix options +# to the "configure" script. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +# The following definition can be set to non-null for special systems +# like AFS with replication. It allows the pathnames used for installation +# to be different than those used for actually reference files at +# run-time. INSTALL_ROOT is prepended to $prefix and $exec_prefix +# when installing files. +INSTALL_ROOT = + +# Directory in which to install the .a or .so binary for the XPA library: +LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib + +# Directory in which to install the program wish: +BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin + +# Directory in which to install the include file xpa.h: +INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include + +# Top-level directory for manual entries: +MAN_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/man + +# Top-level directory for share entries: +MAN_SHARE_DIR = $(INSTALL_ROOT)$(prefix)/share/xpa + +# Platform-specific X compiler flags (include file specifications) +X_CFLAGS = @X_CFLAGS@ +# Platform-specific link directive for X libraries (-L specification) +X_LIBS = @X_LIBS@ +# Platform-specific libraries that must go before -lXt +X_PRE_LIBS = @X_PRE_LIBS@ +# Platform-specific libraries that must go after -lXt +X_EXTRA_LIBS = @X_EXTRA_LIBS@ + +# Platform-specific include files for Tcl +TCL_CFLAGS = @TCL_CFLAGS@ +# Platform-specific libraries for Tcl +TCL_LIBS = @TCL_LIBS@ + +# Platform-specific include files for Gtk +GTK_CFLAGS = @GTK_CFLAGS@ +# Platform-specific libraries for Gtk +GTK_LIBS = @GTK_LIBS@ + +# combine package cflags +PKG_CFLAGS = $(X_CFLAGS) $(TCL_CFLAGS) $(GTK_CFLAGS) + +# extra Libs required to link (e.g. socket libraries) +LIBS = @EXTRA_LIBS@ + +# pthread lib needed to xpans +TLIB = @TLIB@ + +# To change the compiler switches, for example to change from -O +# to -g, change the following line: +CFLAGS = @CFLAGS@ + +# To add ld switches, change the following line: +LDFLAGS = @LDFLAGS@ + +# Some versions of make, like SGI's, use the following variable to +# determine which shell to use for executing commands: +SHELL = /bin/sh + +# if enabled-shared was specified, this will exand to "shlib" and trigger +# building of the shared library +DOSHARED = @DOSHARED@ + +# There are just too many different versions of "install" around; +# better to use the install-sh script that comes with the distribution, +# which is slower but guaranteed to work. + +INSTALL = @srcdir@/install-sh -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 + +#---------------------------------------------------------------- +# The information below is modified by the configure script when +# Makefile is generated from Makefile.in. You shouldn't normally +# modify any of this stuff by hand. +#---------------------------------------------------------------- + +AC_FLAGS = @DEFS@ +RANLIB = @RANLIB@ +EXE = @EXEEXT@ + +#---------------------------------------------------------------- +# The information below should be usable as is. The configure +# script won't modify it and you shouldn't need to modify it +# either. +#---------------------------------------------------------------- +RM = rm -f + +CC = @CC@ + +CC_SWITCHES = -I. ${CFLAGS} ${AC_FLAGS} + +DEPEND_SWITCHES = -I. ${CFLAGS} ${PKG_CFLAGS} ${AC_FLAGS} + +SRCS = xpa.c xpaio.c command.c acl.c remote.c clipboard.c port.c \ + tcp.c client.c word.c xalloc.c find.c xlaunch.c timedconn.c \ + tclloop.c tcl.c xtloop.c gtkloop.c \ + xpaset.c xpaget.c xpainfo.c xpaaccess.c xpans.c xpamb.c + +BASE_OBJS = xpa.o xpaio.o command.o acl.o remote.o clipboard.o port.o \ + tcp.o client.o word.o xalloc.o find.o xlaunch.o timedconn.o + +TCL_OBJS = tclloop.o tcl.o + +XT_OBJS = xtloop.o + +GTK_OBJS = gtkloop.o + +INCL = xpa.h xpap.h + +# these are all the modules going into the "normal" xpa library +LIBOBJS = ${BASE_OBJS} ${TCL_OBJS} ${XT_OBJS} ${GTK_OBJS} +LIB = libxpa.a + +# used in link line +# LLIB= $(LIB) +LLIB= @LLIB@ + +PROGS = xpaset xpaget xpainfo xpaaccess xpans xpamb + +TESTPROGS = ctest stest rtest + +all: xpa.h lib $(PROGS) + +testall: $(TESTPROGS) + +All: all testall + +install:: install-binaries + +install:: $(DOSHARED)_install + +install:: install-man + +install:: install-share + +install:: install-data + +lib: $(LIB) $(DOSHARED) + +$(LIB): $(LIBOBJS) + $(RM) $(LIB) + ar crv $(LIB) $(LIBOBJS) + $(RANLIB) $(LIB) + +shlib: $(LIB) + @(rm -rf lib$(PACKAGE).tmp; mkdir lib$(PACKAGE).tmp; \ + (cd lib$(PACKAGE).tmp && ar x ../lib$(PACKAGE).a); \ + rm -f lib$(PACKAGE).tmp/xt*.o; \ + rm -f lib$(PACKAGE).tmp/tcl*.o; \ + CC='$(CC)' CXX=$(CXX) \ + ./mklib -o $(PACKAGE) lib$(PACKAGE).tmp/*.o; \ + rm -rf lib$(PACKAGE).tmp) + +mingw-dll: $(LIBOBJS) + $(CC) -I. -DHAVE_CONFIG_H -shared port.c tcp.c acl.c find.c \ + remote.c timedconn.c client.c word.c xpaio.c clipboard.c \ + xlaunch.c xalloc.c command.c xpa.c \ + -Wl,--output-def,libxpa.def,--out-implib,libxpa_dll.a,-no-undefined,--enable-runtime-pseudo-reloc -o libxpa.dll \ + -lwsock32 + +tclxpa: $(LIB) + @(rm -rf libtclxpa.tmp; mkdir libtclxpa.tmp; \ + (cd libtclxpa.tmp && ar x ../lib$(PACKAGE).a); \ + rm -f libtclxpa.tmp/xt*.o; \ + CC='$(CC)' CXX=$(CXX) \ + ./mklib -o tclxpa libtclxpa.tmp/*.o $(TCL_LIBS); \ + test -r libtclxpa.dylib && cp -p libtclxpa.dylib libtclxpa.so && echo "copying libtclxpa.dylib to libtclxpa.so"; \ + rm -rf libtclxpa.tmp) + +diff: + -(for f in `ls *.c`; \ + do \ + echo $$f; \ + diff /soft/saord/xpa-2.1.[0-9]*/$$f .; \ + done); + +index: $(LIB) + @(test -r pkgIndex.tcl && mv pkgIndex.tcl pkgIndex.tcl-old; \ + echo "pkg_mkIndex -direct -verbose . libtclxpa.so; exit"| tclsh) + +xpaset: $(LIB) xpaset.o + $(CC) $(LDFLAGS) xpaset.o -o xpaset $(LLIB) $(LIBS) + +xpaget: $(LIB) xpaget.o + $(CC) $(LDFLAGS) xpaget.o -o xpaget $(LLIB) $(LIBS) + +xpainfo: $(LIB) xpainfo.o + $(CC) $(LDFLAGS) xpainfo.o -o xpainfo $(LLIB) $(LIBS) + +xpaaccess: $(LIB) xpaaccess.o + $(CC) $(LDFLAGS) xpaaccess.o -o xpaaccess $(LLIB) $(LIBS) + +xpans: $(LIB) xpans.o + $(CC) $(LDFLAGS) xpans.o -o xpans $(LLIB) $(LIBS) $(TLIB) + +xpamb: $(LIB) xpamb.o + $(CC) $(LDFLAGS) xpamb.o -o xpamb $(LLIB) $(LIBS) + +ctest: $(LIB) ctest.o + $(CC) $(LDFLAGS) ctest.o -o ctest $(LLIB) $(LIBS) + +stest: $(LIB) stest.o + $(CC) $(LDFLAGS) stest.o -o stest $(LIB) $(LIBS) + +rtest: $(LIB) rtest.o + $(CC) $(LDFLAGS) rtest.o -o rtest $(LIB) $(LIBS) + +stestx: $(LIB) stest.o + $(CC) $(LDFLAGS) stest.o -o stest $(LIB) \ + $(X_LIBS) -lXt $(X_PRE_LIBS) -lXext -lX11 $(LIBS) + +# Smoke test: allows end-users to quickly discern basic usability +smoke: ctest stest + ./stest smoke & + sleep 3 + ./ctest -e -b -l 1000 smoke + ./xpaset -p smoke exit + +# Note: before running ranlib below, must cd to target directory because +# some ranlibs write to current directory, and this might not always be +# possible (e.g. if installing as root). + +# this nop-op gets executed if we are not building shared libraries +_install: + +shlib_install: + @-(for i in `ls *.so* *.dylib *.sl 2>/dev/null` ; \ + do \ + if [ -h $$i ] ; then \ + echo "Installing link $$i" ; \ + tar cf - $$i | (cd $(LIB_INSTALL_DIR); tar xf -) ; \ + else \ + echo "Installing $$i" ; \ + $(INSTALL_DATA) $$i $(LIB_INSTALL_DIR)/$$i ; \ + chmod 555 $(LIB_INSTALL_DIR)/$$i; \ + fi; \ + done;) + +install-binaries: $(LIB) $(PROGS) + @for i in $(LIB_INSTALL_DIR) $(INCLUDE_INSTALL_DIR) $(BIN_INSTALL_DIR) ; \ + do \ + if [ ! -d $$i ] ; then \ + echo "Making directory $$i"; \ + mkdir $$i; \ + chmod 755 $$i; \ + else true; \ + fi; \ + done; + @echo "Installing $(LIB)"; + @$(INSTALL_DATA) $(LIB) $(LIB_INSTALL_DIR)/$(LIB); + @(cd $(LIB_INSTALL_DIR); $(RANLIB) $(LIB)); + @chmod 555 $(LIB_INSTALL_DIR)/$(LIB); + @echo "Installing xpa.h" + @$(INSTALL_DATA) xpa.h $(INCLUDE_INSTALL_DIR)/xpa.h + @echo "Installing prsetup.h" + @$(INSTALL_DATA) prsetup.h $(INCLUDE_INSTALL_DIR)/prsetup.h + @for i in $(PROGS) ; \ + do \ + echo "Installing $$i$(EXE)" ; \ + $(INSTALL_PROGRAM) $$i$(EXE) $(BIN_INSTALL_DIR)/$$i$(EXE) ; \ + done; + +install-man: + @if [ ! -d $(MAN_INSTALL_DIR) ] ; then \ + echo "Making directory $(MAN_INSTALL_DIR)"; \ + mkdir $(MAN_INSTALL_DIR); \ + chmod 755 $(MAN_INSTALL_DIR); \ + else true; \ + fi; + @-(for i in `ls ./man/man?/*.?` ; \ + do \ + B=`basename $$i`; \ + E=`echo $$i | awk -F. '{print $$NF}'`; \ + M="$(MAN_INSTALL_DIR)/man$$E"; \ + if [ ! -d $$M ] ; then \ + echo "Making directory $$M"; \ + mkdir $$M; \ + chmod 755 $$M; \ + else true; \ + fi; \ + echo "Installing $$B" ; \ + $(INSTALL_DATA) $$i $$M/$$B; \ + done;) + +install-share: + @if [ ! -d $(MAN_SHARE_DIR) ] ; then \ + echo "Making directory $(MAN_SHARE_DIR)"; \ + mkdir -p $(MAN_SHARE_DIR); \ + chmod 755 $(MAN_SHARE_DIR); \ + else true; \ + fi; + @-(for i in `ls ./doc/sman/xpa?.*` ; \ + do \ + B=`basename $$i`; \ + echo "Installing $$B" ; \ + $(INSTALL_DATA) $$i $(MAN_SHARE_DIR)/$$B; \ + done;) + +install-data: install-pkgconfig + +install-pkgconfig: + @-(mkdir -p $(LIB_INSTALL_DIR)/pkgconfig; \ + echo "Installing xpa.pc" ; \ + $(INSTALL_DATA) xpa.pc $(LIB_INSTALL_DIR)/pkgconfig;) + +Makefile: Makefile.in + $(SHELL) config.status + +clean: + $(RM) *.a *.so *.so.* *.dylib *.o *.exe core \ + errs *pure* .nfs* \ + foo* *~ *.log \#* TAGS *.E a.out errors \ + $(PROGS) $(TESTPROGS) \ + gmon.out *.pg *.bak \ + config.info config.log \ + doc/*~ doc/*.bak man/*~ + $(RM) -r autom4te.cache a.out.dSYM + +distclean: clean + $(RM) Makefile config.status config.cache config.log conf.h \ + xpa.pc + +maintainer-clean:: clean + $(RM) config.status config.cache config.log + +depend: + makedepend -- $(DEPEND_SWITCHES) -- $(SRCS) + +acl.o: acl.c $(INCL) + $(CC) -c $(CC_SWITCHES) acl.c + +remote.o: remote.c $(INCL) + $(CC) -c $(CC_SWITCHES) remote.c + +clipboard.o: clipboard.c $(INCL) + $(CC) -c $(CC_SWITCHES) clipboard.c + +client.o: client.c $(INCL) + $(CC) -c $(CC_SWITCHES) client.c + +command.o: command.c $(INCL) + $(CC) -c $(CC_SWITCHES) command.c + +find.o: find.c + $(CC) -c $(CC_SWITCHES) find.c + +xlaunch.o: xlaunch.c + $(CC) -c $(CC_SWITCHES) xlaunch.c + +timedconn.o: timedconn.c + $(CC) -c $(CC_SWITCHES) timedconn.c + +port.o: port.c $(INCL) + $(CC) -c $(CC_SWITCHES) port.c + +tcl.o: tcl.c $(INCL) + $(CC) -c $(CC_SWITCHES) $(TCL_CFLAGS) tcl.c + +tclloop.o: tclloop.c $(INCL) + $(CC) -c $(CC_SWITCHES) $(TCL_CFLAGS) tclloop.c + +gtkloop.o: gtkloop.c $(INCL) + $(CC) -c $(CC_SWITCHES) $(GTK_CFLAGS) gtkloop.c + +tcp.o: tcp.c + $(CC) -c $(CC_SWITCHES) tcp.c + +word.o: word.c + $(CC) -c $(CC_SWITCHES) word.c + +xalloc.o: xalloc.c + $(CC) -c $(CC_SWITCHES) xalloc.c + +xpa.o: xpa.c $(INCL) + $(CC) -c $(CC_SWITCHES) xpa.c + +xpaio.o: xpaio.c $(INCL) + $(CC) -c $(CC_SWITCHES) xpaio.c + +xtloop.o: xtloop.c $(INCL) + $(CC) -c $(CC_SWITCHES) $(X_CFLAGS) xtloop.c + +xpaaccess.o: xpaaccess.c $(INCL) + $(CC) -c $(CC_SWITCHES) xpaaccess.c + +xpaget.o: xpaget.c $(INCL) + $(CC) -c $(CC_SWITCHES) xpaget.c + +xpainfo.o: xpainfo.c $(INCL) + $(CC) -c $(CC_SWITCHES) xpainfo.c + +xpans.o: xpans.c $(INCL) + $(CC) -c $(CC_SWITCHES) xpans.c + +xpamb.o: xpamb.c $(INCL) + $(CC) -c $(CC_SWITCHES) xpamb.c + +xpaset.o: xpaset.c $(INCL) + $(CC) -c $(CC_SWITCHES) xpaset.c + +ctest.o: ctest.c + $(CC) -c $(CC_SWITCHES) ctest.c + +stest.o: stest.c + $(CC) -c $(CC_SWITCHES) $(X_CFLAGS) stest.c + +rtest.o: rtest.c + $(CC) -c $(CC_SWITCHES) $(X_CFLAGS) rtest.c + +stestx.o: stest.c + $(CC) -o stest.o -c $(CC_SWITCHES) $(X_CFLAGS) \ + -DBUILD_WITH_XT stest.c + +strstr.o: ./compat/strstr.c + $(CC) -c $(CC_SWITCHES) -o strstr.o ./compat/strstr.c + +xpa.h: configure.ac + @($(RM) -r oxpa.h; \ + MAJOR=`echo "${VERSION}" | awk -F. '{print $$1}'`; \ + MINOR=`echo "${VERSION}" | awk -F. '{print $$2}'`; \ + PATCH=`echo "${VERSION}" | awk -F. '{print $$3}'`; \ + sed "s/^#define XPA_VERSION.*/#define XPA_VERSION \"$(VERSION)\"/;s/^#define XPA_MAJOR_VERSION.*/#define XPA_MAJOR_VERSION $${MAJOR}/;s/^#define XPA_MINOR_VERSION.*/#define XPA_MINOR_VERSION $${MINOR}/;s/^#define XPA_PATCH_LEVEL.*/#define XPA_PATCH_LEVEL $${PATCH}/;" < xpa.h > nxpa.h; \ + mv xpa.h oxpa.h; \ + mv nxpa.h xpa.h) + +configure: configure.ac + autoconf + +dist: configure + ($(RM) -r $(DISTDIR); \ + mkdir $(DISTDIR); \ + cp -p *.[ch] *.tcl $(DISTDIR)/.; \ + cp -p pkgIndex.tcl $(DISTDIR)/.; \ + cp -p Makefile.in $(DISTDIR)/.; \ + chmod 664 $(DISTDIR)/Makefile.in; \ + cp -p conf.h.in $(DISTDIR)/.; \ + chmod 664 $(DISTDIR)/conf.h.in; \ + cp -p configure.ac $(DISTDIR)/.; \ + chmod 644 $(DISTDIR)/configure.ac; \ + cp -p *.m4 $(DISTDIR)/.; \ + chmod 644 $(DISTDIR)/*.m4; \ + cp -p configure $(DISTDIR)/.; \ + chmod 755 $(DISTDIR)/configure; \ + cp -p config.sub config.guess $(DISTDIR)/.; \ + chmod 755 $(DISTDIR)/config.sub $(DISTDIR)/config.guess; \ + cp -p saoconfig $(DISTDIR)/.; \ + chmod 755 $(DISTDIR)/saoconfig; \ + cp -p mklib $(DISTDIR)/.; \ + chmod 755 $(DISTDIR)/mklib; \ + cp -p install-sh $(DISTDIR)/install-sh; \ + chmod 755 $(DISTDIR)/install-sh; \ + cp -p README INSTALL COPYING $(DISTDIR)/.; \ + mkdir $(DISTDIR)/doc; \ + cp -p ./doc/*.html $(DISTDIR)/doc/.; \ + cp -p ./doc/*.ps ./doc/*.pdf $(DISTDIR)/doc/.; \ + cp -p ./doc/Makefile $(DISTDIR)/doc/.; \ + mkdir $(DISTDIR)/doc/sman; \ + cp -p ./doc/sman/* $(DISTDIR)/doc/sman/.; \ + mkdir $(DISTDIR)/man; \ + cp -p -R ./man/* $(DISTDIR)/man/.) + +release: dist + (cd $(DISTDIR); cd ..; \ + tar cf - $(DISTNAME) | \ + gzip -9 -c > $(FTPDIR)/$(DISTNAME).tar.gz) + +tar: + ($(RM) config.cache; \ + cd ..; \ + tar cf - $(DISTNAME) | gzip -9 -c > $(DISTNAME).tar.gz) + +errcheck: + @-egrep 'error|warning' foo + +itar: + (cd doc/sman; \ + tar cf - . | gzip -9 -c > ../../../$(DISTNAME)-iman.tar.gz) + +sman: + @(cd doc && $(MAKE) index) + +docs: + @(cd doc; $(MAKE)) + +pure: xpaset.pure xpaget.pure xpainfo.pure xpaaccess.pure \ + xpans.pure xpamb.pure ctest.pure stest.pure rtest.pure + +xpaset.pure: $(LIB) xpaset.o + purify $(CC) $(LDFLAGS) xpaset.o -o xpaset.pure \ + $(LLIB) $(LIBS) + +xpaget.pure: $(LIB) xpaget.o + purify $(CC) $(LDFLAGS) xpaget.o -o xpaget.pure \ + $(LLIB) $(LIBS) + +xpainfo.pure: $(LIB) xpainfo.o + purify $(CC) $(LDFLAGS) xpainfo.o -o xpainfo.pure \ + $(LLIB) $(LIBS) + +xpaaccess.pure: $(LIB) xpaaccess.o + purify $(CC) $(LDFLAGS) xpaaccess.o -o xpaaccess.pure \ + $(LLIB) $(LIBS) + +xpans.pure: $(LIB) xpans.o + purify $(CC) $(LDFLAGS) xpans.o -o xpans.pure \ + $(LLIB) $(LIBS) $(TLIB) + +xpamb.pure: $(LIB) xpamb.o + purify $(CC) $(LDFLAGS) xpamb.o -o xpamb.pure \ + $(LLIB) $(LIBS) + +ctest.pure: $(LIB) ctest.o + purify $(CC) $(LDFLAGS) ctest.o -o ctest.pure \ + $(LLIB) $(LIBS) + +stest.pure: $(LIB) stest.o + purify $(CC) $(LDFLAGS) stest.o -o stest.pure $(LIB) \ + $(X_LIBS) -lXt $(X_PRE_LIBS) -lXext -lX11 $(LIBS) + +rtest.pure: $(LIB) rtest.o + purify $(CC) $(LDFLAGS) rtest.o -o rtest.pure \ + $(LLIB) $(LIBS) + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/README b/README new file mode 100644 index 0000000..08a4bcb --- /dev/null +++ b/README @@ -0,0 +1,43 @@ +This is the directory for XPA 2.0. + +The XPA messaging system provides seamless communication between many +kinds of Unix programs, including X programs and Tcl/Tk programs. It +also provides an easy way for users to communicate with XPA-enabled +programs by executing XPA client commands in the shell or by utilizing +such commands in scripts. Because XPA works both at the programming +level and the shell level, it is a powerful tool for unifying any +analysis environment: users and programmers have great flexibility in +choosing the best level or levels at which to access XPA services, and +client access can be extended or modified easily at any time. + +A program becomes an XPA-enabled server by defining named points of +public access through which data and commands can be exchanged with +other client programs (and users). Using standard TCP sockets as a +transport mechanism, XPA supports both single-point and broadcast +messaging to and from these servers. It supports direct communication +between clients and servers, or indirect communication via an +intermediate message bus emulation program. Host-based access control +is implemented, as is as the ability to communicate with XPA servers +across a network. + +XPA implements a layered interface that is designed to be useful both +to software developers and to users. The interface consists of a +library of XPA client and server routines for use in C/C++ programs and +a suite of high-level user programs built on top of these libraries. +Using the XPA library, access points can be added to Tcl/Tk programs, +Xt programs, or to Unix programs that use the XPA event loop or any +event loop based on select(). Client access subroutines can be added +to any Tcl/Tk, Xt, or Unix program. Client access also is supported at +the command line via a suite of high-level programs. + +To build XPA, see the INSTALL instructions (which are based on +standard instructions for building software using GNU configure). + +Documentation for XPA is contained in the doc subdirectory (where the +help.html file is the top-level index). + +If you have questions, please contact us at: saord@cfa.harvard.edu. + + Eric Mandel + +XPA is distributed under the terms of The MIT License. diff --git a/acl.c b/acl.c new file mode 100644 index 0000000..24b4489 --- /dev/null +++ b/acl.c @@ -0,0 +1,568 @@ +/* + * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory + */ + +/* + * + * acl.c -- xpa access control list management + * + */ + +#include + +/* + *---------------------------------------------------------------------------- + * + * + * Private Routines + * + * + *---------------------------------------------------------------------------- + */ + +/* this is the head of the global list -- too lazy to do anything more */ +static XACL aclhead=NULL; + +#ifdef ANSI_FUNC +static XACL +XPAAclLookup (char *xclass, char *name, unsigned int ip, int exact) +#else +static XACL XPAAclLookup(xclass, name, ip, exact) + char *xclass; + char *name; + unsigned int ip; + int exact; +#endif +{ + XACL cur; + /* look for exact match */ + for(cur=aclhead; cur!=NULL; cur=cur->next){ + if( !strcmp(xclass, cur->xclass) && + !strcmp(name, cur->name) && + ((cur->ip == 0) || (cur->ip == ip)) ){ + return(cur); + } + } + /* otherwise look for a template match (unless exact was specified) */ + if( !exact ){ + for(cur=aclhead; cur!=NULL; cur=cur->next){ + if( tmatch(xclass, cur->xclass) && + tmatch(name, cur->name) && + ((cur->ip == 0) || (cur->ip == ip)) ){ + return(cur); + } + } + } + return(NULL); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAAclParse + * + * Purpose: parse acl list into components + * + * Returns: 0 on success, -1 on failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAAclParse (char *lbuf, char *xclass, char *name, unsigned int *ip, + char *acl, int len) +#else +static int XPAAclParse(lbuf, xclass, name, ip, acl, len) + char *lbuf; + char *xclass; + char *name; + unsigned int *ip; + char *acl; + int len; +#endif +{ + char tbuf[SZ_LINE]; + int lp=0; + + /* class:name is required */ + if( word(lbuf, tbuf, &lp) ){ + XPAParseName(tbuf, xclass, name, len); + } + else + return(-1); + + /* host is required but can be "*" for "all hosts" */ + if( word(lbuf, tbuf, &lp) ){ + if( !strcmp(tbuf, "*") ) + *ip = 0; + else + *ip = gethostip(tbuf); + } + else + return(-1); + + /* acl is required */ + if( word(lbuf, tbuf, &lp) ){ + if( !strcmp(tbuf, "+") ) + strcpy(acl, XPA_ACLS); + else if( !strcmp(tbuf, "-") ) + *acl = '\0'; + else + strcpy(acl, tbuf); + return(0); + } + else + return(-1); +} + +/* + *---------------------------------------------------------------------------- + * + * + * Semi-Public Routines (used by command.c) + * + * + *---------------------------------------------------------------------------- + */ + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAReceiveAcl + * + * Purpose: add or modify the acl for this access point + * + * Returns: 0 for success, -1 for failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAReceiveAcl (void *client_data, void *call_data, char *paramlist, + char *buf, size_t len) +#else +int XPAReceiveAcl(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char *buf; + size_t len; +#endif +{ + XPA xpa = (XPA)call_data; + XPAComm comm; + int i; + int got; + char *s=NULL; + char lbuf[SZ_LINE]; + char tbuf[SZ_LINE]; + + if( paramlist && *paramlist ){ + s = paramlist; + while( isspace((int)*s) ) + s++; + snprintf(tbuf, SZ_LINE, "%s:%s %s\n", xpa->xclass, xpa->name, s); + if( XPAAclEdit(tbuf) < 0 ){ + snprintf(lbuf, SZ_LINE, "invalid acl: %s\n", tbuf); + XPAError(xpa, lbuf); + return(-1); + } + } + else{ + while((XPAGets(xpa, xpa_datafd(xpa), lbuf, SZ_LINE, XPAShortTimeout())>0)&& + *lbuf ){ + snprintf(tbuf, SZ_LINE, "%s:%s %s\n", xpa->xclass, xpa->name, lbuf); + got = XPAAclEdit(tbuf); + if( got < 0 ){ + snprintf(lbuf, SZ_LINE, "invalid acl: %s\n", tbuf); + XPAError(xpa, lbuf); + return(-1); + } + } + } + + /* reset all acl flags for this xpa so acl is recalculated */ + for(comm=xpa->commhead; comm!=NULL; comm=comm->next){ + for(i=0; i<4; i++){ + comm->acl[i] = -1; + } + } + + return(0); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPASendAcl + * + * Purpose: return the acl for this access point + * + * Returns: 0 for success, -1 for failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPASendAcl (void *client_data, void *call_data, char *paramlist, + char **buf, size_t *len) +#else +int XPASendAcl(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char **buf; + size_t *len; +#endif +{ + XPA xpa = (XPA)call_data; + XACL cur; + int got = 0; + char tbuf[SZ_LINE]; + + /* zero all flags */ + for(cur=aclhead; cur!=NULL; cur=cur->next){ + cur->flag = 0; + } + /* look for exact matches */ + for(cur=aclhead; cur!=NULL; cur=cur->next){ + if(!strcmp(xpa->xclass, cur->xclass) && !strcmp(xpa->name, cur->name)){ + snprintf(tbuf, SZ_LINE, "%s:%s %s %s\n", + cur->xclass, cur->name, getiphost(cur->ip), cur->acl); + send(xpa_datafd(xpa), tbuf, strlen(tbuf), 0); + cur->flag = 1; + got++; + } + } + /* look for template matches that we have not printed yet */ + for(cur=aclhead; cur!=NULL; cur=cur->next){ + if( cur->flag == 0 ){ + if(tmatch(xpa->xclass, cur->xclass) && tmatch(xpa->name, cur->name)){ + snprintf(tbuf, SZ_LINE, "%s:%s %s %s\n", + cur->xclass, cur->name, getiphost(cur->ip), cur->acl); + send(xpa_datafd(xpa), tbuf, strlen(tbuf), 0); + got++; + } + } + } + /* zero all flags */ + for(cur=aclhead; cur!=NULL; cur=cur->next){ + cur->flag = 0; + } + if( got == 0 ){ + send(xpa_datafd(xpa), "\n", 1, 0); + } + return(0); +} + +/* + *---------------------------------------------------------------------------- + * + * + * Public Routines + * + * + *---------------------------------------------------------------------------- + */ + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAAclEdit + * + * Purpose: add or modify acl entry in the xpa acl list + * + * Returns: 0 on success, -1 on failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAAclEdit (char *lbuf) +#else +int XPAAclEdit(lbuf) + char *lbuf; +#endif +{ + XACL cur; + char xclass[SZ_LINE]; + char name[SZ_LINE]; + char acl[SZ_LINE]; + unsigned int ip; + + if( XPAAclParse(lbuf, xclass, name, &ip, acl, SZ_LINE) < 0 ) + return(-1); + if( ip == 0 ) + return(-1); + cur = XPAAclLookup(xclass, name, ip, 1); + if( cur == NULL ) + return(XPAAclAdd(lbuf)); + else{ + if( *acl == '\0' ){ + XPAAclDel(cur); + } + else{ + if( cur->acl ) + xfree(cur->acl); + cur->acl = xstrdup(acl); + } + return(0); + } +} + + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAAclAdd + * + * Purpose: add one acl entry to the xpa acl list + * + * Returns: 0 on success, -1 on failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAAclAdd (char *lbuf) +#else +int XPAAclAdd(lbuf) + char *lbuf; +#endif +{ + XACL xnew; + XACL cur; + char xclass[SZ_LINE]; + char name[SZ_LINE]; + char acl[SZ_LINE]; + unsigned int ip; + + /* allocate acl struct */ + if( (xnew = (XACL)xcalloc(1, sizeof(XACLRec))) == NULL ) + goto error; + + /* parse info from line buffer */ + if( XPAAclParse(lbuf, xclass, name, &ip, acl, SZ_LINE) < 0 ) + goto error; + + /* fill in the blanks */ + xnew->xclass = xstrdup(xclass); + xnew->name = xstrdup(name); + xnew->ip = ip; + xnew->acl = xstrdup(acl); + + /* add this acl to end of list of acl's */ + if( aclhead == NULL ){ + aclhead = xnew; + } + else{ + for(cur=aclhead; cur->next!=NULL; cur=cur->next) + ; + cur->next = xnew; + } + return(0); + +error: + if( xnew ) + xfree(xnew); + return(-1); +} + +/* + *--------------------------------------------------------------------------- + * + * Routine: XPAAclDel + * + * Purpose: free up memory in the acl record structure + * + * Results: 0 on success, -1 for failure + * + *--------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAAclDel (XACL acl) +#else +int XPAAclDel(acl) + XACL acl; +#endif +{ + XACL cur; + + if( acl == NULL ) + return(-1); + + /* remove from list of acl's */ + if( aclhead ){ + if( aclhead == acl ){ + aclhead = aclhead->next; + } + else{ + for(cur=aclhead; cur!=NULL; cur=cur->next){ + if( cur->next == acl ){ + cur->next = (cur->next)->next; + break; + } + } + } + } + + /* free up string space */ + if( acl->xclass ) xfree(acl->xclass); + if( acl->name ) xfree(acl->name); + if( acl->acl ) xfree(acl->acl); + + /* free up record struct */ + xfree((char *)acl); + return(0); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAAclFree + * + * Purpose: + * + * Results: 1 on success, 0 for failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +void +XPAAclFree (void) +#else +void XPAAclFree() +#endif +{ + XACL cur, tacl; + + for(cur=aclhead; cur!=NULL; ){ + tacl = cur->next; + XPAAclDel(cur); + cur = tacl; + } +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAAclNew + * + * Purpose: read or re-read the acl list + * + * Results: number of lines in list (including default) + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAAclNew (char *aname, int flag) +#else +int XPAAclNew(aname, flag) + char *aname; + int flag; +#endif +{ + int got=0; + char lbuf[SZ_LINE]; + char hostname[SZ_LINE]; + char *s; + char *obuf; + char *aclname=NULL; + char *aclpath=NULL; + char *defacl=NULL; + char *defcopy=NULL; + char *keywords[10]; + char *values[10]; + int nkeys; + FILE *fp=NULL; + + /* if there is an old list, free it */ + if( flag == 0 ) + XPAAclFree(); + + /* get acl file name */ + if( aname && *aname ) + aclname = aname; + else if( (aclname=(char *)getenv("XPA_ACLFILE")) == NULL ) + aclname = XPA_ACLFILE; + + /* get the default acl */ + if( (defacl=(char *)getenv("XPA_DEFACL")) == NULL ) + defacl = XPA_DEFACL; + + /* macro-expand it to deal with the host name */ + gethost(hostname, SZ_LINE); + nkeys = 0; + keywords[0] = "host"; values[0] = hostname; nkeys++; + + /* open the acl file */ + if( (aclpath=(char *)Access(aclname, "r")) != NULL ){ + if( (fp=fopen(aclpath, "r")) != NULL ){ + while( fgets(lbuf, SZ_LINE, fp) ){ + if( *lbuf == '#' ){ + continue; + } + if( (obuf=macro(lbuf, keywords, values, nkeys, NULL, NULL)) != NULL ){ + if( XPAAclAdd(obuf) == 0 ) + got++; + xfree(obuf); + } + } + fclose(fp); + } + xfree(aclpath); + } + + /* add default acl (it very likely was overridden in the file) */ + defcopy=(char *)xstrdup(defacl); + for(s=(char *)strtok(defcopy,";"); s!=NULL; s=(char *)strtok(NULL,";")){ + if( (obuf = macro(s, keywords, values, nkeys, NULL, NULL)) != NULL ){ + if( XPAAclAdd(obuf) == 0 ) + got++; + xfree(obuf); + } + } + if( defcopy) xfree(defcopy); + + /* return the news */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAAclCheck + * + * Purpose: validate an acl for a given class, name, and host + * + * Results: 1 on success, 0 on failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAAclCheck (XPA xpa, unsigned int ip, char *acl) +#else +int XPAAclCheck(xpa, ip, acl) + XPA xpa; + unsigned int ip; + char *acl; +#endif +{ + char *s; + XACL cur; + + if( !(cur = XPAAclLookup(xpa->xclass, xpa->name, ip, 0)) ) + return(0); + else if( cur->acl == NULL ) + return(0); + else{ + for(s=acl; *s; s++){ + if( !strchr(cur->acl, *s) ) + return(0); + } + return(1); + } +} diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..bc7540d --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1 @@ +builtin(include,tcl.m4) diff --git a/client.c b/client.c new file mode 100644 index 0000000..f70ff40 --- /dev/null +++ b/client.c @@ -0,0 +1,3057 @@ +/* + * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory + */ + +#include + +/* + *---------------------------------------------------------------------------- + * + * + * Private Routines and Data + * + * + *---------------------------------------------------------------------------- + */ + +/* this is the head of the global list of client xpas */ +static XPA xpaclienthead=NULL; + +static char errbuf[SZ_LINE]; /* holds current error message */ +static int id=0; /* id of current command */ + +#define DATA_CONNECT 1 +#define DATA_ACCEPT 2 +#define DATA_DATA 4 + +/* use of a double fork() call is used to prevent zombies which happen + if fork is a child of xpans started by an XPA server (i.e., for some + reason, the SIGCHLD signal does not get sent to xpans parent) + See Stevens, Advanced Programming in te Unix Environment, p. 202 */ +#define USE_DOUBLE_FORK 1 +#ifndef USE_DOUBLE_FORK +#ifdef ANSI_FUNC +void sig_chld(int signo) +#else +#endif +{ + int stat; + + while(waitpid(-1, &stat, WNOHANG) > 0){ + ; + } + return; +} +#endif + +/* + *---------------------------------------------------------------------------- + * + * Routine: rdl + * + * Purpose: read characters up a new-line + * + * Returns: number of characters read + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +rdl (int fd, char *buf, size_t len) +#else +static int rdl(fd, buf, len) + int fd; + char *buf; + int len; +#endif +{ + int i=0; + int got; + + /* start out clean */ + *buf = '\0'; + + /* make sure we have a valid channel */ + if( fd < 0 ) + return(-1); + + /* grab characters up to a new-line or max len */ + while( i < (len-1) ){ + got = read(fd, &(buf[i]), 1); + if( got < 1 ) + break; + else if( buf[i++] == '\n' ) + break; + } + buf[i] = '\0'; + return(i); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAProxyAccept + * + * Purpose: accept a connection from an XPA proxy server + * + * Return: fd of accepted connection or -1 + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static +int XPAProxyAccept(XPA xpa, char *method, char *xclass, char *name, int ifd, + unsigned int *rip, unsigned short *rport, char *rname) +#else +static +int XPAProxyAccept(xpa, method, xclass, name, ifd, rip, rport, rname) + XPA xpa; + char *method; + char *xclass; + char *name; + int ifd; + unsigned int *rip; + unsigned short *rport; + char *rname; +#endif +{ + int sock; + int got; + int oum; + int ofd; + int niter; + int swidth=FD_SETSIZE; + int keep_alive=1; + int reuse_addr=1; + unsigned int ip; + unsigned short port; + char tbuf[SZ_LINE]; + char amethod[SZ_LINE]; + char *tptr; + socklen_t slen; + struct sockaddr_in sock_in; +#if HAVE_SYS_UN_H + struct sockaddr_un sock_un; +#endif + struct timeval tv; + struct timeval *tvp; + fd_set readfds; + + /* initialize results */ + if( rip ) *rip = 0; + if( rport ) *rport = 0; + if( rname ) *rname = '\0'; + + switch(XPAMethod(method)){ + case XPA_INET: + if( !XPAParseIpPort(method, &ip, &port) ){ + goto error; + } + /* open a socket for data connections */ + if( (sock = xsocket(AF_INET, SOCK_STREAM, 0)) < 0 ){ + PERROR(("xpaaccept socket")); + goto error; + } + setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, + (char *)&keep_alive, sizeof(keep_alive)); + setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, + (char *)&reuse_addr, sizeof(reuse_addr)); + memset((char *)&sock_in, 0, sizeof(sock_in)); + sock_in.sin_family = AF_INET; + sock_in.sin_addr.s_addr = htonl(INADDR_ANY); + sock_in.sin_port = htons(port); + /* bind to the ip:port */ + if( xbind(sock, (struct sockaddr *)&sock_in, sizeof(sock_in)) < 0 ){ + PERROR(("xpaaccept bind")); + xclose(sock); + goto error; + } + snprintf(amethod, SZ_LINE, "%x:%d", ip, port); + break; +#if HAVE_SYS_UN_H + case XPA_UNIX: + ip = 0; + port = 0; + /* get filename part, composed of class and name and unique id */ + snprintf(tbuf, SZ_LINE, "%s_%s.%d", xclass, name, (int)time(NULL)); + /* change "/" to "_" for filename */ + for(tptr = tbuf; *tptr != '\0'; tptr++){ + if( *tptr == '/' ) *tptr = '_'; + } + /* create full pathname */ + snprintf(amethod, SZ_LINE, "%s/%s", XPATmpdir(), tbuf); + /* delete old copy */ + unlink (amethod); + /* open a socket and fill in socket information */ + if( (sock = xsocket(AF_UNIX, SOCK_STREAM, 0)) < 0 ){ + goto error; + } + setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, + (char *)&keep_alive, sizeof(keep_alive)); + memset((char *)&sock_un, 0, sizeof(sock_un)); + sock_un.sun_family = AF_UNIX; + strcpy(sock_un.sun_path, amethod); + /* unset umask so that everyone can read and write */ + oum = umask(0); + /* bind to the file */ + got = xbind(sock, (struct sockaddr *)&sock_un, sizeof(sock_un)); + /* reset umask to previous */ + umask(oum); + /* now check for bind error */ + if( got < 0 ){ + xclose(sock); + goto error; + } + break; +#endif + default: + goto error; + } + + /* send port to client so they can connect */ + /* first listen for the connection */ + if( listen(sock, XPA_MAXLISTEN) < 0 ){ + PERROR(("xpaaccept listen")); + xclose(sock); + goto error; + } + + /* and tell the client that we are listening */ + snprintf(tbuf, SZ_LINE, "xpaaccept %s (%s:%s %s)\n", + amethod, xclass, name, method); + FPRINTF((stderr, "%sXPAProxyAccept: sending command to %d:\n%s", + _sp, ifd, tbuf)); + if( XPAPuts(NULL, ifd, tbuf, XPAShortTimeout()) <= 0 ){ + PERROR(("client xpaaccept write")); + xclose(sock); + goto error; + } + + /* we will iterate on xselect */ + if( XPAShortTimeout() > 0 ) + niter = XPAShortTimeout()*100; + else + niter = XPA_SHORT_TIMEOUT*100; +again: + /* this has to be able to time out */ + tv.tv_sec = 0; + tv.tv_usec = 10000; + tvp = &tv; + /* wait for this socket and XPA sockets */ + FD_ZERO(&readfds); + FD_SET(sock, &readfds); + XPAAddSelect(NULL, &readfds); + /* wait for the connection */ + got = xselect(swidth, &readfds, NULL, NULL, tvp); + /* process results of select */ + if( got > 0 ){ + if( !FD_ISSET(sock, &readfds)){ + XPAProcessSelect(&readfds, 0); + goto again; + } + switch(XPAMethod(method)){ + case XPA_INET: + while( 1 ){ + slen = sizeof(struct sockaddr_in); + if((ofd=xaccept(sock, (struct sockaddr *)&sock_in, &slen)) >= 0){ + break; + } + else{ + if( xerrno == EINTR ) + continue; + else{ + PERROR(("xpaaccept acccept")); + xclose(sock); + goto error; + } + } + } + break; +#if HAVE_SYS_UN_H + case XPA_UNIX: + while( 1 ){ + slen = sizeof(struct sockaddr_un); + if((ofd=xaccept(sock, (struct sockaddr *)&sock_un, &slen)) >= 0){ + break; + } + else{ + if( xerrno == EINTR ) + continue; + else{ + PERROR(("xpaaccept acccept")); + xclose(sock); + goto error; + } + } + } + break; +#endif + default: + xclose(sock); + goto error; + } + } + /* timeout? */ + else if( got == 0 ){ + if( --niter > 0 ){ + goto again; + } + else{ + xclose(sock); + FPRINTF((stderr, "%sXPAProxyAccept: select timed out\n", _sp)); + goto error; + } + } + /* error */ + else{ + if( xerrno == EINTR ){ + PERROR(("xpaaccept select")); + goto again; + } + else{ + xclose(sock); + goto error; + } + } + /* done with listening */ + xclose(sock); + + /* fill in return information */ + if( rip ) *rip = ip; + if( rport ) *rport = port; + if( rname ){ + strncpy(rname, amethod, SZ_LINE-1); + rname[SZ_LINE-1] = '\0'; + } + return(ofd); + +error: + return(-1); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientNewInput + * + * Purpose: allocate a new input struct for reading data from stdin + * + * Return: input struct, or NULL on error + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static XPAInput +XPAClientNewInput(XPA xpa) +#else +static XPAInput XPAClientNewInput(xpa) + XPA xpa; +#endif +{ + XPAInput xnew, inp; + + /* allocate a new record */ + if( (xnew=(XPAInput)xcalloc(1, sizeof(XPAInputRec))) == NULL ){ + return(NULL); + } + /* allocate the data buffer */ + xnew->buf = (char *)xmalloc(XPA_BIOSIZE); + /* this buffer starts (and currently ends) at the current byte count */ + xnew->start = xpa->inpbytes; + xnew->end = xpa->inpbytes; + xnew->bytes = 0; + + /* add this input to end of list of input's */ + if( xpa->inphead == NULL ){ + xpa->inphead = xnew; + } + else{ + for(inp=xpa->inphead; inp->next!=NULL; inp=inp->next) + ; + inp->next = xnew; + } + + /* return the record struct */ + return(xnew); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientFreeInput + * + * Purpose: free a input buffer once its been sent to all targets + * + * Return: 0 on success, -1 on failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static void +XPAClientFreeInput (XPA xpa, XPAInput inp) +#else +static void XPAClientFreeInput(xpa, inp) + XPA xpa; + XPAInput inp; +#endif +{ + XPAInput cur; + + if( !xpa || !inp ) + return; + + if( inp == xpa->inphead ){ + xpa->inphead = inp->next; + } + else{ + for(cur=xpa->inphead; cur!=NULL; cur=cur->next){ + if( cur->next == inp ){ + cur->next = inp->next; + break; + } + } + } + + /* free current record */ + if( inp != NULL ){ + if( inp->buf != NULL ) + xfree(inp->buf ); + xfree(inp); + } +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientFreeAllInputs + * + * Purpose: free remaining input buffers + * + * Return: 0 on success, -1 on failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static void +XPAClientFreeAllInputs (XPA xpa) +#else +static void XPAClientFreeAllInputs(xpa) + XPA xpa; +#endif +{ + XPAInput cur, tmp; + + if( !xpa ) + return; + + for(cur=xpa->inphead; cur!=NULL; ){ + tmp = cur->next; + XPAClientFreeInput(xpa, cur); + cur = tmp; + } + xpa->inpbytes = 0; +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientProcessInput + * + * Purpose: read input from stdin and store in an input struct + * + * Return: bytes read + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAClientProcessInput(XPA xpa) +#else +static int XPAClientProcessInput(xpa) + XPA xpa; +#endif +{ + static XPAInput cur=NULL; + int get, got; + + /* set up next buffer, if necessary */ + for(cur=xpa->inphead; cur!=NULL; cur=cur->next){ + if( cur->bytes < XPA_BIOSIZE ) + break; + } + if( cur == NULL ){ + cur = XPAClientNewInput(xpa); + } + + /* read data from stdin */ + get = MIN(XPA_IOSIZE, XPA_BIOSIZE - cur->bytes); + if( isatty(xpa->ifd) ){ + got = rdl(xpa->ifd, &(cur->buf[cur->bytes]), get); + } + else{ + got = read(xpa->ifd, &(cur->buf[cur->bytes]), get); + } + switch(got){ + case -1: + if( XPAVerbosity() ){ + PERROR(("XPA client read")); + } + return(0); + case 0: + xpa->ifd = -1; + FPRINTF((stderr, "%sXPAClientProcessInput: signalling EOF\n", _sp)); + break; + default: + break; + } + cur->bytes += got; + cur->end += got; + xpa->inpbytes += got; +#ifdef FIXEDBYCYGWIN +#if HAVE_CYGWIN + /* on non-NT Windows machines, Cygwin select() does not work once a pipe + gets EOF. It should show the fd ready for reading (and read 0 bytes), + but does not, so we have to hack a manual check */ + /* GetVersion is a Windows call */ + if( GetVersion() >= 0x80000000L ){ + if( got < get ){ + xpa->ifd = -1; + } + } +#endif +#endif + + /* verify to stdout, if necessary */ + if( xpa->client_mode & XPA_CLIENT_VERIFY ){ + fwrite(&(cur->buf[cur->bytes-got]), sizeof(char), got, stdout); + } + + /* return the number of bytes just read */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientFree + * + * Purpose: free a client record and remove from list + * + * Returns: none + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static void +XPAClientFree (XPA xpa, XPAClient client) +#else +static void XPAClientFree(xpa, client) + XPA xpa; + XPAClient client; +#endif +{ + XPAClient cur; + + /* remove from list of xpa's */ + if( xpa->clienthead ){ + if( xpa->clienthead == client ){ + xpa->clienthead = client->next; + } + else{ + for(cur=xpa->clienthead; cur!=NULL; cur=cur->next){ + if( cur->next == client ){ + cur->next = client->next; + break; + } + } + } + } + + if( client->cmdfd >= 0 ){ +#if HAVE_CYGWIN + shutdown(client->cmdfd, SHUT_RDWR); +#endif + xclose(client->cmdfd); + } + if( client->datafd >= 0 ){ +#if HAVE_CYGWIN + shutdown(client->datafd, SHUT_RDWR); +#endif + xclose(client->datafd); + } + if( client->dataname ){ + unlink(client->dataname); + xfree(client->dataname); + } + if( client->method ) + xfree(client->method); + if( client->info ) + xfree(client->info); + if( client->xtemplate ) + xfree(client->xtemplate); + if( client->xclass ) + xfree(client->xclass); + if( client->name ) + xfree(client->name); + if( client->id ) + xfree(client->id); + /* xpaget's fd mode has an alloc'ed bufptr and lenptr */ + if( (client->type == 'g') && (client->mode & XPA_CLIENT_FD) ){ + if( client->bufptr && *(client->bufptr) ) + xfree(*(client->bufptr)); + if( client->bufptr ) + xfree(client->bufptr); + if( client->lenptr ) + xfree(client->lenptr); + } + xfree(client); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientDataSent + * + * Purpose: data is sent, so close data channel and change status to + * signal that we are waiting for the server + * + * Returns: none + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static void +XPAClientDataSent (XPA xpa, XPAClient client) +#else +static void XPAClientDataSent(xpa, client) + XPA xpa; + XPAClient client; +#endif +{ + FPRINTF((stderr, "%sXPAClientDataSent: for cmd %d data %d\n", _sp, + client->cmdfd, client->datafd)); + /* close the data channel, which should trigger a result from the server */ + if( client->datafd >= 0 ){ +#if HAVE_CYGWIN + shutdown(client->datafd, SHUT_RDWR); +#endif + xclose(client->datafd); + client->datafd = -1; + } + /* we are now waiting for the server to complete the calllback */ + client->status = XPA_CLIENT_WAITING; +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientEnd + * + * Purpose: finish up with this client + * + * Returns: error message or null + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static char * +XPAClientEnd (XPA xpa, XPAClient client) +#else +static char *XPAClientEnd(xpa, client) + XPA xpa; + XPAClient client; +#endif +{ + char *error=NULL; + char *eptr; + + FPRINTF((stderr, "%sXPAClientEnd: for cmd %d data %d\n", _sp, + client->cmdfd, client->datafd)); + /* always read the status line -- if we are not ack'ing, we'll get an + OK from the server before the calllback and we can exit quickly */ + /* don't do this if client is xpainfo and we're not ack'ing */ + if( !((client->type == 'i') && !(client->mode & XPA_CLIENT_ACK)) ){ +retry: + if( XPAGets(NULL, client->cmdfd, errbuf, SZ_LINE, XPALongTimeout()) >0 ){ + FPRINTF((stderr, "%sXPAClientEnd: read %s\n", _sp, errbuf)); + eptr = errbuf; + /* this should never happen */ + if( *eptr == '?' ){ + snprintf(errbuf, SZ_LINE, + "XPA$WARNING: protocol mismatch - missing id\n%s", eptr); + error = NULL; + } + else{ + /* make sure we are dealing with a proper message */ + if( strncmp(eptr, client->id, strlen(client->id)) ){ + if( XPAVerbosity() > 1 ){ + fprintf(stderr, + "XPA$WARNING: ignoring out of sync server message:\n"); + fprintf(stderr, "%s", errbuf); + } + goto retry; + } + /* go past id */ + eptr += strlen(client->id); + while( isspace((int)*eptr) ) eptr++; + if( !strncmp(eptr, "XPA$OK", 6) ){ + error = NULL; + } + else{ + error = eptr; + } + } + } + else{ + if( XPAVerbosity() > 1 ){ + fprintf(stderr, + "XPA$WARNING: no reply from server callback (assuming OK)\n"); + } + error = NULL; + } + } + else + error = NULL; + + /* store the error return */ + if( client->errptr ) + *(client->errptr) = xstrdup(error); + + /* remove this client if we are not meant to persist */ + if( !xpa->persist ){ + XPAClientFree(xpa, client); + } + /* otherwise mark as inactive */ + else{ + client->status = XPA_CLIENT_IDLE; + client->bytes = 0; + } + + /* return error status */ + return(error); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientNew + * + * Purpose: allocate a new xpa client + * + * Returns: xpa client struct + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static XPAClient +XPAClientNew (XPA xpa, char *mode, char *xtemplate, int type, + char *xclass, char *name, char *method, char *info) +#else +static XPAClient XPAClientNew(xpa, mode, xtemplate, type, + xclass, name, method, info) + XPA xpa; + char *mode; + char *xtemplate; + int type; + char *xclass; + char *name; + char *method; + char *info; +#endif +{ + XPAClient xnew, client; + struct sockaddr_in sock_in; +#if HAVE_SYS_UN_H + struct sockaddr_un sock_un; +#endif + char xmode[SZ_LINE]; + char tbuf[SZ_LINE]; + char amethod[SZ_LINE]; + char *s=NULL; + unsigned short port; + unsigned int ip=0; + int fd; + int pfd; + int tries=0; + int nsproxy=0; + int keep_alive=1; + + FPRINTF((stderr, "%sXPAClientNew: entering with %s %s %s %s\n", _sp, + xclass, name, method, info)); + + /* no errors as yet */ + *errbuf = '\0'; + + /* look for reuse of xpans fd (used in conjunction with the xpans proxy) */ + *xmode = '\0'; + if( mode ){ + strncpy(xmode, mode, SZ_LINE-1); + xmode[SZ_LINE-1] = '\0'; + } + if( keyword(xmode, "nsproxy", tbuf, SZ_LINE) ){ + nsproxy = 1; + pfd = strtol(tbuf, &s, 0); + fd = XPAProxyAccept(xpa, XPANSMethod(NULL,2), + xclass, name, pfd, &ip, &port, amethod); + /* make sure we got a valid int fd */ + if( fd < 0 ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: no response from server on proxyaccept (%s:%s%s)\n", + xclass, name, XPATimestamp()); + FPRINTF((stderr, "%sXPAClientNew: %s", _sp, errbuf)); + PERROR(("XPAClientNew")); + return(NULL); + } + } + /* normal usage: connect to server */ + else{ + switch(XPAMethod(method)){ + case XPA_INET: +again1: + if( !XPAParseIpPort(method, &ip, &port) ) + return(NULL); + /* use $localhost over $host (we do not trust host to be correct) */ + if( (ip == gethostip("$host")) && (tries == 0) ) + ip = gethostip("$localhost"); + /* connect to the server before we go further */ + if( (fd = xsocket(AF_INET, SOCK_STREAM, 0)) < 0 ){ + return(NULL); + } + setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, + (char *)&keep_alive, sizeof(keep_alive)); + memset((char *)&sock_in, 0, sizeof(sock_in)); + sock_in.sin_family = AF_INET; + sock_in.sin_addr.s_addr = htonl(ip); + sock_in.sin_port = htons(port); + /* make the connection with the server */ + if( connect(fd, (struct sockaddr *)&sock_in, sizeof(sock_in)) <0 ){ + xclose(fd); + /* if localhost doesn't work, make one try with the host ip */ + /* we also try again just in case there was an odd error such + as "permission denied", which we have seen once or twice */ + if( tries < 2 ){ + tries++; + goto again1; + } + /* give up */ + else{ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: no response from server on connect (%s:%s%s)\n", + xclass, name, XPATimestamp()); + PERROR(("XPAClientNew")); + return(NULL); + } + } + /* make sure we close on exec */ + xfcntl(fd, F_SETFD, FD_CLOEXEC); + FPRINTF((stderr, "%sXPAClientNew: inet connect returns fd %d\n", + _sp, fd)); + break; +#if HAVE_SYS_UN_H + case XPA_UNIX: +again2: + /* open a socket and fill in socket information */ + if( (fd = xsocket(AF_UNIX, SOCK_STREAM, 0)) < 0 ){ + return(NULL); + } + setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, + (char *)&keep_alive, sizeof(keep_alive)); + memset((char *)&sock_un, 0, sizeof(sock_un)); + sock_un.sun_family = AF_UNIX; + strcpy(sock_un.sun_path, method); + /* make the connection with the server */ + if( connect(fd, (struct sockaddr *)&sock_un, sizeof(sock_un)) <0 ){ + xclose(fd); + /* Unix sockets get ECONNREFUSED when the listen queue is full, + so we try a few times to give the server a chance to recover */ + if( (xerrno == ECONNREFUSED) && (tries < XPA_RETRIES) ){ + tries++; + XPASleep(10); + goto again2; + } + /* give up */ + else{ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: no response from server on connect (%s:%s%s)\n", + xclass, name, XPATimestamp()); + PERROR(("XPAClientNew")); + return(NULL); + } + } + /* make sure we close on exec */ + xfcntl(fd, F_SETFD, FD_CLOEXEC); + FPRINTF((stderr, "%sXPAClientNew: unix connect returns fd %d\n", + _sp, fd)); + break; +#endif + default: + return(NULL); + } + strncpy(amethod, method, SZ_LINE-1); + amethod[SZ_LINE-1] = '\0'; + } + + /* allocate new send record */ + if( (xnew=(XPAClient)xcalloc(1, sizeof(XPAClientRec))) == NULL ){ + xclose(fd); + return(NULL); + } + + /* fill in the blanks */ + xnew->xtemplate = xstrdup(xtemplate); + xnew->type = type; + xnew->cmdfd = fd; + xnew->datafd = -1; + xnew->xclass = xstrdup(xclass); + xnew->name = xstrdup(name); + xnew->method = xstrdup(amethod); + xnew->info = xstrdup(info); + xnew->ip = ip; + xnew->nsproxy = nsproxy; + xnew->status = XPA_CLIENT_ACTIVE; + + /* now that we have a valid client, add to list */ + if( xpa->clienthead == NULL ){ + xpa->clienthead = xnew; + } + else{ + for(client=xpa->clienthead; client->next!=NULL; client=client->next) + ; + client->next = xnew; + } + FPRINTF((stderr, "%sXPAClientNew: new fd %d\n", _sp, xnew->cmdfd)); + /* return the good news */ + return(xnew); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientAddSelect + * + * Purpose: add one or more xpa client sockets to the select flags + * + * Return: number of clients that were added to the select flags + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAClientAddSelect (XPA xpa, fd_set *readfdsptr, fd_set *writefdsptr) +#else +int XPAClientAddSelect(xpa, readfdsptr, writefdsptr) + XPA xpa; + fd_set *readfdsptr; + fd_set *writefdsptr; +#endif +{ + XPAClient client; + int got=0; + int loop=0; + + /* better have some place to set the flags */ + if( readfdsptr == NULL ) + return(0); + + /* if no xpa is specified, do them all */ + if( xpa == NULL ){ + if( xpaclienthead == NULL ) return(0); + xpa = xpaclienthead; + loop = 1; + } + +loop: + /* set select flags for all clients */ + for(client=xpa->clienthead; client!=NULL; client=client->next){ + /* if this client is processing */ + if( (client->status == XPA_CLIENT_PROCESSING) && (client->datafd >= 0) ){ + if( client->type == 'g' ){ + FPRINTF((stderr, "%sXPAClientAddSelect(get): adding fd %d\n", _sp, + client->datafd)); + FD_SET(client->datafd, readfdsptr); + got++; + } + else if( client->type == 's' ){ + FPRINTF((stderr, "%sXPAClientAddSelect(set): adding fd %d\n", _sp, + client->datafd)); + FD_SET(client->datafd, writefdsptr); + got++; + } + } + /* if this client is waiting */ + else if( (client->status == XPA_CLIENT_WAITING) && (client->cmdfd >= 0) ){ + FPRINTF((stderr, "%sXPAClientAddSelect(waiting): adding fd %d\n", _sp, + client->cmdfd)); + FD_SET(client->cmdfd, readfdsptr); + got++; + } + } + /* loop if necessary */ + if( loop && (xpa=xpa->next) ) goto loop; + /* return the news */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientGet + * + * Purpose: process an xpaget request for a given client + * + * Return: 0 on success, -1 on failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAClientGet (XPA xpa, XPAClient client) +#else +static int XPAClientGet(xpa, client) + XPA xpa; + XPAClient client; +#endif +{ + int status; + char tbuf[SZ_LINE]; + + /* allocate the first buffer, if necessary */ + if( *(client->bufptr) == NULL ){ + client->bufsize = XPA_IOSIZE; + *(client->bufptr) = (char *)xmalloc(client->bufsize); + *(client->lenptr) = 0; + } + if( (*(client->lenptr) + XPA_IOSIZE) > client->bufsize ){ + client->bufsize += (XPA_IOSIZE*10); + *(client->bufptr) = (char *)xrealloc(*(client->bufptr), client->bufsize); + } + + /* now retrieve the data from the server */ + status = recv(client->datafd, *(client->bufptr) + *(client->lenptr), + XPA_IOSIZE, 0); + /* status < 0 means error */ + switch(status){ + /* error */ + case -1: + /* socket would block */ + if((xerrno == EINPROGRESS) || (xerrno == EWOULDBLOCK)){ + return(0); + } + /* clean up after error */ + if( *(client->bufptr) ){ + xfree(*(client->bufptr)); + *(client->bufptr) = NULL; + client->bufsize = 0; + } + *(client->lenptr) = 0; + XPAClientDataSent(xpa, client); +#ifdef OLD + (void)XPAClientEnd(xpa, client); + /* we need to flag some sort of error, if nothing came across */ + if( *(client->errptr) == NULL ){ + *(client->errptr) = xstrdup( + "XPA$ERROR: incomplete transmission from server\n"); + } +#endif + break; + /* eof */ + case 0: + /* if we have multiple clients, we now need to write this one */ + if( client->mode & XPA_CLIENT_FD ){ + if( xpa->nclient > 1 ){ + snprintf(tbuf, SZ_LINE, "XPA$BEGIN %s:%s %s\n", + client->xclass, client->name, client->method); + write(client->fd, tbuf, strlen(tbuf)); + } + write(client->fd, *(client->bufptr), *(client->lenptr)); + if( xpa->nclient > 1 ){ + snprintf(tbuf, SZ_LINE, "XPA$END %s:%s %s\n", + client->xclass, client->name, client->method); + write(client->fd, tbuf, strlen(tbuf)); + } + /* we can free buf, since its not being passed back */ + if( *(client->bufptr) ){ + xfree(*(client->bufptr)); + *(client->bufptr) = NULL; + client->bufsize = 0; + } + } + else{ + /* set final buffer size and put a convenience null at the end */ + if( *(client->bufptr) ){ + client->bufsize = *(client->lenptr)+1; + *(client->bufptr) = (char *)xrealloc(*(client->bufptr),client->bufsize); + *(*(client->bufptr)+*(client->lenptr)) = '\0'; + } + } + /* for all clients, we need to clean up */ + XPAClientDataSent(xpa, client); +#ifdef OLD + (void)XPAClientEnd(xpa, client); +#endif + break; + /* status > 0: bytes read */ + default: + *(client->lenptr) += status; + /* for single client fd mode, we write immediately -- this deals with + the important case of one client with a large amount of data */ + if( (client->mode & XPA_CLIENT_FD) && (xpa->nclient == 1) ){ + write(client->fd, *(client->bufptr), *(client->lenptr)); + /* reset buf for next read */ + if( *(client->bufptr) ) xfree(*(client->bufptr)); + *(client->bufptr) = NULL; + *(client->lenptr) = 0; + } + break; + } + return(status); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientSet + * + * Purpose: process an xpaset request for a given client + * + * Return: 0 on success, -1 on failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAClientSet (XPA xpa, XPAClient client) +#else +static int XPAClientSet(xpa, client) + XPA xpa; + XPAClient client; +#endif +{ + int status; + int left; + int got; + int len; + XPAInput inp; + + if( client->mode & XPA_CLIENT_BUF ){ + while( 1 ){ + len = MIN(XPA_IOSIZE, client->len - client->bytes); + /* see if we have written it all */ + if( len == 0 ){ + status = 1; + goto done; + } + /* write the next chunk */ + FPRINTF((stderr, + "%sXPAClientSet: fd %d sending %lu bytes (%lu - %lu)\n", _sp, + client->datafd, (unsigned long)len, + (unsigned long)client->len, (unsigned long)client->bytes)); + got=send(client->datafd, &(client->buf[client->bytes]), len, 0); + if( got >= 0 ){ + client->bytes += got; + if( XPALevelGet() >0 ) + return(got); + } + else{ + PERROR(("XPAClientSet")); + /* check for error */ + if( (xerrno != EWOULDBLOCK) && (xerrno != EAGAIN) ){ + status = -1; + goto done; + } + /* write would block, so we return and wait the server */ + else{ + return(0); + } + } + } + } + /* reading from stdin and writing to servers */ + else{ + /* find the input buf that contains the data we need */ + for(inp=xpa->inphead; inp!=NULL; inp=inp->next){ + if( (client->bytes >= inp->start) && (client->bytes < inp->end) ){ + break; + } + } + /* if we can't find a buffer ... */ + if( !inp ){ + /* ... and we have all the input, we are done */ + if( xpa->ifd < 0 ){ + FPRINTF((stderr, "%sXPAClientSet: all data read\n", _sp)); + status = 1; + goto done; + } + /* ... but there is more input to come, return */ + else{ + return(0); + } + } + /* optimization: don't write a buffer until its full (or until eof) */ + if( (xpa->ifd >=0) && (inp->bytes < XPA_BIOSIZE) ){ + return(0); + } + + /* write bytes until we would block or until end of this buffer, etc */ + while( 1 ){ + len = MIN(XPA_IOSIZE, inp->end - client->bytes); + FPRINTF((stderr, "%sXPAClientSet: has %lu=min(%d,(%lu-%lu)) [%d]\n", + _sp, (unsigned long)len, XPA_IOSIZE, + (unsigned long)inp->end, (unsigned long)client->bytes, + client->status)); + /* if we are done with this buffer, just return */ + if( (client->status == XPA_CLIENT_PROCESSING) && (len <=0) ){ + /* see if everyone else is done with this buffer as well, + in which case we can free it */ + left = 0; + for(client=xpa->clienthead; client!=NULL; client=client->next){ + if( (client->type != 's') || !(client->mode & XPA_CLIENT_FD) ) + continue; + /* in order to be totally written out, the following must be true: + * 1. send->bytes must be past the end of this buffer + * and + * 2. this buffer must be filled or else we hit eof + */ + FPRINTF((stderr, + "%sXPAClientSet: %lu>=%lu && ((%lu>=%d) or %d<0)) .. ", + _sp, client->bytes, (unsigned long)inp->end, + (unsigned long)inp->bytes, XPA_BIOSIZE, + xpa->ifd)); + if( (client->bytes >= inp->end) && + ((inp->bytes >= XPA_BIOSIZE) || (xpa->ifd < 0)) ){ + /* buffer complete written */ + FPRINTF((stderr, "%sEOF (%lu)\n", + _sp, (unsigned long)xpa->inpbytes)); + ; + } + else{ + FPRINTF((stderr, "%s\n", _sp)); + /* buffer not complete written */ + left++; + break; + } + } + /* if nothing is left, we can free this input struct */ + if( !left ){ + XPAClientFreeInput(xpa, inp); + } + return(0); + } + /* write to the server */ + FPRINTF((stderr, + "%sXPAClientSet: fd %d sending %lu bytes (%lu):\n", _sp, + client->datafd, + (unsigned long)len, (unsigned long)client->bytes)); + got = send(client->datafd, &(inp->buf[client->bytes-inp->start]),len,0); + /* check for success */ + if( got >= 0 ){ + /* update the number of bytes we wrote */ + client->bytes += got; + FPRINTF((stderr, "%sXPAClientSet: sent %lu bytes (total is %lu)\n", + _sp, (unsigned long)got, (unsigned long)client->bytes)); + /* go back for more */ + if( XPALevelGet() >0 ) + return(got); + else + continue; + } + /* check for error */ + else{ + PERROR(("XPAClientSet")); + /* anything but a "would block" error is bad */ + if( (xerrno != EWOULDBLOCK) && (xerrno != EAGAIN) ){ + status = -1; + goto done; + } + /* write would block, so we return and wait the server */ + else{ + FPRINTF((stderr, "%sXPAClientSet: waiting for more data\n", _sp)); + return(0); + } + } + } + } + +done: + XPAClientDataSent(xpa, client); +#ifdef OLD + (void)XPAClientEnd(xpa, client); +#endif + return(status); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientProcessSelect + * + * Purpose: process xpas that have pending reads or writes + * + * Return: number of xpas processed + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAClientProcessSelect (XPA xpa, + fd_set *readfdsptr, fd_set *writefdsptr, int maxreq) +#else +int XPAClientProcessSelect(xpa, readfdsptr, writefdsptr, maxreq) + XPA xpa; + fd_set *readfdsptr; + fd_set *writefdsptr; + int maxreq; +#endif +{ + int got=0; + int loop=0; + XPAClient client; + + /* <= 0 means do all of them */ + if( maxreq < 0 ){ + maxreq = 0; + } + + /* if no xpa is specified, do them all */ + if( xpa == NULL ){ + if( xpaclienthead == NULL ) return(0); + xpa = xpaclienthead; + loop = 1; + } + +loop: + /* first process any new input before we write output */ + if( xfd_isset_stdin(xpa->ifd, readfdsptr) ){ + xfd_clr_stdin(xpa->ifd, readfdsptr); + XPAClientProcessInput(xpa); + } + /* look at all clients */ +again: + for(client=xpa->clienthead; client!=NULL; client=client->next){ + /* if we are processing */ + if( (client->status == XPA_CLIENT_PROCESSING) && (client->datafd>=0) ){ + /* then handle new requests */ + if((client->type == 'g') && FD_ISSET(client->datafd, readfdsptr)){ + FD_CLR(client->datafd, readfdsptr); + XPAClientGet(xpa, client); + got++; + if( maxreq && (got >= maxreq) ) return(got); + goto again; + } + else if((client->type == 's') && FD_ISSET(client->datafd, writefdsptr)){ + FD_CLR(client->datafd, writefdsptr); + /* if the return is > 0, we completed the send */ + if( XPAClientSet(xpa, client) > 0 ) + got++; + if( maxreq && (got >= maxreq) ) return(got); + goto again; + } + } + /* if this client is waiting */ + else if( (client->status == XPA_CLIENT_WAITING) && (client->cmdfd >= 0) ){ + if( FD_ISSET(client->cmdfd, readfdsptr)){ + FD_CLR(client->cmdfd, readfdsptr); + XPAClientEnd(xpa, client); + got++; + if( maxreq && (got >= maxreq) ) return(got); + goto again; + } + } + } + /* loop if necessary */ + if( loop && (xpa=xpa->next) ) goto loop; + /* return the news */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientLoop + * + * Purpose: non-X programs event loop for handling XPA client events + * + * Returns: none + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAClientLoop (XPA xpa, int mode) +#else +static int XPAClientLoop(xpa, mode) + XPA xpa; + int mode; +#endif +{ + int got=0; + int sgot; + int doxpa=1; + int ltimeout; + char *s=NULL; + fd_set readfds; + fd_set writefds; + static int width=0; + struct timeval tv; + struct timeval *tvp; + + /* set width once */ + if( width == 0 ){ + width = FD_SETSIZE; + } + /* allow environment to turn off xpa server processing in client loop */ + if( (s=getenv("XPA_CLIENT_DOXPA")) && isfalse(s) ){ + doxpa = 0; + } + ltimeout = XPALongTimeout(); + FD_ZERO(&readfds); + FD_ZERO(&writefds); + while( XPAClientAddSelect(xpa, &readfds, &writefds) ){ + /* add other XPA's and process them as we process the client */ + if( (mode & XPA_CLIENT_SEL_XPA) && doxpa ){ + FPRINTF((stderr, "%sXPAClientLoop: will handle server reqs ...\n", _sp)); + XPAAddSelect(NULL, &readfds); + } + /* hopefully, a server will respond in a finite amount of time */ + if( ltimeout > 0 ){ + tv.tv_sec = ltimeout; + tv.tv_usec = 0; + tvp = &tv; + } + /* wait forever, if necessary */ + else{ + tvp = NULL; + } + /* add stdin to select, if there is one */ + if( xpa->ifd >= 0 ){ + xfd_set_stdin(xpa->ifd, &readfds); +#if HAVE_MINGW32 + /* BUT: for windows, we can't add stdin to select and therefore we + must set a short timeout and look manually */ + tv.tv_sec = 0; + tv.tv_usec = 10000; + /* this is the number of window iterations we will perform */ + if( ltimeout > 0 ) + ltimeout *= 100; + tvp = &tv; +#endif + } + /* wait for a server to respond */ + FPRINTF((stderr, "%sXPAClientLoop: waiting on select() ...\n", _sp)); + sgot = xselect(width, &readfds, &writefds, NULL, tvp); + FPRINTF((stderr, "%sXPAClientLoop: select returns: %d\n", _sp, sgot)); + /* error -- what should we do? */ + if( sgot < 0 ){ + if( xerrno == EINTR ){ + FD_ZERO(&readfds); + FD_ZERO(&writefds); + continue; + } + if( XPAVerbosity() ){ + perror("XPAClientLoop() select"); + } + exit(1); + } + /* timed out -- no one responded */ + else if( sgot == 0 ){ +#if HAVE_MINGW32 + if( xpa->ifd >= 0 ){ + if( ltimeout > 0 ){ + if( --ltimeout <= 0 ) + break; + } + } + else{ + break; + } +#else + break; +#endif + } + else{ + got += XPAClientProcessSelect(xpa, &readfds, &writefds, 0); + if( (mode & XPA_CLIENT_SEL_XPA) && doxpa ){ + got += XPAProcessSelect(&readfds, 0); + } + } + FD_ZERO(&readfds); + FD_ZERO(&writefds); + } + return(got); +} + +#if HAVE_MINGW32==0 +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientLoopFork + * + * Purpose: non-X programs forked event loop for handling XPA client events + * + * Returns: number of clients "processed" + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAClientLoopFork (XPA xpa, int mode) +#else +static int XPAClientLoopFork(xpa, mode) + XPA xpa; + int mode; +#endif +{ + XPAClient client, tclient; + pid_t pid; + int got; + int fd[2]; + char active=1; +#ifndef USE_DOUBLE_FORK + struct sigaction act; + /* set up the signal handler to reap children (to avoid zombies) */ + act.sa_handler = sig_chld; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; +#ifdef SA_RESTART + act.sa_flags |= SA_RESTART; +#endif +#ifdef SA_NOCLDWAIT + act.sa_flags |= SA_NOCLDWAIT; +#endif + sigaction(SIGCHLD, &act, NULL); +#endif + + if( pipe(fd) < 0 ){ + got = 0; + } + else if( (pid = fork()) < 0 ){ + close(fd[0]); + close(fd[1]); + got=0; + } + else if( pid == 0 ){ /* child */ + /* child write to parent that he is active */ + close(fd[0]); + write(fd[1], &active, 1); + close(fd[1]); +#ifdef USE_DOUBLE_FORK + /* second fork prevents zombies: + when child/parent exits, second child is inherited + by init and thus is not a child of original parent */ + if( (pid = fork()) >= 0 ){ + /* child/parent exits */ + if( pid > 0 ) + exit(0); + /* new child goes on under init ... */ + } +#endif + /* enter the main loop and process */ + XPAIOCallsXPA(0); + XPAClientLoop(xpa, mode); + exit(0); + } else { /* parent */ + /* parent waits for child to wake up */ + close(fd[1]); + read(fd[0], &active, 1); + close(fd[0]); +#ifdef USE_DOUBLE_FORK + /* for double fork, also wait for intermediate process to exit */ + waitpid(pid, NULL, 0); +#endif + /* fake end of clients */ + for(got=0, client=xpa->clienthead; client!=NULL; ){ + got++; + tclient = client->next; + if( (client->status == XPA_CLIENT_PROCESSING) && (client->datafd >=0) ){ +#if HAVE_CYGWIN + /* In Cygwin, we call shutdown (as well as close) to avoid Windows + problems. The parent can't do this since the child is using the + sockets, so we just close the sockets explicitly here */ + xclose(client->datafd); + client->datafd = -1; + if( !xpa->persist ){ + xclose(client->cmdfd); + client->cmdfd = -1; + } +#endif + client->errptr = NULL; + /* remove this client if we are not meant to persist */ + if( !xpa->persist ){ + XPAClientFree(xpa, client); + } + /* otherwise mark as inactive */ + else{ + client->status = XPA_CLIENT_IDLE; + client->bytes = 0; + } + } + client = tclient; + } + } + return(got); +} +#endif + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientConnect + * + * Purpose: go to name service and get new names, merge with old, + * and connect to servers + * + * Returns: number of connections + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAClientConnect (XPA xpa, char *mode, char *xtemplate, int type) +#else +static int XPAClientConnect(xpa, mode, xtemplate, type) + XPA xpa; + char *mode; + char *xtemplate; + int type; +#endif +{ + int i; + int n; + int got; + int lp=0; + int total=0; + char **xclasses; + char **names; + char **methods; + char **infos; + char xtype[2]; + char xmode[SZ_LINE]; + char tbuf[SZ_LINE]; + char lbuf[SZ_LINE]; + XPAClient client; + + /* do some initialization */ + XPAInitEnv(); + + /* make sure we have a target */ + if( !xtemplate || !*xtemplate ) + return(0); + + /* make a string out of the type for the lookup */ + xtype[0] = type; + xtype[1] = '\0'; + + /* reset the number of clients we are processing */ + xpa->nclient = 0; + + /* look for specific proxy info */ + *xmode = '\0'; + if( mode ){ + strncpy(xmode, mode, SZ_LINE-1); + xmode[SZ_LINE-1] = '\0'; + } + if( keyword(xmode, "ns", lbuf, SZ_LINE) ){ + FPRINTF((stderr, "%sXPAClientConnect: using ns info: %s\n", _sp, lbuf)); + newdtable("(),"); + xclasses = (char **)xmalloc(sizeof(char *)); + names = (char **)xmalloc(sizeof(char *)); + methods = (char **)xmalloc(sizeof(char *)); + infos = (char **)xmalloc(sizeof(char *)); + if( word(lbuf, tbuf, &lp) ) + xclasses[0] = xstrdup(tbuf); + if( word(lbuf, tbuf, &lp) ) + names[0] = xstrdup(tbuf); + if( word(lbuf, tbuf, &lp) ) + methods[0] = xstrdup(tbuf); + infos[0] = xstrdup(XPA_DEF_CLIENT_INFO); + n = 1; + freedtable(); + } + /* else ask xpans for access points matching the template */ + else{ + n = XPANSLookup(xpa, + xtemplate, xtype, &xclasses, &names, &methods, &infos); + } + /* mark existing clients who do not match this template */ + for(got=0, client=xpa->clienthead; client !=NULL; client=client->next){ + for(i=0; itype == type) && + (!strcmp(client->xclass, xclasses[i])) && + (!strcmp(client->name, names[i])) && + (!strcmp(client->method, methods[i])) && + (!strcmp(client->info, infos[i])) ){ + got++; + } + } + /* don't unmark if its a different type -- someone else might be active */ + if( !got && (client->type == type) ){ + client->status = XPA_CLIENT_IDLE; + } + } + /* add new clients for this type */ + for(i=0; iclienthead; client !=NULL; client=client->next){ + if( (client->type == type) && + (!strcmp(client->xclass, xclasses[i])) && + (!strcmp(client->name, names[i])) && + (!strcmp(client->method, methods[i])) && + (!strcmp(client->info, infos[i])) ){ + /* might have to change the template */ + if( strcmp(client->xtemplate, xtemplate) ){ + xfree(client->xtemplate); + client->xtemplate = xstrdup(xtemplate); + } + client->status = XPA_CLIENT_ACTIVE; + got++; + total++; + FPRINTF((stderr, "%sXPAClientConnect: existing match: %s %s %s\n", + _sp, xclasses[i], names[i], methods[i])); + break; + } + } + if( !got ){ + FPRINTF((stderr, "%sXPAClientConnect: calls XPAClientNew for %s:%s %s\n", + _sp, xclasses[i], names[i], methods[i])); + if( XPAClientNew(xpa, mode, xtemplate, type, + xclasses[i], names[i], methods[i], infos[i]) ) + total++; + } + /* done with these strings */ + xfree(xclasses[i]); + xfree(names[i]); + xfree(methods[i]); + xfree(infos[i]); + } + /* free up arrays alloc'ed by names server */ + if( n > 0 ){ + xfree(xclasses); + xfree(names); + xfree(methods); + xfree(infos); + } + return(total); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClientStart + * + * Purpose: send init string to server and perform other authentication + * tasks + * + * Returns: 0 if success, -1 otherwise + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAClientStart (XPA xpa, XPAClient client, char *paramlist, char *mode) +#else +static int XPAClientStart(xpa, client, paramlist, mode) + XPA xpa; + XPAClient client; + char *paramlist; + char *mode; +#endif +{ + int fd=0; + int lp=0; + int flags; + int tries=0; + int dmode=0; + int keep_alive=1; + unsigned int ip=0; + unsigned short port; + char tbuf[SZ_LINE]; + char tbuf2[SZ_LINE]; + char lbuf[SZ_LINE]; + char *cmd=NULL; + char *method=NULL; + struct sockaddr_in sock_in; +#if HAVE_SYS_UN_H + struct sockaddr_un sock_un; +#endif + + switch(client->type){ + case 'a': + cmd = "xpaaccess"; + break; + case 'g': + cmd = "xpaget"; + break; + case 'i': + cmd = "xpainfo"; + break; + case 's': + cmd = "xpaset"; + break; + } + + /* get mode flags */ + XPAMode(mode, &(client->mode), "ack", XPA_CLIENT_ACK, 1); + if( client->type == 's' ) + XPAMode(mode, &(xpa->client_mode), "verify", XPA_CLIENT_VERIFY, 0); + /* package up and send the initialization message */ + strcpy(lbuf, cmd); + /* set and save the id value */ + snprintf(tbuf, SZ_LINE, "%c%d", client->type, id++); + if( client->id ) xfree(client->id); + client->id = xstrdup(tbuf); + /* if we are using the xpans proxy, we will want to call + accept() (server calls connect()) for the data channel */ + if( client->nsproxy ) + strcat(lbuf, " -a"); + /* set the value of the client big-endian-ness */ + snprintf(tbuf, SZ_LINE, " -e %s", XPAEndian() ? "big" : "little"); + strcat(lbuf, tbuf); + snprintf(tbuf, SZ_LINE, " -i %s", client->id); + strcat(lbuf, tbuf); + if( !(client->mode & XPA_CLIENT_ACK) ) + strcat(lbuf, " -n"); + if( strcmp(client->info, XPA_DEF_CLIENT_INFO) ){ + snprintf(tbuf, SZ_LINE, " -p %s", client->info); + strcat(lbuf, tbuf); + } + snprintf(tbuf, SZ_LINE, " %s:%s", client->xclass, client->name); + strcat(lbuf, tbuf); + if( paramlist && *paramlist ){ + strcat(lbuf, " "); + strncat(lbuf, paramlist, MAX(0,(int)(SZ_LINE-(int)strlen(lbuf)-2))); + } + strcat(lbuf, "\n"); + FPRINTF((stderr, "%sXPAClientStart: fd %d sends:\n%s", + _sp, client->cmdfd, lbuf)); + if( XPAPuts(NULL, client->cmdfd, lbuf, XPAShortTimeout()) <= 0 ){ + goto error; + } + + /* if xpainfo and no ack'ing, we are basically done */ + if( (client->type == 'i') && !(client->mode & XPA_CLIENT_ACK) ){ + goto done; + } + + /* authentication */ +retry: + lp = 0; + if( XPAGets(NULL, client->cmdfd, lbuf, SZ_LINE, XPAShortTimeout()) >0 ){ + FPRINTF((stderr, "%sXPAClientStart: fd %d received cmd:\n%s", _sp, + client->cmdfd, lbuf)); + /* this should never happen */ + if( !word(lbuf, tbuf, &lp) || (*tbuf == '?') ){ + snprintf(errbuf, SZ_LINE, + "XPA$WARNING: Protocol mismatch: id\n%s", lbuf); + goto error; + } + /* make sure we are dealing with a proper message */ + if( strcmp(tbuf, client->id) ){ + FPRINTF((stderr, "%sXPA$WARNING: ignoring out of sync message:\n", _sp)); + FPRINTF((stderr, "%s", lbuf)); + if( XPAVerbosity() > 1 ){ + fprintf(stderr, "XPA$WARNING: ignoring out of sync server message:\n"); + fprintf(stderr, "%s", lbuf); + } + goto retry; + } + + /* this should never happen */ + if( !word(lbuf, tbuf, &lp) ){ + snprintf(errbuf, SZ_LINE, "XPA$WARNING: missing BUF request\n%s", lbuf); + goto error; + } + if( !strcmp(tbuf, "XPA$NODATA") || !strcmp(tbuf, "XPA$NOBUF") ){ + xpa->nclient += 1; + goto started; + } + /* support 2.2 (DATA) and 2.0,2.1 (BUF) */ + else if( !strcmp(tbuf, "XPA$DATA") || !strcmp(tbuf, "XPA$BUF") ){ + if( !strcmp(tbuf, "XPA$DATA") ){ + dmode |= DATA_DATA; + if( !word(lbuf, tbuf, &lp) ){ + snprintf(errbuf, SZ_LINE, + "XPA$WARNING: missing DATA request type\n%s", lbuf); + goto error; + } + if( !strcmp(tbuf, "connect") ){ + method = client->method; + dmode |= DATA_CONNECT; + } + else if( !strcmp(tbuf, "accept") ){ + method = client->method; + dmode |= DATA_ACCEPT; + } + else{ + snprintf(errbuf, SZ_LINE, + "XPA$WARNING: invalid data connection request: %s (%s:%s)\n", + tbuf, client->xclass, client->name); + goto error; + } + } + else if( !strcmp(tbuf, "XPA$BUF") ){ + if( !word(lbuf, tbuf, &lp) ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: missing data buffer method (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + goto error; + } + method = tbuf; + dmode |= DATA_CONNECT; + } + /* handle connect-type requests */ + if( dmode & DATA_CONNECT ){ + switch(XPAMethod(method)){ + case XPA_INET: + XPAParseIpPort(method, &ip, &port); + /* connect to the server before we go further */ + if( (fd = xsocket(AF_INET, SOCK_STREAM, 0)) < 0 ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: bad socket for data chan (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + if( XPAVerbosity() ){ + perror("XPA client socket"); + } + goto error; + } + setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, + (char *)&keep_alive, sizeof(keep_alive)); + memset((char *)&sock_in, 0, sizeof(sock_in)); + sock_in.sin_family = AF_INET; + /* connect using the same ip we used for the command channel + (i.e., could be localhost) */ + sock_in.sin_addr.s_addr = htonl(client->ip); + sock_in.sin_port = htons(port); + FPRINTF((stderr, + "%sXPAClientStart: attempting dchan connect: %s\n", + _sp, method)); + if( connect(fd, (struct sockaddr *)&sock_in, sizeof(sock_in)) < 0 ){ + PERROR(("dchan connect")); + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: can't connect to data chan (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + if( XPAVerbosity() ){ + perror("XPA client connect"); + } + xclose(fd); + goto error; + } + break; +#if HAVE_SYS_UN_H + case XPA_UNIX: +again: + /* open a socket and fill in socket information */ + if( (fd = xsocket(AF_UNIX, SOCK_STREAM, 0)) < 0 ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: bad socket for data chan (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + if( XPAVerbosity() ){ + perror("XPA client socket"); + } + goto error; + } + setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, + (char *)&keep_alive, sizeof(keep_alive)); + memset((char *)&sock_un, 0, sizeof(sock_un)); + sock_un.sun_family = AF_UNIX; + strcpy(sock_un.sun_path, method); + FPRINTF((stderr, + "%sXPAClientStart: attempting dchan connect: %s\n", + _sp, method)); + if( connect(fd, (struct sockaddr *)&sock_un, sizeof(sock_un)) < 0 ){ + PERROR(("dchan connect")); + xclose(fd); + if( (xerrno == ECONNREFUSED) && (tries < XPA_RETRIES) ){ + tries++; + xclose(fd); + XPASleep(10); + goto again; + } + /* give up */ + else{ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: can't connect to data chan (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + if( XPAVerbosity() ){ + perror("XPA client connect"); + } + goto error; + } + } + break; +#endif + default: + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: unknown connection method (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + goto error; + } + } + /* handle "doaccept" requests */ + else if( dmode & DATA_ACCEPT ){ + fd = XPAProxyAccept(xpa, XPANSMethod(NULL,2), + client->xclass, client->name, client->cmdfd, + NULL, NULL, tbuf2); + if( fd < 0 ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: can't connect to proxy server (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + goto error; + } + else if( *tbuf2 ){ + client->dataname = xstrdup(tbuf2); + } + } + + /* common code for either type of data connect request */ + client->datafd = fd; + /* make sure we close on exec */ + xfcntl(client->datafd, F_SETFD, FD_CLOEXEC); + /* for senders, set to no block mode */ + if( client->type == 's' ){ + /* save state and set in non-blocking mode */ + xfcntl_nonblock(client->datafd, flags); + } + xpa->nclient += 1; + goto started; + } + /* handle error message */ + else if( !strcmp(tbuf, "XPA$ERROR") ){ + snprintf(errbuf, SZ_LINE, "%s", &lbuf[lp]); + goto error; + } + /* everything else is an error */ + else{ + snprintf(errbuf, SZ_LINE, "%s", &lbuf[lp]); + goto error; + } + } + else{ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: no response from server during handshake (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + goto error; + } + +error: + FPRINTF((stderr, "Error in XPAClientStart: %s", errbuf)); + XPAClientFree(xpa, client); + return(-1); + +started: + /* it is necessary to add this this extra hack/ack between the + authentication ack and the error return (both from the server) + to avoid getting Nagle buffered. if we already did an accept, + however, we already sent a message and need not repeat it */ + if( !(dmode & DATA_ACCEPT) ){ + FPRINTF((stderr, "%sXPAClientStart: %d sending nagle\n", + _sp, client->cmdfd)); + XPAPuts(NULL, client->cmdfd, "xpanagle\n", XPAShortTimeout()); + } + + /* write a "data request" to the server on the data channel, supplying + the arguments to allow the server to find the associated command */ + if( dmode & DATA_DATA ){ + if( !word(lbuf, tbuf, &lp) ) + strcpy(tbuf, "?"); + if( !word(lbuf, tbuf2, &lp) ) + strcpy(tbuf2, "?"); + snprintf(lbuf, SZ_LINE, "xpadata -f %s %s\n", tbuf, tbuf2); + FPRINTF((stderr, + "%sXPAClientStart: sending data channel %d request: %s", _sp, + client->datafd, lbuf)); + if( XPAPuts(NULL, client->datafd, lbuf, XPAShortTimeout()) <0 ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: unable to issue data request: %s (%s:%s%s)\n", + lbuf, client->xclass, client->name, XPATimestamp()); + FPRINTF((stderr, "%sXPAClientStart: error returned is %s", _sp, errbuf)); + goto error; + } + } + +done: + /* mark as active and started */ + client->status = XPA_CLIENT_PROCESSING; + return(0); +} + +/* + *---------------------------------------------------------------------------- + * + * + * Public Routines + * + * + *---------------------------------------------------------------------------- + */ + +/* + *--------------------------------------------------------------------------- + * + * Routine: XPAClientValid + * + * Purpose: see if the xpa client struct is valid + * + * Results: 1 on success, 0 for failure + * + *--------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAClientValid (XPA xpa) +#else +int XPAClientValid(xpa) + XPA xpa; +#endif +{ + return(_XPAValid(xpaclienthead, xpa, "c")); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAOpen + * + * Purpose: open a persistent XPA client connection + * + * Returns: XPA struct on success + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +XPA +XPAOpen (char *mode) +#else +XPA XPAOpen(mode) + char *mode; +#endif +{ + XPA xpa; + + /* allocate xpa struct */ + if( (xpa = (XPA)xcalloc(1, sizeof(XPARec))) == NULL ) + return(NULL); + /* add version */ + xpa->version = xstrdup(XPA_VERSION); + /* mark this as a client struct */ + xpa->type = xstrdup("c"); + /* mark as persistent so we don't destroy at the end of the transfer */ + xpa->persist = 1; + + /* add this xpa to end of list of client xpas */ + XPAListAdd(&xpaclienthead, xpa); + + return(xpa); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAClose + * + * Purpose: close a persistent XPA client connection + * + * Returns: none + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +void +XPAClose (XPA xpa) +#else +void XPAClose(xpa) + XPA xpa; +#endif +{ + XPAClient client, tclient; + NS ns, tns; + + /* ignore struct if its not a client struct */ + if( !XPAClientValid(xpa) ) + return; + + /* remove from list of client xpas */ + XPAListDel(&xpaclienthead, xpa); + + /* free each remaining client */ + for(client=xpa->clienthead; client!=NULL; ){ + tclient = client->next; + XPAClientFree(xpa, client); + client = tclient; + } + + /* close down the name server and all of the remotes for this xpa */ + for(ns=xpa->nshead; ns!=NULL; ){ + tns = ns->next; + XPANSClose(xpa, ns); + ns = tns; + } + + /* free string space */ + if( xpa->version ) + xfree(xpa->version); + if( xpa->type ) + xfree(xpa->type); + if( xpa ) + xfree(xpa); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAGet + * + * Purpose: get XPA values + * + * Returns: 0 for success, -1 for failure + * len bytes of data returned in buf + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAGet (XPA xpa, char *xtemplate, char *paramlist, char *mode, + char **bufs, size_t *lens, char **names, char **messages, int n) +#else +int XPAGet(xpa, xtemplate, paramlist, mode, bufs, lens, names, messages, n) + XPA xpa; + char *xtemplate; + char *paramlist; + char *mode; + char **bufs; + size_t *lens; + char **names; + char **messages; + int n; +#endif +{ + int i; + int oldmode=0; + int xmode=0; + int type='g'; + int idef=1; + int got=0; + char tbuf[SZ_LINE]; + XPAClient client, tclient; + + FPRINTF((stderr, "%sXPAGet: starting\n", _sp)); + /* if not persistent, we need a temp xpa struct; + (also ignore passed struct if its not a client struct) */ + if( (xpa == NULL) || strcmp(xpa->type, "c") ){ + if( (xpa = XPAOpen(NULL)) == NULL ) + return(-1); + /* mark this as not persistent */ + xpa->persist = 0; + } + /* save xpa mode -- this call might override */ + else{ + /* make sure we have a valid client handle */ + if( !XPAClientValid(xpa) ){ + if( XPAVerbosity() ){ + fprintf(stderr, "XPA$ERROR: invalid xpa client handle\n"); + } + return(-1); + } + oldmode = xpa->client_mode; + } + + /* these arrays are required */ + if( (bufs == NULL) || (lens == NULL) ){ + got = -1; + goto done; + } + + /* flag that we don't read from stdin */ + xpa->ifd = -1; + + /* zero out the return buffers */ + memset((char *)bufs, 0, ABS(n)*sizeof(char *)); + memset((char *)lens, 0, ABS(n)*sizeof(size_t)); + if( names != NULL ) + memset((char *)names, 0, ABS(n)*sizeof(char *)); + if( messages != NULL ) + memset((char *)messages, 0, ABS(n)*sizeof(char *)); + + /* connect to clients and grab data */ + if( XPAClientConnect(xpa, mode, xtemplate, type) >0 ){ + /* retrieve data from n active clients */ + for(client=xpa->clienthead; client!=NULL; ){ + tclient = client->next; + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (gotxclass, client->name, client->method); + names[got] = xstrdup(tbuf); + } + if( XPAClientStart(xpa, client, paramlist, mode) >=0 ){ + /* we fill buffers */ + client->mode |= XPA_CLIENT_BUF; + client->bufptr = &(bufs[got]); + client->lenptr = &(lens[got]); + if( names != NULL ) + client->nameptr = &(names[got]); + if( messages != NULL ) + client->errptr = &(messages[got]); + } + else{ + if( messages != NULL ) + messages[got] = xstrdup(errbuf); + } + got++; + } + client = tclient; + } + /* if we have active clients */ + if( got ){ +#if HAVE_MINGW32==0 + /* check for loop modes */ + XPAMode(mode, &xmode, "dofork", XPA_CLIENT_SEL_FORK, 0); + /* dofork implies don't do xpa */ + if( xmode & XPA_CLIENT_SEL_FORK ) + idef = 0; + XPAMode(mode, &xmode, "doxpa", XPA_CLIENT_SEL_XPA, idef); + if( xmode & XPA_CLIENT_SEL_FORK ){ + XPAClientLoopFork(xpa, xmode); + } + else{ + /* enter the main loop and process */ + XPAClientLoop(xpa, xmode); + } +#else + XPAMode(mode, &xmode, "doxpa", XPA_CLIENT_SEL_XPA, idef); + XPAClientLoop(xpa, xmode); +#endif + } + } + +done: + /* look for clients who timed out */ + for(i=0, client=xpa->clienthead; client!=NULL; client=client->next){ + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (istatus == XPA_CLIENT_PROCESSING) && ( messages != NULL) ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: no response from server callback (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + messages[i] = xstrdup(errbuf); + } + } + } + /* remove this xpa if we are not meant to persist */ + if( xpa && !xpa->persist ) + XPAClose(xpa); + /* restore xpa mode -- this call might override */ + else + xpa->client_mode = oldmode; + + /* return number of clients processes (including errors) */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAGetFd + * + * Purpose: get XPA values + * + * Returns: 0 for success, -1 for failure + * len bytes of data returned in buf + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAGetFd (XPA xpa, char *xtemplate, char *paramlist, char *mode, + int *fds, char **names, char **messages, int n) +#else +int XPAGetFd(xpa, xtemplate, paramlist, mode, fds, names, messages, n) + XPA xpa; + char *xtemplate; + char *paramlist; + int *fds; + char *mode; + char **names; + char **messages; + int n; +#endif +{ + int i; + int oldmode=0; + int xmode=0; + int got=0; + int type='g'; + int idef=1; + char tbuf[SZ_LINE]; + XPAClient client, tclient; + + FPRINTF((stderr, "%sXPAGetFd: starting\n", _sp)); + /* if not persistent, we need a temp xpa struct; + (also ignore passed struct if its not a client struct) */ + if( (xpa == NULL) || strcmp(xpa->type, "c") ){ + if( (xpa = XPAOpen(NULL)) == NULL ) + return(-1); + /* mark this as not persistent */ + xpa->persist = 0; + } + /* save xpa mode -- this call might override */ + else{ + /* make sure we have a valid client handle */ + if( !XPAClientValid(xpa) ){ + if( XPAVerbosity() ){ + fprintf(stderr, "XPA$ERROR: invalid xpa client handle\n"); + } + return(-1); + } + oldmode = xpa->client_mode; + } + + /* flag that we don't read from stdin */ + xpa->ifd = -1; + + /* zero out the return buffers */ + if( names != NULL ) + memset((char *)names, 0, ABS(n)*sizeof(char *)); + if( messages != NULL ) + memset((char *)messages, 0, ABS(n)*sizeof(char *)); + + /* connect to clients and grab data */ + if( XPAClientConnect(xpa, mode, xtemplate, type) > 0 ){ + /* retrieve data from n active clients */ + for(client=xpa->clienthead; client!=NULL; ){ + tclient = client->next; + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (gotxclass, client->name, client->method); + names[got] = xstrdup(tbuf); + } + if( XPAClientStart(xpa, client, paramlist, mode) >= 0 ){ + /* we write to an fd */ + client->mode |= XPA_CLIENT_FD; + /* negative value => one channel for all clients */ + if( n < 0 ) + client->fd = fds[0]; + else + client->fd = fds[got]; + client->bufptr = (char **)xcalloc(1, sizeof(char *)); + client->lenptr = (size_t *)xcalloc(1, sizeof(size_t)); + if( names != NULL ) + client->nameptr = &(names[got]); + if( messages != NULL ) + client->errptr = &(messages[got]); + } + else{ + if( messages != NULL ) + messages[got] = xstrdup(errbuf); + } + got++; + } + client = tclient; + } + /* if we have active clients */ + if( got ){ +#if HAVE_MINGW32==0 + /* check for loop modes */ + XPAMode(mode, &xmode, "dofork", XPA_CLIENT_SEL_FORK, 0); + /* dofork implies don't do xpa */ + if( xmode & XPA_CLIENT_SEL_FORK ) + idef = 0; + XPAMode(mode, &xmode, "doxpa", XPA_CLIENT_SEL_XPA, idef); + if( xmode & XPA_CLIENT_SEL_FORK ){ + XPAClientLoopFork(xpa, xmode); + } + else{ + /* enter the main loop and process */ + XPAClientLoop(xpa, xmode); + } +#else + XPAMode(mode, &xmode, "doxpa", XPA_CLIENT_SEL_XPA, idef); + XPAClientLoop(xpa, xmode); +#endif + } + } + /* look for clients who timed out */ + for(i=0, client=xpa->clienthead; client!=NULL; client=client->next){ + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (istatus == XPA_CLIENT_PROCESSING) && ( messages != NULL) ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: no response from server callback (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + messages[i] = xstrdup(errbuf); + } + } + } + /* remove this xpa if we are not meant to persist */ + if( xpa && !xpa->persist ) + XPAClose(xpa); + /* restore xpa mode -- this call might override */ + else + xpa->client_mode = oldmode; + + /* return number of clients processes (including errors) */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPASet + * + * Purpose: set XPA values + * + * Returns: 0 for success, -1 for failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPASet (XPA xpa, char *xtemplate, char *paramlist, char *mode, + char *buf, size_t len, char **names, char **messages, int n) +#else +int XPASet(xpa, xtemplate, paramlist, mode, buf, len, names, messages, n) + XPA xpa; + char *xtemplate; + char *paramlist; + char *mode; + char *buf; + size_t len; + char **names; + char **messages; + int n; +#endif +{ + int i; + int oldmode=0; + int xmode=0; + int got=0; + int type='s'; + int idef=1; + char tbuf[SZ_LINE]; + XPAClient client, tclient; + + FPRINTF((stderr, "%sXPASet: starting\n", _sp)); + /* if not persistent, we need a temp xpa struct; + (also ignore passed struct if its not a client struct) */ + if( (xpa == NULL) || strcmp(xpa->type, "c") ){ + if( (xpa = XPAOpen(NULL)) == NULL ) + return(-1); + /* mark this as not persistent */ + xpa->persist = 0; + } + /* save xpa mode -- this call might override */ + else{ + /* make sure we have a valid client handle */ + if( !XPAClientValid(xpa) ){ + if( XPAVerbosity() ){ + fprintf(stderr, "XPA$ERROR: invalid xpa client handle\n"); + } + return(-1); + } + oldmode = xpa->client_mode; + } + + /* flag that we don't read from stdin */ + xpa->ifd = -1; + + /* zero out the return buffers */ + if( names != NULL ) + memset((char *)names, 0, ABS(n)*sizeof(char *)); + if( messages != NULL ) + memset((char *)messages, 0, ABS(n)*sizeof(char *)); + + /* connect to clients and grab data */ + if( XPAClientConnect(xpa, mode, xtemplate, type) >0 ){ + /* retrieve data from n active clients */ + for(client=xpa->clienthead; client!=NULL; ){ + tclient = client->next; + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (gotxclass, client->name, client->method); + names[got] = xstrdup(tbuf); + } + if( XPAClientStart(xpa, client, paramlist, mode) >= 0 ){ + /* we fill buffers */ + client->mode |= XPA_CLIENT_BUF; + client->buf = buf; + client->len = len; + if( names != NULL ) + client->nameptr = &(names[got]); + if( messages != NULL ) + client->errptr = &(messages[got]); + } + else{ + if( messages != NULL ) + messages[got] = xstrdup(errbuf); + } + got++; + } + client = tclient; + } + /* if we have active clients */ + if( got ){ +#if HAVE_MINGW32==0 + /* check for loop modes */ + XPAMode(mode, &xmode, "dofork", XPA_CLIENT_SEL_FORK, 0); + /* dofork implies don't do xpa */ + if( xmode & XPA_CLIENT_SEL_FORK ) + idef = 0; + XPAMode(mode, &xmode, "doxpa", XPA_CLIENT_SEL_XPA, idef); + if( xmode & XPA_CLIENT_SEL_FORK ){ + XPAClientLoopFork(xpa, xmode); + } + else{ + /* enter the main loop and process */ + XPAClientLoop(xpa, xmode); + } +#else + XPAMode(mode, &xmode, "doxpa", XPA_CLIENT_SEL_XPA, idef); + XPAClientLoop(xpa, xmode); +#endif + } + } + /* look for clients who timed out */ + for(i=0, client=xpa->clienthead; client!=NULL; client=client->next){ + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (istatus == XPA_CLIENT_PROCESSING) && ( messages != NULL) ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: no response from server callback (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + messages[i] = xstrdup(errbuf); + } + } + } + /* remove this xpa if we are not meant to persist */ + if( xpa && !xpa->persist ) + XPAClose(xpa); + /* restore xpa mode -- this call might override */ + else + xpa->client_mode = oldmode; + + /* return number of clients processes (including errors) */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPASetFd + * + * Purpose: set XPA values + * + * Returns: 0 for success, -1 for failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPASetFd (XPA xpa, char *xtemplate, char *paramlist, char *mode, + int fd, char **names, char **messages, int n) +#else +int XPASetFd(xpa, xtemplate, paramlist, mode, fd, names, messages, n) + XPA xpa; + char *xtemplate; + char *paramlist; + char *mode; + int fd; + char **names; + char **messages; + int n; +#endif +{ + int i; + int oldmode=0; + int xmode=0; + int got=0; + int got2=0; + int type='s'; + int idef=1; + int flags; + char *s; + char tbuf[SZ_LINE]; + XPAClient client, tclient; + + FPRINTF((stderr, "%sXPASetFd: starting\n", _sp)); + /* if not persistent, we need a temp xpa struct; + (also ignore passed struct if its not a client struct) */ + if( (xpa == NULL) || strcmp(xpa->type, "c") ){ + if( (xpa = XPAOpen(NULL)) == NULL ) + return(-1); + /* mark this as not persistent */ + xpa->persist = 0; + } + /* save xpa mode -- this call might override */ + else{ + /* make sure we have a valid client handle */ + if( !XPAClientValid(xpa) ){ + if( XPAVerbosity() ){ + fprintf(stderr, "XPA$ERROR: invalid xpa client handle\n"); + } + return(-1); + } + oldmode = xpa->client_mode; + } + + /* Set non-blocking mode for the input fd, if its not a tty */ + xpa->ifd = fd; + if( isatty(xpa->ifd) == 0 ){ + /* save state and set in non-blocking mode */ + xfcntl_nonblock(xpa->ifd, flags); + } + /* zero out the return buffers */ + if( names != NULL ) + memset((char *)names, 0, ABS(n)*sizeof(char *)); + if( messages != NULL ) + memset((char *)messages, 0, ABS(n)*sizeof(char *)); + + /* connect to clients and grab data */ + if( XPAClientConnect(xpa, mode, xtemplate, type) >0 ){ + /* open clients all at once */ + for(client=xpa->clienthead; client!=NULL; ){ + tclient = client->next; + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (gotxclass, client->name, client->method); + names[got] = xstrdup(tbuf); + } + if( XPAClientStart(xpa, client, paramlist, mode) >= 0 ){ + /* we fill buffers */ + client->mode |= XPA_CLIENT_FD; + if( names != NULL ) + client->nameptr = &(names[got]); + if( messages != NULL ) + client->errptr = &(messages[got]); + } + else{ + if( messages != NULL ) + messages[got] = xstrdup(errbuf); + } + got++; + } + client = tclient; + } + /* if we have active clients */ + if( got ){ + /* if fd is null, user did not want to send data, just the paramlist */ + if( fd < 0 ){ + for(client=xpa->clienthead; client!=NULL; ){ + tclient = client->next; + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (gotclienthead; client!=NULL; client=client->next){ + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (istatus == XPA_CLIENT_PROCESSING) && ( messages != NULL) ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: no response from server callback (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + messages[i] = xstrdup(errbuf); + } + } + } + /* reset flags, if necessary */ + if( xpa->ifd >=0 && (isatty(xpa->ifd) ==0) ){ + xfcntl(xpa->ifd, F_SETFL, flags); + } + /* free all input structs */ + XPAClientFreeAllInputs(xpa); + /* remove this xpa if we are not meant to persist */ + if( xpa && !xpa->persist ) + XPAClose(xpa); + /* restore xpa mode -- this call might override */ + else + xpa->client_mode = oldmode; + + /* return number of clients processes (including errors) */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAInfo + * + * Purpose: send XPA info + * + * Returns: 0 for success, -1 for failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAInfo (XPA xpa, char *xtemplate, char *paramlist, char *mode, + char **names, char **messages, int n) +#else +int XPAInfo(xpa, xtemplate, paramlist, mode, names, messages, n) + XPA xpa; + char *xtemplate; + char *paramlist; + char *mode; + char **names; + char **messages; + int n; +#endif +{ + int i; + int oldmode=0; + int got=0; + char type='i'; + char *s; + char tbuf[SZ_LINE]; + XPAClient client, tclient; + + /* if not persistent, we need a temp xpa struct; + (also ignore passed struct if its not a client struct) */ + if( (xpa == NULL) || strcmp(xpa->type, "c") ){ + if( (xpa = XPAOpen(NULL)) == NULL ) + return(-1); + /* mark this as not persistent */ + xpa->persist = 0; + } + /* save xpa mode -- this call might override */ + else{ + /* make sure we have a valid client handle */ + if( !XPAClientValid(xpa) ){ + if( XPAVerbosity() ){ + fprintf(stderr, "XPA$ERROR: invalid xpa client handle\n"); + } + return(-1); + } + oldmode = xpa->client_mode; + } + + /* flag that we don't read from stdin */ + xpa->ifd = -1; + + /* zero out the return buffers */ + if( names != NULL ) + memset((char *)names, 0, ABS(n)*sizeof(char *)); + if( messages != NULL ) + memset((char *)messages, 0, ABS(n)*sizeof(char *)); + + /* connect to clients and grab data */ + if( XPAClientConnect(xpa, mode, xtemplate, type) >0 ){ + /* retrieve data from n active clients */ + for(client=xpa->clienthead; client!=NULL; ){ + tclient = client->next; + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (gotxclass, client->name, client->method); + names[got] = xstrdup(tbuf); + } + if( XPAClientStart(xpa, client, paramlist, mode) >= 0 ){ + XPAClientDataSent(xpa, client); + s = XPAClientEnd(xpa, client); + if( (messages != NULL) && (messages[got] == NULL) ) + messages[got] = xstrdup(s); + } + else{ + if( (messages != NULL) && (messages[got] == NULL) ) + messages[got] = xstrdup(errbuf); + } + got++; + } + client = tclient; + } + } + /* look for clients who timed out */ + for(i=0, client=xpa->clienthead; client!=NULL; client=client->next){ + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (istatus == XPA_CLIENT_PROCESSING) && ( messages != NULL) ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: no response from server callback (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + messages[i] = xstrdup(errbuf); + } + } + } + /* remove this xpa if we are not meant to persist */ + if( xpa && !xpa->persist ) + XPAClose(xpa); + /* restore xpa mode -- this call might override */ + else + xpa->client_mode = oldmode; + + /* return number of clients processes (including errors) */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAAccess + * + * Purpose: determine if XPA access point is available + * + * Returns: 0 for success, -1 for failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAAccess (XPA xpa, char *xtemplate, char *paramlist, char *mode, + char **names, char **messages, int n) +#else +int XPAAccess(xpa, xtemplate, paramlist, mode, names, messages, n) + XPA xpa; + char *xtemplate; + char *paramlist; + char *mode; + char **names; + char **messages; + int n; +#endif +{ + int i; + int oldmode=0; + int xmode=0; + int got=0; + int type='a'; + char *s; + char *ind1, *ind2; + char tbuf[SZ_LINE]; + XPAClient client, tclient; + + /* if not persistent, we need a temp xpa struct; + (also ignore passed struct if its not a client struct) */ + if( (xpa == NULL) || strcmp(xpa->type, "c") ){ + if( (xpa = XPAOpen(NULL)) == NULL ) + return(-1); + /* mark this as not persistent */ + xpa->persist = 0; + } + /* save xpa mode -- this call might override */ + else{ + /* make sure we have a valid client handle */ + if( !XPAClientValid(xpa) ){ + if( XPAVerbosity() ){ + fprintf(stderr, "XPA$ERROR: invalid xpa client handle\n"); + } + return(-1); + } + oldmode = xpa->client_mode; + } + + /* flag that we don't read from stdin */ + xpa->ifd = -1; + + /* zero out the return buffers */ + if( names != NULL ) + memset((char *)names, 0, ABS(n)*sizeof(char *)); + if( messages != NULL ) + memset((char *)messages, 0, ABS(n)*sizeof(char *)); + + /* connect to clients and grab data */ + if( XPAClientConnect(xpa, mode, xtemplate, type) >0 ){ + /* retrieve data from n active clients */ + for(client=xpa->clienthead; client!=NULL; ){ + tclient = client->next; + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (gotxclass, client->name, client->method); + names[got] = xstrdup(tbuf); + } + if( XPAClientStart(xpa, client, paramlist, mode) >=0 ){ + XPAClientDataSent(xpa, client); + s = XPAClientEnd(xpa, client); + if( (messages != NULL) && (messages[got] == NULL) ) + messages[got] = xstrdup(s); + } + else{ + if( (messages != NULL) && (messages[got] == NULL) ) + messages[got] = xstrdup(errbuf); + } + /* might have to fix the name if was an explicit mach:port */ + if( names && names[got] && *errbuf && + !strncmp(names[got], "?:?", 3) && + (ind1=strrchr(errbuf, '(')) && (ind2=strrchr(errbuf, ')')) ){ + ind1++; + strncpy(tbuf, ind1, ind2-ind1); + tbuf[ind2-ind1] = '\0'; + xfree(names[got]); + names[got] = xstrdup(tbuf); + } + got++; + } + client = tclient; + } + /* if we have active clients */ + if( got ){ + /* check for loop modes */ + XPAMode(mode, &xmode, "doxpa", XPA_CLIENT_SEL_XPA, 1); + /* enter the main loop and process */ + XPAClientLoop(xpa, xmode); + } + } + /* look for clients who timed out */ + for(i=0, client=xpa->clienthead; client!=NULL; client=client->next){ + if( (client->type == type) && (client->status != XPA_CLIENT_IDLE) && + (istatus == XPA_CLIENT_PROCESSING) && ( messages != NULL) ){ + snprintf(errbuf, SZ_LINE, + "XPA$ERROR: no response from server callback (%s:%s%s)\n", + client->xclass, client->name, XPATimestamp()); + messages[i] = xstrdup(errbuf); + } + } + } + /* remove this xpa if we are not meant to persist */ + if( xpa && !xpa->persist ) + XPAClose(xpa); + /* restore xpa mode -- this call might override */ + else + xpa->client_mode = oldmode; + + /* return number of clients processes (including errors) */ + return(got); +} + diff --git a/clipboard.c b/clipboard.c new file mode 100644 index 0000000..68df675 --- /dev/null +++ b/clipboard.c @@ -0,0 +1,324 @@ +/* + * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory + */ + +/* + * + * remote.c -- xpa access control list management + * + */ + +#include + +/* + *---------------------------------------------------------------------------- + * + * + * Private Routines + * + * + *---------------------------------------------------------------------------- + */ + +#ifdef ANSI_FUNC +static XPAClip +ClipBoardNew(XPA xpa, char *name) +#else +static XPAClip ClipBoardNew(xpa, name) + XPA xpa; + char *name; +#endif +{ + XPAClip cur, xnew; + if( (xnew = (XPAClip)xcalloc(1, sizeof(XPAClipRec))) == NULL ) + return(NULL); + + /* fill in record structure */ + xnew->name = xstrdup(name); + xnew->ip = xpa->comm->cmdip; + + /* add to the end of list */ + if( xpa->cliphead == NULL ){ + xpa->cliphead = xnew; + } + else{ + for(cur=xpa->cliphead; cur->next!=NULL; cur=cur->next){ + ; + } + cur->next = xnew; + } + return xnew; +} + +#ifdef ANSI_FUNC +static XPAClip +ClipBoardLookup(XPA xpa, char *name) +#else +static XPAClip ClipBoardLookup(xpa, name) + XPA xpa; + char *name; +#endif +{ + XPAClip cur; + + /* look for reserved keywords that have callbacks */ + for(cur=xpa->cliphead; cur!=NULL; cur=cur->next){ + if( !strcmp(name, cur->name) && (xpa->comm->cmdip == cur->ip) ){ + return(cur); + } + } + return NULL; +} + +#ifdef ANSI_FUNC +static int +ClipBoardAdd(XPA xpa, char *name, char *paramlist, char *buf) +#else +static int +ClipBoardAdd(xpa, name, paramlist, buf) + XPA xpa; + char *name; + char *paramlist; + char *buf; +#endif +{ + XPAClip cur; + if( !(cur = ClipBoardLookup(xpa, name)) ) + cur = ClipBoardNew(xpa, name); + if( !cur ) + return -1; + if( cur->value ) + xfree(cur->value); + cur->value = xstrdup(buf); + return 0; +} + +#ifdef ANSI_FUNC +static int +ClipBoardAppend(XPA xpa, char *name, char *paramlist, char *buf) +#else +static int +ClipBoardAppend(xpa, name, paramlist, buf) + XPA xpa; + char *name; + char *paramlist; + char *buf; +#endif +{ + XPAClip cur; + if( !(cur = ClipBoardLookup(xpa, name)) ) + cur = ClipBoardNew(xpa, name); + if( !cur ) + return -1; + if( cur->value ){ + if( (cur->value = (char *)xrealloc(cur->value, + strlen(cur->value)+strlen(buf)+1)) ) + strcat(cur->value, buf); + else + return -1; + } + else{ + cur->value = xstrdup(buf); + } + return 0; +} + +#ifdef ANSI_FUNC +static int +ClipBoardDelete(XPA xpa, char *name, char *paramlist) +#else +static int +ClipBoardDelete(xpa, name, paramlist) + XPA xpa; + char *name; + char *paramlist; +#endif +{ + XPAClip cur; + if( (cur = ClipBoardLookup(xpa, name)) ){ + ClipBoardFree(xpa, cur); + return 0; + } + else + return -1; +} + +/* + *---------------------------------------------------------------------------- + * + * + * Semi-Public Routines (used by xpa.c and command.c) + * + * + *---------------------------------------------------------------------------- + */ + +#ifdef ANSI_FUNC +int +ClipBoardFree(XPA xpa, XPAClip clip) +#else +int ClipBoardFree(xpa, clip) + XPA xpa; + XPAClip clip; +#endif +{ + XPAClip cur; + + if( !clip ) + return 0; + /* remove from list */ + if( xpa->cliphead ){ + if( xpa->cliphead == clip ){ + xpa->cliphead = clip->next; + } + else{ + for(cur=xpa->cliphead; cur!=NULL; cur=cur->next){ + if( cur->next == clip ){ + cur->next = clip->next; + break; + } + } + } + } + if( clip->name ) xfree(clip->name); + if( clip->value ) xfree(clip->value); + xfree(clip); + return 1; +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAReceiveClipboard + * + * Purpose: add a new clipboard entry + * + * Returns: xpa callback error codes + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAReceiveClipboard (void *client_data, void *call_data, char *paramlist, + char *buf, size_t len) +#else +int XPAReceiveClipboard(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char *buf; + size_t len; +#endif +{ + XPA xpa = (XPA)call_data; + char cmd[SZ_LINE]; + char name[SZ_LINE]; + char tbuf[SZ_LINE]; + int lp=0; + int status = -1; + + *cmd = '\0'; + *name = '\0'; + if( paramlist && *paramlist ){ + if( !word(paramlist, cmd, &lp) || !word(paramlist, name, &lp) ) + goto done; + /* lookup the command */ + if( !strcmp(cmd, "add") ){ + status = ClipBoardAdd(xpa, name, ¶mlist[lp], buf); + } + else if( !strncmp(cmd, "app", 3) ){ + status = ClipBoardAppend(xpa, name, ¶mlist[lp], buf); + } + else if( !strncmp(cmd, "del", 3) ){ + status = ClipBoardDelete(xpa, name, ¶mlist[lp]); + } +#ifdef LATER + else if( !strncmp(cmd, "loa", 3) ){ + status = ClipBoardLoad(xpa, name, ¶mlist[lp], buf); + } + else if( !strncmp(cmd, "sav", 3) ){ + status = ClipBoardSave(xpa, name, ¶mlist[lp]); + } +#endif + } + +done: + if( status < 0 ){ + if( !*cmd || !*name ){ + XPAError(xpa, "XPA clipboard requires: add|append|delete name\n"); + } + else{ + snprintf(tbuf, SZ_LINE, + "XPA clipboard invalid cmd or name: %s %s\n", cmd, name); + XPAError(xpa, tbuf); + } + } + return(status); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPASendClipboard + * + * Purpose: return clipboard information + * + * Returns: 0 for success, -1 for failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPASendClipboard (void *client_data, void *call_data, char *paramlist, + char **buf, size_t *len) +#else +int XPASendClipboard(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char **buf; + size_t *len; +#endif +{ + XPA xpa = (XPA)call_data; + char name[SZ_LINE]; + char tbuf[SZ_LINE]; + int lp=0; + int status = -1; + XPAClip cur; + + *name = '\0'; + if( paramlist && *paramlist ){ + if( !word(paramlist, name, &lp) ) + goto done; + if( !(cur = ClipBoardLookup(xpa, name)) ) + goto done; + if( cur->value ){ + send(xpa_datafd(xpa), cur->value, strlen(cur->value), 0); + status = 0; + } + } + +done: + if( status < 0 ){ + if( !*name ){ + XPAError(xpa, "XPA clipboard requires: name\n"); + } + else{ + snprintf(tbuf, SZ_LINE, "XPA clipboard invalid name: %s\n", name); + XPAError(xpa, tbuf); + } + } + return(status); +} + +/* + *---------------------------------------------------------------------------- + * + * + * Public Routines + * + * + *---------------------------------------------------------------------------- + */ + diff --git a/command.c b/command.c new file mode 100644 index 0000000..2ea182d --- /dev/null +++ b/command.c @@ -0,0 +1,1217 @@ +/* + * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory + */ + +#include + +/* + *---------------------------------------------------------------------------- + * + * + * Private Routines and Data + * + * + *---------------------------------------------------------------------------- + */ + +/* this is the static xpa struct that holds the reserved commands */ +static XPA rxpa=NULL; + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPACmdParseNames + * + * Purpose: massage a name string, changing multiple sequential spaces + * into a single space + * + * Returns: new name, with spaces massaged (also number of spacess) + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static char * +XPACmdParseNames(char *lbuf, int *ntokens) +#else +static char *XPACmdParseNames(lbuf, ntokens) + char *lbuf; + int *ntokens; +#endif +{ + char tbuf[SZ_LINE]; + int lp=0; + char *buf; + + /* can't be larger than the original string */ + buf = (char *)xmalloc(strlen(lbuf)+1); + *buf = '\0'; + *ntokens = 0; + + /* pick off each word, separating by a single space */ + while( word(lbuf, tbuf, &lp)){ + if( *buf != '\0' ) + strcat(buf, " "); + strcat(buf, tbuf); + *ntokens += 1; + } + + /* make the string the right size */ + buf = (char *)xrealloc(buf, strlen(buf)+1); + return(buf); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAReceiveNSConnect + * + * Purpose: reset and re-establish connection to name server + * + * Returns: xpa callback error codes + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAReceiveNSConnect (void *client_data, void *call_data, char *paramlist, + char *buf, size_t len) +#else +static int XPAReceiveNSConnect(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char *buf; + size_t len; +#endif +{ + XPA xpa = (XPA)call_data; + XPA txpa; + char tbuf[SZ_LINE]; + int doall=0; + int lp=0; + + if( paramlist && *paramlist ){ + if( word(paramlist, tbuf, &lp) && !strcmp(tbuf, "-all") ){ + doall = 1; + } + } + if( doall ){ + for(txpa=XPAListHead(); txpa!=NULL; txpa=txpa->next){ + XPANSAdd(txpa, NULL, NULL); + } + } + else{ + XPANSAdd(xpa, NULL, NULL); + } + return(0); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAReceiveNSDisconnect + * + * Purpose: break connection to name server + * + * Returns: xpa callback error codes + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAReceiveNSDisconnect (void *client_data, void *call_data, char *paramlist, + char *buf, size_t len) +#else +static int XPAReceiveNSDisconnect(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char *buf; + size_t len; +#endif +{ + XPA xpa = (XPA)call_data; + XPA txpa; + NS ns, tns; + char tbuf[SZ_LINE]; + int doall=0; + int lp=0; + + if( paramlist && *paramlist ){ + if( word(paramlist, tbuf, &lp) && !strcmp(tbuf, "-all") ){ + doall = 1; + } + } + if( doall ){ + for(txpa=XPAListHead(); txpa!=NULL; txpa=txpa->next){ + for(ns=txpa->nshead; ns!= NULL; ){ + tns = ns->next; + XPANSClose(txpa, ns); + ns = tns; + } + } + } + else{ + for(ns=xpa->nshead; ns!= NULL; ){ + tns = ns->next; + XPANSClose(xpa, ns); + ns = tns; + } + } + return(0); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAReceiveEnv + * + * Purpose: set an environment variable + * + * Returns: xpa callback error codes + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAReceiveEnv (void *client_data, void *call_data, char *paramlist, + char *buf, size_t len) +#else +static int XPAReceiveEnv(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char *buf; + size_t len; +#endif +{ + XPA xpa = (XPA)call_data; + char name[SZ_LINE]; + char value[SZ_LINE]; + char *tbuf; + int lp=0; + + if( word(paramlist, name, &lp) ){ + if( word(paramlist, value, &lp) ){ + tbuf = (char *)xmalloc(strlen(name)+1+strlen(value)+1); + snprintf(tbuf, SZ_LINE, "%s=%s", name, value); + putenv(tbuf); + return(0); + } + else{ + if( strchr(name, '=') != NULL ){ + tbuf = xstrdup(name); + putenv(tbuf); + return(0); + } + else{ + XPAError(xpa, "XPA setenv requires name and value pair\n"); + return(-1); + } + } + } + else{ + XPAError(xpa, "XPA setenv requires name and value pair\n"); + return(-1); + } +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPASendEnv + * + * Purpose: return an environment variable to client + * + * Returns: xpa callback error codes + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPASendEnv (void *client_data, void *call_data, char *paramlist, + char **buf, size_t *len) +#else +static int XPASendEnv(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char **buf; + size_t *len; +#endif +{ + int tlen; + char *tbuf; + char *ebuf; + + if( (ebuf = (char *)getenv(paramlist)) != NULL ){ + tlen = strlen(ebuf)+2; + tbuf = (char *)xmalloc(tlen); + snprintf(tbuf, tlen, "%s\n", ebuf); + *buf = tbuf; + *len = strlen(tbuf); + } + else{ + *buf = xstrdup("\n"); + *len = 1; + } + return(0); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAReceiveReserved + * + * Purpose: execute reserved command + * + * Returns: xpa callback error codes + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPAReceiveReserved (void *client_data, void *call_data, char *paramlist, + char *buf, size_t len) +#else +static int XPAReceiveReserved(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char *buf; + size_t len; +#endif +{ + char *cmd = (char *)client_data; + XPA xpa = (XPA)call_data; + + if( !strcmp(cmd, "end") ){ + xpa->comm->status |= XPA_STATUS_ENDBUF; + return(0); + } + else if( !strcmp(cmd, "exec") ){ + xpa->comm->status |= XPA_STATUS_READBUF; + return(0); + } + else{ + return(-1); + } +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPASendHelp + * + * Purpose: send help strings + * + * Returns: xpa callback error codes + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPASendHelp (void *client_data, void *call_data, char *paramlist, + char **buf, size_t *len) +#else +static int XPASendHelp(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char **buf; + size_t *len; +#endif +{ + XPA xpa = (XPA)call_data; + XPACmd cmd; + int lp=0; + int slen; + char tbuf[SZ_LINE]; + char lbuf[SZ_LINE]; + char *sbuf; + + if( !paramlist || !*paramlist ){ + if( xpa->version != NULL ){ + snprintf(lbuf, SZ_LINE, "XPA version: %s\n", xpa->version); + send(xpa_datafd(xpa), lbuf, strlen(lbuf), 0); + } + } + if( xpa->commands == NULL ){ + if( xpa->help != NULL ){ + slen = strlen(xpa->help)+SZ_LINE; + sbuf = (char *)xmalloc(slen); + snprintf(sbuf, slen, "%s\n", xpa->help); + send(xpa_datafd(xpa), sbuf, strlen(sbuf), 0); + xfree(sbuf); + } + else{ + strcpy(lbuf, "\n"); + send(xpa_datafd(xpa), lbuf, strlen(lbuf), 0); + } + } + else{ + if( paramlist && *paramlist ){ + while( word(paramlist, tbuf, &lp) ){ + for(cmd=xpa->commands; cmd!=NULL; cmd=cmd->next){ + if( !strcmp(tbuf, cmd->name) ){ + if( cmd->help != NULL ){ + slen = strlen(cmd->name)+strlen(cmd->help)+SZ_LINE; + sbuf = (char *)xmalloc(slen); + snprintf(sbuf, slen, "%s:\t%s\n", cmd->name, cmd->help); + send(xpa_datafd(xpa), sbuf, strlen(sbuf), 0); + xfree(sbuf); + } + else{ + snprintf(lbuf, SZ_LINE, "%s:\t(no help available)\n", cmd->name); + send(xpa_datafd(xpa), lbuf, strlen(lbuf), 0); + } + } + } + } + } + else{ + for(cmd=xpa->commands; cmd!=NULL; cmd=cmd->next){ + if( cmd->help != NULL ){ + slen = strlen(cmd->name)+strlen(cmd->help)+SZ_LINE; + sbuf = (char *)xmalloc(slen); + snprintf(sbuf, slen, "%s:\t%s\n", cmd->name, cmd->help); + send(xpa_datafd(xpa), sbuf, strlen(sbuf), 0); + xfree(sbuf); + } + else{ + snprintf(lbuf, SZ_LINE, "%s:\t(no help available)\n", cmd->name); + send(xpa_datafd(xpa), lbuf, strlen(lbuf), 0); + } + } + } + } + return(0); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPASendVersion + * + * Purpose: send XPA version string + * + * Returns: xpa callback error codes + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +static int +XPASendVersion (void *client_data, void *call_data, char *paramlist, + char **buf, size_t *len) +#else +static int XPASendVersion(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char **buf; + size_t *len; +#endif +{ + XPA xpa = (XPA)call_data; + char lbuf[SZ_LINE]; + + if( xpa->version != NULL ) + snprintf(lbuf, SZ_LINE, "%s\n", xpa->version); + else + strcpy(lbuf, "\n"); + send(xpa_datafd(xpa), lbuf, strlen(lbuf), 0); + return(0); +} + +/* + *---------------------------------------------------------------------------- + * + * + * Semi-Public Routines and Data + * + * These routines are used by XPAHandler and XPANew + * + * + *---------------------------------------------------------------------------- + */ + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAInitReserved + * + * Purpose: add the reserved commands to the reserved xpa struct + * + * Results: none + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +void +XPAInitReserved (void) +#else +void XPAInitReserved() +#endif +{ + if( !rxpa ){ + if( (rxpa = (XPA)xcalloc(1, sizeof(struct xparec))) == NULL ) + return; + /* XPACmdAdd requires that the callbacks be defined explicitly in rxpa */ + rxpa->send_callback = XPASendCommands; + rxpa->receive_callback = XPAReceiveCommands; + /* add reserved commands */ + XPACmdAdd(rxpa, "-acl", + "\tget (set) the access control list\n\t\t options: host type acl", + XPASendAcl, NULL, NULL, XPAReceiveAcl, NULL, "fillbuf=false"); + XPACmdAdd(rxpa, "-env", + "\tget (set) an environment variable\n\t\t options: name (value)", + XPASendEnv, NULL, NULL, XPAReceiveEnv, NULL, NULL); + XPACmdAdd(rxpa, "-exec", + "\texecute commands from buffer\n\t\t options: none", + NULL, NULL, NULL, XPAReceiveReserved, (void *)"exec", NULL); + XPACmdAdd(rxpa, "-help", + "\treturn help string for specified XPA\n\t\t options: cmd name (commands only)", + XPASendHelp, NULL, NULL, NULL, NULL, NULL); + XPACmdAdd(rxpa, "-ltimeout", + "\tget (set) long timeout\n\t\t options: seconds|reset", + XPASendLTimeout, NULL, NULL, XPAReceiveLTimeout, NULL, NULL); + XPACmdAdd(rxpa, "-nsconnect", + "\tre-establish name server connection to this XPA\n\t\t options: -all", + NULL, NULL, NULL, XPAReceiveNSConnect, NULL, NULL); + XPACmdAdd(rxpa, "-nsdisconnect", + "\tbreak name server connection to this XPA\n\t\t options: -all", + NULL, NULL, NULL, XPAReceiveNSDisconnect, NULL, NULL); + XPACmdAdd(rxpa, "-remote", + "\tconnect to remote name service with specified acl \n\t\t options: host:port +|-|acl -proxy", + XPASendRemote, NULL, NULL, XPAReceiveRemote, NULL, "fillbuf=false"); + XPACmdAdd(rxpa, "-clipboard", + "\tset/get clipboard information \n\t\t options: [cmd] name", + XPASendClipboard, NULL, NULL, XPAReceiveClipboard, NULL, NULL); + XPACmdAdd(rxpa, "-stimeout", + "\tget (set) short timeout\n\t\t options: seconds|reset", + XPASendSTimeout, NULL, NULL, XPAReceiveSTimeout, NULL, NULL); + XPACmdAdd(rxpa, "-version", + "\treturn XPA version string\n\t\t options: none", + XPASendVersion, NULL, NULL, NULL, NULL, NULL); + } +} + +#ifdef ANSI_FUNC +void +XPAFreeReserved (void) +#else +void XPAFreeReserved() +#endif +{ + XPACmd cmd, tcmd; + if( !rxpa ) return; + /* free reserved commands */ + for(cmd=rxpa->commands; cmd!=NULL; ){ + tcmd = cmd->next; + XPACmdDel(rxpa, cmd); + cmd = tcmd; + } + xfree(rxpa); + rxpa = NULL; +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPACmdLookupReserved + * + * Purpose: lookup a reserved command name + * + * Results: cmd struct or null + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +XPACmd +XPACmdLookupReserved (XPA xpa, char *lbuf, int *lp) +#else +XPACmd XPACmdLookupReserved(xpa, lbuf, lp) + XPA xpa; + char *lbuf; + int *lp; +#endif +{ + XPACmd cmd; + int lp2=0; + char *lptr; + char name[SZ_LINE]; + + /* make sure we have something to work with */ + if( (rxpa==NULL) || (lbuf==NULL) || (lbuf[*lp]=='\0') ) + return(NULL); + + /* this is where we start parsing */ + lptr = &(lbuf[*lp]); + + /* to simplify life, we assume reserved words are 1 token */ + if( !word(lptr, name, &lp2) ) + return(NULL); + + /* look for reserved keywords that have callbacks */ + for(cmd=rxpa->commands; cmd!=NULL; cmd=cmd->next){ + if( !strcmp(name, cmd->name) ){ + *lp += lp2; + return(cmd); + } + } + + /* nothing, nowhere */ + return(NULL); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPACmdLookup + * + * Purpose: lookup a user-defined command name + * + * Results: cmd struct or null + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +XPACmd +XPACmdLookup (XPA xpa, char *lbuf, int *lp) +#else +XPACmd XPACmdLookup(xpa, lbuf, lp) + XPA xpa; + char *lbuf; + int *lp; +#endif +{ + XPACmd cmd; + int i; + int lp2; + int len, tlen; + char *lptr; + char tbuf[SZ_LINE]; + char name[SZ_LINE]; + + /* make sure we have something to work with */ + if( (xpa==NULL) || (lbuf==NULL) || (lbuf[*lp]=='\0') ) + return(NULL); + + /* this is where we start parsing */ + lptr = &(lbuf[*lp]); + + /* look up commands for this name */ + for(cmd=xpa->commands; cmd!=NULL; cmd=cmd->next){ + /* make up a name with the required number of tokens for this command */ + *name = '\0'; + lp2 = 0; + tlen = 0; + for(i=0; intokens; i++){ + if( word(lptr, tbuf, &lp2)){ + len = strlen(tbuf)+1; + if( (tlen+len) <= (SZ_LINE-1) ){ + if( *name != '\0' ) + strcat(name, " "); + strcat(name, tbuf); + tlen += len; + } + /* not enough room */ + else{ + *name = '\0'; + break; + } + } + } + /* we now have the name, see if its what we want */ + if( *name && !strcmp(cmd->name, name) ){ + *lp += lp2; + return(cmd); + } + } + + /* did not find the command in this xpa -- now look through reserved */ + return(XPACmdLookupReserved(xpa, lbuf, lp)); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAReceiveCommands + * + * Purpose: process a list of commands from xpaset + * + * Results: number of commands processed + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPAReceiveCommands (void *client_data, void *call_data, char *paramlist, + char *buf, size_t len) +#else +int XPAReceiveCommands(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char *buf; + size_t len; +#endif +{ + XPA xpa = (XPA)call_data; + XPACmd cmd; + int lp; + int savelp; + int plen; + int bgot; + int got=0; + int gotbuf=0; + int freebuf=1; + char lbuf[SZ_LINE]; + char tbuf[SZ_LINE]; + char tbuf1[SZ_LINE]; + + /* use ";" as a command separator (as well as \n) */ + newdtable(";"); + + /* if we already have buf, there will be no need to get it */ + if( buf ) + gotbuf++; + + /* if we have no paramlist, we read from the socket */ + if( (xpa_datafd(xpa) >=0) && (!paramlist || (*paramlist == '\0')) ){ + xpa->comm->status |= XPA_STATUS_READBUF; + XPAGets(xpa, xpa_datafd(xpa), lbuf, SZ_LINE, XPALongTimeout()); + FPRINTF((stderr, "%sXPAReceiveCommands: read %s\n", _sp, lbuf)); + } + else{ + xpa->comm->status &= ~XPA_STATUS_READBUF; + nowhite(paramlist, lbuf); + } + + /* we must have something to start with */ + if( *lbuf == '\0' ){ + XPAError(xpa, xpaMessbuf[XPA_RTN_NOCMD2]); + got = -1; + goto done; + } + + /* This look either executes the one set of commands in paramlist, + or reads one line at a time from the socket and executes commands. + In the latter case, each callback can read the socket as well */ + while( 1 ){ + FPRINTF((stderr, "%sXPAReceiveCommands: top of loop: %s\n", _sp, lbuf)); + lp = 0; + while( lbuf[lp] != '\0' ){ + if( (cmd = XPACmdLookup(xpa, lbuf, &lp)) == NULL ){ + XPAError(xpa, xpaMessbuf[XPA_RTN_UNCMD]); + got = -1; + goto done; + } + /* reserved commands can only be called from the same host as the server, + or from local (unix) sockets */ + if( (cmd->xpa == rxpa) && + strcmp(cmd->name, "-help") && strcmp(cmd->name, "-version") ){ + if( XPAMtype() == XPA_INET ){ + if( (!xpa->comm || !LOCALIP(xpa->comm->cmdip)) ){ + FPRINTF((stderr, "%sXPAReceiveCommands: rejecting reserved: %s\n", + _sp, cmd->name)); + XPAError(xpa, xpaMessbuf[XPA_RTN_NOAUTH]); + got = -1; + goto done; + } + } + } + FPRINTF((stderr, "%sXPAReceiveCommands: cmd->name: %s\n", + _sp, cmd->name)); + *tbuf = '\0'; + if( (lastdelim() != ';') && (lastdelim() != '\n') ){ + /* skip white space between command and params */ + while( isspace((int)lbuf[lp]) ) + lp++; + /* here is where the params start */ + savelp = lp; + /* look for command delimiter -- the end of the params */ + while( word(lbuf, tbuf1, &lp) ){ + if( (lastdelim() == ';') || (lastdelim() == '\n') ){ + break; + } + /* make sure a command-ending delim is not next */ + while( isspace((int)lbuf[lp]) ) + lp++; + if( (lbuf[lp] == ';') || (lbuf[lp] == '\n') ){ + break; + } + } + /* get length of parameter list */ + plen = lp - savelp; + /* but skip final delim */ + if( (plen>0) && ((lastdelim() == ';')||(lastdelim() == '\n')) ) + plen--; + /* copy the params up to the command delimiter */ + if( plen > 0 ){ + strncpy(tbuf, &(lbuf[savelp]), plen); + tbuf[plen] = '\0'; + } + } + /* execute the associated XPA callback */ + if( cmd->receive_callback != NULL ){ + /* get buf now, if its needed */ + if( !gotbuf && (xpa_datafd(xpa) >= 0) && + (cmd->receive_mode & XPA_MODE_FILLBUF) ){ + /* read buf -- this buf will stay around for all commands */ + FPRINTF((stderr, "%sXPAReceiveCommands: at XPAGetBuf\n", _sp)); + bgot = XPAGetBuf(xpa, xpa_datafd(xpa), &buf, &len, -1); + /* close the data channel */ + XPACloseData(xpa, xpa->comm); + if( bgot >= 0 ){ + /* got the buffer */ + gotbuf++; + } + /* error getting buf */ + else{ + XPAError(xpa, xpaMessbuf[XPA_RTN_NODATA]); + got = -1; + goto done; + } + } + got = (cmd->receive_callback)(cmd->receive_data, call_data, + tbuf, buf, len); + /* if we don't want to free the buffer, mark it for saving */ + if( (buf != NULL) && !(cmd->receive_mode & XPA_MODE_FREEBUF) ){ + freebuf=0; + } + if( got != 0 ){ + goto done; + } + } + else{ + XPAError(xpa, xpaMessbuf[XPA_RTN_NOREC]); + got = -1; + goto done; + } + } + /* conditions for exiting the command loop: */ + /* if we processed the END command, we are done */ + if( xpa->comm->status & XPA_STATUS_ENDBUF ) + break; + /* if we are not reading the data buffer, we are done */ + if( !(xpa->comm->status & XPA_STATUS_READBUF) ) + break; + /* if we got EOF or error reading the data buffer, we are done */ + if( XPAGets(xpa, xpa_datafd(xpa), lbuf, SZ_LINE, XPALongTimeout()) <=0 ) + break; + } + +done: + /* if no one wants buf, free it now */ + if( freebuf ) + xfree(buf); + /* restore last delimiter table */ + freedtable(); + /* return error code */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPASendCommands + * + * Purpose: process a list of commands from xpaget + * + * Results: number of commands processed (currently 0 or 1) + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPASendCommands (void *client_data, void *call_data, char *paramlist, + char **buf, size_t *len) +#else +int XPASendCommands(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char **buf; + size_t *len; +#endif +{ + XPA xpa = (XPA)call_data; + XPACmd cmd; + char tbuf[SZ_LINE]; + int lp=0; + int got=0; + + /* return help as default */ + if( *paramlist == '\0' ){ + paramlist = "-help"; + } + + /* lookup the command and execute */ + if( (cmd = XPACmdLookup(xpa, paramlist, &lp)) != NULL ){ + /* reserved commands can only be called from the same host as the server, + or from local (unix) sockets */ + if( (cmd->xpa == rxpa) && + strcmp(cmd->name, "-help") && strcmp(cmd->name, "-version") ){ + if( XPAMtype() == XPA_INET ){ + if( (!xpa->comm || !LOCALIP(xpa->comm->cmdip)) ){ + FPRINTF((stderr, "%sXPAReceiveCommands: rejecting reserved: %s\n", + _sp, cmd->name)); + XPAError(xpa, xpaMessbuf[XPA_RTN_NOAUTH]); + got = -1; + goto done; + } + } + } + /* execute the associated XPA send callback, + using the remaining command string as an argument */ + strcpy(tbuf, ¶mlist[lp]); + nocr(tbuf); + if( !strcmp(tbuf, "-help") ){ + if( cmd->help != NULL ) + snprintf(tbuf, SZ_LINE, "%s\n", cmd->help); + else + snprintf(tbuf, SZ_LINE, "\n"); + send(xpa_datafd(xpa), tbuf, strlen(tbuf), 0); + got = 0; + } + else if( cmd->send_callback != NULL ){ + got = (cmd->send_callback)(cmd->send_data, call_data, + ¶mlist[lp], buf, len); + } + else{ + XPAError(xpa, xpaMessbuf[XPA_RTN_NOSEND]); + got = -1; + goto done; + } + } + else{ + XPAError(xpa, xpaMessbuf[XPA_RTN_UNCMD]); + got = -1; + goto done; + } + +done: + /* return error code */ + return(got); +} + +/* + *---------------------------------------------------------------------------- + * + * + * Public Routines and Data + * + * + *---------------------------------------------------------------------------- + */ + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPACmdNew + * + * Purpose: define a named command access point + * + * Results: XPA struct or NULL + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +XPA +XPACmdNew (char *xclass, char *name) +#else +XPA XPACmdNew(xclass, name) + char *xclass; + char *name; +#endif +{ + XPA xpa; + char tbuf[SZ_LINE]; + + /* we need a name */ + if( (name == NULL) || (*name == '\0') ) + return(NULL); + + /* we need some valid class */ + if( (xclass == NULL) || (*xclass == '\0') ) + xclass = "*"; + + /* help string */ + snprintf(tbuf, SZ_LINE, "XPA commands for %s:%s\n\t\t options: see -help", + xclass, name); + + /* create a new XPA with command callbacks */ + xpa = XPANew(xclass, name, tbuf, + XPASendCommands, NULL, NULL, + XPAReceiveCommands, NULL, "fillbuf=false"); + + /* return the good news */ + return(xpa); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPACmdAdd + * + * Purpose: add a command to a named command access point + * + * Results: 0 on success, -1 for failure + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +XPACmd +XPACmdAdd (XPA xpa, char *name, char *help, + SendCb send_callback, void *send_data, char *send_mode, + ReceiveCb rec_callback, void *rec_data, char *rec_mode) +#else +XPACmd XPACmdAdd(xpa, name, help, + send_callback, send_data, send_mode, + rec_callback, rec_data, rec_mode) + XPA xpa; + char *name; + char *help; + SendCb send_callback; + void *send_data; + char *send_mode; + ReceiveCb rec_callback; + void *rec_data; + char *rec_mode; +#endif +{ + XPACmd xnew; + XPACmd cur; + XPACmd prev; + + /* make sure we have a valid command record */ + if( !xpa || + (xpa->send_callback != XPASendCommands) || + (xpa->receive_callback != XPAReceiveCommands) ){ + return(NULL); + } + + /* we need either a send or a receive or both */ + if( (send_callback == NULL) && (rec_callback == NULL ) ){ + return(NULL); + } + + /* limit the size of the cmd name designation */ + if( strlen(name) > XPA_NAMELEN ){ + return(NULL); + } + + /* allocate space for a new record */ + xnew = (XPACmd)xcalloc(1, sizeof(struct xpacmdrec)); + + /* backlink to xpa */ + xnew->xpa = xpa; + + /* fill in the blanks */ + xnew->name = XPACmdParseNames(name, &(xnew->ntokens)); + xnew->help = xstrdup(help); + + /* receive callback */ + xnew->send_callback = send_callback; + xnew->send_data = send_data; + xnew->send_mode = XPA_DEF_MODE_SEND; + XPAMode(send_mode, &(xnew->send_mode), "freebuf", XPA_MODE_FREEBUF,1); + /* acl is a global mode */ + XPAMode(send_mode, &(xpa->send_mode), "acl", XPA_MODE_ACL, 1); + + /* receive callback */ + xnew->receive_callback = rec_callback; + xnew->receive_data = rec_data; + /* process the mode string */ + xnew->receive_mode = XPA_DEF_MODE_REC; + XPAMode(rec_mode, &(xnew->receive_mode), "usebuf", XPA_MODE_BUF,1); + XPAMode(rec_mode, &(xnew->receive_mode), "fillbuf", XPA_MODE_FILLBUF,1); + XPAMode(rec_mode, &(xnew->receive_mode), "freebuf", XPA_MODE_FREEBUF,1); + /* acl is a global mode */ + XPAMode(rec_mode, &(xpa->receive_mode), "acl", XPA_MODE_ACL, 1); + + /* enter into list, in alphabetical order */ + if( xpa->commands == NULL ){ + xpa->commands = xnew; + return(xnew); + } + else{ + for(prev=NULL, cur=xpa->commands; cur!=NULL; prev=cur, cur=cur->next){ + /* if new name is an existing name, add it before */ + if( strcmp(xnew->name, cur->name) ==0 ) + goto addname; + /* if existing name is a subset of new name, add it before */ + else if( !strncmp(xnew->name, cur->name, strlen(cur->name)) ) + goto addname; + /* if new name is a subset of existing name, add it after */ + else if( !strncmp(xnew->name, cur->name, strlen(xnew->name)) ) + continue; + /* if new name is lexically greater than existing name, add it after */ + else if( strcmp(xnew->name, cur->name) >0 ) + continue; +addname: + /* add the new name here and return */ + if( prev == NULL ){ + xpa->commands = xnew; + xnew->next = cur; + return(xnew); + } + else{ + prev->next = xnew; + xnew->next = cur; + return(xnew); + } + } + /* if we are still here, we did not find a place to insert, i.e., + we are at the end of the list */ + prev->next = xnew; + return(xnew); + } +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPACmdDel + * + * Purpose: free a named command access point + * + * Results: none + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPACmdDel (XPA xpa, XPACmd cmd) +#else +int XPACmdDel(xpa, cmd) + XPA xpa; + XPACmd cmd; +#endif +{ + XPACmd cur; + int got=0; + + /* gotta have something to free */ + if( cmd == NULL ) + return(-1); + + /* remove from list of xpa's commands */ + if( xpa && xpa->commands ){ + if( xpa->commands == cmd ){ + xpa->commands = cmd->next; + got++; + } + else{ + for(cur=xpa->commands; cur!=NULL; cur=cur->next){ + if( cur->next == cmd ){ + cur->next = cmd->next; + got++; + break; + } + } + } + } + + /* free up space */ + if( got ){ + if( cmd->name ) + xfree(cmd->name); + if( cmd->help ) + xfree(cmd->help); + xfree(cmd); + return(0); + } + else{ + return(-1); + } +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPACmdInternalReceive + * + * Purpose: internal execute of the receive callback for this command + * + * Results: number of commands processed + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPACmdInternalReceive (void *client_data, void *call_data, + char *paramlist, char *buf, size_t len) +#else +int XPACmdInternalReceive(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char *buf; + size_t len; +#endif +{ + XPA xpa = (XPA)call_data; + + /* make sure we have something */ + if( xpa == NULL ) + return(-1); + /* make the call */ + return(XPAReceiveCommands(client_data, xpa, paramlist, buf, len)); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPACmdInternalSend + * + * Purpose: internal execute of the send callback for this command + * + * Results: number of commands processed (currently 0 or 1) + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +int +XPACmdInternalSend (void *client_data, void *call_data, + char *paramlist, char **buf, size_t *len) +#else +int XPACmdInternalSend(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char **buf; + size_t *len; +#endif +{ + XPA xpa = (XPA)call_data; + + /* make sure we have something */ + if( xpa == NULL ) + return(-1); + + /* make the call */ + return(XPASendCommands(client_data, xpa, paramlist, buf, len)); +} + +/* + *---------------------------------------------------------------------------- + * + * Routine: XPAGetReserved + * + * Purpose: return xpa handle for reserved xpa commands + * + * Return: xpa handle + * + *---------------------------------------------------------------------------- + */ +#ifdef ANSI_FUNC +XPA +XPAGetReserved (void) +#else +XPA XPAGetReserved() +#endif +{ + return(rxpa); +} diff --git a/conf.h.in b/conf.h.in new file mode 100644 index 0000000..206d8d6 --- /dev/null +++ b/conf.h.in @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory + */ + +/* Define as 1 if you have string.h */ +#undef HAVE_STRING_H + +/* Define as 1 if you have strings.h */ +#undef HAVE_STRINGS_H + +/* Define as 1 if you have stdlib.h */ +#undef HAVE_STDLIB_H + +/* Define as 1 if you have malloc.h */ +#undef HAVE_MALLOC_H + +/* Define as 1 if you have unistd.h */ +#undef HAVE_UNISTD_H + +/* Define as 1 if you have getopt.h */ +#undef HAVE_GETOPT_H + +/* Define as 1 if you have pwd.h */ +#undef HAVE_PWD_H + +/* Define as 1 if you have values.h */ +#undef HAVE_VALUES_H + +/* Define as 1 if you have dlfcn.h */ +#undef HAVE_DLFCN_H + +/* Define as 1 if you have sys/un.h */ +#undef HAVE_SYS_UN_H + +/* Define as 1 if you have sys/shm.h */ +#undef HAVE_SYS_SHM_H + +/* Define as 1 if you have sys/mman.h */ +#undef HAVE_SYS_MMAN_H + +/* Define as 1 if you have sys/select.h */ +#undef HAVE_SYS_SELECT_H + +/* Define as 1 if you have sys/ipc.h */ +#undef HAVE_SYS_IPC_H + +/* Define as 1 if you have setjmp.h */ +#undef HAVE_SETJMP_H + +/* Define as 1 if you have socklen_t */ +#undef HAVE_SOCKLEN_T + +/* Define as 1 if you have strchr */ +#undef HAVE_STRCHR + +/* Define as 1 if you have memcpy */ +#undef HAVE_MEMCPY + +/* Define as 1 if you have snprintf */ +#undef HAVE_SNPRINTF + +/* Define as 1 if you have setenv */ +#undef HAVE_SETENV + +/* Define as 1 if you have posix_spawn */ +#undef HAVE_POSIX_SPAWN + +/* Define as 1 if you have crt_externs.h */ +#undef HAVE_CRT_EXTERNS_H + +/* Define as 1 if you have NSGetEvniron */ +#undef HAVE__NSGETENVIRON + +/* Define as 1 if you have atexit */ +#undef HAVE_ATEXIT + +/* Define as 1 if you have pthread library */ +#undef HAVE_LIBPTHREAD + +/* Define as 1 if you need reentrant errno, etc. */ +#undef _REENTRANT + +/* Define as 1 if you have Tcl */ +#undef HAVE_TCL + +/* Define as 1 if you have Xt */ +#undef HAVE_XT + +/* Define as 1 if you have Gtk */ +#undef HAVE_GTK + +/* Define as 1 if you are running Cygwin. */ +#undef HAVE_CYGWIN + +/* Define as 1 if you are running MinGW. */ +#undef HAVE_MINGW32 diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..22906b3 --- /dev/null +++ b/config.guess @@ -0,0 +1,1495 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2006-03-13' + +# 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, 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, 2002, 2003, 2004, 2005 +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 ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # 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. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + 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 ; set_cc_for_build= ;' + +# 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 + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # 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 ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # 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. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + 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 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + 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 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + 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 ;; + 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 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + 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 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # 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 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + 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 -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + 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 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????: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 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + 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 ;; + *: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 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + 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 ;; + *: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 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 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 -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 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 -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + 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 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + 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 ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[345]*) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T:Interix*:[345]*) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 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 i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + 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 | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + 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 ;; + 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 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + 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 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # 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 ;; + 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 + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + 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 ;; + 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 ;; + 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 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + 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 ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + 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 ;; + 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 ;; + 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 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + 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 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*: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 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*: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; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *: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 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + 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 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *: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 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *: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 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +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\n"); 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 -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# 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 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + 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 0000000..5705e54 --- /dev/null +++ b/config.sub @@ -0,0 +1,1609 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2006-03-07' + +# 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., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, 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, 2002, 2003, 2004, 2005 +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 ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # 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 ;; + + * ) + 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* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | 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 | -knuth | -cray) + 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 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -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/'` + ;; + -sco5v6*) + # 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] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m32c) + 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) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # 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-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | 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-* | iq2000-* \ + | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + m32c-*) + ;; + # 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 + ;; + abacus) + basic_machine=abacus-unknown + ;; + 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 + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + 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 + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + 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 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + 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 + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + 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 + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + 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 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-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-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`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 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + 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 + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + 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 + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-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 + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + 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 + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + 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 + ;; + mmix) + basic_machine=mmix-knuth + ;; + 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 + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + 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 + ;; + *-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* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -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* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -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* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -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 + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -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 + ;; + -tpf*) + os=-tpf + ;; + -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 + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -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 + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # 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 + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-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 + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -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 + +# 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 0000000..f6c832d --- /dev/null +++ b/configure @@ -0,0 +1,9061 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59 for xpa 2.1.18. +# +# Report bugs to . +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='xpa' +PACKAGE_TARNAME='xpa' +PACKAGE_VERSION='2.1.18' +PACKAGE_STRING='xpa 2.1.18' +PACKAGE_BUGREPORT='eric@cfa.harvard.edu' + +ac_unique_file="./xpa.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP SZ_LONG RANLIB ac_ct_RANLIB TLIB DOSHARED LLIB X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_CFLAGS TCL_LIBS GTK_CFLAGS GTK_LIBS EXTRA_LIBS LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures xpa 2.1.18 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +X features: + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR + +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 xpa 2.1.18:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-threaded-xpans build threaded xpans + --enable-shared build shared libraries + --enable-posix_spawn use posix_spawn() if available + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-x use the X Window System + --with-tcl directory containing tcl configuration (tclConfig.sh) + --with-threads build for use in threaded programs + --with-gtk= include directory for gtk e.g. /usr/include/gtk-1.2 + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +xpa configure 2.1.18 +generated by GNU Autoconf 2.59 + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xpa $as_me 2.1.18, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ac_config_headers="$ac_config_headers conf.h" + + +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 +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_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_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { 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=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_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 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +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 + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + + +# save LDFLAGS +XLDFLAGS="$LDFLAGS" + +# +# checks that we use in most projects +# +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +if test x"${EXEEXT}" = "xno"; then + EXEEXT="" +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6 +if test "${ac_cv_type_long+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 +int +main () +{ +if ((long *) 0) + return 0; +if (sizeof (long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_long=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 + +echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long" = yes; then + # The cast to unsigned long 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. + 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 +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_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 +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_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 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 +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_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 +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_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 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 conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f 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 +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_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 conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +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 +long longval () { return (long) (sizeof (long)); } +unsigned long ulongval () { return (long) (sizeof (long)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (long))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long=`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 ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_long=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + +SZ_LONG=$ac_cv_sizeof_long + + +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 $as_executable_p "$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 + +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 $as_executable_p "$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 + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +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 + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + +for ac_header in malloc.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in getopt.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in pwd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in values.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in setjmp.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/un.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/shm.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/mman.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/ipc.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in sys/select.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 +if test "${ac_cv_type_socklen_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. */ +#include + +int +main () +{ +if ((socklen_t *) 0) + return 0; +if (sizeof (socklen_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_socklen_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_socklen_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 +echo "${ECHO_T}$ac_cv_type_socklen_t" >&6 +if test $ac_cv_type_socklen_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_SOCKLEN_T 1 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+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 () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + + + + + + + +for ac_func in strchr memcpy snprintf atexit setenv +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +echo "$as_me:$LINENO: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define connect to an innocuous variant, in case declares connect. + For example, HP-UX 11i declares gettimeofday. */ +#define connect innocuous_connect + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef connect + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +choke me +#else +char (*f) () = connect; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != connect; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_connect=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 + +if test $ac_cv_func_connect = no; then + echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 +echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +int +main () +{ +connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_connect=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 +if test $ac_cv_lib_socket_connect = yes; then + EXTRA_LIBS="$EXTRA_LIBS -lsocket" +fi + +fi +echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define gethostbyname to an innocuous variant, in case declares gethostbyname. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname innocuous_gethostbyname + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyname + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +char (*f) () = gethostbyname; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gethostbyname; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gethostbyname=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 + +if test $ac_cv_func_gethostbyname = no; then + echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + EXTRA_LIBS="$EXTRA_LIBS -lnsl" +fi + +fi +# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb") + +# +# checks specific to this project +# + +echo "$as_me:$LINENO: checking for threaded xpans" >&5 +echo $ECHO_N "checking for threaded xpans... $ECHO_C" >&6 +# Check whether --enable-threaded-xpans or --disable-threaded-xpans was given. +if test "${enable_threaded_xpans+set}" = set; then + enableval="$enable_threaded_xpans" + fun_ok=$enableval +else + fun_ok=no +fi; +if test "$fun_ok" = "yes"; then + echo "$as_me:$LINENO: result: $fun_ok" >&5 +echo "${ECHO_T}$fun_ok" >&6 + echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 +echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create (); +int +main () +{ +pthread_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_create=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_create=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6 +if test $ac_cv_lib_pthread_pthread_create = yes; then + have_pthread=yes +fi + + if test x"${have_pthread}" = x"yes"; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBPTHREAD 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + TLIB="-lpthread" + else + { { echo "$as_me:$LINENO: error: no threads found ... can't use enable-threaded-xpans" >&5 +echo "$as_me: error: no threads found ... can't use enable-threaded-xpans" >&2;} + { (exit 1); exit 1; }; } + fi +else + echo "$as_me:$LINENO: result: $fun_ok" >&5 +echo "${ECHO_T}$fun_ok" >&6 +fi + + +echo "$as_me:$LINENO: checking for shared library build" >&5 +echo $ECHO_N "checking for shared library build... $ECHO_C" >&6 +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + fun_ok=$enableval +else + fun_ok=no +fi; +if test "$fun_ok" != "no"; then + fpic="yes" + DOSHARED=shlib + + if test "$fun_ok" = "link"; then + LLIB="-L. -l$PACKAGE_NAME" + else + LLIB='$(LIB)' + fi +else + DOSHARED="" + LLIB='$(LIB)' +fi + +echo "$as_me:$LINENO: result: $fun_ok" >&5 +echo "${ECHO_T}$fun_ok" >&6 + +echo "$as_me:$LINENO: checking for request to use posix_spawn" >&5 +echo $ECHO_N "checking for request to use posix_spawn... $ECHO_C" >&6 +# Check whether --enable-posix_spawn or --disable-posix_spawn was given. +if test "${enable_posix_spawn+set}" = set; then + enableval="$enable_posix_spawn" + fun_ok=$enableval +else + fun_ok=no +fi; +echo "$as_me:$LINENO: result: $fun_ok" >&5 +echo "${ECHO_T}$fun_ok" >&6 +if test "$fun_ok" = "yes"; then + + +for ac_func in posix_spawn _NSGetEnviron +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_header in crt_externs.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------- ## +## Report this to eric@cfa.harvard.edu ## +## ----------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +fi + +echo "$as_me:$LINENO: checking for X" >&5 +echo $ECHO_N "checking for X... $ECHO_C" >&6 + + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + +fi; +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else + if test "${ac_cv_have_x+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +rm -fr conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat >Imakefile <<'_ACEOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +_ACEOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac + fi + cd .. + rm -fr conftest.dir +fi + +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/usr/include/X11 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Intrinsic.h. + # First, try using that file with no special directory specified. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # We can compile using X headers with no special include directory. +ac_x_includes= +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Intrinsic.h"; then + ac_x_includes=$ac_dir + break + fi +done +fi +rm -f conftest.err conftest.$ac_ext +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lXt $LIBS" + 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 () +{ +XtMalloc (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries= +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +LIBS=$ac_save_LIBS +for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl; do + if test -r $ac_dir/libXt.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no + +if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi +fi + + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + echo "$as_me:$LINENO: result: $have_x" >&5 +echo "${ECHO_T}$have_x" >&6 + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 +echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 +fi + +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. + +cat >>confdefs.h <<\_ACEOF +#define X_DISPLAY_MISSING 1 +_ACEOF + + X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + case `(uname -sr) 2>/dev/null` in + "SunOS 5"*) + echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 +echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 + ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" + 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 conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_R_nospace=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_R_nospace=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test $ac_R_nospace = yes; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + X_LIBS="$X_LIBS -R$x_libraries" + else + LIBS="$ac_xsave_LIBS -R $x_libraries" + 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 conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_R_space=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_R_space=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test $ac_R_space = yes; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + X_LIBS="$X_LIBS -R $x_libraries" + else + echo "$as_me:$LINENO: result: neither works" >&5 +echo "${ECHO_T}neither works" >&6 + fi + fi + LIBS=$ac_xsave_LIBS + esac + fi + + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn Johnson says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And Karl Berry says + # the Alpha needs dnet_stub (dnet does not exist). + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +int +main () +{ +XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 +echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 +if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet $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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dnet_ntoa (); +int +main () +{ +dnet_ntoa (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dnet_dnet_ntoa=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dnet_dnet_ntoa=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 +echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 +if test $ac_cv_lib_dnet_dnet_ntoa = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +fi + + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 +echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 +if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet_stub $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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dnet_ntoa (); +int +main () +{ +dnet_ntoa (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dnet_stub_dnet_ntoa=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dnet_stub_dnet_ntoa=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 +echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 +if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +fi + + fi +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$ac_xsave_LIBS" + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to T.E. Dickey. + # The functions gethostbyname, getservbyname, and inet_addr are + # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. + echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define gethostbyname to an innocuous variant, in case declares gethostbyname. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname innocuous_gethostbyname + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyname + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +char (*f) () = gethostbyname; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gethostbyname; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gethostbyname=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 + + if test $ac_cv_func_gethostbyname = no; then + echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +fi + + if test $ac_cv_lib_nsl_gethostbyname = no; then + echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 +echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 +if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_bsd_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_bsd_gethostbyname=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 +if test $ac_cv_lib_bsd_gethostbyname = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" +fi + + fi + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says Simon Leinen: it contains gethostby* + # variants that don't use the name server (or something). -lsocket + # must be given before -lnsl if both are needed. We assume that + # if connect needs -lnsl, so does gethostbyname. + echo "$as_me:$LINENO: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define connect to an innocuous variant, in case declares connect. + For example, HP-UX 11i declares gettimeofday. */ +#define connect innocuous_connect + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef connect + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +choke me +#else +char (*f) () = connect; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != connect; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_connect=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 + + if test $ac_cv_func_connect = no; then + echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 +echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $X_EXTRA_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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +int +main () +{ +connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_connect=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 +if test $ac_cv_lib_socket_connect = yes; then + X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +fi + + fi + + # Guillermo Gomez says -lposix is necessary on A/UX. + echo "$as_me:$LINENO: checking for remove" >&5 +echo $ECHO_N "checking for remove... $ECHO_C" >&6 +if test "${ac_cv_func_remove+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define remove to an innocuous variant, in case declares remove. + For example, HP-UX 11i declares gettimeofday. */ +#define remove innocuous_remove + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char remove (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef remove + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char remove (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_remove) || defined (__stub___remove) +choke me +#else +char (*f) () = remove; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != remove; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_remove=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_remove=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 +echo "${ECHO_T}$ac_cv_func_remove" >&6 + + if test $ac_cv_func_remove = no; then + echo "$as_me:$LINENO: checking for remove in -lposix" >&5 +echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 +if test "${ac_cv_lib_posix_remove+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix $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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char remove (); +int +main () +{ +remove (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_posix_remove=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_posix_remove=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 +echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 +if test $ac_cv_lib_posix_remove = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" +fi + + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + echo "$as_me:$LINENO: checking for shmat" >&5 +echo $ECHO_N "checking for shmat... $ECHO_C" >&6 +if test "${ac_cv_func_shmat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shmat to an innocuous variant, in case declares shmat. + For example, HP-UX 11i declares gettimeofday. */ +#define shmat innocuous_shmat + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shmat (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shmat + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shmat (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shmat) || defined (__stub___shmat) +choke me +#else +char (*f) () = shmat; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shmat; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shmat=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shmat=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 +echo "${ECHO_T}$ac_cv_func_shmat" >&6 + + if test $ac_cv_func_shmat = no; then + echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 +echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 +if test "${ac_cv_lib_ipc_shmat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lipc $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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shmat (); +int +main () +{ +shmat (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ipc_shmat=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ipc_shmat=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 +echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 +if test $ac_cv_lib_ipc_shmat = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" +fi + + fi + fi + + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS=$LDFLAGS + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # John Interrante, Karl Berry + echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 +echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 +if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lICE $X_EXTRA_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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char IceConnectionNumber (); +int +main () +{ +IceConnectionNumber (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ICE_IceConnectionNumber=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ICE_IceConnectionNumber=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 +echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 +if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then + X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" +fi + + LDFLAGS=$ac_save_LDFLAGS + +fi + +if test x"${have_x}" = "xyes"; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_XT 1 +_ACEOF + +fi + + + # + # Ok, lets find the tcl configuration + # First, look for one uninstalled. + # the alternative search directory is invoked by --with-tcl + # + + if test x"${no_tcl}" = x ; then + # we reset no_tcl in case something fails here + no_tcl=true + +# Check whether --with-tcl or --without-tcl was given. +if test "${with_tcl+set}" = set; then + withval="$with_tcl" + with_tclconfig=${withval} +fi; + echo "$as_me:$LINENO: checking for Tcl configuration" >&5 +echo $ECHO_N "checking for Tcl configuration... $ECHO_C" >&6 + if test x"${withval}" != xno ; then + if test "${ac_cv_c_tclconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + # First check to see if --with-tcl was specified. + if test x"${with_tclconfig}" != x ; then + if test -f "${with_tclconfig}/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` + else + echo "$as_me:$LINENO: result: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5 +echo "${ECHO_T}${with_tclconfig} directory doesn't contain tclConfig.sh" >&6 + fi + fi + + # then check for a private Tcl installation + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ../tcl \ + `ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../tcl \ + `ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \ + ../../../tcl \ + `ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + + # check in a few common install locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do + if test -f "$i/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i; pwd)` + break + fi + done + fi + + # check in a few other private locations + if test x"${ac_cv_c_tclconfig}" = x ; then + for i in \ + ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do + if test -f "$i/unix/tclConfig.sh" ; then + ac_cv_c_tclconfig=`(cd $i/unix; pwd)` + break + fi + done + fi + +fi + + else + echo "$as_me:$LINENO: result: skipping Tcl configuration" >&5 +echo "${ECHO_T}skipping Tcl configuration" >&6 + ac_cv_c_tclconfig="none" + fi + + if test x"${ac_cv_c_tclconfig}" = x ; then + TCL_BIN_DIR="# no Tcl configs found" + echo "$as_me:$LINENO: result: can't find Tcl configuration definitions" >&5 +echo "${ECHO_T}can't find Tcl configuration definitions" >&6 +# no Tcl is OK egm 03/25/03 +# AC_MSG_WARN(Can't find Tcl configuration definitions) +# exit 0 + elif test x"${ac_cv_c_tclconfig}" = xnone ; then + TCL_BIN_DIR="" + else + no_tcl= + TCL_BIN_DIR=${ac_cv_c_tclconfig} + echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5 +echo "${ECHO_T}found $TCL_BIN_DIR/tclConfig.sh" >&6 + fi + fi + +if test x"${no_tcl}" = x ; then + + echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 +echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6 + + if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then + echo "$as_me:$LINENO: result: loading" >&5 +echo "${ECHO_T}loading" >&6 + . $TCL_BIN_DIR/tclConfig.sh + else + echo "$as_me:$LINENO: result: file not found" >&5 +echo "${ECHO_T}file not found" >&6 + fi + + # + # If the TCL_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TCL_LIB_SPEC will be set to the value + # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC + # instead of TCL_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. + # + + if test -f $TCL_BIN_DIR/Makefile ; then + TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} + TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} + TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} + fi + + # + # eval is required to do the TCL_DBGX substitution + # + + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" + eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" + + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" + eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + + + + + + + + + + + + + + if test -r $TCL_PREFIX/include/tcl.h; then + TCL_CFLAGS="$TCL_INCLUDE_SPEC" + if test x"$DOSHARED" != x -a x"$TCL_SUPPORTS_STUBS" = x1; then + TCL_LIBS="$TCL_STUB_LIB_SPEC" + TCL_CFLAGS="$TCL_CFLAGS -DUSE_TCL_STUBS=1" + echo "$as_me:$LINENO: result: Tcl support will utilize stubs library: $TCL_LIBS" >&5 +echo "${ECHO_T}Tcl support will utilize stubs library: $TCL_LIBS" >&6 + else + TCL_LIBS="$TCL_LIB_SPEC" + echo "$as_me:$LINENO: result: Tcl support will utilize library: $TCL_LIBS" >&5 +echo "${ECHO_T}Tcl support will utilize library: $TCL_LIBS" >&6 + fi + cat >>confdefs.h <<\_ACEOF +#define HAVE_TCL 1 +_ACEOF + + else + if test x"${with_tclconfig}" != x ; then + TCL_CFLAGS="$TCL_INCLUDE_SPEC" + TCL_LIBS="$TCL_LIB_SPEC" + cat >>confdefs.h <<\_ACEOF +#define HAVE_TCL 1 +_ACEOF + + echo "$as_me:$LINENO: result: warning: tcl.h not found with --with-tcl ... tcl build might fail" >&5 +echo "${ECHO_T}warning: tcl.h not found with --with-tcl ... tcl build might fail" >&6 + else + echo "$as_me:$LINENO: result: $TCL_PREFIX/include/tcl.h not found ... use --with-tcl to build tcl explicitly" >&5 +echo "${ECHO_T}$TCL_PREFIX/include/tcl.h not found ... use --with-tcl to build tcl explicitly" >&6 + fi + fi +fi + + + +echo "$as_me:$LINENO: checking for incorporation of thread support" >&5 +echo $ECHO_N "checking for incorporation of thread support... $ECHO_C" >&6 + +# Check whether --with-threads or --without-threads was given. +if test "${with_threads+set}" = set; then + withval="$with_threads" + thr=1 +else + thr=0 +fi; +if test x"$thr" = x1 ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + CFLAGS="$CFLAGS -D_REENTRANT" +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:$LINENO: checking for gtk" >&5 +echo $ECHO_N "checking for gtk... $ECHO_C" >&6 + +# Check whether --with-gtk or --without-gtk was given. +if test "${with_gtk+set}" = set; then + withval="$with_gtk" + havelib=1 +else + havelib=0 +fi; +if test x"$havelib" = x1 ; then + echo "$as_me:$LINENO: result: yes ($withval)" >&5 +echo "${ECHO_T}yes ($withval)" >&6 + GTK_CFLAGS="`pkg-config gtk+-2.0 --cflags` -DHAVE_GTK=1" + GTK_LIBS="`pkg-config gtk+-2.0 --libs`" + cat >>confdefs.h <<\_ACEOF +#define HAVE_GTK 1 +_ACEOF + +else + GTK_CFLAGS="" + GTK_LIBS="" + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + +# restore LDFLAGS +LDFLAGS="$LDFLAGS $XLDFLAGS" + +echo "$as_me:$LINENO: checking $host_os configuration" >&5 +echo $ECHO_N "checking $host_os configuration... $ECHO_C" >&6 +case $host_os in + *cygwin*|*Cygwin* ) + cat >>confdefs.h <<\_ACEOF +#define HAVE_CYGWIN 1 +_ACEOF + + echo "$as_me:$LINENO: result: flagging Cygwin" >&5 +echo "${ECHO_T}flagging Cygwin" >&6 + ;; + *mingw32*|*Mingw32*) + CFLAGS="$CFLAGS -mconsole" + EXTRA_LIBS="$EXTRA_LIBS -lwsock32" + cat >>confdefs.h <<\_ACEOF +#define HAVE_MINGW32 1 +_ACEOF + + echo "$as_me:$LINENO: result: flagging MinGW" >&5 +echo "${ECHO_T}flagging MinGW" >&6 + ;; + *darwin*|*Darwin*) + LDFLAGS="$LDFLAGS $CFLAGS" + G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'` + if test x"$G" != x -a "$G" -lt 42; then + CFLAGS="$CFLAGS -no-cpp-precomp" + fi + if test x"$TCL_PREFIX" = x"/usr/local"; then + TCL_CFLAGS="" + echo "$as_me:$LINENO: result: removing -I/usr/local/include" >&5 +echo "${ECHO_T}removing -I/usr/local/include" >&6 + fi + ;; + *osf*|*Osf*) + echo "$as_me:$LINENO: checking for snprintf in -ldb" >&5 +echo $ECHO_N "checking for snprintf in -ldb... $ECHO_C" >&6 +if test "${ac_cv_lib_db_snprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldb $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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char snprintf (); +int +main () +{ +snprintf (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_db_snprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_db_snprintf=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_db_snprintf" >&5 +echo "${ECHO_T}$ac_cv_lib_db_snprintf" >&6 +if test $ac_cv_lib_db_snprintf = yes; then + EXTRA_LIBS="$EXTRA_LIBS -ldb" +fi + + ;; + * ) + if test x"$fpic" = x"yes" ; then + if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then + CFLAGS="$CFLAGS -fPIC" + echo "$as_me:$LINENO: result: adding -fPIC to gcc" >&5 +echo "${ECHO_T}adding -fPIC to gcc" >&6 + else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 + fi + else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 + fi + ;; +esac + + + + ac_config_files="$ac_config_files Makefile" + + +# generate pkg-config meta-data file + ac_config_files="$ac_config_files xpa.pc" + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by xpa $as_me 2.1.18, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +xpa config.status 2.1.18 +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "xpa.pc" ) CONFIG_FILES="$CONFIG_FILES xpa.pc" ;; + "conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS conf.h" ;; + *) { { 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 +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@SZ_LONG@,$SZ_LONG,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@TLIB@,$TLIB,;t t +s,@DOSHARED@,$DOSHARED,;t t +s,@LLIB@,$LLIB,;t t +s,@X_CFLAGS@,$X_CFLAGS,;t t +s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t +s,@X_LIBS@,$X_LIBS,;t t +s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t +s,@TCL_VERSION@,$TCL_VERSION,;t t +s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t +s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t +s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t +s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t +s,@TCL_LIB_SPEC@,$TCL_LIB_SPEC,;t t +s,@TCL_STUB_LIB_FILE@,$TCL_STUB_LIB_FILE,;t t +s,@TCL_STUB_LIB_FLAG@,$TCL_STUB_LIB_FLAG,;t t +s,@TCL_STUB_LIB_SPEC@,$TCL_STUB_LIB_SPEC,;t t +s,@TCL_CFLAGS@,$TCL_CFLAGS,;t t +s,@TCL_LIBS@,$TCL_LIBS,;t t +s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t +s,@GTK_LIBS@,$GTK_LIBS,;t t +s,@EXTRA_LIBS@,$EXTRA_LIBS,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (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.ac b/configure.ac new file mode 100644 index 0000000..fb5aeb2 --- /dev/null +++ b/configure.ac @@ -0,0 +1,217 @@ +# This file is an input file used by the GNU "autoconf" program to +# generate the file "configure", which is run during XPA installation +# to configure the system for the local environment. +AC_INIT(xpa, 2.1.18, eric@cfa.harvard.edu, xpa) + +AC_CONFIG_HEADERS([conf.h]) +AC_CONFIG_SRCDIR(./xpa.h) +AC_CANONICAL_HOST + +# save LDFLAGS +XLDFLAGS="$LDFLAGS" + +# +# checks that we use in most projects +# +AC_PROG_CC + +AC_EXEEXT +if test x"${EXEEXT}" = "xno"; then + EXEEXT="" +fi + +AC_CHECK_SIZEOF(long) +SZ_LONG=$ac_cv_sizeof_long +AC_SUBST(SZ_LONG) + +AC_PROG_RANLIB + +AC_HEADER_STDC +AC_CHECK_HEADERS(malloc.h) +AC_CHECK_HEADERS(getopt.h) +AC_CHECK_HEADERS(pwd.h) +AC_CHECK_HEADERS(values.h) +AC_CHECK_HEADERS(dlfcn.h) +AC_CHECK_HEADERS(setjmp.h) +AC_CHECK_HEADERS(sys/un.h) +AC_CHECK_HEADERS(sys/shm.h) +AC_CHECK_HEADERS(sys/mman.h) +AC_CHECK_HEADERS(sys/ipc.h) +AC_CHECK_HEADERS(sys/select.h) + +AC_CHECK_TYPES([socklen_t], [], [], [#include ]) + +AC_C_CONST + +AC_CHECK_FUNCS(strchr memcpy snprintf atexit setenv) + +AC_CHECK_FUNC(connect) +if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, EXTRA_LIBS="$EXTRA_LIBS -lsocket") +fi +AC_CHECK_FUNC(gethostbyname) +if test $ac_cv_func_gethostbyname = no; then + AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl") +fi +# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb") + +# +# checks specific to this project +# + +AC_MSG_CHECKING(for threaded xpans) +AC_ARG_ENABLE(threaded-xpans, [ --enable-threaded-xpans build threaded xpans], + [fun_ok=$enableval], [fun_ok=no]) +if test "$fun_ok" = "yes"; then + AC_MSG_RESULT($fun_ok) + AC_CHECK_LIB(pthread, pthread_create, have_pthread=yes) + if test x"${have_pthread}" = x"yes"; then + AC_DEFINE(HAVE_LIBPTHREAD) + AC_DEFINE(_REENTRANT) + TLIB="-lpthread" + else + AC_MSG_ERROR([no threads found ... can't use enable-threaded-xpans], 1) + fi +else + AC_MSG_RESULT($fun_ok) +fi +AC_SUBST(TLIB) + +AC_MSG_CHECKING(for shared library build) +AC_ARG_ENABLE(shared, [ --enable-shared build shared libraries], + [fun_ok=$enableval], [fun_ok=no]) +if test "$fun_ok" != "no"; then + fpic="yes" + DOSHARED=shlib + AC_SUBST(DOSHARED) + if test "$fun_ok" = "link"; then + LLIB="-L. -l$PACKAGE_NAME" + else + LLIB='$(LIB)' + fi +else + DOSHARED="" + LLIB='$(LIB)' +fi +AC_SUBST(LLIB) +AC_MSG_RESULT($fun_ok) + +AC_MSG_CHECKING(for request to use posix_spawn) +AC_ARG_ENABLE(posix_spawn, [ --enable-posix_spawn use posix_spawn() if available], + [fun_ok=$enableval], [fun_ok=no]) +AC_MSG_RESULT($fun_ok) +if test "$fun_ok" = "yes"; then + AC_CHECK_FUNCS(posix_spawn _NSGetEnviron) + AC_CHECK_HEADERS(crt_externs.h) +fi + +AC_PATH_XTRA +if test x"${have_x}" = "xyes"; then + AC_DEFINE(HAVE_XT) +fi + +SC_PATH_TCLCONFIG +if test x"${no_tcl}" = x ; then + SC_LOAD_TCLCONFIG + if test -r $TCL_PREFIX/include/tcl.h; then + TCL_CFLAGS="$TCL_INCLUDE_SPEC" + if test x"$DOSHARED" != x -a x"$TCL_SUPPORTS_STUBS" = x1; then + TCL_LIBS="$TCL_STUB_LIB_SPEC" + TCL_CFLAGS="$TCL_CFLAGS -DUSE_TCL_STUBS=1" + AC_MSG_RESULT([Tcl support will utilize stubs library: $TCL_LIBS]) + else + TCL_LIBS="$TCL_LIB_SPEC" + AC_MSG_RESULT([Tcl support will utilize library: $TCL_LIBS]) + fi + AC_DEFINE(HAVE_TCL) + else + if test x"${with_tclconfig}" != x ; then + TCL_CFLAGS="$TCL_INCLUDE_SPEC" + TCL_LIBS="$TCL_LIB_SPEC" + AC_DEFINE(HAVE_TCL) + AC_MSG_RESULT([warning: tcl.h not found with --with-tcl ... tcl build might fail]) + else + AC_MSG_RESULT([$TCL_PREFIX/include/tcl.h not found ... use --with-tcl to build tcl explicitly]) + fi + fi +fi +AC_SUBST(TCL_CFLAGS) +AC_SUBST(TCL_LIBS) + +AC_MSG_CHECKING(for incorporation of thread support) +AC_ARG_WITH(threads, + [ --with-threads build for use in threaded programs], thr=1, thr=0) +if test x"$thr" = x1 ; then + AC_MSG_RESULT(yes) + CFLAGS="$CFLAGS -D_REENTRANT" +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(for gtk) +AC_ARG_WITH(gtk, + [ --with-gtk= include directory for gtk e.g. /usr/include/gtk-1.2], havelib=1, havelib=0) +if test x"$havelib" = x1 ; then + AC_MSG_RESULT(yes ($withval)) + GTK_CFLAGS="`pkg-config gtk+-2.0 --cflags` -DHAVE_GTK=1" + GTK_LIBS="`pkg-config gtk+-2.0 --libs`" + AC_DEFINE(HAVE_GTK) +else + GTK_CFLAGS="" + GTK_LIBS="" + AC_MSG_RESULT(no) +fi +AC_SUBST(GTK_CFLAGS) +AC_SUBST(GTK_LIBS) + +# restore LDFLAGS +LDFLAGS="$LDFLAGS $XLDFLAGS" + +AC_MSG_CHECKING([$host_os configuration]) +case $host_os in + *cygwin*|*Cygwin* ) + AC_DEFINE(HAVE_CYGWIN) + AC_MSG_RESULT([flagging Cygwin]) + ;; + *mingw32*|*Mingw32*) + CFLAGS="$CFLAGS -mconsole" + EXTRA_LIBS="$EXTRA_LIBS -lwsock32" + AC_DEFINE(HAVE_MINGW32) + AC_MSG_RESULT([flagging MinGW]) + ;; + *darwin*|*Darwin*) + LDFLAGS="$LDFLAGS $CFLAGS" + G=`$CC -v 2>&1 | grep version | awk '{print $3}' | awk -F. '{print $1$2}'` + if test x"$G" != x -a "$G" -lt 42; then + CFLAGS="$CFLAGS -no-cpp-precomp" + fi + if test x"$TCL_PREFIX" = x"/usr/local"; then + TCL_CFLAGS="" + AC_MSG_RESULT([removing -I/usr/local/include]) + fi + ;; + *osf*|*Osf*) + AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb") + ;; + * ) + if test x"$fpic" = x"yes" ; then + if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then + CFLAGS="$CFLAGS -fPIC" + AC_MSG_RESULT([adding -fPIC to gcc]) + else + AC_MSG_RESULT(none) + fi + else + AC_MSG_RESULT(none) + fi + ;; +esac + +AC_SUBST(EXTRA_LIBS) + +AC_CONFIG_FILES(Makefile) + +# generate pkg-config meta-data file +AC_CONFIG_FILES(xpa.pc) + +AC_OUTPUT diff --git a/copyright b/copyright new file mode 100644 index 0000000..e115788 --- /dev/null +++ b/copyright @@ -0,0 +1,30 @@ +Unless otherwise indicated, all source is: + +Copyright (C) 1999-2013 +Smithsonian Astrophysical Observatory, Cambridge, MA, USA + +XPA 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 + +Correspondence concerning XPA should be addressed as follows: + +Eric Mandel +Smithsonian Astrophysical Observatory +MS 3 +60 Garden St. +Cambridge, MA 02138 USA + +eric@cfa.harvard.edu + +http://hea-www.harvard.edu/saord/xpa/ diff --git a/ctest.c b/ctest.c new file mode 100644 index 0000000..b4827d1 --- /dev/null +++ b/ctest.c @@ -0,0 +1,684 @@ +/* + * Copyright (c) 1999-2003 Smithsonian Astrophysical Observatory + */ + +/* + * + * ctest -- client test for xpa + * + */ +#include + +extern char *optarg; +extern int optind; + +int quiet=0; +int dowait=0; +int n=0; +int don=0; +int save_bytes=-1; +int exitonerror=0; +char *save_buf=NULL; +char *mode=""; +char name[SZ_LINE]; + +#define MAX_FPS 4 + +#ifdef ANSI_FUNC +int +send_cb (void *client_data, void *call_data, char *paramlist, + char **buf, size_t *len) +#else +int send_cb(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char **buf; + size_t *len; +#endif +{ + char *s = (char *)client_data; + XPA xpa = (XPA)call_data; + char tbuf[SZ_LINE]; + int sendbuf=0; + + /* introduce ourselves */ + if( !quiet ){ + fprintf(stdout, "SEND_CB #%d: %s:%s (%s)\n", + n++, xpa_class(xpa), xpa_name(xpa), s); + } + + /* process special paramlist tokens */ + if( paramlist && *paramlist ){ + if( !quiet ) + fprintf(stdout, "\tparamlist: %s\n", paramlist); + if( !strncmp(paramlist, "buf", 3) ){ + sendbuf=1; + } + else if( !strncmp(paramlist, "error", 5) ){ + if( !quiet ) + fprintf(stdout, "\treturning error: %s\n", ¶mlist[6]); + *len = 0; + *buf = NULL; + XPAError(xpa, ¶mlist[6]); + return(-1); + } + else if( !strcmp(paramlist, "exit") ){ + if( !quiet ) + fprintf(stdout, "Exiting\n"); + exit(0); + } + else if( !strcmp(paramlist, "wait") ){ + fprintf(stdout, "Press to continue ..."); + fgets(tbuf, SZ_LINE, stdin); + } + } + else if( dowait ){ + fprintf(stdout, "Press to continue ..."); + fgets(tbuf, SZ_LINE, stdin); + } + + /* return information about this xpa */ + if( !sendbuf ){ + snprintf(tbuf, SZ_LINE, + "nclass: %s\nname: %s\nmethod: %s\nsendian: %s\ncendian: %s\n", + xpa_class(xpa), xpa_name(xpa), xpa_method(xpa), + xpa_sendian(xpa), xpa_cendian(xpa)); + + if( (xpa->send_mode & XPA_MODE_FILLBUF) ){ + send(xpa_datafd(xpa), tbuf, strlen(tbuf), 0); + *len = 0; + *buf = NULL; + if( !quiet) + fprintf(stdout, "\tcallback writes %d bytes to client\n", + (int)strlen(tbuf)); + } + /* return the buffer and let xpa transmit it */ + else{ + *len = strlen(tbuf); + *buf = (char *)xmalloc(*len); + memcpy(*buf, tbuf, *len); + if( !quiet) + fprintf(stdout, "\tcallback returns %d bytes to xpa handler\n", + (int)strlen(tbuf)); + } + } + /* return the last buffer we were sent */ + else{ + if( (xpa->send_mode & XPA_MODE_FILLBUF) ){ + send(xpa_datafd(xpa), save_buf, save_bytes, 0); + *len = 0; + *buf = NULL; + if( !quiet) + fprintf(stdout, "\tcallback writes %d bytes to client\n", save_bytes); + } + /* return the buffer and let xpa transmit it */ + else{ + *len = save_bytes; + *buf = (char *)xmalloc(*len); + memcpy(*buf, save_buf, *len); + if( !quiet) + fprintf(stdout, "\tcallback returns %d bytes to xpa handler\n", + save_bytes); + } + } + fflush(stdout); + fflush(stderr); + return(0); +} + +#ifdef ANSI_FUNC +int +receive_cb (void *client_data, void *call_data, char *paramlist, + char *buf, size_t len) +#else +int receive_cb(client_data, call_data, paramlist, buf, len) + void *client_data; + void *call_data; + char *paramlist; + char *buf; + size_t len; +#endif +{ + XPA xpa = (XPA)call_data; + char *s = (char *)client_data; + char tbuf[SZ_LINE]; + char *errs[1]; + int i; + int ip; + int got; + int xwait; + + if( !quiet ){ + fprintf(stdout, "RECEIVE_CB #%d: %s:%s (%s)\n", + n++, xpa_class(xpa), xpa_name(xpa), s); + } + if( !quiet ){ + fprintf(stdout, "\tbuf: %lu bytes\n", (unsigned long)len); + } + + /* process param list */ + if( paramlist && *paramlist ){ + if( !quiet ) + fprintf(stdout, "\tparamlist: %s\n", paramlist); + if( !strcmp(paramlist, "free") ){ + if( !quiet ) + fprintf(stdout, "Freeing xpa struct\n"); + XPAFree(xpa); + return(0); + } + else if( !strncmp(paramlist, "error", 5) ){ + if( !quiet ) + fprintf(stdout, "Processing error: %s\n", ¶mlist[6]); + XPAError(xpa, ¶mlist[6]); + return(-1); + } + else if( !strcmp(paramlist, "exit") ){ + if( !quiet ) + fprintf(stdout, "Exiting\n"); + exit(0); + } + else if( !strcmp(paramlist, "wait") ){ + fprintf(stdout, "Press to continue ..."); + fgets(tbuf, SZ_LINE, stdin); + } + else if( !strncmp(paramlist, "xpaset", 6) ){ + ip = 0; + word(paramlist, tbuf, &ip); + if( word(paramlist, tbuf, &ip) ){ + if( !quiet ) + fprintf(stdout, "calling XPASet(%s, \"%s\")\n", + tbuf, &(paramlist[ip])); + got = XPASet(NULL, tbuf, &(paramlist[ip]), mode, + paramlist, strlen(paramlist), NULL, errs, 1); + if( got == 0 ){ + if( !quiet ) + fprintf(stdout, "no XPA access points matched template %s\n", + tbuf); + } + else if( errs[0] != NULL ){ + if( !quiet ) + fprintf(stdout, "Error on xpaset to %s: %s\n", tbuf, errs[0]); + xfree(errs[0]); + if( exitonerror ) + exit(1); + } + else{ + if( !quiet ) + fprintf(stdout, "XPASet to %s successful\n", tbuf); + } + } + return(0); + } + } + else if( dowait ){ + fprintf(stdout, "Press to continue ..."); + fgets(tbuf, SZ_LINE, stdin); + } + + /* reset save buffer */ + if( save_buf != NULL ){ + xfree(save_buf); + save_buf = NULL; + } + save_bytes = 0; + + xwait = dowait; + if( !(xpa->receive_mode & XPA_MODE_FILLBUF) ){ + while( (got=recv(xpa_datafd(xpa), tbuf, SZ_LINE, 0)) >0 ){ + if( xwait >0 ){ + fprintf(stdout, "got %d bytes ... press to continue ...", got); + fgets(tbuf, SZ_LINE, stdin); + xwait--; + } + i = save_bytes; + save_bytes += got; + if( save_buf == NULL ) + save_buf = (char *)xmalloc(save_bytes); + else + save_buf = (char *)xrealloc(save_buf, save_bytes); + memcpy(&save_buf[i], tbuf, got); + } + if( !quiet ) + fprintf(stdout, "callback read %d bytes\n", save_bytes); + } + else{ + save_bytes = len; + save_buf = (char *)xmalloc(len); + memcpy(save_buf, buf, len); + } + fflush(stdout); + fflush(stderr); + return(0); +} + +#ifdef ANSI_FUNC +int +info_cb (void *client_data, void *call_data, char *paramlist) +#else +int info_cb(client_data, call_data, paramlist) + void *client_data; + void *call_data; + char *paramlist; +#endif +{ + XPA xpa = (XPA)call_data; + char *s = (char *)client_data; + char xtemplate[SZ_LINE]; + char *names[MAX_FPS]; + char *bufs[MAX_FPS]; + char *errs[MAX_FPS]; + size_t lens[MAX_FPS]; + int i; + int ip; + int got; + + if( !quiet ){ + fprintf(stdout, "INFO_CB #%d: %s:%s (%s)\n", + n++, xpa_class(xpa), xpa_name(xpa), s); + } + + if( paramlist && *paramlist ){ + if( !quiet ) + fprintf(stdout, "\tparamlist: %s\n", paramlist); + ip = 0; + word(paramlist, xtemplate, &ip); + if( !strcmp(xtemplate, "xpaget") ){ + word(paramlist, xtemplate, &ip); + got = XPAGet(xpa, xtemplate, &(paramlist[ip]), NULL, + bufs, lens, names, errs, MAX_FPS); + if( !quiet ) + fprintf(stdout, "XPAGet (%s) returned %d buffer(s)\n", xtemplate, got); + for(i=0; i 0 ){ + fprintf(stdout, "contents (%lu bytes):\n", (unsigned long)lens[i]); + write(fileno(stdout), bufs[i], lens[i]); + } + if( !quiet ) + fprintf(stdout, "\n"); + } + else{ + write(fileno(stdout), errs[i], strlen(errs[i])); + if( exitonerror ) + exit(1); + } + if( bufs[i] ) + xfree(bufs[i]); + if( names[i] ) + xfree(names[i]); + if( errs[i] ) + xfree(errs[i]); + } + } + } + fflush(stdout); + fflush(stderr); + return(0); +} + +#ifdef ANSI_FUNC +int +main (int argc, char **argv) +#else +int +main(argc, argv) + int argc; + char **argv; +#endif +{ + char *plist=NULL; + char *paramlist=NULL; + char *xtemplate="*:*"; + char *smode=NULL; + char tbuf[SZ_LINE]; + char name[SZ_LINE]; + char cmd[SZ_LINE]; + char fxpa[SZ_LINE]; + char *names[MAX_FPS]; + char *bufs[MAX_FPS]; + char *dbufs[MAX_FPS]; + char *errs[MAX_FPS]; + char *buf=NULL; + int c; + size_t lens[MAX_FPS]; + size_t dlens[MAX_FPS]; + int i; + int got; + int maxbufs; + int j=0; + int loop=1; + int delay=0; + int get=1; + int set=0; + int info=0; + int access=0; + int pipe=0; + int tiny=0; + int doxpa = 0; + int xpaopen=0; + int wait=0; + XPA xpa=NULL; + XPA xpa1=NULL; + int fds[1]; + +#if HAVE_MINGW32==0 + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); +#endif + + *cmd = '\0'; + /* process switch arguments */ + while ((c = getopt(argc, argv, "abd:ef:gil:m:nopqstwx:")) != -1){ + switch(c){ + case 'a': + get = 0; + set = 0; + info = 0; + access = 1; + break; + case 'b': + get = 1; + set = 1; + info = 0; + access = 0; + break; + case 'd': + delay = atoi(optarg); + break; + case 'e': + exitonerror++; + break; + case 'f': + snprintf(cmd, SZ_LINE, "stest %s &\n", optarg); + snprintf(fxpa, SZ_LINE, "%s1", optarg); + break; + case 'g': + get = 1; + set = 0; + info = 0; + access = 0; + break; + case 'i': + get = 0; + set = 0; + info = 1; + access = 0; + break; + case 'l': + loop = atoi(optarg); + break; + case 'm': + smode = xstrdup(optarg); + break; + case 'n': + don = 1; + break; + case 'o': + xpaopen = 1; + break; + case 'p': + pipe = 1; + fds[0] = fileno(stdout); + break; + case 'q': + quiet = 1; + break; + case 's': + get = 0; + set = 1; + info = 0; + access = 0; + break; + case 't': + tiny = 1; + break; + case 'w': + wait = 1; + break; + case 'x': + doxpa = 1; + strcpy(name, optarg); + break; + } + } + if( optind < argc ){ + xtemplate = argv[optind]; + optind++; + } + + /* make up the paramlist */ + plist = XPAArgvParamlist(argc, argv, optind); + if( !don ) + paramlist = plist; + else + paramlist = (char *)xcalloc(strlen(plist)+SZ_LINE, sizeof(char)); + + /* for setting, make up a number of dbufs that we will send */ + if( set ){ + /* must be less than MAX_FPS */ + maxbufs = 2; + + dbufs[0] = (char *)xmalloc(SZ_LINE); + strcpy(dbufs[0], "this is a short string"); + dlens[0] = strlen(dbufs[0]); + + if( tiny ) + dlens[1] = 256+1; + else + dlens[1] = 256*1000+1; + dbufs[1] = (char *)xmalloc(dlens[1]); + for(j=0, buf=dbufs[1]; j 1 ){ + if( !quiet ){ + fprintf(stdout, "CLIENT #%d: %s\n", j, xtemplate); + if( paramlist && *paramlist ) + fprintf(stdout, "\tparamlist: %s\n", paramlist); + } + } + /* make up paramlist, if necessary */ + if( don ) + snprintf(paramlist, SZ_LINE, "%s %d", plist, j); + /* XPAGet, XPAGetFd */ + if( get ){ + if( pipe ){ + got = XPAGetFd(xpa, xtemplate, paramlist, smode, + fds, names, errs, -MAX_FPS); + } + else{ + got = XPAGet(xpa, xtemplate, paramlist, smode, + bufs, lens, names, errs, MAX_FPS); + for(i=0; i 0 ){ + write(fileno(stdout), bufs[i], lens[i]); + } + if( strcmp(paramlist, "buf") ) + fprintf(stdout, "\n"); + } + else{ + write(fileno(stdout), errs[i], strlen(errs[i])); + if( exitonerror ) + exit(1); + } + } + if( bufs[i] ) + xfree(bufs[i]); + if( names[i] ) + xfree(names[i]); + if( errs[i] ) + xfree(errs[i]); + } + } + } + + /* XPASet, XPASetFd */ + if( set ){ + if( pipe ){ + if( !quiet ) + fprintf(stdout, "\tsending data from stdin\n"); + got =XPASetFd(xpa, xtemplate, paramlist, smode, + fileno(stdin), names, errs, MAX_FPS); + } + else{ + got = XPASet(xpa, xtemplate, paramlist, smode, + dbufs[j%maxbufs], dlens[j%maxbufs], + names, errs, MAX_FPS); + } + for(i=0; i to continue ..."); + fgets(tbuf, SZ_LINE, stdin); + } + + /* delay */ + if( delay ) + XPASleep(delay); + } + + /* XPAOpen/XPAClose */ + if( xpaopen ){ + XPAClose(xpa); + } + + /* free up space */ + if( set ){ + for(j=0; j +#include +#include +#include /* gethostbyname() */ + +#define SZ_LINE 1024 + +int main(int argc, char **argv) +{ + int i; + char host[SZ_LINE]; + struct hostent *hostent; + + if( argc > 1 ) + strcpy(host, argv[1]); + else{ + fprintf(stderr, "calling gethostname() ...\n"); + if( gethostname(host, SZ_LINE) == -1 ){ + perror("gethostname"); + exit(1); + } + else{ + fprintf(stderr, "host name is %s\n", host); + } + } + fprintf(stderr, "calling gethostbyname(host) ...\n"); + if( !(hostent = gethostbyname(host)) ){ + perror("gethostbyname"); + exit(1); + } + else{ + fprintf(stderr, "gethostbyname() succeeded\n"); + } + fprintf(stderr, "printing ip address(es) for this host ...\n"); + if( hostent ){ + for(i=0; hostent->h_addr_list[i]; i++){ + fprintf(stderr, "%x\n", *(int *)hostent->h_addr_list[i]); + } + } + else{ + fprintf(stderr, "ERROR: can't look up: %s\n", host); + } + return(0); +} diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..eda8931 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,51 @@ +# +# Makefile for misc programs, not good enough for their own directory +# + +RM = rm +RMFLAGS = -f +MV = mv +MVFLAGS = -f +CP = cp +CPFLAGS = -p + +MANDIR = ../man + +all: dirs files hardcopy + +dirs: + @(if [ ! -d ${MANDIR} ]; then \ + mkdir ${MANDIR}; \ + mkdir ${MANDIR}/man1 ${MANDIR}/man3 ${MANDIR}/mann; \ + fi) + +files: + @(for i in *.html; do \ + echo processing $$i; \ + ./html2man ../man < $$i; \ + done) + +hardcopy: + html2ps -C fb -d -g -n -u -W b -x 1 -o xpa.ps help.html + ps2pdf xpa.ps xpa.pdf + + +# NB: sman.conf must be copied to $HOME or else its not found ... +# we also have to figure out where swish-e is located and hardwire it +index: szlong + @(cd ..; MANPATH=`pwd`/man; export MANPATH; cd doc; \ + SW=`which swish-e`; \ + SZ_LONG=`./szlong`; \ + sed -e 's#@SW@#'$$SW'#g' < sman_conf.tmpl > $${HOME}/sman.conf; \ + sman-update --clearcache; \ + sman-update --verbose --index=./sman/xpa$${SZ_LONG}.index; \ + rm -f $${HOME}/sman.conf szlong) + +szlong: szlong.c + $(CC) $(CFLAGS) -o szlong szlong.c + +clean: + -$(RM) $(RMFLAGS) *.BAK *.bak *.o core errs ,* *~ *.a \ + foo* goo* tags TAGS html2ps.dbg + + diff --git a/doc/acl.html b/doc/acl.html new file mode 100644 index 0000000..b1f458d --- /dev/null +++ b/doc/acl.html @@ -0,0 +1,137 @@ + + + +XPA Access Control + + + + +

XPAAcl: Access Control for XPA Messaging

+ + +

Summary

+

+XPA supports host-based access control for each XPA access point. You +can enable/disable access control using the XPA_ACL environment +variable. You can specify access to specific XPA access points for +specific machines using the XPA_DEFACL and XPA_ACLFILE environment +variables. By default, an XPA access point is accessible only to +processes running on the same machine (same as X Windows). + + +

Description

+

+When INET sockets are in use (the default, as specified by the +XPA_METHOD environment variable), XPA supports a host-based +access control mechanism for individual access points. This mean that +access can be specified for get, set, or info operations for each +access point on a machine by machine basis. For LOCAL sockets, access +is restricted (by definition) to the host machine. + +

+XPA access control is enabled by default, but can be turned off by +setting the XPA_ACL environment variable to false. +In this case, any process can access any XPA server. + +

+Assuming that access control is turned on, the ACL for an individual +XPA access point is set up when that access point is registered +(although it can be changed later on; see below). This can be done in +one of two ways: + +Firstly, the XPA_ACLFILE environment variable can defined to +point to a file of access controls for individual access points. The format +of this file is: +

+ class:name ip acl
+
+The first argument is a template that specifies the class:name of the +access point covered by this ACL. See +XPA Access Points and Templates +for more information about xpa templates. + +

+The second argument is the IP address (in human-readable format) of +the machine which is being given access. This argument can be +* to match all IP addresses. It also can be $host +to match the IP address of the current host. + +

+The third argument is a string combination of s, g, +or i to allow xpaset, xpaget, or +xpainfo access respectively. The ACL argument can be ++ to give sgi access or it can be - to turn +off all access. + +

+For example, +

+  *:xpa1  somehost sg
+  *:xpa1  myhost +
+  * * g
+
+will allow processes on the machine somehost to make xpaget and xpaset calls, +allow processes on myhost to make any call, and allow all other hosts to +make xpaget (but not xpaset) calls. + +Secondly, if the XPA_ACLFILE does not exist, then a single +default value for all access points can be specified using the +XPA_DEFACL environment variable. The default value for this +variable is: +
+  #define XPA_DEFACL "*:* $host +"
+
+meaning that all access points are fully accessible to all processes +on the current host. Thus, in the absence of any ACL environment variables, +processes on the current host have full access to all access points +created on that host. This parallels the X11 xhost mechanism. + +

+Access to an individual XPA access point can be changed using the -acl +parameter for that access point. For example: +

+  xpaset -p xpa1 -acl "somehost -"
+
+will turn off all access control for somehost to the xpa1 access point, while: +
+  xpaset -p XPA:xpa1 -acl "beberly gs"
+
+will give beberly xpaget and xpaset access to the access point whose +class is XPA and whose name is xpa1. +

+Similarly, the current ACL for a given access point can be retrieved using: +

+  xpaget xpa1 -acl
+
+Of course, you must have xpaget access to this XPA access point to +retrieve its ACL. + +

+Note that the XPA access points registered in the xpans +program also behave according to the ACL rules. That is, you cannot +use xpaget to view the access points registered with xpans unless +you have the proper ACL. + +

+Note also when a client request is made to an XPA server, the access +control is checked when the initial connection is established. This +access in effect at this time remains in effect so long as the client +connection is maintained, regardless of whether the access fro that +XPA is changed later on. + +

+We recognize that host-based access control is only relatively secure +and will consider more stringent security (e.g., private key) in the +future if the community requires such support. + + + + + +

+Go to XPA Help Index + +

Last updated: September 10, 2003
+ + + diff --git a/doc/changelog.html b/doc/changelog.html new file mode 100644 index 0000000..c7b146a --- /dev/null +++ b/doc/changelog.html @@ -0,0 +1,806 @@ + + +XPA ChangeLog + + +

XPA ChangeLog

+ +

+This ChangeLog covers the XPA 2 implementation. It will be updated +as we continue to develop and improve XPA. The up-to-date version can be +found here. + +

Public Release 2.1.16 (TBD)

+
    +
  • Ensure that mingw utilizes Windows error codes instead of *nix codes +
+ +

Public Release 2.1.15 (July 23, 2013)

+
    +

    +

  • Added support for large data transfers +

    +

  • XPAGet and XPASet now pass size_t instead of int for lengths +

    +

  • Send and receive callbacks now pass size_t instead of int for lengths +

    +

  • Port to mingw (Windows) +
+ + +

Public Release 2.1.14 (June 7, 2012)

+
    +

    +

  • Fixed several memory leaks in the Tcl wrappers (tcl.c). +

    +

  • Use Tcl stubs library for linking shared Tcl, if available. +
+ +

Public Release 2.1.13 (April 14, 2011)

+
    +

    +

  • An atexit handler is no longer installed automatically (it crashes +Tcl 8.5.8 applications). Call XPAAtExit(void) to install the handler. +

    +

  • Removed permission checking from Find() on cygwin systems. This was broken +by Windows 7. +

    +

  • Removed addition of -no-cpp-precomp flag from gcc 4.2 and beyond (Mac). +
+ +

Public Release 2.1.12 (January 26, 2010)

+
    +

    +

  • Added XPA_HOST environment variable to allow users to specify +the hostname (and hence, ip) component of the INET method id. This is +useful, for example, if you want to register an access point using a +VPN-generated IP instead of the canonical IP. +

    +

  • Fix typo in Tcl binding to xpainfo causing a crash after 2 invocations. +
+ +

Public Release 2.1.11 (December 7, 2009)

+
    +

    +

  • Generalized XPANSKeepAlive() to send messages to xpans, proxy xpans, or +both. The default is to send just to proxies (e.g. chandra-ed). +

    +

  • Changed XPANSKeepAlive() to send an in-band new-line char to +xpans, changed xpans to handle an in-band new-line as a keep-alive +message. Necessitated by Cisco routers that clear the URG flag in +a TCP packet, breaking OOB data transfer for the whole Internet, as +well as the OOB-based keep-alive implemented in xpans. +

    +

  • In xpans, print warning when the keep-alive option switch is used. +

    +

  • Port to mingw (thanks to B.Schoenhammer) +

    +

  • Change OOB character sent by xpans keepalive to a space, trying to working around cisco routers that force OOB data into the inbound stream. +

    +

  • fix gcc fprintf warning in xpans.c +
+ +

Public Release 2.1.10 (September 1, 2009)

+
    +

    +

  • Update mklib and configure.ac to support 64-bit builds on Macs. +

    +

  • Fixed bug in XPAAccess() in which the returned names could have an extra +(bogus) character when the target is an explicit ip:port or local socket file. +

    +

  • Add setjmp/longjmp support to xalloc. +

    +

  • Add XPASaveJmp(void *env) as a high-level interface to xalloc_savejmp(); +
+ +

Internal Release 2.1.9

+
    +

    +

  • Fixed a bug that prevented an access point starting with a number +from being recognized peoperly. NB: a pure number still signifies a +port on the current machine. Also num:num signifies ip:port, where ip +can be a pure hex value or the canonical form vvv.xxx.yyy.zzz. +

    +

  • Modified internal Launch() routine to use posix_spawn(), if necessary. +This is required for OS X 10.5 (leopard), which frowns upon use of fork() +and exec(). Also modified zprocess routines to use Launch(). +

    +

  • Added XPASetFree(xpa, void (*myfree)(void *)) routine to allow callbacks +to specify a free routine other than malloc free (e.g. Perl garbage collection). +

    +

  • XPACmdAdd() now checks to ensure that it was passed an XPA struct created +by XPACmdNew(). +

    +

  • Change launch.h to xlaunch.h to avoid conflict with OS X. +
+ +

Public Release 2.1.8 (1 November 2007)

+
    +

    +

  • A public release to complete current XPA development work. +
+ +

Patch Release 2.1.7b[1,2] (Feb 22, 2006; March 8, 2007)

+
    + +

    +

  • Added a convenience null to the end of the buffers returned by XPAGet. + +

    +

  • Added code to avoid calling atexit routine if a fork'ed child +calls exit() instead of _exit(). + +

    +

  • Added XPA_CLIENT_DOXPA environment variable to turn off client +processing of xpa server requests. + +

    +

  • Added --version to xpaset, xpaget, xpainfo, xpaaccess, xpans to +display XPA version and exit. + +

    +

  • Added support for integrating XPA into a Gtk loop. + +

    +

  • xpaaccess now returns its answer in the error code as well as to stdout +(without the -n switch, it returns 1 for a match, with the -n switch, +the number of matches is returned). + +

    +

  • Fixed bug which prevented xpans from being started up automatically +by an xpa server if its pathname contained a space character. + +

    +

  • Fixed bug in MINGW port of xpans in which an XPA server that +terminated via an interrupt was not being properly removed from the +list of registered access points. + +

    +

  • Added XPA_LOGNAME to override LOGNAME when registering username + +

    +

  • Upgraded swish-e indexing code to 2.4.5. + +
+ +

Patch Release 2.1.6 (4 May 2005)

+
    + +

    +

  • Added -P switch to xpans to enable experimental proxy support +(default is disabled). An argument of 1 processes proxy requests in +the same thread as xpans requests, while an argument of 2 processes +proxy requests in a separate thread. (The latter is recommended to +avoid xpans timeouts, since xpa callback processing can take a long +time.) + +

    +

  • Added ability to build shared libraries (done automatically with +configure --enable-shared) with compilers other than gcc. + +

    +

  • Made yet another attempt to build shared libraries under OS X. + +

    +

  • Fixed a server bug in Tcl support under Windows (introduced early +in 2.1.6) which caused an occasional SEGV. + +

    +

  • Fixed race condition in cases where 2 or more servers makes client calls +to one another. + +

    +

  • Fixed bug in the XPA handler routine in which an access point was +turned off if an error occurred in that routine (as opposed to the +user-defined callback routine). + +

    +

  • Fixed race condition when "ack=false" flag (or -n) is used with XPASet() +(or xpaset). + +

    +

  • Added defensive code to XPA handler to ensure that the passed XPA record +is valid. + +

    +

  • Tcl/XPA servers such as ds9 were not turning off select() on the +xpa channels inside an xpa callback, as required. This is now fixed. + +

    +

  • Added timestamps to most server and client error messages if the +XPA_TIMESTAMP_ERRORS variable is set. This is useful when XPA errors are +being logged in an error log (e.g. Web/CGI use). + +

    +

  • Generated PostScript and PDF versions of the help pages. + +

    +

  • Moved OPTIONS section before (often-lengthy) DESCRIPTION section in +man pages. + +

    +

  • All memory allocation now performs error checking on the result. + +

    +

  • Removed some compiler warnings that surfaced when using gcc -O2. + +

    +

  • Updated configure.ac to better support Tcl in Panther with Apple +Frameworks. + +
+ +

Patch Release 2.1.5 (12 January 2004)

+
    + +

    +

  • Fixed bug in XPAPoll(). Erroneously, no requests were being +processed when maxreq==0. Now, all pending events are processed, as +per the documentation. + +

    +

  • Added ack=false to XPAInfo() (and corresponding -n to xpainfo) +so that client does not wait for a response from the server. This is +essential in cases where XPA servers wish to send info messages to +one another without causing a race condition. + +

    +

  • Generated man pages from the html pages. These are installed +automatically at build time. + +

    +

  • The xpans program with Unix sockets now uses a lock file to signal +that it is running, in order to avoid a potential (but rare) race +condition at startup. + +

    +

  • Code that calls Unix-type bind() now manipulate umask() to ensure that +all users have write permissions to the socket file (OS X apparently uses +these permissions while previous platforms ignore them). + +

    +

  • Configure now checks for socklen_t type (OS X does not define it). + +

    +

  • Added an atexit function to run XPAFree. The aim here is to delete Unix +socket files on exiting. + +

    +

  • Under Windows, the Tcl event-handling code now blocks for 1/1000 of a +second instead of not blocking at all (which inadvertently used 100% of cpu). + +

    +

  • Upgraded Tcl/Tk support to 8.4. + +

    +

  • Made another round of checks was made through all instances of +strcat, strcpy, etc. to look for potential buffer overflows. Changed +all instances of sprintf() to snprintf(). + +

    +

  • Class and name designators are now limited to 1024 characters, for +no particular reason. + +

    +

  • The obsolete $SAORD_BIN variable was being added to the path when +searching for xpans. This is no longer the case. + +

    +

  • Fixed non-ANSI compiler errors in both xpa.c and xpans.c. + +

    +

  • Fixed minor problems to support compilation with g++. + +

    +

  • Ported to Intel icc and gcc 3.3 compilers. + +

    +

  • Upgraded autoconf to 2.57. Included in this upgrade is a change that +makes gcc the default compiler (use "configure CC=cc" to change this). +Also, by default, the Tcl shared object is no longer automatically built +if the Tcl libraries are used. Use the --enable-tclshlib switch in +configure to enable this feature. + +

    +

  • Changed license from public domain to GNU GPL. + +
+ +

Patch Release 2.1.4 (24 March 2003)

+
    + +

    +

  • Made inet method unique, even when hosts are behind a firewall using +the same ports (on different local machines). + +

    +

  • The initial connection from an xpa server to a local xpans now is +controlled by a timeout (default 5 sec, controlled by XPA_CONNECT_TIMEOUT +variable). This should prevent a hang on connect() if the network +is not set up correctly. + +

    +

  • Fixed rare race condition when an XPA server callback performed its own +XPAGet or XPASet call to another XPA server. + +

    +

  • Use POSIX O_NONBLOCK for non-blocking I/O in fcntl call if it +exists, instead of O_NDELAY. + +
+ +

Patch Release 2.1.3 (26 September 2002)

+
    + +

    +

  • Added -k [sec] switch to xpans to support sending one-byte keepalive +messages from xpans to registered xpa servers. + +

    +

  • Added XPANSKeepAlive routine (and Tcl equivalent) to allow +xpa servers to send a one-byte keepalive message to xpans. + +
+ +

Patch Release 2.1.2 (18 July 2002)

+
    + +

    +

  • The "-help" reserved command now also displays the XPA version, if +no explicit sub-commands are specified. + +

    +

  • Change internal state of xpans proxy to save ip:port value of a +server behind a NAT firewall. This is required to give some hope of +distinguishing multiple instances of ds9 running behind NAT. + +
+ +

Patch Release 2.1.1 (20 June 2002)

+
    + +

    +

  • Added a version check between xpans and an access point, +performed when it gets registered by an XPA server. If the server +has a version greater than the xpans version, a warning is issued by +both programs. + +

    +

  • Added a boolean XPA_NSREGISTER environment variable to allow an +XPA server to skip xpans registration. The default is to register with +the name server. If set to "false", the access point still is set up +but it is not registered with an xpans. It can be registered later on +(using -remote or -proxy, for example). + +

    +

  • Fixed bug in which xpans was still listening on any interface when +XPA_METHOD was localhost (instead of just listening on localhost). + +
+ +

Public Release 2.1.0 (22 April 2002)

+ +

+New features include: + +

    +

    +

  • Support for proxy access to XPA servers (e.g. ds9) situated +behind a firewall (useful for NVO-type applications). + +

    +

  • Improved support for allowing remote machines access rights to the +XPA access points (useful for NVO-type applications). + +

    +

  • Ability for XPAAccess() routine and xpaaccess program to contact XPA + directly. + +

    +

  • Support for a clipboard access point that allows clients to store ASCII +state information in an XPA-enabled server. + +

    +

  • Improved support for Windows platform, as well as new support for Mac OSX. +
+ +

Pre-Release 2.1.0e (2 April 2002)

+
    + +

    +

  • Removed the environment variable generated by each XPA access +point (of the form XPA_name=method). The putenv() call was causing ds9 +to crash under both Linux and LinuxPPC during a socket operation. We +suspect a bug in putenv but cannot prove it and this feature is not +essential, so ... + +
+ +

Pre-Release 2.1.0e (1 April 2002)

+
    + +

    +

  • Fixed an uninitialized variable in xpamb which prevented it from +working at all on some systems. + +

    +

  • Changed xpamb switch from "-add" to "-data" (to store named data). + +

    +

  • Changed how xpamb works with xpaget so that xpamb can return data +from XPA access points as well as from stored data. (Previous versions +only returned stored data.) Now, you can retrieve stored data +explicitly using the -info and/or -data switches. For example: +
    +  xpaget xpamb -info foo
    +
    +will return info about the previously stored data named foo. If +neither switch is present, then the name is assumed to be an XPA access +point. +
+ +

Pre-Release 2.1.0e (25 March 2002)

+
    + +

    +

  • Changed symbol for default port from "*" to "$port" to avoid +a syntactical conflict between class:* and machine:* when processing an +XPA access point class:name specification. Thus, the default inet +method now is '$host:$port' instead of '$host:*'. + +
+ +

Pre-Release 2.1.0e (19 March 2002)

+
    + +

    +

  • Removed timeout check when reading data (in clients using xpaget +and servers filling the data buffer). We have more and more cases +where we need to wait a long time to retrieve data (e.g., slow +networks or receiving data being compressed on the fly). + +

    +

  • Moved call to sigaction(SIGCHLD,...) out of XPAOpen(), so that it +is only executed when needed by XPAGet()/XPASet() routines called from +within xpans/proxy. But then changed logic to use a double fork() instead +of sigaction() to prevent zombies (Stevens Adv. Programming p 202). + +

    +

  • Each XPA access point now generates an environment variable of the +form XPA_name=method so that children can communicate with the parent access +point more easily. + +

    +

  • Added version option to Tcl xparec: +
    +  if [catch { xparec "" version } version] {
    +    puts "pre-2.1.0e"
    +  } else {
    +    puts [split $version .]
    +  }
    +
    +to help differentiate between XPA versions within Tcl code. + +
+ +

Pre-Release 2.1.0e (14 February 2002)

+
    +

    +

  • Fixed client handling of out-of-sync messages. +
+ +

Pre-Release 2.1.0e (11 February 2002)

+
    + +

    +

  • Fixed client.c/xopen() so that it does not open an extra socket. + +

    +

  • Fixed xpainfo/xopen() to prevent client from hanging waiting for ack. + +

    +

  • Modified stest to generate xpaaccess points xpa, xpa1, c_xpa, and +i_xpa (or more generally, , 1, c_, i) to allow +more flexible testing of templates. Also added -a for testing XPAAccess(). + +
+ +

Beta Release 2.1.0b10 (31 January 2002)

+
    + +

    +

  • Added support for Mac OSX/Darwin to configure file. + +
+ +

Beta Release 2.1.0b9 (26 January 2002)

+
    + +

    +

  • Fixed bug in client library that caused XPAAccess() call to hang. + +
+ +

Beta Release 2.1.0b8 (4 January 2002)

+
    + +

    +

  • Made modifications to Makefile.in to make releases easier. + +

    +

  • Added instructions to Makefile.in so that xpa.h will always have +correct #defines for XPA_VERSION, XPA_MAJOR_VERSION, XPA_MINOR_VERSION, +and XPA_PATCH_LEVEL. + +
+ +

Beta Release 2.1.0b7 (21 December 2001)

+
    + +

    +

  • Added -proxy switch to -remote sub-command to allow remote access +through a firewall, using xpans as a proxy server. The support for proxy +processing required a change to the client/server protocol. This means +that new xpa servers will not work with old xpa clients (although new +xpa clients will work with old xpa servers). For details about proxy +firewall support, see http://hea-www.harvard.edu/RD/xpa/inet.html. + +

    +

  • Fixed Tcl support for XPA under Windows/Cygwin by re-writing +the code used to add XPA to the Tcl event loop. This fix makes ds9 +support for XPA much more stable under Windows. + +

    +

  • Added the shutdown() call to XPA under Cygwin/Windows before +closing send() sockets. It appears that a Cygwin recv() socket call +does not always sense when the other end closes the socket using +close(). This measure must be considered a hack, since the actual +problem was never resolved. + +

    +

  • Added code to protect accept() and select() calls from interrupts. + +

    +

  • Extended syntax of the environment variable XPA_NSINET to: +
    +  setenv XPA_NSINET host:port[,port[,port]]
    +
    +to allow specification of the XPA access point port for xpans, +as well as the proxy data port. + +

    +

  • Modified xpans log file so that it contains the xpaset commands +required to reconnect with xpa servers. + +

    +

  • xpans now deletes its Unix socket files. + +
+ +

Beta Release 2.1.0b6 (29 October 2001)

+
    + +

    +

  • Implemented a reserve public access point named -clipboard so +that clients can store ASCII state information on any number of named +clipboards. Clipboards of the same name created by clients on +different machines are kept separate. The syntax for creating a +clipboard is: +
    +  [data] | xpaset [server] -clipboard add|append [clipboard_name]
    +  xpaset -p [server] -clipboard delete [clipboard_name]
    +  xpaget [server] -clipboard [clipboard_name]
    +
    +Use "add" to create a new clipboard or replace the contents of an existing +one. Use "append" to append to an existing clipboard. + +
+ +

Beta Release 2.1.0b5 (22 October 2001)

+
    + +

    +

  • Use FD_SETSIZE instead of getdtablesize() to determine how many files +to check during select(); + +

    +

  • Under Cygwin, the launch() routine now uses the Cygwin spawnvp() +instead of fork()/exec() where possible (i.e., if no stdfiles are +being redirected). This is recommended by Cygwin's (skimpy) on-line +documentation and seems to fix the problems ds9 had when starting xpans +automatically. + +

    +

  • Added error check to select() call in xpans. + +
+ +

Beta Release 2.1.0b4 (24 September 2001)

+
    + +

    +

  • The launch() now can return an error code if the execv() system +call fails (something system() does not do). + +

    +

  • INET socket calls between xpa clients and servers now will use +localhost if they are on the same machine. This protects against +Linux systems where the hostname is hardwired (wrongly) in a DHCP +environment. + +
+ +

Beta Release 2.1.0b3 (6 September 2001)

+
    + +

    +

  • Modified xpans so that, in the case of a firewall, it tries to +correct the specified ip:port by matching against the ip found in +the socket packet at accept() time. + +

    +

  • Replaced system() call used to start xpans automatically with +a special launch() call, which performs execvp() directly without going +through sh. (launch() works under DOS and has fewer security problems.) + +

    +

  • Fixed bug in xpans in which its xpa port was always being set to 14286. + +
+ +

Beta Release 2.1.0b2 (17 August 2001)

+
    + +

    +

  • Added support for -remote command, which registers the access +point in the XPA name server of the specified remote server, and gives +the remote server access rights to the access point. This is used, for +example, to give data servers xpa access to ds9 so that data can be +sent to ds9 as a result of a CGI-based Web query. + +

    +

  • Reserved commands (except "-help" and "-version") now can only be +executed on the machine on which the xpa service is running (not +through -remote servers). + +

    +

  • Fixed bug in xpans in which a bad telnet command could hang the program. + +

    +

  • Added -s [security file] to xpans to allow logging of all external +connections. + +
+ +

Beta Release 2.1.0b1 (6 August 2001)

+
    +

    +

  • The xpaaccess client program and XPAAccess() client subroutine +were modified so that an access-type query can directly contact the +xpa servers matching the requested xpa template, instead of just +querying the name server for registered access points. This avoid the +race condition in which an access point is registered but is not yet +available, perhaps because the server has not yet entered its event +loop. Note that the calling sequence of the XPAAccess() routine was +changed to return all matching access points and their availability +status (instead of just returning the number of registered access +points). Because of this, we are calling this a minor release instead +of a patch. + +

    +

  • Added support for XPA_PORT and XPA_PORTFILE environment variables +to allow specification of the port to be used by the command channel +(and data channel, if an optional second port is specified) for a given +access point. + +

    +

  • Added -m switch to xpaget, xpaset, xpainfo, xpaaccess to allow +override of the XPA_METHOD environment variable. + +

    +

  • Changed the default name of the ACL file from xpa.acl to acls.xpa. + +

    +

  • Fixed bug in which it was not possible to send a "set ACL" +command to an XPA server which did not have a receive callback (i.e., +did not allow xpaset). The xpans program is one such server. It now is +possible to set the ACL on xpans. + +

    +

  • We have discovered that Tcl support for datachan and cmdchan is +broken under Windows due to an unexplained incompatibility between +Cygwin sockets and Win32 sockets. We therefore have removed datachan +and cmdchan from the Windows/Tcl support until further notice. + +

    +

  • Extended the behavior of the XPA_DEFACL environment variable so that +it can support more than one acl, using a list of semi-colon delimited +controls such as: setenv XPA_DEFACL '*:* $host +; *:foo1 otherhost +'. + +

    +

  • Fixed bug in which the class:name specifier "*:*" was erroneously +trying to access the xpans name server, instead of accessing all +access points. + +

    +

  • Support TMPDIR and TMP environment variables as well as XPA_TMPDIR. + +
+ +

Patch Release 2.0.5 (10 November 2000)

+
    +

    +

  • Added support for Tcl on Windows where there is no select()-based +event loop (i.e., where there is no Tcl_CreateFileHandler call in Tcl) +

    +

  • Minor fixes in Makefile for installing on Windows +

    +

  • Minor compiler fixes from gcc -Wall. +
+ +

Patch Release 2.0.4 (20 September 2000)

+
    +

    +

  • Removed extraneous include of varargs.h from find.c. +

    +

  • Ported to SGI C compiler, which caught lots of unused variables, etc. +

    +

  • Ported to Cygwin/Windows, which required that we change socket read() +and write() calls to recv() and send() respectively. Also had to ensure that +we only did socket I/O on sockets (no fileio). +
+ +

Patch Release 2.0.3 (15 June 2000)

+
    +

    +

  • Fixed the client XPASet() and XPASetFd() calls to handle the specified +max number of connections (they were ignoring this argument, leading to +memory overwrites). +

    +

  • Fixed Makefile.in so that CFLAGS and LDFLAGS are not hard-wired values. +

    +

  • Fixed word.h to load malloc.h and stdlib.h only if they exist. +

    +

  • Documentation fixes to programs.html (in xpaaccess) and client.html +(XPANSLookup). +

    +

  • Added explicit typecast to strlen() argument to MAX #define in +XPAClientStart (strlen() is unsigned in Linux, which can break MAX). +

    +

  • Removed bogus Imakefile from directory. +

    +

  • Changed directory name to include patch level (i.e., xpa-2.0.3). +
+ +

Patch Release 2.0.2 (9 September 1999)

+
    +

    +

  • Fixed server mode (-s) in the xpaset program by properly cleaning up +the input buffers (sending commands and data in server mode was broken). +
+ +

Patch Release 2.0.1 (6 August 1999)

+
    +

    +

  • Fixed the Tcl binding code (tcl.c) for 64-bit machines (Dec Alpha) +(erroneously used %x instead of %p when converting pointers to ASCII). +

    +

  • Got rid of a few compiler warnings on 64-bit machines (a few are +unavoidable since we must cast int to void * and back when passing around +client data). +
+ +

Public Release 2.0 (27 May 1999)

+
    +

    +

  • "a new day with no mistakes ... yet" +
+ +
+

+Index to the XPA Help Pages + +


+
Last updated: 22 April 2002
+ + diff --git a/doc/changes.html b/doc/changes.html new file mode 100644 index 0000000..8488985 --- /dev/null +++ b/doc/changes.html @@ -0,0 +1,69 @@ + + + +Changes For Users from XPA 1.0 and 2.0 + + + + +

XPA Changes: Changes For Users from XPA 1.0 and 2.0

+ + +

Summary

+

+This document describes changes that will affect users who migrate +from XPA 1.0 to XPA 2.0. + + +

Description

+

+There have been a few changes that affect users who upgrade XPA +from version 1.0 to version 2.0. These changes are detailed below. +

    +

    +

  • XPA commands no longer have a resolver routine (this is open to +negotiations, but we decided the idea was dumb). For the SAOtng +program, this means that you must explicitly specify the access +point, i.e.,: +
    +  cat foo.fits | xpaset SAOtng fits
    +
    + +

    +instead of: +

    +  cat foo.fits | xpaset SAOtng
    +
    +

    +

  • By default, xpaset, xpaget, etc. now wait for the server callback to +complete; i.e., the old -W is implied (and the switch is ignored). +This allows support for better error handling. If you want xpaset, etc. +to return before the callback is complete, use -n switch: +
    +  echo "file foo.fits" | xpaset -n SAOtng
    +
    +

    +

  • The old -w switch in xpaset and xpaget is no longer necessary (and is +ignored), since you can have more than one process communicating with +an xpa access point at one time. + +

    +

  • The new -p switch on xpaset means you need not read from stdout: +
                  
    +  xpaset -p SAOtng colormap I8
    +
    +

    +will send the paramlist to the SAOtng callback without reading from stdin. + +

+ + + + + +

+Go to XPA Help Index + +

Last updated: September 10, 2003
+ + diff --git a/doc/client.html b/doc/client.html new file mode 100644 index 0000000..5648d85 --- /dev/null +++ b/doc/client.html @@ -0,0 +1,898 @@ + + + +XPA Client API + + + + +

XPAClient: The XPA Client-side Programming Interface

+ + +

Summary

+A description of the XPA client-side programming interface. + + +

Introduction to XPA Client Programming

+

+Sending/receiving data to/from an XPA access point is easy: you +generally only need to call the XPAGet() or XPASet() subroutines. +

+  #include <xpa.h>
+
+  int XPAGet(XPA xpa,
+      char *template, char *paramlist, char *mode,
+      char **bufs, size_t *lens, char **names, char **messages, int n);
+
+  int XPASet(XPA xpa,
+      char *template, char *paramlist, char *mode,
+      char *buf, size_t len, char **names, char **messages, int n);
+
+  int XPAInfo(XPA xpa,
+      char *template, char *paramlist, char *mode,
+      char **names, char **messages, int n);
+
+  int XPAAccess(XPA xpa,
+      char *template, char *paramlist, char *mode,
+      char **names, char **messages, int n);
+
+  int XPAGetFd(XPA xpa,
+      char *template, char *paramlist, char *mode,
+      int *fds, char **names, char **messages, int n);
+
+  int XPASetFd(XPA xpa,
+      char *template, char *paramlist, char *mode,
+      int fd, char **names, char **messages, int n);
+
+  XPA XPAOpen(char *mode);
+
+  void XPAClose(XPA xpa);
+
+  int XPANSLookup(XPA xpa,
+      char *template, char *type,
+      char ***classes, char ***names, char ***methods, char ***infos);
+
+ +

Introduction

+ +To use the XPA application programming interface, a software developer +generally will include the xpa.h definitions file: +
+  #include <xpa.h>
+
+in the software module that defines or accesses an XPA access point and +then will link against the libxpa.a library: +
+  gcc -o foo foo.c libxpa.a
+
+XPA has been compiled using both C and C++ compilers. +

+Client communication with XPA public access points generally is +accomplished using XPAGet() or XPASet() within a program (or xpaget +and xpaset at the command line). Both routines require specification +of the name of the access point. If a template +is used to specify the access point name (e.g., "ds9*"), then +communication will take place with all servers matching that template. + + + + +

XPAGet: retrieve data from one or more XPA servers

+ + + +
+  #include <xpa.h>
+
+  int XPAGet(XPA xpa,
+             char *template, char *paramlist, char *mode,
+             char **bufs, size_t *lens, char **names, char **messages,
+	     int n);
+
+
+ + +

+Retrieve data from one or more XPA servers whose class:name identifier +matches the specified template. + +

+A +template +of the form "class1:name1" is sent to the +XPA name server, which returns a list of at most n matching XPA +servers. A connection is established with each of these servers and +the paramlist string is passed to the server as the data transfer +request is initiated. If an XPA struct is passed to the call, then the +persistent connections are updated as described above. Otherwise, +temporary connections are made to the servers (which will be closed +when the call completes). + +

+The XPAGet() routine then retrieves data from at most n XPA servers, +places these data into n allocated buffers and places the buffer +pointers in the bufs array. The length of each buffer is stored in the +lens array. A string containing the class:name and ip:port is stored +in the name array. If a given server returned an error or the server +callback sends a message back to the client, then the message will be +stored in the associated element of the messages array. NB: if +specified, the name and messages arrays must be of size n or greater. + +

+The returned message string will be of the form: +

+  XPA$ERROR error-message (class:name ip:port)
+
+or +
+  XPA$MESSAGE message (class:name ip:port)
+
+

+Note that when there is an error stored in an messages entry, the +corresponding bufs and lens entry may or may not be NULL and 0 +(respectively), depending on the particularities of the server. + +

+The return value will contain the actual number of servers that were +processed. This value thus will hold the number of valid entries in +the bufs, lens, names, and messages arrays, and can be used to loop +through these arrays. In names and/or messages is NULL, no information is +passed back in that array. + +

+The bufs, names, and messages arrays should be freed upon completion (if +they are not NULL); + +

+The mode string is of the form: "key1=value1,key2=value2,..." +The following keywords are recognized: +

+  key   	value		default		explanation
+  ------	--------	--------	-----------
+  ack		true/false	true		if false, don't wait for ack from server (after callback completes)
+  doxpa		true/false	true		client processes xpa requests
+
+

+The ack keyword is not very useful, since the server completes the callback +in order to return the data anyway. It is here for completion (and perhaps +for future usefulness). + +

+Normally, an XPA client will process incoming XPA server requests +while awaiting the completion of the client request. Setting this +variable to "false" will prevent XPA server requests from being +processed by the client. + +

+Example: +

+  #include <xpa.h>
+
+  #define NXPA 10
+  int  i, got;
+  size_t  lens[NXPA];
+  char *bufs[NXPA];
+  char *names[NXPA];
+  char *messages[NXPA];
+  got = XPAGet(NULL, "ds9", "file", NULL, bufs, lens, names, messages,
+  NXPA);
+  for(i=0; i<got; i++){
+    if( messages[i] == NULL ){
+      /* process buf contents */
+      ProcessImage(bufs[i], ...);
+      free(bufs[i]);
+    }
+    else{
+      /* error processing */
+      fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
+    }
+    if( names[i] )
+      free(names[i]);
+    if( messages[i] )
+      free(messages[i]);
+  }
+
+ + + + +

XPASet: send data to one or more XPA servers

+ + + +
+  #include <xpa.h>
+
+  int XPASet(XPA xpa,
+             char *template, char *paramlist, char *mode,
+             char *buf, size_t len, char **names, char **messages,
+             int n);
+
+
+ + +

+Send data to one or more XPA servers whose class:name identifier +matches the specified template. + +

+A +template +of the form "class1:name1" is sent to the +XPA name server, which returns a list of at most n matching XPA +servers. A connection is established with each of these servers and +the paramlist string is passed to the server as the data transfer +request is initiated. If an XPA struct is passed to the call, the +persistent connections are updated as described above. Otherwise, +temporary connections are made to the servers (which will be closed +when the call completes). + +

+The XPASet() routine transfers data from buf to the XPA servers. +The length of buf (in bytes) should be placed in the len variable. + +

+A string containing the class:name and ip:port of each of these server +is returned in the name array. If a given server returned an error or +the server callback sends a message back to the client, then the +message will be stored in the associated element of the messages +array. NB: if specified, the name and messages arrays must be of size +n or greater. + +

+The returned message string will be of the form: + +

+  XPA$ERROR   [error] (class:name ip:port)
+
+or +
+  XPA$MESSAGE [message] (class:name ip:port)
+
+

+The return value will contain the actual number of servers that were +processed. This value thus will hold the number of valid entries in +the names and messages arrays, and can be used to loop through these +arrays. In names and/or messages is NULL, no information is passed back +in that particular array. + +

+The mode string is of the form: "key1=value1,key2=value2,..." +The following keywords are recognized: +

+  key   	value		default		explanation
+  ------	--------	--------	-----------
+  ack		true/false	true		if false, don't wait for ack from server (after callback completes)
+  verify	true/false	false		send buf from XPASet[Fd] to stdout
+  doxpa		true/false	true		client processes xpa requests
+
+

+The ack keyword is useful in cases where one does not want to wait for +the server to complete, e.g. if a lot of processing needs to be done +by the server on the passed data or when the success of the server +operation is not relevant to the client. + +

+Normally, an XPA client will process incoming XPA server requests +while awaiting the completion of the client request. Setting this +variable to "false" will prevent XPA server requests from being +processed by the client. + +

+Example: +

+  #include <xpa.h>
+
+  #define NXPA 10
+  int  i, got;
+  size_t  len;
+  char *buf;
+  char *names[NXPA];
+  char *messages[NXPA];
+  ...
+  [fill buf with data and set len to the length, in bytes, of the data]
+  ...
+  /* send data to all access points */
+  got = XPASet(NULL, "ds9", "fits", NULL, buf, len, names, messages, NXPA);
+  /* error processing */
+  for(i=0; i<got; i++){
+    if( messages[i] ){
+      fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
+    }
+    if( names[i] )    free(names[i]);
+    if( messages[i] ) free(messages[i]);
+  }
+
+ + + + +

XPAInfo: send short message to one or more XPA servers

+ + + +
+  #include <xpa.h>
+
+  int XPAInfo(XPA xpa,
+              char *template, char *paramlist, char *mode,
+	      char **names, char **messages, int n);
+
+
+ + +

+Send a short paramlist message to one or more XPA servers whose +class:name identifier matches the specified +template. + +

+A +template +of the form "class1:name1" is sent to the +XPA name server, which returns a list of at most n matching XPA +servers. A connection is established with each of these servers and +the paramlist string is passed to the server as the data transfer +request is initiated. If an XPA struct is passed to the call, then the +persistent connections are updated as described above. Otherwise, +temporary connections are made to the servers (which will be closed +when the call completes). + +

+The XPAInfo() routine does not send data from a buf to the XPA +servers. Only the paramlist is sent. The semantics of the paramlist +is not formalized, but at a minimum is should tell the server how to +get more information. For example, it might contain the class:name +of the XPA access point from which the server (acting as a client) +can obtain more info using XPAGet. + +

+A string containing the class:name and ip:port of each server is +returned in the name array. If a given server returned an error or +the server callback sends a message back to the client, then the +message will be stored in the associated element of the messages +array. The returned message string will be of the form: +

+  XPA$ERROR   error-message (class:name ip:port)
+
+or +
+  XPA$MESSAGE message 	  (class:name ip:port)
+
+

+The return value will contain the actual number of servers that were +processed. This value thus will hold the number of valid entries in +the names and messages arrays, and can be used to loop through these +arrays. In names and/or messages is NULL, no information is passed back +in that array. + +

+The following keywords are recognized: +

+  key   	value		default		explanation
+  ------	--------	--------	-----------
+  ack		true/false	true		if false, don't wait for ack from server
+
+

+When ack is false, XPAInfo() will not wait for an error return from the XPA +server. This means, in effect, that XPAInfo will send its paramlist string +to the XPA server and then exit: no information will be sent from the server +to the client. This UDP-like behavior is essential to avoid race +conditions in cases where XPA servers are sending info messages to +other servers. If two servers try to send each other an info message +at the same time and then wait for an ack, a race condition will result and +one or both will time out. + +

+Example: +

+  (void)XPAInfo(NULL, "IMAGE", "ds9 image", NULL, NULL, NULL, 0);
+
+ + + + +

XPAGetFd: retrieve data from one or more XPA servers and write to files

+ + + +
+  #include <xpa.h>
+
+  int XPAGetFd(XPA xpa,
+               char *template, char *paramlist, char *mode,
+	       int *fds, char **names, char **messages, int n);
+
+
+ + +

+Retrieve data from one or more XPA servers whose class:name identifier +matches the specified +template +and write it to files associated with +one or more standard I/O fds (i.e, handles returned by open()). + +

+A +template +of the form "class1:name1" is sent to the +XPA name server, which returns a list of at most ABS(n) matching XPA +servers. A connection is established with each of these servers and +the paramlist string is passed to the server as the data transfer +request is initiated. If an XPA struct is passed to the call, then the +persistent connections are updated as described above. Otherwise, +temporary connections are made to the servers (which will be closed +when the call completes). + +

+The XPAGetFd() routine then retrieves data from the XPA servers, +and write these data to the fds associated with one or more fds +(i.e., results from open). Is n is positive, then there will be n fds +and the data from each server will be sent to a separate fd. If n is +negative, then there is only 1 fd and all data is sent to this single +fd. (The latter is how xpaget is implemented.) + +

+A string containing the class:name and ip:port is stored in the name +array. If a given server returned an error or the server callback +sends a message back to the client, then the message will be stored in +the associated element of the messages array. NB: if specified, the +name and messages arrays must be of size n or greater. + +

+The returned message string will be of the form: +

+  XPA$ERROR   error-message (class:name ip:port)
+
+or +
+  XPA$MESSAGE message 	  (class:name ip:port)
+
+

+Note that when there is an error stored in an messages entry, the +corresponding bufs and lens entry may or may not be NULL and 0 +(respectively), depending on the particularities of the server. + +

+The return value will contain the actual number of servers that were +processed. This value thus will hold the number of valid entries in +the bufs, lens, names, and messages arrays, and can be used to loop +through these arrays. In names and/or messages is NULL, no information is +passed back in that array. + +

+The mode string is of the form: "key1=value1,key2=value2,..." +The following keywords are recognized: +

+  key   	value		default		explanation
+  ------	--------	--------	-----------
+  ack		true/false	true		if false, don't wait for ack from server (after callback completes)
+
+

+The ack keyword is not very useful, since the server completes the callback +in order to return the data anyway. It is here for completion (and perhaps +for future usefulness). + +

+Example: +

+  #include <xpa.h>
+  #define NXPA 10
+  int  i, got;
+  int fds[NXPA];
+  char *names[NXPA];
+  char *messages[NXPA];
+  for(i=0; i<NXPA; i++)
+    fds[i] = open(...);
+  got = XPAGetFd(NULL, "ds9", "file", NULL, fds, names, messages, NXPA);
+  for(i=0; i<got; i++){
+    if( messages[i] != NULL ){
+      /* error processing */
+      fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
+    }
+    if( names[i] )
+      free(names[i]);
+    if( messages[i] )
+      free(messages[i]);
+  }
+
+ + + + +

XPASetFd: send data from stdin to one or more XPA servers

+ + + +
+  #include <xpa.h>
+
+  int XPASetFd(XPA xpa,
+               char *template, char *paramlist, char *mode,
+	       int fd, char **names, char **messages, int n)
+
+ + + +

+Read data from a standard I/O fd and send it to one or more XPA +servers whose class:name identifier matches the specified +template. + +

+A +template +of the form "class1:name1" is sent to the +XPA name server, which returns a list of at most n matching XPA +servers. A connection is established with each of these servers and +the paramlist string is passed to the server as the data transfer +request is initiated. If an XPA struct is passed to the call, then the +persistent connections are updated as described above. Otherwise, +temporary connections are made to the servers (which will be closed +when the call completes). + +

+The XPASetFd() routine then reads bytes from the specified fd +until EOF and sends these bytes to the XPA servers. +The final parameter n specifies the maximum number of servers to contact. +A string containing the class:name and ip:port of each server is returned in +the name array. If a given server returned an error, then the error +message will be stored in the associated element of the messages array. +NB: if specified, the name and messages arrays must be of size n or greater. + +

+The return value will contain the actual number of servers that were +processed. This value thus will hold the number of valid entries in +the names and messages arrays, and can be used to loop through these +arrays. In names and/or messages is NULL, no information is passed back +in that array. + +

+The mode string is of the form: "key1=value1,key2=value2,..." +The following keywords are recognized: +

+  key   	value		default		explanation
+  ------	--------	--------	-----------
+  ack		true/false	true		if false, don't wait for ack from server (after callback completes)
+  verify	true/false	false		send buf from XPASet[Fd] to stdout
+
+

+The ack keyword is useful in cases where one does not want to wait for +the server to complete, e.g. is a lot of processing needs to be done +on the passed data or when the success of the server operation is not +relevant to the client. + +

+Example: +

+  #include <xpa.h>
+
+  #define NXPA 10
+  int  i, got;
+  int fd;
+  char *names[NXPA];
+  char *messages[NXPA];
+  fd = open(...);
+  got = XPASetFd(NULL, "ds9", "fits", NULL, fd, names, messages, NXPA);
+  for(i=0; i<got; i++){
+    if( messages[i] != NULL ){
+      /* error processing */
+      fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
+    }
+    if( names[i] )
+      free(names[i]);
+    if( messages[i] )
+      free(messages[i]);
+  }
+
+ + + + +

XPAOpen: allocate a persistent client handle

+ + + +
+  #include <xpa.h>
+
+  XPA XPAOpen(char *mode);
+
+
+ + +

+XPAOpen() allocates a persistent XPA struct that can be used with +calls to XPAGet(), XPASet(), XPAInfo(), XPAGetFd(), and +XPASetFd(). Persistence means that a connection to an XPA server is +not closed when one of the above calls is completed but will be +re-used on successive calls. Using XPAOpen() therefore saves the time +it takes to connect to a server, which could be significant with slow +connections or if there will be a large number of exchanges with a +given access point. The mode argument currently is ignored ("reserved +for future use"). + +

+An XPA struct is returned if XPAOpen() was successful; otherwise NULL +is returned. This returned struct can be passed as the first argument +to XPAGet(), etc. Those calls will update the list of active XPA +connections. Already connected servers (from a previous call) are +left connected and new servers also will be connected. Old servers +(from a previous call) that are no longer needed are disconnected. +The connected servers will remain connected when the next call to +XPAGet() is made and connections are once again updated. + +

+Example: +

+ #include <xpa.h>
+
+  XPA xpa;
+  xpa = XPAOpen(NULL);
+
+ + + + +

XPAClose: close a persistent XPA client handle

+ + + +
+  #include <xpa.h>
+
+  void XPAClose(XPA xpa);
+
+
+ + +

+XPAClose closes the persistent connections associated with this XPA struct +and frees all allocated space. It also closes the open sockets connections +to all XPA servers that were opened using this handle. + +

+Example: +

+  #include <xpa.h>
+
+  XPA xpa;
+  XPAClose(xpa);
+
+ + + + +

XPANSLookup: lookup registered XPA access points

+ + + +
+  #include <xpa.h>
+
+  int XPANSLookup(XPA xpa,
+  	          char *template, char type,
+	          char ***classes, char ***names,
+	          char ***methods, char ***infos)
+
+
+ + +

+XPA routines act on a class:name identifier in such a way +that all access points that match the identifier are processed. It is +sometimes desirable to choose specific access points from the +candidates that match the +template. In order to do this, the +XPANSLookup routine can be called to return a list of matches, so that +specific class:name instances can then be fed to XPAGet(), XPASet(), etc. + +

The first argument is an optional XPA struct. If non-NULL, the +existing name server connection associated with the specified xpa is +used to query the xpans name server for matching templates. Otherwise, +a new (temporary) connection is established with the name server. + +

+The second argument to XPANSLookup is the class:name +template +to match. + +

+The third argument for XPANSLookup() is the type of access and can be +any combination of: +

+  type   	explanation
+  ------	-----------
+  g		xpaget calls can be made on this access point
+  s		xpaset calls can be made on this access point
+  i		xpainfo calls can be made on this access point
+
+

+The call typically specifies only one of these at a time. + +

+The final arguments are pointers to arrays that will be filled +in and returned by the name server. The name server will allocate and +return arrays filled with the classes, names, and methods of all XPA +access points that match the template +and have the specified type. Also returned are info strings, which +generally are used internally by the client routines. These can be +ignored (but the strings must be freed). The function returns the +number of matches. The returned value can be used to loop through the +matches: + +Example: +

+  #include <xpa.h>
+
+  char **classes;
+  char **names;
+  char **methods;
+  char **infos;
+  int i, n;
+  n = XPANSLookup(NULL, "foo*", "g", &classes, &names, &methods, &infos);
+  for(i=0; i<n; i++){
+    [more specific checks on possibilities ...]
+    [perhaps a call to XPAGet for those that pass, etc. ...]
+    /* don't forget to free alloc'ed strings when done */
+    free(classes[i]);
+    free(names[i]);
+    free(methods[i]);
+    free(infos[i]);
+  }
+  /* free up arrays alloc'ed by names server */
+  if( n > 0 ){
+    free(classes);
+    free(names);
+    free(methods);
+    free(infos);
+  }
+
+

+The specified +template +also can be a host:port specification, for example: +

+  myhost:12345
+
+

+In this case, no connection is made to the name server. Instead, the +call will return one entry such that the ip array contains the ip for +the specified host and the port array contains the port. The class +and name entries are set to the character "?", since the class and +name of the access point are not known. + + + + +

XPAAccess: return XPA access points matching +template (XPA 2.1 and above)

+ + + +
+  #include <xpa.h>
+
+  int XPAAccess(XPA xpa,
+	        char *template, char *paramlist, char *mode,
+	        char **names, char **messages, int n);
+
+
+ + +

+The XPAAccess routine returns the public access points that match the +specified second argument template and +have the specified access type. + +

+A +template +of the form "class1:name1" is sent to the +XPA name server, which returns a list of at most n matching XPA +servers. A connection is established with each of these servers and +the paramlist string is passed to the server as the data transfer +request is initiated. If an XPA struct is passed to the call, then the +persistent connections are updated as described above. Otherwise, +temporary connections are made to the servers (which will be closed +when the call completes). + +

+The XPAAccess() routine retrieves names from at most n XPA servers +that match the specified template and that were checked for access +using the specified mode. The return string contains both the +class:name and ip:port. If a given server returned an error or the +server callback sends a message back to the client, then the message +will be stored in the associated element of the messages array. +NB: if specified, the name and messages arrays must be of size n or greater. + +

+The returned message string will be of the form: +

+  XPA$ERROR error-message (class:name ip:port)
+
+

+Note that names of matching registered access points are always +returned but may not be valid; it is not sufficient to assume that the +returned number of access points is the number of valid access points. +Rather, it is essential to check the messages array for error +messages. Any string in the messages array is an error message and +indicated that the associated access point is not available. + +

+For example, assume that a server registers a number of access points +but delays entering its event loop. If a call to XPAAccess() is made +before the event loop is entered, the call will timeout (after waiting +for the long timeout period) and return an error of the form: +

+  XPA$ERROR: timeout waiting for server authentication (XPA:xpa1)
+
+The error means that the XPA access point has been registered but is +not yet available (because events are not being processed). When the +server finally enters its event loop, subsequent calls to XPAAccess() +will return successfully. + +

+NB: This routine only works with XPA servers built with XPA 2.1.x and later. +Servers with older versions of XPA will return the error message: + + XPA$ERROR invalid xpa command in initialization string + +If you get this error message, then the old server actually is ready +for access, since it got to the point of fielding the query! The +xpaaccess program, for example, ignores this message in order to work +properly with older servers. + +

+The third argument for XPAAccess() is the type of access and can be +any combination of: +

+  type   	explanation
+  ------	-----------
+  g		xpaget calls can be made on this access point
+  s		xpaset calls can be made on this access point
+  i		xpainfo calls can be made on this access point
+
+

+The mode string argument is of the form: "key1=value1,key2=value2,..." +The following keywords are recognized: +

+  key   	value		default		explanation
+  ------	--------	--------	-----------
+  ack		true/false	true		if false, don't wait for ack from server (after callback completes)
+
+

+The ack keyword is not very useful, since the server completes the callback +in order to return the data anyway. It is here for completion (and perhaps +for future usefulness). + + + + + + + + + + + + + + + + + + + + + + + +

+Go to XPA Help Index + +

Last updated: March 10, 2007
+ + + diff --git a/doc/convert.html b/doc/convert.html new file mode 100644 index 0000000..a8d0dd2 --- /dev/null +++ b/doc/convert.html @@ -0,0 +1,146 @@ + + + +Converting the XPA API to 2.0 + + + + +

XPAConvert: Converting the XPA API to 2.0

+ + +

Summary

+

+This document describes tips for converting from xpa 1.0 (Xt-based +xpa) to xpa 2.0 (socket-based xpa). + + +

Description

+

+The following are tips for converting from xpa 1.0 (Xt-based xpa) to +xpa 2.0 (socket-based xpa). The changes are straight-forward and +almost can be done automatically (we used editor macros for most of +the conversion). +

    +

    +

  • The existence of the cpp XPA_VERSION directive to distinguish between 1.0 +(where it is not defined) and 2.0 (where it is defined). + +

    +

  • Remove the first widget argument from all send and receive server +callbacks. Also change first 2 arguments from XtPointer to void +*. For example: +
    +#ifdef XPA_VERSION
    +static void XPAReceiveFile(client_data, call_data, paramlist, buf, len)
    +     void *client_data;
    +     void *call_data;
    +     char *paramlist;
    +     char *buf;
    +     int len;
    +#else
    +static void XPAReceiveFile(w, client_data, call_data, paramlist, buf, len)
    +     Widget w;
    +     XtPointer client_data;
    +     XtPointer call_data;
    +     char *paramlist;
    +     char *buf;
    +     int len;
    +#endif
    +
    +

    +

  • Server callbacks should be declared as returning int instead +of void. They now should return 0 for no errors, -1 for error. + +

    +

  • The mode flags have changed when defining XPA server callbacks. +The old S flag (save buffer) is replaced by freebuf=false. +The old E flag (empty buffer is OK) is no longer used (it +was an artifact of the X implementation). + +

    +

  • Change NewXPACommand() to XPAcmdNew(), with the new calling sequence: +
    +  xpa = NewXPACommand(toplevel, NULL, prefix, NULL);
    +
    +is changed to: +
    +  xpa = XPACmdNew(xclass, name);
    +
    +

    +

  • Change the AddXPACommand() subroutine name to XPACmdAdd (with the same +calling sequence): +
    +  AddXPACommand(xpa, "file",
    +    "\tdisplay a new file\n\t\t  requires: filename",
    +    NULL, NULL, NULL, XPAReceiveFile, text, NULL);
    +
    +is changed to: +
    +  XPACmdAdd(xpa, "file",
    +    "\tdisplay a new file\n\t\t  requires: filename",
    +    NULL, NULL, NULL, XPAReceiveFile, text, NULL);
    +
    +

    +

  • The XPAXtAppInput() routine should be called just before XtAppMainLoop() +to add xpa fds to the Xt event loop: +
    +  /* add the xpas to the Xt loop */
    +  XPAXtAddInput(app, NULL);
    +
    +  /* process events */
    +  XtAppMainLoop(app);
    +
    +

    +

  • Change NewXPA() to XPANew() and call XPAXtAddInput() if the XtAppMainLoop +routine already has been entered: +
    +  xpa = NewXPA(saotng->xim->toplevel, prefix, xparoot,
    +               "FITS data or image filename\n\t\t  options: file type",
    +               XPASendData, new, NULL,
    +               XPAReceiveData, new, "SE");
    +
    +is changed to: +
    +  sprintf(tbuf, "%s.%s", prefix, xparoot);
    +  xpa = XPANew("SAOTNG", tbuf,
    +               "FITS data or image filename\n\t\t  options: file type",
    +               XPASendData, new, NULL,
    +               XPAReceiveData, new, "SE");
    +  XPAXtAddInput(XtWidgetToApplicationContext(saotng->xim->toplevel), xpa);
    +
    +

    +

  • Change XPAInternalReceiveCommand() to XPACmdInternalReceive() +remove first argument in the calling sequence): +
    +  XPAInternalReceiveCommand(im->saotng->xim->toplevel,
    +			    im->saotng, im->saotng->commands,
    +			    "zoom reset", NULL, 0);
    +
    +is changed to: +
    +  XPACmdInternalReceive(im->saotng, im->saotng->commands,
    +			"zoom reset", NULL, 0);
    +
    +

    +

  • Change DestroyXPA to XPAFree: +
    +  DestroyXPA(im->dataxpa);
    +
    +is changed to: +
    +  XPAFree(im->dataxpa);
    +
    +
+ + + + + +

+Go to XPA Help Index + +

Last updated: September 10, 2003
+ + + diff --git a/doc/env.html b/doc/env.html new file mode 100644 index 0000000..4a71e80 --- /dev/null +++ b/doc/env.html @@ -0,0 +1,371 @@ + + + +The XPA Environment + + + + +

XPAEnv: Environment Variables for XPA Messaging

+ + +

Summary

+Describes the environment variables which can be used to tailor the overall +XPA environment. + + +

Description

+

+The following environment variables are supported by XPA: +

+

+

XPA_ACL +
If XPA_ACL is true, then +host-based XPA Access Control +is turned on and only specified machines can access specified access +points. If false, then access control is turned off and any +machine can access point. The default is turn turn access control on. + +

+

XPA_ACLFILE +
If +XPA Access Control +is turned on, this variable specifies the name of the file containing +access control information for all access points started by this user. +The default file name is: $HOME/acls.xpa. + +

+

XPA_CONNECT_TIMEOUT +
When an XPA server first starts up, it immediately tries to +connect to the XPA name server program (xpans) on the host specified by +the XPA_NSINET variable. (If this connection fails on the +local host, and if xpans can be found in the path, then the name +server is started automatically.) Unfortunately, a mis-configured +network can cause this connect attempt to hang for many seconds while +the connect() system call times out. Therefore, an alarm is started +to interrupt the connect() call and prevent a long hang. The initial +value of the alarm timeout is 10 seconds, but can be changed by setting +this environment variable. If you want to disable the alarm and allow +the initial connect() to time out, set the value of this variable to +0. Normally, users would not change this variable at all. + +

+

XPA_CLIENT_DOXPA +
Normally, an XPA client (xpaget, xpaset, etc.) will process incoming +XPA server requests while awaiting the completion of the client request. +Setting this variable to "false" will prevent XPA server requests from +being processed by the client. + +

+

XPA_DEFACL +
If +XPA Access Control +is turned on, this variable specifies the default access control +condition for all access points, if the XPA_ACLFILE file does +not exist. The default acl is: $host:* $host +, meaning that +all processes on the host machine have full access to all access points. + +

+

XPA_HOST +
+For the INET socket method, XPA utilizes the canonical hostname (as +returned by the gethostname() routine) to construct the IP part of the +method id. Under some circumstances, this might not be a correct choice +of name and IP. For example, if an XPA server is started on a machine +running VPN, you might want to use the VPN name and IP instead of the +canonical host name, so that other machines in the VPN network can +access the server. In this case, you can set the XPA_HOST to be +the VPN name (if resolvable) or, more easily, the VPN IP. + +

+

XPA_IOCALLSXPA +
+Setting this variable causes all XPA socket IO calls to process +outstanding XPA requests whenever the primary socket is not ready for +IO. This means that a server making a client call will (recursively) +process incoming server requests while waiting for client completion. +This inter-IO XPA processing avoids a rare +XPA Race Condition: two or more +XPA servers sending messages to one another using an XPA client +routine such as XPASet() can deadlock while each waits for the other +server to respond. This can happen, for example, if the servers call +XPAPoll() with a time limit, and send messages in between the polling call. + +

+By default, this option is turned off, because we judge that the added +code complication and overhead involved will not be justified by the +amount of its use. Moreover, processing XPA requests within socket IO +can lead to non-intuitive results, since incoming server requests will +not necessarily be processed to completion in the order in which they +are received. + +

+

XPA_LOGNAME +
+XPA preferentially uses the de facto standard environment variable +LOGNAME to determine the username when registering an access point in +the name server. If this environment variable has been used for +something other than the actual user name (such as a log file name), +unexpected results can ensue. In such cases, use the XPA_LOGNAME +variable to set the user name. (If neither exists, then getpwuid(geteuid()) +is used as a last resort). + +

+

XPA_LONG_TIMEOUT +
XPA is designed to allow data to be sent from one process to +another over a long period of time (i.e., a program that generates +image data sends that data to an image display, but slowly) but it +also seeks to prevent hangs. This is done by supporting 2 timeout +periods: a short timeout for protocol communication +and a long for data communication. +

+The XPA_LONG_TIMEOUT variable controls the long +timeout and is used to prevent hangs in cases where communication +between the client and server that is not controlled by the +XPA interface itself. Transfer of data between client and server, or a +client's wait for a status message after completion of the server +callback, are two examples of this sort of communication. By default, +the long timeout is set to 180 seconds. +Setting the value to -1 will disable long timeouts and allow +an infinite amount of time. + +

+

XPA_MAXHOSTS +
The maximum number of access points that the programs +xpaset, xpaget, and xpainfo will +communicate with at one time. The default is 64, meaning, for +example, that the xpaset program will not send a message +to more than 100 access points at one time and xpaget will +not retrieve from more than 100 access points at one time. + +

+

XPA_METHOD +
+Determines the socket connection method used by this session of XPA. +The choices are: inet (to use INET or Internet-based +sockets), localhost (to use the machines localhost inet +socket), or local (unix) (to use UNIX sockets). The default +is INET. Using the inet method will allow access +from other machines (subject to access controls) but using +localhost or local will not. Localhost is most useful +for private access and when the machine in question is not connected +to the Internet. The unix method also can be used for private access +and non-Internet connections (Unix platforms only). +

+Once defined, the first registration of an XPA access point will +ensure that an instance of the +XPA Name Server (xpans) +is running that handles that connection method. All new access points +will use the new connection method but existing access points will use +the original method. + +

+

XPA_NSINET +
For the inet method of socket connection, this variable +specifies the host and port on which the +XPA Name Server (xpans) +is listens for new access points. The default is $host:$port, +meaning that the default XPA port (14285) on the current machine +(as returned by gethostname()) is used. If several machines were all +accessing the same XPA access points, you would use this variable to +specify that they all use the same name server to find out about these +access points. For example, a value of myhost:$port would +mean that the xpans name server is running on myhost and uses the +default port 12345. All machines would then get the XPA access points +registered with that name server, subject to access controls. +

+The port used by xpans to register its XPA access point normally is +taken to be one greater than the port on which it receives new access +points from XPA servers. You can specify a specific access point port +using the syntax machine:port1,port2, i.e., the access point port is +specified after the comma. For example, $host:12345,23456 will listen +for new access ports on 12345 and will accept XPA commands on 23456. + +

+

XPA_NSREGISTER +
+This boolean variable specifies whether a server registers its XPA +access point with the specified xpans name server. The default is +true. If set to false, the access point still is +set up but it is not registered with xpans and therefore cannot be +accessed by name. (It can be accessed by method, if the latter is +known.) Note that an access point can be registered later on (using +-remote or -proxy, for example). This variable mainly is useful in +cases where the Internet configuration is broken (so that registration +causes a DNS hang) but you still wish to and can use the server with a +remote xpans (e.g., ds9's Virtual Observatory capability). + +

+

XPA_NSUNIX +
For the local method of socket connection, this variable +specifies the name of the Unix file that will be used to access the +XPA Name Server (xpans). The default is +xpans_unix. This variable is not usually needed. Note that +is the local socket method is used, then remote machines will +not be able to access the xpans name server or the registered XPA access +points. + +

+

XPA_NSUSERS +
+This variable specifies whether other users' access points will be +returned by the +XPA Name Server (xpans) for use by +xpaget, xpaset, etc. +Generally speaking, it is sufficient to run one xpans name server per +machine and register the access points for all users with that xpans. +This means, for example, that if you request information from +ds9 by running: +
+  xpaget ds9 colormap
+
+you might get information from your own ds9 as well as +from another user running ds9 on the same machine. The +XPA_NSUSERS variable controls whether you want such access +to the access points of other users. +By default, only your own access points are returned, so +that, in the example above, you would only get the colormap information +from the ds9 you registered. If, however, you had set the value of the +XPA_NSUSERS variable to eric,fred, then you would be +able to communicate with both eric and fred's access points. Note that +this variable can be overridden using the -u switch on the +xpaget, xpaset, and xpainfo programs. + +

+

XPA_PORT +
+A semi-colon delimited list of user specified ports to use for specific +XPA access points. The format is each specification is: +
+class:template port1[ port2]
+
+where port1 is the main (command) port for the access point and +port2 is the (secondary) data port. If port2 is not specified, +it defaults to a value of 0 (meaning the system assigns the port). + +

+Specification of specific ports is useful, for example, when a machine +outside a firewall needs to communicate with a machine inside a +firewall. In such a case, the firewall should be configured to allow +socket connections to both the command and data port from the outside +machine, and the inside XPA program should be started up with the +outside machine in its ACL list. Then, when the inside program is +started with specified ports, outside XPA programs can use +"machine:port" to contact the inside access points, instead of the +access point names. That is, the machine outside the firewall does not +need access to the XPA name server: +

+export XPA_PORT="DS9:ds9 12345 12346"   # on machine "inside"
+cat foo.fits | xpaset inside:12345 fits # on machine "outside"
+
+Note that 2 ports are required for full XPA communication and +therefore 2 ports should be specified to go through a firewall. The +second port assignment is not important if you simply are assigning +the command port in order to communicate commands with a known +port (e.g., to bypass the xpans name server). If only one (command) +port is specified, the system will negotiate a random data port and +everything will work properly. + +

+This support is somewhat experimental. If you run into problems, please +let us know. + +

+

XPA_PORTFILE +
+A list of user-specified port to use for specific xpa access points. +The format of the file is: +
+class:template port1 [port2]
+
+where port1 is the main port for the access point and +port2 is the data port. If port2 is not specified, it defaults +to a value of 0 (meaning the system assigns the port). See +XPA_PORT above for an explanation of user-specified ports. + +

+

XPA_SHORT_TIMEOUT +
XPA is designed to allow data to be sent from one process to +another over a long period of time (i.e., a program that generates +image data sends that data to an image display, but slowly) but it +also seeks to prevent hangs. This is done by supporting 2 timeout +periods: a short timeout for protocol communication +and a long for data communication. +

+The XPA_SHORT_TIMEOUT variable +controls the short timeout and is used to prevent hangs +in cases where the XPA protocol requires internal communication between +the client and server that is controlled by the XPA interface +itself. Authentication is an example of this sort of communication, +as is the establishment of a data channel between the two processes. +The default value for the short is 30 seconds (which is +a pretty long time, actually). Setting the value to -1 will disable +short timeouts and allow an infinite amount of time. + +

+

XPA_SIGUSR1 +
If the value of this variable is true, then XPA will +catch SIGUSR1 signals when performing an I/O operation in order to +curtail that operation. This facility allows users to send a SIGUSR1 +signal to an XPA server if a client is hanging up the server by +sending or receiving data too slowly (timeouts also can be used -- see +above). When enabled in this way, the SIGUSR1 signal is ignored at all other +times, so that its safe to send the signal at any time. If the +variable is set to false, then SIGUSR1 is not used at +all. Turning off SIGUSR1 would be desired in cases there the program +uses SIGUSR1 for some other reason and does not want XPA interfering. +The default is to use the signal. + +

+

XPA_TIMESTAMP_ERRORS +
If XPA_TIMESTAMP_ERRORS is true, then error +messages will include a date/time string. This can be useful when +XPA errors are being saved in an error log (e.g. Web/CGI use). The +default is false. +
+ +

+

XPA_TMPDIR +
This variable specifies the directory into which XPA logs, Unix +socket files (when XPA_METHOD is local), etc. are +stored. The default is /tmp/.xpa. + +

+

XPA_VERBOSITY +
Specify the verbosity level of error messages. If the value is +set to 0, false, or off, then no error +messages are printed to stderr. If the value is 1, then +important XPA error messages will be output. If the value is +set to 2, XPA warnings about out-of-sync messages will also +be output. These latter almost always can be ignored. + +

+

XPA_VERSIONCHECK +
Specify whether a new access point should check its major and minor XPA +version number against the version used by the xpans name server at +registration time. The default is true. When checking is +performed, a warning is issued if the server major version is found to +be greater than the xpans version. Note that the check is performed +both by the XPA server and by the xpans process and warnings will be +issued by each. Also, instead of the values of true or +false, you can give this variable an integer value n. In this +case, each version checking process (i.e., the XPA-enabled server or +xpans) will print out a maximum of n warning messages (after which +version warnings are silently swallowed). +

+In general, it is a bad idea to run an XPA-enabled server program +using a version of XPA newer than the basic xpaset, xpaget, xpaaccess, +xpans programs. This sort of mismatch usually will not work due to +protocol changes. + + + + + +

+Go to XPA Help Index + +

Last updated: December 23, 2009
+ + + diff --git a/doc/examples.html b/doc/examples.html new file mode 100644 index 0000000..0bd68d4 --- /dev/null +++ b/doc/examples.html @@ -0,0 +1,64 @@ + + + +Where to Find Example/Test Code + + + + +

XPACode: Where to Find Example/Test Code

+ + +

Summary

+

+The XPA source code directory contains two test programs, +stest.c, and ctest.c that can serve as +examples for writing XPA servers and clients, respectively. +They also can be used to test various features of XPA. + + +

Description

+

+To build the XPA test programs, execute: +

+   make All
+
+in the XPA source directory to generate the stest and +ctest programs. (NB: this should work on all platforms, +although we have had problems with unresolved externals on one +Sun/Solaris machine, for reasons still unknown.) +

+The stest program can be executed with no arguments to start +an XPA server that contains the access points: xpa, xpa1, +c_xpa (containing sub-commands cmd1 and cmd2), and i_xpa. +You then can use xpaset and xpaget to interact with these access points: +

+  cat xpa.c | xpaset xpa      # send to xpa
+  cat xpa.c | xpaset "xpa*"   # send to xpa and xpa1
+  xpaget xpa                  # receive from xpa
+  xpaget xpa*                 # receive from xpa and xpa1
+
+etc. You also can use ctest to do the same thing, or to iterate: +
+  ctest -s -l 100 xpa        # send to xpa 100 times
+  ctest -s -l 100 "xpa*"     # send to xpa and xpa1 100 times
+  ctest -g -l 100 xpa        # receive from xpa 100 times
+  ctest -g -l 100 "xpa*"     # receive from xpa and xpa1 100 times
+
+More options are available: see the stest.c and ctest.c code itself, which +were used extensively to debug XPA. + +

+The file test.tcl in the XPA source directory gives examples for using the +XPATclInterface. + + + + + +

+Go to XPA Help Index + +

Last updated: September 10, 2003
+ + diff --git a/doc/help.html b/doc/help.html new file mode 100644 index 0000000..dfe51f9 --- /dev/null +++ b/doc/help.html @@ -0,0 +1,162 @@ + + + +The XPA Help Facility + + + + +

XPA: Public Access to Data and Algorithms

+ + +

Summary

+This document is the Table of Contents for XPA. + + +

Description

+

+The XPA messaging system provides seamless communication between many +kinds of Unix programs, including X programs and Tcl/Tk programs. It +also provides an easy way for users to communicate with XPA-enabled +programs by executing XPA client commands in the shell or by utilizing +such commands in scripts. Because XPA works both at the programming +level and the shell level, it is a powerful tool for unifying any +analysis environment: users and programmers have great flexibility in +choosing the best level or levels at which to access XPA services, and +client access can be extended or modified easily at any time. + +

+A program becomes an XPA-enabled server by defining named points of +public access through which data and commands can be exchanged with +other client programs (and users). Using standard TCP sockets as a +transport mechanism, XPA supports both single-point and broadcast +messaging to and from these servers. It supports direct communication +between clients and servers, or indirect communication via an +intermediate message bus emulation program. Host-based access control +is implemented, as is as the ability to communicate with XPA servers +across a network. + +

+XPA implements a layered interface that is designed to be useful both +to software developers and to users. The interface consists of a +library of XPA client and server routines for use in C/C++ programs and +a suite of high-level user programs built on top of these libraries. +Using the XPA library, access points can be added to Tcl/Tk programs, +Xt programs, or to Unix programs that use the XPA event loop or any +event loop based on select(). Client access subroutines can be added +to any Tcl/Tk, Xt, or Unix program. Client access also is supported at +the command line via a suite of high-level programs. + +

+Choose from the following topics: + +

+ + + +
Last updated: September 10, 2003
+ + diff --git a/doc/html2man b/doc/html2man new file mode 100755 index 0000000..4e60799 --- /dev/null +++ b/doc/html2man @@ -0,0 +1,258 @@ +#!/usr/bin/perl +# +# See COPYRIGHT +# +# Script to generate a pod file from an html source (the same one as for text files too) +# and later this pod file it passed through pod2man +# +# Use: +# html2man [ [] ] is the directory where the man pages will be created +# (current directory by default). If a file name is given instead of +# directory then the directory of that file is used. +# is the directory containing the ttf2pt1 files version.h +# and CHANGES.html which are used to generate the release name and date +# for the man page (by default looks in current directory and then in up to +# 5 ancestor directories). +# If the version files can not be found then the release defaults to +# "current" and the date defaults to today. +# +# Special formatting in the html file is: +# All controls are hidden within HTML comments that must occupy a whole separate line +# Such a line looks like: +# +# +# Any sort of directive must be followed by a space. The pod directives are +# automatically surrounded by empty lines in the output file. +# The html2man directives are: +# +# +# Define a man page. Multiple man pages can be defined in the same HTML +# file. is a short name by which this man page will be referred in the +# other directives. is the name of the man page, and
is the +# section of the manual (do not confuse with sections within a man page). +# +# +# All the text following this directive is copied (with translation) +# into the specified section of the specified man page. The sections +# may appear in arbitrary order, they will be rearranged to the standard +# order before output. Only standard section names are permitted (see @stdsect +# below). The pod directives which occur outside of man sections are ignored, +# just like the common text. The translation of HTML tags is: +# +#
- to paragraph break +# - to B<> +# - to I<> +# - to C<> +# - to F<> +#
    ,
  • ,
- to =over 2, =item *, =back +#  , &, <, > - to their symbols, appropriately encoded +# +# The rest of HTML tags is removed +# +# If the same section is started more than once, the text from the +# second appearance will be added to the first, etc. +# +# +# Stop copying text to the man page. +# +# +# Continue copying text to the man page, same section as before. +# +# +# Insert this into the man page (works only when copying is enabled). +# Characters <, >, & are converted as usual. + +@mons = qw(January February March April May June July August September October November December); + +$dir = $ARGV[0]; +$maindir = $ARGV[1]; + +if($dir eq "") { + $dir = "."; +} elsif( ! -d $dir ) { + if( ! ($dir =~ s|\/[^/]*$||) ) { + $dir = "."; + } +} +if($maindir eq "") { + $maindir = "."; + for($i=0; $i<5; $i++) { + if(-f "$maindir/version.h") { + last; + } + $maindir = "../$maindir"; + } +} + +if( open(VERFILE, "<$maindir/version.h") ) { + while() { + if( /^\s*\#define\s+TTF2PT1_VERSION\s+\"(.*)\"/ ) { + $release = "version $1"; + } + } + close(VERFILE); + if( $release =~ /SNAP-([0-9][0-9])([0-9][0-9])([0-9][0-9])/ ) { + $date = sprintf("%s %d, 20%02d", $mons[$2-1], $3, $1); + } elsif( open(CFILE, "<$maindir/CHANGES.html") ) { + while() { + if( /\/) { + last; + } + } + $_ = ; + chomp; + if( $_ =~ s/^.*?-- // ) { + $date = $_; + } + close(CFILE); + } +} + +if($release eq "") { + if( open(VERFILE, "<../Makefile") ) { + while() { + if( /^VERSION\s+=\s+(.*)/ ) { + $release = "version $1"; + } + } + close(VERFILE); + } +} + +if($release eq "") { + $release = "current"; +} +if($date eq "") { + @lt = localtime(time); + $date = sprintf("%s %d, %d", $mons[$lt[4]], $lt[3], 1900+$lt[5]); +} + +#printf(STDERR "date=%s release=%s\n", $date, $release); + +$writemode = 0; + +while() { + if( s/^\<\!\-\- \=(\S+)\s+//) { + $cmd = $1; + s/\s*\-\-\>\s*$//; + #printf(STDERR "cmd=%s args=%s\n", $cmd, $_); + if($cmd =~ /^=/) { + if($writemode) { + $text{$tosect} .= "\n\n$cmd $_\n\n"; + } + } elsif($cmd eq "defdoc") { + @sl = split; + push(@allids, $sl[0]); + $file{$sl[0]} = $sl[1]; + $mansect{$sl[0]} = $sl[2]; + } elsif($cmd eq "section") { + # tosect includes the file id + $tosect = $_; + $text{$tosect} .= "\n\n"; + $writemode = 1; + } elsif($cmd eq "stop") { + $writemode = 0; + $text{$tosect} .= "\n"; + } elsif($cmd eq "cont") { + $writemode = 1; + } elsif($cmd eq "text") { + if($writemode) { + s/\<\;//gi; + s/\&\;/\&/gi; + $text{$tosect} .= "$_\n"; + } + } + } elsif($writemode) { +# s/^\s+//; + + s/\{/\&lbr;/g; + s/\}/\&rbr;/g; + + s/\/\n\n/gi; + #s/\/\n\n=over 4\n\n/gi; + #s/\<\/blockquote\>/\n\n=back\n\n/gi; + s/\/\n\n=over 4\n\n/gi; + s/\<\/ul\>/\n\n=back\n\n/gi; + s/\\s*/\n\n=item \*\n\n/gi; + + s/\/\n\n=over 4\n\n/gi; + s/\<\/dl\>/\n\n=back\n\n/gi; + s/\\s*/\n\n=item \*\n\n/gi; + s/\\s*/\n\n/gi; + + s/\(.*?)\<\/i\>/I\{\1\}/gi; + s/\(.*?)\<\/em\>/I\{\1\}/gi; + s/\(.*?)\<\/b\>/B\{\1\}/gi; + s/\(.*?)\<\/tt\>/C\{\1\}/gi; + s/\
(.*?)\<\/a\>/F\{\1\}/gi; + s/\summary\<\/h2\>//gi; + s/\description\<\/h2\>//gi; + s/\examples\<\/h2\>//gi; + s/\options\<\/h2\>//gi; + s/\(.*?)\<\/h2\>/B\{\1\}/gi; + s/\<.*?\>//g; + s/\{/\/g; + + s/\ \;/S< >/gi; + s/\&\;/\&/gi; +# s/\<\;/E/gi; +# s/\>\;/E/gi; + s/\<\;/\/gi; + #s/\|/E/g; + #s/\//E/g; + s/\&lbr\;/\{/g; + s/\&rbr\;/\}/g; + + #printf(STDERR "section=%s add=%s", $tosect, $_); + $text{$tosect} .= $_; + } +} + +@stdsect = ( + "NAME", + "SYNOPSIS", + "OPTIONS", + "DESCRIPTION", + "RETURN VALUE", + "ERRORS", + "EXAMPLES", + "ENVIRONMENT", + "FILES", + "SEE ALSO", + "NOTES", + "CAVEATS", + "DIAGNOSTICS", + "BUGS", + "RESTRICTIONS", + "AUTHOR", + "HISTORY" ); + +#printf(STDERR "allids= @allids\n"); +for $id (@allids) { + print(STDERR "creating man page $id $file{$id} $mansect{$id}\n\n"); + die "Unable to create pod file $dir/$file{$id}.pod" + unless open(PODF, ">./pod/$file{$id}.pod"); + print(PODF "=pod\n\n"); + for $sect (@stdsect) { + $sid = "$id $sect"; + #printf(STDERR "trying %s\n", $sid); + if(defined $text{$sid}) { + #printf(STDERR " section %s\n", $sid); + print(PODF "=head1 $sect\n\n$text{$sid}\n\n"); + } + } + print(PODF "=cut\n"); + close(PODF); + die "Unable to generate the man page $dir/$file{$id}.1" + if system("pod2man --section=\"$mansect{$id}\" --release=\"$release\" " + . "--center=\"SAORD Documentation\" --date=\"$date\" " + . "--name=\"$file{$id}\" " + . "./pod/$file{$id}.pod > $dir/man$mansect{$id}/$file{$id}.$mansect{$id}"); + + unlink("$dir/$file{$id}.pod"); +} diff --git a/doc/html2ps.dbg b/doc/html2ps.dbg new file mode 100644 index 0000000..2c7bc86 --- /dev/null +++ b/doc/html2ps.dbg @@ -0,0 +1,94 @@ +***** html2ps version 1.0 beta5 +***** Command: /proj/rd/linux64/bin/html2ps -C fb -d -g -n -u -W b -x 1 -o xpa.ps help.html +***** Perl: 5.010001 +***** HTML2PSPATH= +***** Global file /proj/rd/linux64/lib/html2ps/html2psrc: +/* Global configuration file for html2ps */ + +@html2ps { + package { + ImageMagick: 1; + djpeg: 1; + TeX: 1; + dvips: 1; + Ghostscript: 1; + libwww-perl: 1; + path: "/usr/bin"; + } + paper { + type: letter; + } + hyphenation { + en { + file: "/proj/rd/linux64/lib/html2ps/hyphen.tex"; + } + } +} +***** +html2ps version 1.0 beta5 +Reading help.html +Link: intro.html +Link: template.html +Link: info.html +Link: method.html +Link: inet.html +Link: users.html +Link: programs.html +Link: xpamb.html +Link: xpans.html +Link: server.html +Link: oom.html +Link: client.html +Link: xt.html +Link: tcl.html +Link: env.html +Link: acl.html +Link: changelog.html +Link: examples.html +Link: changes.html +Link: convert.html +Link: name.html +At least 21 documents remaining +Reading intro.html +At least 20 documents remaining +Reading template.html +At least 19 documents remaining +Reading info.html +At least 18 documents remaining +Reading method.html +At least 17 documents remaining +Reading inet.html +At least 16 documents remaining +Reading users.html +At least 15 documents remaining +Reading programs.html +At least 14 documents remaining +Reading xpamb.html +At least 13 documents remaining +Reading xpans.html +At least 12 documents remaining +Reading server.html +At least 11 documents remaining +Reading oom.html +At least 10 documents remaining +Reading client.html +At least 9 documents remaining +Reading xt.html +At least 8 documents remaining +Reading tcl.html +At least 7 documents remaining +Reading env.html +At least 6 documents remaining +Reading acl.html +At least 5 documents remaining +Reading changelog.html +At least 4 documents remaining +Reading examples.html +At least 3 documents remaining +Reading changes.html +At least 2 documents remaining +Reading convert.html +At least 1 document remaining +Reading name.html +Inserting cross references + diff --git a/doc/inet.html b/doc/inet.html new file mode 100644 index 0000000..3155885 --- /dev/null +++ b/doc/inet.html @@ -0,0 +1,260 @@ + + + +XPA Communication Between Hosts + + + + +

XPAInet: XPA Communication Between Hosts

+ + +

Summary

+XPA uses standard inet sockets to support communication between two or +more host computers. + + +

Description

+

+When the Communication Method is set to +inet (as it is by default), XPA can be used to communicate +between different computers on the Internet. INET sockets utilize the +IP address of the given machine and a (usually random) port number to +communicate between processes on the same machine or between different +machines on the Internet. These standard Internet sockets are also +used by programs such as Netscape, ftp. etc. + +

+XPA supports a host-based Access Control mechanism +to prevent unauthorized access of XPA access points by other computers +on the Net. By default, only the machine on which the XPA server is +running can access XPA services. Therefore, setting up communication +between a local XPA server machine and a remote client machine +requires a two-part registration process: + +

    +
  • the XPA service on the local machine must be made known to the +remote machine +
  • the remote machine must be given permission to access the local +XPA service +
+ +Three methods by which this remote registration can be accomplished +are described below. + +

Manual Registration

+ +The first method is the most basic and does not require the remote +client to have xpans running. To use it, the local server simply +gives a remote client machine access to one or more XPA access points +using xpaset and the -acl sub-command. For example, +consider the XPA test program "stest" running on a local machine. By +default the access control for the access point named "xpa" is +restricted to that machine: +
+  [sh]$ xpaget xpa -acl
+  *:* 123.456.78.910 gisa
+  *:* localhost gisa
+
+Using xpaset and the -acl sub-command, a remote client +machine can be given permission to perform xpaget, xpaset, xpaaccess, +or xpainfo operations. For example, to allow the xpaget operation, the +following command can be issued on the local machine: +
+  [sh]$ xpaset -p xpa -acl "remote_machine g"
+
+This results in the following access permissions on the local machine: +
+  [sh]$ xpaget xpa -acl
+  XPA:xpa 234.567.89.012 g
+  *:* 123.456.78.910 gisa
+  *:* localhost gisa
+
+ +The remote client can now use the local server's xpans name server to +establish communication with the local XPA service. This can be done +on a call-by-call basis using the -i switch on xpaset, xpaget, etc: +
+  [sh]$ xpaget -i "local_machine:12345" xpa
+  class: XPA
+  name: xpa
+  method: 88877766:2778
+  sendian: little
+  cendian: big
+
+Alternatively, the XPA_NSINET variable on the remote machine can be +set to point directly to xpans on the local machine, removing +the need to override this value each time an XPA program is run: +
+  [csh]$ setenv XPA_NSINET 'karapet:$port'
+  [csh]$ xpaget xpa
+  class: XPA
+  name: xpa
+  method: 88877766:2778
+  sendian: little
+  cendian: big
+
+Here, '$port' means to use the default XPA name service port (14285). +not a port environment variable. + +

+Access permission for remote client machines can be stored in a file +on the local machine pointed to by the XPA_ACLFILE environment +variable or using the XPA_DEFACL environment variable. See XPA Access Control for more information. + +

Remote Registration

+ +If xpans is running on the remote client machine, then a local xpaset +command can be used with the -remote sub-command to +register the local XPA service in the remote name service, while at +the same time giving the remote machine permission to access the local +service. For example, assume again that "stest" is running on the +local machine and that xpans is also running on the remote machine. +To register access of this local xpa on the remote machine, use +the xpaset and the -remote sub-command: +
+  [sh]$ ./xpaset -p xpa -remote 'remote_machine:$port' +
+
+To register the local xpa access point on the remote machine with xpaget +access only, execute: +
+  [sh]$ ./xpaset -p xpa -remote 'remote_machine:$port' g
+
+Once the remote registration command is executed, the remote client +machine will have an entry such as the following in its own xpans name +service: +
+  [csh]$ xpaget xpans
+  XPA xpa gs 88877766:2839 eric
+
+The xpa access point can now be utilized on the remote machine without +further setup: +
+  [csh]$ xpaget xpa
+  class: XPA
+  name: xpa
+  method: 838e2f68:2839
+  sendian: little
+  cendian: big
+
+To unregister remote access from the local machine, use the same +command but with a '-' argument: +
+  [sh]$ xpaset -p xpa -remote 'remote_machine:$port' -
+
+The benefit of using remote registration is that communication with +remote access points can be mixed with that of other access points +on the remote machine. Using Access Point +Names and Templates, one XPA command can be used to send or +receive messages to the remote and local services. + +

XPANS Proxy Registration

+ +The two methods described above are useful when the local and remote +machines are able to communicate freely to one another. This would be +the case on most Local Area Networks (LANs) where all machines are +behind the same firewall and there is no port blocking between +machines on the same LAN. The situation is more complicated when the +XPA server is behind a firewall, where outgoing connections are +allowed, but incoming port blocking is implemented to prevent machines +outside the firewall from connecting to machines inside the +firewall. Such incoming port blocking will prevent xpaset and xpaget +from connecting to an XPA server inside a firewall. + +

+To allow locally fire-walled XPA services to register with remote +machines, we have implemented a proxy service within the xpans name +server. To register remote proxy service, xpaset and the +-remote sub-command is again used, but with an additional +-proxy argument added to the end of the command: +

+  [sh]$ ./xpaset -p xpa -remote 'remote_machine:$port' g -proxy
+
+Once a remote proxy registration command is executed, the remote +machine will have an entry such as the following in its own xpans name +service: +
+  [csh]$ xpaget xpans
+  XPA xpa gs @88877766:2839 eric
+
+The '@' sign in the name service entry indicates that xpans proxy +processing is being used for this access point. Other than that, from +the user's point of view, there is no difference in how this XPA +access point is contacted using XPA programs (xpaset, xpaget, etc.) or +libraries: +
+  [csh]$ xpaget xpa
+  class: XPA
+  name: xpa
+  method: 88877766:3053
+  sendian: little
+  cendian: big
+
+

+Of course, the underlying processing of the XPA requests is very much +different when xpans proxy is involved. Instead of an XPA program such +contacting the XPA service directly, it contacts the local xpans. +Acting as a proxy server, xpans communicates with the XPA service +using the command channel established at registration time. Commands +(including establishing a new data channel) are sent between xpans and +the XPA service to set up a new message transfer, and then data is fed +to/from the xpa request, through xpans, from/to the XPA service. In +this way, it can be arranged so that connections between the +fire-walled XPA service and the remote client are always initiated by +the XPA service itself. Thus, incoming connections that would be +blocked by the firewall are avoided. Note that there is a performance +penalty for using the xpans/proxy service. Aside from extra overhead +to set up proxy communication, all data must be sent through the +intermediate proxy process. + +

+The xpans proxy scheme requires that the remote client allow the local +XPA server machine to connect to the remote xpans/proxy server. If the +remote client machine also is behind a port-blocking firewall, such +connections will be disallowed. In this case, the only solution is to +open up some ports on the remote client machine to allow incoming +connections to xpans/proxy. Two ports must be opened (for command and +data channel connections). By default, these two ports are 14285 and +14287. The port numbers can be changed using the XPA_NSINET +environment variable. This variable takes the form: +

+  setenv XPA_NSINET machine:port1[,port2[,port3]]
+
+where port1 is the main connecting port, port2 is the XPA access port, +and port3 is the secondary data connecting port. The second and third +ports are optional and default to port1+1 and port1+2, respectively. +It is port1 and port3 that must be left open for incoming connections. + +

+For example, to change the port assignments so that xpans listens +for registration commands on port 12345 and data commands on port 28573: +

+  setenv XPA_NSINET myhost:12345
+
+Alternatively, all three ports can be assigned explicitly: +
+  setenv XPA_NSINET remote:12345,3000,12346
+
+In this case 12345 and 12346 should be open for incoming connections. +The XPA access port (which need not be open to the outside +world) is set to 3000. + +

+Finally, note that we currently have no mechanism to cope with +Internet proxy servers (such as SOCKS servers). If an XPA service is +running on a machine that cannot connect directly to outside machines, +but goes through a proxy server instead, there currently is no way to +register that XPA service with a remote machine. We hope to implement +support for SOCKS proxy in a future release. + + + + + +

+Go to XPA Help Index + +

Last updated: September 10, 2003
+ + diff --git a/doc/info.html b/doc/info.html new file mode 100644 index 0000000..75837bd --- /dev/null +++ b/doc/info.html @@ -0,0 +1,193 @@ + + + +Getting Common Information About Access Points + + + + +

XPACommon: Getting Common Information About Access Points

+ + +

Summary

+

+There are various kinds of generic information you can retrieve about +an XPA access point by using the xpaget command. + + +

Description

+

+You can find out which XPA access points have been registered with +the currently running +XPA name server +by executing the +xpaget +command to retrieve info from the XPA name server: +

+  xpaget xpans
+
+If, for example, the +stest test server program +is running, the following XPA access points will be returned (the specifics +of the returned info will vary for different machines and users): +
+  XPA xpa gs 838e2f67:1262 eric
+  XPA xpa1 gs 838e2f67:1266 eric
+  XPA c_xpa gs 838e2f67:1267 eric
+  XPA i_xpa i 838e2f67:1268 eric
+
+Note that access to this information is subject to the usual +XPA Access Control restrictions. + +

+Each XPA access point supports a number of reserved sub-commands that provide +access to different kinds of information, e.g. the access control for +that access point. These sub-commands can be executed by using +xpaset +or +xpaget +at the command line, or +XPAGet() +or +XPASet() +in programs, e.g: +

+  xpaget ds9 -acl
+  xpaget ds9 -help
+  xpaget ds9 env FOO
+
+  xpaset -p ds9 env FOO foofoo
+
+With the exception of -help and -version, reserved +sub-commands are available only on the machine on which the XPA server +itself is running. + +The following reserved sub-commands are defined for all access points: +
+ +

+

-acl get (set) the access control list [options: host type acl, for set] +
+The 'xpaset' option allows you to add a new acl for a given host, or change +the acl for an existing host. See +XPA Access Control +for more information. +This access point is available only on the server machine. + +

+

-env get (set) an environment variable [options: name (value, for set)] +
+The 'xpaget' option will return the value of the named environment +variable. The 'xpaset' option will set the value of the names +variable to the specified value. +This access point is available only on the server machine. +(Please be advised that we have had problems setting environment +variables in static Tcl/Tk programs such as ds9 running under Linux.) + +

+

-clipboard set(get) information on a named clipboard +
Clients can store ASCII state information on any number of named +clipboards. Clipboards of the same name created by clients on +different machines are kept separate. The syntax for creating a +clipboard is: +
+  [data] | xpaset [server] -clipboard add|append [clipboard_name]
+  xpaset -p [server] -clipboard delete [clipboard_name]
+
+Use "add" to create a new clipboard or replace the contents of an existing +one. Use "append" to append to an existing clipboard. +

+Information on a named clipboard is retrieved using: +

+  xpaget [server] -clipboard [clipboard_name]
+
+

+

-exec set: execute commands from buffer [options: none] +
+If -exec is specified in the paramlist of an 'xpaset' call, then further +sub-commands will be retrieved from the data buffer. + +

+

-help get: return help string for this XPA or sub-command [options: name (for sub-commands)] +
+Each XPA access point and each XPA sub-command can have a help string +associated with it that is specified when the access point is defined. +The -help option will return this help string. For XPA access points +that contain user-defined sub-commands, you can get the help string +for a particular sub-command by specifying its name, or else get the +help strings for all sub-commands if not name is specified. + +

+

-ltimeout get (set) the long timeout value [options: seconds|reset] +
+The 'xpaget' option will return the value of the long timeout (in seconds). +The 'xpaset' option will set the value of the long timeout. If "reset" is +specified, then the timeout value will be reset to the default value. + +

+

-nsconnect set: re-establish name server connection to all XPA's [options: none] +
+If the +XPA Name Server (xpans) +process has terminated unexpectedly and then re-started, this +sub-command can be used to re-establish the connection. You use it by +sending the command to the [name:port] or [file] of the access point +instead of to the XPA name (since the latter requires the xpans +connection!): +
+  xpaset -p 838e2f67:1268 -nsconnect
+
+See xpans for more information. + +

+

-nsdisconnect set: break name server connection to all XPA's [options: none] +
+This sub-command will terminate the connection to the +XPA Name Server (xpans), thereby making +all access points inaccessible except through their underlying [name:port] +or [file] identifiers. I forget why we added it, it seems pretty useless. + +

+

-stimeout get (set) the short timeout value [options: seconds|reset] +
+The 'xpaget' option will return the value of the short timeout (in seconds). +The 'xpaset' option will set the value of the short timeout. If "reset" is +specified, then the timeout value will be reset to the default value. + +

+

-remote set: register xpa with remote server [options: host[:port] [acl]] [-proxy] +
+This sub-command will register the XPA access point with the XPA name +server (xpans) on the specified host (which must already be running). +The specified host also is given access control to the access point, +using the specified acl or the default acl of "+" (meaning the remote +host can xpaset, xpaget, xpainfo or xpaaccess). If the acl is +specified as "-", then the access point is unregistered. +See Communication Between Machines +for more information on how this sub-command is used. + +

+

-version get: return XPA version string [options: none] +
+The version refers to the version of XPA used to define this access point +(currently something like 2.0). + +
+ +

+You can add your own reserved commands to all XPA access points by using the +XPACmdAdd() +routine, passing the XPA handle returned by XPA XPAGetReserved(void) +as the first argument. Note again that these will only be available on the +machine where the XPA service is running. + + + + + +

+Go to XPA Help Index + +

Last updated: September 10, 2003
+ + diff --git a/doc/intro.html b/doc/intro.html new file mode 100644 index 0000000..f9c9947 --- /dev/null +++ b/doc/intro.html @@ -0,0 +1,148 @@ + + + +Introduction to XPA + + + + +

XPAIntro: Introduction to the XPA Messaging System

+ + +

Summary

+

+A brief introduction to the XPA messaging system, which provides +seamless communication between all kinds of Unix event-driven +programs, including X programs, Tcl/Tk programs, and Perl programs. + + +

Description

+

+The XPA messaging system provides seamless communication between all +kinds of Unix programs, including X programs, Tcl/Tk programs, and +Perl programs. It also provides an easy way for users to communicate +with these XPA-enabled programs by executing XPA client commands in +the shell or by utilizing such commands in scripts. Because XPA works +both at the programming level and the shell level, it is a powerful +tool for unifying any analysis environment: users and programmers have +great flexibility in choosing the best level or levels at which to +access XPA services, and client access can be extended or modified +easily at any time. + +

+A program becomes an XPA-enabled server by defining named points of +public access through which data and commands can be exchanged with +other client programs (and users). Using standard TCP sockets as +a transport mechanism, XPA supports both single-point and broadcast +messaging to and from these servers. It supports direct communication +between clients and servers, or indirect communication via an +intermediate message bus emulation program. Host-based access control +is implemented, as is as the ability to communicate with XPA servers +across a network. + +

+XPA implements a layered interface that is designed to be useful both +to software developers and to users. The interface consists of a +library of XPA client and server routines for use in programs and a +suite of high-level user programs built on top of these libraries. +Using the XPA library, access points can be added to +Tcl/Tk +programs, +Xt +programs, or to Unix programs that use the XPA event loop or any +event loop based on select(). Client access subroutines can be added +to any Tcl/Tk or Unix program. Client access also is supported at the +command line via a suite of high-level programs. + +

+The major components of the XPA layered interface are: +

    +
  • +A set of XPA server routines, centered on +XPANew(), +which are used by XPA server programs to tag public access points with +string identifiers and to register send and receive callbacks for +these access points. + +
  • +A set of XPA client routines, centered on the +XPASet() +and +XPAGet(), +which are used by external client applications to exchange data and +commands with an XPA server. + +
  • +High-level programs, centered on +xpaset +and +xpaget, +which allow data +and information to be exchanged with XPA server programs from the +command line and from scripts. These programs have the command syntax: +
    +  [data] | xpaset  [qualifiers ...]
    +           xpaget  [qualifiers ...]
    +
    +
  • +An XPA name server program, +xpans, +through which XPA access point names are +registered by servers and distributed to clients. +
+ +

+Defining an XPA access point is easy: a server application calls +XPANew(), +XPACmdNew(), +or the experimental +XPAInfoNew() +routine to +create a named public access point. An XPA service can specify "send" +and "receive" callback procedures (or an "info" procedure in the case +of XPAInfoNew()) to be executed by the program when an external +process either sends data or commands to this access point or requests +data or information from this access point. Either of the callbacks +can be omitted, so that a particular access point can be specified as +read-only, read-write, or write-only. Application-specific client +data can be associated with these callbacks. Having defined one or +more public access points in this way, an XPA server program enters +its usual event loop (or uses the standard XPA event loop). + +

+Clients communicate with these XPA public access points +using programs such as +xpaget, +xpaset, and +xpainfo +(at the command line), +or routines such as +XPAGet(), +XPASet(), +and +XPAInfo() +within a program. Both methods require specification of the name of +the access point. The xpaget program returns data or other +information from an XPA server to its standard output, while the +xpaset program sends data or commands from its standard input to an +XPA application. The corresponding API routines set/get data to/from +memory, returning error messages and other info as needed. If a +template +is used to specify the access point name (e.g., "ds9*"), then +communication will take place with all servers matching that template. + +

+Please note that XPA currently is not thread-safe. All XPA calls must be +in the same thread. + + + + + +

+Go to XPA Help Index + +

Last updated: March 10, 2007
+ + + diff --git a/doc/method.html b/doc/method.html new file mode 100644 index 0000000..d85fc89 --- /dev/null +++ b/doc/method.html @@ -0,0 +1,90 @@ + + + +XPA Communication Methods + + + + +

XPAMethod: XPA Communication Methods

+ + +

Summary

+

+XPA supports both inet and unix (local) socket communication. + + +

Description

+

+XPA uses sockets for communication between processes. It supports +three methods of socket communication: inet, localhost, and unix. In +general, the same method should be employed for all XPA processes in a +session and the global environment variable XPA_METHOD should be used +to set up the desired method. By default, the preferred method is +"inet", which is appropriate for most users. You can set up a +different method by typing something like: +

+  setenv XPA_METHOD local              # unix csh
+  XPA_METHOD=local; export XPA_METHOD  # unix sh, bash, windows/cygwin
+  set XPA_METHOD=localhost             # dos/windows
+
+The options for XPA_METHOD are: inet, unix (or +local), and localhost. On Unix machines, this +environment setup command can be placed in your shell init file +(.cshrc, .profile, .bashrc, etc.) On Windows platforms, it can be +placed in your AUTOEXEC.BAT file (I think!). + +

+By default, inet sockets are used by XPA. These are the standard +Internet sockets that are used by programs such as Netscape, +ftp. etc. Inet sockets utilize the IP address of the given machine and +a (usually random) port number to communicate between processes on the +same machine or between different machines on the Internet. (Note that +XPA has an Access Control mechanism to +prevent unauthorized access of XPA access points by other computers on +the Net). For users connected to the Internet, this usually is the +appropriate communication method. For more information about setting +up XPA communication between machines, see +Communication Between Machines. + +

+In you are using XPA on a machine without an Internet connection, then +inet sockets are not appropriate. In fact, an XPA process often will +hang for many seconds while waiting for a response from the Domain +Name Service (DNS) when using inet sockets. Instead of inet sockets, +users on Unix platforms can also use unix sockets (also known +as local sockets). These sockets are based on the local file system +and do not make use of the DNS. They generally are considered to be +faster than inet sockets, but they are not implemented under +Windows. Use local sockets as a first resort if you are on a Unix +machine that is not connected to the Internet. + +

+Users not connected to the Internet also can use localhost +sockets. These are also inet-type sockets but the IP address used for +the local machine is the localhost address, 0x7F000001, instead +of the real IP of the machine. Depending on how sockets are set up for +a given platform, communication with the DNS usually is not required in +this case (though of course, XPA cannot interact with other machines). +The localhost method will generally work on both Unix and Windows +platforms, but whether the DNS is required or not is subject to +individual configurations. + +

+A final warning/reminder: if your XPA-enabled server hangs at startup +time and your XPA_METHOD is inet, the problem probably is +related to an incorrect Internet configuration. This can be confirmed +by using the unix method or (usually) the localhost +method. You can use these alternate methods if other hosts do not need +access to the XPA server. + + + + + +

+Go to XPA Help Index + +

Last updated: September 10, 2003
+ + diff --git a/doc/name.html b/doc/name.html new file mode 100644 index 0000000..5269378 --- /dev/null +++ b/doc/name.html @@ -0,0 +1,48 @@ + + + +What does XPA stand for? + + + + +

XPAName: What does XPA stand for?

+ + +

Summary

+

+What does XPA stand for? Who knows anymore! + + +

Description

+

+What does XPA stand for? Dunno! The XPA messaging system originally +was built on top of the X Window System and XPA was the mnemonic for +X Public Access, to emphasize that we were providing public +access to previously private data and algorithms in Xt programs. Now +that XPA no longer is tied to X, it can be argued that we ought to +change the name (how about SPAM: simple public access mechanism +), but XPA is in wide-spread use in the astronomical community of +its birth, and the name has taken on a life of its own. If anyone can +think of what XPA now means, please let us know. + +

+If you think this is bad, consider the MMT Telescope on Mount Hopkins, +Arizona. When first installed twenty years ago, it featured an array +of six 72-inch diameter mirrors. from which came its name: the +Multiple Mirror Telescope. In spring of 1999, these mirrors +were replaced by a single 21 and 1/2 -foot diameter primary mirror, +the largest single-piece glass reflector on the North American +continent. And now MMT stands for ... MMT! + + + + + +

+Go to XPA Help Index + +

Last updated: September 10, 2003
+ + + diff --git a/doc/oom.html b/doc/oom.html new file mode 100644 index 0000000..360740e --- /dev/null +++ b/doc/oom.html @@ -0,0 +1,52 @@ + + + +Out of Memory + + + + +

Xpaoom: What happens when XPA runs out of memory?

+ + +

Summary

+

+When XPA can't allocate memory, it exits. You can arrange to have it call +longjmp() instead. + + +

Description

+

+When an XPA server or client cannot allocate memory, it will attempt to +output an error message and then exit. If this is not satisfactory (e.g., +perhaps your program is interactive and can recover from OOM errors), you +can tell XPA to call longjmp() to go to a recovery branch. To pass the +requisite jmp_buf variable to XPA, make the following call: +

+  XPASaveJmp(void *env);
+
+The value of env is the address of a jmp_buf variable that was previously +passed to setjmp(). For example: +
+  jmp_buf env;
+  ...
+  if( setjmp(jmp_buf) != 0 ){
+    /* out of memory -- take corrective action, if possible */
+  } else {
+    /* save env for XPA */
+    XPASaveJmp((void *)&jmp_buf);
+  }
+  // enter main loop ...
+
+ + + + + +

+Go to XPA Help Index + +

Last updated: April 7, 2009
+ + + diff --git a/doc/pod/xpa.pod b/doc/pod/xpa.pod new file mode 100644 index 0000000..7787d4b --- /dev/null +++ b/doc/pod/xpa.pod @@ -0,0 +1,399 @@ +=pod + +=head1 NAME + + + +B + + + +=head1 SYNOPSIS + + + + +This document is the Table of Contents for XPA. + + + +=head1 DESCRIPTION + + + + + +The XPA messaging system provides seamless communication between many +kinds of Unix programs, including X programs and Tcl/Tk programs. It +also provides an easy way for users to communicate with XPA-enabled +programs by executing XPA client commands in the shell or by utilizing +such commands in scripts. Because XPA works both at the programming +level and the shell level, it is a powerful tool for unifying any +analysis environment: users and programmers have great flexibility in +choosing the best level or levels at which to access XPA services, and +client access can be extended or modified easily at any time. + + +A program becomes an XPA-enabled server by defining named points of +public access through which data and commands can be exchanged with +other client programs (and users). Using standard TCP sockets as a +transport mechanism, XPA supports both single-point and broadcast +messaging to and from these servers. It supports direct communication +between clients and servers, or indirect communication via an +intermediate message bus emulation program. Host-based access control +is implemented, as is as the ability to communicate with XPA servers +across a network. + + +XPA implements a layered interface that is designed to be useful both +to software developers and to users. The interface consists of a +library of XPA client and server routines for use in C/C++ programs and +a suite of high-level user programs built on top of these libraries. +Using the XPA library, access points can be added to Tcl/Tk programs, +Xt programs, or to Unix programs that use the XPA event loop or any +event loop based on select(). Client access subroutines can be added +to any Tcl/Tk, Xt, or Unix program. Client access also is supported at +the command line via a suite of high-level programs. + + +Choose from the following topics: + + + +=over 4 + + + + +=item * + +Introduction to XPA +[xpaintro(n)] + + +=item * + +Access Point Names and Templates +[xpatemplate(n)] + + +=item * + +Getting Common Information About Access Points +[xpacommon(n)] + + +=item * + +Communication Methods +[xpamethod(n)] + + +=item * + +Communication Between Hosts +[xpainet(n)] + + +=item * + +Distinguishing Users +[xpausers(n)] + + + +=item * + +XPA User Programs + + +=over 4 + + + + +=item * + +xpaget: get data and info +[xpaget(1)] + + +=item * + +xpaset: send data and info +[xpaset(1)] + + +=item * + +xpainfo: send info alert +[xpainfo(1)] + + +=item * + +xpaaccess: get access point info +[xpaaccess(1)] + + +=item * + +xpamb: message bus emulation +[xpamb(1)] + + +=item * + +xpans: the XPA name server +[xpans(1)] + + +=back + + + + + +=item * + +XPA Server Routines + + +=over 4 + + + + +=item * + +XPANew: define a new access point +[xpanew(3)] + + +=item * + +XPACmdNew: define a new command access point +[xpacmdnew(3)] + + +=item * + +XPACmdAdd: add a command +[xpacmdadd(3)] + + +=item * + +XPACmdDel: delete a command +[xpacmddel(3)] + + +=item * + +XPAInfoNew: define an info access point +[xpainfonew(3)] + + +=item * + +XPAFree: free an access point +[xpafree(3)] + + +=item * + +XPAMainLoop: event loop for select server +[xpamainloop(3)] + + +=item * + +XPAPoll: poll for XPA events +[xpapoll(3)] + + +=item * + +XPACleanup: release reserved XPA memory +[xpacleanup(3)] + + +=item * + +XPA Server Macros: accessing structure internals +[xpamacros(3)] + + +=item * + +XPA Race Conditions: how to avoid them +[xparace(3)] + + +=item * + +XPA Out of Memory (OOM) errors +[xpaoom(3)] + + +=back + + + + + +=item * + +XPA Client Routines + + +=over 4 + + + + +=item * + +XPAOpen: open a persistent client connection +[xpaopen(3)] + + +=item * + +XPAClose: close persistent client connection +[xpaclose(3)] + + +=item * + +XPAGet: get data +[xpaget(3)] + + +=item * + +XPASet: send data or commands +[xpaset(3)] + + +=item * + +XPAInfo: send an info alert +[xpainfo(3)] + + +=item * + +XPAGetFd: get data and write to an fd +[xpagetfd(3)] + + +=item * + +XPASetFd: read data from and fd and send +[xpasetfd(3)] + + +=item * + +XPANSLookup: look up an access point +[xpanslookup(3)] + + +=item * + +XPAAccess: get access info +[xpaaccess(3)] + + +=item * + +The XPA/Xt Interface: Xt interface to XPA +[xpaxt(n)] + + +=item * + +The XPA/Tcl Interface: Tcl interface to XPA +[xpatcl(n)] + + +=back + + + + + +=item * + +Tailoring the XPA Environment + + +=over 4 + + + + +=item * + +Environment Variables +[xpaenv(n)] + + +=item * + +Access Control +[xpaacl(n)] + + +=back + + + + + +=item * + +Miscellaneous + + +=over 4 + + + + + +=item * + +Where to Find Example/Test Code + + +=item * + +User Changes Between XPA 1.0 and 2.0 + + +=item * + +API Changes Between XPA 1.0 and 2.0 + + +=item * + +What Does XPA Stand For, Anyway? + + +=back + + + + + +=back + + + + + + +=cut diff --git a/doc/pod/xpaaccess.pod b/doc/pod/xpaaccess.pod new file mode 100644 index 0000000..ab34b9b --- /dev/null +++ b/doc/pod/xpaaccess.pod @@ -0,0 +1,102 @@ +=pod + +=head1 NAME + + + +B + + + +=head1 SYNOPSIS + + + + + +xpaaccess [-c] [-h] [-i nsinet] [-m method] [-n] [-t sval,lval] [-u users] -v