diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2016-10-27 17:38:41 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2016-10-27 17:38:41 (GMT) |
commit | 5b44fb0d6530c4ff66a446afb69933aa8ffd014f (patch) | |
tree | e059f66d1f612e21fe9d83f9620c8715530353ec /funtools/fitsy | |
parent | da2e3d212171bbe64c1af39114fd067308656990 (diff) | |
parent | 23c7930d27fe11c4655e1291a07a821dbbaba78d (diff) | |
download | blt-5b44fb0d6530c4ff66a446afb69933aa8ffd014f.zip blt-5b44fb0d6530c4ff66a446afb69933aa8ffd014f.tar.gz blt-5b44fb0d6530c4ff66a446afb69933aa8ffd014f.tar.bz2 |
Merge commit '23c7930d27fe11c4655e1291a07a821dbbaba78d' as 'funtools'
Diffstat (limited to 'funtools/fitsy')
87 files changed, 19075 insertions, 0 deletions
diff --git a/funtools/fitsy/Imakefile b/funtools/fitsy/Imakefile new file mode 100644 index 0000000..52727ba --- /dev/null +++ b/funtools/fitsy/Imakefile @@ -0,0 +1,54 @@ +XCOMM Makefile for fitsy library + +#include "../config/Imake.rules" + +LBINDIR = `$(TOP)/pathname $(TOP)/bin` +LMANDIR = $(TOP)/man +LLIBDIR = $(TOP)/lib + +INCLUDES= -I. + +SRCS= cardpar.c \ + cardfmt.c \ + cardins.c \ + cardfind.c \ + headget.c \ + headset.c \ + headins.c \ + headinit.c \ + headdata.c \ + headfind.c \ + headfile.c \ + headimage.c \ + headtable.c \ + dataimage.c \ + fitshead.c \ + fitsimage.c \ + ftacht.c \ + nd.c + +OBJS= cardpar.o \ + cardfmt.o \ + cardins.o \ + cardfind.o \ + headget.o \ + headset.o \ + headins.o \ + headinit.o \ + headdata.o \ + headfind.o \ + headfile.o \ + headimage.o \ + headtable.o \ + dataimage.o \ + fitshead.o \ + fitsimage.o \ + ftacht.o \ + nd.o + +NormalLibraryObjectRule() +NormalLibraryTarget(fitsy,$(OBJS)) + +DependTarget() +LintTarget() + diff --git a/funtools/fitsy/Makefile.in b/funtools/fitsy/Makefile.in new file mode 100644 index 0000000..5504778 --- /dev/null +++ b/funtools/fitsy/Makefile.in @@ -0,0 +1,240 @@ +# Makefile for library files used by GNU text utilities. +# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +SHELL = /bin/sh + +srcdir = @srcdir@ +VPATH = @srcdir@ + +# 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, .so, and .o files: +LIB_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/lib + +# Directory in which to install the programs: +BIN_INSTALL_DIR = $(INSTALL_ROOT)$(exec_prefix)/bin + +# Directory in which to install the include files: +INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(prefix)/include + +# 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 = ./install-sh -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 + +CC = @CC@ +#CC = gcc -fPIC -Wall -Wno-comment +#CC = gcc -fbounds-checking -DBOUNDS_CHECKING +AR = ar +RANLIB = @RANLIB@ +#DEFS = -DCONFIG_BROKETS @DEFS@ +DEFS = @DEFS@ +#CFLAGS = -g +# CFLAGS = @CFLAGS@ +#CFLAGS = -ansi -pedantic -Wimplicit -Wreturn-type -Wunused -Wformat -Wuninitialized -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Werror +CFLAGS = @CFLAGS@ +LDFLAGS = @LDFLAGS@ +YACC = @YACC@ + +# extra libs +EXTRA_LIBS = @EXTRA_LIBS@ + +# extra objs (usually set to $ZOBJS) +EXTRA_OBJS = @EXTRA_OBJS@ + +# the full set of libraries for linking +LIBS = $(EXTRA_LIBS) + +OBJECTS=cardpar.o \ + cardfmt.o \ + cardins.o \ + cardfind.o \ + headget.o \ + headset.o \ + headins.o \ + headinit.o \ + headdata.o \ + headfind.o \ + headfile.o \ + headimage.o \ + headtable.o \ + headsimple.o \ + headwcs.o \ + inverse.o \ + dataimage.o \ + fitshead.o \ + fitsimage.o \ + ftacht.o \ + ftacht2.o \ + nd.o \ + tableheader.o \ + $(EXTRA_OBJS) + +# comment this out to use default defintions for stand-alone compile +XFILE = -DUSE_XFILEIO=1 -I../util + +INCL = $(XFILE) -I$(srcdir) + +# the default library for this package +DEFLIB = @DEFLIB@ +# the actual library we are building (if this is a subpackage) +LIB = @LIB@ + +all: $(LIB) + +progs: $(PROGS) + +All: $(LIB) $(PROGS) + +.c.o: + $(CC) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) $< + +$(LIB): $(OBJECTS) + $(AR) cruv $@ $(OBJECTS) + $(RANLIB) $@ + +objects:$(OBJECTS) + +fitsy: Force + $(MAKE) clean + $(MAKE) objects XFILE="" + $(MAKE) libfitsy.a + +libfitsy.a : Force + $(AR) cruv $@ $(OBJECTS) + $(RANLIB) $@ + + +# these are the zlib routines: +adler32.o: $(ZDIR)/adler32.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/adler32.c +compress.o: $(ZDIR)/compress.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/compress.c +crc32.o: $(ZDIR)/crc32.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/crc32.c +gzio.o: $(ZDIR)/gzio.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/gzio.c +uncompr.o: $(ZDIR)/uncompr.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/uncompr.c +deflate.o: $(ZDIR)/deflate.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/deflate.c +trees.o: $(ZDIR)/trees.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/trees.c +zutil.o: $(ZDIR)/zutil.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/zutil.c +inflate.o: $(ZDIR)/inflate.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/inflate.c +infblock.o: $(ZDIR)/infblock.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/infblock.c +inftrees.o: $(ZDIR)/inftrees.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/inftrees.c +infcodes.o: $(ZDIR)/infcodes.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/infcodes.c +infutil.o: $(ZDIR)/infutil.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/infutil.c +inffast.o: $(ZDIR)/inffast.c + $(CC) -I$(ZDIR) -c $(CPPFLAGS) $(DEFS) $(INCL) $(CFLAGS) \ + $(ZDIR)/inffast.c + +install: install-binaries + +install-binaries: $(LIB) + @for i in $(LIB_INSTALL_DIR) $(INCLUDE_INSTALL_DIR) ; \ + do \ + if [ ! -d $$i ] ; then \ + echo "Making directory $$i"; \ + mkdir $$i; \ + chmod 755 $$i; \ + else true; \ + fi; \ + done; + @if [ "$(LIB)" = "$(DEFLIB)" ] ; then \ + XLIB=`basename $(LIB)`; \ + echo "Installing $$XLIB"; \ + $(INSTALL_DATA) $$XLIB $(LIB_INSTALL_DIR)/$$XLIB; \ + (cd $(LIB_INSTALL_DIR); $(RANLIB) $$XLIB); \ + chmod 555 $(LIB_INSTALL_DIR)/$$XLIB; \ + fi; + @echo "Installing fitsy.h" + @$(INSTALL_DATA) fitsy.h $(INCLUDE_INSTALL_DIR)/fitsy.h + @echo "Installing xfile.h" + @$(INSTALL_DATA) xfile.h $(INCLUDE_INSTALL_DIR)/xfile.h +# @for i in $(PROGS) ; \ +# do \ +# if [ -f $$i ] ; then \ +# echo "Installing $$i" ; \ +# $(INSTALL_PROGRAM) $$i $(BIN_INSTALL_DIR)/$$i ; \ +# fi; \ +# done; + +uninstall: + +TAGS: $(SOURCES) + etags $(SOURCES) + +check: + +RM = rm -f + +clean: + $(RM) *.a *.so *.o *.exe core errs *pure* .nfs* \ + foo* *~ *.log \#* TAGS *.E a.out errors \ + $(ZDIR)/*.o \ + $(PROGS) $(TESTPROGS) \ + gmon.out *.pg *.bak \ + config.info config.log \ + doc/*~ + $(RM) -r autom4te.cache + +mostlyclean: clean + +distclean: clean + $(RM) Makefile config.cache config.status config.log + +realclean: distclean + $(RM) TAGS + diff --git a/funtools/fitsy/ac_c_long_long.m4 b/funtools/fitsy/ac_c_long_long.m4 new file mode 100644 index 0000000..fb6df1e --- /dev/null +++ b/funtools/fitsy/ac_c_long_long.m4 @@ -0,0 +1,36 @@ +##### http://autoconf-archive.cryp.to/ac_c_long_long.html +# +# SYNOPSIS +# +# AC_C_LONG_LONG +# +# DESCRIPTION +# +# Provides a test for the existance of the long long int type and +# defines HAVE_LONG_LONG if it is found. +# +# LAST MODIFICATION +# +# 2006-10-30 +# +# COPYLEFT +# +# Copyright (c) 2006 Caolan McNamara <caolan@skynet.ie> +# +# Copying and distribution of this file, with or without +# modification, are permitted in any medium without royalty provided +# the copyright notice and this notice are preserved. + +AC_DEFUN([AC_C_LONG_LONG], +[AC_CACHE_CHECK(for long long int, ac_cv_c_long_long, +[if test "$GCC" = yes; then + ac_cv_c_long_long=yes + else + AC_TRY_COMPILE(,[long long int i;], + ac_cv_c_long_long=yes, + ac_cv_c_long_long=no) + fi]) + if test $ac_cv_c_long_long = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, [compiler understands long long]) + fi +]) diff --git a/funtools/fitsy/aclocal.m4 b/funtools/fitsy/aclocal.m4 new file mode 100644 index 0000000..65f68be --- /dev/null +++ b/funtools/fitsy/aclocal.m4 @@ -0,0 +1 @@ +builtin(include,ac_c_long_long.m4) diff --git a/funtools/fitsy/cardfind.c b/funtools/fitsy/cardfind.c new file mode 100644 index 0000000..999d143 --- /dev/null +++ b/funtools/fitsy/cardfind.c @@ -0,0 +1,201 @@ +/* Fitsy FITS card find routines. + + DESCRIPTION + + Routines to find FITS cards in a FITS headers data structure. + + EXAMPLES ++ + + /-* Declair some fitsy types. + *-/ + #FITSHead fits; + #FITSCard foo; + #FITSCard goo; + #FITSBuff key; + + /-* Look up a card using sequential search. + *-/ + #ft_cardkey(key, "FOO"); + foo = #ft_cardfind(fits, key, 0); + + /-* This is the same thing. But the card is added to the header + if it isn't found. This will also invalidate the index if + there is one. + *-/ + #ft_cardkey(key, "FOO"); + foo = #ft_cardfind(fits, key, 1); + + /-* Now index the header so that searches are faster. #ft_cardfind + will automatically use the index if its valid. + *-/ + #ft_index(fits); + #ft_cardkey(key, "GOO", 0); + goo = #ft_cardfind(fits, key, 0); ++ + */ + +#include "fitsy.h" + +int ft_compare(a, b) + char **a; + char **b; + +{ + int ax, bx; + + if ( !strncmp(*a, *b, 5) + && ((*a)[5] != ' ') && ((*b)[5] != ' ') + && (ax = atoi(&(*a)[5])) + && (bx = atoi(&(*b)[5])) ) { + if ( ax < bx ) return -1; + if ( ax == bx ) return 0; + if ( ax > bx ) return 1; + } + + return strncmp(*a, *b, 8); +} + +/* Find a FITS card in the header. + + #cardfind will use the index if is has been created otherwise + it searches sequentially through the header to find the card. + */ +FITSCard ft_cardfind(fits, key, add) + FITSHead fits; /* The FITS header to look in. */ + FITSCard key; /* The card keyword to lookup. */ + int add; /* If add is true the card will + be added to the header if it is + not found. + */ +{ + FITSCard card; + int match; + + if ( fits == NULL ) return NULL; + if ( key == NULL ) return NULL; + + if ( fits->index ) card = ft_cardfindidx(fits, key, &match); + else card = ft_cardfindseq(fits, key, &match); + + if ( !match && add ) + return ft_cardins(fits, key, card); + else return match ? card : NULL; +} + +/* Find a FITS card in the header using an index. + + If the header is not indexed an index is created for it. + */ +FITSCard ft_cardfindidx(fits, key, match) + FITSHead fits; + FITSCard key; + int *match; /* Returns true if the card found is + an exact match for the keyword requested. + */ +{ + FITSCard *base; + int length; + + int lo, hi, cut; + int i; + + if ( fits == NULL ) return NULL; + if ( key == NULL ) return NULL; + + base = fits->index; + length = ft_ncards(fits); + + lo = -1; + hi = length; + cut = length / 2; + + if ( !fits->index ) ft_headindex(fits); + + *match = 0; + while ( hi - lo > 1 ) { + if ( !(i = ft_compare((char **)&key, (char **)&base[cut])) ) { + *match = 1; + return base[cut]; + } + + if ( i < 0 ) { + hi = cut; + cut = (lo + hi) / 2; + } else { + lo = cut; + cut = (lo + hi) / 2; + } + } + + if ( !strncmp(key->c, base[cut]->c, 5) ) + return base[cut]; + + return NULL; +} + +/* Find a card in the FITS header using sequential search. + + If the requested card is a FITS indexed keyword and an exact match + is not found, the last card of that type is returned and + match is set to 0. + */ +FITSCard ft_cardfindseq(fits, key, match) + FITSHead fits; + FITSCard key; + int *match; +{ + FITSCard card; + FITSCard xnear = NULL; + + if ( fits == NULL ) return NULL; + if ( key == NULL ) return NULL; + + *match = 0; + for ( card = fits->cards; card != &fits->cards[fits->ncard]; card++ ) { + if ( !strncmp(key->c, card->c, 8) ) { + *match = 1; + return card; + } + if ( !strncmp(key->c, card->c, 5) + && (isdigit((unsigned int) (*card).c[5]) || (*card).c[5] == ' ' ) + && (isdigit((unsigned int) (*card).c[6]) || (*card).c[6] == ' ' ) + && (isdigit((unsigned int) (*card).c[7]) || (*card).c[7] == ' ' ) ) { + xnear = card; + } + } + + return xnear; +} + +FITSCard ft_cardfindblok(cards, key, match, nhist) + FITSCard cards; + FITSCard key; + int *match; + int *nhist; +{ + FITSCard card; + FITSCard xnear = NULL; + + if ( cards== NULL ) return NULL; + if ( key == NULL ) return NULL; + + *nhist = 0; + *match = 0; + for ( card = cards; card != &cards[FT_CARDS]; card++ ) { + if ( !strncmp(key->c, card->c, 8) ) { + *match = 1; + return card; + } + if ( !strncmp(key->c, card->c, 5) + && (isdigit((unsigned int) (*card).c[5]) || (*card).c[5] == ' ' ) + && (isdigit((unsigned int) (*card).c[6]) || (*card).c[6] == ' ' ) + && (isdigit((unsigned int) (*card).c[7]) || (*card).c[7] == ' ' ) ) { + xnear = card; + } + + if ( !strncmp(key->c, "HISTORY", 7) ) (*nhist)++; + } + + return xnear; +} diff --git a/funtools/fitsy/cardfmt.c b/funtools/fitsy/cardfmt.c new file mode 100644 index 0000000..58d2301 --- /dev/null +++ b/funtools/fitsy/cardfmt.c @@ -0,0 +1,367 @@ +/* Fitsy FITS card set routines. + + EXAMPLES + + Format the keyword part of a card: ++ + + FITSHead fits; + FITSBuff card; + FITSCard here; + + #ft_cardclr(&card, 1); /-* Clear out the card first *-/ + + #ft_cardkey(&card, "RA"); /-* Set the keyword *-/ + #ft_cardsetr(&card, 14.789, 3, "OBS RA"); /-* Set the value of RA. *-/ + + here = #ft_cardapp(fits, &card); /-* Put the new card into a header*-/ + + #ft_cardsetr(here, 15.567, 3, FT_Comment); /-* Set a new value after it's in + the header and reuse the existing + comment *-/ ++ + + Format the value part of a card: ++ + int l = 1; + int i = 15; + double d = 34.7; + char *c = "Shutter"; + + FITSHead fits; + FITSCard card; + + /-* Get a card pointer from the header + *-/ + card = #ft_cardfind(fits, "Keyword", 0); + + #ft_cardsetl(card, l, "A true value"); + #ft_cardseti(card, i, "15 is the number"); + #ft_cardsetr(card, d, 4, "Four digits of precision here"); + + /-* In this example the special pointer #FT_Comment is used to + use the existing comment in the card. + *-/ + #ft_cardsets(card, c, FT_Comment); ++ + */ + +#include <ctype.h> +#include <math.h> +#include "fitsy.h" +#include "xos.h" + +char FT_comment='\0'; +char *FT_Comment = &FT_comment; + + +/* look for blank name */ +int ft_isblank(s) + char *s; +{ + if( !s || !*s ) + return 1; + for(; *s; s++){ + if( *s != ' ' ) + return 0; + } + return 1; +} + +/* Format a FITS card with the supplied values. + */ +FITSCard ft_cardfmt(card, name, n, type, value, prec, comm) + FITSCard card; /* FITS card to format. */ + char *name; /* keyword name. */ + int n; /* keyword index number, if is zero no + index number is appended to the + keyword. + */ + FITSType type; /* type of the card. */ + void *value; /* pointer to the value to format. The + pointer must be of the apropriate type. + */ + int prec; /* If type is FT_REAL the value is formatted + at this precision. Otherwise this parameter + is ignored. + */ + char *comm; /* Comment for the card. */ +{ + int i, j; + int card_len = 30; + FITSBuff comment; + + if ( card == NULL ) return NULL; + + if ( comm == FT_Comment ) { + ft_cardclr((FITSCard) comment.c, 1); + + for ( i = 8; i < FT_CARDLEN && card->c[i] != '/'; i++ ); + i++; + for ( j = 0; i < FT_CARDLEN; i++, j++ ) + comment.c[j] = card->c[i]; + if ( j ) comment.c[j+1] = '\0'; + else comment.c[0] = '\0'; + } + + memset(&(*card).c[8], ' ', FT_CARDLEN-8); + + if ( name ) { + int len = Min(strlen(name), 8); + + memset(&(*card).c[0], ' ', 8); + memcpy(&(*card).c[0], name, len); + + if ( n != 0 ) { + char tbuf[32]; /* Vestigial remains of Eric's fix. */ + snprintf(tbuf, 32, "%d", n); + + memcpy(&(*card).c[len], tbuf, Min((int)strlen(tbuf), 8-len)); + } + /* sense HISTORY AND COMMENT cards */ + if( !n && (ft_isblank(name) || + !strcmp(name, "HISTORY") || + !strcmp(name, "CONTINUE") || + !strcmp(name, "COMMENT")) ) + type = FT_COMMENT; + } + + if ( value ) { + switch ( type ) { + case FT_COMMENT: { + char *v = (char *) value; + + for ( i = 0, j = 8; j < FT_CARDLEN && v[i]; i++, j++ ) { + card->c[j] = v[i]; + } + + goto docomm; + } + + case FT_VALUE: { + char *v = (char *) value; + + card->c[8] = '='; + + for ( i = 0, j = 10; j < FT_CARDLEN && v[i]; i++, j++ ) { + if ( v[i] == '\'' ) { + j--; + continue; + } + + card->c[j] = v[i]; + } + if ( j < 29 ) j = 29; + + card_len = j; + break; + } + + case FT_STRING: { + char *v = (char *) value; + + card->c[8] = '='; + card->c[10] = '\''; + + for ( i = 0, j = 11; j < FT_CARDLEN-1 && v[i]; i++, j++ ) { + if ( v[i] == '\'' ) { + j--; + continue; + } + card->c[j] = v[i]; + } + if ( j < 19 ) j = 19; + + card->c[j++] = '\''; + + card_len = j; + break; + } + + case FT_INTEGER: { + int *v = (int *) value; + + card->c[8] = '='; + sprintf(&card->c[10], "%20d", *v); + card_len = strlen((card->c)); + card->c[card_len] = ' '; + break; + } + + case FT_LONG: { + longlong *v = (longlong *) value; + + card->c[8] = '='; +#if HAVE_LONG_LONG + sprintf(&card->c[10], "%20lld", *v); +#else + sprintf(&card->c[10], "%20ld", *v); +#endif + card_len = strlen((card->c)); + card->c[card_len] = ' '; + break; + } + + case FT_REAL: { + double *v = (double *) value; + + card->c[8] = '='; + /* use e format if the number is too big/small */ + if( Abs(*v) < 0.1 ) + sprintf(&card->c[10], "%#20.*E", prec, *v); + else if( Abs(*v) >= pow(10.0,(double)(20-2-prec)) ) + sprintf(&card->c[10], "%#20.*E", + Min(17,prec+(int)log10(*v)) , *v); + else + sprintf(&card->c[10], "%#20.*f", prec, *v); + card_len = strlen(card->c); + card->c[card_len] = ' '; + break; + } + case FT_LOGICAL: { + int *v = (int *) value; + + card->c[8] = '='; + card->c[29] = *v ? 'T' : 'F'; + card_len = 30; + break; + } + case FT_COMPLEX: break; + case FT_UNKNOWN: break; + } + } + +docomm: + if ( comm != NULL ) { + if ( comm == FT_Comment ) comm = comment.c; + if ( *comm ) { + int comm_len; + + while( *comm == ' ' ) + comm++; + comm_len = strlen(comm); + + if ( card_len + comm_len + 3 > FT_CARDLEN ) { + /* Clip the comment + */ + comm_len = FT_CARDLEN-(card_len + 3); + } + + if ( comm_len <= 0 ) return card; + + /* start as close to col 29 as we can to make it look nice */ + if ( (card_len < 30) && + (card_len + comm_len + 3 < FT_CARDLEN) ) { + int spaces; + spaces = Min(30-card_len,FT_CARDLEN-(card_len+comm_len+3)); + if( spaces > 0 ){ + while( spaces-- ) + card->c[card_len++] = ' '; + } + } + + card->c[card_len+1] = '/'; + card->c[card_len+2] = ' '; + memmove(&(*card).c[card_len+3], comm, comm_len); + } + } + + return card; +} + +/* Format a keyword into a FITS card. + */ +FITSCard ft_cardkey(card, name, n) + FITSCard card; + char *name; + int n; +{ + return ft_cardfmt(card, name, n, FT_UNKNOWN, NULL, 0, NULL); +} + +/* Format a value into a FITS card. + */ +FITSCard ft_cardset(card, type, value, prec, comm) + FITSCard card; + FITSType type; + void *value; + int prec; + char *comm; +{ + return ft_cardfmt(card, NULL, 0, type, value, prec, comm); +} + +/* Format a logical value into a FITS card. + */ +FITSCard ft_cardsetl(card, lvalue, comm) + FITSCard card; + int lvalue; /* Logical to format as a FITS value. */ + char *comm; +{ + return ft_cardfmt (card, NULL, 0, FT_LOGICAL, &lvalue, 0, comm); +} + +/* Format an integer value into a FITS card. + */ +FITSCard ft_cardseti(card, ivalue, comm) + FITSCard card; + int ivalue; /* Integer to format as a FITS value. */ + char *comm; +{ + return ft_cardfmt (card, NULL, 0, FT_INTEGER, &ivalue, 0, comm); +} + +/* Format an 64-bit integer value into a FITS card. + */ +FITSCard ft_cardsetil(card, ivalue, comm) + FITSCard card; + longlong ivalue; /* Integer to format as a FITS value. */ + char *comm; +{ + return ft_cardfmt (card, NULL, 0, FT_LONG, &ivalue, 0, comm); +} + +/* Format a real value into a FITS card. + */ +FITSCard ft_cardsetr(card, rvalue, prec, comm) + FITSCard card; + double rvalue; /* Double to format as a FITS value. */ + int prec; + char *comm; +{ + return ft_cardfmt (card, NULL, 0, FT_REAL , &rvalue, prec, comm); +} + +/* Format a string value into a FITS card. + */ +FITSCard ft_cardsets(card, svalue, comm) + FITSCard card; + char *svalue; /* String to format as a FITS value. */ + char *comm; +{ + return ft_cardfmt (card, NULL, 0, FT_STRING , svalue, 0, comm); +} + +/* Clear FITS cards by writing space into them. + */ +FITSCard ft_cardclr(card, ncards) + FITSCard card; + int ncards; /* Number of 80 character FITS cards to clear */ +{ + if ( card != NULL ) + memset(card, ' ', sizeof(FITSBuff) * ncards); + + return card; +} + +/* Copy a FITS card. + */ +FITSCard ft_cardcpy(card1, card2) + FITSCard card1; /* Destination card */ + FITSCard card2; /* Source card */ +{ + if ( card1 != NULL && card2 != NULL ) + memmove(card1->c, card2->c, sizeof(FITSBuff)); + + return card1; +} diff --git a/funtools/fitsy/cardins.c b/funtools/fitsy/cardins.c new file mode 100644 index 0000000..59ce7a8 --- /dev/null +++ b/funtools/fitsy/cardins.c @@ -0,0 +1,107 @@ +/* Fitsy FITS card insert and delete routines. + + EXAMPLES ++ + FITSCard here; + FITSBuff card; + + #ft_cardkey(&card, "Keyword", 0); + #ft_cardseti(&card, 4, NULL); + + /-* Insert a new card "Keyword" after the 4th card. + *-/ + here = #ft_cardins(fits, &card, #ft_cardnth(4)); + + /-* Append the same card to the header + *-/ + card = #ft_cardapp(fits, &card); + + /-* Delete the first card. + *-/ + #ft_carddel(fits, here); ++ + */ + +#include "xos.h" +#include "fitsy.h" + +/* Insert a #card into a FITS header after #here. + + If #here is NULL #card is inserted before the END card. + + Returns #card; + */ +FITSCard ft_cardins(fits, card, here) + FITSHead fits; /* FITS header. */ + FITSCard card; /* FITS card to insert, append or + delete. */ + FITSCard here; /* Insert #card after #here */ +{ + + if ( fits == NULL ) return NULL; + if ( fits->cards == NULL ) return NULL; + if ( card == NULL ) return NULL; + + if ( fits->index ) (void)Free(fits->index); + + if ( fits->ncard+1 > fits->acard ) { + int hereoffset = 0; + + if ( here != NULL ) hereoffset = here - fits->cards; + + if ( fits->mem != FT_MALLOC ) return NULL; + + fits->acard += FT_CARDS; + /* fits->data = fits->acard * FT_CARDLEN; */ + (void)ReAlloc(fits->cards, sizeof(FITSBuff) * fits->acard + 1); + /* make sure there is a null at the end (EGM) */ + ((char *)fits->cards)[sizeof(FITSBuff) * fits->acard] = '\0'; + + if ( here != NULL ) here = fits->cards + hereoffset; + + ft_cardclr(&fits->cards[fits->acard-FT_CARDS], FT_CARDS); + } + + if ( here == NULL ) here = &fits->cards[fits->ncard-2]; + + memmove(here+2, here+1 + , (&fits->cards[fits->ncard-1]-here) * sizeof(FITSBuff)); + memmove(here+1, card , sizeof(FITSBuff)); + + fits->ncard++; + + return (here+1); +} + +/* Append a card to the end of the FITS header. + + Retuns #card. + */ +FITSCard ft_cardapp(fits, card) + FITSHead fits; + FITSCard card; +{ + return ft_cardins(fits, card, NULL); +} + +/* Delete a card from a FITS header. + + Returns #card which now points the the card after + the one deleted + */ +FITSCard ft_carddel(fits, card) + FITSHead fits; + FITSCard card; +{ + if ( fits == NULL ) return NULL; + if ( card == NULL ) return NULL; + + (void)Free(fits->index); + memmove(card, card+1, (ft_last(fits) - card) * sizeof(FITSBuff)); + ft_cardclr(ft_last(fits), 1); + + fits->ncard--; + + return card; +} + diff --git a/funtools/fitsy/cardpar.c b/funtools/fitsy/cardpar.c new file mode 100644 index 0000000..df45248 --- /dev/null +++ b/funtools/fitsy/cardpar.c @@ -0,0 +1,173 @@ +/* Fitsy FITS card parsing routines. + + DESCRIPTION + These routines parse FITS cards. Usually the header value routines will + be used instead of these. + + EXAMPLES ++ + FITSHead fits; + FITSCard card; + FITSType type; + char value[FT_CARDLEN]; + int index; + char comment[FT_CARDLEN]; + + int im; /-* Is this a primary image? *-/ + + #ft_cardpar(card, &type, value, &index, comm); + + card = #ft_headfind(fits, "SIMPLE", 0, 0); + + im = #ft_cardgetl(card); + */ + +#include "fitsy.h" + +/* Parse a FITS card in to its type, value index and comment parts + + The ft_cardpar will parse an 80 character fits card in memory + into its parts according to the standard. Some non-standard + card formats are recognized. + + Returns + The value parameter. + */ +char *ft_cardpar(card, type, value, index, comm) + FITSCard card; /* FITS card to parse. */ + FITSType *type; /* Returned card type. */ + char *value; /* Returned card value string. */ + int *index; /* Returned index of the card keyword. */ + char *comm; /* Returned card comment. */ +{ + int i=0, j; + + if ( card == NULL ) { + *value = '\0'; + return value; + } + + if ( index ) *index = strtol(&card->c[5], NULL, 0); + + value[0] = '\0'; + + if ( !strncmp(card->c, "HISTORY ", 8) || !strncmp(card->c, "COMMENT ", 8) + || !strncmp(card->c, "CONTINUE ", 9) + || !strncmp(card->c, " ", 8) || (*card).c[8] != '=' ) { + strncpy(value, &(*card).c[8], sizeof(FITSBuff) - 8); + if ( type != NULL ) *type = FT_COMMENT; + } else { + if ( card->c[10] == '\'' ) { + if ( type != NULL ) *type = FT_STRING; + + for ( i = 11, j = 0; i < FT_CARDLEN; i++, j++ ) { + if ( card->c[i] == '\'' ) { + if ( i+1 == FT_CARDLEN || card->c[i+1] != '\'' ) { + break; + } else { + i++; + } + } + + value[j] = card->c[i]; + } + for ( ; j && value[j-1] == ' '; j-- ); + value[j] = '\0'; + } else { + if ( type != NULL ) *type = FT_INTEGER; + + for ( i = 10; i < FT_CARDLEN; i++ ) + if ( card->c[i] != ' ' ) + break; + + if ( ( card->c[i] == 'T' || card->c[i] == 'F' + || card->c[i] == 't' || card->c[i] == 'f' ) + && type != NULL ) *type = FT_LOGICAL; + + for ( j = 0; i < FT_CARDLEN; i++, j++ ) { + if ( card->c[i] == '/' ) break; + if ( card->c[i] == '.' && type != NULL ) *type = FT_REAL; + + value[j] = (*card).c[i]; + } + value[j] = '\0'; + } + } + + if ( comm != NULL ) { + for ( ; i < FT_CARDLEN && card->c[i] != '/' ; i++ ); + i++; + + for ( j = 0; i < FT_CARDLEN; i++, j++ ) + comm[j] = card->c[i]; + comm[j] = '\0'; + } + + return value; +} + +static FITSBuff ft_value; + +/* Return the value of a FITS card in a static buffer. + */ +char *ft_cardget(card) + FITSCard card; +{ + return ft_cardpar(card, NULL, (char *) ft_value.c, NULL, NULL); +} + +/* Return the value of a FITS card as a logical. + */ +int ft_cardgetl(card) + FITSCard card; +{ + char *value = ft_cardget(card); + + return *value == 'T' || *value == 't'; +} + +/* Return the value of a FITS card as an integer. + */ +int ft_cardgeti(card) + FITSCard card; +{ + /* return strtol(ft_cardget(card), NULL, 0); */ + return (int)ft_cardgetr(card); +} + +/* Return the value of a FITS card as an integer. + */ +longlong ft_cardgetil(card) + FITSCard card; +{ + /* return strtol(ft_cardget(card), NULL, 0); */ + return (longlong)ft_cardgetr(card); +} + +/* Return the value of a FITS card as a double. + */ +double ft_cardgetr(card) + FITSCard card; +{ + int i; + char *s = ft_cardget(card); + + /* change final 'D' to 'E' so that strtod() can convert correctly */ + for(i=strlen(s)-1; i>=0; i--){ + if( s[i] == 'D' ){ + s[i] = 'E'; + break; + } + } + return strtod(s, NULL); +} + +/* Return the value of a FITS card as an allocated string. + + The returned string is allocated with strdup(). + */ +char *ft_cardgets(card) + FITSCard card; +{ + return (char *)strdup(ft_cardget(card)); +} diff --git a/funtools/fitsy/compat/install-sh b/funtools/fitsy/compat/install-sh new file mode 100755 index 0000000..ab74c88 --- /dev/null +++ b/funtools/fitsy/compat/install-sh @@ -0,0 +1,238 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/funtools/fitsy/conf.h.in b/funtools/fitsy/conf.h.in new file mode 100644 index 0000000..5f3fa16 --- /dev/null +++ b/funtools/fitsy/conf.h.in @@ -0,0 +1,59 @@ +/* Define as 1 if this compiler supports long long. */ +#undef HAVE_LONG_LONG + +/* Define as 1 if you have string.h */ +#undef HAVE_STRING_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 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/ipc.h */ +#undef HAVE_SYS_IPC_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 Tcl */ +#undef HAVE_TCL + +/* Define as 1 if you have Xt */ +#undef HAVE_XT + +/* 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/funtools/fitsy/config.guess b/funtools/fitsy/config.guess new file mode 100644 index 0000000..44290b8 --- /dev/null +++ b/funtools/fitsy/config.guess @@ -0,0 +1,1435 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2015 Free Software Foundation, Inc. + +timestamp='2015-02-23' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>. +# +# 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. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches to <config-patches@gnu.org>. + + +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 <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2015 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 + +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include <features.h> + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + +# 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 tuples: *-*-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=`(uname -p 2>/dev/null || \ + /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 ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-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*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + 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 + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + 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}${abi}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_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 powerpc-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'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + 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 ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + 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:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-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 <stdio.h> /* 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 <sys/systemcfg.h> + + 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:*:[4567]) + 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/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + 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 <stdlib.h> + #include <unistd.h> + + 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 -q __LP64__ + 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 <unistd.h> + 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:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + *:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-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-${LIBC}`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/[-(].*//'`-${LIBC} + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + 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 -q ld.so.1 + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${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-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-${LIBC} + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + 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.[02]*:*) + 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' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/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 i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-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; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + 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; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; 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.[02]*:*) + 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 <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # 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 ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + 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 ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-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 + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi + 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 ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + 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 ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; +esac + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +and + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> 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/funtools/fitsy/config.sub b/funtools/fitsy/config.sub new file mode 100644 index 0000000..bc855a2 --- /dev/null +++ b/funtools/fitsy/config.sub @@ -0,0 +1,1807 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2015 Free Software Foundation, Inc. + +timestamp='2015-02-22' + +# 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 3 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, see <http://www.gnu.org/licenses/>. +# +# 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. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to <config-patches@gnu.org>. +# +# 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. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# 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 <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2015 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-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + 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 | -microblaze*) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -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*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -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 \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | epiphany \ + | fido | fr30 | frv | ft32 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ + | open8 | or1k | or1knd | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ + | riscv32 | riscv64 \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | 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 \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-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-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | or1k*-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | 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-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | visium-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # 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 + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + 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 + ;; + cr16 | cr16-*) + basic_machine=cr16-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 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + 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*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 + ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; + mingw32) + basic_machine=i686-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + 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 + ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + 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 + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + 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 + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + 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 | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + 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 | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + 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 + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + 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 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + 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 + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + 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 + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-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[24]aeb | 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. + -auroraux) + os=-auroraux + ;; + -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* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -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* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -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* | -toppers* | -drops* | -es* | -tirtos*) + # 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 + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -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 + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + 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 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + 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 + ;; + -cnk*|-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/funtools/fitsy/configure-failsafe b/funtools/fitsy/configure-failsafe new file mode 100755 index 0000000..9a9478b --- /dev/null +++ b/funtools/fitsy/configure-failsafe @@ -0,0 +1,6199 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59 for fitsy 1.0.0. +# +# Report bugs to <saord@cfa.harvard.edu>. +# +# 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='fitsy' +PACKAGE_TARNAME='fitsy' +PACKAGE_VERSION='1.0.0' +PACKAGE_STRING='fitsy 1.0.0' +PACKAGE_BUGREPORT='saord@cfa.harvard.edu' + +ac_unique_file="./fitsy.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#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 RANLIB ac_ct_RANLIB CPP EGREP LIB DEFLIB DOSHARED LLIB USE_DL EXTRA_LIBS EXTRA_OBJS 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 fitsy 1.0.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_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 + +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 fitsy 1.0.0:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-shared build shared libraries + --enable-dl allow use of dynamic loading if available + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-altlib=LIB library name + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + 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 <saord@cfa.harvard.edu>. +_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 +fitsy configure 1.0.0 +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 fitsy $as_me 1.0.0, 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/'` + + + +# +# 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 </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&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 <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* 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 <stdlib.h> +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 + + +echo "$as_me:$LINENO: checking for long long int" >&5 +echo $ECHO_N "checking for long long int... $ECHO_C" >&6 +if test "${ac_cv_c_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$GCC" = yes; then + ac_cv_c_long_long=yes + 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 () +{ +long long int i; + ; + 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_long_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_long_long=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_c_long_long" >&5 +echo "${ECHO_T}$ac_cv_c_long_long" >&6 + if test $ac_cv_c_long_long = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LONG_LONG 1 +_ACEOF + + fi + + +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 + + +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 <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 <limits.h> +#else +# include <assert.h> +#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 <ac_nonexistent.h> +_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 <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> 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 <limits.h> +#else +# include <assert.h> +#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 <ac_nonexistent.h> +_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 <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.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_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 <string.h> + +_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 <stdlib.h> + +_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 <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in 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 saord@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 saord@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 saord@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 saord@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 saord@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 saord@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 saord@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 + +case $host_os in + *cygwin*|*Cygwin* ) + ;; + * ) + +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 saord@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 + + ;; +esac + +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 <sys/socket.h> + +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 +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 <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#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 <limits.h> declares connect. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define connect innocuous_connect + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#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 <limits.h> declares gethostbyname. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define gethostbyname innocuous_gethostbyname + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#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 +# + +DEFLIB="libfitsy.a" +echo "$as_me:$LINENO: checking for alternate target library" >&5 +echo $ECHO_N "checking for alternate target library... $ECHO_C" >&6 + +# Check whether --with-altlib or --without-altlib was given. +if test "${with_altlib+set}" = set; then + withval="$with_altlib" + alt_lib=yes LIB=$withval +else + alt_lib=no LIB=$DEFLIB +fi; +echo "$as_me:$LINENO: result: $alt_lib ($LIB)" >&5 +echo "${ECHO_T}$alt_lib ($LIB)" >&6 + + + +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 + LLIB='$(LIB)' +fi + +echo "$as_me:$LINENO: result: $fun_ok" >&5 +echo "${ECHO_T}$fun_ok" >&6 + +# Check whether --enable-dl or --disable-dl was given. +if test "${enable_dl+set}" = set; then + enableval="$enable_dl" + fun_ok=$enableval +else + fun_ok=no +fi; +if test "$fun_ok" = "yes"; then +echo "$as_me:$LINENO: checking for dynamic loading (with gcc) " >&5 +echo $ECHO_N "checking for dynamic loading (with gcc) ... $ECHO_C" >&6 +if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then + using_dl="yes" + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + have_dl=yes +else + have_dl=no +fi + + if test "$have_dl" = yes; then + USE_DL="-DUSE_DL=1" + fpic="yes" + EXTRA_LIBS="$EXTRA_LIBS -ldl" + if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then + LDFLAGS="$LDFLAGS -rdynamic" + fi + else + echo "$as_me:$LINENO: checking for dlopen in -lc" >&5 +echo $ECHO_N "checking for dlopen in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $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 dlopen (); +int +main () +{ +dlopen (); + ; + 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_c_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_dlopen=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_c_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_c_dlopen" >&6 +if test $ac_cv_lib_c_dlopen = yes; then + have_dl=yes +else + have_dl=no +fi + + if test "$have_dl" = yes; then + USE_DL="-DUSE_DL=1" + fpic="yes" + if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then + LDFLAGS="$LDFLAGS -rdynamic" + fi + else + using_dl="no" + fi + fi +else + using_dl="no" +fi +echo "$as_me:$LINENO: result: $using_dl ($CC)" >&5 +echo "${ECHO_T}$using_dl ($CC)" >&6 +fi + + +echo "$as_me:$LINENO: checking $host_os configuration" >&5 +echo $ECHO_N "checking $host_os configuration... $ECHO_C" >&6 +PRE="" +POST="|\& cat" +case $host_os in + *cygwin*|*Cygwin* ) + +cat >>confdefs.h <<\_ACEOF +#define HAVE_CYGWIN +_ACEOF + + echo "$as_me:$LINENO: result: flagging Cygwin" >&5 +echo "${ECHO_T}flagging Cygwin" >&6 + PRE="sh -c {" + POST="}" + ;; + *mingw32*|*Mingw32*) + CFLAGS="$CFLAGS -mconsole" + EXTRA_LIBS="$EXTRA_LIBS -lwsock32" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MINGW32 +_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 + CFLAGS="$CFLAGS -fno-common" + if test x"$fpic" = x"yes" ; then + CFLAGS="$CFLAGS -fPIC" + echo "$as_me:$LINENO: result: adding -fno-common, -fPIC to CFLAGS" >&5 +echo "${ECHO_T}adding -fno-common, -fPIC to CFLAGS" >&6 + else + echo "$as_me:$LINENO: result: adding -fno-common to CFLAGS" >&5 +echo "${ECHO_T}adding -fno-common to CFLAGS" >&6 + 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" + + +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 fitsy $as_me 1.0.0, 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 <bug-autoconf@gnu.org>." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +fitsy config.status 1.0.0 +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" ;; + "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,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@LIB@,$LIB,;t t +s,@DEFLIB@,$DEFLIB,;t t +s,@DOSHARED@,$DOSHARED,;t t +s,@LLIB@,$LLIB,;t t +s,@USE_DL@,$USE_DL,;t t +s,@EXTRA_LIBS@,$EXTRA_LIBS,;t t +s,@EXTRA_OBJS@,$EXTRA_OBJS,;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 <<CEOF' >>$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 <<CEOF' >>$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/funtools/fitsy/configure.ac b/funtools/fitsy/configure.ac new file mode 100644 index 0000000..2095085 --- /dev/null +++ b/funtools/fitsy/configure.ac @@ -0,0 +1,168 @@ +# 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(fitsy, 1.0.0, saord@cfa.harvard.edu, fitsy) + +AC_CONFIG_HEADERS([conf.h]) +AC_CONFIG_SRCDIR(./fitsy.h) +AC_CANONICAL_HOST + +# +# checks that we use in most projects +# +AC_PROG_CC + +AC_EXEEXT +if test x"${EXEEXT}" = "xno"; then + EXEEXT="" +fi + +AC_C_LONG_LONG + +AC_PROG_RANLIB + +AC_HEADER_STDC +AC_CHECK_HEADERS(malloc.h) +AC_CHECK_HEADERS(getopt.h) +AC_CHECK_HEADERS(values.h) +AC_CHECK_HEADERS(dlfcn.h) +AC_CHECK_HEADERS(sys/un.h) +AC_CHECK_HEADERS(sys/mman.h) +AC_CHECK_HEADERS(sys/ipc.h) +case $host_os in + *cygwin*|*Cygwin* ) + ;; + * ) + AC_CHECK_HEADERS(sys/shm.h) + ;; +esac + +AC_CHECK_TYPES([socklen_t], [], [], [#include <sys/socket.h>]) + +AC_C_CONST + +AC_CHECK_FUNCS(strchr memcpy snprintf) + +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 +# + +DEFLIB="libfitsy.a" +AC_MSG_CHECKING(for alternate target library) +AC_ARG_WITH(altlib, [ --with-altlib=LIB library name], + alt_lib=yes LIB=$withval, alt_lib=no LIB=$DEFLIB) +AC_MSG_RESULT($alt_lib ($LIB)) +AC_SUBST(LIB) +AC_SUBST(DEFLIB) + +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 + LLIB='$(LIB)' +fi +AC_SUBST(LLIB) +AC_MSG_RESULT($fun_ok) + +AC_ARG_ENABLE(dl, [ --enable-dl allow use of dynamic loading if available], + [fun_ok=$enableval], [fun_ok=no]) +if test "$fun_ok" = "yes"; then +AC_MSG_CHECKING([for dynamic loading (with gcc) ]) +if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then + using_dl="yes" + AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no) + if test "$have_dl" = yes; then + USE_DL="-DUSE_DL=1" + fpic="yes" + EXTRA_LIBS="$EXTRA_LIBS -ldl" + if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then + LDFLAGS="$LDFLAGS -rdynamic" + fi + else + AC_CHECK_LIB(c, dlopen, have_dl=yes, have_dl=no) + if test "$have_dl" = yes; then + USE_DL="-DUSE_DL=1" + fpic="yes" + if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then + LDFLAGS="$LDFLAGS -rdynamic" + fi + else + using_dl="no" + fi + fi +else + using_dl="no" +fi +AC_MSG_RESULT([$using_dl ($CC)]) +fi +AC_SUBST(USE_DL) + +AC_MSG_CHECKING([$host_os configuration]) +PRE="" +POST="|\& cat" +case $host_os in + *cygwin*|*Cygwin* ) + AC_DEFINE([HAVE_CYGWIN]) + AC_MSG_RESULT(flagging Cygwin) + PRE="sh -c {" + POST="}" + ;; + *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 + CFLAGS="$CFLAGS -fno-common" + if test x"$fpic" = x"yes" ; then + CFLAGS="$CFLAGS -fPIC" + AC_MSG_RESULT([adding -fno-common, -fPIC to CFLAGS]) + else + AC_MSG_RESULT([adding -fno-common to CFLAGS]) + 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" + 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_SUBST(EXTRA_OBJS) + +AC_CONFIG_FILES(Makefile) + +AC_OUTPUT diff --git a/funtools/fitsy/data b/funtools/fitsy/data new file mode 100644 index 0000000..e2b25d6 --- /dev/null +++ b/funtools/fitsy/data @@ -0,0 +1,95 @@ +cardfind.c: if ( fits->index ) card = ft_cardfindidx(fits, key, &match); +cardfind.c: base = fits->index; +cardfind.c: if ( !fits->index ) ft_headindex(fits); +cardfind.c: for ( card = fits->cards; card != &fits->cards[fits->ncard]; card++ ) { +cardins.c: if ( fits->cards == NULL ) return NULL; +cardins.c: if ( fits->index ) Free(fits->index); +cardins.c: if ( fits->ncard+1 > fits->acard ) { +cardins.c: if ( here != NULL ) hereoffset = here - fits->cards; +cardins.c: if ( fits->mem != FT_MALLOC ) return NULL; +cardins.c: fits->acard += FT_CARDS; +cardins.c: fits->data = fits->acard * FT_CARDLEN; +cardins.c: ReAlloc(fits->cards, sizeof(FITSBuff) * fits->acard + 1); +cardins.c: ((char *)fits->cards)[sizeof(FITSBuff) * fits->acard] = '\0'; +cardins.c: if ( here != NULL ) here = fits->cards + hereoffset; +cardins.c: ft_cardclr(&fits->cards[fits->acard-FT_CARDS], FT_CARDS); +cardins.c: if ( here == NULL ) here = &fits->cards[fits->ncard-2]; +cardins.c: , (&fits->cards[fits->ncard-1]-here) * sizeof(FITSBuff)); +cardins.c: fits->ncard++; +cardins.c: Free(fits->index); +cardins.c: fits->ncard--; +headdata.c: return Seek(sfile, fits->data, 0) != -1; +headfile.c: fits->seek = Tell(file); +headfile.c: memmove(fits->cards, card1, n); +headfile.c: if ( Read(file, (void *)&fits->cards[0].c[n], +headfile.c: Free(fits->cards); +headfile.c: if ( (end = ft_cardfindblok(&fits->cards[(nbloks-1) * FT_CARDS] +headfile.c: fits->ncard += FT_CARDS; +headfile.c: ReAlloc(fits->cards, (nbloks+1) * FT_BLOCK + 1); +headfile.c: ((char *)fits->cards)[(nbloks+1) * FT_BLOCK] = '\0'; +headfile.c: ft_cardclr(&fits->cards[nbloks * FT_CARDS], FT_CARDS); +headfile.c: if ( Read(file, (void *)&fits->cards[nbloks * FT_CARDS], +headfile.c: Free(fits->cards); +headfile.c: fits->data = Tell(file); +headfile.c: fits->ncard = end - fits->cards + 1; +headfile.c: fits->acard = nbloks * FT_CARDS; +headfile.c: if ( fits->sync ) ft_synchead(fits); +headfile.c: Write(file, (void *)fits->cards, +headfile.c: FT_BLOCK, ((fits->ncard+FT_CARDS-1)/FT_CARDS)); +headfile.c: return Seek(file, fits->seek, 0) != -1; +headfile.c: sync = fits->sync; +headfile.c: fits->sync = x; +headfind.c: if ( fits->index ) Free(fits->index); +headfind.c: Malloc(fits->index, sizeof(FITSCard *) * fits->ncard); +headfind.c: for ( i = 0; i < fits->ncard; i++ ) { +headfind.c: fits->index[i] = (FITSCard) &fits->cards[i]; +headfind.c: qsort(fits->index, fits->ncard, sizeof(FITSCard *), ft_compare); +headimage.c: if ( fits->basic ) ft_basicfree(fits->basic); +headimage.c: if ( fits->image ) ft_imagefree(fits->image); +headimage.c: if ( fits->table ) ft_tablefree(fits->table); +headimage.c: fits->basic = ft_basicloadhead(fits); +headimage.c: fits->image = ft_imageloadhead(fits); +headimage.c: fits->table = ft_tableloadhead(fits); +headimage.c: if ( fits->basic ) ft_basicstorhead(fits, fits->basic); +headimage.c: if ( fits->image ) ft_imagestorhead(fits, fits->image); +headimage.c: if ( fits->table ) ft_tablestorhead(fits, fits->table); +headimage.c: if ( fits->basic == NULL ) return NULL; +headimage.c: if ( fits->basic->bitpix > 0 ) +headinit.c: fits->mem = FT_MALLOC; +headinit.c: fits->primary = NULL; +headinit.c: fits->rfcount = 1; +headinit.c: fits->cards = fits->last = cards; +headinit.c: fits->acard = fits->ncard = Abs(bytes/FT_CARDLEN); +headinit.c: if ( bytes > 0 ) fits->mem = FT_EXTERN; +headinit.c: fits->ncard = end - fits->cards + 1; +headinit.c: fits->acard = ((fits->ncard+FT_CARDS-1)/FT_CARDS) * FT_CARDS; +headinit.c: fits->data = fits->acard * FT_CARDLEN; +headinit.c: fits->acard = bytes/FT_CARDLEN ? bytes/FT_CARDLEN : FT_CARDS; +headinit.c: (void)Calloc(fits->cards, sizeof(FITSBuff) * fits->acard + 1); +headinit.c: ((char *)fits->cards)[sizeof(FITSBuff) * fits->acard] = '\0'; +headinit.c: ft_cardclr(fits->cards, fits->acard); +headinit.c: fits->ncard = 0; +headinit.c: fits->data = fits->acard * FT_CARDLEN; +headinit.c: fits->index = NULL; +headinit.c: fits->last = fits->cards; +headinit.c: fits->ncard = 1; +headinit.c: ft_cardkey(fits->cards, "END", 0); +headinit.c: fits->sync = 0; +headinit.c: fits->cache = NULL; +headinit.c: if ( fits->primary ) +headinit.c: ft_primlink(fits->primary, head); +headinit.c: memmove(head->cards, fits->cards, head->acard * FT_CARDLEN); +headinit.c: if( head->index && !fits->index ){ +headinit.c: if ( --fits->rfcount ) return; +headinit.c: if ( fits->index ) Free(fits->index); +headinit.c: if ( fits->basic ) ft_basicfree(fits->basic); +headinit.c: if ( fits->image ) ft_imagefree(fits->image); +headinit.c: if ( fits->table ) ft_tablefree(fits->table); +headinit.c: if ( fits->mem == FT_MALLOC && freecards ) Free(fits->cards); +headinit.c: if ( fits->mem == FT_MMAP ) ft_munmap(fits); +headinit.c: if ( fits->mem == FT_SHMAT ) ft_shmdt(fits); +headinit.c: if ( fits->primary ) ft_headfree(fits->primary, 1); +headinit.c: fits->primary = prim; +headinit.c: fits->cards = (FITSCard) cards; +headtable.c: table->col[i-1].width = fits->basic->naxis[0] - table->col[i-1].offset; +headtable.c: ft_basicstorhead(fits, fits->basic); diff --git a/funtools/fitsy/dataimage.c b/funtools/fitsy/dataimage.c new file mode 100644 index 0000000..e627f84 --- /dev/null +++ b/funtools/fitsy/dataimage.c @@ -0,0 +1,221 @@ +/* Routines to handle FITS image data. + */ + +#include <xos.h> +#include "fitsy.h" + +/* Read data from a file pointer and convert it to the requested type. + */ +void *ft_dataread(file, fits, dataptr, pixtype) + File file; /* File pointer to read data from. */ + FITSHead fits; + void *dataptr; /* Pointer to data buffer to store data. */ + int pixtype; /* Pixtype to convert data to. */ +{ + void *fdata; + void *mdata; + size_t fsize; + size_t msize; + + if ( file == NULL ) return NULL; + if ( fits == NULL ) return NULL; + + if ( pixtype == FT_BITPIX ) + pixtype = ft_bitpix(fits); + + fsize = Abs(ft_bitpix(fits)/8); + msize = pixtype ? (size_t)((Abs(pixtype) & ~FT_UNSIGNED)/8) : fsize; + + if ( dataptr == NULL ) { + Malloc(mdata, ft_fitsbloks(ft_datapixls(fits) * msize) * FT_BLOCK); + if ( mdata == NULL ) { + return NULL; + } + } else + mdata = dataptr; + + + if ( pixtype && msize != fsize ) { + Malloc(fdata, ft_databloks(fits) * FT_BLOCK); + if ( fdata == NULL ) { + if ( mdata && dataptr == NULL ) (void)Free(mdata); + return NULL; + } + } else + fdata = mdata; + + /* Read in enough data but don't show an error in a short data + * block. + */ + if(ftRead(file, fdata, 1, ft_databloks(fits)*FT_BLOCK) < ft_databytes(fits)){ + if ( dataptr == NULL ) { + if ( fdata != mdata ) (void)Free(fdata); + (void)Free(mdata); + } + return NULL; + } + + if ( pixtype ) { + ft_dataswap(fdata, fdata, ft_databytes(fits), ft_bitpix(fits)); + + if ( pixtype != ft_bitpix(fits) + || ft_hasbscale(fits) + || ft_hasbzero(fits) ) { + ft_acht(pixtype, mdata, ft_bitpix(fits), fdata + , ft_datapixls(fits) + , 1 + , ft_hasbscale(fits) || ft_hasbzero(fits) + , ft_bscale(fits) + , ft_bzero(fits)); + } + } + + if ( mdata != fdata ) (void)Free(fdata); + return mdata; +} + + +int ft_datawrite(file, fits, data, pixtype) + File file; + FITSHead fits; + void *data; + int pixtype; +{ + void *fdata; + void *mdata = data; + int fsize; + int msize; + int pad; + char blok[FT_BLOCK]; + + if ( file == NULL ) return 0; + if ( fits == NULL ) return 0; + + if ( pixtype == FT_BITPIX ) + pixtype = ft_bitpix(fits); + + fsize = Abs(ft_bitpix(fits)/8); + msize = pixtype ? (Abs(pixtype) & ~FT_UNSIGNED)/8 : fsize; + + if ( pixtype && msize != fsize ) { + Malloc(fdata, ft_databloks(fits) * FT_BLOCK); + if ( fdata == NULL ) { + return 0; + } + } else + fdata = mdata; + + if ( pixtype ) { + if ( pixtype != ft_bitpix(fits) + || ft_hasbscale(fits) + || ft_hasbzero(fits) ) { + ft_acht(ft_bitpix(fits), fdata, pixtype, mdata + , ft_datapixls(fits) + , 0 + , ft_hasbscale(fits) || ft_hasbzero(fits) + , ft_bscale(fits) + , ft_bzero(fits)); + } + + ft_dataswap(fdata, fdata, ft_databytes(fits), ft_bitpix(fits)); + } + + memset(blok, 0, FT_BLOCK); + + ftWrite(file, fdata, 1, ft_databytes(fits)); + + /* this is how John would do it ... + ftWrite(file, blok , 1, + (FT_BLOCK - ft_databytes(fits) % FT_BLOCK) % FT_BLOCK); + */ + + /* ... and this is Eric's way ... */ + pad = FT_BLOCK - ft_databytes(fits) % FT_BLOCK; + if( pad && (pad != FT_BLOCK) ) + ftWrite(file, blok , 1, pad); + + if ( mdata != fdata ) (void)Free(fdata); + return 1; +} + + +void swap2(to, from, nbytes) + char *to; + char *from; + size_t nbytes; +{ + char c; + size_t i; + for ( i=0; i < nbytes; i += 2, (to += 2), (from += 2) ) { + c = *from; + *(to) = *(from+1); + *(to+1) = c; + } +} + +void swap4(to, from, nbytes) + char *to; + char *from; + size_t nbytes; +{ + char c; + size_t i; + for ( i=0; i < nbytes; i += 4, (to += 4), (from += 4) ) { + c = *from; + *to = *(from+3); + *(to+3) = c; + c = *(from+1); + *(to+1) = *(from+2); + *(to+2) = c; + } +} + +void swap8(to, from, nbytes) + char *to; + char *from; + size_t nbytes; +{ + char c; + size_t i; + for ( i=0; i < nbytes; i += 8, (to += 8), (from += 8) ) { + c = *(from+0); + *(to+0) = *(from+7); + *(to+7) = c; + c = *(from+1); + *(to+1) = *(from+6); + *(to+6) = c; + c = *(from+2); + *(to+2) = *(from+5); + *(to+5) = c; + c = *(from+3); + *(to+3) = *(from+4); + *(to+4) = c; + } +} + +/* Swap n bytes of data if necessary. + */ +void *ft_dataswap(to, from, n, type) + void *to; /* Pointer to data to swap. */ + void *from; /* Pointer to data to swap. */ + size_t n; /* N bytes */ + int type; /* Swap 2, swap 4, swap 8. */ +{ + if ( !from || !to ) return NULL; + if ( !ft_byteswap() ) { + if ( from == to ) return to; + + memcpy(to, from, n); + return to; + } + + if ( type && Abs(type) != 8 ) { + switch ( Abs(type) ) { + case 16: swap2(to, from, n); break; + case 32: swap4(to, from, n); break; + case 64: swap8(to, from, n); break; + } + } + + return to; +} diff --git a/funtools/fitsy/datatable.c b/funtools/fitsy/datatable.c new file mode 100644 index 0000000..9d596ff --- /dev/null +++ b/funtools/fitsy/datatable.c @@ -0,0 +1,15 @@ +/* datatable.c + */ + +ft_tablerecread() +{ + +} + +ft_tablerecwrite() +{ + +} + + + diff --git a/funtools/fitsy/doc/basicval.html b/funtools/fitsy/doc/basicval.html new file mode 100644 index 0000000..d849b10 --- /dev/null +++ b/funtools/fitsy/doc/basicval.html @@ -0,0 +1,77 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<p> +<!-- pnuts --> <a href="headfile.html">[Previous]</a> <a href="imageval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + +<A NAME="section-1.1.1"><H3>Basic FITS Values</H3></A> + + +<P> + When a FITS header is scanned in memory or read from a file several + basic values are retrieved from the header and stored in the <B>FITSHead</B> + or <B>FITSBasic</B> structures. This structure may be accesed with the following + macros: + +<PRE> + #define <B>ft_ncards</B>(fits) ( fits->ncard ) + #define <B>ft_cardnth</B>(fits, nth) ( ( nth <= fits->ncard ) \ + ? &fits->cards[nth-1] \ + : NULL ) + + #define <B>ft_last</B>(fits) ft_cardnth(fits, fits->ncard) + + #define <B>ft_swapped</B>() (*(short *)"001000" & 0x0001) + #define <B>ft_seek</B>(fits) ( fits->seek ) + + typedef struct <B>FITSHead</B> { + FITSCard cards; + FITSCard *index; + FITSCard last; + int acard; + int ncard; + + int mem; + int seek; + int data; + + FITSBasic basic; + FITSImage image; + FITSTable table; + } <B>*FITSHead</B>; + + + #define <B>ft_simple</B>(fits) ( fits->basic->simple ) + #define <B>ft_name</B>(fits) ( fits->basic->name ) + #define <B>ft_bitpix</B>(fits) ( fits->basic->bitpix ) + #define <B>ft_naxes</B>(fits) ( fits->basic->naxes ) + #define <B>ft_naxis</B>(fits, i) ( fits->basic->naxis[i-1]) + #define <B>ft_pcount</B>(fits) ( fits->basic->pcount ) + #define <B>ft_gcount</B>(fits) ( fits->basic->gcount ) + #define <B>ft_databytes</B>(fits) ( fits->basic->databytes) + #define <B>ft_databloks</B>(fits) ( fits->basic->databloks) + + typedef struct <B>FITSBasic</B> { + int simple; + char *name; + + int bitpix; + int naxes; + int *naxis; + + int gcount; + int pcount; + + int databytes; + int databloks; + } <B>*FITSBasic</B>; +<P> +</PRE> + +<p> +<!-- pnuts --> <a href="headfile.html">[Previous]</a> <a href="imageval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/basicval.wu b/funtools/fitsy/doc/basicval.wu new file mode 100644 index 0000000..aba50b9 --- /dev/null +++ b/funtools/fitsy/doc/basicval.wu @@ -0,0 +1,62 @@ + +Basic FITS Values +================= + + When a FITS header is scanned in memory or read from a file several + basic values are retrieved from the header and stored in the #FITSHead + or #FITSBasic structures. This structure may be accesed with the following + macros: + ++ + ##define #ft_ncards(fits) ( fits->ncard ) + ##define #ft_cardnth(fits, nth) ( ( nth <= fits->ncard ) \ + ? &fits->cards[nth-1] \ + : NULL ) + + ##define #ft_last(fits) ft_cardnth(fits, fits->ncard) + + ##define #ft_swapped() (*(short *)"\001\000" & 0x0001) + ##define #ft_seek(fits) ( fits->seek ) + + typedef struct #FITSHead { + FITSCard cards; + FITSCard *index; + FITSCard last; + int acard; + int ncard; + + int mem; + int seek; + int data; + + FITSBasic basic; + FITSImage image; + FITSTable table; + } #"*FITSHead"; + + + ##define #ft_simple(fits) ( fits->basic->simple ) + ##define #ft_name(fits) ( fits->basic->name ) + ##define #ft_bitpix(fits) ( fits->basic->bitpix ) + ##define #ft_naxes(fits) ( fits->basic->naxes ) + ##define #ft_naxis(fits, i) ( fits->basic->naxis[i-1]) + ##define #ft_pcount(fits) ( fits->basic->pcount ) + ##define #ft_gcount(fits) ( fits->basic->gcount ) + ##define #ft_databytes(fits) ( fits->basic->databytes) + ##define #ft_databloks(fits) ( fits->basic->databloks) + + typedef struct #FITSBasic { + int simple; + char *name; + + int bitpix; + int naxes; + int *naxis; + + int gcount; + int pcount; + + int databytes; + int databloks; + } #"*FITSBasic"; ++ diff --git a/funtools/fitsy/doc/cardfind.html b/funtools/fitsy/doc/cardfind.html new file mode 100644 index 0000000..4562c29 --- /dev/null +++ b/funtools/fitsy/doc/cardfind.html @@ -0,0 +1,112 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> cardfind +</TITLE> +<p> +<!-- pnuts --> <a href="cardfmt.html">[Previous]</a> <a href="cardins.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_cardfind,ft_cardfindidx,ft_cardfindseq -Fitsy FITS card find routines. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +FITSCard ft_cardfind(FITSHead fits, FITSCard key, int add); +FITSCard ft_cardfindidx(FITSHead fits, FITSCard key, int *match); +FITSCard ft_cardfindseq(FITSHead fits, FITSCard key, int *match); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>FITSHead fits</B> - The FITS header to look in. + <LI> <B>FITSCard key</B> - The card keyword to lookup. + <LI> <B>int add</B> - If add is true the card will + be added to the header if it is + not found. + <LI> <B>int *match</B> - Returns true if the card found is + an exact match for the keyword requested. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + +<P> + Routines to find FITS cards in a FITS headers data structure. + +<A NAME="section-1.1.4.1"><H4>ft_cardfind</H4></A> + +<P> + Find a FITS card in the header. + +<P> + <B>cardfind</B> will use the index if is has been created otherwise + it searches sequentially through the header to find the card. + +<A NAME="section-1.1.4.2"><H4>ft_cardfindidx</H4></A> + +<P> + Find a FITS card in the header using an index. + +<P> + If the header is not indexed an index is created for it. + +<A NAME="section-1.1.4.3"><H4>ft_cardfindseq</H4></A> + +<P> + Find a card in the FITS header using sequential search. + +<P> + If the requested card is a FITS indexed keyword and an exact match + is not found, the last card of that type is returned and + match is set to 0. + +<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A> + + +<PRE> + + /* Declair some fitsy types. + */ + <B>FITSHead</B> fits; + <B>FITSCard</B> foo; + <B>FITSCard</B> goo; + <B>FITSBuff</B> key; + + /* Look up a card using sequential search. + */ + <B>ft_cardkey</B>(key, "FOO"); + foo = <B>ft_cardfind</B>(fits, key, 0); + + /* This is the same thing. But the card is added to the header + if it isn't found. This will also invalidate the index if + there is one. + */ + <B>ft_cardkey</B>(key, "FOO"); + foo = <B>ft_cardfind</B>(fits, key, 1); + + /* Now index the header so that searches are faster. <B>ft_cardfind</B> + will automatically use the index if its valid. + */ + <B>ft_index</B>(fits); + <B>ft_cardkey</B>(key, "GOO", 0); + goo = <B>ft_cardfind</B>(fits, key, 0); + +<P> +</PRE> + +<p> +<!-- pnuts --> <a href="cardfmt.html">[Previous]</a> <a href="cardins.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/cardfind.wu b/funtools/fitsy/doc/cardfind.wu new file mode 100644 index 0000000..b854c3d --- /dev/null +++ b/funtools/fitsy/doc/cardfind.wu @@ -0,0 +1,85 @@ +Title: cardfind + + +NAME +==== + ft_cardfind,ft_cardfindidx,ft_cardfindseq -Fitsy FITS card find routines. + +SYNOPSIS +======== + + +- +FITSCard ft_cardfind(FITSHead fits, FITSCard key, int add); +FITSCard ft_cardfindidx(FITSHead fits, FITSCard key, int *match); +FITSCard ft_cardfindseq(FITSHead fits, FITSCard key, int *match); + + +- +PARAMETERS +========== + * #"FITSHead fits" - The FITS header to look in. + * #"FITSCard key" - The card keyword to lookup. + * #"int add" - If add is true the card will + be added to the header if it is + not found. + * #"int *match" - Returns true if the card found is + an exact match for the keyword requested. + +DESCRIPTION +=========== + Routines to find FITS cards in a FITS headers data structure. + + ft_cardfind + ----------- + Find a FITS card in the header. + + #cardfind will use the index if is has been created otherwise + it searches sequentially through the header to find the card. + + ft_cardfindidx + -------------- + Find a FITS card in the header using an index. + + If the header is not indexed an index is created for it. + + ft_cardfindseq + -------------- + Find a card in the FITS header using sequential search. + + If the requested card is a FITS indexed keyword and an exact match + is not found, the last card of that type is returned and + match is set to 0. + +EXAMPLES +======== + ++ + + /* Declair some fitsy types. + *-/ + #FITSHead fits; + #FITSCard foo; + #FITSCard goo; + #FITSBuff key; + + /* Look up a card using sequential search. + *-/ + #ft_cardkey(key, "FOO"); + foo = #ft_cardfind(fits, key, 0); + + /* This is the same thing. But the card is added to the header + if it isn't found. This will also invalidate the index if + there is one. + *-/ + #ft_cardkey(key, "FOO"); + foo = #ft_cardfind(fits, key, 1); + + /* Now index the header so that searches are faster. #ft_cardfind + will automatically use the index if its valid. + *-/ + #ft_index(fits); + #ft_cardkey(key, "GOO", 0); + goo = #ft_cardfind(fits, key, 0); + ++ diff --git a/funtools/fitsy/doc/cardfmt.html b/funtools/fitsy/doc/cardfmt.html new file mode 100644 index 0000000..0ab1cd6 --- /dev/null +++ b/funtools/fitsy/doc/cardfmt.html @@ -0,0 +1,181 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> cardfmt +</TITLE> +<p> +<!-- pnuts --> <a href="cardpar.html">[Previous]</a> <a href="cardfind.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_cardfmt,ft_cardkey,ft_cardset,ft_cardsetl,ft_cardseti,ft_cardsetr,ft_cardsets,ft_cardclr,ft_cardcpy +- Fitsy FITS card set routines. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +FITSCard ft_cardfmt(FITSCard card, char *name, int n, FITSType type, void *value, int prec, char *comm); +FITSCard ft_cardkey(FITSCard card, char *name, int n); +FITSCard ft_cardset(FITSCard card, FITSType type, void *value, int prec, char *comm); +FITSCard ft_cardsetl(FITSCard card, int lvalue, char *comm); +FITSCard ft_cardseti(FITSCard card, int ivalue, char *comm); +FITSCard ft_cardsetr(FITSCard card, double rvalue, int prec, char *comm); +FITSCard ft_cardsets(FITSCard card, char *svalue, char *comm); +FITSCard ft_cardclr(FITSCard card, int ncards); +FITSCard ft_cardcpy(FITSCard card1, FITSCard card2); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>FITSCard card</B> - FITS card to format. + <LI> <B>char *name</B> - keyword name. + <LI> <B>int n</B> - keyword index number, if is zero no + index number is appended to the + keyword. + <LI> <B>FITSType type</B> - type of the card. + +<P> + Possible values for a <B>FITSType</B> are as follows: + <UL> +<P> + <LI> <B>FT_COMMENT</B> + <LI> <B>FT_LOGICAL</B> + <LI> <B>FT_INTEGER</B> + <LI> <B>FT_STRING</B> + <LI> <B>FT_VALUE</B> + <LI> <B>FT_REAL</B> + <LI> <B>FT_COMPLEX</B> + + </UL> +<P> + <LI> <B>void *value</B> - pointer to the value to format. The + pointer must be of the apropriate type. + <LI> <B>int prec</B> - If type is FT_REAL the value is formatted + at this precision. Otherwise this parameter + is ignored. + <LI> <B>char *comm</B> - Comment for the card. + <LI> <B>int lvalue</B> - Logical to format as a FITS value. + <LI> <B>int ivalue</B> - Integer to format as a FITS value. + <LI> <B>double rvalue</B> - Double to format as a FITS value. + <LI> <B>char *svalue</B> - String to format as a FITS value. + <LI> <B>int ncards</B> - Number of 80 character FITS cards to clear + <LI> <B>FITSCard card1</B> - Destination card + <LI> <B>FITSCard card2</B> - Source card + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_cardfmt</H4></A> + +<P> + Format a FITS card with the supplied values. + +<A NAME="section-1.1.4.2"><H4>ft_cardkey</H4></A> + +<P> + Format a keyword into a FITS card. + +<A NAME="section-1.1.4.3"><H4>ft_cardset</H4></A> + +<P> + Format a value into a FITS card. + +<A NAME="section-1.1.4.4"><H4>ft_cardsetl</H4></A> + +<P> + Format a logical value into a FITS card. + +<A NAME="section-1.1.4.5"><H4>ft_cardseti</H4></A> + +<P> + Format an integer value into a FITS card. + +<A NAME="section-1.1.4.6"><H4>ft_cardsetr</H4></A> + +<P> + Format a real value into a FITS card. + +<A NAME="section-1.1.4.7"><H4>ft_cardsets</H4></A> + +<P> + Format a string value into a FITS card. + +<A NAME="section-1.1.4.8"><H4>ft_cardclr</H4></A> + +<P> + Clear FITS cards by writing space into them. + +<A NAME="section-1.1.4.9"><H4>ft_cardcpy</H4></A> + +<P> + Copy a FITS card. + +<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A> + +<P> + Format the keyword part of a card: + +<PRE> + + FITSHead fits; + FITSBuff card; + FITSCard here; + + <B>ft_cardclr</B>(&card, 1); /* Clear out the card first */ + + <B>ft_cardkey</B>(&card, "RA"); /* Set the keyword */ + <B>ft_cardsetr</B>(&card, 14.789, 3, "OBS RA"); /* Set the value of RA. */ + + here = <B>ft_cardapp</B>(fits, &card); /* Put the new card into a header*/ + + <B>ft_cardsetr</B>(here, 15.567, 3, FT_Comment); /* Set a new value after it's in + the header and reuse the existing + comment */ + +<P> +</PRE> + +<P> + Format the value part of a card: + +<PRE> + int l = 1; + int i = 15; + double d = 34.7; + char *c = "Shutter"; + + FITSHead fits; + FITSCard card; + + /* Get a card pointer from the header + */ + card = <B>ft_cardfind</B>(fits, "Keyword", 0); + + <B>ft_cardsetl</B>(card, l, "A true value"); + <B>ft_cardseti</B>(card, i, "15 is the number"); + <B>ft_cardsetr</B>(card, d, 4, "Four digits of precision here"); + + /* In this example the special pointer <B>FT_Comment</B> is used to + use the existing comment in the card. + */ + <B>ft_cardsets</B>(card, c, FT_Comment); + +<P> +</PRE> + +<p> +<!-- pnuts --> <a href="cardpar.html">[Previous]</a> <a href="cardfind.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/cardfmt.wu b/funtools/fitsy/doc/cardfmt.wu new file mode 100644 index 0000000..ce072e8 --- /dev/null +++ b/funtools/fitsy/doc/cardfmt.wu @@ -0,0 +1,144 @@ +Title: cardfmt + + +NAME +==== + ft_cardfmt,ft_cardkey,ft_cardset,ft_cardsetl,ft_cardseti,ft_cardsetr,ft_cardsets,ft_cardclr,ft_cardcpy +- Fitsy FITS card set routines. + +SYNOPSIS +======== + + +- +FITSCard ft_cardfmt(FITSCard card, char *name, int n, FITSType type, void *value, int prec, char *comm); +FITSCard ft_cardkey(FITSCard card, char *name, int n); +FITSCard ft_cardset(FITSCard card, FITSType type, void *value, int prec, char *comm); +FITSCard ft_cardsetl(FITSCard card, int lvalue, char *comm); +FITSCard ft_cardseti(FITSCard card, int ivalue, char *comm); +FITSCard ft_cardsetr(FITSCard card, double rvalue, int prec, char *comm); +FITSCard ft_cardsets(FITSCard card, char *svalue, char *comm); +FITSCard ft_cardclr(FITSCard card, int ncards); +FITSCard ft_cardcpy(FITSCard card1, FITSCard card2); + + +- +PARAMETERS +========== + * #"FITSCard card" - FITS card to format. + * #"char *name" - keyword name. + * #"int n" - keyword index number, if is zero no + index number is appended to the + keyword. + * #"FITSType type" - type of the card. + + Possible values for a #FITSType are as follows: + * #"FT_COMMENT" + * #"FT_LOGICAL" + * #"FT_INTEGER" + * #"FT_STRING" + * #"FT_VALUE" + * #"FT_REAL" + * #"FT_COMPLEX" + + * #"void *value" - pointer to the value to format. The + pointer must be of the apropriate type. + * #"int prec" - If type is FT_REAL the value is formatted + at this precision. Otherwise this parameter + is ignored. + * #"char *comm" - Comment for the card. + * #"int lvalue" - Logical to format as a FITS value. + * #"int ivalue" - Integer to format as a FITS value. + * #"double rvalue" - Double to format as a FITS value. + * #"char *svalue" - String to format as a FITS value. + * #"int ncards" - Number of 80 character FITS cards to clear + * #"FITSCard card1" - Destination card + * #"FITSCard card2" - Source card + +DESCRIPTION +=========== + + ft_cardfmt + ---------- + Format a FITS card with the supplied values. + + ft_cardkey + ---------- + Format a keyword into a FITS card. + + ft_cardset + ---------- + Format a value into a FITS card. + + ft_cardsetl + ----------- + Format a logical value into a FITS card. + + ft_cardseti + ----------- + Format an integer value into a FITS card. + + ft_cardsetr + ----------- + Format a real value into a FITS card. + + ft_cardsets + ----------- + Format a string value into a FITS card. + + ft_cardclr + ---------- + Clear FITS cards by writing space into them. + + ft_cardcpy + ---------- + Copy a FITS card. + +EXAMPLES +======== + Format the keyword part of a card: + ++ + + FITSHead fits; + FITSBuff card; + FITSCard here; + + #ft_cardclr(&card, 1); /* Clear out the card first *-/ + + #ft_cardkey(&card, "RA"); /* Set the keyword *-/ + #ft_cardsetr(&card, 14.789, 3, "OBS RA"); /* Set the value of RA. *-/ + + here = #ft_cardapp(fits, &card); /* Put the new card into a header*-/ + + #ft_cardsetr(here, 15.567, 3, FT_Comment); /* Set a new value after it's in + the header and reuse the existing + comment *-/ + ++ + + Format the value part of a card: + ++ + int l = 1; + int i = 15; + double d = 34.7; + char *c = "Shutter"; + + FITSHead fits; + FITSCard card; + + /* Get a card pointer from the header + *-/ + card = #ft_cardfind(fits, "Keyword", 0); + + #ft_cardsetl(card, l, "A true value"); + #ft_cardseti(card, i, "15 is the number"); + #ft_cardsetr(card, d, 4, "Four digits of precision here"); + + /* In this example the special pointer #FT_Comment is used to + use the existing comment in the card. + *-/ + #ft_cardsets(card, c, FT_Comment); + ++ diff --git a/funtools/fitsy/doc/cardins.html b/funtools/fitsy/doc/cardins.html new file mode 100644 index 0000000..26c9acc --- /dev/null +++ b/funtools/fitsy/doc/cardins.html @@ -0,0 +1,99 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> cardins +</TITLE> +<p> +<!-- pnuts --> <a href="cardfind.html">[Previous]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_cardins,ft_cardapp,ft_carddel -Fitsy FITS card insert and delete routines. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +FITSCard ft_cardins(FITSHead fits, FITSCard card, FITSCard here); +FITSCard ft_cardapp(FITSHead fits, FITSCard card); +FITSCard ft_carddel(FITSHead fits, FITSCard card); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>FITSHead fits</B> - FITS header. + <LI> <B>FITSCard card</B> - FITS card to insert, append or + delete. + <LI> <B>FITSCard here</B> - Insert <B>card</B> after <B>here</B> + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_cardins</H4></A> + +<P> + Insert a <B>card</B> into a FITS header after <B>here.</B> + +<P> + If <B>here</B> is NULL <B>card</B> is inserted before the END card. + +<P> + Returns <B>card</B>; + +<A NAME="section-1.1.4.2"><H4>ft_cardapp</H4></A> + +<P> + Append a card to the end of the FITS header. + +<P> + Retuns <B>card.</B> + +<A NAME="section-1.1.4.3"><H4>ft_carddel</H4></A> + +<P> + Delete a card from a FITS header. + +<P> + Returns <B>card</B> which now points the the card after + the one deleted + +<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A> + + +<PRE> + FITSCard here; + FITSBuff card; + + <B>ft_cardkey</B>(&card, "Keyword", 0); + <B>ft_cardseti</B>(&card, 4, NULL); + + /* Insert a new card "Keyword" after the 4th card. + */ + here = <B>ft_cardins</B>(fits, &card, <B>ft_cardnth</B>(4)); + + /* Append the same card to the header + */ + card = <B>ft_cardapp</B>(fits, &card); + + /* Delete the first card. + */ + <B>ft_carddel</B>(fits, here); + +<P> +</PRE> + +<p> +<!-- pnuts --> <a href="cardfind.html">[Previous]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/cardins.wu b/funtools/fitsy/doc/cardins.wu new file mode 100644 index 0000000..26109f9 --- /dev/null +++ b/funtools/fitsy/doc/cardins.wu @@ -0,0 +1,72 @@ +Title: cardins + + +NAME +==== + ft_cardins,ft_cardapp,ft_carddel -Fitsy FITS card insert and delete routines. + +SYNOPSIS +======== + + +- +FITSCard ft_cardins(FITSHead fits, FITSCard card, FITSCard here); +FITSCard ft_cardapp(FITSHead fits, FITSCard card); +FITSCard ft_carddel(FITSHead fits, FITSCard card); + + +- +PARAMETERS +========== + * #"FITSHead fits" - FITS header. + * #"FITSCard card" - FITS card to insert, append or + delete. + * #"FITSCard here" - Insert #card after #here + +DESCRIPTION +=========== + + ft_cardins + ---------- + Insert a #card into a FITS header after #here. + + If #here is NULL #card is inserted before the END card. + + Returns #card; + + ft_cardapp + ---------- + Append a card to the end of the FITS header. + + Retuns #card. + + ft_carddel + ---------- + Delete a card from a FITS header. + + Returns #card which now points the the card after + the one deleted + +EXAMPLES +======== + ++ + FITSCard here; + FITSBuff card; + + #ft_cardkey(&card, "Keyword", 0); + #ft_cardseti(&card, 4, NULL); + + /* Insert a new card "Keyword" after the 4th card. + *-/ + here = #ft_cardins(fits, &card, #ft_cardnth(4)); + + /* Append the same card to the header + *-/ + card = #ft_cardapp(fits, &card); + + /* Delete the first card. + *-/ + #ft_carddel(fits, here); + ++ diff --git a/funtools/fitsy/doc/cardpar.html b/funtools/fitsy/doc/cardpar.html new file mode 100644 index 0000000..9d91fd6 --- /dev/null +++ b/funtools/fitsy/doc/cardpar.html @@ -0,0 +1,134 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> cardpar +</TITLE> +<p> +<!-- pnuts --> <a href="dataimage.html">[Previous]</a> <a href="cardfmt.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_cardpar,ft_cardget,ft_cardgetl,ft_cardgeti,ft_cardgetr,ft_cardgets -Fitsy + FITS card parsing routines. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +char *ft_cardpar(FITSCard card, FITSType *type, char *value, int *index, char *comm); +char *ft_cardget(FITSCard card); +int ft_cardgetl(FITSCard card); +int ft_cardgeti(FITSCard card); +double ft_cardgetr(FITSCard card); +char *ft_cardgets(FITSCard card); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>FITSCard card</B> - FITS card to parse. + <LI> <B>FITSType *type</B> - Returned card type. + +<P> + Possible values for a <B>FITSType</B> are as follows: + <UL> +<P> + <LI> <B>FT_COMMENT</B> + <LI> <B>FT_LOGICAL</B> + <LI> <B>FT_INTEGER</B> + <LI> <B>FT_STRING</B> + <LI> <B>FT_VALUE</B> + <LI> <B>FT_REAL</B> + <LI> <B>FT_COMPLEX</B> + + </UL> +<P> + <LI> <B>char *value</B> - Returned card value string. + <LI> <B>int *index</B> - Returned index of the card keyword. + <LI> <B>char *comm</B> - Returned card comment. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + +<P> + These routines parse FITS cards. Usually the header value routines will + be used instead of these. + +<A NAME="section-1.1.4.1"><H4>ft_cardpar</H4></A> + +<P> + Parse a FITS card in to its type, value index and comment parts + +<P> + The ft_cardpar will parse an 80 character fits card in memory + into its parts according to the standard. Some non-standard + card formats are recognized. + +<A NAME="section-1.1.4.2"><H4>ft_cardget</H4></A> + +<P> + Return the value of a FITS card in a static buffer. + +<A NAME="section-1.1.4.3"><H4>ft_cardgetl</H4></A> + +<P> + Return the value of a FITS card as a logical. + +<A NAME="section-1.1.4.4"><H4>ft_cardgeti</H4></A> + +<P> + Return the value of a FITS card as a integer. + +<A NAME="section-1.1.4.5"><H4>ft_cardgetr</H4></A> + +<P> + Return the value of a FITS card as a double. + +<A NAME="section-1.1.4.6"><H4>ft_cardgets</H4></A> + +<P> + Return the value of a FITS card as a allocated string. + +<P> + The returned string is allocated with strdup(). + +<A NAME="section-1.1.5"><H3>RETURNS</H3></A> + + +<A NAME="section-1.1.5.1"><H4>ft_cardpar</H4></A> + +<P> + The value parameter. +<A NAME="section-1.1.6"><H3>EXAMPLES</H3></A> + + +<PRE> + FITSHead fits; + FITSCard card; + FITSType type; + char value[FT_CARDLEN]; + int index; + char comment[FT_CARDLEN]; + + int im; /* Is this a primary image? */ + + <B>ft_cardpar</B>(card, &type, value, &index, comm); + + card = <B>ft_headfind</B>(fits, "SIMPLE", 0, 0); + + im = <B>ft_cardgetl</B>(card); + +</PRE> +<p> +<!-- pnuts --> <a href="dataimage.html">[Previous]</a> <a href="cardfmt.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/cardpar.wu b/funtools/fitsy/doc/cardpar.wu new file mode 100644 index 0000000..604390b --- /dev/null +++ b/funtools/fitsy/doc/cardpar.wu @@ -0,0 +1,99 @@ +Title: cardpar + + +NAME +==== + ft_cardpar,ft_cardget,ft_cardgetl,ft_cardgeti,ft_cardgetr,ft_cardgets -Fitsy + FITS card parsing routines. + +SYNOPSIS +======== + + +- +char *ft_cardpar(FITSCard card, FITSType *type, char *value, int *index, char *comm); +char *ft_cardget(FITSCard card); +int ft_cardgetl(FITSCard card); +int ft_cardgeti(FITSCard card); +double ft_cardgetr(FITSCard card); +char *ft_cardgets(FITSCard card); + + +- +PARAMETERS +========== + * #"FITSCard card" - FITS card to parse. + * #"FITSType *type" - Returned card type. + + Possible values for a #FITSType are as follows: + * #"FT_COMMENT" + * #"FT_LOGICAL" + * #"FT_INTEGER" + * #"FT_STRING" + * #"FT_VALUE" + * #"FT_REAL" + * #"FT_COMPLEX" + + * #"char *value" - Returned card value string. + * #"int *index" - Returned index of the card keyword. + * #"char *comm" - Returned card comment. + +DESCRIPTION +=========== + These routines parse FITS cards. Usually the header value routines will + be used instead of these. + + ft_cardpar + ---------- + Parse a FITS card in to its type, value index and comment parts + + The ft_cardpar will parse an 80 character fits card in memory + into its parts according to the standard. Some non-standard + card formats are recognized. + + ft_cardget + ---------- + Return the value of a FITS card in a static buffer. + + ft_cardgetl + ----------- + Return the value of a FITS card as a logical. + + ft_cardgeti + ----------- + Return the value of a FITS card as a integer. + + ft_cardgetr + ----------- + Return the value of a FITS card as a double. + + ft_cardgets + ----------- + Return the value of a FITS card as a allocated string. + + The returned string is allocated with strdup(). + +RETURNS +======= + + ft_cardpar + ---------- + The value parameter. +EXAMPLES +======== + ++ + FITSHead fits; + FITSCard card; + FITSType type; + char value[FT_CARDLEN]; + int index; + char comment[FT_CARDLEN]; + + int im; /* Is this a primary image? *-/ + + #ft_cardpar(card, &type, value, &index, comm); + + card = #ft_headfind(fits, "SIMPLE", 0, 0); + + im = #ft_cardgetl(card); diff --git a/funtools/fitsy/doc/dataimage.html b/funtools/fitsy/doc/dataimage.html new file mode 100644 index 0000000..9de21fe --- /dev/null +++ b/funtools/fitsy/doc/dataimage.html @@ -0,0 +1,58 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> dataimage +</TITLE> +<p> +<!-- pnuts --> <a href="headdata.html">[Previous]</a> <a href="cardpar.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_dataread,ft_dataswap -Routines to handle FITS image data. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +void *ft_dataread(File file, FITSHead fits, void *dataptr, int pixtype); +void *ft_dataswap(void *data, int n, int type); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>File file</B> - File pointer to read data from. + <LI> <B>FITSHead fits</B> - Not Documented. + <LI> <B>void *dataptr</B> - Pointer to data buffer to store data. + <LI> <B>int pixtype</B> - Pixtype to convert data to. + <LI> <B>void *data</B> - Pointer to data to swap. + <LI> <B>int n</B> - N bytes + <LI> <B>int type</B> - Swap 2 or swap 4. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_dataread</H4></A> + +<P> + Read data from a file pointer and convert it to the requested type. + +<A NAME="section-1.1.4.2"><H4>ft_dataswap</H4></A> + +<P> + Swap n bytes of data if necessary. + +<p> +<!-- pnuts --> <a href="headdata.html">[Previous]</a> <a href="cardpar.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/dataimage.wu b/funtools/fitsy/doc/dataimage.wu new file mode 100644 index 0000000..67edfe1 --- /dev/null +++ b/funtools/fitsy/doc/dataimage.wu @@ -0,0 +1,37 @@ +Title: dataimage + + +NAME +==== + ft_dataread,ft_dataswap -Routines to handle FITS image data. + +SYNOPSIS +======== + + +- +void *ft_dataread(File file, FITSHead fits, void *dataptr, int pixtype); +void *ft_dataswap(void *data, int n, int type); + + +- +PARAMETERS +========== + * #"File file" - File pointer to read data from. + * #"FITSHead fits" - Not Documented. + * #"void *dataptr" - Pointer to data buffer to store data. + * #"int pixtype" - Pixtype to convert data to. + * #"void *data" - Pointer to data to swap. + * #"int n" - N bytes + * #"int type" - Swap 2 or swap 4. + +DESCRIPTION +=========== + + ft_dataread + ----------- + Read data from a file pointer and convert it to the requested type. + + ft_dataswap + ----------- + Swap n bytes of data if necessary. diff --git a/funtools/fitsy/doc/examples.wu b/funtools/fitsy/doc/examples.wu new file mode 100644 index 0000000..23e8d25 --- /dev/null +++ b/funtools/fitsy/doc/examples.wu @@ -0,0 +1,36 @@ +Here is an example of writing a FITS image. + + header = ft_imagehead(simple, bitpix, naxis, ax1, ax2, ...); + ft_imagewite(file, header, data, bitpix); + + These routines allow access to complete multiextension + FITS files. If bitpix is given as 0 no data will be read + in on the first pass. If bitpix is specified the data + blocks will be read and converted (if images) to the given + type. If the file is not seekable the data will be + buffered in any event. + + FITSFile = ft_fileopen(filenamei, bitpix); + FITSFile = ft_fileread(file, bitpix); + + hdu = ft_filematch(fitsfile, hduname); + + ft_filehduhead(fitsfile, hdu); + ft_filehdudata(fitsfile, hdu); + + ft_filevali(fitsfile, hdu, name, n, &card); + ft_fileseti(fitsfile, hdu, name, n, &card); + ft_fileappi(fitsfile, hdu, name, n); + + data = ft_fileimageread(fitsfile, bitpix); + + data = ft_filetableload(fitsfile) + data = ft_filetablerowload(fitsfile, row); + + Toss in xx_alloc and get 1, 2, 3 dim edges. + Toss in acht and get type changes. + + Add macros for all struct value access + + ft_headblocks(head) + ft_datablocks(head) + diff --git a/funtools/fitsy/doc/fitsimage.html b/funtools/fitsy/doc/fitsimage.html new file mode 100644 index 0000000..934e68a --- /dev/null +++ b/funtools/fitsy/doc/fitsimage.html @@ -0,0 +1,72 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> fitsimage +</TITLE> +<p> +<!-- pnuts --> <a href="fitsy.html">[Previous]</a> <a href="headinit.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_simpleimageread,ft_simpleimagewrite,ft_imageread,ft_imagewrite -Fitsy FITS + routines to read and write FITS images. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +int ft_simpleimageread(char *filename, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype); +int ft_simpleimagewrite(char *filename, FITSHead fits, float *data, int pixtype); +int ft_imageread(File file, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype); +int ft_imagewrite(File file, FITSHead fits, float *data, int pixtype); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>char *filename</B> - FITS image file name. + <LI> <B>FITSHead *headptr</B> - Returned pointer to FITS header + <LI> <B>void **dataptr</B> - Returned pointer to FITS data. + <LI> <B>void ***data2dptr</B> - Returned edge vector to data. + <LI> <B>int pixtype</B> - pixtype to convert data to. + <LI> <B>FITSHead fits</B> - FITS header to write. + <LI> <B>float *data</B> - Data to write into FITS file. + <LI> <B>File file</B> - File pointer to read header and data from. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_simpleimageread</H4></A> + +<P> + Read a FITS image from the named file. + +<A NAME="section-1.1.4.2"><H4>ft_simpleimagewrite</H4></A> + +<P> + Write a FITS image to a named file. + +<A NAME="section-1.1.4.3"><H4>ft_imageread</H4></A> + +<P> + Read a FITS image from a file pointer. + +<A NAME="section-1.1.4.4"><H4>ft_imagewrite</H4></A> + +<P> + Write a FITS image to a file. + +<p> +<!-- pnuts --> <a href="fitsy.html">[Previous]</a> <a href="headinit.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/fitsimage.wu b/funtools/fitsy/doc/fitsimage.wu new file mode 100644 index 0000000..43f6066 --- /dev/null +++ b/funtools/fitsy/doc/fitsimage.wu @@ -0,0 +1,49 @@ +Title: fitsimage + + +NAME +==== + ft_simpleimageread,ft_simpleimagewrite,ft_imageread,ft_imagewrite -Fitsy FITS + routines to read and write FITS images. + +SYNOPSIS +======== + + +- +int ft_simpleimageread(char *filename, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype); +int ft_simpleimagewrite(char *filename, FITSHead fits, float *data, int pixtype); +int ft_imageread(File file, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype); +int ft_imagewrite(File file, FITSHead fits, float *data, int pixtype); + + +- +PARAMETERS +========== + * #"char *filename" - FITS image file name. + * #"FITSHead *headptr" - Returned pointer to FITS header + * #"void **dataptr" - Returned pointer to FITS data. + * #"void ***data2dptr" - Returned edge vector to data. + * #"int pixtype" - pixtype to convert data to. + * #"FITSHead fits" - FITS header to write. + * #"float *data" - Data to write into FITS file. + * #"File file" - File pointer to read header and data from. + +DESCRIPTION +=========== + + ft_simpleimageread + ------------------ + Read a FITS image from the named file. + + ft_simpleimagewrite + ------------------- + Write a FITS image to a named file. + + ft_imageread + ------------ + Read a FITS image from a file pointer. + + ft_imagewrite + ------------- + Write a FITS image to a file. diff --git a/funtools/fitsy/doc/fitsy.html b/funtools/fitsy/doc/fitsy.html new file mode 100644 index 0000000..a4fcb6c --- /dev/null +++ b/funtools/fitsy/doc/fitsy.html @@ -0,0 +1,78 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> Fitsy FITS Library TOC +</TITLE> +<p> +<!-- pnuts --> <a href="../mmtilib.html">[Previous]</a> <a href="fitsimage.html">[Next]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + +<A NAME="section-1.1.1"><H3>Fitsy FITS Routines</H3></A> + + +<UL> +<P> + <LI> Routines to handle complete FITS files. ::fitsfile.html + <LI> <A HREF="fitsimage.html">Routines to handle FITS images.</A> + <LI> <A HREF="fitstable.html">Routines to handle FITS tables.</A> + <LI> Routines to handle FITS headers. + <UL> + <LI> <A HREF="headinit.html">Creating the <B>FITSHead</B> data structure.</A> + <LI> <A HREF="headfile.html">Reading and writing FITS headers.</A> + <LI> Getting basic values in a header. + +<P> + Many of the most basic FITS values are retrieved in when a fits + file is scanned in memory or read from disk. + + <UL> +<P> + <LI> <A HREF="basicval.html">Basic values</A> + <LI> <A HREF="imageval.html">Image values</A> + <LI> <A HREF="tableval.html">Table values</A> + + </UL> +<P> + These data structures are transfered to and from the FITS header + with these routines. + + <UL> +<P> + <LI> <A HREF="headimage.html">Load and store basic and image header values.</A> + <LI> <A HREF="headtable.html">Load and store table header values.</A> + + </UL> +<P> + <LI> <A HREF="headget.html">Getting the value of cards in a header.</A> + <LI> <A HREF="headset.html">Setting the value of cards in a header.</A> + <LI> <A HREF="headfind.html">Finding cards in a header</A> + <LI> <A HREF="headins.html">Inserting, appending and deleting cards in a header.</A> + </UL> + <LI> Routines to handle the data portion of a FITS file. + <UL> + <LI> <A HREF="headdata.html">Moving to and skipping over the data portion of a FITS HDU.</A> + <LI> <A HREF="dataimage.html">Reading FITS image data</A> + </UL> + <LI> Low level routines to handle FITS Cards. + <UL> + <LI> <A HREF="cardpar.html">Parsing values from FITS cards.</A> + <LI> <A HREF="cardfmt.html">Formatting FITS cards.</A> + <LI> <A HREF="cardfind.html">Finding cards in a header</A> + <LI> <A HREF="cardins.html">Inserting, appending and deleting cards in a header.</A> + + </UL> +<P> + <LI> Examples + <UL> + <LI> <A HREF="headex.html">Basic header examples.</A> + <LI> <A HREF="cardex.html">Basic card examples.</A> + <LI> <A HREF="examples.html">More examples.</A> + </UL> +</UL> + +<p> +<!-- pnuts --> <a href="../mmtilib.html">[Previous]</a> <a href="fitsimage.html">[Next]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/fitsy.pnuts b/funtools/fitsy/doc/fitsy.pnuts new file mode 100644 index 0000000..a0250e6 --- /dev/null +++ b/funtools/fitsy/doc/fitsy.pnuts @@ -0,0 +1,20 @@ +../mmtilib.html +fitsy.html + fitsimage.html + headinit.html + headfile.html + basicval.html + imageval.html + tableval.html + headimage.html + headtable.html + headget.html + headset.html + headfind.html + headins.html + headdata.html + dataimage.html + cardpar.html + cardfmt.html + cardfind.html + cardins.html diff --git a/funtools/fitsy/doc/fitsy.wu b/funtools/fitsy/doc/fitsy.wu new file mode 100644 index 0000000..5815b67 --- /dev/null +++ b/funtools/fitsy/doc/fitsy.wu @@ -0,0 +1,43 @@ +Title: Fitsy FITS Library TOC + +Fitsy FITS Routines +=================== + + * Routines to handle complete FITS files. ::fitsfile.html + * @"Routines to handle FITS images."::fitsimage.html + * @"Routines to handle FITS tables."::fitstable.html + * Routines to handle FITS headers. + * @"Creating the #FITSHead data structure."::headinit.html + * @"Reading and writing FITS headers."::headfile.html + * Getting basic values in a header. + + Many of the most basic FITS values are retrieved in when a fits + file is scanned in memory or read from disk. + + * @"Basic values"::basicval.html + * @"Image values"::imageval.html + * @"Table values"::tableval.html + + These data structures are transfered to and from the FITS header + with these routines. + + * @"Load and store basic and image header values."::headimage.html + * @"Load and store table header values."::headtable.html + + * @"Getting the value of cards in a header."::headget.html + * @"Setting the value of cards in a header."::headset.html + * @"Finding cards in a header"::headfind.html + * @"Inserting, appending and deleting cards in a header."::headins.html + * Routines to handle the data portion of a FITS file. + * @"Moving to and skipping over the data portion of a FITS HDU."::headdata.html + * @"Reading FITS image data"::dataimage.html + * Low level routines to handle FITS Cards. + * @"Parsing values from FITS cards."::cardpar.html + * @"Formatting FITS cards."::cardfmt.html + * @"Finding cards in a header"::cardfind.html + * @"Inserting, appending and deleting cards in a header."::cardins.html + + * Examples + * @"Basic header examples."::headex.html + * @"Basic card examples."::cardex.html + * @"More examples."::examples.html diff --git a/funtools/fitsy/doc/ftimage.wu b/funtools/fitsy/doc/ftimage.wu new file mode 100644 index 0000000..ecf12c6 --- /dev/null +++ b/funtools/fitsy/doc/ftimage.wu @@ -0,0 +1,41 @@ +Title: ftimage + + +NAME +==== + ft_imageloadhead,ft_imagestorhead,ft_basicloadhead,ft_basicstorhead - Fitsy + FITS routines for reading and writing image related cards. + +SYNOPSIS +======== +- +FITSImage ft_imageloadhead(FITSHead fits); +void ft_imagestorhead(FITSHead fits, FITSImage image); +FITSBasic ft_basicloadhead(FITSHead fits); +void ft_basicstorhead(FITSHead fits, FITSBasic basic); +- + +PARAMETERS +========== + * #"FITSHead fits" - Not Documented. + * #"FITSImage image" - Not Documented. + * #"FITSBasic basic" - Not Documented. + +DESCRIPTION +=========== + + ft_imageloadhead + ---------------- + Load image FITS values into the #FITSImage structure. + + ft_imagestorhead + ---------------- + Store image FITS values from a #FITSImage structure into a header. + + ft_basicloadhead + ---------------- + Load basic FITS values into the #FITSBasic structure. + + ft_basicstorhead + ---------------- + Store basic FITS values from a #FITSBasic structre into a fits header. diff --git a/funtools/fitsy/doc/fttable.wu b/funtools/fitsy/doc/fttable.wu new file mode 100644 index 0000000..de0b5e0 --- /dev/null +++ b/funtools/fitsy/doc/fttable.wu @@ -0,0 +1,35 @@ +Title: fttable + + +NAME +==== + ft_tableloadhead,ft_tablestorhead,ft_tablefree - Fitsy FITS routines to load + and store #FITSTable structures. + +SYNOPSIS +======== +- +FITSTable ft_tableloadhead(FITSHead fits); +void ft_tablestorhead(FITSHead fits, FITSTable table); +void ft_tablefree(FITSTable table); +- + +PARAMETERS +========== + * #"FITSHead fits" - Not Documented. + * #"FITSTable table" - Not Documented. + +DESCRIPTION +=========== + + ft_tableloadhead + ---------------- + Allocate and load a #FITSTable data structure. + + ft_tablestorhead + ---------------- + Store a #FITSTable structure in a FITS header. + + ft_tablefree + ------------ + Free a #FITSTable structure. diff --git a/funtools/fitsy/doc/headdata.html b/funtools/fitsy/doc/headdata.html new file mode 100644 index 0000000..9d586fb --- /dev/null +++ b/funtools/fitsy/doc/headdata.html @@ -0,0 +1,63 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> headdata +</TITLE> +<p> +<!-- pnuts --> <a href="headins.html">[Previous]</a> <a href="dataimage.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_dataskip,ft_dataseek -Fitsy FITS routines to work with the data portion of + a FITS file. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +void ft_dataskip(File ifile, FITSHead fits, File ofile); +int ft_dataseek(File sfile, FITSHead fits); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>File ifile</B> - File pointer to read FITS data from. + <LI> <B>FITSHead fits</B> - FITS header associated with data. + <LI> <B>File ofile</B> - File pointer to write data to. + <LI> <B>File sfile</B> - File pointer to seek. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_dataskip</H4></A> + +<P> + Skip over the data part of a FITS header data unit. + +<P> + If the file is seekable and the <B>ofile</B> file pointer is + <B>NULL</B> the data are skipped with an <B>fseek</B>(). + +<P> + If the <B>ofile</B> file pointer is <B>NULL</B> no data is written. + +<A NAME="section-1.1.4.2"><H4>ft_dataseek</H4></A> + +<P> + Seek to the data portion of prevoiusly read fits header data unit. + +<p> +<!-- pnuts --> <a href="headins.html">[Previous]</a> <a href="dataimage.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/headdata.wu b/funtools/fitsy/doc/headdata.wu new file mode 100644 index 0000000..cf4b7da --- /dev/null +++ b/funtools/fitsy/doc/headdata.wu @@ -0,0 +1,40 @@ +Title: headdata + + +NAME +==== + ft_dataskip,ft_dataseek -Fitsy FITS routines to work with the data portion of + a FITS file. + +SYNOPSIS +======== + + +- +void ft_dataskip(File ifile, FITSHead fits, File ofile); +int ft_dataseek(File sfile, FITSHead fits); + + +- +PARAMETERS +========== + * #"File ifile" - File pointer to read FITS data from. + * #"FITSHead fits" - FITS header associated with data. + * #"File ofile" - File pointer to write data to. + * #"File sfile" - File pointer to seek. + +DESCRIPTION +=========== + + ft_dataskip + ----------- + Skip over the data part of a FITS header data unit. + + If the file is seekable and the #ofile file pointer is + #NULL the data are skipped with an #fseek(). + + If the #ofile file pointer is #NULL no data is written. + + ft_dataseek + ----------- + Seek to the data portion of prevoiusly read fits header data unit. diff --git a/funtools/fitsy/doc/headfile.html b/funtools/fitsy/doc/headfile.html new file mode 100644 index 0000000..32c8978 --- /dev/null +++ b/funtools/fitsy/doc/headfile.html @@ -0,0 +1,67 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> headfile +</TITLE> +<p> +<!-- pnuts --> <a href="headinit.html">[Previous]</a> <a href="basicval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_headread,ft_headwrite,ft_headseek -Fitsy FITS read and write header routines. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +FITSHead ft_headread(File file); +int ft_headwrite(File file, FITSHead fits); +int ft_headseek(File file, FITSHead fits); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>File file</B> - File pointer to read or write a FITS header on. + <LI> <B>FITSHead fits</B> - Header to write. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_headread</H4></A> + +<P> + Read a FITS header from a file pointer. + +<A NAME="section-1.1.4.2"><H4>ft_headwrite</H4></A> + +<P> + Write a FITS header to a file pointer. + +<A NAME="section-1.1.4.3"><H4>ft_headseek</H4></A> + +<P> + Seek back to the header part of a FITS HDU. The file handle must be the same + one from which the FITS header was read and must be seekable. + +<A NAME="section-1.1.5"><H3>RETURNS</H3></A> + + +<A NAME="section-1.1.5.1"><H4>ft_headread</H4></A> + +<P> + The <B>FITSHead</B> read from <B>file.</B> +<p> +<!-- pnuts --> <a href="headinit.html">[Previous]</a> <a href="basicval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/headfile.wu b/funtools/fitsy/doc/headfile.wu new file mode 100644 index 0000000..23aa8e8 --- /dev/null +++ b/funtools/fitsy/doc/headfile.wu @@ -0,0 +1,45 @@ +Title: headfile + + +NAME +==== + ft_headread,ft_headwrite,ft_headseek -Fitsy FITS read and write header routines. + +SYNOPSIS +======== + + +- +FITSHead ft_headread(File file); +int ft_headwrite(File file, FITSHead fits); +int ft_headseek(File file, FITSHead fits); + + +- +PARAMETERS +========== + * #"File file" - File pointer to read or write a FITS header on. + * #"FITSHead fits" - Header to write. + +DESCRIPTION +=========== + + ft_headread + ----------- + Read a FITS header from a file pointer. + + ft_headwrite + ------------ + Write a FITS header to a file pointer. + + ft_headseek + ----------- + Seek back to the header part of a FITS HDU. The file handle must be the same + one from which the FITS header was read and must be seekable. + +RETURNS +======= + + ft_headread + ----------- + The #FITSHead read from #file.
\ No newline at end of file diff --git a/funtools/fitsy/doc/headfind.html b/funtools/fitsy/doc/headfind.html new file mode 100644 index 0000000..1c1edc2 --- /dev/null +++ b/funtools/fitsy/doc/headfind.html @@ -0,0 +1,96 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> headfind +</TITLE> +<p> +<!-- pnuts --> <a href="headset.html">[Previous]</a> <a href="headins.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_headfind,ft_headindex,ft_headfindidx,ft_headfindseq -Fitsy FITS header find + routines. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +FITSCard ft_headfind(FITSHead fits, char *name, int n, int add); +void ft_headindex(FITSHead fits); +FITSCard ft_headfindidx(FITSHead fits, char *name, int n, int *match); +FITSCard ft_headfindseq(FITSHead fits, char *name, int n, int *match); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>FITSHead fits</B> - The FITS header to search. + <LI> <B>char *name</B> - Name of the card keyword to search for. + <LI> <B>int n</B> - keyword index number, if is zero no + index number is appended to the keyword. + <LI> <B>int add</B> - If add is true the card will + be added to the header if it is + not found. + <LI> <B>int *match</B> - Returns true if the card found is + an exact match for the keyword + requested. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_headfind</H4></A> + +<P> + Find a FITS card in the header. + +<P> + If the header has been indexed the index will be used + otherwise a sequential search will be done. + +<A NAME="section-1.1.4.2"><H4>ft_headindex</H4></A> + +<P> + Index a header for use with <B>ft_headfind.</B> + +<A NAME="section-1.1.4.3"><H4>ft_headfindidx</H4></A> + +<P> + Find a FITS card in the header. + +<P> + <B>headfindidx</B> uses an index to find the card. + +<A NAME="section-1.1.4.4"><H4>ft_headfindseq</H4></A> + +<P> + Find a FITS card in the header. + +<P> + Find a card in the header using sequential search. + +<P> + If the requested card is a FITS indexed keyword and an exact match + is not found, the highest existing card of that type is returned and + match is set to 0. + +<A NAME="section-1.1.5"><H3>RETURNS</H3></A> + + +<A NAME="section-1.1.5.1"><H4>ft_headfind</H4></A> + +<P> + The card found or NULL if an exact match was not found. +<p> +<!-- pnuts --> <a href="headset.html">[Previous]</a> <a href="headins.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/headfind.wu b/funtools/fitsy/doc/headfind.wu new file mode 100644 index 0000000..20b143d --- /dev/null +++ b/funtools/fitsy/doc/headfind.wu @@ -0,0 +1,69 @@ +Title: headfind + + +NAME +==== + ft_headfind,ft_headindex,ft_headfindidx,ft_headfindseq -Fitsy FITS header find + routines. + +SYNOPSIS +======== + + +- +FITSCard ft_headfind(FITSHead fits, char *name, int n, int add); +void ft_headindex(FITSHead fits); +FITSCard ft_headfindidx(FITSHead fits, char *name, int n, int *match); +FITSCard ft_headfindseq(FITSHead fits, char *name, int n, int *match); + + +- +PARAMETERS +========== + * #"FITSHead fits" - The FITS header to search. + * #"char *name" - Name of the card keyword to search for. + * #"int n" - keyword index number, if is zero no + index number is appended to the keyword. + * #"int add" - If add is true the card will + be added to the header if it is + not found. + * #"int *match" - Returns true if the card found is + an exact match for the keyword + requested. + +DESCRIPTION +=========== + + ft_headfind + ----------- + Find a FITS card in the header. + + If the header has been indexed the index will be used + otherwise a sequential search will be done. + + ft_headindex + ------------ + Index a header for use with #ft_headfind. + + ft_headfindidx + -------------- + Find a FITS card in the header. + + #headfindidx uses an index to find the card. + + ft_headfindseq + -------------- + Find a FITS card in the header. + + Find a card in the header using sequential search. + + If the requested card is a FITS indexed keyword and an exact match + is not found, the highest existing card of that type is returned and + match is set to 0. + +RETURNS +======= + + ft_headfind + ----------- + The card found or NULL if an exact match was not found.
\ No newline at end of file diff --git a/funtools/fitsy/doc/headget.html b/funtools/fitsy/doc/headget.html new file mode 100644 index 0000000..a9b666c --- /dev/null +++ b/funtools/fitsy/doc/headget.html @@ -0,0 +1,104 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> headget +</TITLE> +<p> +<!-- pnuts --> <a href="headtable.html">[Previous]</a> <a href="headset.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_headget,ft_headgetl,ft_headgeti,ft_headgetr,ft_headgets -Find and return + values from a FITS header. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +char *ft_headget(FITSHead fits, char *name, int n, FITSCard *card); +int ft_headgetl(FITSHead fits, char *name, int n, int ldefault, FITSCard *card); +int ft_headgeti(FITSHead fits, char *name, int n, int idefault, FITSCard *card); +double ft_headgetr(FITSHead fits, char *name, int n, double ddefault, FITSCard *card); +char *ft_headgets(FITSHead fits, char *name, int n, char *sdefault, FITSCard *card); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>FITSHead fits</B> - The FITS header to search. + <LI> <B>char *name</B> - Name of the card keyword to search for. + <LI> <B>int n</B> - keyword index number, if is zero no + index number is appended to the keyword. + <LI> <B>FITSCard *card</B> - The FITS card that was found. + <LI> <B>int ldefault</B> - Default logical value to return. + <LI> <B>int idefault</B> - Default integer value to return. + <LI> <B>double ddefault</B> - Default real value to return. + <LI> <B>char *sdefault</B> - Default string value to return. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_headget</H4></A> + +<P> + Find and return the value of a FITS card as a static string. + +<A NAME="section-1.1.4.2"><H4>ft_headgetl</H4></A> + +<P> + Find and return the value of a FITS card as a logical. + +<A NAME="section-1.1.4.3"><H4>ft_headgeti</H4></A> + +<P> + Find and return the value of a FITS card as an integer. + +<A NAME="section-1.1.4.4"><H4>ft_headgetr</H4></A> + +<P> + Find and return the value of a FITS card as a real. + +<A NAME="section-1.1.4.5"><H4>ft_headgets</H4></A> + +<P> + Find and return the value of a FITS card as a allocated string. + +<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A> + + +<PRE> + FITSHead fits; + FITSCard card; + + + int simple; + int ax1, ax2; + + /* Look up the SIMPLE card in the header and see if its is + True. If it's not found return False. + */ + simple = <B>ft_headgetl</B>(fits, "SIMPLE", 0, 0, &card); + + /* Look up the NAXIS1 and NAXIS2 cards in the header + if a card is not found return 0. + */ + ax1 = <B>ft_headgeti</B>(fits, "NAXIS", 1, 0, &card); + ax2 = <B>ft_headgeti</B>(fits, "NAXIS", 2, 0, &card); + +<P> +</PRE> + +<p> +<!-- pnuts --> <a href="headtable.html">[Previous]</a> <a href="headset.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/headget.wu b/funtools/fitsy/doc/headget.wu new file mode 100644 index 0000000..9b74c96 --- /dev/null +++ b/funtools/fitsy/doc/headget.wu @@ -0,0 +1,79 @@ +Title: headget + + +NAME +==== + ft_headget,ft_headgetl,ft_headgeti,ft_headgetr,ft_headgets -Find and return + values from a FITS header. + +SYNOPSIS +======== + + +- +char *ft_headget(FITSHead fits, char *name, int n, FITSCard *card); +int ft_headgetl(FITSHead fits, char *name, int n, int ldefault, FITSCard *card); +int ft_headgeti(FITSHead fits, char *name, int n, int idefault, FITSCard *card); +double ft_headgetr(FITSHead fits, char *name, int n, double ddefault, FITSCard *card); +char *ft_headgets(FITSHead fits, char *name, int n, char *sdefault, FITSCard *card); + + +- +PARAMETERS +========== + * #"FITSHead fits" - The FITS header to search. + * #"char *name" - Name of the card keyword to search for. + * #"int n" - keyword index number, if is zero no + index number is appended to the keyword. + * #"FITSCard *card" - The FITS card that was found. + * #"int ldefault" - Default logical value to return. + * #"int idefault" - Default integer value to return. + * #"double ddefault" - Default real value to return. + * #"char *sdefault" - Default string value to return. + +DESCRIPTION +=========== + + ft_headget + ---------- + Find and return the value of a FITS card as a static string. + + ft_headgetl + ----------- + Find and return the value of a FITS card as a logical. + + ft_headgeti + ----------- + Find and return the value of a FITS card as an integer. + + ft_headgetr + ----------- + Find and return the value of a FITS card as a real. + + ft_headgets + ----------- + Find and return the value of a FITS card as a allocated string. + +EXAMPLES +======== + ++ + FITSHead fits; + FITSCard card; + + + int simple; + int ax1, ax2; + + /* Look up the SIMPLE card in the header and see if its is + True. If it's not found return False. + *-/ + simple = #ft_headgetl(fits, "SIMPLE", 0, 0, &card); + + /* Look up the NAXIS1 and NAXIS2 cards in the header + if a card is not found return 0. + *-/ + ax1 = #ft_headgeti(fits, "NAXIS", 1, 0, &card); + ax2 = #ft_headgeti(fits, "NAXIS", 2, 0, &card); + ++ diff --git a/funtools/fitsy/doc/headimage.html b/funtools/fitsy/doc/headimage.html new file mode 100644 index 0000000..cfb98bf --- /dev/null +++ b/funtools/fitsy/doc/headimage.html @@ -0,0 +1,99 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> headimage +</TITLE> +<p> +<!-- pnuts --> <a href="tableval.html">[Previous]</a> <a href="headtable.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_syncdata,ft_synchead,ft_imageloadhead,ft_imagestorhead,ft_imagefree,ft_basicloadhead,ft_basicstorhead,ft_basicfree +- Fitsy FITS routines for reading and writing image related cards. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +void ft_syncdata(FITSHead fits); +void ft_synchead(FITSHead fits); +FITSImage ft_imageloadhead(FITSHead fits); +void ft_imagestorhead(FITSHead fits, FITSImage image); +void ft_imagefree(FITSImage image); +FITSBasic ft_basicloadhead(FITSHead fits); +void ft_basicstorhead(FITSHead fits, FITSBasic basic); +void ft_basicfree(FITSBasic basic); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>FITSHead fits</B> - FITS header to read/write image + cards from/to. + <LI> <B>FITSImage image</B> - Image data to copy into header. + <LI> <B>FITSBasic basic</B> - FITSBasic structure + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + +<P> + The routines on this page are usually called automatically from + <B>ft_headinit</B>, <B>ft_headread</B>, <B>ft_headwrite</B> and other higher level + routines. This user should never need to call them with the + exception of <B>ft_synchead</B> or <B>ft_syncdata.</B> + +<A NAME="section-1.1.4.1"><H4>ft_syncdata</H4></A> + +<P> + Copy information from a <B>FITSHead</B> into the <B>FITSBasic</B>, <B>FITSImage</B> + and <B>FITSTable</B> data structures. + +<A NAME="section-1.1.4.2"><H4>ft_synchead</H4></A> + +<P> + Copy information from the <B>FITSBasic</B>, <B>FITSImage</B> and <B>FITSTable</B> data + structures into a <B>FITSHead.</B> + +<A NAME="section-1.1.4.3"><H4>ft_imageloadhead</H4></A> + +<P> + Load image FITS values into the <B>FITSImage</B> structure. + +<A NAME="section-1.1.4.4"><H4>ft_imagestorhead</H4></A> + +<P> + Store image FITS values from a <B>FITSImage</B> structure into a header. + +<A NAME="section-1.1.4.5"><H4>ft_imagefree</H4></A> + +<P> + Free a FITSImage data structure. + +<A NAME="section-1.1.4.6"><H4>ft_basicloadhead</H4></A> + +<P> + Load basic FITS values into the <B>FITSBasic</B> structure. + +<A NAME="section-1.1.4.7"><H4>ft_basicstorhead</H4></A> + +<P> + Store basic FITS values from a <B>FITSBasic</B> structre into a fits header. + +<A NAME="section-1.1.4.8"><H4>ft_basicfree</H4></A> + +<P> + Free a FITSBasic data structure. + +<p> +<!-- pnuts --> <a href="tableval.html">[Previous]</a> <a href="headtable.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/headimage.wu b/funtools/fitsy/doc/headimage.wu new file mode 100644 index 0000000..8c92b08 --- /dev/null +++ b/funtools/fitsy/doc/headimage.wu @@ -0,0 +1,71 @@ +Title: headimage + + +NAME +==== + ft_syncdata,ft_synchead,ft_imageloadhead,ft_imagestorhead,ft_imagefree,ft_basicloadhead,ft_basicstorhead,ft_basicfree +- Fitsy FITS routines for reading and writing image related cards. + +SYNOPSIS +======== + + +- +void ft_syncdata(FITSHead fits); +void ft_synchead(FITSHead fits); +FITSImage ft_imageloadhead(FITSHead fits); +void ft_imagestorhead(FITSHead fits, FITSImage image); +void ft_imagefree(FITSImage image); +FITSBasic ft_basicloadhead(FITSHead fits); +void ft_basicstorhead(FITSHead fits, FITSBasic basic); +void ft_basicfree(FITSBasic basic); + + +- +PARAMETERS +========== + * #"FITSHead fits" - FITS header to read/write image + cards from/to. + * #"FITSImage image" - Image data to copy into header. + * #"FITSBasic basic" - FITSBasic structure + +DESCRIPTION +=========== + The routines on this page are usually called automatically from + #ft_headinit, #ft_headread, #ft_headwrite and other higher level + routines. This user should never need to call them with the + exception of #ft_synchead or #ft_syncdata. + + ft_syncdata + ----------- + Copy information from a #FITSHead into the #FITSBasic, #FITSImage + and #FITSTable data structures. + + ft_synchead + ----------- + Copy information from the #FITSBasic, #FITSImage and #FITSTable data + structures into a #FITSHead. + + ft_imageloadhead + ---------------- + Load image FITS values into the #FITSImage structure. + + ft_imagestorhead + ---------------- + Store image FITS values from a #FITSImage structure into a header. + + ft_imagefree + ------------ + Free a FITSImage data structure. + + ft_basicloadhead + ---------------- + Load basic FITS values into the #FITSBasic structure. + + ft_basicstorhead + ---------------- + Store basic FITS values from a #FITSBasic structre into a fits header. + + ft_basicfree + ------------ + Free a FITSBasic data structure. diff --git a/funtools/fitsy/doc/headinit.html b/funtools/fitsy/doc/headinit.html new file mode 100644 index 0000000..78e6078 --- /dev/null +++ b/funtools/fitsy/doc/headinit.html @@ -0,0 +1,115 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> headinit +</TITLE> +<p> +<!-- pnuts --> <a href="fitsimage.html">[Previous]</a> <a href="headfile.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_headinit,ft_headcopy,ft_headfree,ft_setcards,ft_primary,ft_headmerge -Fitsy + FITS header creation routines. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +FITSHead ft_headinit(void *data, int bytes); +FITSHead ft_headcopy(FITSHead fits); +void ft_headfree(FITSHead fits, int freecards); +void ft_setcards(FITSHead fits, void *cards); +FITSHead ft_primary(FITSHead fits); +FITSHead ft_headmerge(FITSHead fits1, FITSHead fits2); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>void *data</B> - Pointer to FITS cards. + <LI> <B>int bytes</B> - Number of bytes in buffer. + <LI> <B>FITSHead fits</B> - Not Documented. + <LI> <B>int freecards</B> - Free the FITS cards? + <LI> <B>void *cards</B> - Not Documented. + <LI> <B>FITSHead fits1</B> - Not Documented. + <LI> <B>FITSHead fits2</B> - Not Documented. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_headinit</H4></A> + +<P> + Create or import a FITS header to Fitsy. + +<P> + This is the primary way in which FITSHead structures are created. + +<P> + If <B>cards</B> is not NULL then then <B>acard</B> cards are scanned from the memory + in search of the END card. When a memory block is passed in to <B>ft_headinit</B> + then it is considered <I>unmanaged</I> and will not be freed by <B>ft_headfree.</B> + +<P> + If <B>cards</B> is NULL, then <B>acards</B> cards will be allocated for use as a FITSHead. + If <B>acards</B> is 0 the <B>FT_CARDS</B> will be allocated (36). + +<A NAME="section-1.1.4.2"><H4>ft_headcopy</H4></A> + +<P> + Make a copy of a <B>FITSHead</B> data structure. + +<A NAME="section-1.1.4.3"><H4>ft_headfree</H4></A> + +<P> + Free a Fitsy FITS header data structure. + +<A NAME="section-1.1.4.4"><H4>ft_setcards</H4></A> + +<P> + Set the card buffer + +<A NAME="section-1.1.4.5"><H4>ft_primary</H4></A> + +<P> + Make a copy of the header and force it to be a simple primary header. + +<A NAME="section-1.1.4.6"><H4>ft_headmerge</H4></A> + +<P> + Merge cards from fits1 to fits2 + +<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A> + + +<PRE> + FITSHead fits; + + fits = <B>ft_headinit</B>(NULL, 0); /* Create an empty header */ + + /* Build a FITS file header by hand. + */ + <B>ft_headappl</B>(fits, "SIMPLE", 0, 1, "Primary FITS image array"); + <B>ft_headappi</B>(fits, "BITPIX", 0, -32, "Single floats"); + <B>ft_headappi</B>(fits, "NAXIS" , 0, 2, "2d image"); + <B>ft_headappi</B>(fits, "NAXIS" , 1, 256, "X axis is 256"); + <B>ft_headappi</B>(fits, "NAXIS" , 2, 256, "Y axis is 256"); + + +<P> +</PRE> + +<p> +<!-- pnuts --> <a href="fitsimage.html">[Previous]</a> <a href="headfile.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/headinit.wu b/funtools/fitsy/doc/headinit.wu new file mode 100644 index 0000000..1828a8f --- /dev/null +++ b/funtools/fitsy/doc/headinit.wu @@ -0,0 +1,86 @@ +Title: headinit + + +NAME +==== + ft_headinit,ft_headcopy,ft_headfree,ft_setcards,ft_primary,ft_headmerge -Fitsy + FITS header creation routines. + +SYNOPSIS +======== + + +- +FITSHead ft_headinit(void *data, int bytes); +FITSHead ft_headcopy(FITSHead fits); +void ft_headfree(FITSHead fits, int freecards); +void ft_setcards(FITSHead fits, void *cards); +FITSHead ft_primary(FITSHead fits); +FITSHead ft_headmerge(FITSHead fits1, FITSHead fits2); + + +- +PARAMETERS +========== + * #"void *data" - Pointer to FITS cards. + * #"int bytes" - Number of bytes in buffer. + * #"FITSHead fits" - Not Documented. + * #"int freecards" - Free the FITS cards? + * #"void *cards" - Not Documented. + * #"FITSHead fits1" - Not Documented. + * #"FITSHead fits2" - Not Documented. + +DESCRIPTION +=========== + + ft_headinit + ----------- + Create or import a FITS header to Fitsy. + + This is the primary way in which FITSHead structures are created. + + If #cards is not NULL then then #acard cards are scanned from the memory + in search of the END card. When a memory block is passed in to #ft_headinit + then it is considered ~unmanaged~ and will not be freed by #ft_headfree. + + If #cards is NULL, then #acards cards will be allocated for use as a FITSHead. + If #acards is 0 the #FT_CARDS will be allocated (36). + + ft_headcopy + ----------- + Make a copy of a #FITSHead data structure. + + ft_headfree + ----------- + Free a Fitsy FITS header data structure. + + ft_setcards + ----------- + Set the card buffer + + ft_primary + ---------- + Make a copy of the header and force it to be a simple primary header. + + ft_headmerge + ------------ + Merge cards from fits1 to fits2 + +EXAMPLES +======== + ++ + FITSHead fits; + + fits = #ft_headinit(NULL, 0); /* Create an empty header *-/ + + /* Build a FITS file header by hand. + *-/ + #ft_headappl(fits, "SIMPLE", 0, 1, "Primary FITS image array"); + #ft_headappi(fits, "BITPIX", 0, -32, "Single floats"); + #ft_headappi(fits, "NAXIS" , 0, 2, "2d image"); + #ft_headappi(fits, "NAXIS" , 1, 256, "X axis is 256"); + #ft_headappi(fits, "NAXIS" , 2, 256, "Y axis is 256"); + + ++ diff --git a/funtools/fitsy/doc/headins.html b/funtools/fitsy/doc/headins.html new file mode 100644 index 0000000..311f343 --- /dev/null +++ b/funtools/fitsy/doc/headins.html @@ -0,0 +1,128 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> headins +</TITLE> +<p> +<!-- pnuts --> <a href="headfind.html">[Previous]</a> <a href="headdata.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_headinsl,ft_headinsi,ft_headinsr,ft_headinss,ft_headinsv,ft_headappl,ft_headappi,ft_headappr,ft_headapps,ft_headappv,ft_headdel +- Routines to insert, append and delete FITS cards from a header. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +FITSCard ft_headinsl(FITSHead fits, char *name, int n, int lvalue, char *comm, FITSCard here); +FITSCard ft_headinsi(FITSHead fits, char *name, int n, int ivalue, char *comm, FITSCard here); +FITSCard ft_headinsr(FITSHead fits, char *name, int n, double dvalue, int prec, char *comm, FITSCard here); +FITSCard ft_headinss(FITSHead fits, char *name, int n, char *svalue, char *comm, FITSCard here); +FITSCard ft_headinsv(FITSHead fits, char *name, int n, char *vvalue, char *comm, FITSCard here); +FITSCard ft_headappl(FITSHead fits, char *name, int n, int lvalue, char *comm); +FITSCard ft_headappi(FITSHead fits, char *name, int n, int ivalue, char *comm); +FITSCard ft_headappr(FITSHead fits, char *name, int n, double dvalue, int prec, char *comm); +FITSCard ft_headapps(FITSHead fits, char *name, int n, char *svalue, char *comm); +FITSCard ft_headappv(FITSHead fits, char *name, int n, char *vvalue, char *comm); +FITSCard ft_headdel(FITSHead fits, char *name, int n); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>FITSHead fits</B> - FITS header to insert, append or + delete a card. + <LI> <B>char *name</B> - Name of the FITS card. + <LI> <B>int n</B> - keyword index number, if is zero no + index number is appended to the + keyword. + <LI> <B>int lvalue</B> - Logical to format as a FITS value. + <LI> <B>char *comm</B> - Comment for the new card. + <LI> <B>FITSCard here</B> - Insert the new card after this card. + <LI> <B>int ivalue</B> - Integer to format as a FITS value. + <LI> <B>double dvalue</B> - Double to format as a FITS value. + <LI> <B>int prec</B> - Precision for the value + <LI> <B>char *svalue</B> - String to format as a FITS value + <LI> <B>char *vvalue</B> - Raw value to format as a FITS value + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + +<P> + These routines allow FITS cards to be inserted, appended and deleted + by keyword value. + +<P> + The insertion routines format a new card with the supplied keyword and + value and insert it after indicated card. The append routines add new + cards to the end of the header (before the END card). + +<A NAME="section-1.1.4.1"><H4>ft_headinsl</H4></A> + +<P> + Insert a logical value FITS card into a header. + +<A NAME="section-1.1.4.2"><H4>ft_headinsi</H4></A> + +<P> + Insert a integer value FITS card into a header. + +<A NAME="section-1.1.4.3"><H4>ft_headinsr</H4></A> + +<P> + Insert a real value FITS card into a header. + +<A NAME="section-1.1.4.4"><H4>ft_headinss</H4></A> + +<P> + Insert a string value FITS card into a header. + +<A NAME="section-1.1.4.5"><H4>ft_headinsv</H4></A> + +<P> + Insert a raw value FITS card into a header. + +<A NAME="section-1.1.4.6"><H4>ft_headappl</H4></A> + +<P> + Append a logical value FITS card to a header. + +<A NAME="section-1.1.4.7"><H4>ft_headappi</H4></A> + +<P> + Append a integer value FITS card to a header. + +<A NAME="section-1.1.4.8"><H4>ft_headappr</H4></A> + +<P> + Append a real value FITS card to a header. + +<A NAME="section-1.1.4.9"><H4>ft_headapps</H4></A> + +<P> + Append a string value FITS card to a header. + +<A NAME="section-1.1.4.10"><H4>ft_headappv</H4></A> + +<P> + Append a raw value FITS card to a header. + +<A NAME="section-1.1.4.11"><H4>ft_headdel</H4></A> + +<P> + Find and delete a card from a FITS header. + +<p> +<!-- pnuts --> <a href="headfind.html">[Previous]</a> <a href="headdata.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/headins.wu b/funtools/fitsy/doc/headins.wu new file mode 100644 index 0000000..a9852f4 --- /dev/null +++ b/funtools/fitsy/doc/headins.wu @@ -0,0 +1,96 @@ +Title: headins + + +NAME +==== + ft_headinsl,ft_headinsi,ft_headinsr,ft_headinss,ft_headinsv,ft_headappl,ft_headappi,ft_headappr,ft_headapps,ft_headappv,ft_headdel +- Routines to insert, append and delete FITS cards from a header. + +SYNOPSIS +======== + + +- +FITSCard ft_headinsl(FITSHead fits, char *name, int n, int lvalue, char *comm, FITSCard here); +FITSCard ft_headinsi(FITSHead fits, char *name, int n, int ivalue, char *comm, FITSCard here); +FITSCard ft_headinsr(FITSHead fits, char *name, int n, double dvalue, int prec, char *comm, FITSCard here); +FITSCard ft_headinss(FITSHead fits, char *name, int n, char *svalue, char *comm, FITSCard here); +FITSCard ft_headinsv(FITSHead fits, char *name, int n, char *vvalue, char *comm, FITSCard here); +FITSCard ft_headappl(FITSHead fits, char *name, int n, int lvalue, char *comm); +FITSCard ft_headappi(FITSHead fits, char *name, int n, int ivalue, char *comm); +FITSCard ft_headappr(FITSHead fits, char *name, int n, double dvalue, int prec, char *comm); +FITSCard ft_headapps(FITSHead fits, char *name, int n, char *svalue, char *comm); +FITSCard ft_headappv(FITSHead fits, char *name, int n, char *vvalue, char *comm); +FITSCard ft_headdel(FITSHead fits, char *name, int n); + + +- +PARAMETERS +========== + * #"FITSHead fits" - FITS header to insert, append or + delete a card. + * #"char *name" - Name of the FITS card. + * #"int n" - keyword index number, if is zero no + index number is appended to the + keyword. + * #"int lvalue" - Logical to format as a FITS value. + * #"char *comm" - Comment for the new card. + * #"FITSCard here" - Insert the new card after this card. + * #"int ivalue" - Integer to format as a FITS value. + * #"double dvalue" - Double to format as a FITS value. + * #"int prec" - Precision for the value + * #"char *svalue" - String to format as a FITS value + * #"char *vvalue" - Raw value to format as a FITS value + +DESCRIPTION +=========== + These routines allow FITS cards to be inserted, appended and deleted + by keyword value. + + The insertion routines format a new card with the supplied keyword and + value and insert it after indicated card. The append routines add new + cards to the end of the header (before the END card). + + ft_headinsl + ----------- + Insert a logical value FITS card into a header. + + ft_headinsi + ----------- + Insert a integer value FITS card into a header. + + ft_headinsr + ----------- + Insert a real value FITS card into a header. + + ft_headinss + ----------- + Insert a string value FITS card into a header. + + ft_headinsv + ----------- + Insert a raw value FITS card into a header. + + ft_headappl + ----------- + Append a logical value FITS card to a header. + + ft_headappi + ----------- + Append a integer value FITS card to a header. + + ft_headappr + ----------- + Append a real value FITS card to a header. + + ft_headapps + ----------- + Append a string value FITS card to a header. + + ft_headappv + ----------- + Append a raw value FITS card to a header. + + ft_headdel + ---------- + Find and delete a card from a FITS header. diff --git a/funtools/fitsy/doc/headset.html b/funtools/fitsy/doc/headset.html new file mode 100644 index 0000000..e0a674a --- /dev/null +++ b/funtools/fitsy/doc/headset.html @@ -0,0 +1,103 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> headset +</TITLE> +<p> +<!-- pnuts --> <a href="headget.html">[Previous]</a> <a href="headfind.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_headsetl,ft_headseti,ft_headsetr,ft_headsets -Fitsy FITS header set routines. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +FITSCard ft_headsetl(FITSHead fits, char *name, int n, int lvalue, char *comm); +FITSCard ft_headseti(FITSHead fits, char *name, int n, int ivalue, char *comm); +FITSCard ft_headsetr(FITSHead fits, char *name, int n, double rvalue, int prec, char *comm); +FITSCard ft_headsets(FITSHead fits, char *name, int n, char *svalue, char *comm); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>FITSHead fits</B> - FITS header to search in. + <LI> <B>char *name</B> - keyword name. + <LI> <B>int n</B> - keyword index number, if is zero no + index number is appended to the keyword. + <LI> <B>int lvalue</B> - Logical to format as a FITS value. + <LI> <B>char *comm</B> - Comment for the card. + <LI> <B>int ivalue</B> - Integer to format as a FITS value. + <LI> <B>double rvalue</B> - Double to format as a FITS value. + <LI> <B>int prec</B> - The value is formatted + at this precision. + <LI> <B>char *svalue</B> - String to format as a FITS value. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_headsetl</H4></A> + +<P> + Find a FITS card in the header and format a logical value into it. + +<A NAME="section-1.1.4.2"><H4>ft_headseti</H4></A> + +<P> + Find a FITS card in the header and format a logical value into it. + +<A NAME="section-1.1.4.3"><H4>ft_headsetr</H4></A> + +<P> + Find a FITS card in the header and format a logical value into it. + +<A NAME="section-1.1.4.4"><H4>ft_headsets</H4></A> + +<P> + Find a FITS card in the header and format a logical value into it. + +<A NAME="section-1.1.5"><H3>EXAMPLES</H3></A> + +<P> + Set the value part of a card in a header: + +<PRE> + int i = 15; + double d = 34.7; + char *c = "Shutter"; + + FITSCard fits; + FITSCard card; + + card = <B>ft_headsetl</B>(fits, "Cosmic", 0, 1, "Removed Cosimics (silver bullet method)"); + card = <B>ft_headseti</B>(fits, "IValue" , 0, i, "15 is the number"); + + card = <B>ft_headsetr</B>(fits, "Gain", 1, d, 2, "GAIN1"); + card = <B>ft_headsetr</B>(fits, "Gain", 2, d, 2, "GAIN2"); + + card = <B>ft_headsets</B>(fits, "XHIST", 1, "Xray processed!", NULL); + + /* In this example the special pointer <B>ft_comment</B> is used to + use the existing comment in the card. + */ + card = <B>ft_headsets</B>(fits, "FILTER", 0, "V", ft_comment); + +<P> +</PRE> + +<p> +<!-- pnuts --> <a href="headget.html">[Previous]</a> <a href="headfind.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/headset.wu b/funtools/fitsy/doc/headset.wu new file mode 100644 index 0000000..779a7fb --- /dev/null +++ b/funtools/fitsy/doc/headset.wu @@ -0,0 +1,78 @@ +Title: headset + + +NAME +==== + ft_headsetl,ft_headseti,ft_headsetr,ft_headsets -Fitsy FITS header set routines. + +SYNOPSIS +======== + + +- +FITSCard ft_headsetl(FITSHead fits, char *name, int n, int lvalue, char *comm); +FITSCard ft_headseti(FITSHead fits, char *name, int n, int ivalue, char *comm); +FITSCard ft_headsetr(FITSHead fits, char *name, int n, double rvalue, int prec, char *comm); +FITSCard ft_headsets(FITSHead fits, char *name, int n, char *svalue, char *comm); + + +- +PARAMETERS +========== + * #"FITSHead fits" - FITS header to search in. + * #"char *name" - keyword name. + * #"int n" - keyword index number, if is zero no + index number is appended to the keyword. + * #"int lvalue" - Logical to format as a FITS value. + * #"char *comm" - Comment for the card. + * #"int ivalue" - Integer to format as a FITS value. + * #"double rvalue" - Double to format as a FITS value. + * #"int prec" - The value is formatted + at this precision. + * #"char *svalue" - String to format as a FITS value. + +DESCRIPTION +=========== + + ft_headsetl + ----------- + Find a FITS card in the header and format a logical value into it. + + ft_headseti + ----------- + Find a FITS card in the header and format a logical value into it. + + ft_headsetr + ----------- + Find a FITS card in the header and format a logical value into it. + + ft_headsets + ----------- + Find a FITS card in the header and format a logical value into it. + +EXAMPLES +======== + Set the value part of a card in a header: + ++ + int i = 15; + double d = 34.7; + char *c = "Shutter"; + + FITSCard fits; + FITSCard card; + + card = #ft_headsetl(fits, "Cosmic", 0, 1, "Removed Cosimics (silver bullet method)"); + card = #ft_headseti(fits, "IValue" , 0, i, "15 is the number"); + + card = #ft_headsetr(fits, "Gain", 1, d, 2, "GAIN1"); + card = #ft_headsetr(fits, "Gain", 2, d, 2, "GAIN2"); + + card = #ft_headsets(fits, "XHIST", 1, "Xray processed!", NULL); + + /* In this example the special pointer #ft_comment is used to + use the existing comment in the card. + *-/ + card = #ft_headsets(fits, "FILTER", 0, "V", ft_comment); + ++ diff --git a/funtools/fitsy/doc/headtable.html b/funtools/fitsy/doc/headtable.html new file mode 100644 index 0000000..bcb4229 --- /dev/null +++ b/funtools/fitsy/doc/headtable.html @@ -0,0 +1,60 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<TITLE> headtable +</TITLE> +<p> +<!-- pnuts --> <a href="headimage.html">[Previous]</a> <a href="headget.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + + +<A NAME="section-1.1.1"><H3>NAME</H3></A> + +<P> + ft_tableloadhead,ft_tablestorhead,ft_tablefree -Fitsy FITS routines to load + and store <B>FITSTable</B> structures. + +<A NAME="section-1.1.2"><H3>SYNOPSIS</H3></A> + + + +<PRE> +FITSTable ft_tableloadhead(FITSHead fits); +void ft_tablestorhead(FITSHead fits, FITSTable table); +void ft_tablefree(FITSTable table); + + +<P> +</PRE> +<A NAME="section-1.1.3"><H3>PARAMETERS</H3></A> + +<UL> +<P> + <LI> <B>FITSHead fits</B> - Not Documented. + <LI> <B>FITSTable table</B> - Not Documented. + +</UL> +<A NAME="section-1.1.4"><H3>DESCRIPTION</H3></A> + + +<A NAME="section-1.1.4.1"><H4>ft_tableloadhead</H4></A> + +<P> + Allocate and load a <B>FITSTable</B> data structure. + +<A NAME="section-1.1.4.2"><H4>ft_tablestorhead</H4></A> + +<P> + Store a <B>FITSTable</B> structure in a FITS header. + +<A NAME="section-1.1.4.3"><H4>ft_tablefree</H4></A> + +<P> + Free a <B>FITSTable</B> structure. + +<p> +<!-- pnuts --> <a href="headimage.html">[Previous]</a> <a href="headget.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/headtable.wu b/funtools/fitsy/doc/headtable.wu new file mode 100644 index 0000000..0c0f42f --- /dev/null +++ b/funtools/fitsy/doc/headtable.wu @@ -0,0 +1,38 @@ +Title: headtable + + +NAME +==== + ft_tableloadhead,ft_tablestorhead,ft_tablefree -Fitsy FITS routines to load + and store #FITSTable structures. + +SYNOPSIS +======== + + +- +FITSTable ft_tableloadhead(FITSHead fits); +void ft_tablestorhead(FITSHead fits, FITSTable table); +void ft_tablefree(FITSTable table); + + +- +PARAMETERS +========== + * #"FITSHead fits" - Not Documented. + * #"FITSTable table" - Not Documented. + +DESCRIPTION +=========== + + ft_tableloadhead + ---------------- + Allocate and load a #FITSTable data structure. + + ft_tablestorhead + ---------------- + Store a #FITSTable structure in a FITS header. + + ft_tablefree + ------------ + Free a #FITSTable structure. diff --git a/funtools/fitsy/doc/imageval.html b/funtools/fitsy/doc/imageval.html new file mode 100644 index 0000000..6811e73 --- /dev/null +++ b/funtools/fitsy/doc/imageval.html @@ -0,0 +1,42 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<p> +<!-- pnuts --> <a href="basicval.html">[Previous]</a> <a href="tableval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + +<A NAME="section-1.1.1"><H3>Image FITS Values</H3></A> + + +<P> + When a FITS header is scanned in memory or read from a file several + image values are retrieved from the header and stored in s <B>FITSImage</B> + structure. This structure may be accesed with the following macros: + +<PRE> + #define <B>ft_hasbscale</B>(fits) ( fits->image->has_bscale ) + #define <B>ft_bscale</B>(fits) ( fits->image->bscale ) + #define <B>ft_hasbzero</B>(fits) ( fits->image->has_bzero ) + #define <B>ft_bzero</B>(fits) ( fits->image->bzero ) + #define <B>ft_hasblank</B>(fits) ( fits->image->has_blank ) + #define <B>ft_blank</B>(fits) ( fits->image->blank ) + + typedef struct <B>FITSImage</B> { + int has_bscale; + int bscale; + int has_bzero; + int bzero; + + int has_blank; + int blank; + } <B>*FITSImage</B>; +<P> +</PRE> + + +<p> +<!-- pnuts --> <a href="basicval.html">[Previous]</a> <a href="tableval.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/imageval.wu b/funtools/fitsy/doc/imageval.wu new file mode 100644 index 0000000..e5ab468 --- /dev/null +++ b/funtools/fitsy/doc/imageval.wu @@ -0,0 +1,27 @@ + +Image FITS Values +================= + + When a FITS header is scanned in memory or read from a file several + image values are retrieved from the header and stored in s #FITSImage + structure. This structure may be accesed with the following macros: + ++ + ##define #ft_hasbscale(fits) ( fits->image->has_bscale ) + ##define #ft_bscale(fits) ( fits->image->bscale ) + ##define #ft_hasbzero(fits) ( fits->image->has_bzero ) + ##define #ft_bzero(fits) ( fits->image->bzero ) + ##define #ft_hasblank(fits) ( fits->image->has_blank ) + ##define #ft_blank(fits) ( fits->image->blank ) + + typedef struct #FITSImage { + int has_bscale; + int bscale; + int has_bzero; + int bzero; + + int has_blank; + int blank; + } #"*FITSImage"; ++ + diff --git a/funtools/fitsy/doc/makefile-sao b/funtools/fitsy/doc/makefile-sao new file mode 100644 index 0000000..6f33d5e --- /dev/null +++ b/funtools/fitsy/doc/makefile-sao @@ -0,0 +1,51 @@ +SHELL = /bin/sh + +WU = cardpar.wu \ + cardfmt.wu \ + cardins.wu \ + cardfind.wu \ + headget.wu \ + headset.wu \ + headins.wu \ + headinit.wu \ + headdata.wu \ + headfind.wu \ + headfile.wu \ + headimage.wu \ + headtable.wu \ + dataimage.wu \ + fitsimage.wu + +HTML = fitsy.html \ + basicval.html \ + imageval.html \ + tableval.html \ + cardpar.html \ + cardfmt.html \ + cardins.html \ + cardfind.html \ + headinit.html \ + headdata.html \ + headfile.html \ + headget.html \ + headset.html \ + headins.html \ + headfind.html \ + headimage.html \ + headtable.html \ + dataimage.html \ + fitsimage.html + +doc: html + +clean: + rm -f core *.a *.o *.bak $(WU) $(HTML) + +mostlyclean: clean + +html: + wu srcdir=../ pnuts=fitsy.pnuts $(HTML) + + +include $(MMTIMAKEFILE) + diff --git a/funtools/fitsy/doc/tableval.html b/funtools/fitsy/doc/tableval.html new file mode 100644 index 0000000..b069502 --- /dev/null +++ b/funtools/fitsy/doc/tableval.html @@ -0,0 +1,56 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<p> +<!-- pnuts --> <a href="imageval.html">[Previous]</a> <a href="headimage.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +<META NAME="generator" CONTENT="txt2html v1.3"> +</HEAD> +<BODY> + +<A NAME="section-1.1.1"><H3>Table FITS Values</H3></A> + + +<P> + When a FITS header is scanned in memory or read from a file several + table values are retrieved from the header and stored in the <B>FITSTable.</B> + This structure may be accesed with the following macros: + +<PRE> + typedef struct <B>FITSTCol</B> { + int type; + int n; + int size; + int width; + int offset; + char *format; + + int heap; + + char *name; + char *unit; + char *disp; + + int prec; + + int has_scale; + double scale; + int has_zero; + double zero; + + int has_blank; + char *ablank; + double dblank; + } <B>*FITSTCol</B>; + + typedef struct <B>FITSTable</B> { + int tabtype; /* TABLE or BINTABLE */ + int tfields; /* # of fields */ + FITSTCol col; /* Column pointers */ + } <B>*FITSTable</B>; +<P> +</PRE> + +<p> +<!-- pnuts --> <a href="imageval.html">[Previous]</a> <a href="headimage.html">[Next]</a> <a href="fitsy.html">[Up]</a> <a href="../mmtilib.html">[Top]</a> +</BODY> +</HTML> diff --git a/funtools/fitsy/doc/tableval.wu b/funtools/fitsy/doc/tableval.wu new file mode 100644 index 0000000..ae5ff39 --- /dev/null +++ b/funtools/fitsy/doc/tableval.wu @@ -0,0 +1,41 @@ + +Table FITS Values +================= + + When a FITS header is scanned in memory or read from a file several + table values are retrieved from the header and stored in the #FITSTable. + This structure may be accesed with the following macros: + ++ + typedef struct #FITSTCol { + int type; + int n; + int size; + int width; + int offset; + char *format; + + int heap; + + char *name; + char *unit; + char *disp; + + int prec; + + int has_scale; + double scale; + int has_zero; + double zero; + + int has_blank; + char *ablank; + double dblank; + } #"*FITSTCol"; + + typedef struct #FITSTable { + int tabtype; /* TABLE or BINTABLE */ + int tfields; /* # of fields */ + FITSTCol col; /* Column pointers */ + } #"*FITSTable"; ++ diff --git a/funtools/fitsy/fitsfile.c b/funtools/fitsy/fitsfile.c new file mode 100644 index 0000000..035726c --- /dev/null +++ b/funtools/fitsy/fitsfile.c @@ -0,0 +1,65 @@ +/* Fitsy FITS routines to handle a complete multi extension FITS file. + */ + +typedef struct Ft_fileread { + int n; + int flag; + int pixtype; +} Ft_fileread; + +ft_fileimageread(file, fits, data, x) + File file; + FITSHead fits; + FITSFile *data; + Ft_fileread *x; +{ + int size; + + (void)ReAlloc(*data, sizeof(struct FITSFile) * ++x->n); + + (*data)[x->n-1].bitpix = x->pixtype; + + if ( x->flag || ft_seek(fits) == -1 ) { + if ( ((*data)[x->n-1].data = ft_dataread(file, fits, NULL, x->pixtype)) + == NULL ) { + return 0; + } + } +} + +/* Read an entire FITS file. + */ +FITSFile ft_fileread(file, flag, pixtype, n) + File file; + int flag; + int pixtype; + int *n; +{ + Ft_fileread x; + FITSFile data; + + x.n = 0; + x.flag = flag; + x.pixtype = pixtype; + + data = (FITSFile) ft_fileparse(file, ft_fileimageread, &x); + *n = x.n; + + return data; +} + +/* Return a pointer the data poriton of a FITS HDU. + */ +void *ft_filedata(file, ft) + File file; + FITSFile ft; +{ + if ( ft->data != NULL ) return ft->data; + if ( ft_seek(ft->head) == -1 ) return NULL; + + if ( ftSeek(file, ft_seek(ft->head), 0) == -1 ) + return NULL; + + return ft->data = ft_dataread(file, ft->head, NULL, ft->bitpix); +} + diff --git a/funtools/fitsy/fitshead.c b/funtools/fitsy/fitshead.c new file mode 100644 index 0000000..01dfea2 --- /dev/null +++ b/funtools/fitsy/fitshead.c @@ -0,0 +1,483 @@ +/* Fitsy FITS routines to read and write FITS headers. + */ + +#include <xos.h> +#include "fitsy.h" + +#define MAX_COPY 1024 +static int ncopy_file=0; +static File copy_files[MAX_COPY]; + +static int GetWordType(fptr, tbuf, cflag) + char **fptr; + char *tbuf; + int *cflag; +{ + int alpha, digit, other, got; + char *f, *t; + + /* start out clean */ + *tbuf = '\0'; + + /* gather up characters until we have a delim */ + for(got=0, alpha=0, digit=0, other=0, f=*fptr, *tbuf='\0', t=tbuf; + (*f!='\0') && (*f!=',') && (*f!=']'); + got++){ + if( isdigit((unsigned int)*f) ){ + digit++; + *t++ = *f++; + } + else if( isalpha((unsigned int)*f) || (*f == '_') || (*f == '$') ){ + alpha++; + *t++ = *f++; + } + /* special case: extension or index ending with '+' means copy extension */ + else if( (*f=='+') && ((*(f+1)=='\0') || (*(f+1)==',') || (*(f+1)==']')) ){ + /* don't add '+' to output, but inc past it in input */ + f++; + /* we got the 'copy extension' flag */ + *cflag = 1; + } + else{ + /* - might be part of an extension */ + if( (*f=='-') && got && !other ) + alpha++; + else + other++; + *t++ = *f++; + } + } + /* null terminate working string */ + *t = '\0'; + + /* update pointer */ + *fptr = f; + + /* determine what sort of beast we have and return */ + if( got == 0 ) + return(0); + else if( other >0 ) + return(3); + else if( (digit>0) && (alpha==0) ) + return(2); + else + return(1); +} + + +/* + * + * ft_parsefilename -- break a string into name, extension, index, tail + * The possibilities are: + * + * name[extn], name[extn,index], name[index] + * name[extn,tail], name[extn,index,tail], name[index,tail] + * + * where: + * extn is composed of alphanumerics, index is numeric, tail is anything + * and commas are separators. + * + * returns 1 if 'copy flag' was set (+extn, extn+, +index, index+), else 0 + * + * + */ +int ft_parsefilename(filename, name, extn, nmaxlen, indx, tail, tmaxlen) + char *filename; + char *name; + char *extn; + int nmaxlen; + int *indx; + char *tail; + int tmaxlen; +{ + char *f, *t; + char *tbuf, *tbuf2; + int i, len; + int got; + int cflag; + + /* start out clean */ + *extn = '\0'; + *indx = -1; + *tail = '\0'; + cflag = 0; + + /* make sure we have something to work with */ + if( (filename == NULL) || (*filename == '\0') ) + return 0; + + /* handle pipe: specification specially */ + if( !strncasecmp(filename, "pipe:", 5) ){ + strncpy(name, filename, nmaxlen); + return 0; + } + + /* basic work buffers */ + tbuf = (char *)malloc(strlen(filename)+1); + tbuf2 = (char *)malloc(strlen(filename)+1); + + /* this will be our pointer into the filename buffer */ + f = filename; + + /* maxlen generally is 1 more than we can handle */ + nmaxlen--; + tmaxlen--; + + /* gather up the name */ + for(*tbuf='\0', t=tbuf; (*f!='\0') && (*f!='[') && (*f!=','); ) + *t++ = *f++; + /* null terminate working string */ + *t = '\0'; + /* copy max from the work buffer to the name buffer */ + strncpy(name, tbuf, nmaxlen); + name[nmaxlen] = '\0'; + /* check for done */ + if( *f == '\0' ) + goto cleanup; + /* or skip past '[' delim following the name */ + else + f++; + + /* get token and process type */ + switch(GetWordType(&f, tbuf, &cflag)){ + /* EOF */ + case 0: + break; + /* extn */ + case 1: + strcpy(extn, tbuf); + *tbuf = '\0'; + if( *f == ',' ){ + f++; + switch(GetWordType(&f, tbuf, &cflag)){ + case 2: + *indx = strtol(tbuf, NULL, 10); + *tbuf = '\0'; + if( *f == ',' ) + f++; + break; + default: + break; + } + } + break; + /* index */ + case 2: + *indx = strtol(tbuf, NULL, 10); + *tbuf = '\0'; + if( *f == ',' ) + f++; + break; + /* tail */ + case 3: + break; + } + + /* at this point, we are processing tail */ + strcpy(tbuf2, "["); + if( *tbuf != '\0' ) + strcat(tbuf2, tbuf); + if( *f != '\0' ) + strcat(tbuf2, f); + strncpy(tail, tbuf2, tmaxlen); + tail[tmaxlen] = '\0'; + /* get rid of any empty brackets */ + len = strlen(tail); + for(i=0; i<len; i++){ + if( (tail[i] == '[') && (i+2 < len) && (tail[i+1] == ']') ){ + strcpy(tbuf, &(tail[i+2])); + strcpy(&(tail[i]), tbuf); + } + } + /* but don't bother passing back completely null brackets */ + len = strlen(tail); + for(got=0, i=0; i<len; i++){ + if( (tail[i] != '[') && (tail[i] != ']') && (tail[i] != ' ') ){ + got = 1; + break; + } + } + if( !got ) *tail = '\0'; + + /* clean up */ +cleanup: + if( tbuf != NULL ) + free(tbuf); + if( tbuf2 != NULL ) + free(tbuf2); + return cflag; +} + +/* + * + * ft_cfile -- change the static copy_file handle + * This is used to set/unset the copy handle for when we open a fits file + * (There is no other good place to store this copy handle!) + * returns: old handle + * + */ +int ft_cfile(cfile) + File cfile; +{ + if( cfile ){ + if( ncopy_file >= MAX_COPY ) return -1; + copy_files[ncopy_file++] = cfile; + } + else{ + ncopy_file = 0; + } + return ncopy_file; +} + +/* Read a FITS header from the named file -- primitive of ft_fitsheadopen() + */ +File ft_fitsheadread(file, filename, header, mode, iline, ifd) + File file; + char *filename; /* FITS image file name. */ + FITSHead *header; + char *mode; + char iline[FT_CARDLEN]; + File *ifd; +{ + FITSHead prim = NULL; + FITSHead head = NULL; + char name[FT_FILENAME]; + char extn[FT_FILENAME]; + char tail[FT_FILENAME]; + char tbuf[FT_CARDLEN]; + char *e; + char *i; + char *tptr; + int indx = 0; + int len = FT_FILENAME; + int tlen; + int n; + int nc; + static int vlaerr=0; + + /* if the user called the wrong routine, fix it */ + if( !file ) return NULL; + + /* initialize return values */ + if( iline ) iline[0] = '\0'; + if( ifd ) *ifd = file; + + /* parse filename into extension, index, and tail */ + ft_parsefilename(filename, name, extn, len, &indx, tail, len); + + /* make sure this is a FITS file by looking at the first card */ + tptr = (iline ? iline : tbuf); + if( ( !ftGets(file, tptr, 10) ) || + (strncmp(tptr, "SIMPLE =", 9) && strncmp(tptr, "XTENSION=", 9)) ){ + /* pass back opened file so someone else can make an attempt */ + if( !ifd ) ftClose(file); + return NULL; + } + tlen = strlen(tptr); + if( ftRead(file, &tptr[tlen], FT_CARDLEN-tlen, 1) != 1 ){ + /* pass back opened file so someone else can make an attempt */ + if( !ifd ) ftClose(file); + return NULL; + } + + /* don't return anything anymore, both ifd and line were used already */ + if( iline ){ + memcpy(tbuf, iline, FT_CARDLEN); + iline[0] = '\0'; + } + if( ifd ) *ifd = NULL; + + /* read primary header */ + if ( (prim = ft_headread0(file, tbuf, FT_CARDLEN)) == NULL ){ + ftClose(file); + return NULL; + } + + /* Only look in the environment if the primary header + has no data and the user hasn't specified any thing + in the brackets. + */ + if ( ft_databytes(prim) == 0 && !*extn && indx == -1 ) { + if ( (e = (char *)getenv("FITS_EXTNAME")) ) { + strncpy(extn, e, len); + extn[len-1] = '\0'; + } + if ( (i = (char *)getenv("FITS_EXTNUM")) ) { + indx = atoi(i); + } + } + + head = prim; + if ( *extn ) { /* Extension and possible an index */ + do { + char *ext=NULL; + char *extcopy=(char *)strdup(extn); + for(ext=(char *)strtok(extcopy," :;,"); + ext!=NULL; + ext=(char *)strtok(NULL," :;,")){ + /* look for extname, then hduname, along with indx */ + if ( ((ft_name(head) && *ft_name(head) && + !strcasecmp(ext, ft_name(head))) || + (ft_hduname(head) && *ft_hduname(head) && + !strcasecmp(ext, ft_hduname(head)))) && + (indx == -1 || indx == ft_extn(head)) ) + break; + } + if( extcopy ) + free(extcopy); + /* if we matched an extension, we are done */ + if( ext ) + break; + + /* copy header, if necessary */ + if( ncopy_file ){ + for(nc=0; nc<ncopy_file; nc++) + ft_headwrite(copy_files[nc], head); + } + /* skip data, copying header if necessary */ + ft_dataskip(file, head, copy_files, ncopy_file); + + if ( head != prim ) ft_headfree(head, 1); + } while ( (head = ft_headread(file)) ); + + if ( !head ) { + ft_headfree(prim, 1); + ftClose(file); + return NULL; + } + } else if ( indx > 0 ) { /* Extension index, not == 0 */ + int i; + + /* copy header, if necessary */ + if( ncopy_file ){ + for(nc=0; nc<ncopy_file; nc++) + ft_headwrite(copy_files[nc], head); + } + ft_dataskip(file, prim, copy_files, ncopy_file); + + for ( i = 1; i <= indx; i++ ) { + if ( (head = ft_headread(file)) == NULL ) { + ft_headfree(prim, 1); + ftClose(file); + return NULL; + } + if( i != indx ){ + /* copy header, if necessary */ + if( ncopy_file ){ + for(nc=0; nc<ncopy_file; nc++) + ft_headwrite(copy_files[nc], head); + } + /* skip data, copying header if necessary */ + ft_dataskip(file, head, copy_files, ncopy_file); + ft_headfree(head, 1); + } + } + } + + if ( head != prim ){ + ft_primlink(prim, head); /* Link the primary to the header */ + /* this primary header only exists as part of head */ + prim->rfcount = 1; + } + + /* if this is a table and contains a variable length array, issue wanring */ + if( head && head->table && !vlaerr ){ + for ( n = 1; n <= head->table->tfields; n++ ) { + if ( head->table->col[n-1].vla ){ + fprintf(stderr, + "WARNING: The 'variable length array' is not part of the FITS Bintable standard. "); + fprintf(stderr, + "Funtools will pass it along, but will not process it.\n"); + vlaerr++; + break; + } + } + } + + if( header != NULL ){ + *header = head; + } + + return file; +} + +/* Read a FITS header from the named file. + */ +File ft_fitsheadopen(filename, header, tail, len, mode) + char *filename; /* FITS image file name. */ + FITSHead *header; + char *tail; + int len; + char *mode; +{ + return ft_fitsheadopenfd(filename, header, tail, len, mode, NULL, + NULL, NULL); +} + +/* Read a FITS header from the named file. + */ +File ft_fitsheadopenfd(filename, header, tail, len, mode, file, iline, ifd) + char *filename; /* FITS image file name. */ + FITSHead *header; + char *tail; + int len; + char *mode; + File file; + char iline[FT_CARDLEN]; + File *ifd; +{ + char *xmode; + char name[FT_FILENAME]; + char extn[FT_FILENAME]; + int indx = 0; + int cflag; + + /* initialize return values */ + if( iline ) iline[0] = '\0'; + if( ifd ) *ifd = NULL; + + /* parse filename into extension, index, and tail */ + cflag = ft_parsefilename(filename, name, extn, FT_FILENAME, &indx, + tail, len); + + /* set mode or use 'r' as default */ + if( mode ){ + xmode = mode; + } + else + xmode = "r"; + + /* see if 'CopyExtension' mode was explicitly set in the mode */ + if( strchr(xmode, 'C') ) + cflag = 1; + /* else see if it was set in the section and is permitted by the mode */ + else if( strchr(xmode, 'c') && cflag ) + cflag = 1; + /* else we do not copy */ + else + cflag = 0; + + if( !file ){ + if ( (file = ftOpen(name, xmode)) == NULL ) + return NULL; + } + + /* if the "copy extension" flag was set, we can exit here */ + if( cflag ){ + /* flag header was not created */ + if( header ) + *header = NULL; + return file; + } + + /* now read the file up to the specified extension */ + file = ft_fitsheadread(file, filename, header, xmode, iline, ifd); + + /* save filename */ + if( file && header && *header && *name ){ + if( (*header)->filename ) (void)Free((*header)->filename); + (*header)->filename = strdup(name); + } + + return file; +} diff --git a/funtools/fitsy/fitsimage.c b/funtools/fitsy/fitsimage.c new file mode 100644 index 0000000..516f7e1 --- /dev/null +++ b/funtools/fitsy/fitsimage.c @@ -0,0 +1,392 @@ +/* Fitsy FITS routines to read and write FITS images. + */ + +#include <xos.h> +#include <fcntl.h> +#include "fitsy.h" + +#include <sys/types.h> +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif +#include <sys/stat.h> + +#ifdef HAVE_SYS_IPC_H +#include <sys/ipc.h> +#endif +#ifdef HAVE_SYS_SHM_H +#include <sys/shm.h> +#endif + +/* int close PROTOTYPE((int)); */ + +int ft_indxmemdata PROTOTYPE(( + char *data, /* Pointer to FITS */ + int size, + int type, /* Type of memory */ + char *extn, + int indx, + FITSHead *headptr, /* Returned pointer to FITS header */ + void **dataptr, /* Returned pointer to FITS data. */ + void ***data2dptr /* Returned edge vector to data. */)); + +/* changed name to add _ to avoid conflict with param lib egm 4/25/00 */ +int _filesize(file) + int file; +{ + struct stat info; + + if ( fstat(file, &info) < 0 ) return 0; + else return info.st_size; +} + +#ifdef HAVE_SYS_MMAN_H +int ft_munmap(head) + FITSHead head; +{ + return munmap((caddr_t) head->mmap_here, head->mmap_size); +} +#endif + +#ifdef HAVE_SYS_SHM_H +int ft_shmdt(head) + FITSHead head; +{ + return shmdt((caddr_t) head->mmap_here); +} +#endif + +#ifdef HAVE_SYS_SHM_H +/* Attach a FITS image from shared memory. + */ + +int ft_simpleimageshm(filename, headptr, dataptr, data2dptr, size, flags) + char *filename; + FITSHead *headptr; /* Returned pointer to FITS header */ + void **dataptr; /* Returned pointer to FITS data. */ + void ***data2dptr; /* Returned edge vector to data. */ + int size; + int flags; +{ + char name[FT_FILENAME]; + char extn[FT_FILENAME]; + int indx = 0; + + char tail[FT_FILENAME]; + int max = FT_FILENAME; + + int shkey; + char *data; + + char *isize; + + ft_parsefilename(filename, name, extn, max, &indx, tail, max); + + if ( size == 0 && (isize = strstr(tail, "size=")) ) size = atoi(isize+5); + + /* Attach the memory segment + */ + shkey = shmget(atoi(name), size, flags); + data = (void *) shmat(shkey, 0, 0); + + return ft_indxmemdata(data, size, FT_SHMAT, extn, indx, headptr, dataptr, data2dptr); +} +#endif + +#ifdef HAVE_SYS_MMAN_H +/* MMap a FITS image from the named file. + */ +int ft_simpleimagemmap(filename, headptr, dataptr, data2dptr, prot, share) + char *filename; /* FITS image file name. */ + FITSHead *headptr; /* Returned pointer to FITS header */ + void **dataptr; /* Returned pointer to FITS data. */ + void ***data2dptr; /* Returned edge vector to data. */ + int prot; /* Mapped data protections */ + int share; /* Mapped data attributes */ +{ + int file; + + char name[FT_FILENAME]; + char extn[FT_FILENAME]; + int indx = 0; + + char tail[FT_FILENAME]; + int max = FT_FILENAME; + + char *data; + int size; + int mode; + + ft_parsefilename(filename, name, extn, max, &indx, tail, max); + + if ( prot & PROT_WRITE ) { + mode = O_RDWR; + } else { + mode = O_RDONLY; + } + + if ( (file = open(name, mode)) == -1) { + if ( headptr ) *headptr = NULL; + if ( data2dptr ) *data2dptr = NULL; + + return 0; + } + + /* Map the file. + */ + size = _filesize(file); + data = (char *) mmap(NULL, size, prot, share, file, 0); + close(file); + + if ( data == (char *)-1 ) return 0; + + return ft_indxmemdata(data, size, FT_MMAP, extn, indx, headptr, dataptr, data2dptr); +} +#endif + +#if defined(HAVE_SYS_SHM_H) || defined(HAVE_SYS_MMAN_H) +int ft_indxmemdata(data, size, type, extn, indx, headptr, dataptr, data2dptr) + char *data; /* Pointer to FITS */ + int size; + int type; /* Type of memory */ + char *extn; + int indx; + FITSHead *headptr; /* Returned pointer to FITS header */ + void **dataptr; /* Returned pointer to FITS data. */ + void ***data2dptr; /* Returned edge vector to data. */ +{ + FITSHead head = NULL; + + char *here = (char *) data; + void *mapdata = data; + int mapsize = size; + + if ( *extn ) { + while ( (head = ft_headinit(here, size)) && size >= FT_BLOCK ) { + if ( !strcmp(extn, ft_name(head)) + && (indx == -1 || indx == ft_extn(head)) ) break; + here += ft_data(head) + ft_databloks(head) * FT_BLOCK; + size -= ft_data(head) + ft_databloks(head) * FT_BLOCK; + ft_headfree(head, 0); + } + } else if ( indx > 0 ) { + int i; + + for ( i = 0; i < indx && size >= FT_BLOCK; i++ ) { + head = ft_headinit(here, size); + if( !head ){ + if ( headptr ) *headptr = NULL; + if ( data2dptr ) *data2dptr = NULL; + + return 0; + } + here += ft_data(head) + ft_databloks(head) * FT_BLOCK; + size -= ft_data(head) + ft_databloks(head) * FT_BLOCK; + ft_headfree(head, 0); + } + head = ft_headinit(here, size); + data = here + ft_data(head); + + } else { + head = ft_headinit(data, size); + data = here + ft_data(head); + } + + if ( head == NULL ) { + switch(type){ +#ifdef HAVE_SYS_MMAN_H + case FT_MMAP: + munmap(data, mapsize); + break; +#endif +#ifdef HAVE_SYS_SHM_H + case FT_SHMAT: + shmdt(mapdata); + break; +#endif + default: + break; + } + return 0; + } + + head->mem = type; + head->mmap_here = mapdata; + head->mmap_size = mapsize; + + if ( dataptr != NULL ) *dataptr = data; + if ( data2dptr != NULL ) { + *data2dptr = (void **) ft_make2d((void *) data + , Abs(ft_bitpix(head))/8 + , 0, 0 + , ft_naxis(head, 1) + , ft_naxis(head, 2)); + } + if ( headptr != NULL ) { + *headptr = head; + } else { + ft_headfree(head, 0); + } + + return 1; +} +#endif + +/* Read a FITS image from the named file. + */ +int ft_simpleimageread(filename, headptr, dataptr, data2dptr, pixtype) + char *filename; /* FITS image file name. */ + FITSHead *headptr; /* Returned pointer to FITS header */ + void **dataptr; /* Returned pointer to FITS data. */ + void ***data2dptr; /* Returned edge vector to data. */ + int pixtype; /* pixtype to convert data to. */ +{ + FITSHead head = NULL; + File file; + int ret = 1; + + char name[FT_FILENAME]; + char extn[FT_FILENAME]; + int indx = 0; + + char tail[FT_FILENAME]; + int max = FT_FILENAME; + + ft_parsefilename(filename, name, extn, max, &indx, tail, max); + + if ( (file = ftOpen(name, "r")) == NULL ) { + if ( headptr ) *headptr = NULL; + if ( data2dptr ) *data2dptr = NULL; + + return 0; + } + + if ( *extn ) { + while ( (head = ft_headread(file)) ) { + if ( !strcmp(extn, ft_name(head)) + && (indx == -1 || indx == ft_extn(head)) ) break; + ft_dataskip(file, head, NULL, 0); + ft_headfree(head, 1); + } + } else if ( indx > 0 ) { + int i; + + for ( i = 0; i < indx; i++ ) { + head = ft_headread(file); + if( !head ){ + if ( headptr ) *headptr = NULL; + if ( data2dptr ) *data2dptr = NULL; + + return 0; + } + ft_dataskip(file, head, NULL, 0); + ft_headfree(head, 1); + } + head = NULL; + } + + ret = ft_imageread(file, &head, dataptr, data2dptr, pixtype); + if ( headptr ){ + *headptr = head; + if( *name && *headptr ) (*headptr)->filename = strdup(name); + } + else{ + ft_headfree(head, 1); + } + ftClose(file); + + return ret; +} + +/* Write a FITS image to a named file. + */ +int ft_simpleimagewrite(filename, fits, data, pixtype) + char *filename; + FITSHead fits; /* FITS header to write. */ + void *data; /* Data to write into FITS file. */ + int pixtype; +{ + File file; + FITSHead prim; + + if ( fits == NULL ) return 0; + + file = ftOpen(filename, "wb"); + + if (file == NULL) { + return 0; + } + + prim = ft_primary(fits); + + ft_imagewrite(file, prim, data, pixtype); + ftClose(file); + + ft_headfree(prim, 1); + return 1; +} + +/* Read a FITS image from a file pointer. + */ +int ft_imageread(file, headptr, dataptr, data2dptr, pixtype) + File file; /* File pointer to read header and data from.*/ + FITSHead *headptr; + void **dataptr; + void ***data2dptr; + int pixtype; +{ + FITSHead fits; + float *data = NULL; + + if ( file == NULL ) return 0; + + if ( headptr == NULL || *headptr == NULL ) { + if ( (fits = ft_headread(file)) == NULL ) return 0; + } else fits = *headptr; + + if ( dataptr ) data = *dataptr; + if ( data2dptr ) *data2dptr = NULL; + + + if ( (data = ft_dataread(file, fits, data, pixtype)) == NULL ) { + if ( !headptr ) ft_headfree(fits, 1); + return 0; + } + + if ( headptr != NULL ) { + *headptr = fits; + } + + if ( dataptr != NULL ) { + *dataptr = data; + } + + if ( data2dptr != NULL ) { + *data2dptr = (void **) ft_make2d((void *) data + , Abs(pixtype)/8 + , 0, 0 + , ft_naxis(fits, 1) + , ft_naxis(fits, 2)); + } + + return 1; +} + + +/* Write a FITS image to a file. + */ +int ft_imagewrite(file, fits, data, pixtype) + File file; + FITSHead fits; + void *data; + int pixtype; +{ + if ( file == NULL ) return 0; + + ft_syncdata(fits); + if ( ft_headwrite(file, fits) == 0 ) return 0; + if ( ft_datawrite(file, fits, data, pixtype) == 0 ) return 0; + + return 1; +} + diff --git a/funtools/fitsy/fitsy.h b/funtools/fitsy/fitsy.h new file mode 100644 index 0000000..182be0e --- /dev/null +++ b/funtools/fitsy/fitsy.h @@ -0,0 +1,393 @@ +/* Fitsy FITS Image Library. + */ + +#ifndef FITSY_H +#define FITSY_H + +#if HAVE_CONFIG_H +#include "conf.h" +#endif + +#if USE_XFILEIO +#include "xfileio.h" +#else +#include "xfile.h" +#endif + +#ifdef __STDC__ +#define PROTOTYPE(X) X +#else +#define PROTOTYPE(X) ( ) +#endif + +#ifndef UNUSED +#ifdef __GNUC__ +# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) +#else +# define UNUSED(x) UNUSED_ ## x +#endif +#endif + +#ifdef HAVE_STRING_H +#include <string.h> +#endif + +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#include <ctype.h> + +#include "longlong.h" + +#ifndef NULL +#define NULL 0 +#endif + +#define FT_BITS 23040 +#define FT_BLOCK 2880 +#define FT_CARDLEN 80 +#define FT_WORDLEN 8 +#define FT_CARDS (FT_BLOCK/FT_CARDLEN) + +#define FT_UNSIGNED 0x1000 +#define FT_BITPIX -1 + +#define FT_FILENAME 4096 +#define FT_MAXAXES 10 + +#define ft_fitsbloks(bytes) ((bytes+(FT_BLOCK-1))/FT_BLOCK) + +/* Card memory types + */ +#define FT_MALLOC 1 +#define FT_MMAP 2 +#define FT_SHMAT 3 +#define FT_EXTERN 4 + +typedef enum { + FT_UNKNOWN = 0 + , FT_COMMENT + , FT_LOGICAL + , FT_INTEGER + , FT_STRING + , FT_VALUE + , FT_REAL + , FT_COMPLEX + , FT_LONG +} FITSType; + +typedef struct _FITSBuff { + char c[FT_CARDLEN]; +} FITSBuff; + +typedef FITSBuff *FITSCard; + +extern char *FT_Comment; + +#define ft_simple(fits) ( fits->basic->simple ) +#define ft_name(fits) ( fits->basic->name ) +#define ft_hduname(fits) ( fits->basic->hduname ) +#define ft_extn(fits) ( fits->basic->extn ) +#define ft_bitpix(fits) ( fits->basic->bitpix ) +#define ft_naxes(fits) ( fits->basic->naxes ) +#define ft_naxis(fits, i) ( fits->basic->naxis[i-1]) +#define ft_pcount(fits) ( fits->basic->pcount ) +#define ft_gcount(fits) ( fits->basic->gcount ) +#define ft_databytes(fits) ( fits->basic->databytes) +#define ft_datapixls(fits) ( fits->basic->datapixls) +#define ft_databloks(fits) ( fits->basic->databloks) +#define ft_rowbytes(fits) ( fits->basic->row_bytes) + +typedef struct _FITSBasic { + int simple; + char *name; + char *hduname; + int extn; + + int bitpix; + int naxes; + int naxis[FT_MAXAXES]; + + int gcount; + int pcount; + + size_t databytes; + int datapixls; + size_t databloks; + int row_bytes; +} *FITSBasic; + + +#define ft_hasbscale(fits) ( fits->image->has_bscale ) +#define ft_bscale(fits) ( fits->image->dbscale ) +#define ft_hasbzero(fits) ( fits->image->has_bzero ) +#define ft_bzero(fits) ( fits->image->dbzero ) +#define ft_hasscaling(fits) ( fits->image->has_bzero || fits->image->has_bscale ) +#define ft_hasblank(fits) ( fits->image->has_blank ) +#define ft_blank(fits) ( fits->image->blank ) + +typedef struct _FITSLinWCS { + int has_wcs; + + double fwd[3][2]; + double rev[3][2]; +} *FITSLinWCS; + +#define ft_phy2img(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->log, x0, y0, x1, y1, 1) +#define ft_img2phy(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->log, x0, y0, x1, y1, 0) +#define ft_phy2amp(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->amp, x0, y0, x1, y1, 1) +#define ft_amp2phy(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->amp, x0, y0, x1, y1, 0) +#define ft_phy2det(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->det, x0, y0, x1, y1, 1) +#define ft_det2phy(fits, x0, y0, x1, y1) ft_trxlcs(&fits->image->det, x0, y0, x1, y1, 0) + +#define ft_phy2img_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->log, x0, y0, x1, y1, 1) +#define ft_img2phy_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->log, x0, y0, x1, y1, 0) +#define ft_phy2amp_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->amp, x0, y0, x1, y1, 1) +#define ft_amp2phy_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->amp, x0, y0, x1, y1, 0) +#define ft_phy2det_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->det, x0, y0, x1, y1, 1) +#define ft_det2phy_size(fits, x0, y0, x1, y1) ft_trxsiz(&fits->image->det, x0, y0, x1, y1, 0) + +typedef struct _FITSImage { + int has_bscale; + double dbscale; + int has_bzero; + double dbzero; + + int has_blank; + int blank; + + struct _FITSLinWCS log; + struct _FITSLinWCS det; + struct _FITSLinWCS amp; +} *FITSImage; + +typedef struct _FITSTCol { + int type; + int n; + int size; + int width; + int offset; + char *format; + + char *vla; + int vla_type; + int vla_max; + + int heap; + + char *name; + char *unit; + char *disp; + + int prec; + + int has_scale; + double scale; + int has_zero; + double zero; + int scaled; + + int has_blank; + char *ablank; + double dblank; +} *FITSTCol; + +typedef struct _FITSTable { + int tabtype; /* TABLE or BINTABLE */ + int tfields; /* # of fields */ + FITSTCol col; /* Column pointers */ +} *FITSTable; + + +#define ft_cards(fits) ( (void *)fits->cards ) +#define ft_data(fits) ( fits->data ) +#define ft_ncards(fits) ( fits->ncard ) +#define ft_cardnth(fits, nth) ( ( nth <= fits->ncard ) \ + ? &fits->cards[nth-1] \ + : NULL ) + +#define ft_last(fits) ft_cardnth(fits, fits->ncard) + +#define ft_byteswap() (*(short *)"\001\000" & 0x0001) +#define ft_seek(fits) ( fits->seek ) + +typedef struct _FITSHead { + FITSCard cards; + FITSCard *index; + FITSCard last; + int acard; + int ncard; + + char *filename; + File file; + + off_t seek; + off_t data; + int step; + + void *cache; + int nbuffers; + int buffrows; + + int mem; + char *mmap_here; + int mmap_size; + + int sync; + + FITSBasic basic; + FITSImage image; + FITSTable table; + + struct _FITSHead*primary; + int rfcount; +} *FITSHead; + +typedef struct _FITSFile { + FITSHead head; + void *data; + int bitpix; +} *FITSFile; + + +#ifdef __cplusplus +extern "C" { +#endif + +/* cardfind.c */ +FITSCard ft_cardfind PROTOTYPE((FITSHead fits, FITSCard key, int add)); +FITSCard ft_cardfindidx PROTOTYPE((FITSHead fits, FITSCard key, int *match)); +FITSCard ft_cardfindseq PROTOTYPE((FITSHead fits, FITSCard key, int *match)); +FITSCard ft_cardfindblok PROTOTYPE((FITSCard cards, FITSCard key, int *match, int *nhist)); +/* cardfmt.c */ +int ft_isblank PROTOTYPE((char *s)); +FITSCard ft_cardfmt PROTOTYPE((FITSCard card, char *name, int n, FITSType type, void *value, int prec, char *comm)); +FITSCard ft_cardkey PROTOTYPE((FITSCard card, char *name, int n)); +FITSCard ft_cardset PROTOTYPE((FITSCard card, FITSType type, void *value, int prec, char *comm)); +FITSCard ft_cardsetl PROTOTYPE((FITSCard card, int lvalue, char *comm)); +FITSCard ft_cardseti PROTOTYPE((FITSCard card, int ivalue, char *comm)); +FITSCard ft_cardsetil PROTOTYPE((FITSCard card, longlong ivalue, char *comm)); +FITSCard ft_cardsetr PROTOTYPE((FITSCard card, double rvalue, int prec, char *comm)); +FITSCard ft_cardsets PROTOTYPE((FITSCard card, char *svalue, char *comm)); +FITSCard ft_cardclr PROTOTYPE((FITSCard card, int ncards)); +FITSCard ft_cardcpy PROTOTYPE((FITSCard card1, FITSCard card2)); +/* cardins.c */ +FITSCard ft_cardins PROTOTYPE((FITSHead fits, FITSCard card, FITSCard here)); +FITSCard ft_cardapp PROTOTYPE((FITSHead fits, FITSCard card)); +FITSCard ft_carddel PROTOTYPE((FITSHead fits, FITSCard card)); +/* cardpar.c */ +char *ft_cardpar PROTOTYPE((FITSCard card, FITSType *type, char *value, int *index, char *comm)); +char *ft_cardget PROTOTYPE((FITSCard card)); +int ft_cardgetl PROTOTYPE((FITSCard card)); +int ft_cardgeti PROTOTYPE((FITSCard card)); +longlong ft_cardgetil PROTOTYPE((FITSCard card)); +double ft_cardgetr PROTOTYPE((FITSCard card)); +char *ft_cardgets PROTOTYPE((FITSCard card)); +/* ftimage.c */ +int ft_shmdt PROTOTYPE((FITSHead fits)); +FITSImage ft_imageloadhead PROTOTYPE((FITSHead fits)); +void ft_imagestorhead PROTOTYPE((FITSHead fits, FITSImage image)); +void ft_imagefree PROTOTYPE((FITSImage image)); +FITSBasic ft_basicloadhead PROTOTYPE((FITSHead fits)); +void ft_basicstorhead PROTOTYPE((FITSHead fits, FITSBasic basic)); +void ft_basicfree PROTOTYPE((FITSBasic basic)); +/* fttable.c */ +FITSTable ft_tableloadhead PROTOTYPE((FITSHead fits)); +void ft_tablestorhead PROTOTYPE((FITSHead fits, FITSTable table)); +void ft_tablefree PROTOTYPE((FITSTable table)); +/* headtable.c */ +int ft_sizeof PROTOTYPE((int type)); +/* headfile.c */ +FITSHead ft_headread0 PROTOTYPE((File file, char *card1, size_t n)); +FITSHead ft_headread PROTOTYPE((File file)); +int ft_headwrite PROTOTYPE((File file, FITSHead fits)); +void *ft_fileparse PROTOTYPE((File ifile, int (*callback)(File ifile, FITSHead fits, void *data, void *cdata1), void *cdata)); +off_t ft_dataskip PROTOTYPE((File ifile, FITSHead fits, File *ofile, int nofile)); +off_t ft_dataseek PROTOTYPE((File file, FITSHead fits)); +void *ft_dataread PROTOTYPE((File file, FITSHead fits, void *dataptr, int pixtype)); +int ft_simpleimageread PROTOTYPE((char *filename, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype)); +int ft_simpleimagemmap PROTOTYPE((char *filename, FITSHead *headptr, void **dataptr, void ***data2dptr, int prot, int share)); +int ft_munmap(FITSHead fits); +int ft_imageread PROTOTYPE((File file, FITSHead *headptr, void **dataptr, void ***data2dptr, int pixtype)); +int ft_simpleimagewrite PROTOTYPE((char *filename, FITSHead fits, void *data, int pixtype)); +int ft_imagewrite PROTOTYPE((File file, FITSHead fits, void *data, int pixtype)); +void *ft_dataswap PROTOTYPE((void *to, void *from, size_t n, int type)); +FITSFile ft_fileread PROTOTYPE((File file, int flag, int pixtype, int *n)); +void *ft_filedata PROTOTYPE((File file, FITSFile ft)); +/* headfind.c */ +FITSCard ft_headfind PROTOTYPE((FITSHead fits, char *name, int n, int add)); +void ft_headindex PROTOTYPE((FITSHead fits)); +FITSCard ft_headfindidx PROTOTYPE((FITSHead fits, char *name, int n, int *match)); +FITSCard ft_headfindseq PROTOTYPE((FITSHead fits, char *name, int n, int *match)); +/* headinit.c */ +FITSHead ft_headinit PROTOTYPE((void *cards, int acard)); +FITSHead ft_headcopy PROTOTYPE((FITSHead fits)); +void ft_primlink PROTOTYPE((FITSHead prim, FITSHead fits)); + +void ft_headfree PROTOTYPE((FITSHead fits, int freecards)); +void ft_setcards PROTOTYPE((FITSHead fits, void *cards)); +/* headins.c */ +FITSCard ft_headinsl PROTOTYPE((FITSHead fits, char *name, int n, int lvalue, char *comm, FITSCard here)); +FITSCard ft_headinsi PROTOTYPE((FITSHead fits, char *name, int n, int ivalue, char *comm, FITSCard here)); +FITSCard ft_headinsr PROTOTYPE((FITSHead fits, char *name, int n, double dvalue, int prec, char *comm, FITSCard here)); +FITSCard ft_headinss PROTOTYPE((FITSHead fits, char *name, int n, char *svalue, char *comm, FITSCard here)); +FITSCard ft_headinsv PROTOTYPE((FITSHead fits, char *name, int n, char *vvalue, char *comm, FITSCard here)); +FITSCard ft_headappl PROTOTYPE((FITSHead fits, char *name, int n, int lvalue, char *comm)); +FITSCard ft_headappi PROTOTYPE((FITSHead fits, char *name, int n, int ivalue, char *comm)); +FITSCard ft_headappil PROTOTYPE((FITSHead fits, char *name, int n, longlong ivalue, char *comm)); +FITSCard ft_headappr PROTOTYPE((FITSHead fits, char *name, int n, double dvalue, int prec, char *comm)); +FITSCard ft_headapps PROTOTYPE((FITSHead fits, char *name, int n, char *svalue, char *comm)); +FITSCard ft_headappv PROTOTYPE((FITSHead fits, char *name, int n, char *vvalue, char *comm)); +FITSCard ft_headdel PROTOTYPE((FITSHead fits, char *name, int n)); +/* headset.c */ +FITSCard ft_headsetl PROTOTYPE((FITSHead fits, char *name, int n, int lvalue, char *comm, int append)); +FITSCard ft_headseti PROTOTYPE((FITSHead fits, char *name, int n, int ivalue, char *comm, int append)); +FITSCard ft_headsetil PROTOTYPE((FITSHead fits, char *name, int n, longlong ivalue, char *comm, int append)); +FITSCard ft_headsetr PROTOTYPE((FITSHead fits, char *name, int n, double rvalue, int prec, char *comm, int append)); +FITSCard ft_headsets PROTOTYPE((FITSHead fits, char *name, int n, char *svalue, char *comm, int append)); +/* headget.c */ +char *ft_headget PROTOTYPE((FITSHead fits, char *name, int n, FITSCard *card)); +int ft_headgetl PROTOTYPE((FITSHead fits, char *name, int n, int ldefault, FITSCard *card)); +int ft_headgeti PROTOTYPE((FITSHead fits, char *name, int n, int idefault, FITSCard *card)); +longlong ft_headgetil PROTOTYPE((FITSHead fits, char *name, int n, longlong idefault, FITSCard *card)); +double ft_headgetr PROTOTYPE((FITSHead fits, char *name, int n, double ddefault, FITSCard *card)); +char *ft_headgets PROTOTYPE((FITSHead fits, char *name, int n, char *sdefault, FITSCard *card)); + +FITSHead ft_primary PROTOTYPE((FITSHead fits)); +FITSHead ft_headmerge PROTOTYPE((FITSHead fits1, FITSHead fits2, int copy)); +void ft_synchead PROTOTYPE((FITSHead fits)); +void ft_syncdata PROTOTYPE((FITSHead fits)); + +void ft_acht PROTOTYPE((int type1, void* v1, int type2, void* v2, int npix, int direction, int hasscale, double dbscale, double dbzero)); + +void ft_acht2 PROTOTYPE((int type1, void* v1, int type2, void* v2, int npix, int swap, int direction)); + +char **ft_make2d PROTOTYPE((char *ptr, int size, int xstar, int ystar, int xsize, int ysize)); +int ft_datawrite PROTOTYPE((File file, FITSHead fits, void *data, int pixtype)); + +/* fitshead.c */ +int ft_parsefilename PROTOTYPE((char *filename, char *name, char *extn, int nmaxlen, int *indx, char *tail, int tmaxlen)); +int ft_cfile PROTOTYPE((File cfile)); +File ft_fitsheadread PROTOTYPE((File file, char *filename, FITSHead *head, char *mode, char *iline, File *ifd)); +File ft_fitsheadopen PROTOTYPE((char *filename, FITSHead *head, char *tail, int size, char *mode)); +File ft_fitsheadopenfd PROTOTYPE((char *filename, FITSHead *head, char *tail, int size, char *mode, File file, char *iline, File *ifd)); + +int ft_inverse PROTOTYPE((double f[3][2], double r[3][2])); + +/* dataimage.c */ +void swap2 PROTOTYPE((char *to, char *from, size_t nbytes)); +void swap4 PROTOTYPE((char *to, char *from, size_t nbytes)); +void swap8 PROTOTYPE((char *to, char *from, size_t nbytes)); + +/* headwcs.c */ +int ft_trxlcs PROTOTYPE((FITSLinWCS lcs, double x0, double y0, + double *x1, double *y1, int direction)); +int ft_trxsiz PROTOTYPE((FITSLinWCS lcs, double x0, double y0, + double *x1, double *y1, int direction)); + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/funtools/fitsy/ftacht.c b/funtools/fitsy/ftacht.c new file mode 100644 index 0000000..b88892f --- /dev/null +++ b/funtools/fitsy/ftacht.c @@ -0,0 +1,112 @@ +/* ft_acht.c +** +** Vector change type operators. +** FITS adds bzero and bascle. +**/ + +#include "xos.h" +#include "fitsy.h" +#include "generic.h" + + +#ifdef __STDC__ +#define achtxx(ch1, type1, ch2, type2) \ + \ +void acht##ch1##ch2(v1, v2, npix, direction, hasscale, bscale, bzero) \ + type1* v1; \ + type2* v2; \ + int npix; \ + int direction; \ + int hasscale; \ + double bscale; \ + double bzero; \ +{ \ + if ( hasscale ) { \ + if ( direction ) { \ + while ( npix-- ) v1[npix] = v2[npix] * bscale + bzero; \ + } else { \ + while ( npix-- ) v1[npix] = (v2[npix] - bzero) / bscale; \ + } \ + } else { \ + while ( npix-- ) v1[npix] = v2[npix]; \ + } \ +} +#else +#define achtxx(ch1, type1, ch2, type2) \ + \ +void acht/**/ch1/**/ch2(v1, v2, npix, direction, hasscale, bscale, bzero)\ + type1* v1; \ + type2* v2; \ + int npix; \ + int direction; \ + int hasscale; \ + double bscale; \ + double bzero; \ +{ \ + if ( hasscale ) { \ + if ( direction ) { \ + while ( npix-- ) v1[npix] = v2[npix] * bscale + bzero; \ + } else { \ + while ( npix-- ) v1[npix] = (v2[npix] - bzero) / bscale; \ + } \ + } else { \ + while ( npix-- ) v1[npix] = v2[npix]; \ + } \ +} +#endif + + +DOUBLE_GENERIC(achtxx) + + +static int pixtype(type) + int type; +{ + switch ( type ) { + case 8: return TY_UCHAR; + case 16: return TY_SHORT; + case 32: return TY_INT; + + case FT_UNSIGNED | 8: return TY_UCHAR; + case FT_UNSIGNED | 16: return TY_USHORT; + case FT_UNSIGNED | 32: return TY_UINT; + + case -32: return TY_REAL; + case -64: return TY_DOUBLE; + } + + return -1; +} + +void ft_acht(type1, v1, type2, v2, npix, direction, hasscale, bscale, bzero) + int type1; + void* v1; + int type2; + void* v2; + int npix; + int direction; + int hasscale; + double bscale; + double bzero; +{ + typedef void (*vector)(); + +static vector matrix[10][10] = { + { achtcc,achtcs,achtci,achtcl,achtcr,achtcd,achtct,achtcu,achtcv } + , { achtsc,achtss,achtsi,achtsl,achtsr,achtsd,achtst,achtsu,achtsv } + , { achtic,achtis,achtii,achtil,achtir,achtid,achtit,achtiu,achtiv } + , { achtlc,achtls,achtli,achtll,achtlr,achtld,achtlt,achtlu,achtlv } + , { achtrc,achtrs,achtri,achtrl,achtrr,achtrd,achtrt,achtru,achtrv } + , { achtdc,achtds,achtdi,achtdl,achtdr,achtdd,achtdt,achtdu,achtdv } + , { achttc,achtts,achtti,achttl,achttr,achttd,achttt,achttu,achttv } + , { achtuc,achtus,achtui,achtul,achtur,achtud,achtut,achtuu,achtuv } + , { achtvc,achtvs,achtvi,achtvl,achtvr,achtvd,achtvt,achtvu,achtvv } +}; + + type1 = pixtype(type1); + type2 = pixtype(type2); + + if ( type1 < 0 || type2 < 0 ) return; + + (*matrix[type1][type2])(v1, v2, npix, direction, hasscale, bscale, bzero); +} diff --git a/funtools/fitsy/ftacht2.c b/funtools/fitsy/ftacht2.c new file mode 100644 index 0000000..a4d2ec3 --- /dev/null +++ b/funtools/fitsy/ftacht2.c @@ -0,0 +1,151 @@ +/* ft_acht2.c +** +** Vector change type operators. +** FITS adds bzero and bascle. +**/ + +#if HAVE_CONFIG_H +#include <conf.h> +#endif +#include "xos.h" +#include "fitsy.h" +#include "longlong.h" +#include "generic.h" + +typedef void (*vector)(); + +#ifdef __STDC__ +#define cht2xx(ch1, type1, ch2, type2) \ + \ +void cht2##ch1##ch2(v1, v2, npix, rtn, direction) \ + void *v1; \ + void *v2; \ + int npix; \ + vector rtn; \ + int direction; \ +{ \ + type1 tval1; \ + type2 tval2; \ + if( direction == 0 ){ \ + while ( npix-- ) { \ + (rtn)(&tval2, (char *)v2+(npix*sizeof(type2)), sizeof(type2)); \ + tval1 = tval2; \ + memcpy((char *)v1+(npix*sizeof(type1)), &tval1, sizeof(type1)); \ + } \ + } \ + else{ \ + while ( npix-- ) { \ + memcpy(&tval2, (char *)v2+(npix*sizeof(type2)), sizeof(type2)); \ + tval1 = tval2; \ + (rtn)((char *)v1+(npix*sizeof(type1)), &tval1, sizeof(type1)); \ + } \ + } \ +} +#else +#define cht2xx(ch1, type1, ch2, type2) \ + \ +void cht2/**/ch1/**/ch2(v1, v2, npix, rtn, direction) \ + void *v1; \ + void *v2; \ + int npix; \ + vector rtn; \ + int direction; \ +{ \ + type1 tval1; \ + type2 tval2; \ + if( direction == 0 ){ \ + while ( npix-- ) { \ + (rtn)(&tval2, (char *)v2+(npix*sizeof(type2)), sizeof(type2)); \ + tval1 = tval2; \ + memcpy((char *)v1+(npix*sizeof(type1)), &tval1, sizeof(type1)); \ + } \ + } \ + else{ \ + while ( npix-- ) { \ + memcpy(&tval2, (char *)v2+(npix*sizeof(type2)), sizeof(type2)); \ + tval1 = tval2; \ + (rtn)((char *)v1+(npix*sizeof(type1)), &tval1, sizeof(type1)); \ + } \ + } \ +} +#endif + +DOUBLE_GENERIC(cht2xx) + +static int pixtype2(type) + int type; +{ + switch ( type ) { + case 'A': return TY_UCHAR; + case 'B': return TY_UCHAR; + case 'X': return TY_UCHAR; + case 'I': return TY_SHORT; + case 'K': return TY_LONG; + case 'U': return TY_USHORT; + case 'J': return TY_INT; + case 'V': return TY_UINT; + case 'L': return TY_UCHAR; + case 'E': return TY_REAL; + case 'D': return TY_DOUBLE; + } + + return -1; +} + +void ft_acht2(type1, v1, type2, v2, npix, swap, direction) + int type1; + void* v1; + int type2; + void* v2; + int npix; + int swap; + int direction; +{ + vector rtn=NULL; + int offset1, offset2, type; + +static vector matrix[10][10] = { + { cht2cc,cht2cs,cht2ci,cht2cl,cht2cr,cht2cd,cht2ct,cht2cu,cht2cv } + , { cht2sc,cht2ss,cht2si,cht2sl,cht2sr,cht2sd,cht2st,cht2su,cht2sv } + , { cht2ic,cht2is,cht2ii,cht2il,cht2ir,cht2id,cht2it,cht2iu,cht2iv } + , { cht2lc,cht2ls,cht2li,cht2ll,cht2lr,cht2ld,cht2lt,cht2lu,cht2lv } + , { cht2rc,cht2rs,cht2ri,cht2rl,cht2rr,cht2rd,cht2rt,cht2ru,cht2rv } + , { cht2dc,cht2ds,cht2di,cht2dl,cht2dr,cht2dd,cht2dt,cht2du,cht2dv } + , { cht2tc,cht2ts,cht2ti,cht2tl,cht2tr,cht2td,cht2tt,cht2tu,cht2tv } + , { cht2uc,cht2us,cht2ui,cht2ul,cht2ur,cht2ud,cht2ut,cht2uu,cht2uv } + , { cht2vc,cht2vs,cht2vi,cht2vl,cht2vr,cht2vd,cht2vt,cht2vu,cht2vv } +}; + + offset1 = pixtype2(type1); + offset2 = pixtype2(type2); + if ( offset1 < 0 || offset2 < 0 ) return; + + if( swap ){ + if( direction == 0 ) + type = type2; + else + type = type1; + switch(ft_sizeof(type)){ + case 1: + rtn = (vector)memcpy; + break; + case 2: + rtn = swap2; + break; + case 4: + rtn = swap4; + break; + case 8: + rtn = swap8; + break; + default: + rtn = (vector)memcpy; + break; + } + } + else{ + rtn = (vector)memcpy; + } + + (*matrix[offset1][offset2])(v1, v2, npix, rtn, direction); +} diff --git a/funtools/fitsy/generic.h b/funtools/fitsy/generic.h new file mode 100644 index 0000000..5835492 --- /dev/null +++ b/funtools/fitsy/generic.h @@ -0,0 +1,30 @@ +/* generic.h */ + +typedef unsigned char _uchar; +typedef unsigned short _ushort; +typedef unsigned int _uint; + +#define DOUBLE_EXPAND(ch, type, FUNCTION) \ + \ +FUNCTION(ch,type,c,char) \ +FUNCTION(ch,type,s,short) \ +FUNCTION(ch,type,i,int) \ +FUNCTION(ch,type,l,longlong) \ +FUNCTION(ch,type,r,float) \ +FUNCTION(ch,type,d,double) \ +FUNCTION(ch,type,t,_uchar) \ +FUNCTION(ch,type,u,_ushort) \ +FUNCTION(ch,type,v,_uint) \ + +#define DOUBLE_GENERIC(FUNCTION) \ + \ +DOUBLE_EXPAND(c,char,FUNCTION) \ +DOUBLE_EXPAND(s,short,FUNCTION) \ +DOUBLE_EXPAND(i,int,FUNCTION) \ +DOUBLE_EXPAND(l,longlong,FUNCTION) \ +DOUBLE_EXPAND(r,float,FUNCTION) \ +DOUBLE_EXPAND(d,double,FUNCTION) \ +DOUBLE_EXPAND(t,_uchar,FUNCTION) \ +DOUBLE_EXPAND(u,_ushort,FUNCTION) \ +DOUBLE_EXPAND(v,_uint,FUNCTION) \ + diff --git a/funtools/fitsy/headdata.c b/funtools/fitsy/headdata.c new file mode 100644 index 0000000..748fbea --- /dev/null +++ b/funtools/fitsy/headdata.c @@ -0,0 +1,67 @@ +/* Fitsy FITS routines to work with the data portion of a FITS file. + */ + +#include <xos.h> +#include "fitsy.h" + +/* Skip over the data part of a FITS header data unit. + + If the file is seekable and the #ofile file pointer is + #NULL or nfile is 0, the data are skipped with an #fseek(). + + If the #ofile file pointer is #NULL no data is written. + + */ + +#define NBLOCK 500 + +off_t ft_dataskip(ifile, fits, ofiles, nofile) + File ifile; /* File pointer to read FITS data from. */ + FITSHead fits; /* FITS header associated with data. */ + File* ofiles; /* File pointers to write data to. */ + int nofile; /* number of files */ +{ + int i; + int blocks; + char block[FT_BLOCK * NBLOCK]; + off_t pos=0; + + if ( ifile == NULL ) return pos; + if ( fits == NULL ) return pos; + + if ( ft_seek(fits) != -1 && (!ofiles || !nofile) ) { + if ( ft_databytes(fits) ){ + pos = ftSeek(ifile, ft_databloks(fits) * FT_BLOCK, 1); + return pos; + } + } + + if ( ft_databytes(fits) ) { + for ( blocks = ft_databloks(fits); + blocks > NBLOCK; blocks -= NBLOCK ) { + ftRead(ifile, block, 1, FT_BLOCK*NBLOCK); + for(i=0; i<nofile; i++) + ftWrite(ofiles[i], block, 1, FT_BLOCK*NBLOCK); + } + if ( blocks ) { + ftRead(ifile, block, 1, FT_BLOCK*blocks); + for(i=0; i<nofile; i++) + ftWrite(ofiles[i], block, 1, FT_BLOCK*blocks); + } + } + return pos; +} + +/* Seek to the data portion of prevoiusly read fits header data unit. + */ +off_t ft_dataseek(sfile, fits) + File sfile; /* File pointer to seek. */ + FITSHead fits; +{ + if ( sfile == NULL ) return -1; + if ( fits == NULL ) return -1; + + return ftSeek(sfile, fits->data, 0) != -1; +} + + diff --git a/funtools/fitsy/headfile.c b/funtools/fitsy/headfile.c new file mode 100644 index 0000000..b80788d --- /dev/null +++ b/funtools/fitsy/headfile.c @@ -0,0 +1,147 @@ +/* Fitsy FITS read and write header routines. + */ + +#include <xos.h> +#include "fitsy.h" + +FITSHead ft_headread0(file, card1, n) + File file; + char *card1; + size_t n; +{ + int nbloks; + + FITSHead fits; + FITSCard cards; + FITSCard end; + FITSBuff key; + int match; + int nhist; + + if ( file == NULL ) return NULL; + + Malloc(cards, FT_BLOCK+1); + ft_cardclr(cards, FT_CARDS); + /* make sure there is a null at the end (EGM) */ + ((char *)cards)[FT_BLOCK] = '\0'; + fits = ft_headinit(cards, -FT_CARDS*FT_CARDLEN); + + fits->seek = ftTell(file); + + if ( card1 ) + memmove(fits->cards, card1, n); + + if ( ftRead(file, (void *)&fits->cards[0].c[n], + 1, FT_BLOCK - n) != FT_BLOCK - n ) { + (void)Free(fits->cards); + (void)Free(fits); + return NULL; + }; + + ft_cardkey(&key, "END", 0); + + for ( nbloks = 1; 1; nbloks++ ) { + if ( (end = ft_cardfindblok(&fits->cards[(nbloks-1) * FT_CARDS] + , &key, &match, &nhist)) ) break; + + if ( (nbloks <= 25) || (nbloks > 25 && nhist < FT_CARDS) ) { + fits->ncard += FT_CARDS; + (void)ReAlloc(fits->cards, (nbloks+1) * FT_BLOCK + 1); + /* make sure there is a null at the end (EGM) */ + ((char *)fits->cards)[(nbloks+1) * FT_BLOCK] = '\0'; + ft_cardclr(&fits->cards[nbloks * FT_CARDS], FT_CARDS); + } else + nbloks--; + + if ( ftRead(file, (void *)&fits->cards[nbloks * FT_CARDS], + 1, FT_BLOCK) != FT_BLOCK ) { + (void)Free(fits->cards); + (void)Free(fits); + return NULL; + } + } + + fits->data = ftTell(file); + + fits->ncard = end - fits->cards + 1; + fits->acard = nbloks * FT_CARDS; + + ft_syncdata(fits); + + return fits; +} + +/* Read a FITS header from a file pointer. + + Returns + The #FITSHead read from #file. + */ +FITSHead ft_headread(file) + File file; /* File pointer to read or write a FITS header on. */ +{ + return ft_headread0(file, NULL, 0); +} + +/* Write a FITS header to a file pointer. + */ +int ft_headwrite(file, fits) + File file; + FITSHead fits; /* Header to write. */ +{ + if ( file == NULL ) return 0; + if ( fits == NULL ) return 0; + + if ( fits->sync ) ft_synchead(fits); + + ftWrite(file, (void *)fits->cards, + FT_BLOCK, ((fits->ncard+FT_CARDS-1)/FT_CARDS)); + ftFlush(file); + + return 1; +} + +void *ft_fileparse(ifile, callback, cdata) + File ifile; + int (*callback)(); + void *cdata; +{ + FITSHead fits; + void *data = NULL; + + if ( ifile == NULL ) return NULL; + + while ( (fits = ft_headread(ifile)) ) { + if ( (*callback)(ifile, fits, &data, cdata) ) + return data; + } + + return data; +} + +/* Seek back to the header part of a FITS HDU. The file handle must be the same + one from which the FITS header was read and must be seekable. + */ +off_t ft_headseek(file, fits) + File file; + FITSHead fits; +{ + if ( file == NULL ) return -1; + if ( fits == NULL ) return -1; + + return ftSeek(file, fits->seek, 0) != -1; +} + +int ft_sync(fits, x) + FITSHead fits; + int x; +{ + int sync; + + if ( fits == NULL ) return -1; + + sync = fits->sync; + fits->sync = x; + + return sync; + +} diff --git a/funtools/fitsy/headfind.c b/funtools/fitsy/headfind.c new file mode 100644 index 0000000..8095c15 --- /dev/null +++ b/funtools/fitsy/headfind.c @@ -0,0 +1,86 @@ +/* Fitsy FITS header find routines. + */ + +#include "xos.h" +#include "fitsy.h" + +extern int ft_compare(); + +/* Find a FITS card in the header. + + If the header has been indexed the index will be used + otherwise a sequential search will be done. + + Returns + The card found or NULL if an exact match was not found. + */ +FITSCard ft_headfind(fits, name, n, add) + FITSHead fits; /* The FITS header to search. */ + char *name; /* Name of the card keyword to search for. */ + int n; /* keyword index number, if is zero no + index number is appended to the keyword. + */ + int add; /* If add is true the card will + be added to the header if it is + not found. + */ +{ + FITSBuff key; + + return ft_cardfind(fits, ft_cardkey(&key, name, n), add); +} + +/* Index a header for use with #ft_headfind. + */ +void ft_headindex(fits) + FITSHead fits; +{ + int i; + + if ( fits->index ) (void)Free(fits->index); + + Malloc(fits->index, sizeof(FITSCard *) * fits->ncard); + for ( i = 0; i < fits->ncard; i++ ) { + fits->index[i] = (FITSCard) &fits->cards[i]; + } + + qsort(fits->index, fits->ncard, sizeof(FITSCard *), ft_compare); +} + +/* Find a FITS card in the header. + + #headfindidx uses an index to find the card. + */ +FITSCard ft_headfindidx(fits, name, n, match) + FITSHead fits; + char *name; + int n; + int *match; /* Returns true if the card found is + an exact match for the keyword + requested. + */ +{ + FITSBuff key; + + return ft_cardfindidx(fits, ft_cardkey(&key, name, n), match); +} + +/* Find a FITS card in the header. + + Find a card in the header using sequential search. + + If the requested card is a FITS indexed keyword and an exact match + is not found, the highest existing card of that type is returned and + match is set to 0. + */ +FITSCard ft_headfindseq(fits, name, n, match) + FITSHead fits; + char *name; + int n; + int *match; +{ + FITSBuff key; + + return ft_cardfindseq(fits, ft_cardkey(&key, name, n), match); +} + diff --git a/funtools/fitsy/headget.c b/funtools/fitsy/headget.c new file mode 100644 index 0000000..89dd7c9 --- /dev/null +++ b/funtools/fitsy/headget.c @@ -0,0 +1,126 @@ +/* Find and return values from a FITS header. + + EXAMPLES ++ + FITSHead fits; + FITSCard card; + + + int simple; + int ax1, ax2; + + /-* Look up the SIMPLE card in the header and see if its is + True. If it's not found return False. + *-/ + simple = #ft_headgetl(fits, "SIMPLE", 0, 0, &card); + + /-* Look up the NAXIS1 and NAXIS2 cards in the header + if a card is not found return 0. + *-/ + ax1 = #ft_headgeti(fits, "NAXIS", 1, 0, &card); + ax2 = #ft_headgeti(fits, "NAXIS", 2, 0, &card); ++ + */ + +#include <fitsy.h> + +/* Find and return the value of a FITS card as a static string. + */ +char *ft_headget(fits, name, n, card) + FITSHead fits; /* The FITS header to search. */ + char *name; /* Name of the card keyword to search for. */ + int n; /* keyword index number, if is zero no + index number is appended to the keyword. + */ + FITSCard *card; /* The FITS card that was found. */ +{ + return ft_cardget(*(card) = ft_headfind(fits, name, n, 0)); +} + +/* Find and return the value of a FITS card as a logical. + */ +int ft_headgetl(fits, name, n, ldefault, card) + FITSHead fits; + char *name; + int n; + int ldefault; /* Default logical value to return. */ + FITSCard *card; +{ + FITSCard C; + + if ( card == NULL ) card = &C; + + return ( (*(card) = ft_headfind(fits, name, n, 0)) ? + ft_cardgetl(*(card)) : (int)(ldefault) ); +} + + +/* Find and return the value of a FITS card as an integer. + */ +int ft_headgeti(fits, name, n, idefault, card) + FITSHead fits; + char *name; + int n; + int idefault; /* Default integer value to return. */ + FITSCard *card; +{ + FITSCard C; + + if ( card == NULL ) card = &C; + + return ( (*(card) = ft_headfind(fits, name, n, 0)) ? + ft_cardgeti(*(card)) : (int)(idefault) ); +} + +/* Find and return the value of a FITS card as an integer. + */ +longlong ft_headgetil(fits, name, n, idefault, card) + FITSHead fits; + char *name; + int n; + longlong idefault; /* Default integer value to return. */ + FITSCard *card; +{ + FITSCard C; + + if ( card == NULL ) card = &C; + + return ( (*(card) = ft_headfind(fits, name, n, 0)) ? + ft_cardgetil(*(card)) : (longlong)(idefault) ); +} + +/* Find and return the value of a FITS card as a real. + */ +double ft_headgetr(fits, name, n, ddefault, card) + FITSHead fits; + char *name; + int n; + double ddefault; /* Default real value to return. */ + FITSCard *card; +{ + FITSCard C; + + if ( card == NULL ) card = &C; + + return ( (*(card) = ft_headfind(fits, name, n, 0)) ? + ft_cardgetr(*(card)) : (double)(ddefault) ); + +} +/* Find and return the value of a FITS card as a allocated string. + */ +char *ft_headgets(fits, name, n, sdefault, card) + FITSHead fits; + char *name; + int n; + char *sdefault; /* Default string value to return. */ + FITSCard *card; +{ + FITSCard C; + + if ( card == NULL ) card = &C; + + return ( (*(card) = ft_headfind(fits, name, n, 0)) ? + ft_cardgets(*(card)) : (sdefault == NULL + ? NULL + : (char *)strdup(sdefault)) ); +} diff --git a/funtools/fitsy/headimage.c b/funtools/fitsy/headimage.c new file mode 100644 index 0000000..042cec9 --- /dev/null +++ b/funtools/fitsy/headimage.c @@ -0,0 +1,274 @@ +/* Fitsy FITS routines for reading and writing image related cards. + + DESCRIPTION + + The routines on this page are usually called automatically from + #ft_headinit, #ft_headread, #ft_headwrite and other higher level + routines. This user should never need to call them with the + exception of #ft_synchead or #ft_syncdata. + */ + + +#include <xos.h> +#include "fitsy.h" + +/* Copy information from a #FITSHead into the #FITSBasic, #FITSImage + and #FITSTable data structures. + */ +void ft_syncdata(fits) + FITSHead fits; +{ + if ( fits == NULL ) return; + + if ( fits->basic ) ft_basicfree(fits->basic); + if ( fits->image ) ft_imagefree(fits->image); + if ( fits->table ) ft_tablefree(fits->table); + + fits->basic = ft_basicloadhead(fits); + fits->image = ft_imageloadhead(fits); + fits->table = ft_tableloadhead(fits); +} + +/* Copy information from the #FITSBasic, #FITSImage and #FITSTable data + structures into a #FITSHead. + */ +void ft_synchead(fits) + FITSHead fits; +{ + if ( fits == NULL ) return; + + if ( fits->basic ) ft_basicstorhead(fits, fits->basic); + if ( fits->image ) ft_imagestorhead(fits, fits->image); + if ( fits->table ) ft_tablestorhead(fits, fits->table); +} + +/* Load image FITS values into the #FITSImage structure. + */ +FITSImage ft_imageloadhead(fits) + FITSHead fits; /* FITS header to read/write image + cards from/to. */ +{ + FITSImage image = NULL; + FITSCard card; + + char *xtension; + + if ( fits == NULL ) return NULL; + if ( fits->basic == NULL ) return NULL; + + if ( ft_headgetl(fits, "SIMPLE", 0, 0, &card) + || (( xtension = ft_headget(fits, "XTENSION", 0, &card)) + && !strcmp(xtension, "IMAGE")) ) { + Malloc(image, sizeof(struct _FITSImage)); + + image->blank = ft_headgeti(fits, "BLANK", 0, 0, &card); + image->has_blank = card != NULL; + + image->dbzero = ft_headgetr(fits, "BZERO" , 0, 0.0, &card); + image->has_bzero = image->dbzero != 0.0; + + image->dbscale = ft_headgetr(fits, "BSCALE", 0, 1.0, &card); + image->has_bscale = image->dbscale != 1.0; + + /* Read in the IRAF Linear Image CS info + */ + image->log.has_wcs = 0; + image->log.fwd[0][0] = ft_headgetr(fits, "LTM1_1", 0, 1.0, &card); + image->log.has_wcs |= card != NULL; + image->log.fwd[1][0] = ft_headgetr(fits, "LTM2_1", 0, 0.0, &card); + image->log.has_wcs |= card != NULL; + image->log.fwd[0][1] = ft_headgetr(fits, "LTM1_2", 0, 0.0, &card); + image->log.has_wcs |= card != NULL; + image->log.fwd[1][1] = ft_headgetr(fits, "LTM2_2", 0, 1.0, &card); + image->log.has_wcs |= card != NULL; + image->log.fwd[2][0] = ft_headgetr(fits, "LTV1" , 0, 0.0, &card); + image->log.has_wcs |= card != NULL; + image->log.fwd[2][1] = ft_headgetr(fits, "LTV2" , 0, 0.0, &card); + image->log.has_wcs |= card != NULL; + image->log.has_wcs |= ft_inverse(image->log.fwd, image->log.rev); + + image->det.has_wcs = 0; + image->det.fwd[0][0] = ft_headgetr(fits, "DTM1_1", 0, 1.0, &card); + image->det.has_wcs |= card != NULL; + image->det.fwd[1][0] = ft_headgetr(fits, "DTM2_1", 0, 0.0, &card); + image->det.has_wcs |= card != NULL; + image->det.fwd[0][1] = ft_headgetr(fits, "DTM1_2", 0, 0.0, &card); + image->det.has_wcs |= card != NULL; + image->det.fwd[1][1] = ft_headgetr(fits, "DTM2_2", 0, 1.0, &card); + image->det.has_wcs |= card != NULL; + image->det.fwd[2][0] = ft_headgetr(fits, "DTV1" , 0, 0.0, &card); + image->det.has_wcs |= card != NULL; + image->det.fwd[2][1] = ft_headgetr(fits, "DTV2" , 0, 0.0, &card); + image->det.has_wcs |= card != NULL; + image->det.has_wcs |= ft_inverse(image->det.fwd, image->det.rev); + + image->amp.has_wcs = 0; + image->amp.fwd[0][0] = ft_headgetr(fits, "ATM1_1", 0, 1.0, &card); + image->amp.has_wcs |= card != NULL; + image->amp.fwd[1][0] = ft_headgetr(fits, "ATM2_1", 0, 0.0, &card); + image->amp.has_wcs |= card != NULL; + image->amp.fwd[0][1] = ft_headgetr(fits, "ATM1_2", 0, 0.0, &card); + image->amp.has_wcs |= card != NULL; + image->amp.fwd[1][1] = ft_headgetr(fits, "ATM2_2", 0, 1.0, &card); + image->amp.has_wcs |= card != NULL; + image->amp.fwd[2][0] = ft_headgetr(fits, "ATV1" , 0, 0.0, &card); + image->amp.has_wcs |= card != NULL; + image->amp.fwd[2][1] = ft_headgetr(fits, "ATV2" , 0, 0.0, &card); + image->amp.has_wcs |= card != NULL; + image->amp.has_wcs |= ft_inverse(image->amp.fwd, image->amp.rev); + } + + + return image; +} + +/* Store image FITS values from a #FITSImage structure into a header. + */ +void ft_imagestorhead(fits, image) + FITSHead fits; + FITSImage image; /* Image data to copy into header. */ +{ + if ( fits == NULL ) return; + if ( image == NULL ) return; + + if ( image->has_blank ) { + if ( fits->basic->bitpix > 0 ) + ft_headseti(fits, "BLANK", 0, image->blank, NULL, 0); + } + + if ( image->has_bzero ) + ft_headsetr(fits, "BZERO" , 0, image->dbzero , 7, NULL, 0); + if ( image->has_bscale ) + ft_headsetr(fits, "BSCALE", 0, image->dbscale, 7, NULL, 0); + + if ( image->log.has_wcs ) { + ft_headsetr(fits, "LTM1_1", 0, image->log.fwd[0][0], 7, NULL, 0); + ft_headsetr(fits, "LTM1_2", 0, image->log.fwd[0][1], 7, NULL, 0); + ft_headsetr(fits, "LTM2_1", 0, image->log.fwd[1][0], 7, NULL, 0); + ft_headsetr(fits, "LTM2_2", 0, image->log.fwd[1][1], 7, NULL, 0); + ft_headsetr(fits, "LTV1", 0, image->log.fwd[2][0], 7, NULL, 0); + ft_headsetr(fits, "LTV2", 0, image->log.fwd[2][1], 7, NULL, 0); + } + if ( image->amp.has_wcs ) { + ft_headsetr(fits, "ATM1_1", 0, image->amp.fwd[0][0], 7, NULL, 0); + ft_headsetr(fits, "ATM1_2", 0, image->amp.fwd[0][1], 7, NULL, 0); + ft_headsetr(fits, "ATM2_1", 0, image->amp.fwd[1][0], 7, NULL, 0); + ft_headsetr(fits, "ATM2_2", 0, image->amp.fwd[1][1], 7, NULL, 0); + ft_headsetr(fits, "ATV1", 0, image->amp.fwd[2][0], 7, NULL, 0); + ft_headsetr(fits, "ATV2", 0, image->amp.fwd[2][1], 7, NULL, 0); + } + if ( image->det.has_wcs ) { + ft_headsetr(fits, "DTM1_1", 0, image->det.fwd[0][0], 7, NULL, 0); + ft_headsetr(fits, "DTM1_2", 0, image->det.fwd[0][1], 7, NULL, 0); + ft_headsetr(fits, "DTM2_1", 0, image->det.fwd[1][0], 7, NULL, 0); + ft_headsetr(fits, "DTM2_2", 0, image->det.fwd[1][1], 7, NULL, 0); + ft_headsetr(fits, "DTV1", 0, image->det.fwd[2][0], 7, NULL, 0); + ft_headsetr(fits, "DTV2", 0, image->det.fwd[2][1], 7, NULL, 0); + } +} + + +/* Free a FITSImage data structure. + */ +void ft_imagefree(image) + FITSImage image; +{ + if ( image ) (void)Free(image); +} + +/* Load basic FITS values into the #FITSBasic structure. + */ +FITSBasic ft_basicloadhead(fits) + FITSHead fits; +{ + FITSBasic basic; + FITSCard card; + int i; + + if ( fits == NULL ) return NULL; + + Malloc(basic, sizeof(struct _FITSBasic)); + + basic->simple = ft_headgetl(fits, "SIMPLE", 0, 0, &card); + if ( basic->simple ) { + basic->name = strdup("primary"); + } else { + basic->name = ft_headgets(fits, "EXTNAME", 0, "None", &card); + basic->hduname = ft_headgets(fits, "HDUNAME", 0, "None", &card); + basic->extn = ft_headgeti(fits, "EXTVER", 0, 0, &card); + } + + basic->naxes = ft_headgeti(fits, "NAXIS", 0, 0, &card); + + if ( basic->naxes > FT_MAXAXES ) return NULL; + + for ( i = 1; i <= basic->naxes; i++ ) + basic->naxis[i-1] = ft_headgeti(fits, "NAXIS", i, 0, &card); + + basic->bitpix = ft_headgeti(fits, "BITPIX", 0, 0, &card); + basic->gcount = ft_headgeti(fits, "GCOUNT", 0, 1, &card); + basic->pcount = ft_headgeti(fits, "PCOUNT", 0, 0, &card); + + + if ( basic->naxes == 0 || basic->gcount == 0 ) { + basic->datapixls = 0; + } else { + basic->datapixls = 1; + + for ( i = 1; i <= basic->naxes; i++ ) + basic->datapixls *= basic->naxis[i-1]; + + basic->datapixls = + basic->gcount + * (basic->pcount + basic->datapixls); + } + + basic->databytes = basic->datapixls * (Abs(basic->bitpix)/8); + basic->databloks = ft_fitsbloks(basic->databytes); + basic->row_bytes = basic->naxis[0] * (Abs(basic->bitpix)/8); + + return basic; +} + +/* Store basic FITS values from a #FITSBasic structre into a fits header. + */ +void ft_basicstorhead(fits, basic) + FITSHead fits; + FITSBasic basic; /* FITSBasic structure */ +{ + FITSCard card; + + int i; + int naxes; + + if ( fits == NULL ) return; + if ( basic == NULL ) return; + + naxes = ft_headgeti(fits, "NAXIS", 0, 0, &card); + + ft_headsetl(fits, "SIMPLE", 0, 1, NULL, 0); + + ft_headseti(fits, "BITPIX", 0, basic->bitpix, NULL, 0); + ft_headseti(fits, "NAXIS" , 0, basic->naxes, NULL, 0); + + for ( i = 1; i <= naxes; i++ ) { + if ( i < basic->naxes ) + ft_headseti(fits, "NAXIS", i, basic->naxis[i-1], NULL, 0); + else + ft_headdel (fits, "NAXIS", i); + } + + ft_headseti(fits, "GCOUNT", basic->gcount, 0, NULL, 0); + ft_headseti(fits, "PCOUNT", basic->pcount, 0, NULL, 0); +} + +/* Free a FITSBasic data structure. + */ +void ft_basicfree(basic) + FITSBasic basic; +{ + if ( basic->name ) (void)Free(basic->name ); + if ( basic->hduname ) (void)Free(basic->hduname ); + if ( basic ) (void)Free(basic ); +} + diff --git a/funtools/fitsy/headinit.c b/funtools/fitsy/headinit.c new file mode 100644 index 0000000..8e27dc8 --- /dev/null +++ b/funtools/fitsy/headinit.c @@ -0,0 +1,256 @@ +/* Fitsy FITS header creation routines. + + EXAMPLES ++ + FITSHead fits; + + fits = #ft_headinit(NULL, 0); /-* Create an empty header *-/ + + /-* Build a FITS file header by hand. + *-/ + #ft_headappl(fits, "SIMPLE", 0, 1, "Primary FITS image array"); + #ft_headappi(fits, "BITPIX", 0, -32, "Single floats"); + #ft_headappi(fits, "NAXIS" , 0, 2, "2d image"); + #ft_headappi(fits, "NAXIS" , 1, 256, "X axis is 256"); + #ft_headappi(fits, "NAXIS" , 2, 256, "Y axis is 256"); + ++ + */ + +#include "xos.h" +#include "fitsy.h" + +/* Create or import a FITS header to Fitsy. + + This is the primary way in which FITSHead structures are created. + + If #cards is not NULL then then #acard cards are scanned from the memory + in search of the END card. When a memory block is passed in to #ft_headinit + then it is considered ~unmanaged~ and will not be freed by #ft_headfree. + + If #cards is NULL, then #acards cards will be allocated for use as a FITSHead. + If #acards is 0 the #FT_CARDS will be allocated (36). + + + */ +FITSHead ft_headinit(data, bytes) + void *data; /* Pointer to FITS cards. */ + int bytes; /* Number of bytes in buffer. */ +{ + int match; + FITSHead fits; + FITSCard end = NULL; + FITSBuff *cards; + + /* cast the namby-pamby void into a real pointer + */ + cards = (FITSCard) data; + + Calloc(fits, sizeof(struct _FITSHead)); + fits->mem = FT_MALLOC; + fits->primary = NULL; + fits->filename = NULL; + fits->rfcount = 1; + + if ( cards ) { + fits->cards = fits->last = cards; + fits->acard = fits->ncard = Abs(bytes/FT_CARDLEN); + if ( bytes > 0 ) fits->mem = FT_EXTERN; + + if ( bytes > 0 && (end=ft_headfindseq(fits, "END", 0, &match)) ) { + fits->ncard = end - fits->cards + 1; + fits->acard = ((fits->ncard+FT_CARDS-1)/FT_CARDS) * FT_CARDS; + fits->data = fits->acard * FT_CARDLEN; + } + } else { + if ( bytes == 0 ) bytes = FT_CARDS * FT_CARDLEN; + + fits->acard = bytes/FT_CARDLEN ? bytes/FT_CARDLEN : FT_CARDS; + (void)Calloc(fits->cards, sizeof(FITSBuff) * fits->acard + 1); + /* make sure there is a null at the end (EGM) */ + ((char *)fits->cards)[sizeof(FITSBuff) * fits->acard] = '\0'; + ft_cardclr(fits->cards, fits->acard); + fits->ncard = 0; + fits->data = fits->acard * FT_CARDLEN; + } + fits->index = NULL; + fits->last = fits->cards; + + if ( !cards || (bytes > 0 && !end) ) { + fits->ncard = 1; + ft_cardkey(fits->cards, "END", 0); + } else { + if ( end ) { + ft_syncdata(fits); + } + } + + fits->sync = 0; + fits->cache = NULL; + + return fits; +} + +/* Make a copy of a #FITSHead data structure. + */ +FITSHead ft_headcopy(fits) + FITSHead fits; +{ + FITSHead head; + + if ( fits == NULL ) return ft_headinit(NULL, 0); + + Calloc(head, sizeof(struct _FITSHead)); + head->primary = NULL; + head->rfcount = 1; + + if ( fits->primary ) + ft_primlink(fits->primary, head); + + memmove(head, fits, sizeof(struct _FITSHead)); + + (void)Calloc (head->cards, head->acard * FT_CARDLEN + 1); + /* make sure there is a null at the end (EGM) */ + ((char *)head->cards)[head->acard * FT_CARDLEN] = '\0'; + memmove(head->cards, fits->cards, head->acard * FT_CARDLEN); + + head->index = NULL; + head->basic = NULL; + head->image = NULL; + head->table = NULL; + head->mem = FT_MALLOC; + head->mmap_here = 0; + head->mmap_size = 0; + + /* realloc filename string for the copy record */ + if( head->filename ) head->filename = strdup(head->filename); + + ft_syncdata(head); + + if( head->index && !fits->index ){ + (void)Free(head->index); + head->index = NULL; + } + + return head; +} + +/* Free a Fitsy FITS header data structure. + */ +void ft_headfree(fits, freecards) + FITSHead fits; + int freecards; /* Free the FITS cards? */ +{ + if ( fits == NULL ) return; + + if ( --fits->rfcount ) return; + + if ( fits->index ) (void)Free(fits->index); + if ( fits->filename ) (void)Free(fits->filename); + + if ( fits->basic ) ft_basicfree(fits->basic); + if ( fits->image ) ft_imagefree(fits->image); + if ( fits->table ) ft_tablefree(fits->table); + + if ( fits->mem == FT_MALLOC && freecards ) (void)Free(fits->cards); + +#ifdef HAVE_SYS_MMAN_H + if ( fits->mem == FT_MMAP ) ft_munmap(fits); +#endif +#ifdef HAVE_SYS_SHM_H + if ( fits->mem == FT_SHMAT ) ft_shmdt(fits); +#endif + + if ( fits->primary ) ft_headfree(fits->primary, 1); + + (void)Free(fits); +} + +void ft_primlink(prim, fits) + FITSHead prim; + FITSHead fits; +{ + if ( prim == NULL ) return; + if ( fits == NULL ) return; + + fits->primary = prim; + prim->rfcount++; +} + +/* Set the card buffer + */ +void ft_setcards(fits, cards) + FITSHead fits; + void *cards; +{ + fits->cards = (FITSCard) cards; +} + +/* Make a copy of the header and force it to be a simple primary header. + */ +FITSHead ft_primary(fits) + FITSHead fits; +{ + FITSHead prim; + int one = 1; + + prim = ft_headcopy(fits); + + ft_cardfmt(ft_cardnth(prim, 1) + , "SIMPLE", 0, FT_LOGICAL, &one, 0, FT_Comment); + + ft_headdel(prim, "EXTVER", 0); + ft_headdel(prim, "GCOUNT", 0); + ft_headdel(prim, "PCOUNT", 0); + ft_headdel(prim, "EXTEND", 0); + ft_headdel(prim, "NEXTEND", 0); + ft_headdel(prim, "INHERIT", 0); + + return prim; +} + +/* Merge cards from fits1 to fits2 + */ +FITSHead ft_headmerge(fits1, fits2, copy) + FITSHead fits1; + FITSHead fits2; + int copy; +{ + FITSHead merge; + FITSCard card; + int i, match; + + merge = ft_headcopy(fits1); + + if ( fits2 != NULL ) { + i = 1; + card = ft_cardnth(fits2, 1); + if( !strcmp(card->c, "SIMPLE") || !strcmp(card->c, "XTENSION") ) + i = 2; + for ( ; i < ft_ncards(fits2); i++ ) { + /* The card is not in the merge header + */ + if ( !(card = ft_cardfindseq(merge + , ft_cardnth(fits2, i), &match)) ) { + ft_cardapp(merge, ft_cardnth(fits2, i)); + } else { + if ( !match ) { + ft_cardins(merge, ft_cardnth(fits2, i), card); + } else { + /* special cards always are inserted */ + if( !strncmp(card->c, "HISTORY ", 8) || + !strncmp(card->c, "CONTINUE ", 9) || + !strncmp(card->c, "COMMENT ", 8) || + !strncmp(card->c, " ", 8) ) + ft_cardapp(merge, ft_cardnth(fits2, i)); + else if( copy ) ft_cardcpy(card , ft_cardnth(fits2, i)); + } + } + } + + } + + ft_syncdata(merge); + + return merge; +} diff --git a/funtools/fitsy/headins.c b/funtools/fitsy/headins.c new file mode 100644 index 0000000..a83a9f4 --- /dev/null +++ b/funtools/fitsy/headins.c @@ -0,0 +1,205 @@ +/* Routines to insert, append and delete FITS cards from a header. + + These routines allow FITS cards to be inserted, appended and deleted + by keyword value. + + The insertion routines format a new card with the supplied keyword and + value and insert it after indicated card. The append routines add new + cards to the end of the header (before the END card). + + */ + +#include "fitsy.h" + +/* Insert a logical value FITS card into a header. + */ +FITSCard ft_headinsl(fits, name, n, lvalue, comm, here) + FITSHead fits; /* FITS header to insert, append or + delete a card. + */ + char *name; /* Name of the FITS card. */ + int n; /* keyword index number, if is zero no + index number is appended to the + keyword. + */ + int lvalue;/* Logical to format as a FITS value. */ + char *comm; /* Comment for the new card. */ + FITSCard here; /* Insert the new card after this card. */ +{ + FITSBuff card; + + return ft_cardins(fits + , ft_cardfmt(&card, name, n, FT_LOGICAL, &lvalue, 0, comm) + , here); +} + +/* Insert a integer value FITS card into a header. + */ +FITSCard ft_headinsi(fits, name, n, ivalue, comm, here) + FITSHead fits; + char *name; + int n; + int ivalue;/* Integer to format as a FITS value. */ + char *comm; + FITSCard here; +{ + FITSBuff card; + + return ft_cardins(fits + , ft_cardfmt(&card, name, n, FT_INTEGER, &ivalue, 0, comm) + , here); +} + +/* Insert a longlong integer value FITS card into a header. + */ +FITSCard ft_headinsil(fits, name, n, ivalue, comm, here) + FITSHead fits; + char *name; + int n; + longlong ivalue;/* Integer to format as a FITS value. */ + char *comm; + FITSCard here; +{ + FITSBuff card; + + return ft_cardins(fits + , ft_cardfmt(&card, name, n, FT_LONG, &ivalue, 0, comm) + , here); +} + +/* Insert a real value FITS card into a header. + */ +FITSCard ft_headinsr(fits, name, n, dvalue, prec, comm, here) + FITSHead fits; + char *name; + int n; + double dvalue;/* Double to format as a FITS value. */ + int prec; /* Precision for the value */ + char *comm; + FITSCard here; +{ + FITSBuff card; + + return ft_cardins(fits + , ft_cardfmt(&card, name, n, FT_REAL, &dvalue, prec, comm) + , here); +} + +/* Insert a string value FITS card into a header. + */ +FITSCard ft_headinss(fits, name, n, svalue, comm, here) + FITSHead fits; + char *name; + int n; + char *svalue;/* String to format as a FITS value */ + char *comm; + FITSCard here; +{ + FITSBuff card; + + return ft_cardins(fits + , ft_cardfmt(&card, name, n, FT_STRING, svalue, 0, comm) + , here); +} + +/* Insert a raw value FITS card into a header. + */ +FITSCard ft_headinsv(fits, name, n, vvalue, comm, here) + FITSHead fits; + char *name; + int n; + char *vvalue;/* Raw value to format as a FITS value */ + char *comm; + FITSCard here; +{ + FITSBuff card; + + return ft_cardins(fits + , ft_cardfmt(&card, name, n, FT_VALUE, vvalue, 0, comm) + , here); +} + +/* Append a logical value FITS card to a header. + */ +FITSCard ft_headappl(fits, name, n, lvalue, comm) + FITSHead fits; + char *name; + int n; + int lvalue; + char *comm; +{ + return ft_headinsl(fits, name, n, lvalue, comm, NULL); +} + +/* Append a integer value FITS card to a header. + */ +FITSCard ft_headappi(fits, name, n, ivalue, comm) + FITSHead fits; + char *name; + int n; + int ivalue; + char *comm; +{ + return ft_headinsi(fits, name, n, ivalue, comm, NULL); +} + +/* Append a 64-bit integer value FITS card to a header. + */ +FITSCard ft_headappil(fits, name, n, ivalue, comm) + FITSHead fits; + char *name; + int n; + longlong ivalue; + char *comm; +{ + return ft_headinsil(fits, name, n, ivalue, comm, NULL); +} + +/* Append a real value FITS card to a header. + */ +FITSCard ft_headappr(fits, name, n, dvalue, prec, comm) + FITSHead fits; + char *name; + int n; + double dvalue; + int prec; + char *comm; +{ + return ft_headinsr(fits, name, n, dvalue, prec, comm, NULL); +} + +/* Append a string value FITS card to a header. + */ +FITSCard ft_headapps(fits, name, n, svalue, comm) + FITSHead fits; + char *name; + int n; + char *svalue; + char *comm; +{ + return ft_headinss(fits, name, n, svalue, comm, NULL); +} + + +/* Append a raw value FITS card to a header. + */ +FITSCard ft_headappv(fits, name, n, vvalue, comm) + FITSHead fits; + char *name; + int n; + char *vvalue; + char *comm; +{ + return ft_headinsv(fits, name, n, vvalue, comm, NULL); +} + + +/* Find and delete a card from a FITS header. + */ +FITSCard ft_headdel(fits, name, n) + FITSHead fits; + char *name; + int n; +{ + return ft_carddel(fits, ft_headfind(fits, name, n, 0)); +} diff --git a/funtools/fitsy/headset.c b/funtools/fitsy/headset.c new file mode 100644 index 0000000..ed586c7 --- /dev/null +++ b/funtools/fitsy/headset.c @@ -0,0 +1,132 @@ +/* Fitsy FITS header set routines. + + EXAMPLES + + Set the value part of a card in a header: ++ + int i = 15; + double d = 34.7; + char *c = "Shutter"; + + FITSCard fits; + FITSCard card; + + card = #ft_headsetl(fits, "Cosmic", 0, 1, "Removed Cosimics (silver bullet method)"); + card = #ft_headseti(fits, "IValue" , 0, i, "15 is the number"); + + card = #ft_headsetr(fits, "Gain", 1, d, 2, "GAIN1"); + card = #ft_headsetr(fits, "Gain", 2, d, 2, "GAIN2"); + + card = #ft_headsets(fits, "XHIST", 1, "Xray processed!", NULL); + + /-* In this example the special pointer #ft_comment is used to + use the existing comment in the card. + *-/ + card = #ft_headsets(fits, "FILTER", 0, "V", ft_comment); ++ + */ + +#include "fitsy.h" + +/* Find a FITS card in the header and format a logical value into it. + */ +FITSCard ft_headsetl(fits, name, n, lvalue, comm, append) + FITSHead fits; /* FITS header to search in. */ + char *name; /* keyword name. */ + int n; /* keyword index number, if is zero no + index number is appended to the keyword. + */ + + int lvalue; /* Logical to format as a FITS value. */ + char *comm; /* Comment for the card. */ + int append; /* Append the card if not found */ +{ + FITSCard card; + + if ( !(card = ft_cardsetl(ft_headfind(fits, name, n, 1), lvalue, comm)) + && append ) + card = ft_headappl(fits, name, n, lvalue, comm); + + return card; +} + +/* Find a FITS card in the header and format a logical value into it. + */ +FITSCard ft_headseti(fits, name, n, ivalue, comm, append) + FITSHead fits; + char *name; + int n; + int ivalue; /* Integer to format as a FITS value. */ + char *comm; + int append; +{ + FITSCard card; + + if ( !(card = ft_cardseti(ft_headfind(fits, name, n, 1), ivalue, comm)) + && append ) + card = ft_headappi(fits, name, n, ivalue, comm); + + return card; +} + +/* Find a FITS card in the header and format a logical value into it. + */ +FITSCard ft_headsetil(fits, name, n, ivalue, comm, append) + FITSHead fits; + char *name; + int n; + longlong ivalue; /* Integer to format as a FITS value. */ + char *comm; + int append; +{ + FITSCard card; + + if ( !(card = ft_cardsetil(ft_headfind(fits, name, n, 1), ivalue, comm)) + && append ) + card = ft_headappil(fits, name, n, ivalue, comm); + + return card; +} + +/* Find a FITS card in the header and format a logical value into it. + */ +FITSCard ft_headsetr(fits, name, n, rvalue, prec, comm, append) + FITSHead fits; + char *name; + int n; + double rvalue; /* Double to format as a FITS value. */ + int prec; /* The value is formatted + at this precision. + */ + char *comm; + int append; +{ + FITSCard card; + + if ( !(card = ft_cardsetr(ft_headfind(fits, name, n, 1) + , rvalue, prec, comm)) + && append ) + card = ft_headappr(fits, name, n, rvalue, prec, comm); + + return card; +} + +/* Find a FITS card in the header and format a string value into it. + */ +FITSCard ft_headsets(fits, name, n, svalue, comm, append) + FITSHead fits; + char *name; + int n; + char *svalue; /* String to format as a FITS value. */ + char *comm; + int append; +{ + FITSCard card; + + if ( !(card = ft_cardsets(ft_headfind(fits, name, n, 1), svalue, comm)) + && append ) + card = ft_headapps(fits, name, n, svalue, comm); + + return card; +} + diff --git a/funtools/fitsy/headsimple.c b/funtools/fitsy/headsimple.c new file mode 100644 index 0000000..79cefb1 --- /dev/null +++ b/funtools/fitsy/headsimple.c @@ -0,0 +1,30 @@ +/* headsimple.c + */ + +#include <xos.h> +#include <fitsy.h> + +FITSHead ft_headsimple(mem, bytes, naxis, naxes, bitpix) + void *mem; + int bytes; + int bitpix; + int naxis; + int *naxes; +{ + FITSHead fits; + int i; + + if ( mem ) memset(mem, 0, bytes); + + fits = ft_headinit((FITSCard) mem, bytes); + ft_headappl(fits, "SIMPLE" , 0, 1 , NULL); + ft_headappi(fits, "BITPIX" , 0, bitpix , NULL); + ft_headappi(fits, "NAXIS" , 0, naxis , NULL); + + for ( i = 1; i <= naxis; i++ ) { + ft_headappi(fits, "NAXIS" , 1, naxes[i], NULL); + } + return fits; +} + + diff --git a/funtools/fitsy/headtable.c b/funtools/fitsy/headtable.c new file mode 100644 index 0000000..0e34d59 --- /dev/null +++ b/funtools/fitsy/headtable.c @@ -0,0 +1,299 @@ +/* Fitsy FITS routines to load and store #FITSTable structures. + */ + +#include <xos.h> +#include "fitsy.h" + +char * ft_formattyp(c) + char c; +{ + switch ( c ) { + case 'L': return "c"; + case 'X': return "x"; + case 'B': return "ud"; + case 'I': return "d"; + case 'J': return "d"; + case 'K': return "lld"; + case 'U': return "ud"; + case 'V': return "ud"; + case 'F': return "f"; + case 'E': return "f"; + case 'D': return "f"; + case 'A': return "s"; + case 'C': return "f"; + case 'M': return "f"; + case 'P': return "x"; + case 'G': return "f"; + } + + /* probably won't work, but a NULL will segv */ + return ""; +} + +char *ft_format(col) + FITSTCol col; +{ + char format[80]; + + char t = col->type; + int w = col->width; + int p = col->prec; + + if ( col->disp != NULL ) { + sscanf(col->disp, " %c %d.%d", &t, &w, &p); + } + + snprintf(format, 80, "%%%d.%d%s", w, p, ft_formattyp(t)); + return strdup(format); +} + +int ft_sizeof(c) + int c; +{ + switch ( c ) { + case 'P': return 8; + case 'U': return 2; + case 'I': return 2; + case 'V': return 4; + case 'J': return 4; + case 'K': return 8; + case 'F': return 4; + case 'E': return 4; + case 'D': return 8; + case 'A': return 1; + case 'L': return 1; + case 'X': return 1; + case 'B': return 1; + case 'C': return 8; + case 'M': return 16; + + case 8: return 1; + case 16: return 2; + case 32: return 4; + case 64: return 8; + + case FT_UNSIGNED | 8: return 1; + case FT_UNSIGNED | 16: return 2; + case FT_UNSIGNED | 32: return 4; + + case -32: return 4; + case -64: return 8; + + } + + return 0; +} + + +/* Allocate and load a #FITSTable data structure. + */ +FITSTable ft_tableloadhead(fits) + FITSHead fits; +{ + FITSTable table = NULL; + FITSCard card; + char *xtension; + int i; + + int offset = 0; + + if ( (xtension = ft_headget(fits, "XTENSION", 0, &card)) != NULL + && ( !strcmp(xtension, "TABLE") + || !strcmp(xtension, "BINTABLE") + || !strcmp(xtension, "A3DTABLE") + || !strcmp(xtension, "3DTABLE") ) ) { + Malloc(table, sizeof(struct _FITSTable)); + + table->tabtype = !strcmp(xtension, "TABLE"); + if ( !(table->tfields = ft_headgeti(fits, "TFIELDS", 0, 0, &card)) ) { + (void)Free(table); + return NULL; + } + + ft_headindex(fits); + + Malloc(table->col, sizeof(struct _FITSTCol) * table->tfields); + + for ( i = 1; i <= table->tfields; i++ ) { + FITSCard card; + char *tform; + int r = 0, w = 0, p = 0; + char t = ' ', h = ' '; + char format[64]; + + table->col[i-1].name = ft_headgets(fits, "TTYPE", i, NULL, &card); + table->col[i-1].unit = ft_headgets(fits, "TUNIT", i, NULL, &card); + table->col[i-1].scale = ft_headgetr(fits, "TSCAL", i, 1.0, &card); + table->col[i-1].has_scale = card != NULL; + table->col[i-1].zero = ft_headgetr(fits, "TZERO", i, 0.0, &card); + table->col[i-1].has_zero = card != NULL; + table->col[i-1].scaled = table->col[i-1].has_zero || table->col[i-1].has_scale; + table->col[i-1].ablank = ft_headgets(fits, "TNULL", i, NULL, &card); + table->col[i-1].has_blank = card != NULL; + tform = ft_headget(fits, "TFORM", i, &card); + /* if we have no TFORM, its an illegal binary table */ + if( !card ){ + table->tfields = i; + ft_tablefree(table); + return NULL; + } + + /* hacked support for variable length arrays. we ignore the data + and just process the 2 64-bit pointers */ + if ( sscanf(tform, "%d P %c ( %d )", &r, &t, &w) == 3 ) { + /* save values for variable length array */ + table->col[i-1].vla = strdup(tform); + table->col[i-1].vla_type = t; + table->col[i-1].vla_max = w; + /* set up vla pointer values in the table */ + r = 2; + t = 'J'; + w = 0; + } + else if ( sscanf(tform, "P %c ( %d )", &t, &w) == 2 ) { + /* save values for variable length array */ + table->col[i-1].vla = strdup(tform); + table->col[i-1].vla_type = t; + table->col[i-1].vla_max = w; + /* set up vla pointer values in the table */ + r = 2; + t = 'J'; + w = 0; + } + else if ( sscanf(tform, "%d Q %c ( %d )", &r, &t, &w) == 3 ) { + /* save values for variable length array */ + table->col[i-1].vla = strdup(tform); + table->col[i-1].vla_type = t; + table->col[i-1].vla_max = w; + /* set up vla pointer values in the table */ + r = 2; + t = 'K'; + w = 0; + } + else if ( sscanf(tform, "Q %c ( %d )", &t, &w) == 2 ) { + /* save values for variable length array */ + table->col[i-1].vla = strdup(tform); + table->col[i-1].vla_type = t; + table->col[i-1].vla_max = w; + /* set up vla pointer values in the table */ + r = 2; + t = 'K'; + w = 0; + } + else{ + if ( !sscanf(tform, " %d %c %d.%d", &r, &t, &w, &p) ) { + r = 1; + sscanf(tform, " %c %d.%d", &t, &w, &p); + } + } + if ( table->tabtype ) { /* ASCII TABLE */ + table->col[i-1].format = strdup(format); + + table->col[i-1].type = 'A'; + table->col[i-1].n = 1; + table->col[i-1].size = w; + table->col[i-1].offset = ft_headgeti(fits, "TBCOL", i, 0, &card) + - 1; + table->col[i-1].heap = 0; + table->col[i-1].prec = p; + + } else { /* BINTABLE */ + + switch ( t ) { + case 'P': + table->col[i-1].heap = 1; + table->col[i-1].type = h; + table->col[i-1].n = p; + table->col[i-1].size = ft_sizeof(table->col[i-1].type); + table->col[i-1].width= table->col[i-1].size + * table->col[i-1].n; + break; + case 'A': + p = 1; + if ( !sscanf(tform, " %d %c%d", &r, &t, &p) ) { + r = 1; + sscanf(tform, " %c%d", &t, &p); + } + + table->col[i-1].heap = 0; + table->col[i-1].type = t; + table->col[i-1].n = r; + table->col[i-1].size = 1; + table->col[i-1].width= table->col[i-1].size + * table->col[i-1].n; + break; + case 'X': + table->col[i-1].heap = 0; + table->col[i-1].type = t; + table->col[i-1].n = r; + table->col[i-1].size = ft_sizeof(table->col[i-1].type); + table->col[i-1].width= + ((table->col[i-1].size * table->col[i-1].n) + 7) / 8; + table->col[i-1].prec = p; + break; + default: + table->col[i-1].heap = 0; + table->col[i-1].type = t; + table->col[i-1].n = r; + table->col[i-1].size = ft_sizeof(table->col[i-1].type); + table->col[i-1].width= table->col[i-1].size + * table->col[i-1].n; + table->col[i-1].prec = p; + break; + } + + table->col[i-1].offset = offset; + + if ( table->col[i-1].heap ) + offset += 8; + else + offset += table->col[i-1].width; + + if ( table->col[i-1].ablank ) + table->col[i-1].dblank = + strtod(table->col[i-1].ablank, NULL); + + table->col[i-1].disp = ft_headgets(fits, "TDISP", i, NULL, &card); + table->col[i-1].format = ft_format(&table->col[i-1]); + } + } + if ( table->tabtype ) { /* ASCII TABLE */ + for ( i = 1; i < table->tfields; i++ ) { + table->col[i-1].width = table->col[i].offset - table->col[i-1].offset; + } + table->col[i-1].width = fits->basic->naxis[0] - table->col[i-1].offset; + } + + } + + return table; +} + +/* Store a #FITSTable structure in a FITS header. + */ +void ft_tablestorhead(fits, table) + FITSHead fits; + FITSTable table; +{ + ft_basicstorhead(fits, fits->basic); +} + +/* Free a #FITSTable structure. + */ +void ft_tablefree(table) + FITSTable table; +{ + int i; + + for ( i = 1; i <= table->tfields; i++ ) { + if ( table->col[i-1].name ) free(table->col[i-1].name); + if ( table->col[i-1].unit ) free(table->col[i-1].unit); + if ( table->col[i-1].disp ) free(table->col[i-1].disp); + if ( table->col[i-1].format ) free(table->col[i-1].format); + if ( table->col[i-1].vla ) free(table->col[i-1].vla); + if ( table->col[i-1].ablank ) free(table->col[i-1].ablank); + } + + (void)Free(table->col); + (void)Free(table); +} diff --git a/funtools/fitsy/headwcs.c b/funtools/fitsy/headwcs.c new file mode 100644 index 0000000..8c41c95 --- /dev/null +++ b/funtools/fitsy/headwcs.c @@ -0,0 +1,91 @@ +/* headwcs.c + */ + +#include <xos.h> +#include "fitsy.h" + +int ft_trxlcs(lcs, x0, y0, x1, y1, direction) + FITSLinWCS lcs; + double x0; + double y0; + double *x1; + double *y1; + int direction; +{ + if ( !lcs->has_wcs ) { + *x1 = x0; + *y1 = y0; + return 0; + } + + if ( direction ) { + *x1 = x0 * lcs->fwd[0][0] + y0 * lcs->fwd[1][0] + lcs->fwd[2][0]; + *y1 = x0 * lcs->fwd[0][1] + y0 * lcs->fwd[1][1] + lcs->fwd[2][1]; + } else { + *x1 = x0 * lcs->rev[0][0] + y0 * lcs->rev[1][0] + lcs->rev[2][0]; + *y1 = x0 * lcs->rev[0][1] + y0 * lcs->rev[1][1] + lcs->rev[2][1]; + } + + return 1; +} + +int ft_trxsiz(lcs, x0, y0, x1, y1, direction) + FITSLinWCS lcs; + double x0; + double y0; + double *x1; + double *y1; + int direction; +{ + if ( !lcs->has_wcs ) { + *x1 = x0; + *y1 = y0; + return 0; + } + + if ( direction ) { + *x1 = x0 * lcs->fwd[0][0]; + *y1 = y0 * lcs->fwd[1][1]; + } else { + *x1 = x0 * lcs->rev[0][0]; + *y1 = y0 * lcs->rev[1][1]; + } + + return 1; +} + +void ft_loglcs(fits, m11, m12, m21, m22, v1, v2) + FITSHead fits; + double m11, m12, m21, m22; + double v1, v2; +{ + if ( m11 != 1.0 ) ft_headsetr(fits, "LTM1_1", 0, m11, 7, NULL, 1); + if ( m12 != 0.0 ) ft_headsetr(fits, "LTM1_2", 0, m12, 7, NULL, 1); + if ( m21 != 0.0 ) ft_headsetr(fits, "LTM2_1", 0, m21, 7, NULL, 1); + if ( m22 != 1.0 ) ft_headsetr(fits, "LTM2_2", 0, m22, 7, NULL, 1); + if ( v1 != 0.0 ) ft_headsetr(fits, "LTV1" , 0, v1, 7, NULL, 1); + if ( v2 != 0.0 ) ft_headsetr(fits, "LTV2" , 0, v2, 7, NULL, 1); +} + +void ft_wcslcs(fits, m11, m12, m21, m22, crv1, crv2, crp1, crp2, cun1, cun2) + FITSHead fits; + double m11, m12, m21, m22; + double crv1, crv2, crp1, crp2; + char *cun1, *cun2; +{ + ft_headsets(fits, "CTYPE1" , 0, "LINEAR", NULL, 1); + ft_headsets(fits, "CTYPE2" , 0, "LINEAR", NULL, 1); + + if ( crv1 != 0.0 ) ft_headsetr(fits, "CRVAL1" , 0, crv1, 7, NULL, 1); + if ( crp1 != 0.0 ) ft_headsetr(fits, "CRPIX1" , 0, crp1, 7, NULL, 1); + if ( cun1 != NULL) ft_headsets(fits, "CUNIT1" , 0, cun1, NULL, 1); + + if ( crv2 != 0.0 ) ft_headsetr(fits, "CRVAL2" , 0, crv2, 7, NULL, 1); + if ( crp2 != 0.0 ) ft_headsetr(fits, "CRPIX2" , 0, crp2, 7, NULL, 1); + if ( cun2 != NULL) ft_headsets(fits, "CUNIT2" , 0, cun2, NULL, 1); + + if ( m11 != 1.0 ) ft_headsetr(fits, "CD1_1", 0, m11, 7, NULL, 1); + if ( m12 != 0.0 ) ft_headsetr(fits, "CD1_2", 0, m12, 7, NULL, 1); + if ( m21 != 0.0 ) ft_headsetr(fits, "CD2_1", 0, m21, 7, NULL, 1); + if ( m22 != 1.0 ) ft_headsetr(fits, "CD2_2", 0, m22, 7, NULL, 1); +} diff --git a/funtools/fitsy/install-sh b/funtools/fitsy/install-sh new file mode 100755 index 0000000..36f96f3 --- /dev/null +++ b/funtools/fitsy/install-sh @@ -0,0 +1,276 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd=$cpprog + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "$0: no input file specified" >&2 + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "$0: $src does not exist" >&2 + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "$0: no destination specified" >&2 + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d "$dst" ] + then + dst=$dst/`basename "$src"` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-$defaultIFS}" + +oIFS=$IFS +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS=$oIFS + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp=$pathcomp$1 + shift + + if [ ! -d "$pathcomp" ] ; + then + $mkdirprog "$pathcomp" + else + : + fi + + pathcomp=$pathcomp/ +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd "$dst" && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename "$dst"` + else + : + fi + +# Make a couple of temp file names in the proper directory. + + dsttmp=$dstdir/#inst.$$# + rmtmp=$dstdir/#rm.$$# + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" "$dsttmp" && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && + +# Now rename the file to the real destination. + + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + +fi && + +# The final little trick to "correctly" pass the exit status to the exit trap. + +{ + (exit 0); exit +} diff --git a/funtools/fitsy/inverse.c b/funtools/fitsy/inverse.c new file mode 100644 index 0000000..1ed7b75 --- /dev/null +++ b/funtools/fitsy/inverse.c @@ -0,0 +1,93 @@ +/**** + * + * Chop the code to do this for 2D. + * + * affine_matrix4_inverse + * + * Computes the inverse of a 3D affine matrix; i.e. a matrix with a dimen- + * sionality of 4 where the right column has the entries (0, 0, 0, 1). + * + * This procedure treats the 4 by 4 matrix as a block matrix and + * calculates the inverse of one submatrix for a significant perform- + * ance improvement over a general procedure that can invert any non- + * singular matrix: + * -- -- -- -- + * | | -1 | -1 | + * | A 0 | | A 0 | + * -1 | | | | + * M = | | = | -1 | + * | C 1 | | -C A 1 | + * | | | | + * -- -- -- -- + * + * where M is a 4 by 4 matrix, + * A is the 3 by 3 upper left submatrix of M, + * C is the 1 by 3 lower left submatrix of M. + * + * Input: + * in - 3D affine matrix + * + * Output: + * out - inverse of 3D affine matrix + * + * Returned value: + * TRUE if input matrix is nonsingular + * FALSE otherwise + * + ***/ + +#include <xos.h> + + +typedef double Matrix3[3][2]; + +int ft_inverse (in, out) + register Matrix3 in; + register Matrix3 out; +{ + register double det_1; + double pos, neg, temp; + +#define ACCUMULATE \ + if (temp >= 0.0) \ + pos += temp; \ + else \ + neg += temp; + +#define PRECISION_LIMIT (1.0e-15) + + /* + * Calculate the determinant of submatrix A and determine if the + * the matrix is singular as limited by the double precision + * floating-point data representation. + */ + pos = neg = 0.0; + temp = in[0][0] * in[1][1]; + ACCUMULATE + temp = -in[0][1] * in[1][0]; + ACCUMULATE + det_1 = pos + neg; + + /* Is the submatrix A singular? */ + if ((det_1 == 0.0) || (Abs(det_1 / (pos - neg)) < PRECISION_LIMIT)) { + + /* Matrix M has no inverse */ + /* EPrint("affine_matrix3_inverse: singular matrix\n"); */ + return 0; + } + + else { + /* Calculate inverse(A) = adj(A) / det(A) */ + det_1 = 1.0 / det_1; + out[0][0] = in[1][1] * det_1; + out[1][0] = - in[1][0] * det_1; + out[0][1] = - in[0][1] * det_1; + out[1][1] = in[0][0] * det_1; + + /* Calculate -C * inverse(A) */ + out[2][0] = - ( in[2][0] * out[0][0] + in[2][1] * out[1][0] ); + out[2][1] = - ( in[2][0] * out[0][1] + in[2][1] * out[1][1] ); + + return 1; + } +} diff --git a/funtools/fitsy/longlong.h b/funtools/fitsy/longlong.h new file mode 100644 index 0000000..0a0afc1 --- /dev/null +++ b/funtools/fitsy/longlong.h @@ -0,0 +1,12 @@ +#ifndef LONGLONG_H +#define LONGLONG_H + +#if HAVE_LONG_LONG +typedef long long longlong; +#else +typedef long longlong; +#endif + +#endif + + diff --git a/funtools/fitsy/nd.c b/funtools/fitsy/nd.c new file mode 100644 index 0000000..1ae3461 --- /dev/null +++ b/funtools/fitsy/nd.c @@ -0,0 +1,51 @@ +/* nd.c + */ + +#include <xos.h> +#include <fitsy.h> + +void *ft_alloc2d(size, xstar, ystar, xsize, ysize) + int size; + int xstar; + int ystar; + int xsize; + int ysize; +{ + void *ptr; + + Malloc(ptr, xsize * ysize * size); + return ft_make2d(ptr, size, xstar, ystar, xsize, ysize); +} + + +char **ft_make2d(ptr, size, xstar, ystar, xsize, ysize) + char *ptr; + int size; + int xstar; + int ystar; + int xsize; + int ysize; +{ + char **ptr2d; + + if ( ptr == NULL ) return NULL; + + Malloc(ptr2d, ysize * sizeof(void *)); + + if ( ptr2d == NULL ) return NULL; + + for (; ysize--;) { + ptr2d[ysize] = ptr + xsize * ysize * size - xstar * size; + } + return ptr2d - ystar; +} + +void ft_free2d(ptr2d, size, xstar, ystar) + char **ptr2d; + int size; + int xstar; + int ystar; +{ + free(&ptr2d[ystar][xstar * size]); + free(&ptr2d[ystar]); +} diff --git a/funtools/fitsy/parse.c b/funtools/fitsy/parse.c new file mode 100644 index 0000000..ffe0d52 --- /dev/null +++ b/funtools/fitsy/parse.c @@ -0,0 +1,196 @@ + +#include <stdio.h> + +char *strchr(); +char *strchr(); + + +main() +{ + char filename[1024]; + + char xsect[1024]; + char ysect[1024]; + + int x0, x1, y0, y1; + int xsection = 0; + int ysection = 0; + + + char extn[1024]; + int exti; + char tail[1024]; + char cattail[1024]; + + char line[1024]; + char *l; + char *k; + int i, n; + + int length = 0; + + while ( l = gets(line) ) { + i = 0; + filename[i] = '\0'; + + printf("line : %s\n", line); + + extn[0] = '\0'; + exti = -1; + tail[0] = '\0'; + cattail[0] = '\0'; + + xsection = 0; + ysection = 0; + + while ( *l ) { + if ( tail[0] ) { + strcat(cattail, "["); + strcat(cattail, tail); + strcat(cattail, "]"); + } + tail[0] = '\0'; + + /* Copy characters to the filename until a + section starts. + */ + while ( *l && *l != '[' ) filename[i++] = *l++; + if ( !*l ) break; + + /* Record where the section begins. + Translate quoted "]" chars to '\001' + */ + k = l; + while ( *l && *l != ']' ) { + if ( *l == '\'' || *l == '"' ) { + char q = *l; + l++; + + while ( *l && *l != q ) { + if ( *l == ']' ) *l = '\001'; + l++; + } + } + l++; + } + if ( *l != ']' ) fprintf(stderr, "unterminated section\n"); + l++; + + /* Look for sections + */ + length = l - k; + + /* IMIO Image Section ? + */ + if ( sscanf(k, "[%[-+0-9:*],%[-+0-9:*]]%n", xsect, ysect, &n) == 2 && n == length ) { + if ( !strcmp(xsect, "*") ) xsection = 1; + else + if ( !strcmp(xsect, "-*") ) xsection = -1; + else + if ( sscanf(xsect, "%d:%d", &x0, &x1) == 2 ) + xsection = 2; + else + goto tryagain; + + if ( !strcmp(ysect, "*") ) ysection = 1; + else + if ( !strcmp(ysect, "-*") ) ysection = -1; + else + if ( sscanf(ysect, "%d:%d", &y0, &y1) == 2 ) + ysection = 2; + else + goto tryagain; + + continue; + } + + /* The section looked a little like an image section + but its didn't work out. + */ + tryagain: + + if ( sscanf(k, "[%d]%n" , &exti, &n) == 1 /* exti */ + && n == length ) + continue; + + exti = -1; + + if ( sscanf(k, "[%[^]\"',=+-]]%n" , extn, &n) == 1 /* extn */ + && n == length ) + continue; + + extn[0] = '\0'; + + if ( sscanf(k, "[%[^]\"',=+-],%d]%n" , extn, &exti, &n) == 2 /* extn, exti */ + && n == length ) + continue; + + exti = -1; + extn[0] = '\0'; + + if ( sscanf(k, "[%[^]\"',=+-],%d, %[^]]]%n",extn, &exti, tail, &n)==3 /* extn, exti, tail */ + && n == length ) + continue; + + exti = -1; + extn[0] = '\0'; + tail[0] = '\0'; + + if ( sscanf(k, "[%d,%[^]]]%n" , &exti, tail, &n) == 2 /* exti, tail */ + && n == length ) + continue; + + exti = -1; + tail[0] = '\0'; + + if ( sscanf(k, "[%[^]\"',=+-],%[^]]]%n", extn, tail, &n) == 2 /* extn, tail */ + && n == length ) + continue; + + extn[0] = '\0'; + tail[0] = '\0'; + + if ( sscanf(k, "[%[^]]]%n" , tail, &n) == 1 /* tail */ + && n == length ) + continue; + + tail[0] = '\0'; + + fprintf(stderr, "unparsable section\n"); + } + + if ( tail[0] ) { + strcat(cattail, "["); + strcat(cattail, tail); + strcat(cattail, "]"); + } + filename[i] = '\0'; + + /* Restore the "]" chars that might be lurking in + the tail. + */ + { + char *t = cattail; + while ( *t ) { + if ( *t == '\001' ) *t = ']'; + t++; + } + } + + printf("filenname: %s\n", filename); + switch ( xsection ) { + case 0: printf(" no xsection\n"); break; + case 1: printf(" xsection = *\n"); break; + case -1: printf(" xsection = -*\n"); break; + case 2: printf(" xsection = [%d:%d]\n", x0, x1); break; + } + switch ( ysection ) { + case 0: printf(" no ysection\n"); break; + case 1: printf(" ysection = *\n"); break; + case -1: printf(" ysection = -*\n"); break; + case 2: printf(" ysection = [%d:%d]\n", y0, y1); break; + } + printf(" extn = [%s, %d]\n", extn, exti); + printf(" tail = %s\n", cattail); + } +} diff --git a/funtools/fitsy/ptest.c b/funtools/fitsy/ptest.c new file mode 100644 index 0000000..eb84411 --- /dev/null +++ b/funtools/fitsy/ptest.c @@ -0,0 +1,28 @@ +#include <stdio.h> + +#define SZ_LINE 256 + +main(argc, argv) + int argc; + char **argv; +{ + char tbuf[SZ_LINE]; + char name[SZ_LINE]; + char extn[SZ_LINE]; + char tail[SZ_LINE]; + int indx; + + while( 1 ){ + *tbuf = '\0'; + if( feof(stdin) ) + break; + gets(tbuf); + if( *tbuf == 'q' ) + exit(0); + if( (*tbuf == '\0') || (*tbuf == '\n') ) + continue; + ft_parsefilename(tbuf, name, extn, SZ_LINE, &indx, tail, SZ_LINE); + fprintf(stderr, "%s ->\nname='%s' extn='%s' indx='%d' tail='%s'\n\n", + tbuf, name, extn, indx, tail); + } +} diff --git a/funtools/fitsy/tableheader.c b/funtools/fitsy/tableheader.c new file mode 100644 index 0000000..e7a48e4 --- /dev/null +++ b/funtools/fitsy/tableheader.c @@ -0,0 +1,230 @@ +#include <xos.h> +#include "fitsy.h" + +/* + * + * ft_tableheader -- read a string that details the structure + * of the event record and generate a fitsy table header + * + * The structure of the string is: + * + * [name]:[n][type]:[(lodim:)hidim] + * + * Data types follow standard conventions for FITS binary tables, but include + * two extra unsigned types ('U' and 'V'): + * + * B -- unsigned 8-bit char + * I -- signed 16-bit int + * J -- signed 32-bit int + * K -- signed 64-bit int + * E -- 32-bit float + * D -- 64-bit float + * U -- unsigned 16-bit int + * V -- unsigned 32-bit int + * + * An optional integer value n can be prefixed to the type to indicate + * that the element actually is an array of n values. + * + * Furthermore, image dimensions are attached to the event specification + * in order to tell FITS how to bin the events into an image. They + * follow the conventions for the FITS TLMIN, TLMAX, and TALEN + * keywords. If the low image dimension is not specified, it defaults to + * 1. Thus: + * + * RAWX:J:1:100 + * RAWX:J:100 + * + * both specify that the dimension of this column runs from 1 to 100. + * Note that it is required that all padding be specified in the record + * definition. + * + * + * For example, suppose a FITS binary table has the following set of column + * definitions: + * + * + * TTYPE1 = 'X ' / Label for field + * TFORM1 = '1I ' / Data type for field + * TLMIN1 = 1 / Min. axis value + * TLMAX1 = 10 / Max. axis value + * TTYPE2 = 'Y ' / Label for field + * TFORM2 = '1I ' / Data type for field + * TLMIN2 = 2 / Min. axis value + * TLMAX2 = 11 / Max. axis value + * TTYPE3 = 'PHA ' / Label for field + * TFORM3 = '1I ' / Data type for field + * TTYPE4 = 'PI ' / Label for field + * TFORM4 = '1J ' / Data type for field + * TTYPE5 = 'TIME ' / Label for field + * TFORM5 = '1D ' / Data type for field + * TTYPE6 = 'DX ' / Label for field + * TFORM6 = '1E ' / Data type for field + * TLMIN6 = 1 / Min. axis value + * TLMAX6 = 10 / Max. axis value + * TTYPE7 = 'DY ' / Label for field + * TFORM7 = '1E ' / Data type for field + * TLMIN7 = 3 / Min. axis value + * TLMAX7 = 12 / Max. axis value + * + * An raw event file containing these same data would have the event + * specification: + * + * X:I:10,Y:I:2:11,PHA:I,PI:J,TIME:D,DX:E:10,DY:E:3:12 + * + */ +FITSHead ft_tableheader(char *eventdef, int nev) +{ + FITSHead header; + char type[SZ_LINE]; + char name[SZ_LINE]; + char dim[SZ_LINE]; + char *neventdef = NULL; + char *nevdef; + char *d, *n, *s, *t, u[2]; + char **names, **types, **dims; + char *extname="EVENTS"; + int extver=1; + int cols, width, got; + int i, r; + int *lodims, *hidims, *widths; + + /* init the fitsy header */ + header = ft_headinit(NULL, 0); + + /* get rid of enclosing parens */ + if(*eventdef == '('){ + NewString(neventdef, eventdef+1); + i = strlen(neventdef); + if( neventdef[i-1] == ')' ) + neventdef[i-1] = '\0'; + } + else{ + NewString(neventdef, eventdef); + } + /* we only deal with upper case in FITS */ + for(nevdef=neventdef; *nevdef; nevdef++){ + if( islower((int)*nevdef) ) + *nevdef = toupper(*nevdef); + } + + /* first count the number of columns we have specified, + separated by ',' */ + for(s=neventdef, cols=1; *s; s++){ + if( *s == ',' ) + cols++; + } + + /* allocate string space for each column */ + names = (char **)calloc(cols, sizeof(char *)); + types = (char **)calloc(cols, sizeof(char *)); + dims = (char **)calloc(cols, sizeof(char *)); + lodims = (int *)calloc(cols, sizeof(int)); + hidims = (int *)calloc(cols, sizeof(int)); + widths = (int *)calloc(cols, sizeof(int)); + + /* process the string and gather up the information */ + for(s=neventdef, width=0, got=0; *s; ){ + /* get name */ + n=name; + *n = '\0'; + while( *s && (*s != ':') ) + *n++ = *s++; + *n = '\0'; + NewString(names[got], name); + /* skip delim */ + if( *s == ':' ) + s++; + if( *s == '\0' ) + break; + + /* get type, which might be preceded by a count */ + r = strtol(s, &t, 10); + if( s != t ) + s = t; + else + r = 1; + /* cast unsupported unsigned type, if necessary */ + u[0] = *s; + u[1] = '\0'; + snprintf(type, SZ_LINE, "%d%c", r, *u); + NewString(types[got], type); + width += ft_sizeof(*u)*r; + widths[got] = ft_sizeof(*u); + /* bump past type character */ + s++; + + /* get optional image dimension */ + if( *s == ':' ){ + /* skip past ':' */ + s++; + *dim = '\0'; + for( d=dim; *s && (*s != ',') && (*s != ':'); ) + *d++ = *s++; + *d = '\0'; + NewString(dims[got], dim); + if( *s == ':' ){ + lodims[got] = atoi(dims[got]); + s++; + *dim = '\0'; + for( d=dim; *s && (*s != ','); ) + *d++ = *s++; + *d = '\0'; + hidims[got] = atoi(dim); + } + else{ + lodims[got] = 0; + hidims[got] = atoi(dims[got])-1; + } + if( *s == ',' ) + s++; + } + else + dims[got] = NULL; + + /* bump past the comma */ + if( *s == ',' ) + s++; + /* done with another header value */ + got++; + } + + /* fake the header to a binary table */ + ft_headsets(header, "XTENSION", 0, "BINTABLE", "FITS BINARY TABLE", 1); + ft_headseti(header, "BITPIX", 0, 8, "Binary data", 1); + ft_headseti(header, "NAXIS", 0, 2, "Table is a matrix", 1); + ft_headseti(header, "NAXIS", 1, width, "Width of table in bytes", 1); + ft_headseti(header, "NAXIS", 2, nev, "Number of entries in table", 1); + ft_headseti(header, "PCOUNT", 0, 0, "Random parameter count", 1); + ft_headseti(header, "GCOUNT", 0, 1, "Group count", 1); + ft_headseti(header, "TFIELDS", 0, got, "Number of fields in each row", 1); + ft_headsets(header, "EXTNAME", 0, extname, "Table name", 1); + ft_headseti(header, "EXTVER", 0, extver, "Version number of table", 1); + /* info for each column */ + for(i=0; i<got; i++){ + ft_headsets(header, "TFORM", i+1, types[i], "Data type for field", 1); + ft_headsets(header, "TTYPE", i+1, names[i], "Label for field", 1); + if( dims[i] != NULL ){ + ft_headseti(header, "TLMIN", i+1, lodims[i], "Min. axis value", 1); + ft_headseti(header, "TLMAX", i+1, hidims[i], "Max. axis value", 1); + } + } + + /* now turn this into a table header */ + ft_syncdata(header); + + /* free up the column strings */ + for(i=0; i<cols; i++){ + if( names[i] ) free(names[i]); + if( types[i] ) free(types[i]); + if( dims[i] ) free(dims[i]); + } + if( names ) free(names); + if( types ) free(types); + if( dims ) free(dims); + if( lodims ) free(lodims); + if( hidims ) free(hidims); + if( widths ) free(widths); + if( neventdef ) free(neventdef); + + return header; +} diff --git a/funtools/fitsy/xfile.h b/funtools/fitsy/xfile.h new file mode 100644 index 0000000..6d8e60c --- /dev/null +++ b/funtools/fitsy/xfile.h @@ -0,0 +1,20 @@ +/* default xfile.h + */ + +#ifndef XFILE_H +#define XFILE_H + +#include <stdio.h> + +typedef FILE *File; +#define ftOpen(n, m) fopen(n, m) +#define ftWrite(f, b, s, n) fwrite(b, s, n, f) +#define ftRead(f, b, s, n) fread(b, s, n, f) +#define ftGets(f, b, n) fgets(b, n, f) +#define ftFlush(f) fflush(f) +#define ftSeek(f, o, n) (fseek(f, o, n), ftell(f)) +#define ftTell(f) ftell(f) +#define ftOpenFd(fd, mode) fdopen(fd, mode) +#define ftClose(fd) fclose(fd) + +#endif diff --git a/funtools/fitsy/xos.h b/funtools/fitsy/xos.h new file mode 100644 index 0000000..8677a4f --- /dev/null +++ b/funtools/fitsy/xos.h @@ -0,0 +1,226 @@ +/* xos.h +**/ + +#ifndef os_h +#define os_h + +#if HAVE_CONFIG_H +#include <conf.h> +#endif + +#include "longlong.h" + +#ifndef NULL +#define NULL 0 +#endif + +#ifdef __STDC__ +#include <stdarg.h> +#define PROTOTYPE(X) X +#else +#include <varargs.h> +#define PROTOTYPE(X) ( ) +#endif + +#if HAVE_STRING_H +#include <string.h> +#else +char *strchr(); +char *strrchr(); + +char *strcpy(); +char *strncpy(); +int strlen(); +void *memset(); +#endif + +#ifndef HAVE_STRCHR +#define strchr index +#define strrchr rindex +#endif +#ifndef HAVE_MEMCPY +#ifndef memcpy +#define memcpy(d, s, n) bcopy ((s), (d), (n)) +#endif +#ifndef memmove +#define memmove(d, s, n) bcopy ((s), (d), (n)) +#endif +#else +#ifndef bcopy +#define bcopy(s, d, n) memcpy( (d), (s), (n)) +#endif +#endif + +#ifdef HAVE_MALLOC_H +#include <malloc.h> +#else +void *malloc(); +void *calloc(); +void *realloc(); +void free(); +#endif + +#define Min(x, y) (((x) < (y)) ? (x) : (y)) +#define Max(x, y) (((x) > (y)) ? (x) : (y)) + +#define Clip(min, max, val) (((val) < (min) ) ? (min) : \ + ((val) > (max) ) ? (max) : (val) ) + +#define Abs(xx) (((xx) > 0) ? (xx) : -(xx) ) + +#ifdef MSDOS +#define sleep SAOSleep +#endif + +#ifdef __GNU_C__ +#define INLINE inline +#else +#define INLINE +#endif + + +#define New(space, thing) Calloc(space, sizeof(thing)) +#ifndef NewString +#define NewString(space, str) (( str == NULL ) \ + ? NULL \ + : strcpy(Malloc(space, strlen(str) + 1) \ + , str)) +#endif + +#ifdef _EXCEPT_H + +extern exception ex_malloc; +#define MEMEX(exc, space) , ((space) ? (space) : \ + ( except(exc, "cannot allocate %s line %d", __FILE__, __LINE__) \ + , space)) +#else +#define MEMEX(exc, space) +#endif + +#ifdef DEBUG +#define Malloc(space, size) ( ((space) = (void *) malloc(size)) \ + , printf("malloc : 0x%09lx %10d bytes - " #space "\n" \ + , space, size) \ + , space) + + +#define Calloc(space, size) ( ((space) = (void *) malloc(size)) \ + , printf("calloc : 0x%09lx %10d bytes - " #space "\n"\ + , space, size) \ + , memset(space, 0, size) \ + , space) + +#define Free(space) ( space != NULL ? \ + printf("free : 0x%09lx - " #space "\n", space) \ + , free((char *) space), (int) (space = NULL) \ + : printf("free : (null)\n"), (void *) NULL ) + +#define ReAlloc(space, size) ( space != NULL ? \ + printf("relloc : 0x%09lx %10d bytes - " #space "\n" \ + , ((space) = (void *) realloc((void*)space, size)) \ + , size), (void *) space \ + : (void *) Malloc(space, size) ) + +#define D(args) printf args + +#else +#define Malloc(space, size) ( (space) = (void *) calloc(size, 1) MEMEX(ex_malloc, space) ) +#define ReAlloc(space, size) ( space ? \ + (void *)(((space) = (void *) realloc((void*)space, size)) \ + MEMEX(ex_malloc, space)) \ + : (void *) Malloc(space, size) ) + +#define Calloc(space, size) ( Malloc(space, size), memset(space, 0, size), space ) + +#define Free(space) ( space ? ( free((char *) space), (void *)(space = NULL)) \ + : (void *) NULL ) + +#define D(args) +#endif + + +#ifdef TYPES +typedef double real; +typedef int bool; + +typedef struct _complex { + double r; + double i; +} complex; + +typedef bool (*bfunct) (); +typedef short (*sfunct) (); +typedef int (*ifunct) (); +typedef longlong (*lfunct) (); +typedef real (*rfunct) (); +typedef double (*dfunct) (); +typedef complex (*xfunct) (); +#endif + +#define MIN_normal 0.99e-306 +#define MAX_normal 0.99e306 + + +/* Types.h +** +** Data type constants +**/ + +#ifndef INDEFS +#define INDEFS (-32767) +#endif +#ifndef INDEFL +#define INDEFL ((unsigned long) 0x80000001) +#endif +#ifndef INDEFI +#define INDEFI INDEFL +#endif +#ifndef INDEFR +#define INDEFR 1.6e38 +#endif +#ifndef INDEFD +#define INDEFD 1.6e308 +#endif +#ifndef INDEF +#define INDEF INDEFR +#endif + + +#define TY_CHAR 0 +#define TY_SHORT 1 +#define TY_INT 2 +#define TY_LONG 3 +#define TY_REAL 4 +#define TY_DOUBLE 5 + +#define TY_UCHAR 6 +#define TY_USHORT 7 +#define TY_UINT 8 +#define TY_ULONG 9 + + +#define SZ_CHAR 1 +#define SZ_SHORT 2 +#define SZ_INT 4 +#define SZ_LONG 8 +#define SZ_REAL 4 +#define SZ_DOUBLE 8 + +#define X__PI 3.14159265358979323846 +#define X_2PI ( 2 * X__PI ) +#define X_R2D (X_2PI / 360.0) +#define X_R2H (X_2PI / 24.0) +#define X_H2D (360.0 / 24.0) + +#define r2h(r) ( (r) / X_R2H ) +#define h2r(d) ( (d) * X_R2H ) +#define r2d(r) ( (r) / X_R2D ) +#define d2r(d) ( (d) * X_R2D ) +#define h2d(r) ( (r) * X_H2D ) +#define d2h(d) ( (d) / X_H2D ) +#endif + +#define DPrint(X) EPrint X +#define XPrint(X) + +/* end os_h */ |