slcfitsio-0.3.8/0000755002657400265740000000000010621347734012554 5ustar davisdavisslcfitsio-0.3.8/share/0000755002657400265740000000000010621347547013660 5ustar davisdavisslcfitsio-0.3.8/share/readrmf.sl0000644002657400265740000000447610054700047015637 0ustar davisdavisrequire ("histogram"); require ("fits"); static define convert_to_array_type (a) { if (_typeof (a) == Array_Type) return; variable dims, ndims, type; (dims, ndims, type) = array_info (a); variable nrows = dims[0]; variable aa = Array_Type[nrows]; _for (0, nrows-1, 1) { variable i = (); aa[i] = a[i, *]; } return aa; } public define fits_read_rmf (file) { variable rmf = struct { energ_lo, energ_hi, n_grp, f_chan, n_chan, matrix, e_min, e_max, channel }; variable t = fits_read_table (file + "[MATRIX]"); rmf.energ_lo = t.energ_lo; rmf.energ_hi = t.energ_hi; rmf.n_grp = t.n_grp; variable f_chan = t.f_chan; variable n_chan = t.n_chan; variable matrix = t.matrix; variable nrows = length (rmf.energ_lo); f_chan = convert_to_array_type (f_chan); n_chan = convert_to_array_type (n_chan); _for (0, nrows-1, 1) { variable i = (); variable a; a = f_chan[i]; reshape (a, [length (a)]); a = n_chan[i]; reshape (a, [length (a)]); a = matrix[i]; reshape (a, [length (a)]); } rmf.f_chan = f_chan; rmf.n_chan = n_chan; rmf.matrix = matrix; (rmf.e_min, rmf.e_max, rmf.channel) = fits_read_col (file+"[EBOUNDS]", "e_min","e_max","channel"); rmf.channel = int (rmf.channel + 0.5); return rmf; } public define eval_rmf_E(rmf, e) { variable channels = rmf.channel; variable num_channels = max (channels); variable num_energies = length (e); variable i_list = hist_bsearch (e, rmf.energ_lo); variable matrix = rmf.matrix; variable r = @Array_Type(_typeof(matrix[0]), [num_energies, num_channels]); variable min_chan = min (channels); _for (0, num_energies-1, 1) { variable ii = (); variable i = i_list[ii]; variable n_chan = rmf.n_chan[i]; variable f_chan = rmf.f_chan[i]; variable matrix_i = matrix[i]; variable matrix_start = 0; _for (0, rmf.n_grp[i]-1, 1) { variable j = (); variable n = n_chan[j]; variable start_chan = f_chan[j]; variable stop_chan = start_chan + (n-1); variable chans = [start_chan:stop_chan]; variable matrix_stop = matrix_start + (n-1); r[ii,chans] = matrix_i[[matrix_start:matrix_stop]]; matrix_start = matrix_stop+1; } } if (typeof(e) != Array_Type) reshape (r, [num_channels]); return r; } slcfitsio-0.3.8/configure0000755002657400265740000077433710602533163014500 0ustar davisdavis#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="src/cfitsio-module.c" ac_default_prefix=/usr/local # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='RPATH 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 RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE CONFIG_DIR CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP DYNAMIC_LINK_LIB ELF_CC ELF_CFLAGS ELF_LINK ELF_LINK_CMD ELF_DEP_LIBS DYNAMIC_LINK_FLAGS CC_SHARED ELFLIB ELFLIB_MAJOR ELFLIB_MAJOR_MINOR SLANG_LIB_FOR_MODULES DLL_IMPLIB_NAME INSTALL_MODULE X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS SLANG_LIB SLANG_INC CFITSIO_LIB CFITSIO_INC slang_version slang_major_version slang_minor_version slang_patchlevel_version MODULE_INSTALL_DIR SL_FILES_INSTALL_DIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-x use the X Window System --with-slang=DIR Use DIR/lib and DIR/include for slang --with-slanglib=DIR slang library in DIR --with-slanginc=DIR slang include files in DIR --with-cfitsio=DIR Use DIR/lib and DIR/include for cfitsio --with-cfitsiolib=DIR cfitsio library in DIR --with-cfitsioinc=DIR cfitsio include files in DIR Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in autoconf $srcdir/autoconf; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&5 echo "$as_me: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&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/'` 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 # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi #These variable are initialized by JD init function CONFIG_DIR=`pwd` cd $srcdir if test "`pwd`" != "$CONFIG_DIR" then { { echo "$as_me:$LINENO: error: \"This software does not support configuring from another directory. See the INSTALL file\"" >&5 echo "$as_me: error: \"This software does not support configuring from another directory. See the INSTALL file\"" >&2;} { (exit 1); exit 1; }; } fi # Note: these will differ if one is a symbolic link if test -f /usr/bin/dirname; then JD_Above_Dir=`dirname $CONFIG_DIR` else # system is a loser JD_Above_Dir=`cd ..;pwd` fi JD_Above_Dir2=`cd ..;pwd` 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 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_cv_c_compiler_gnu = yes; then echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi echo "$as_me:$LINENO: checking for library containing strerror" >&5 echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 if test "${ac_cv_search_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_strerror=no 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 strerror (); int main () { strerror (); ; 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_search_strerror="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_strerror" = no; then for ac_lib in cposix; do LIBS="-l$ac_lib $ac_func_search_save_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 strerror (); int main () { strerror (); ; 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_search_strerror="-l$ac_lib" 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_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 echo "${ECHO_T}$ac_cv_search_strerror" >&6 if test "$ac_cv_search_strerror" != no; then test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" fi echo "$as_me:$LINENO: checking for AIX" >&5 echo $ECHO_N "checking for AIX... $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. */ #ifdef _AIX yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 cat >>confdefs.h <<\_ACEOF #define _ALL_SOURCE 1 _ACEOF else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f conftest* cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef hpux yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then cat >>confdefs.h <<\_ACEOF #define _HPUX_SOURCE 1 _ACEOF if test "$CC" = cc; then CC="cc -Ae"; fi fi rm -f conftest* echo "$as_me:$LINENO: checking C compiler that understands ANSI prototypes" >&5 echo $ECHO_N "checking C compiler that understands ANSI prototypes... $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. */ int main () { extern int silly (int); ; 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 echo "$as_me:$LINENO: result: $CC looks ok. Good." >&5 echo "${ECHO_T}$CC looks ok. Good." >&6 else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: $CC is not a good enough compiler" >&5 echo "${ECHO_T}$CC is not a good enough compiler" >&6 { { echo "$as_me:$LINENO: error: Set env variable CC to your ANSI compiler and rerun configure." >&5 echo "$as_me: error: Set env variable CC to your ANSI compiler and rerun configure." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done DYNAMIC_LINK_LIB="" if test "${ac_cv_header_dlfcn_h+set}" = set; then echo "$as_me:$LINENO: checking for dlfcn.h" >&5 echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 if test "${ac_cv_header_dlfcn_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 echo $ECHO_N "checking dlfcn.h 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 _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 dlfcn.h presence" >&5 echo $ECHO_N "checking dlfcn.h 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 _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: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for dlfcn.h" >&5 echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 if test "${ac_cv_header_dlfcn_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_dlfcn_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 fi if test $ac_cv_header_dlfcn_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DLFCN_H 1 _ACEOF 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 DYNAMIC_LINK_LIB="-ldl" cat >>confdefs.h <<\_ACEOF #define HAVE_DLOPEN 1 _ACEOF else echo "$as_me:$LINENO: checking for dlopen" >&5 echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 if test "${ac_cv_func_dlopen+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 dlopen to an innocuous variant, in case declares dlopen. For example, HP-UX 11i declares gettimeofday. */ #define dlopen innocuous_dlopen /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef dlopen /* 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 (); /* 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_dlopen) || defined (__stub___dlopen) choke me #else char (*f) () = dlopen; #endif #ifdef __cplusplus } #endif int main () { return f != 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_func_dlopen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_dlopen=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 echo "${ECHO_T}$ac_cv_func_dlopen" >&6 if test $ac_cv_func_dlopen = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DLOPEN 1 _ACEOF fi if test "$ac_cv_func_dlopen" != yes then { echo "$as_me:$LINENO: WARNING: cannot perform dynamic linking" >&5 echo "$as_me: WARNING: cannot perform dynamic linking" >&2;} fi fi fi ELFLIB="lib\$(THIS_LIB).so" ELFLIB_MAJOR="\$(ELFLIB).\$(ELF_MAJOR_VERSION)" ELFLIB_MAJOR_MINOR="\$(ELFLIB).\$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION)" if test "$GCC" = yes then if test X"$CFLAGS" = X then CFLAGS="-O2" fi fi INSTALL_MODULE="\$(INSTALL_DATA)" case "$host_os" in *linux*|*gnu*|k*bsd*-gnu ) DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED="\$(CC) \$(CFLAGS) -shared -fPIC" ;; *solaris* ) if test "$GCC" = yes then DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-ztext -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED="\$(CC) \$(CFLAGS) -G -fPIC" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -K PIC" ELF_LINK="\$(CC) \$(LDFLAGS) -G -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED="\$(CC) \$(CFLAGS) -G -K PIC" fi ;; # osr5 or unixware7 with current or late autoconf *sco3.2v5* | *unixware-5* | *sco-sysv5uw7*) if test "$GCC" = yes then DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED="\$(CC) \$(CFLAGS) -G -fPIC" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -K pic" # ELF_LINK="ld -G -z text -h#" ELF_LINK="\$(CC) \$(LDFLAGS) -G -z text -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED="\$(CC) \$(CFLAGS) -G -K pic" fi ;; *irix6.5* ) echo "Note: ELF compiler for host_os=$host_os may not be correct" echo "double-check: 'mode_t', 'pid_t' may be wrong!" if test "$GCC" = yes then # not tested DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED="\$(CC) \$(CFLAGS) -shared -fPIC" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS)" # default anyhow ELF_LINK="\$(CC) \$(LDFLAGS) -shared -o \$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED="\$(CC) \$(CFLAGS) -shared" fi ;; *darwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fno-common" ELF_LINK="\$(CC) \$(LDFLAGS) -dynamiclib -install_name \$(install_lib_dir)/\$(ELFLIB_MAJOR) -compatibility_version \$(ELF_MAJOR_VERSION) -current_version \$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION)" ELF_DEP_LIBS="\$(LDFLAGS) \$(DL_LIB)" CC_SHARED="\$(CC) -bundle -flat_namespace -undefined suppress \$(CFLAGS) -fno-common" ELFLIB="lib\$(THIS_LIB).dylib" ELFLIB_MAJOR="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).dylib" ELFLIB_MAJOR_MINOR="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION).dylib" ;; *freebsd* ) ELFLIB_MAJOR_MINOR="\$(ELFLIB).\$(ELF_MAJOR_VERSION)" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" if test "X$PORTOBJFORMAT" = "Xelf" ; then ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-soname,\$(ELFLIB_MAJOR)" else ELF_LINK="ld -Bshareable -x" fi ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED="\$(CC) \$(CFLAGS) -shared -fPIC" ;; *cygwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) " DLL_IMPLIB_NAME="lib\$(THIS_LIB)\$(ELFLIB_MAJOR_VERSION).dll.a" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR) -Wl,--out-implib=\$(DLL_IMPLIB_NAME) -Wl,-export-all-symbols -Wl,-enable-auto-import" ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED="\$(CC) \$(CFLAGS) -shared" SLANG_LIB_FOR_MODULES="-L\$(ELFDIR) -lslang" INSTALL_MODULE="\$(INSTALL)" ;; * ) echo "Note: ELF compiler for host_os=$host_os may be wrong" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED="\$(CC) \$(CFLAGS) -shared -fPIC" esac case "$host_cpu" in *alpha* ) if test "$GCC" = yes then IEEE_CFLAGS="-mieee" else IEEE_CFLAGS="-ieee_with_no_inexact" fi ;; * ) IEEE_CFLAGS="" esac if test "x$ac_path_x_has_been_run" != xyes; then echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 ac_path_x_has_been_run=yes # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" fi; # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -fr conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -fr conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for a specified header file. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XtMalloc (0) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libXt.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" # It might be that x_includes is empty (headers are found in the # standard search path. Then output the corresponding message ac_out_x_includes=$x_includes test "x$x_includes" = x && ac_out_x_includes="in standard search path" echo "$as_me:$LINENO: result: libraries $x_libraries, headers $ac_out_x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $ac_out_x_includes" >&6 fi fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >>confdefs.h <<\_ACEOF #define X_DISPLAY_MISSING 1 _ACEOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case `(uname -sr) 2>/dev/null` in "SunOS 5"*) echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_nospace=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_nospace=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_nospace = yes; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_space=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_space=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_space = yes; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$as_me:$LINENO: result: neither works" >&5 echo "${ECHO_T}neither works" >&6 fi fi LIBS=$ac_xsave_LIBS esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XOpenDisplay (); int main () { XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. echo "$as_me:$LINENO: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define gethostbyname to an innocuous variant, in case declares gethostbyname. For example, HP-UX 11i declares gettimeofday. */ #define gethostbyname innocuous_gethostbyname /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef gethostbyname /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else char (*f) () = gethostbyname; #endif #ifdef __cplusplus } #endif int main () { return f != gethostbyname; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 if test $ac_cv_func_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. echo "$as_me:$LINENO: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6 if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define connect to an innocuous variant, in case declares connect. For example, HP-UX 11i declares gettimeofday. */ #define connect innocuous_connect /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef connect /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else char (*f) () = connect; #endif #ifdef __cplusplus } #endif int main () { return f != connect; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 if test $ac_cv_func_connect = no; then echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); int main () { connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. echo "$as_me:$LINENO: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6 if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define remove to an innocuous variant, in case declares remove. For example, HP-UX 11i declares gettimeofday. */ #define remove innocuous_remove /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef remove /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_remove) || defined (__stub___remove) choke me #else char (*f) () = remove; #endif #ifdef __cplusplus } #endif int main () { return f != remove; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6 if test $ac_cv_func_remove = no; then echo "$as_me:$LINENO: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); int main () { remove (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo "$as_me:$LINENO: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6 if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shmat to an innocuous variant, in case declares shmat. For example, HP-UX 11i declares gettimeofday. */ #define shmat innocuous_shmat /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shmat /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else char (*f) () = shmat; #endif #ifdef __cplusplus } #endif int main () { return f != shmat; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6 if test $ac_cv_func_shmat = no; then echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); int main () { shmat (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ipc_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char IceConnectionNumber (); int main () { IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi if test "X$jd_prefix" = "X" then jd_prefix=$ac_default_prefix if test "X$prefix" != "XNONE" then jd_prefix="$prefix" fi jd_exec_prefix="$jd_prefix" if test "X$exec_prefix" != "XNONE" then jd_exec_prefix="$exec_prefix" fi eval `sh <&5 echo $ECHO_N "checking for the slang library and header files ... $ECHO_C" >&6 jd_slang_include_dir="" jd_slang_library_dir="" jd_with_slang_library="" # Check whether --with-slang or --without-slang was given. if test "${with_slang+set}" = set; then withval="$with_slang" jd_with_slang_arg=$withval else jd_with_slang_arg=unspecified fi; case "x$jd_with_slang_arg" in xno) jd_with_slang_library="no" ;; x) { { echo "$as_me:$LINENO: error: --with-slang requires a value-- try yes or no" >&5 echo "$as_me: error: --with-slang requires a value-- try yes or no" >&2;} { (exit 1); exit 1; }; } ;; xunspecified) ;; xyes) ;; *) jd_slang_include_dir="$jd_with_slang_arg"/include jd_slang_library_dir="$jd_with_slang_arg"/lib ;; esac # Check whether --with-slanglib or --without-slanglib was given. if test "${with_slanglib+set}" = set; then withval="$with_slanglib" jd_with_slanglib_arg=$withval else jd_with_slanglib_arg=unspecified fi; case "x$jd_with_slanglib_arg" in xunspecified) ;; xno) ;; x) { { echo "$as_me:$LINENO: error: --with-slanglib requres a value" >&5 echo "$as_me: error: --with-slanglib requres a value" >&2;} { (exit 1); exit 1; }; } ;; *) jd_slang_library_dir="$jd_with_slanglib_arg" ;; esac # Check whether --with-slanginc or --without-slanginc was given. if test "${with_slanginc+set}" = set; then withval="$with_slanginc" jd_with_slanginc_arg=$withval else jd_with_slanginc_arg=unspecified fi; case "x$jd_with_slanginc_arg" in x) { { echo "$as_me:$LINENO: error: --with-slanginc requres a value" >&5 echo "$as_me: error: --with-slanginc requres a value" >&2;} { (exit 1); exit 1; }; } ;; xunspecified) ;; xno) ;; *) jd_slang_include_dir="$jd_with_slanginc_arg" ;; esac if test X"$jd_with_slang_library" = X then jd_slang_inc_file= jd_with_slang_library="yes" if test "X$jd_slang_inc_file" = "X" then jd_slang_inc_file=slang.h fi if test X"$jd_slang_include_dir" = X then lib_include_dirs="\ $jd_prefix_incdir \ /usr/local/slang/include \ /usr/local/include/slang \ /usr/local/include \ /usr/include/slang \ /usr/slang/include \ /usr/include \ /opt/include/slang \ /opt/slang/include \ /opt/include" for X in $lib_include_dirs do if test -r "$X/$jd_slang_inc_file" then jd_slang_include_dir="$X" break fi done if test X"$jd_slang_include_dir" = X then jd_with_slang_library="no" fi fi if test X"$jd_slang_library_dir" = X then lib_library_dirs="\ $jd_prefix_libdir \ /usr/local/lib \ /usr/local/lib/slang \ /usr/local/slang/lib \ /usr/lib \ /usr/lib/slang \ /usr/slang/lib \ /opt/lib \ /opt/lib/slang \ /opt/slang/lib" case "$host_os" in *darwin* ) exts="dylib so a" ;; * ) exts="so a" esac found=0 for X in $lib_library_dirs do for E in $exts do if test -r "$X/libslang.$E" then jd_slang_library_dir="$X" found=1 break fi done if test $found -eq 1 then break fi done if test X"$jd_slang_library_dir" = X then jd_with_slang_library="no" fi fi fi if test "$jd_with_slang_library" = "yes" then echo "$as_me:$LINENO: result: yes: $jd_slang_library_dir and $jd_slang_include_dir" >&5 echo "${ECHO_T}yes: $jd_slang_library_dir and $jd_slang_include_dir" >&6 SLANG_LIB=-L$jd_slang_library_dir if test "X$jd_slang_library_dir" = "X/usr/lib" then SLANG_LIB="" else if test "X$jd_slang_library_dir" != "X" then if test "X$RPATH" = "X" then case "$host_os" in *linux*|*solaris* ) if test "X$GCC" = Xyes then if test "X$ac_R_nospace" = "Xno" then RPATH="-Wl,-R," else RPATH="-Wl,-R" fi else if test "X$ac_R_nospace" = "Xno" then RPATH="-R " else RPATH="-R" fi fi ;; *osf*|*openbsd*) if test "X$GCC" = Xyes then RPATH="-Wl,-rpath," else RPATH="-rpath " fi ;; *netbsd*) if test "X$GCC" = Xyes then RPATH="-Wl,-R" fi ;; esac if test "X$RPATH" != "X" then RPATH="$RPATH$jd_slang_library_dir" fi else RPATH="$RPATH:$jd_slang_library_dir" fi fi fi SLANG_INC=-I$jd_slang_include_dir if test "X$jd_slang_include_dir" = "X/usr/include" then SLANG_INC="" fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SLANG_INC="" SLANG_LIB="" fi if test "$jd_with_slang_library" = "no" then { { echo "$as_me:$LINENO: error: unable to find the slang library and header file $jd_slang_inc_file" >&5 echo "$as_me: error: unable to find the slang library and header file $jd_slang_inc_file" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for the cfitsio library and header files fitsio.h" >&5 echo $ECHO_N "checking for the cfitsio library and header files fitsio.h... $ECHO_C" >&6 jd_cfitsio_include_dir="" jd_cfitsio_library_dir="" jd_with_cfitsio_library="" # Check whether --with-cfitsio or --without-cfitsio was given. if test "${with_cfitsio+set}" = set; then withval="$with_cfitsio" jd_with_cfitsio_arg=$withval else jd_with_cfitsio_arg=unspecified fi; case "x$jd_with_cfitsio_arg" in xno) jd_with_cfitsio_library="no" ;; x) { { echo "$as_me:$LINENO: error: --with-cfitsio requires a value-- try yes or no" >&5 echo "$as_me: error: --with-cfitsio requires a value-- try yes or no" >&2;} { (exit 1); exit 1; }; } ;; xunspecified) ;; xyes) ;; *) jd_cfitsio_include_dir="$jd_with_cfitsio_arg"/include jd_cfitsio_library_dir="$jd_with_cfitsio_arg"/lib ;; esac # Check whether --with-cfitsiolib or --without-cfitsiolib was given. if test "${with_cfitsiolib+set}" = set; then withval="$with_cfitsiolib" jd_with_cfitsiolib_arg=$withval else jd_with_cfitsiolib_arg=unspecified fi; case "x$jd_with_cfitsiolib_arg" in xunspecified) ;; xno) ;; x) { { echo "$as_me:$LINENO: error: --with-cfitsiolib requres a value" >&5 echo "$as_me: error: --with-cfitsiolib requres a value" >&2;} { (exit 1); exit 1; }; } ;; *) jd_cfitsio_library_dir="$jd_with_cfitsiolib_arg" ;; esac # Check whether --with-cfitsioinc or --without-cfitsioinc was given. if test "${with_cfitsioinc+set}" = set; then withval="$with_cfitsioinc" jd_with_cfitsioinc_arg=$withval else jd_with_cfitsioinc_arg=unspecified fi; case "x$jd_with_cfitsioinc_arg" in x) { { echo "$as_me:$LINENO: error: --with-cfitsioinc requres a value" >&5 echo "$as_me: error: --with-cfitsioinc requres a value" >&2;} { (exit 1); exit 1; }; } ;; xunspecified) ;; xno) ;; *) jd_cfitsio_include_dir="$jd_with_cfitsioinc_arg" ;; esac if test X"$jd_with_cfitsio_library" = X then jd_cfitsio_inc_file=fitsio.h jd_with_cfitsio_library="yes" if test "X$jd_cfitsio_inc_file" = "X" then jd_cfitsio_inc_file=cfitsio.h fi if test X"$jd_cfitsio_include_dir" = X then lib_include_dirs="\ $jd_prefix_incdir \ /usr/local/cfitsio/include \ /usr/local/include/cfitsio \ /usr/local/include \ /usr/include/cfitsio \ /usr/cfitsio/include \ /usr/include \ /opt/include/cfitsio \ /opt/cfitsio/include \ /opt/include" for X in $lib_include_dirs do if test -r "$X/$jd_cfitsio_inc_file" then jd_cfitsio_include_dir="$X" break fi done if test X"$jd_cfitsio_include_dir" = X then jd_with_cfitsio_library="no" fi fi if test X"$jd_cfitsio_library_dir" = X then lib_library_dirs="\ $jd_prefix_libdir \ /usr/local/lib \ /usr/local/lib/cfitsio \ /usr/local/cfitsio/lib \ /usr/lib \ /usr/lib/cfitsio \ /usr/cfitsio/lib \ /opt/lib \ /opt/lib/cfitsio \ /opt/cfitsio/lib" case "$host_os" in *darwin* ) exts="dylib so a" ;; * ) exts="so a" esac found=0 for X in $lib_library_dirs do for E in $exts do if test -r "$X/libcfitsio.$E" then jd_cfitsio_library_dir="$X" found=1 break fi done if test $found -eq 1 then break fi done if test X"$jd_cfitsio_library_dir" = X then jd_with_cfitsio_library="no" fi fi fi if test "$jd_with_cfitsio_library" = "yes" then echo "$as_me:$LINENO: result: yes: $jd_cfitsio_library_dir and $jd_cfitsio_include_dir" >&5 echo "${ECHO_T}yes: $jd_cfitsio_library_dir and $jd_cfitsio_include_dir" >&6 CFITSIO_LIB=-L$jd_cfitsio_library_dir if test "X$jd_cfitsio_library_dir" = "X/usr/lib" then CFITSIO_LIB="" else if test "X$jd_cfitsio_library_dir" != "X" then if test "X$RPATH" = "X" then case "$host_os" in *linux*|*solaris* ) if test "X$GCC" = Xyes then if test "X$ac_R_nospace" = "Xno" then RPATH="-Wl,-R," else RPATH="-Wl,-R" fi else if test "X$ac_R_nospace" = "Xno" then RPATH="-R " else RPATH="-R" fi fi ;; *osf*|*openbsd*) if test "X$GCC" = Xyes then RPATH="-Wl,-rpath," else RPATH="-rpath " fi ;; *netbsd*) if test "X$GCC" = Xyes then RPATH="-Wl,-R" fi ;; esac if test "X$RPATH" != "X" then RPATH="$RPATH$jd_cfitsio_library_dir" fi else RPATH="$RPATH:$jd_cfitsio_library_dir" fi fi fi CFITSIO_INC=-I$jd_cfitsio_include_dir if test "X$jd_cfitsio_include_dir" = "X/usr/include" then CFITSIO_INC="" fi else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 CFITSIO_INC="" CFITSIO_LIB="" fi if test "$jd_with_cfitsio_library" = "no" then { { echo "$as_me:$LINENO: error: unable to find the cfitsio library and header file $jd_cfitsio_inc_file" >&5 echo "$as_me: error: unable to find the cfitsio library and header file $jd_cfitsio_inc_file" >&2;} { (exit 1); exit 1; }; } fi slang_h=$jd_slang_include_dir/slang.h echo "$as_me:$LINENO: checking SLANG_VERSION in $slang_h" >&5 echo $ECHO_N "checking SLANG_VERSION in $slang_h... $ECHO_C" >&6 slang_version=`grep "^#define *SLANG_VERSION " $slang_h | awk '{ print $3 }'` slang_major_version=`echo $slang_version | awk '{ print int($1/10000) }'` slang_minor_version=`echo $slang_version $slang_major_version | awk '{ print int(($1 - $2*10000)/100) }'` slang_patchlevel_version=`echo $slang_version $slang_major_version $slang_minor_version | awk '{ print ($1 - $2*10000 - $3*100) }'` echo "$as_me:$LINENO: result: $slang_major_version.$slang_minor_version.$slang_patchlevel_version" >&5 echo "${ECHO_T}$slang_major_version.$slang_minor_version.$slang_patchlevel_version" >&6 if test "X$slang_major_version" = "X1" then MODULE_INSTALL_DIR="$libdir/slang/modules" else MODULE_INSTALL_DIR="$libdir/slang/v$slang_major_version/modules" fi SL_FILES_INSTALL_DIR=$datadir/slsh/local-packages for ac_header in \ stdlib.h \ unistd.h \ do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done echo "$as_me:$LINENO: checking for short" >&5 echo $ECHO_N "checking for short... $ECHO_C" >&6 if test "${ac_cv_type_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((short *) 0) return 0; if (sizeof (short)) 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_short=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_short=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 echo "${ECHO_T}$ac_cv_type_short" >&6 echo "$as_me:$LINENO: checking size of short" >&5 echo $ECHO_N "checking size of short... $ECHO_C" >&6 if test "${ac_cv_sizeof_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_short" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_short=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (short)); } unsigned long ulongval () { return (long) (sizeof (short)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (short))) < 0) { long i = longval (); if (i != ((long) (sizeof (short)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (short)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_short=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (short), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_short=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 echo "${ECHO_T}$ac_cv_sizeof_short" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF echo "$as_me:$LINENO: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6 if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((int *) 0) return 0; if (sizeof (int)) 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_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6 echo "$as_me:$LINENO: checking size of int" >&5 echo $ECHO_N "checking size of int... $ECHO_C" >&6 if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_int" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (int)); } unsigned long ulongval () { return (long) (sizeof (int)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (int))) < 0) { long i = longval (); if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (int)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_int=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_int" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF echo "$as_me:$LINENO: checking for long" >&5 echo $ECHO_N "checking for long... $ECHO_C" >&6 if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((long *) 0) return 0; if (sizeof (long)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6 echo "$as_me:$LINENO: checking size of long" >&5 echo $ECHO_N "checking size of long... $ECHO_C" >&6 if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_long" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (long)); } unsigned long ulongval () { return (long) (sizeof (long)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (long))) < 0) { long i = longval (); if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (long)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_long=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF echo "$as_me:$LINENO: checking for float" >&5 echo $ECHO_N "checking for float... $ECHO_C" >&6 if test "${ac_cv_type_float+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((float *) 0) return 0; if (sizeof (float)) 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_float=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_float=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_float" >&5 echo "${ECHO_T}$ac_cv_type_float" >&6 echo "$as_me:$LINENO: checking size of float" >&5 echo $ECHO_N "checking size of float... $ECHO_C" >&6 if test "${ac_cv_sizeof_float+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_float" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (float))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (float))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (float))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (float))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (float))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_float=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (float), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (float), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (float)); } unsigned long ulongval () { return (long) (sizeof (float)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (float))) < 0) { long i = longval (); if (i != ((long) (sizeof (float)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (float)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_float=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (float), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (float), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_float=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_float" >&5 echo "${ECHO_T}$ac_cv_sizeof_float" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_FLOAT $ac_cv_sizeof_float _ACEOF echo "$as_me:$LINENO: checking for double" >&5 echo $ECHO_N "checking for double... $ECHO_C" >&6 if test "${ac_cv_type_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((double *) 0) return 0; if (sizeof (double)) 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_double=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_double=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_double" >&5 echo "${ECHO_T}$ac_cv_type_double" >&6 echo "$as_me:$LINENO: checking size of double" >&5 echo $ECHO_N "checking size of double... $ECHO_C" >&6 if test "${ac_cv_sizeof_double+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$ac_cv_type_double" = yes; then # The cast to unsigned long works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (double))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (double))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (double))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (double))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !(((long) (sizeof (double))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_double=$ac_lo;; '') { { echo "$as_me:$LINENO: error: cannot compute sizeof (double), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (double), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: internal error: not reached in cross-compile" >&5 echo "$as_me: error: internal error: not reached in cross-compile" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (double)); } unsigned long ulongval () { return (long) (sizeof (double)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) exit (1); if (((long) (sizeof (double))) < 0) { long i = longval (); if (i != ((long) (sizeof (double)))) exit (1); fprintf (f, "%ld\n", i); } else { unsigned long i = ulongval (); if (i != ((long) (sizeof (double)))) exit (1); fprintf (f, "%lu\n", i); } exit (ferror (f) || fclose (f) != 0); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_double=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) { { echo "$as_me:$LINENO: error: cannot compute sizeof (double), 77 See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (double), 77 See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi rm -f conftest.val else ac_cv_sizeof_double=0 fi fi echo "$as_me:$LINENO: result: $ac_cv_sizeof_double" >&5 echo "${ECHO_T}$ac_cv_sizeof_double" >&6 cat >>confdefs.h <<_ACEOF #define SIZEOF_DOUBLE $ac_cv_sizeof_double _ACEOF ELF_CFLAGS="$ELF_CFLAGS $IEEE_CFLAGS" CFLAGS="$CFLAGS $IEEE_CFLAGS" ac_config_headers="$ac_config_headers src/config.h:src/config.hin" ac_config_files="$ac_config_files Makefile:autoconf/Makefile.in src/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 $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile:autoconf/Makefile.in" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h:src/config.hin" ;; *) { { 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,@RPATH@,$RPATH,;t t 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,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@CONFIG_DIR@,$CONFIG_DIR,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@DYNAMIC_LINK_LIB@,$DYNAMIC_LINK_LIB,;t t s,@ELF_CC@,$ELF_CC,;t t s,@ELF_CFLAGS@,$ELF_CFLAGS,;t t s,@ELF_LINK@,$ELF_LINK,;t t s,@ELF_LINK_CMD@,$ELF_LINK_CMD,;t t s,@ELF_DEP_LIBS@,$ELF_DEP_LIBS,;t t s,@DYNAMIC_LINK_FLAGS@,$DYNAMIC_LINK_FLAGS,;t t s,@CC_SHARED@,$CC_SHARED,;t t s,@ELFLIB@,$ELFLIB,;t t s,@ELFLIB_MAJOR@,$ELFLIB_MAJOR,;t t s,@ELFLIB_MAJOR_MINOR@,$ELFLIB_MAJOR_MINOR,;t t s,@SLANG_LIB_FOR_MODULES@,$SLANG_LIB_FOR_MODULES,;t t s,@DLL_IMPLIB_NAME@,$DLL_IMPLIB_NAME,;t t s,@INSTALL_MODULE@,$INSTALL_MODULE,;t t s,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t s,@X_LIBS@,$X_LIBS,;t t s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t s,@SLANG_LIB@,$SLANG_LIB,;t t s,@SLANG_INC@,$SLANG_INC,;t t s,@CFITSIO_LIB@,$CFITSIO_LIB,;t t s,@CFITSIO_INC@,$CFITSIO_INC,;t t s,@slang_version@,$slang_version,;t t s,@slang_major_version@,$slang_major_version,;t t s,@slang_minor_version@,$slang_minor_version,;t t s,@slang_patchlevel_version@,$slang_patchlevel_version,;t t s,@MODULE_INSTALL_DIR@,$MODULE_INSTALL_DIR,;t t s,@SL_FILES_INSTALL_DIR@,$SL_FILES_INSTALL_DIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac # 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; } 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 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (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 echo "" echo "You are compiling with the following compiler configuration:" echo " CC =" "$CC" echo " CC_SHARED =" "$CC_SHARED" echo " CFLAGS =" "$CFLAGS" echo " LDFLAGS =" "$LDFLAGS" "$DYNAMIC_LINK_FLAGS" echo "" echo "The modules will be installed in $MODULE_INSTALL_DIR." echo "Any associated .sl files will be install in $SL_FILES_INSTALL_DIR" echo "" echo "If any of these quantities are incorrect, edit src/Makefile accordingly." echo "" slcfitsio-0.3.8/doc/0000755002657400265740000000000010621347550013315 5ustar davisdavisslcfitsio-0.3.8/doc/tm/0000755002657400265740000000000010621347550013735 5ustar davisdavisslcfitsio-0.3.8/doc/tm/rtl/0000755002657400265740000000000010621347550014536 5ustar davisdavisslcfitsio-0.3.8/doc/tm/rtl/cfitsiofuns.tm0000644002657400265740000004573010611753762017452 0ustar davisdavis \function{_fits_get_errstatus} \synopsis{Retrieve a text string corresponding to an error code} \usage{String_Type _fits_get_errstatus (Int_Type status)} \description \xreferences{fits_get_errstatus} \seealso{fits_read_errmsgs, _fits_read_errmsg} \done \function{_fits_read_errmsg} \synopsis{Retrieve an error message from the cfitsio error message stack} \usage{String_Type _fits_read_errmsg ()} \description \xreferences{fits_read_errmsg} \notes This function returns \NULL if there are no error messages available. \seealso{fits_read_errmsgs, fits_set_verbose_errors} \done \function{_fits_open_file} \synopsis{Open a fits file} \usage{status = _fits_open_file (Ref_Type fptr, String_Type file, String_Type mode)} \description \xreferences{fits_open_file} The main difference between this function and its cfitsio counterpart is that the \exmp{mode} argument is a string whose value must be one of the following: #v+ "r" Open the file in read-only mode "w" Open the file in read-write mode "c" Create a new file. #v- Note that if the mode argument is \exmp{"c"}, then the cfitsio \exmp{fits_create_file} function will be called. An important difference between this intrinsic function and the \exmp{fits_create_file} library function is that if the file already exists, the library function will return an error, whereas \ifun{_fits_open_file} will simply delete the file before creating a new one. \done \function{_fits_delete_file} \synopsis{Delete the file associated with a Fits_File_Type object} \usage{status = _fits_delete_file (Fits_File_Type fptr)} \description \xreferences{fits_delete_file} \done \function{_fits_close_file} \synopsis{Close a fits file} \usage{status = _fits_close_file (Fits_File_Type fptr)} \description \xreferences{fits_close_file} \done \function{_fits_movabs_hdu} \synopsis{Move to an absolute HDU number} \usage{status = _fits_movabs_hdu (Fits_File_Type fptr, Int_Type hdunum)} \description \xreferences{fits_movabs_hdu} \notes The cfitsio counterpart also returns the HDU type of the resulting HDU. \done \function{_fits_movrel_hdu} \synopsis{Move a relative number of HDUs} \usage{status = _fits_movrel_hdu (Fits_File_Type fptr, Int_Type nmove)} \description \xreferences{fits_movrel_hdu} \notes The cfitsio counterpart also returns the HDU type of the resulting HDU. \done \function{_fits_movnam_hdu} \synopsis{Move to a named HDU} \usage{status = _fits_movnam_hdu (fptr, hdutype, extname, extvers)} #v+ Fits_File_Type fptr; Int_Type hdutype, extvers; String_Type extname; #v- \description \xreferences{fits_movnam_hdu} \done \function{_fits_get_num_hdus} \synopsis{Return the number of HDUs in a FITS file} \usage{status = _fits_get_num_hdus (Fits_File_Type fptr, Ref_Type hdunum)} \description \xreferences{fits_get_num_hdus} \done \function{_fits_get_hdu_num} \synopsis{Return the current HDU number} \usage{hdunum = _fits_get_hdu_num (Fits_File_Type fptr)} \description \xreferences{fits_get_hdu_num} \done \function{_fits_get_hdu_type} \synopsis{Get the current HDU type} \usage{status = _fits_get_hdu_type (Fits_File_Type fptr, Ref_Type hdutype)} \description \xreferences{fits_get_hdu_type} Upon a sucessful return, the value of the variable associated with the \exmp{hdutype} reference will be set to one of the following constants: #v+ _FITS_IMAGE_HDU _FITS_ASCII_TBL _FITS_BINARY_TBL #v- \done \function{_fits_copy_file} \synopsis{Copy a fits file} \usage{status = _fits_copy_file (infptr, outfptr, previous, current, following)} #v+ Fits_File_Type infptr, outfptr; Int_Type previous, current, following; #v- \description \xreferences{fits_copy_file} \done \function{_fits_copy_hdu} \synopsis{Copy an HDU} \usage{status = _fits_copy_hdu (infptr, outfptr, morekeys)} #v+ Fits_File_Type infptr, outfptr; Int_Type morekeys; #v- \description \xreferences{fits_copy_hdu} \done \function{_fits_copy_header} \synopsis{Copy a fits header from one HDU to another} \usage{status = _fits_copy_header (Fits_File_Type infptr, Fits_File_Type outfptr)} \description \xreferences{fits_copy_header} \done \function{_fits_delete_hdu} \synopsis{Delete the current HDU} \usage{status = _fits_delete_hdu (Fits_File_Type fptr)} \description \xreferences{fits_delete_hdu} \notes The corresponding cfitsio function also returns the HDU type of the new HDU. If that information is necessary, make a separate call to \ifun{_fits_get_hdu_type}. \done \function{_fits_create_img} \synopsis{Create a new image extension} \usage{status = _fits_create_img (fptr, bitpix, dims)} #v+ Fits_File_Type fptr; Int_Type bitpix; Array_Type dims; #v- \description \xreferences{fits_create_img} \notes This function differs from the corresponding cfitsio function in that the \exmp{dims} array is assumed to be a 1-d integer array whose elements specify the number of axes and the size of each axis. In particular, the value of the NAXIS keyword will be given by \exmp{length(dims)}, the value of NAXIS1 will be given by \exmp{dims[0]}, and so forth. \done \function{_fits_write_img} \synopsis{Write an image} \usage{status = _fits_write_img (Fits_File_Type fptr, Array_Type img} \description \xreferences{fits_write_img} \notes This function differs from its cfitsio counterpart in that the whole image represented by the array \exmp{img} will be written out. \done \function{_fits_read_img} \synopsis{Read an image} \usage{status = _fits_read_img (Fits_File_Type fptr, Ref_Type img)} \description \xreferences{fits_read_img} \notes This function differs from the corresponding cfitsio routine in that the type of the image returned is automatically determined by the routine via a call to \exmp{fits_get_img_type}. The dimensionality of the returned image is given by \exmp{[...,NAXIS2,NAXIS1]} such that \exmp{NAXIS1} corresponds to the fastest varying dimension, \exmp{NAXIS2} the next fastest varying, etc. \done \function{_fits_create_binary_tbl} \synopsis{Create a binary table extension} \usage{status = _fits_create_binary_tbl (fptr, naxis2, ttype, tform, tunit, extname)} #v+ Fits_File_Type fptr; Array_Type tunit, tform, ttype; Int_Type naxis2; String_Type extname; #v- \notes The \exmp{_fits_create_binary_tbl} function is a wrapper around the \cfitsioxref{fits_create_tbl} function explicitly creating a binary table. The input arrays \exmp{ttype}, \exmp{tform}, and \exmp{tunit} must be the same length, which determines the number of columns in the table. The \exmp{tunit} and \exmp{extname} parameters may be set to \NULL. \done \function{_fits_update_key} \synopsis{Update a keyword or append a new one} \usage{status = _fits_update_key (fptr, keyname, value, comment)} #v+ Fits_File_Type fptr; String_Type keyname, comment; Any_Type value; #v- \description \xreferences{fits_update_key} \notes The data-type for the \exmp{value} argument must be an approriate type for FITS keywords. If \exmp{value} is a string, then the string will be written as a cfitsio long-string using the \cfitsioxref{fits_update_key_longstr} function. If \exmp{value} is \NULL, then the \cfitsioxref{fits_update_key_null} function will be called to update the keyword. The \exmp{comment} parameter may be set to \NULL to if the comment field associated with the keyword is not to be modified. To update the value of a boolean (logical) keyword, use the \ifun{_fits_update_logical} function. \done \function{_fits_update_logical} \synopsis{Update the value of a boolean keyword} \usage{status = _fits_update_logical (fptr, keyname, value, comment)} #v+ Fits_File_Type fptr; String_Type keyname, comment; Int_Type value; #v- \description The \ifun{_fits_update_logical} function is a wrapper around the cfitsio \cfitsioxref{fits_update_key} function with TLOGICAL specified as the datatype argument. If the \exmp{value} parameter is non-zero, then a value \exmp{T} (TRUE) will be given to the specified keyword. Otherwise, the value of the keyword will be set to \exmp{F} (FALSE). If the \exmp{comment} parameter is NULL, then the keyword's comment field will not be modified. \seealso{_fits_update_key} \done \function{_fits_write_comment} \synopsis{Write a COMMENT header} \usage{status = _fits_write_comment (Fits_File_Type fptr, String_Type comment)} \description \xreferences{fits_write_comment} \done \function{_fits_write_history} \synopsis{Write a HISTORY header} \usage{status = _fits_write_history (Fits_File_Type fptr, String_Type history)} \description \xreferences{fits_write_history} \done \function{_fits_write_date} \synopsis{Write a DATE keyword} \usage{status = _fits_write_date (Fits_File_Type fptr)} \description \xreferences{fits_write_date} \done \function{_fits_write_record} \synopsis{Write a keyword record} \usage{status = _fits_write_record (Fits_File_Type fptr, String_Type card)} \description \xreferences{fits_write_record} \done \function{_fits_modify_name} \synopsis{Rename a keyword} \usage{status = _fits_modify_name (fptr, oldname, newname)} #v+ Fits_File_Type fptr; String_Type oldname, newname; #v- \description \xreferences{fits_modify_name} \done \function{_fits_get_num_keys} \synopsis{Get the number of keywords in the current HDU} \usage{status _fits_get_num_keys (Fits_File_Type fptr, Ref_Type numkeys)} \description This function is a wrapper around the cfitsio \cfitsioxref{fits_get_hdrspace} function. It obtains the number of existing keywords in the current HDU (excluding the END keyword) and assigns that value to variable associated with the \exmp{numkeys} parameter. \done \function{_fits_read_key_integer} \synopsis{Read the value of a keyword as an integer} \usage{status = _fits_read_key_integer (fptr, keyname, value, comment)} #v+ Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; #v- \description This function uses the cfitsio \cfitsioxref{fits_read_key} function to read the value of the specifed keyword as an integer. Its value is assigned to the variable referenced by the \exmp{value} parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. \seealso{_fits_read_key, _fits_read_key_string, _fits_read_key_double} \done \function{_fits_read_key_string} \synopsis{Read the value of a keyword as a string} \usage{status = _fits_read_key_string (fptr, keyname, value, comment)} #v+ Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; #v- \description This function uses the cfitsio \cfitsioxref{fits_read_key_longstr} function to read the value of the specifed keyword as a cfitsio long-string. The string is assigned to the variable referenced by the \exmp{value} parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. \seealso{_fits_read_key, _fits_read_key_integer, _fits_read_key_double} \done \function{_fits_read_key_double} \synopsis{Read the value of a keyword as a double} \usage{status = _fits_read_key_double (fptr, keyname, value, comment)} #v+ Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; #v- \description This function uses the cfitsio \cfitsioxref{fits_read_key} function to read the value of the specifed keyword as a double. The keyword's value is assigned to the variable referenced by the \exmp{value} parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. \seealso{_fits_read_key, _fits_read_key_integer, _fits_read_key_string} \done \function{_fits_read_key} \synopsis{Read the value of a keyword} \usage{status = _fits_read_key (fptr, keyname, value, comment)} #v+ Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; #v- \description This function uses the cfitsio \cfitsioxref{fits_read_key} function to read the value of the specifed keyword. It first uses the cfitsio \cfitsioxref{fits_get_keytype} function to determine the data-type for the keyword and then calls \cfitsioxref{fits_read_key} using that data-type. The resulting value is assigned to the variable referenced by the \exmp{value} parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. \seealso{_fits_read_key_integer, _fits_read_key_string, _fits_read_key_double} \done \function{_fits_read_record} \synopsis{Read a specified record from the current HDU} \usage{status = _fits_read_record (fptr, keynum, card)} #v+ Fits_File_Type fptr; Int_Type keynum; Ref_Type card; #v- \description \xreferences{fits_read_record} \done \function{_fits_delete_key} \synopsis{Delete a keyword from the header} \usage{status = _fits_delete_key (Fits_File_Type fptr, String_Type keyname)} \description \xreferences{fits_delete_key} \done \function{_fits_get_colnum} \synopsis{Get the column number of a specfied table column} \usage{status = _fits_get_colnum (fptr, colname, colnum)} #v+ Fits_File_Type fptr; String_Type colname; Ref_Type colnum; #v- \description \xreferences{fits_get_colnum} \notes The corresponding cfitsio function permits a wildcard match to the \exmp{colname} parameter. The current wrapping of this function does not support such matching. The \exmp{colname} parameter is treating in a case-insensitive manner. \done \function{_fits_insert_rows} \synopsis{Insert rows into a table} \usage{status = _fits_insert_rows (fptr, firstrow, nrows)} #v+ Fits_File_Type fptr; Int_Type firstrow, nrows; #v- \description \xreferences{fits_insert_rows} \done \function{_fits_delete_rows} \synopsis{Delete rows from a table} \usage{status = _fits_delete_rows (fptr, firstrow, nrows)} #v+ Fits_File_Type fptr; Int_Type firstrow, nrows; #v- \description \xreferences{fits_delete_rows} \done \function{_fits_insert_cols} \synopsis{Insert columns into a table} \usage{status = _fits_insert_cols (fptr, colnum, ttype, tform)} #v+ Fits_File_Type fptr; Int_Type colnum; Array_Type ttype, tform; #v- \description \xreferences{fits_insert_cols} \notes The number of columns to be inserted is given by the length of the \exmp{ttype} and \exmp{tform} arrays, which must be of the same length. \done \function{_fits_delete_col} \synopsis{Delete a column from a table} \usage{status = _fits_delete_col (Fits_File_Type fptr, Int_Type colnum)} \description \xreferences{fits_delete_col} \done \function{_fits_get_num_cols} \synopsis{Get the number of table columns} \usage{status = _fits_get_num_cols (Fits_File_Type fptr, Ref_Type ncols)} \description \xreferences{fits_get_num_cols} \done \function{_fits_get_rowsize} \synopsis{Get the number of rows to read or write for maximum efficiency} \usage{status = _fits_get_rowsize (Fits_File_Type fptr, Ref_Type nrows)} \description \xreferences{fits_get_rowsize} \done \function{_fits_get_num_rows} \synopsis{Get the number of table rows} \usage{status = _fits_get_num_cols (Fits_File_Type fptr, Ref_Type nrows)} \description \xreferences{fits_get_num_rows} \done \function{_fits_write_col} \synopsis{Write data to a table column} \usage{status = _fits_write_col (fptr, colnum, firstrow, firstelem, array)} #v+ Fits_File_Type fptr; Int_Type colnum; Int_Type firstrow, firstelem; Array_Type array; #v- \description \xreferences{fits_write_col} \notes The number of elements written out to the column by this function will be equal to the number of elements in the array. \done \function{_fits_read_col} \synopsis{Read elements from a column} \usage{status = _fits_read_col (fptr, colnum, firstrow, numrows, array} #v+ Fits_File_Type fptr; Int_Type colnum, firstrow, numrows; Ref_Type array; #v- \description This function is a complicated wrapper around a number of cfitsio functions to enable it to read any type of column, including vector and variable length columns. The data read by the function is assigned as the appropriately typed array to the variable referenced by the \exmp{array} argument. For ordinary scalar columns, a 1-d array of size \exmp{numrows} will be produced. For a vector column, a 2d array of size \exmp{[numrows,repeat]} will be generated. Here \exmp{repeat} is given by the repeat value associated with the column. For a variable length column, where data are stored in the heap of the HDU, the data will be read as a 1-d array of \exmp{numrows} arrays. If the column is a bit-valued column, then data will be returned as an array of integers of the appropriate size. Currently only 8X, 16X, and 32X bit columns are supported. \seealso{_fits_read_cols, _fits_write_col} \done \function{_fits_get_keytype} \synopsis{Get a keyword's data type} \usage{status = _fits_get_keytype (fptr, keyname, type)} #v+ Fits_File_Type fptr; String_Type keyname; Ref_Type type; #v- \description \xreferences{fits_get_keytype} \notes This function differs from its cfitsio counterpart in that instead of explicitly specifying the keyword's value string, this function uses the value of the specified keyword. It also returns the type as a \slang \var{DataType_Type} object, e.g., \exmp{Int_Type}, \exmp{Complex_Type}, etc. \done \function{_fits_get_keyclass} \synopsis{Get the class of an input header record} \usage{Int_Type _fits_get_keyclass (String_Type card)} \description \xreferences{fits_get_keyclass} \done \function{_fits_read_cols} \synopsis{Read one or more table columns} \usage{status = _fits_read_cols (fptr, colnums, firstrow, nrows, arrays)} #v+ Fits_File_Type fptr; Array_Type colnums; Int_Type firstrow, numrows; Ref_Type arrays; #v- \description This function performs a similar task as the \exmp{_fits_read_col}. The main difference is that instead of reading a single column, it is capable of reading multiple columns specified by the \exmp{colnums} parameter. It assigns the data as an array of arrays to the variable referenced by the \exmp{arrays} parameter. See the documentation for the \ifun{_fits_read_col} function for more information. \notes This function takes advantage of the cfitsio buffering mechanism to optimize the reads. \done \function{_fits_write_chksum} \synopsis{Compute and write DATASUM and CHECKSUM keywords} \usage{status = _fits_write_chksum (Fits_File_Type fptr)} \description \xreferences{fits_write_chksum} \done \function{_fits_update_chksum} \synopsis{Update the CHECKSUM keyword} \usage{status = _fits_update_chksum (Fits_File_Type fptr)} \description \xreferences{fits_update_chksum} \done \function{_fits_verify_chksum} \synopsis{Verify the checksums for the current HDU} \usage{status = _fits_verify_chksum (fptr, dataok, hduok)} #v+ Fits_File_Type fptr; Ref_Type dataok, hduok; #v- \description \xreferences{fits_verify_chksum} \done \function{_fits_get_chksum} \synopsis{Get the checksums for the current HDU} \usage{status = _fits_get_chksum (fptr, datasum, hdusum)} #v+ Fits_File_Type fptr; Ref_Type datasum, hdusum; #v- \description \xreferences{fits_get_chksum} \done \function{_fits_get_version} \synopsis{Get the cfitsio library version number} \usage{Float_Type _fits_get_version ()} \description \xreferences{fits_get_version} \done slcfitsio-0.3.8/doc/tm/cfitsio.tm0000644002657400265740000007620510602532746015753 0ustar davisdavis#% -*- mode: tm; mode: fold -*- #%{{{Macros #i linuxdoc.tm #d it#1 $1 #d slang \bf{S-lang} #d exmp#1 \tt{$1} #d var#1 \tt{$1} #d ivar#1 \tt{$1} #d ifun#1 \tt{$1} #d cvar#1 \tt{$1} #d cfun#1 \tt{$1} #d svar#1 \tt{$1} #d sfun#1 \tt{$1} #d icon#1 \tt{$1} #d chapter#1 $1

#d preface #d tag#1 $1 #d function#1 \sect1{$1\label{$1}} #d variable#1 \sect1{$1\label{$1}} #d function_sect#1 \sect{$1} #d begin_constant_sect#1 \sect{$1} #d constant#1 $1 #d end_constant_sect #d synopsis#1 Synopsis $1 #d keywords#1 Keywords $1 #d usage#1 Usage $1 #d description Description #d example Example #d notes Notes #d seealso#1 See Also \linuxdoc_list_to_ref{$1} #d done

#d -1 -1 #d 0 0 #d 1 1 #d 2 2 #d 3 3 #d 4 4 #d 5 5 #d 6 6 #d 7 7 #d 8 8 #d 9 9 #d NULL NULL #d file#1 $1 #d documentstyle book #%}}} #d module#1 \tt{$1} \linuxdoc \begin{\documentstyle} \title S-Lang CFITSIO Module Reference \author John E. Davis, \tt{davis@space.mit.edu} \date \__today__ \toc #d cfitsio_url http://heasarc.gsfc.nasa.gov/docs/software/fitsio/ #d cfitsio_ref_url \ http://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/cfitsio.html #d fits_url http://heasarc.gsfc.nasa.gov/docs/heasarc/fits.html #d FITS FITS #d CFITSIO CFITSIO \chapter{Introduction} #%{{{ \url{\fits_url}{FITS} (Flexible Image Transport System) is a data format that is in widespread use by the astronomical community. \url{\cfitsio_ref_url}{CFITSIO} is a popular C library that interfaces to such files and provides support for all features of the format. Moreover \CFITSIO supports a number of unofficial or proposed \FITS conventions that are in widespread use. This package makes use of the \CFITSIO library allow one to manipulate \FITS files from the \slang interpreter. The package consists of two interfaces: a high level interface and a low level one. The low level interface is implemented as a module and is more or less a straightforward wrapping of the functions of the \CFITSIO library. Functions from this interface are prefixed with an underscore to indicate that they are part of the low-level interface. The high level interface is written in \slang and makes use of functions from the low level interface. While there is some overlap with the semantics of the \CFITSIO library, the high level interface should be regarded as a separate interface to fits files. To illustrate the difference between the two interfaces, consider the low-level \ifun{_fits_read_col} function and its high level counterpart \sfun{fits_read_col}. The low-level function reads a single column, specified via the column number, from a fits binary table and performs a minimal amount of error checking. In contrast, \sfun{fits_read_col} is a high level function that reads one or more columns, specified either as column numbers or named columns, from a table and does so in a way that takes into account the way \CFITSIO performs buffering for maximum efficiency. Moreover, the high level function checks for the presence of TDIM keywords or columns to give the arrays it returns the proper dimensionality. If any errors occur, the function will throw an exception. #%}}} \chapter{The high-level interface} \sect{Overview} #%{{{ The high-level interface consists of a number of functions that are written in \slang and are designed to take some of the tedium out of performing standard operations on fits files. To illustrate this point, consider the creation of a fits file with a binary table extension called called ``COSXSINX'': #v+ variable data = struct { x, cosx, sinx }; data.x = [0:2*PI:0.01]; data.cosx = cos(data.x); data.sinx = sin(data.x); fits_write_binary_table ("foo.fits", "COSXSINX", data); #v- It can't get much easier than that! #%}}} \sect{Opening and Closing Files} #%{{{ In general the high-level functions take an argument that represents the fits file to be manipulated. It may be either an already open file pointer such as one returned by \sfun{fits_open_file}, or the name of a file to be opened. In the documentation for the functions, this fact is indicated by #v+ Fits_File_Type or String_Type fd; #v- showing that the file descriptor may be either an open file pointer or a string. If specified as a string, then a fits file of that name will be opened in a mode that is compatible with the operation being performed, with the current HDU (header-data unit) set to the first ``most interesting'' one. Here, ``first most interesting'' means the first HDU with a non-zero value for the NAXIS keyword. For example, sometimes one simply wants to read some keywords from a file. In such a case it is not necessary to explicitly call \sfun{fits_open_file}. Rather simply pass the name of the file to the appropriate function: #v+ (object, ra_targ, dec_targ) = fits_read_key ("foo.fits", "OBJECT", "RA_TARG", "DEC_TARG"); #v- It may be necessary to specify which HDU should be used if the ``first most interesting'' one is not the desired HDU. The easiest way to do that is to specify the extension using \CFITSIO's virtual file syntax, e.g., #v+ (object, ra_targ, dec_targ) = fits_read_key ("foo.fits+1", "OBJECT", "RA_TARG", "DEC_TARG"); (object, ra_targ, dec_targ) = fits_read_key ("foo.fits[EVENTS]", "OBJECT", "RA_TARG", "DEC_TARG"); #v- If one is going to make a number of calls to functions in the high-level interface using the same file, then it is a good idea to explicitly open the file, e.g., #v+ fptr = fits_open_file ("foo.fits[EVENTS]", "w"); #v- opens the file for both reading and writing and sets the current HDU to the ``EVENTS'' extension. The object returned by the \sfun{fits_open_file} function is an object of type \var{Fits_File_Type}. It is automatically destroyed when it goes out of scope. When this happens, the fits file attached to it will be silently closed. Consider: #v+ define write_image_to_file (file, img) { variable fptr = fits_open_file ("new.fits", "c"); fits_write_image (fptr, NULL, img, NULL, NULL); fits_write_date (fptr); } #v- Here, the \exmp{write_image_to_file} function will create a new file called \file{new.fits} and write the specified image to the file. In this example, the file pointer object was not explicitly closed. Since the \exmp{fptr} variable goes out of scope when the function returns, the cfitsio module will silently close the file. While this is a convenient feature for many purposes, it is always better to explicitly close a file when it has been modified. The reason for this is that \CFITSIO writes to internal buffers and then flushes those to the disk. Often some buffers will not get written to the disk until the file is closed. If the disk is full, or something else goes wrong then the file will not be properly closed resulting in a incomplete or corrupt file. Hence it is strongly recommended that one explicitly close a file after writing to a file, i.e., #v+ define write_image_to_file (file, img) { variable fptr = fits_open_file ("new.fits", "c"); fits_write_image (fptr, NULL, img, NULL, NULL); fits_write_date (fptr); fits_close_file (fptr); } #v- #%}}} \sect{Keywords} The high-level interface contains several functions for manipulating header keywords and records. \sect1{Reading Header Keywords} #%{{{ The \sfun{fits_read_key} may be used to read the values of one or more keywords. Suppose that the file \file{casA.fits} contains the following keywords in an extension called ``EVENTS'': #v+ TELESCOP= 'CHANDRA ' / Telescope INSTRUME= 'ACIS ' / Instrument DETNAM = 'ACIS-7 ' / Detector GRATING = 'NONE ' / Grating OBJECT = 'CAS A ' / Source name RA_NOM = 350.91781217089 / Nominal RA DEC_NOM = 58.792819089577 / Nominal Dec ROLL_NOM= 323.38710408328 / Nominal Roll #v- The \sfun{fits_read_key} function may be used to read, e.g, the OBJECT and RA_NOM keywords: #v+ (obj, ra) = fits_read_key ("casA.fits[EVENTS]", "OBJECT", "RA_NOM"); #v- After the function call, the variables \exmp{obj} and \exmp{ra} will have the data types \var{String_Type} and \var{Double_Type}, resp. If the requested keyword does not exist in the header, the function will return \NULL to signal its not existence: #v+ exptime = fits_read_key ("casA.fits[EVENTS]", "EXPTIME"); if (exptime == NULL) { message ("*** Warning: EXPTIME does not exist. Assuming 3.2); exptime = 3.2; } #v- The \sfun{fits_read_key_struct} is an alternative to \sfun{fits_read_key} that returns a structure with field names that correspond to the keyword names. In most cases, a field name will just be the lower case version of the keyword name. However, if the keyword name does not start with an alphabetic character or contains a hyphen, then it will be normalized as follows: \begin{enum} \item The keyword name will be lowercased. \item All non-alphanumeric characters will be changed to an underscore. \item If the first character of the resulting name is numeric, then the name will be prefixed with an underscore. \end{enum} To illustrate the normalization process, consider: #v+ keys = fits_read_key_struct ("foo.fits", "OBJECT", "2CRVL3", "DATE-OBS"); #v- After the function call, \exmp{keys} will be a structure with the 3 fields: \exmp{object}, \exmp{_2crvl3}, and \exmp{date_obs}. If any of these keywords do not exist in the header, the value of the corresponding structure field will be NULL. #%}}} \sect1{Writing Header Keywords} #%{{{ The \sfun{fits_update_key} function may be used to write or update the value of a keyword. If a keyword of the specified name exists, then the value of the keyword will be updated to the new value. Otherwise a new keyword will be appended to the header. Other specialized keyword writing routines include \sfun{fits_write_date}, which write the current date in the required format, and \sfun{fits_write_chksum}, which computes and updates the checksum of the HDU. Finally the \sfun{fits_write_comment} and \sfun{fits_write_history} functions may be used to write comments and history records to the header, respectively. #%}}} \sect{Binary Tables} \sect1{Reading Binary Tables} #%{{{ There are a several functions for reading binary tables. The simplest one, \sfun{fits_read_table} reads the entire binary table into a structure, whose fields correspond to the names of the columns in the table. (If a column has a name that contains non-alphanumeric characters, or does not start with an alphabetic character, then the structure field name for the column will be undergo the normalization process described for keywords.) For example, consider a file called \exmp{foo.fits} with a binary table whose structure is defined by the FITS header: #v+ XTENSION= 'BINTABLE' BITPIX = 8 NAXIS = 2 NAXIS1 = 34 NAXIS2 = 500 PCOUNT = 0 GCOUNT = 1 TFIELDS = 4 TTYPE1 = 'TIME ' TFORM1 = 'D ' TTYPE2 = 'X ' TFORM2 = 'E ' TTYPE3 = 'Y ' TFORM3 = 'E ' TTYPE4 = 'PHAS ' TFORM4 = '9I ' EXTNAME = 'EXAMPLE ' TDIM4 = '(3,3) ' #v- This header shows that the binary table is 500 rows in length and contains 4 columns with names TIME, X, Y, and PHAS. The table may be read via #v+ tbl = fits_read_table ("foo.fits[EXAMPLE]"); #v- assigning a structure to the \exmp{tbl} variable. The structure has fields with names \exmp{time}, \exmp{x}, \exmp{y}, and \exmp{phas}, which be displayed via #v+ vmessage ("tbl.time = %S", tbl.time); vmessage ("tbl.x = %S", tbl.x); vmessage ("tbl.y = %S", tbl.y); vmessage ("tbl.phas = %S", tbl.y); #v- producing: #v+ tbl.time = Double_Type[500] tbl.x = Float_Type[500] tbl.y = Float_Type[500] tbl.z = Short_Type[500,3,3] #v- Note that the \exmp{fits_read_table} function not only read the data in a way that preserved the data type, but it also correctly identified the \exmp{phas} column as one containing a 3x3 image in every row! Often one is interested in only a few columns of a table. Instead of reading the entire table, which could use a lot of memory for a large table, the \exmp{fits_read_table} function may also be used to read just the specified columns, e.g., #v+ tbl = fits_read_table ("foo.fits[EXAMPLE]", "x", "y"); #v- will read just the \exmp{X} and \exmp{Y} columns. An alternative interface with much the same functionality is provided by the \exmp{fits_read_col} function. Instead of returning the data as a structure, it returns the data as multiple return values, e.g., #v+ t = fits_read_col ("foo.fits[EXAMPLE]", "time"); (x,y) = fits_read_col ("foo.fits[EXAMPLE]", "x", "y"); #v- The \sfun{fits_read_cell} function may be used to read a single cell in the table. For example #v+ phas = fits_read_cell ("foo.fits[EXAMPLE]", "phas", 4); #v- will return the 3x3 array of the ``phas'' column in the fourth row. Finally, the \exmp{fits_read_cells} function may be used to read a specified range of rows in the table. For instance, #v+ (x,y) = fits_read_cells ("foo.fits[EXAMPLE]", "x", "y", 1, 1000); #v- will read the first 1000 rows of the \exmp{X} and \exmp{Y} columns in the table. #%}}} \sect1{Writing Binary Tables} #%{{{ The high-level interface has several functions that are useful for the creation of a binary table. Chief among them is the \sfun{fits_write_binary_table} function, which supports several methods of calling it. The simplest use was illustrated earlier. Here more complicated uses will be considered. As a first step, suppose that the binary table is to contain data for the Lissajous curve constructed as follows: #v+ A_x = 10.0; omega_x = 3.0; phi_x = 0.0; A_y = 20.0; omega_y = 7.0; phi_y = 1.0; t = [0:100:0.01]; x = A_x * cos (omega_x*t + phi_x); y = A_y * cos (omega_y*t + phi_y); #v- The goal is to write out arrays \exmp{t}, \exmp{x}, and \exmp{y} to a binary table called LISSAJOUS, and with columns of the corresponding names. The easiest way is to use: #v+ data = struct {t, x, y}; data.t = t; data.x = x; data.y = y; fits_write_binary_table ("foo.fits", "LISSAJOUS", data); #v- Now suppose that it is desired to write the parameters defining the Lissajous pattern as keywords and to write a history record to the file. One way to do this is via the \exmp{fits_update_key}, \sfun{fits_write_history}, and \sfun{fits_write_comment} functions: #v+ fp = fits_open_file ("foo.fits[LISSAJOUS]"); fits_write_comment (fp, "This table contains data for a Lissajous pattern"); fits_update_key (fp, "A_X", A_x, "x(t) Amplitude"); fits_update_key (fp, "A_Y", A_y, "y(t) Amplitude"); fits_update_key (fp, "OMEGA_X", omega_x, "x(t) omega"); fits_update_key (fp, "OMEGA_Y", omega_y, "y(t) omega"); fits_update_key (fp, "PHI_X", phi_x, "x(t) phase"); fits_update_key (fp, "PHI_Y", phi_y, "y(t) phase"); fits_write_history (fp, "This was written as an example for the " + "documentation of the slang cfitsio module"); fits_close_file (fp); #v- The advantage of using the \exmp{fits_update_key} is that it allows control over the comment associated with the keyword; however, repeated calls to \sfun{fits_update_key} can become tedious. A simpler mechanism to achieve this goal is to pass the keywords and history information to the \sfun{fits_write_binary_table} function as an optional arguments, #v+ keys = struct {A_x, omega_x, phi_x, A_y, omega_y, phi_y}; set_struct_fields (keys, A_x, omega_x, phi_x, A_y, omega_y, phi_y); hist = struct {history, comment}; hist.comment = "This table contains data for a Lissajous pattern"; hist.history = "This was written as an example for the " + "documentation of the slang cfitsio module"; fits_write_binary_table ("foo.fits", "LISSAJOUS", data, keys, hist); #v- to produce: #v+ XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 24 / width of table in bytes NAXIS2 = 10000 / number of rows in table PCOUNT = 0 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 3 / number of fields in each row TTYPE1 = 't ' / label for field 1 TFORM1 = 'D ' / data format of field: 8-byte DOUBLE TTYPE2 = 'x ' / label for field 2 TFORM2 = 'D ' / data format of field: 8-byte DOUBLE TTYPE3 = 'y ' / label for field 3 TFORM3 = 'D ' / data format of field: 8-byte DOUBLE EXTNAME = 'LISSAJOUS' / name of this binary table extension A_X = 10 OMEGA_X = 3 PHI_X = 0 A_Y = 20 OMEGA_Y = 7 PHI_Y = 1 COMMENT This table contains data for a Lissajous pattern HISTORY This was written as an example for the documentation of the slang cfitsi HISTORY o module #v- It is important to note that in the the above examples, the name of the file to contain the binary table was explicitly passed to the \sfun{fits_write_binary_table} function. This causes \sfun{fits_write_binary_table} to create a \em{new} file containing the binary table, and if a file of that name exists, \em{it will be deleted} before the new one is created. To append a table to an existing file, first open it using the \sfun{fits_open_file} function, and then use the file pointer in place of the name: #v+ fp = fits_open_file ("foo.fits", "w"); % <<-- note the "w" . . fits_write_binary_table (fp, ....); fits_close_file (fp); #v- This technique must also be used to create a file containing multiple binary tables: #v+ fp = fits_open_file ("foo.fits", "c"); % <<-- note the "c" . . fits_write_binary_table (fp, ....); % first table . . fits_write_binary_table (fp, ....); % second table fits_close_file (fp); #v- #%}}} \sect{Images} \sect1{Preliminaries} #%{{{ Dealing with FITS images in \slang is easy as long as one understands that FITS stores images in FORTRAN \em{column-major} order, whereas \slang utilizes a C \em{row-major} order. That is, the first dimension of a FITS array varies fastest whereas it is the last dimension of a \slang array that varies fastest. This difference is automatically accounted for by the underlying \module{cfitsio} module. In other words, images may be used in \slang scope as ordinary \slang arrays where the first dimension varies slowest, and the \module{cfitsio} module will make the necessary translations when reading or writing an image from a file. An easy way to remember the \slang or C ordering is that for a 2-d array, the first index is a row index and the second a column--- the same as matrices are indexed in linear algebra. Do not fall into the trap of indexing a \slang array the same as you would of indexing a point in Cartesian space (x,y), instead think in terms of rows and columns. #%}}} \sect1{Reading and Writing Images} #%{{{ The \sfun{fits_read_img} may be used to read the image from the primary FITS HDU or a FITS image extension. It is not designed to read images that are stored in binary tables--- there are other functions for that purpose. The \sfun{fits_read_img} function simply returns the data as an array of the appropriate type and dimensions (in row-major order) with any scaling defined via the BZERO and BSCALE header keywords applied. Writing an image HDU is somewhat more involved than reading one because in addition to writing the image data, the header must first be set up to describe the image. Fortunately, the high-level functions make this easy. Suppose that one has created an image array via, e.g., the \module{histogram} module's \ifun{hist2d} function from the X and Y columns of a binary table: #v+ (x,y) = fits_read_col ("evt2.fits[EVENTS]", "X","Y"); xgrid = 3840.5 + [0:1023:2]; ygrid = 3840.5 + [0:1023:2]; img = hist2d (y, x, ygrid, xgrid); #v- and that one wants to write this out to a fits file called \file{img.fits}. The simplest way to do this is using \sfun{fits_write_image_hdu}: #v+ fits_write_image_hdu ("img.fits", NULL, img); #v- Note that the data-type of the image array controls the type of image written to the fits file. If the image array is an array of \exmp{Double_Type}s, then the image will be written with BITPIX set to -64. To have such an array out as 16 bit integers, then the array must first be scaled to the range of a 16 bit integer and then typecast to \var{Int16_Type}: #v+ int16_image = typecast (img, Int16_Type); #v- Additional keywords may be written to the image HDU using the \sfun{fits_update_key} function. And like \sfun{fits_write_binary_table}, the \sfun{fits_write_image_hdu} function takes optional parameters that specify additional keywords, history, and comments to be written. The reader is referred to the discussion of the \sfun{fits_write_binary_table} function for more information. #%}}} #% \sect{Copying Headers} \sect{WCS Routines} \sect1{Introduction} The FITS package includes a set of routines for reading and writing \url{http://fits.gsfc.nasa.gov/fits_wcs.html}{WCS} keywords in the form proposed by \url{http://www.atnf.csiro.au/people/mcalabre/WCS/wcs.pdf}{Greisen and Calabretta}. Although they are part of the high-level interface, the routines are somewhat experimental and as such must be loaded separately via: #v+ require ("fitswcs"); #v- The routines in this interface deal with a structure that describes the WCS via the following fields: \begin{descrip} \tag{naxis} The number of axes to transform (Int_Type) \tag{ctype} Specifies the WCS transformation (String_Type[naxis]) \tag{cunit} Units (String_Type[naxis]) \tag{crval} WCS values at the reference pixel (Double_Type[naxis]) \tag{crpix} The coordinates of the reference pixel (Double_Type[naxis]) \tag{cdelt} Species the gradient at the reference pixel (Double_Type[naxis]) \tag{pc} An array used to linearly transform the WCS. (Double_Type[naxis,naxis] or NULL) \tag{pv} An array of addition parameters used to specify the WCS (NULL in most cases) \tag{ps} An array of additional string parameters (NULL in most cases). \tag{wcsname} A name given to this coordinate system. \end{descrip} While the user is encouraged to understand the FITS WCS conventions and the precise meanings of these fields, the \exmp{fitswcs} interface provides routines to make the use of this structure as transparent as possible for the most common uses. A few examples will illustrate this. \sect1{Examples} Consider once again the example of creating a FITS image by binning two columns of a FITS binary table: #v+ (x,y) = fits_read_col ("evt2.fits[EVENTS]", "X","Y"); xgrid = 3840.5 + [0:1023:2]; ygrid = 3840.5 + [0:1023:2]; img = hist2d (y, x, ygrid, xgrid); fits_write_image_hdu ("img.fits", NULL, img); #v- Unfortunately the resulting file will contain none of the WCS information that was attached to the X and Y columns from which the image was constructed. One might be tempted to simply copy that information to the output file with the aid of the \exmp{fitswcs} routines via #v+ wcs = fitswcs_get_column_wcs ("evt2.fits[EVENTS]", ["Y", "X"]); fitswcs_put_img_wcs ("img.fits", wcs); #v- The problem with this approach is that the WCS read from the binary table does not describe the image created from it because it knows nothing about how the image was binned nor how the image pixel coordinates relate back to the X and Y columns. That information is contained in the definition of the grids passed to the \ifun{hist2d} function: #v+ xgrid = 3840.5 + [0:1023:2]; ygrid = 3840.5 + [0:1023:2]; #v- These grids describe a simple linear transformation from image pixel coordinates to the (X,Y) coordinates of the binary table. Since the transformation is linear, the \exmp{fitswcs_bin_wcs} function may be used to transform the WCS: #v+ wcs = fitswcs_bin_wcs (wcs, ygrid, xgrid); #v- It is the transformed WCS that is to be written out: #v+ fitswcs_put_img_wcs ("img.fits", wcs); #v- It is important to note the order in which the X and Y arguments were used. Recall that FITS stores images in a FORTRAN column-major order whereas \slang uses a row-major order. For this reason, ``row-like'' parameters come before ``column-like'' parameters in statements such as #v+ img = hist2d (y, x, ygrid, xgrid); wcs = fitswcs_get_column_wcs ("evt2.fits[EVENTS]", ["Y", "X"]); wcs = fitswcs_bin_wcs (wcs, ygrid, xgrid); #v- \sect1{Alternate WCS} Sometimes it is useful to attach more than one coordinate system to an image. For example, it is useful to have a coordinate system that maps the pixel coordinates back to (X,Y) coordinates from which they were derived. The \sfun{fitswcs_new_img_wcs} may be used to construct a linear WCS corresponding to the linear coordinate grids of the image: #v+ wcsP = fitswcs_new_img_wcs (ygrid, xgrid); wcsP.wcsname = "PHYSICAL"; fitswcs_put_img_wcs ("img.fits", wcsP, 'P'); #v- Note that the WCS was given the name ``PHYSICAL''. While not required, this enables this alternate coordinate system to be displayed as the physical system by the DS9 image display program. \sect1{Degenerate Axes} Consider a FITS file \exmp{hydra.fits} containing an image HDU with the following FITS header: #v+ SIMPLE = T / file does conform to FITS standard BITPIX = -32 / number of bits per data pixel NAXIS = 4 / number of data axes NAXIS1 = 657 / length of data axis NAXIS2 = 657 / length of data axis NAXIS3 = 1 / length of data axis NAXIS4 = 1 / length of data axis CTYPE1 = 'RA---SIN' CRVAL1 = 139.5235701 CRPIX1 = 330 CDELT1 = -0.0004166666768 CTYPE2 = 'DEC--SIN' CRVAL2 = -12.0955450949 CRPIX2 = 328 CDELT2 = 0.0004166666768 PC1_1 = 1 PC1_2 =-1.7318465835227e-09 PC2_1 = 1.7318465835227e-09 PC2_2 = 1 CTYPE3 = 'FREQ ' CRVAL3 = 332902343.75 CRPIX3 = 1 CDELT3 = 2490234.5 CTYPE4 = 'STOKES ' CRVAL4 = 1 CRPIX4 = 1 CDELT4 = 1 #v- This particular image had so-called ``degenerate axes'' added, which had the effect of increasing its dimensionality from 2 to 4. As such, this image may be rejected by some image display programs that expect a 2-d image. In fact, #v+ img = fits_read_img ("hydra.fits"); wcs = fitswcs_get_img_wcs ("hydra.fits"); #v- will read the image as a \exmp{Float_Type[1,1,657,657]} object, and the WCS as a 4-d with wcs.ctype equal to #v+ ["STOKES", "FREQ", "DEC--SIN", "RA---SIN"] #v- The degenerate dimensions may be removed from the image via #v+ img = img[0,0,*,*]; #v- producing a 2d image of type \exmp{Float_Type[657,657]}. The corresponding wcs may be obtained using the \sfun{fitswcs_slice} function to extract the last two dimensions of the WCS: #v+ wcs = fitswcs_slice (wcs, [2,3]); #v- Another use of the \sfun{fitswcs_slice} is to reorder the dimensions of the WCS. For example, earlier it was pointed out that when constructing an image from columns in a table, that one read the WCS in a row-major order. If the reverse order was used when obtaining the WCS from the columns of a binary table, e.g., #v+ wcs = fitswcs_get_column_wcs ("evt2.fits[EVENTS]", ["X", "Y"]); #v- then it would have been necessary to reverse the order of the dimensions of the WCS structure. The \sfun{fitswcs_slice} may be used to swap the dimensions of the WCS, e.g., #v+ wcs = fitswcs_slice (wcs, [1,0]); #v- #%+ (Recall that the FITS convention is to assign the pixel coordinate (0.5,0.5) to the extreme corner of the first pixel, whereas many systems, including \slang, use (0,0) for that position and regard the center of the pixel as being at (0.5,0.5). #%- #% \sect{Examples} \sect{High-level Function Reference} #i fitsfuns.tm \sect{WCS Function Reference} #i fitswcsfuns.tm \chapter{The low-level interface} \sect{Overview} #%{{{ Functions in the low-level module are usually needed when it is necessary to perform some task that is not readily achievable using the high-level interface. This module may be loaded using #v+ require ("cfitsio"); #v- When mixing functions from both interfaces, it is not necessary to explicitly load the \module{cfitsio} module in this manner since it is loaded automatically by the high-level interface. For the most part, for those functions that have been wrapped, the \module{cfitsio} module represents a 1-1 mapping between the functions of the cfitsio library and those of the module. For this reason a detailed description of the functions in the \module{cfitsio} module will not be given here; the reader is referred to the documentation for the \CFITSIO library itself for the details. Here only the semantic differences between the functions in the module and those of the library, and how the functions are documented. Most \CFITSIO functions adhere to a so-called ``inherited status'' convention via a ``status'' argument as the last parameter. In addition functions also return the error status as a return value. For simplicity the wrapping by the module does not respect this convention. That is, none of the module's functions take a status argument. For example, the \CFITSIO documentation for the \exmp{fits_get_num_hdus} specifies that it is to be called from C via: #v+ status = fits_get_num_hdus (fptr, &hdunum, &status); #v- This function has been wrapped such that it is to be called from \slang via #v+ status = _fits_get_num_hdus (fptr, &hdunum); #v- #%}}} \sect{Low-level Function Reference} #s+ #i mkindex.sl #s- #d iflatex#2 <#if output=latex2e>$1<#unless output=latex2e>$2 #d ifhtml#2 <#if output=html>$1<#unless output=html>$2 #d xreferences#1 This function is a wrapper around the cfitsio library \ function \exmp{$1}. \ See \ifhtml{\url{\cfitsio_fun_url{$1}}{its documentation}}{its documentation}\ for additional information. #d cfitsioxref#1 \ifhtml{\url{\cfitsio_fun_url{$1}}{$1}}{\exmp{$1}} #i rtl/cfitsiofuns.tm \end{\documentstyle} slcfitsio-0.3.8/doc/tm/fixtex.sl0000644002657400265740000000443710565374626015627 0ustar davisdavis#!/usr/bin/env jed-script % Version 0.3.2-0 if (__argc != 2) { message ("Usage: ./fixtex.sl "); quit_jed (); } variable file = __argv[1]; () = read_file (file); % Patch up the >,< signs bob (); replace ("$<$", "<"); replace ("$>$", ">"); % It appears that sgml2tex screws up _for in section titles, producing \_{for}. replace ("ion\\_{", "ion{\\_"); % Make the first chapter a preface bob (); if (bol_fsearch ("\\chapter{Preface}")) { push_spot (); push_mark (); go_right (8); insert ("*"); % \chapter{ --> \chapter*{ () = bol_fsearch ("\\chapter{"); push_spot (); insert("\\tableofcontents\n"); eol (); insert ("\n\\pagenumbering{arabic}"); pop_spot (); narrow (); bob (); replace ("\\section{", "\\section*{"); widen (); if (bol_bsearch ("\\tableofcontents")) delete_line (); pop_spot (); if (bol_bsearch ("\\maketitle")) insert ("\\pagenumbering{roman}\n"); } static define fixup_urldefs () { % pdflatex cannot grok urldef bob (); while (bol_fsearch("\\urldef{") and ffind ("\\url{")) { variable line = line_as_string (); bol (); insert ("\\ifpdf\n"); deln (7); insert ("\\newcommand"); push_mark (); ()=ffind ("}"); variable macro = bufsubstr (); () = ffind ("\\url"); go_left (1); trim (); insert("{"); % pdflatex cannot grok # in urls. Nuke em. if (ffind ("#")) { del_eol (); insert ("}"); } eol (); insert ("}\n\\else\n"); insert (line); newline (); insert ("\\fi\n"); } } static define remove_repeated_urls () { variable name, url; variable names = Assoc_Type[Int_Type, 0]; while (bol_fsearch ("{\\em ")) { go_right (4); skip_white (); push_mark (); () = ffind ("}"); !if (looking_at ("} {\\tt ")) { pop_mark(0); continue; } name = bufsubstr (); if (names[name]) { go_right(1); push_mark (); () = ffind ("}"); go_right(1); del_region (); } else { names[name] = 1; go_right(1); () = ffind ("}"); go_right (1); } % Now remove empty lines inserted by the broken sgml2latex program. skip_white (); !if (eolp ()) continue; go_right(1); skip_white (); if (eolp ()) del (); } } fixup_urldefs (); remove_repeated_urls (); save_buffer (); quit_jed (); slcfitsio-0.3.8/doc/tm/helpfile.tm0000644002657400265740000000035610214374067016074 0ustar davisdavis#i slhlp.tm #d xreferences#1 \ This function is a wrapper around the CFITSIO function \exmp{$1}.\__newline__\ See its documentation for additional information. #d cfitsioxref#1 $1 #i rtl/cfitsiofuns.tm #i fitsfuns.tm #i fitswcsfuns.tm slcfitsio-0.3.8/doc/tm/mkindex.sl0000644002657400265740000000370310564706572015750 0ustar davisdavis% The code here constructs an index for the low-level routines. It uses % the index page at listed off % http://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/cfitsio.html % Each function is indexed using: % fits_clear_errmark % [*] % static variable Index_Page = "node119.html"; static variable CFitsio_Root_URL = "http://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user"; static variable Wget_Cmd = "wget --quiet"; static define retrieve_url (url, outfile) { vmessage ("Obtaining the cfitsio index from heasarc..."); () = system (sprintf ("%s -O '%s' '%s'", Wget_Cmd, outfile, url)); } static define mkindex () { variable cbuf = whatbuf (); variable index_url = strcat (CFitsio_Root_URL, "/", Index_Page); variable tmpfile = sprintf ("/tmp/cfitsio_index_%d_%d", getpid(),_time()); retrieve_url (index_url, tmpfile); () = read_file (tmpfile); () = remove (tmpfile); variable index = Assoc_Type[String_Type]; bob (); while (bol_fsearch ("fits_")) { () = ffind ("fits_"); push_mark (); () = ffind (""); variable fun = bufsubstr (); go_down(1); if (0 == ffind (" fitsfuns.tm fitswcsfuns.tm: ../../src/fitswcs.sl $(SL2TM) ../../src/fitswcs.sl > fitswcsfuns.tm text-files: $(TXT_FILES) #----- SGML Files ----------------------------------------------------------- $(MODULE).sgml : $(MODULE).tm $(MODULE_DEPS) $(TMEXPAND) -I$(MACRODIR) $(MODULE).tm $(MODULE).sgml #----- HTML Files ----------------------------------------------------------- $(MODULE).html : $(MODULE).sgml $(SGML2HTML) $(MODULE).sgml #----- TeX Files ------------------------------------------------------------ $(MODULE).tex : $(MODULE).sgml $(SGML2LATEX) $(MODULE).sgml ./fixtex.sl $(MODULE).tex #----- PDF Files ----------------------------------------------------------- $(MODULE).pdf : $(MODULE).tex $(MAKE) texclean $(PDFLATEX) $(MODULE).tex $(PDFLATEX) $(MODULE).tex $(PDFLATEX) $(MODULE).tex #----- PS Files ----------------------------------------------------------- $(MODULE).ps : $(MODULE).tex texclean $(LATEX) $(MODULE).tex $(LATEX) $(MODULE).tex $(LATEX) $(MODULE).tex dvips -o $(MODULE).ps $(MODULE).dvi #----- Text Files ----------------------------------------------------------- $(MODULE).txt: $(MODULE).sgml $(SGML2TXT) $(MODULE).sgml #---------------------------------------------------------------------------- help-files: $(HLP_FILE) $(HLP_FILE): $(HLP_TM_FILE) $(HLPFUNS_TM) $(TMEXPAND) -I$(MACRODIR) $(HLP_TM_FILE) $(HLP_FILE) texclean: -rm -f *.dvi *.log *.aux *.toc *.out clean: texclean -rm -f *~ rtl/*.BAK rtl/*~ *.tmp *-error distclean: clean -rm -f *.html *.ps $(HLP_FILE) $(TXT_FILES) $(TEX_FILES) $(SGML_FILES) $(PDF_FILES) $(AUTOGEN_TM) install-txt: $(TXT_FILES) -mv $(TXT_FILES) ../text install-help: $(HLP_FILE) -mkdir -p $(HELPDIR) -mv $(HLP_FILE) $(HELPDIR) install-all: all install-help install-txt $(PS_FILES) $(PDF_FILES) -mkdir -p $(HTMLDIR) $(PSDIR) $(SGMLDIR) $(PDFDIR) -mv *.html $(HTMLDIR) -mv $(PS_FILES) ../ps -mv $(SGML_FILES) ../sgml -mv $(PDF_FILES) ../pdf install: install-txt install-help slcfitsio-0.3.8/doc/text/0000755002657400265740000000000010621347550014301 5ustar davisdavisslcfitsio-0.3.8/doc/text/cfitsio.txt0000644002657400265740000032156610611753762016524 0ustar davisdavis S-Lang CFITSIO Module Reference John E. Davis, davis@space.mit.edu Apr 19, 2007 ____________________________________________________________ Table of Contents Introduction The high-level interface 1. Overview 2. Opening and Closing Files 3. Keywords 3.1 Reading Header Keywords 3.2 Writing Header Keywords 4. Binary Tables 4.1 Reading Binary Tables 4.2 Writing Binary Tables 5. Images 5.1 Preliminaries 5.2 Reading and Writing Images 6. WCS Routines 6.1 Introduction 6.2 Examples 6.3 Alternate WCS 6.4 Degenerate Axes 7. High-level Function Reference 7.1 fits_read_errmsgs 7.2 fits_set_verbose_errors 7.3 fits_open_file 7.4 fits_close_file 7.5 fits_move_to_interesting_hdu 7.6 fits_key_exists 7.7 fits_get_colnum 7.8 fits_binary_table_column_exists 7.9 fits_read_col 7.10 fits_read_col_struct 7.11 fits_read_cell 7.12 fits_read_row 7.13 fits_read_header 7.14 fits_read_table 7.15 fits_read_key 7.16 fits_read_key_struct 7.17 fits_create_binary_table 7.18 fits_write_binary_table 7.19 fits_update_key 7.20 fits_update_logical 7.21 fits_write_comment 7.22 fits_write_history 7.23 fits_write_date 7.24 fits_write_chksum 7.25 fits_verify_chksum 7.26 fits_read_records 7.27 fits_write_records 7.28 fits_get_keyclass 7.29 fits_get_bitpix 7.30 fits_read_img 7.31 fits_create_image_hdu 7.32 fits_write_image_hdu 7.33 fits_write_img 8. WCS Function Reference 8.1 fitswcs_new 8.2 fitswcs_slice 8.3 fitswcs_get_img_wcs 8.4 fitswcs_get_column_wcs 8.5 fitswcs_get_vector_wcs 8.6 fitswcs_new_img_wcs 8.7 fitswcs_put_img_wcs 8.8 fitswcs_put_column_wcs 8.9 fitswcs_linear_transform_wcs 8.10 fitswcs_rebin_wcs 8.11 fitswcs_bin_wcs 8.11 The low-level interface 9. Overview 10. Low-level Function Reference 10.1 _fits_get_errstatus 10.2 _fits_read_errmsg 10.3 _fits_open_file 10.4 _fits_delete_file 10.5 _fits_close_file 10.6 _fits_movabs_hdu 10.7 _fits_movrel_hdu 10.8 _fits_movnam_hdu 10.9 _fits_get_num_hdus 10.10 _fits_get_hdu_num 10.11 _fits_get_hdu_type 10.12 _fits_copy_file 10.13 _fits_copy_hdu 10.14 _fits_copy_header 10.15 _fits_delete_hdu 10.16 _fits_create_img 10.17 _fits_write_img 10.18 _fits_read_img 10.19 _fits_create_binary_tbl 10.20 _fits_update_key 10.21 _fits_update_logical 10.22 _fits_write_comment 10.23 _fits_write_history 10.24 _fits_write_date 10.25 _fits_write_record 10.26 _fits_modify_name 10.27 _fits_get_num_keys 10.28 _fits_read_key_integer 10.29 _fits_read_key_string 10.30 _fits_read_key_double 10.31 _fits_read_key 10.32 _fits_read_record 10.33 _fits_delete_key 10.34 _fits_get_colnum 10.35 _fits_insert_rows 10.36 _fits_delete_rows 10.37 _fits_insert_cols 10.38 _fits_delete_col 10.39 _fits_get_num_cols 10.40 _fits_get_rowsize 10.41 _fits_get_num_rows 10.42 _fits_write_col 10.43 _fits_read_col 10.44 _fits_get_keytype 10.45 _fits_get_keyclass 10.46 _fits_read_cols 10.47 _fits_write_chksum 10.48 _fits_update_chksum 10.49 _fits_verify_chksum 10.50 _fits_get_chksum 10.51 _fits_get_version ______________________________________________________________________ 1. Introduction FITS (Flexible Image Transport System) is a data format that is in widespread use by the astronomical community. CFITSIO is a popular C library that interfaces to such files and provides support for all features of the format. Moreover CFITSIO supports a number of unofficial or proposed FITS conventions that are in widespread use. This package makes use of the CFITSIO library allow one to manipulate FITS files from the S-lang interpreter. The package consists of two interfaces: a high level interface and a low level one. The low level interface is implemented as a module and is more or less a straightforward wrapping of the functions of the CFITSIO library. Functions from this interface are prefixed with an underscore to indicate that they are part of the low-level interface. The high level interface is written in S-lang and makes use of functions from the low level interface. While there is some overlap with the semantics of the CFITSIO library, the high level interface should be regarded as a separate interface to fits files. To illustrate the difference between the two interfaces, consider the low-level _fits_read_col function and its high level counterpart fits_read_col. The low-level function reads a single column, specified via the column number, from a fits binary table and performs a minimal amount of error checking. In contrast, fits_read_col is a high level function that reads one or more columns, specified either as column numbers or named columns, from a table and does so in a way that takes into account the way CFITSIO performs buffering for maximum efficiency. Moreover, the high level function checks for the presence of TDIM keywords or columns to give the arrays it returns the proper dimensionality. If any errors occur, the function will throw an exception. 2. The high-level interface 2.1. Overview The high-level interface consists of a number of functions that are written in S-lang and are designed to take some of the tedium out of performing standard operations on fits files. To illustrate this point, consider the creation of a fits file with a binary table extension called called ``COSXSINX'': variable data = struct { x, cosx, sinx }; data.x = [0:2*PI:0.01]; data.cosx = cos(data.x); data.sinx = sin(data.x); fits_write_binary_table ("foo.fits", "COSXSINX", data); It can't get much easier than that! 2.2. Opening and Closing Files In general the high-level functions take an argument that represents the fits file to be manipulated. It may be either an already open file pointer such as one returned by fits_open_file, or the name of a file to be opened. In the documentation for the functions, this fact is indicated by Fits_File_Type or String_Type fd; showing that the file descriptor may be either an open file pointer or a string. If specified as a string, then a fits file of that name will be opened in a mode that is compatible with the operation being performed, with the current HDU (header-data unit) set to the first ``most interesting'' one. Here, ``first most interesting'' means the first HDU with a non-zero value for the NAXIS keyword. For example, sometimes one simply wants to read some keywords from a file. In such a case it is not necessary to explicitly call fits_open_file. Rather simply pass the name of the file to the appropriate function: (object, ra_targ, dec_targ) = fits_read_key ("foo.fits", "OBJECT", "RA_TARG", "DEC_TARG"); It may be necessary to specify which HDU should be used if the ``first most interesting'' one is not the desired HDU. The easiest way to do that is to specify the extension using CFITSIO's virtual file syntax, e.g., (object, ra_targ, dec_targ) = fits_read_key ("foo.fits+1", "OBJECT", "RA_TARG", "DEC_TARG"); (object, ra_targ, dec_targ) = fits_read_key ("foo.fits[EVENTS]", "OBJECT", "RA_TARG", "DEC_TARG"); If one is going to make a number of calls to functions in the high- level interface using the same file, then it is a good idea to explicitly open the file, e.g., fptr = fits_open_file ("foo.fits[EVENTS]", "w"); opens the file for both reading and writing and sets the current HDU to the ``EVENTS'' extension. The object returned by the fits_open_file function is an object of type Fits_File_Type. It is automatically destroyed when it goes out of scope. When this happens, the fits file attached to it will be silently closed. Consider: define write_image_to_file (file, img) { variable fptr = fits_open_file ("new.fits", "c"); fits_write_image (fptr, NULL, img, NULL, NULL); fits_write_date (fptr); } Here, the write_image_to_file function will create a new file called new.fits and write the specified image to the file. In this example, the file pointer object was not explicitly closed. Since the fptr variable goes out of scope when the function returns, the cfitsio mod- ule will silently close the file. While this is a convenient feature for many purposes, it is always better to explicitly close a file when it has been modified. The reason for this is that CFITSIO writes to internal buffers and then flushes those to the disk. Often some buffers will not get written to the disk until the file is closed. If the disk is full, or something else goes wrong then the file will not be properly closed resulting in a incomplete or corrupt file. Hence it is strongly recommended that one explicitly close a file after writing to a file, i.e., define write_image_to_file (file, img) { variable fptr = fits_open_file ("new.fits", "c"); fits_write_image (fptr, NULL, img, NULL, NULL); fits_write_date (fptr); fits_close_file (fptr); } 2.3. Keywords The high-level interface contains several functions for manipulating header keywords and records. 2.3.1. Reading Header Keywords The fits_read_key may be used to read the values of one or more keywords. Suppose that the file casA.fits contains the following keywords in an extension called ``EVENTS'': TELESCOP= 'CHANDRA ' / Telescope INSTRUME= 'ACIS ' / Instrument DETNAM = 'ACIS-7 ' / Detector GRATING = 'NONE ' / Grating OBJECT = 'CAS A ' / Source name RA_NOM = 350.91781217089 / Nominal RA DEC_NOM = 58.792819089577 / Nominal Dec ROLL_NOM= 323.38710408328 / Nominal Roll The fits_read_key function may be used to read, e.g, the OBJECT and RA_NOM keywords: (obj, ra) = fits_read_key ("casA.fits[EVENTS]", "OBJECT", "RA_NOM"); After the function call, the variables obj and ra will have the data types String_Type and Double_Type, resp. If the requested keyword does not exist in the header, the function will return NULL to signal its not existence: exptime = fits_read_key ("casA.fits[EVENTS]", "EXPTIME"); if (exptime == NULL) { message ("*** Warning: EXPTIME does not exist. Assuming 3.2); exptime = 3.2; } The fits_read_key_struct is an alternative to fits_read_key that returns a structure with field names that correspond to the keyword names. In most cases, a field name will just be the lower case version of the keyword name. However, if the keyword name does not start with an alphabetic character or contains a hyphen, then it will be normalized as follows: 1. The keyword name will be lowercased. 2. All non-alphanumeric characters will be changed to an underscore. 3. If the first character of the resulting name is numeric, then the name will be prefixed with an underscore. To illustrate the normalization process, consider: keys = fits_read_key_struct ("foo.fits", "OBJECT", "2CRVL3", "DATE-OBS"); After the function call, keys will be a structure with the 3 fields: object, _2crvl3, and date_obs. If any of these keywords do not exist in the header, the value of the corresponding structure field will be NULL. 2.3.2. Writing Header Keywords The fits_update_key function may be used to write or update the value of a keyword. If a keyword of the specified name exists, then the value of the keyword will be updated to the new value. Otherwise a new keyword will be appended to the header. Other specialized keyword writing routines include fits_write_date, which write the current date in the required format, and fits_write_chksum, which computes and updates the checksum of the HDU. Finally the fits_write_comment and fits_write_history functions may be used to write comments and history records to the header, respectively. 2.4. Binary Tables 2.4.1. Reading Binary Tables There are a several functions for reading binary tables. The simplest one, fits_read_table reads the entire binary table into a structure, whose fields correspond to the names of the columns in the table. (If a column has a name that contains non-alphanumeric characters, or does not start with an alphabetic character, then the structure field name for the column will be undergo the normalization process described for keywords.) For example, consider a file called foo.fits with a binary table whose structure is defined by the FITS header: XTENSION= 'BINTABLE' BITPIX = 8 NAXIS = 2 NAXIS1 = 34 NAXIS2 = 500 PCOUNT = 0 GCOUNT = 1 TFIELDS = 4 TTYPE1 = 'TIME ' TFORM1 = 'D ' TTYPE2 = 'X ' TFORM2 = 'E ' TTYPE3 = 'Y ' TFORM3 = 'E ' TTYPE4 = 'PHAS ' TFORM4 = '9I ' EXTNAME = 'EXAMPLE ' TDIM4 = '(3,3) ' This header shows that the binary table is 500 rows in length and con- tains 4 columns with names TIME, X, Y, and PHAS. The table may be read via tbl = fits_read_table ("foo.fits[EXAMPLE]"); assigning a structure to the tbl variable. The structure has fields with names time, x, y, and phas, which be displayed via vmessage ("tbl.time = %S", tbl.time); vmessage ("tbl.x = %S", tbl.x); vmessage ("tbl.y = %S", tbl.y); vmessage ("tbl.phas = %S", tbl.y); producing: tbl.time = Double_Type[500] tbl.x = Float_Type[500] tbl.y = Float_Type[500] tbl.z = Short_Type[500,3,3] Note that the fits_read_table function not only read the data in a way that preserved the data type, but it also correctly identified the phas column as one containing a 3x3 image in every row! Often one is interested in only a few columns of a table. Instead of reading the entire table, which could use a lot of memory for a large table, the fits_read_table function may also be used to read just the specified columns, e.g., tbl = fits_read_table ("foo.fits[EXAMPLE]", "x", "y"); will read just the X and Y columns. An alternative interface with much the same functionality is provided by the fits_read_col function. Instead of returning the data as a structure, it returns the data as multiple return values, e.g., t = fits_read_col ("foo.fits[EXAMPLE]", "time"); (x,y) = fits_read_col ("foo.fits[EXAMPLE]", "x", "y"); The fits_read_cell function may be used to read a single cell in the table. For example phas = fits_read_cell ("foo.fits[EXAMPLE]", "phas", 4); will return the 3x3 array of the ``phas'' column in the fourth row. Finally, the fits_read_cells function may be used to read a specified range of rows in the table. For instance, (x,y) = fits_read_cells ("foo.fits[EXAMPLE]", "x", "y", 1, 1000); will read the first 1000 rows of the X and Y columns in the table. 2.4.2. Writing Binary Tables The high-level interface has several functions that are useful for the creation of a binary table. Chief among them is the fits_write_binary_table function, which supports several methods of calling it. The simplest use was illustrated earlier. Here more complicated uses will be considered. As a first step, suppose that the binary table is to contain data for the Lissajous curve constructed as follows: A_x = 10.0; omega_x = 3.0; phi_x = 0.0; A_y = 20.0; omega_y = 7.0; phi_y = 1.0; t = [0:100:0.01]; x = A_x * cos (omega_x*t + phi_x); y = A_y * cos (omega_y*t + phi_y); The goal is to write out arrays t, x, and y to a binary table called LISSAJOUS, and with columns of the corresponding names. The easiest way is to use: data = struct {t, x, y}; data.t = t; data.x = x; data.y = y; fits_write_binary_table ("foo.fits", "LISSAJOUS", data); Now suppose that it is desired to write the parameters defining the Lissajous pattern as keywords and to write a history record to the file. One way to do this is via the fits_update_key, fits_write_his- tory, and fits_write_comment functions: fp = fits_open_file ("foo.fits[LISSAJOUS]"); fits_write_comment (fp, "This table contains data for a Lissajous pattern"); fits_update_key (fp, "A_X", A_x, "x(t) Amplitude"); fits_update_key (fp, "A_Y", A_y, "y(t) Amplitude"); fits_update_key (fp, "OMEGA_X", omega_x, "x(t) omega"); fits_update_key (fp, "OMEGA_Y", omega_y, "y(t) omega"); fits_update_key (fp, "PHI_X", phi_x, "x(t) phase"); fits_update_key (fp, "PHI_Y", phi_y, "y(t) phase"); fits_write_history (fp, "This was written as an example for the " + "documentation of the slang cfitsio module"); fits_close_file (fp); The advantage of using the fits_update_key is that it allows control over the comment associated with the keyword; however, repeated calls to fits_update_key can become tedious. A simpler mechanism to achieve this goal is to pass the keywords and history information to the fits_write_binary_table function as an optional arguments, keys = struct {A_x, omega_x, phi_x, A_y, omega_y, phi_y}; set_struct_fields (keys, A_x, omega_x, phi_x, A_y, omega_y, phi_y); hist = struct {history, comment}; hist.comment = "This table contains data for a Lissajous pattern"; hist.history = "This was written as an example for the " + "documentation of the slang cfitsio module"; fits_write_binary_table ("foo.fits", "LISSAJOUS", data, keys, hist); to produce: XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 24 / width of table in bytes NAXIS2 = 10000 / number of rows in table PCOUNT = 0 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 3 / number of fields in each row TTYPE1 = 't ' / label for field 1 TFORM1 = 'D ' / data format of field: 8-byte DOUBLE TTYPE2 = 'x ' / label for field 2 TFORM2 = 'D ' / data format of field: 8-byte DOUBLE TTYPE3 = 'y ' / label for field 3 TFORM3 = 'D ' / data format of field: 8-byte DOUBLE EXTNAME = 'LISSAJOUS' / name of this binary table extension A_X = 10 OMEGA_X = 3 PHI_X = 0 A_Y = 20 OMEGA_Y = 7 PHI_Y = 1 COMMENT This table contains data for a Lissajous pattern HISTORY This was written as an example for the documentation of the slang cfitsi HISTORY o module It is important to note that in the the above examples, the name of the file to contain the binary table was explicitly passed to the fits_write_binary_table function. This causes fits_write_binary_table to create a new file containing the binary table, and if a file of that name exists, it will be deleted before the new one is created. To append a table to an existing file, first open it using the fits_open_file function, and then use the file pointer in place of the name: fp = fits_open_file ("foo.fits", "w"); % <<-- note the "w" . . fits_write_binary_table (fp, ....); fits_close_file (fp); This technique must also be used to create a file containing multiple binary tables: fp = fits_open_file ("foo.fits", "c"); % <<-- note the "c" . . fits_write_binary_table (fp, ....); % first table . . fits_write_binary_table (fp, ....); % second table fits_close_file (fp); 2.5. Images 2.5.1. Preliminaries Dealing with FITS images in S-lang is easy as long as one understands that FITS stores images in FORTRAN column-major order, whereas S-lang utilizes a C row-major order. That is, the first dimension of a FITS array varies fastest whereas it is the last dimension of a S-lang array that varies fastest. This difference is automatically accounted for by the underlying cfitsio module. In other words, images may be used in S-lang scope as ordinary S-lang arrays where the first dimension varies slowest, and the cfitsio module will make the necessary translations when reading or writing an image from a file. An easy way to remember the S-lang or C ordering is that for a 2-d array, the first index is a row index and the second a column--- the same as matrices are indexed in linear algebra. Do not fall into the trap of indexing a S-lang array the same as you would of indexing a point in Cartesian space (x,y), instead think in terms of rows and columns. 2.5.2. Reading and Writing Images The fits_read_img may be used to read the image from the primary FITS HDU or a FITS image extension. It is not designed to read images that are stored in binary tables--- there are other functions for that purpose. The fits_read_img function simply returns the data as an array of the appropriate type and dimensions (in row-major order) with any scaling defined via the BZERO and BSCALE header keywords applied. Writing an image HDU is somewhat more involved than reading one because in addition to writing the image data, the header must first be set up to describe the image. Fortunately, the high-level functions make this easy. Suppose that one has created an image array via, e.g., the histogram module's hist2d function from the X and Y columns of a binary table: (x,y) = fits_read_col ("evt2.fits[EVENTS]", "X","Y"); xgrid = 3840.5 + [0:1023:2]; ygrid = 3840.5 + [0:1023:2]; img = hist2d (y, x, ygrid, xgrid); and that one wants to write this out to a fits file called img.fits. The simplest way to do this is using fits_write_image_hdu: fits_write_image_hdu ("img.fits", NULL, img); Note that the data-type of the image array controls the type of image written to the fits file. If the image array is an array of Double_Types, then the image will be written with BITPIX set to -64. To have such an array out as 16 bit integers, then the array must first be scaled to the range of a 16 bit integer and then typecast to Int16_Type: int16_image = typecast (img, Int16_Type); Additional keywords may be written to the image HDU using the fits_update_key function. And like fits_write_binary_table, the fits_write_image_hdu function takes optional parameters that specify additional keywords, history, and comments to be written. The reader is referred to the discussion of the fits_write_binary_table function for more information. 2.6. WCS Routines 2.6.1. Introduction The FITS package includes a set of routines for reading and writing WCS keywords in the form proposed by Greisen and Calabretta . Although they are part of the high-level interface, the routines are somewhat experimental and as such must be loaded separately via: require ("fitswcs"); The routines in this interface deal with a structure that describes the WCS via the following fields: naxis The number of axes to transform (Int_Type) ctype Specifies the WCS transformation (String_Type[naxis]) cunit Units (String_Type[naxis]) crval WCS values at the reference pixel (Double_Type[naxis]) crpix The coordinates of the reference pixel (Double_Type[naxis]) cdelt Species the gradient at the reference pixel (Double_Type[naxis]) pc An array used to linearly transform the WCS. (Double_Type[naxis,naxis] or NULL) pv An array of addition parameters used to specify the WCS (NULL in most cases) ps An array of additional string parameters (NULL in most cases). wcsname A name given to this coordinate system. While the user is encouraged to understand the FITS WCS conventions and the precise meanings of these fields, the fitswcs interface provides routines to make the use of this structure as transparent as possible for the most common uses. A few examples will illustrate this. 2.6.2. Examples Consider once again the example of creating a FITS image by binning two columns of a FITS binary table: (x,y) = fits_read_col ("evt2.fits[EVENTS]", "X","Y"); xgrid = 3840.5 + [0:1023:2]; ygrid = 3840.5 + [0:1023:2]; img = hist2d (y, x, ygrid, xgrid); fits_write_image_hdu ("img.fits", NULL, img); Unfortunately the resulting file will contain none of the WCS informa- tion that was attached to the X and Y columns from which the image was constructed. One might be tempted to simply copy that information to the output file with the aid of the fitswcs routines via wcs = fitswcs_get_column_wcs ("evt2.fits[EVENTS]", ["Y", "X"]); fitswcs_put_img_wcs ("img.fits", wcs); The problem with this approach is that the WCS read from the binary table does not describe the image created from it because it knows nothing about how the image was binned nor how the image pixel coordi- nates relate back to the X and Y columns. That information is con- tained in the definition of the grids passed to the hist2d function: xgrid = 3840.5 + [0:1023:2]; ygrid = 3840.5 + [0:1023:2]; These grids describe a simple linear transformation from image pixel coordinates to the (X,Y) coordinates of the binary table. Since the transformation is linear, the fitswcs_bin_wcs function may be used to transform the WCS: wcs = fitswcs_bin_wcs (wcs, ygrid, xgrid); It is the transformed WCS that is to be written out: fitswcs_put_img_wcs ("img.fits", wcs); It is important to note the order in which the X and Y arguments were used. Recall that FITS stores images in a FORTRAN column-major order whereas S-lang uses a row-major order. For this reason, ``row-like'' parameters come before ``column-like'' parameters in statements such as img = hist2d (y, x, ygrid, xgrid); wcs = fitswcs_get_column_wcs ("evt2.fits[EVENTS]", ["Y", "X"]); wcs = fitswcs_bin_wcs (wcs, ygrid, xgrid); 2.6.3. Alternate WCS Sometimes it is useful to attach more than one coordinate system to an image. For example, it is useful to have a coordinate system that maps the pixel coordinates back to (X,Y) coordinates from which they were derived. The fitswcs_new_img_wcs may be used to construct a linear WCS corresponding to the linear coordinate grids of the image: wcsP = fitswcs_new_img_wcs (ygrid, xgrid); wcsP.wcsname = "PHYSICAL"; fitswcs_put_img_wcs ("img.fits", wcsP, 'P'); Note that the WCS was given the name ``PHYSICAL''. While not required, this enables this alternate coordinate system to be dis- played as the physical system by the DS9 image display program. 2.6.4. Degenerate Axes Consider a FITS file hydra.fits containing an image HDU with the following FITS header: SIMPLE = T / file does conform to FITS standard BITPIX = -32 / number of bits per data pixel NAXIS = 4 / number of data axes NAXIS1 = 657 / length of data axis NAXIS2 = 657 / length of data axis NAXIS3 = 1 / length of data axis NAXIS4 = 1 / length of data axis CTYPE1 = 'RA---SIN' CRVAL1 = 139.5235701 CRPIX1 = 330 CDELT1 = -0.0004166666768 CTYPE2 = 'DEC--SIN' CRVAL2 = -12.0955450949 CRPIX2 = 328 CDELT2 = 0.0004166666768 PC1_1 = 1 PC1_2 =-1.7318465835227e-09 PC2_1 = 1.7318465835227e-09 PC2_2 = 1 CTYPE3 = 'FREQ ' CRVAL3 = 332902343.75 CRPIX3 = 1 CDELT3 = 2490234.5 CTYPE4 = 'STOKES ' CRVAL4 = 1 CRPIX4 = 1 CDELT4 = 1 This particular image had so-called ``degenerate axes'' added, which had the effect of increasing its dimensionality from 2 to 4. As such, this image may be rejected by some image display programs that expect a 2-d image. In fact, img = fits_read_img ("hydra.fits"); wcs = fitswcs_get_img_wcs ("hydra.fits"); will read the image as a Float_Type[1,1,657,657] object, and the WCS as a 4-d with wcs.ctype equal to ["STOKES", "FREQ", "DEC--SIN", "RA---SIN"] The degenerate dimensions may be removed from the image via img = img[0,0,*,*]; producing a 2d image of type Float_Type[657,657]. The corresponding wcs may be obtained using the fitswcs_slice function to extract the last two dimensions of the WCS: wcs = fitswcs_slice (wcs, [2,3]); Another use of the fitswcs_slice is to reorder the dimensions of the WCS. For example, earlier it was pointed out that when constructing an image from columns in a table, that one read the WCS in a row-major order. If the reverse order was used when obtaining the WCS from the columns of a binary table, e.g., wcs = fitswcs_get_column_wcs ("evt2.fits[EVENTS]", ["X", "Y"]); then it would have been necessary to reverse the order of the dimen- sions of the WCS structure. The fitswcs_slice may be used to swap the dimensions of the WCS, e.g., wcs = fitswcs_slice (wcs, [1,0]); 2.7. High-level Function Reference 2.7.1. fits_read_errmsgs Synopsis Retrieve all error messages from the CFITSIO error stack Usage String_Type[] fits_read_errmsgs () Description This function returns all the error messages from the CFITSIO error message stack as an array of strings. Notes Using this function will cause the error message stack to be cleared. See Also ``_fits_read_errmsg'', ``fits_set_verbose_errors'' 2.7.2. fits_set_verbose_errors Synopsis Set the verbosity level of the cfitsio error messages Usage fits_set_verbose_errors (Int_Type level) Description When a call to a function in the high-level interface fails, a error message will get generated. By default, all messages from the underlying cfitsio error stack are printed. This behavior may be turned off by calling this function with level equal to 0. See Also ``fits_read_errmsgs'' 2.7.3. fits_open_file Synopsis Open a fits file Usage Fits_File_Type fits_open_file (String_Type filename, String_Type mode) Description The fits_open_file function can be used to open and existing fits file for reading or updating, or to create a new fits file, depending upon the value of the mode parameter. Specifically, if mode is "r", the file will be opened for reading. If mode is "w", the file will be opened for updating (both reading and writing). Otherwise, mode must be "c", which indicates that a new file is to be created. In the latter case, if a file already exists with the specified name, it will get deleted and a new one created in its place. If the function fails, it will signal an error; otherwise an open file pointer will be returned. See Also ``fits_close_file'', ``fits_create_binary_table'' 2.7.4. fits_close_file Synopsis Close a fits file Usage fits_close_file (Fits_File_Type f) Description The fits_close_file closes a previously opened fits file. The function will signal an error if the operation fails. Notes This function could fail if it fails to write out any buffered data because of filesystem errors (disk full, etc.). See Also ``fits_open_file'' 2.7.5. fits_move_to_interesting_hdu Synopsis Move to an extension that looks interesting Usage fits_move_to_interesting_hdu (fp [, hdu_type] Fits_File_Type fp; Int_Type hdu_type; Description The function move the fits file pointer fp forward to an HDU that looks interesting. By definition, an interesting HDU is one in which NAXIS is non-zero. The first parameter fp must be a pointer to an already open fits file. The second parameter, if present, may be used to specifiy the type of HDU, e.g., either an image (hdu_type=_FITS_IMAGE_HDU) or a binary table (hdu_type=_FITS_BINARY_TBL). If the function fails to find an interesting HDU of the appropriate type, an exception will be generated. See Also ``fits_open_file'' 2.7.6. fits_key_exists Synopsis Check for the existence of a keyword Usage Int_Type fits_key_exists (fd, key) Fits_File_Type or String_Type fd; String_Type key; Description The fits_key_exists function checks for the existence of a specified keyword in the file specified by the descriptor fd, which must specify the name of a file or an open file pointer. If the specified key exists, the function return 1, otherwise it returns 0. See Also ``fits_read_key'', ``fits_read_header'' 2.7.7. fits_get_colnum Synopsis Get the column numbers of specified columns Usage column_num = fits_get_colnum (fd, column_name) Fits_File_Type or String_Type fd; String_Type column_name; Description This function returns the column number of the column with the specified name. The file-descriptor fd must specify the name of a file, or an open fits file pointer. See Also ``fits_binary_table_column_exists'' 2.7.8. fits_binary_table_column_exists Synopsis Check for the existence of a binary table column Usage Int_Type fits_binary_table_column_exists (fd, col) Fits_File_Type or String_Type fd; String_Type col; Description This function may be used to determine whether or not a named column exists in a binary table. The table is specified via the fd parameter which must either be the name of a file containing the binary table, or an file pointer. If the specified column exists, 1 will be returned; otherwise the function will return 0. See Also ``fits_key_exists'', ``fits_open_file'' 2.7.9. fits_read_col Synopsis Read one or more columns from a FITS binary table Usage (x1, ...xN) = fits_read_col (file, c1, ... cN) Fits_File_Type or String_Type file; Int_Type or String_Type c1, ...cN; Description This function returns one or more vectors containing objects in the specified columns of the binary table indicated by file. If file is a string, then the file will be opened via the virtual file specification implied by file. Otherwise, file should represent an already opened FITS file. The column parameters may either be strings denoting the column names, or integers representing the column numbers. See Also ``fits_read_cell'', ``fits_read_row'', ``fits_read_table'' 2.7.10. fits_read_col_struct Synopsis Read one or more columns from a FITS binary table Usage struct = fits_read_col_struct (file, col1, ...) Fits_File_Type or String_Type file; String_Type col1, ...; Description This function works exactly like fits_read_col except it returns the values in a structure. See the documentation on that function for more information. See Also ``fits_read_col'', ``fits_read_key_struct'', ``fits_read_row'', ``fits_read_header'' 2.7.11. fits_read_cell Synopsis Read a cell from a FITS binary table Usage X = fits_read_cell (file, c, r) Fits_File_Type or String_Type file; Int_Type r, c; Description This function returns the object in the column c and row r of the binary table indicated by file. If file is a string, then the file will be opened via the virtual file specification implied by file. Otherwise, file should represent an already opened FITS file. See Also ``fits_read_col'', ``fits_read_row'' 2.7.12. fits_read_row Synopsis Read a row from a FITS binary table Usage Struct_Type fits_read_cell (file, r) Fits_File_Type or String_Type file; Int_Type r; Description This function returns a structure containing the data in the columns of the row r of the binary table indicated by file. If file is a string, then the file will be opened via the virtual file specification implied by file. Otherwise, file should represent an already opened FITS file. See Also ``fits_read_col'', ``fits_read_cell'' 2.7.13. fits_read_header Synopsis Read a FITS header Usage Struct_Type fits_read_header (file) Fits_File_Type or String_Type file; Description This function reads the header of the fits file given by the file parameter and returns it as a structure. If file is a string, then the file will be opened via the virtual file specification implied by file. Otherwise, file should represent an already opened FITS file. See Also ``fits_read_table'' 2.7.14. fits_read_table Synopsis Read a FITS table Usage Struct_Type fits_read_table (file [,columns...]) Fits_File_Type or String_Type file; Description fits_read_table reads the data in a table of the FITS file specified by file and returns it as a structure. If the optional column name parameters are specified, then only those columns will be read. Otherwise, the entire table will be returned. If file is a string, then the file will be opened via the virtual file specification implied by file. Otherwise, file should represent an already opened FITS file. See Also ``fits_read_col'', ``fits_read_cell'', ``fits_read_row'', ``fits_read_header'' 2.7.15. fits_read_key Synopsis Read one or more keywords from a FITS file Usage (val1,...) = fits_read_key (file, key1, ...) Fits_File_Type or String_Type file; String_Type key1, ...; Description fits_read_key reads the values of one or more keywords in the fits file specified by file and returns them. If file is a string, then the file will be opened via the virtual file specification implied by file. Otherwise, file should represent an already opened FITS file. If any of the keywords do not exist, a value of NULL will be returned for the corresponding keyword. See Also ``fits_read_key_struct'', ``fits_read_col'', ``fits_read_cell'', ``fits_read_row'', ``fits_read_header'' 2.7.16. fits_read_key_struct Synopsis Read one or more keywords from a FITS file Usage struct = fits_read_key (file, key1, ...) Fits_File_Type or String_Type file; String_Type key1, ...; Description This function works exactly like fits_read_key excepts returns the values in a structure. See the documentation on that function for more information. See Also ``fits_read_key'', ``fits_read_col'', ``fits_read_cell'', ``fits_read_row'', ``fits_read_header'' 2.7.17. fits_create_binary_table Synopsis Prepare a binary table Usage fits_create_binary_table (file, extname, nrows, ttype, tform, tunit) Fits_File_Type or String_Type file; String_Type extname; Int_Type nrows; String_Type ttype[]; String_Type tform[]; String_Type tunit[]; Description This creates a new binary table with the specified structure. The parameters ttype, tform, and tunit are string arrays that specify the column names, column data type, and column units, respectively. The binary table will be given the extension name extname. See Also ``fits_write_binary_table'', ``fits_open_file'' 2.7.18. fits_write_binary_table Synopsis Write a binary table Usage fits_write_binary_table (file, extname, sdata, [skeys [,hist]]) Fits_File_Type or String_Type file; String_Type extname; Struct_Type sdata; Struct_Type skeys; Struct_Type hist; Description The fits_write_binary_table function creates a new binary table in the specified file. The parameter file specifies either a filename or an open file pointer. The extname parameter specifies the extension name of the binary table. The data written to table are specified in the sdata structure, where the name of the structure field specifies the column name. If skeys is non-NULL, then it is a structure indicating additional keywords to be written to the header of the binary table. If the optional parameter hist is present and non-NULL, then it is a structure whose fields indicate either comment or history information to be written to the header. Example The following code variable data = struct { x, cosx, sinx }; data.x = [0:2*PI:0.01]; data.cosx = cos(data.x); data.sinx = sin(data.x); variable keys = struct { hduname, username}; keys.hduname = "COSXSINX"; keys.username = "John Doe"; variable hist = struct { history, comment}; hist.history = ["This is a history record", "This is another"]; hist.comment = ["This is a comment", "And this is another"]; fits_write_binary_table ("foo.fits", "COSXSINX", data, keys, hist); produces a binary table with the header: XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 24 / width of table in bytes NAXIS2 = 629 / number of rows in table PCOUNT = 0 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 3 / number of fields in each row TTYPE1 = 'x ' / label for field 1 TFORM1 = 'D ' / data format of field: 8-byte DOUBLE TTYPE2 = 'cosx ' / label for field 2 TFORM2 = 'D ' / data format of field: 8-byte DOUBLE TTYPE3 = 'sinx ' / label for field 3 TFORM3 = 'D ' / data format of field: 8-byte DOUBLE EXTNAME = 'COSXSINX' / name of this binary table extension HDUNAME = 'COSXSINX' USERNAME= 'John Doe' HISTORY This is a history record HISTORY This is another COMMENT This is a comment COMMENT And this is another Notes This function provides no mechanism to mix comments and keyword records. As the example shows, this function places the comment and history records at the end of the table. See Also ``fits_create_binary_table'', ``fits_open_file'' 2.7.19. fits_update_key Synopsis Update the value of a keyword Usage fits_update_key (fd, key, val [,comment]) String_Type or Fits_File_Type fd; String_Type key; Any type val; String_Type comment; Description The fits_update_key function updates the value and comment fields of an existing keyword with the specified name. If the keyword does not exist, a new keyword will be appended to the end of the header. See Also ``fits_update_logical'', ``fits_read_key'' 2.7.20. fits_update_logical Synopsis Update the value of a logical (boolean) keyword Usage fits_update_logical (fd, key, val, comment) String_Type or Fits_File_Type fd; String_Type key; Any type val; String_Type comment; Description The fits_update_logical function updates the value and comment fields of an existing keyword of the specified name with the specified boolean value. If the keyword does not exist, a new keyword will be appended to the end of the header. See Also ``fits_update_key'' 2.7.21. fits_write_comment Synopsis Write a comment to the header Usage fits_write_comment (fd, comment) Fits_File_Type or String_Type fd; String_Type comment; Description As the name indicates, this function writes a comment record to the specified fits file. The file-descriptor fd must either be the name of a fits file or an open fits file pointer. See Also ``fits_update_key'', ``fits_write_history'' 2.7.22. fits_write_history Synopsis Write a history record to the header Usage fits_write_history (fd, history) Fits_File_Type or String_Type fd; String_Type history; Description As the name indicates, this function writes a history record to the specified fits file. The file-descriptor fd must either be the name of a fits file or an open fits file pointer. See Also ``fits_update_key'', ``fits_write_comment'' 2.7.23. fits_write_date Synopsis Write the DATE keyword to the current HDU Usage fits_write_date (fd) Fits_File_Type or String_Type fd; Description The fits_write_date function calls _fits_write_date to write the DATE to the header of the specified file descriptor, which must either be the name of a fits file or an open fits file pointer. See Also ``fits_update_key'' 2.7.24. fits_write_chksum Synopsis Compute and write the DATASUM and CHECKSUM keywords Usage fits_write_chksum (fd) Fits_File_Type or String_Type fd; Description The fits_write_chksum function calls _fits_write_comment to compute and write the DATASUM and CHECKSUM keywords to the header of the specified file descriptor, which must either be the name of a fits file or an open fits file pointer. See Also ``fits_update_key'', ``fits_verify_chksum'' 2.7.25. fits_verify_chksum Synopsis Verify the checksums for the current HDU Usage isok = fits_verify_chksum (fd [,dataok, hduok]) Fits_File_Type or String_Type fd; Ref_Type dataok, hduok; Description The fits_verify_chksum function calls _fits_verify_chksum to verify the header and data checksums of the current HDU. A non- zero return value signifies that the checksums are ok, otherwise the function returns 0 to indicate that the checksums are invalid. The individual checksums of the HDU or data can be checked through the use of the optional parameters. See Also ``fits_write_chksum'' 2.7.26. fits_read_records Synopsis Read all the records in a fits header Usage String_Type[] fits_read_records (Fits_File_Type or String_Type fp) Description This function returns a list of all the header records associated with the fits file descriptor as an array of strings. See Also ``fits_write_records'', ``fits_read_key'' 2.7.27. fits_write_records Synopsis Write records to fits header Usage fits_write_records (fd, records) Fits_File_Type or String_Type fd; Array_Type records; Description This function uses the _fits_write_record function to write a series of records to the current HDU. See Also ``fits_read_records'' 2.7.28. fits_get_keyclass Synopsis Obtain the key classes for a set of cards Usage Int_Type[] = fits_get_keyclass (Array_Type cards) Description This function uses the _fits_get_keyclass function to obtain the key-classes associated with one or more cards. The function returns an integer-valued array of the same length as the cards array. Example Obtain set of header cards to those that are not associated with the cards describing the structure of the HDU: variable cards = fits_read_records ("evt2.fits[EVENTS]"); variable classes = fits_get_keyclass (cards); cards = cards[where (classes != _FITS_TYP_STRUC_KEY)]; See Also ``fits_read_records'', ``fits_read_key'' 2.7.29. fits_get_bitpix Synopsis Get the fits bitpix value for an array Usage Int_Type fits_get_bitpix (array) Description This function may be used to obtain the bitpix value for a specified image array. The array must be an integer or floating point type, otherwise and error will be generated. The bitpix value is returned. See Also ``fits_write_image_hdu'', ``fits_read_img'' 2.7.30. fits_read_img Synopsis Read image data from a fits file Usage Array_Type fits_read_img (fd) Fits_File_Type or String_Type fd; Description This function reads an image from the specified file descriptor. The file descriptor must be either the name of an existing file, or an open file pointer. It returns the image upon sucess, or signals an error upon failure. See Also ``fits_read_table'', ``fits_read_col'', ``fits_open_file'', ``fits_write_img'' 2.7.31. fits_create_image_hdu Synopsis Create a primary array or image extension Usage fits_create_image_hdu (fd, extname, type, dims) Fits_File_Type or String_Type fd; String_Type extname; Array_Type dims; DataType_Type type; Description This function make use of the _fits_create_img function to create an image extension or primary array of the specified type and size. If the extname parameter is non-NULL, then an EXTNAME keyword will be written out with the value of the extname parameter. The dims parameter must be a 1-d integer array that corresponds to the dimensions of the array to be written. If fd is specified as a string, then a new file of that name will be created. If a file by that name already exists, it will be deleted and a new one created. If this behavior is undesired, then explicitly open the file and pass this routine the resulting file pointer. See Also ``fits_write_image_hdu'' 2.7.32. fits_write_image_hdu Synopsis Write an image extension Usage fits_write_image_hdu (file, extname, image [,skeys [,hist]]) Fits_File_Type or String_Type file; String_Type extname; Any_Type image Struct_Type skeys; Struct_Type hist; Description The fits_write_image_hdu function creates a new image extension in the specified file. The parameter file specifies either a filename or an open file pointer. The extname parameter specifies the extension name of the image, or NULL for the primary image. The image data written to the file are specified by the image parameter. If the optional parameter skeys is non- NULL, then it is a structure indicating additional keywords to be written to the HDU. If the optional parameter hist is present and non-NULL, then it is a structure whose fields indicate either comment or history information to be written to the header. Example The following code variable img = [1:128*128]; reshape (img, [128,128]); variable keys = struct { hduname, username}; keys.hduname = "MY_IMAGE"; keys.username = "John Doe"; variable hist = struct { history, comment}; hist.history = ["This is a history record", "This is another"]; hist.comment = ["This is a comment", "And this is another"]; fits_write_image_hdu ("foo.fits", NULL, img, keys, hist); produces an image HDU with the header: SIMPLE = T / file does conform to FITS standard BITPIX = 32 / number of bits per data pixel NAXIS = 2 / number of data axes NAXIS1 = 128 / length of data axis 1 NAXIS2 = 128 / length of data axis 2 EXTEND = T / FITS dataset may contain extensions COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H HDUNAME = 'MY_IMAGE' USERNAME= 'John Doe' HISTORY This is a history record HISTORY This is another COMMENT This is a comment COMMENT And this is another Notes This function provides no mechanism to mix comments and keyword records. As the example shows, this function places the comment and history records at the end of the table. See Also ``fits_create_binary_table'', ``fits_open_file'' 2.7.33. fits_write_img Synopsis Write the image data to an Image HDU Usage fits_write_img (Fits_File_Type fptr, Any_Type data) Description This function writes the image data out to current HDU, assumed to be an Image HDU. See Also ``fits_write_image_hdu'', ``fits_create_image_hdu'' 2.8. WCS Function Reference 2.8.1. fitswcs_new Synopsis Create a new-ndimensional linear WCS Usage wcs = fitswcs_new (Int_Type naxis) Description This function returns a new WCS structure of the specified dimensionality that represents an identity (linear) transformation. See Also ``fitswcs_get_img_wcs'', ``fitswcs_get_column_wcs'', ``fitswcs_get_vector_wcs'' 2.8.2. fitswcs_slice Synopsis Form a new wcs from one or more axes of another Usage new_wcs = fitswcs_slice (wcs, dims) Description This function may be used to construct a new wcs from another by rearranging its axes or by using a subset of them. The dims argument specifies the dimensions to use. Example Suppose that wcs represents a 4 dimensional WCS. Then wcs2 = fitswcs_slice (wcs, [0,1]); will result in a 2 dimensional WCS from the first 2 axis of the input WCS. Similarly, wcs2 = fitswcs_slice (wcs, [1,0]); will produce a 2d WCS with the first two axes swapped. See Also ``fitswcs_get_img_wcs'', ``fitswcs_get_column_wcs'', ``fitswcs_get_vector_wcs'' 2.8.3. fitswcs_get_img_wcs Synopsis Read a WCS for a FITS image Usage wcs = fitswcs_get_img_wcs (fp [,alt]) Description The fitswcs_get_img_wcs returns a structure representing a WCS from the specified file descriptor fp corresponding to an image HDU. An optional parameter may be used to specified an alternate WCS. Example wcs = fitswcs_get_img_wcs ("img.fits[IMAGE]", 'P'); See Also ``fitswcs_put_img_wcs'', ``fitswcs_get_column_wcs'', ``fitswcs_get_vector_wcs'' 2.8.4. fitswcs_get_column_wcs Synopsis Get the WCS attached to one or more columns of a binary table Usage fitswcs_get_column_wcs (fp, columns-array [,alt] Description This function may be used to obtain the WCS associated with one or more columns of a binary table. The file descriptor fp must specify a binary table. The columns-array parameter should be an array of columns names. The third parameter is optional and is used to specify an alternate WCS. Example wcs = fitswcs_get_column_wcs ("evt1.fits[EVENTS]", ["X","Y"]); See Also ``fitswcs_put_column_wcs'', ``fitswcs_get_img_wcs'', ``fitswcs_get_vector_wcs'' 2.8.5. fitswcs_get_vector_wcs Synopsis Get the WCS of an image in a specified table cell Usage wcs = fitswcs_get_vector_wcs (fp, column_name, row [,alt]) Description This function reads the WCS of an image in a specified cell of a binary table given by fp parameter. The second and third parameters specify the column name and row number of the cell. An optional fourth parameter may be used to obtain the corresponding alternate WCS. Example This example reads the WCS associated with the image in the second row of the QEU column of the binary table with HDUNAME equal to AXAF_QEU1 in the file "HRCQEU.fits": wcs = fitswcs_get_vector_wcs ("HRCQEU.fits[AXAF_QEU1], "QEU", 2); Notes The current implementation does not yet support references to the WCS of other cells. See Also ``fitswcs_get_column_wcs'', ``fitswcs_get_img_wcs'' 2.8.6. fitswcs_new_img_wcs Synopsis Create a linear WCS for an image Usage wcs = fitswcs_new_img_wcs (grid0,grid1,...) Description This function may be used to construct a linear WCS for an image with the specified grids. The grids are assumed to be linear. Example Use the histogram module's hist2d function to create an image from the X and Y columns in a file, and the construct a corresponding WCS: (x,y) = fits_read_col ("table.fits", "X", "Y"); gridx = [min(x):max(x):0.5]; gridy = [min(y):max(y):0.5]; img = hist2d (y,x,gridy,gridx); wcs = fitswcs_new_img_wcs (gridy, gridx); See Also ``fitswcs_new'', ``fitswcs_get_img_wcs'' 2.8.7. fitswcs_put_img_wcs Synopsis Write a WCS out to an image header Usage fitswcs_put_img_wcs (fp, wcs [,alt]) Description The fitswcs_put_img_wcs may be used to write the specified wcs out to the image HDU specified by the fp parameter. An optional third parameter may be used to specify an alternate WCS. Example fp = fits_open_file ("img.fits", "w"); . . . fits_put_img_wcs (fp, wcs, 'P'); fits_close_file (fp); See Also ``fitswcs_put_column_wcs'' 2.8.8. fitswcs_put_column_wcs Synopsis Write the WCS attached to one or more table columns Usage fitswcs_put_column_wcs (fp, wcs, columns-array [,alt]) Description This function may be used to attach a WCS to one or more columns of a binary table. The dimensionality of the specified WCS must match the length of the array specifying the column names. The first parameter, fp must specify a binary table extension. The fourth parameter is optional and may be used to specify an alternate WCS. Example fitswcs_put_column_wcs ("evt2.fits[EVENTS], wcs, ["X","Y"]); See Also ``fitswcs_get_column_wcs'', ``fitswcs_put_img_wcs'', ``fitswcs_get_img_wcs'' 2.8.9. fitswcs_linear_transform_wcs Synopsis Apply a linear transformation to a WCS Usage wcs1 = fitswcs_linear_transform_wcs (wcs, U0, A, X0) wcs: The specified WCS to transform U0,X0: 1-d arrays A: 2-d array (or 1-d array representing a diagonal matrix) Description This function may be used to create a new WCS by applying a linear transformation to an existing one. This is useful when one has a WCS associated with physical coordinates X, and then applies the linear transformation U = U0 + A#(X-X0) to the coordinates X. Then corresponding WCS for the resulting image is given by new_wcs = fitswcs_linear_transform_wcs (wcs, U0, A, X0); Notes The dimensionality of the WCS is limited to 2 in the current implementation. See Also ``fitswcs_rebin_wcs'', ``fitswcs_bin_wcs'' 2.8.10. fitswcs_rebin_wcs Synopsis This function may be used to obtain the wcs for a rebinned image Usage wcs1 = fitswcs_rebin_wcs (wcs, old_dims, new_dims...) Description This function may be used to construct the WCS for a rebinned image from the WCS of of the unbinned image. The grid parameters specify the linear grids the new image. Example new_img = hist2d_rebin (new_yrid, new_xgrid, old_ygrid, old_xgrid, old_img); new_wcs = fitswcs_rebin_wcs (old_wcs, array_shape(old_img), array_shape(new_img)); See Also ``fitswcs_bin_wcs'', ``fitswcs_linear_transform_wcs'', ``fitswcs_slice'' 2.8.11. fitswcs_bin_wcs Synopsis This function may be used to obtain the wcs for a rebinned image Usage wcs1 = fitswcs_rebin_wcs (wcs, grid0, grid1, ...) Description This function may be used to construct the WCS for an image created by binning a set of coordinates from, e.g., a pixel- list. The wcs parameter represents the wcs attached to the unbinnned coordinates. The grid parameters specify the linear grids that were used to create the image. See Also ``fitswcs_rebin_wcs'', ``fitswcs_linear_transform_wcs'', ``fitswcs_slice'' 3. The low-level interface 3.1. Overview Functions in the low-level module are usually needed when it is necessary to perform some task that is not readily achievable using the high-level interface. This module may be loaded using require ("cfitsio"); When mixing functions from both interfaces, it is not necessary to explicitly load the cfitsio module in this manner since it is loaded automatically by the high-level interface. For the most part, for those functions that have been wrapped, the cfitsio module represents a 1-1 mapping between the functions of the cfitsio library and those of the module. For this reason a detailed description of the functions in the cfitsio module will not be given here; the reader is referred to the documentation for the CFITSIO library itself for the details. Here only the semantic differences between the functions in the module and those of the library, and how the functions are documented. Most CFITSIO functions adhere to a so-called ``inherited status'' convention via a ``status'' argument as the last parameter. In addition functions also return the error status as a return value. For simplicity the wrapping by the module does not respect this convention. That is, none of the module's functions take a status argument. For example, the CFITSIO documentation for the fits_get_num_hdus specifies that it is to be called from C via: status = fits_get_num_hdus (fptr, &hdunum, &status); This function has been wrapped such that it is to be called from S- lang via status = _fits_get_num_hdus (fptr, &hdunum); 3.2. Low-level Function Reference 3.2.1. _fits_get_errstatus Synopsis Retrieve a text string corresponding to an error code Usage String_Type _fits_get_errstatus (Int_Type status) Description This function is a wrapper around the cfitsio library function fits_get_errstatus. See its documentation for additional information. See Also ``fits_read_errmsgs'', ``_fits_read_errmsg'' 3.2.2. _fits_read_errmsg Synopsis Retrieve an error message from the cfitsio error message stack Usage String_Type _fits_read_errmsg () Description This function is a wrapper around the cfitsio library function fits_read_errmsg. See its documentation for additional information. Notes This function returns NULL if there are no error messages available. See Also ``fits_read_errmsgs'', ``fits_set_verbose_errors'' 3.2.3. _fits_open_file Synopsis Open a fits file Usage status = _fits_open_file (Ref_Type fptr, String_Type file, String_Type mode) Description This function is a wrapper around the cfitsio library function fits_open_file. See its documentation for additional information. The main difference between this function and its cfitsio counterpart is that the mode argument is a string whose value must be one of the following: "r" Open the file in read-only mode "w" Open the file in read-write mode "c" Create a new file. Note that if the mode argument is "c", then the cfitsio fits_cre- ate_file function will be called. An important difference between this intrinsic function and the fits_create_file library function is that if the file already exists, the library function will return an error, whereas _fits_open_file will simply delete the file before creating a new one. 3.2.4. _fits_delete_file Synopsis Delete the file associated with a Fits_File_Type object Usage status = _fits_delete_file (Fits_File_Type fptr) Description This function is a wrapper around the cfitsio library function fits_delete_file. See its documentation for additional information. 3.2.5. _fits_close_file Synopsis Close a fits file Usage status = _fits_close_file (Fits_File_Type fptr) Description This function is a wrapper around the cfitsio library function fits_close_file. See its documentation for additional information. 3.2.6. _fits_movabs_hdu Synopsis Move to an absolute HDU number Usage status = _fits_movabs_hdu (Fits_File_Type fptr, Int_Type hdunum) Description This function is a wrapper around the cfitsio library function fits_movabs_hdu. See its documentation for additional information. Notes The cfitsio counterpart also returns the HDU type of the resulting HDU. 3.2.7. _fits_movrel_hdu Synopsis Move a relative number of HDUs Usage status = _fits_movrel_hdu (Fits_File_Type fptr, Int_Type nmove) Description This function is a wrapper around the cfitsio library function fits_movrel_hdu. See its documentation for additional information. Notes The cfitsio counterpart also returns the HDU type of the resulting HDU. 3.2.8. _fits_movnam_hdu Synopsis Move to a named HDU Usage status = _fits_movnam_hdu (fptr, hdutype, extname, extvers) Fits_File_Type fptr; Int_Type hdutype, extvers; String_Type extname; Description This function is a wrapper around the cfitsio library function fits_movnam_hdu. See its documentation for additional information. 3.2.9. _fits_get_num_hdus Synopsis Return the number of HDUs in a FITS file Usage status = _fits_get_num_hdus (Fits_File_Type fptr, Ref_Type hdunum) Description This function is a wrapper around the cfitsio library function fits_get_num_hdus. See its documentation for additional information. 3.2.10. _fits_get_hdu_num Synopsis Return the current HDU number Usage hdunum = _fits_get_hdu_num (Fits_File_Type fptr) Description This function is a wrapper around the cfitsio library function fits_get_hdu_num. See its documentation for additional information. 3.2.11. _fits_get_hdu_type Synopsis Get the current HDU type Usage status = _fits_get_hdu_type (Fits_File_Type fptr, Ref_Type hdutype) Description This function is a wrapper around the cfitsio library function fits_get_hdu_type. See its documentation for additional information. Upon a sucessful return, the value of the variable associated with the hdutype reference will be set to one of the following constants: _FITS_IMAGE_HDU _FITS_ASCII_TBL _FITS_BINARY_TBL 3.2.12. _fits_copy_file Synopsis Copy a fits file Usage status = _fits_copy_file (infptr, outfptr, previous, current, following) Fits_File_Type infptr, outfptr; Int_Type previous, current, following; Description This function is a wrapper around the cfitsio library function fits_copy_file. See its documentation for additional information. 3.2.13. _fits_copy_hdu Synopsis Copy an HDU Usage status = _fits_copy_hdu (infptr, outfptr, morekeys) Fits_File_Type infptr, outfptr; Int_Type morekeys; Description This function is a wrapper around the cfitsio library function fits_copy_hdu. See its documentation for additional information. 3.2.14. _fits_copy_header Synopsis Copy a fits header from one HDU to another Usage status = _fits_copy_header (Fits_File_Type infptr, Fits_File_Type outfptr) Description This function is a wrapper around the cfitsio library function fits_copy_header. See its documentation for additional information. 3.2.15. _fits_delete_hdu Synopsis Delete the current HDU Usage status = _fits_delete_hdu (Fits_File_Type fptr) Description This function is a wrapper around the cfitsio library function fits_delete_hdu. See its documentation for additional information. Notes The corresponding cfitsio function also returns the HDU type of the new HDU. If that information is necessary, make a separate call to _fits_get_hdu_type. 3.2.16. _fits_create_img Synopsis Create a new image extension Usage status = _fits_create_img (fptr, bitpix, dims) Fits_File_Type fptr; Int_Type bitpix; Array_Type dims; Description This function is a wrapper around the cfitsio library function fits_create_img. See its documentation for additional information. Notes This function differs from the corresponding cfitsio function in that the dims array is assumed to be a 1-d integer array whose elements specify the number of axes and the size of each axis. In particular, the value of the NAXIS keyword will be given by length(dims), the value of NAXIS1 will be given by dims[0], and so forth. 3.2.17. _fits_write_img Synopsis Write an image Usage status = _fits_write_img (Fits_File_Type fptr, Array_Type img Description This function is a wrapper around the cfitsio library function fits_write_img. See its documentation for additional information. Notes This function differs from its cfitsio counterpart in that the whole image represented by the array img will be written out. 3.2.18. _fits_read_img Synopsis Read an image Usage status = _fits_read_img (Fits_File_Type fptr, Ref_Type img) Description This function is a wrapper around the cfitsio library function fits_read_img. See its documentation for additional information. Notes This function differs from the corresponding cfitsio routine in that the type of the image returned is automatically determined by the routine via a call to fits_get_img_type. The dimensionality of the returned image is given by [...,NAXIS2,NAXIS1] such that NAXIS1 corresponds to the fastest varying dimension, NAXIS2 the next fastest varying, etc. 3.2.19. _fits_create_binary_tbl Synopsis Create a binary table extension Usage status = _fits_create_binary_tbl (fptr, naxis2, ttype, tform, tunit, extname) Fits_File_Type fptr; Array_Type tunit, tform, ttype; Int_Type naxis2; String_Type extname; Notes The _fits_create_binary_tbl function is a wrapper around the fits_create_tbl function explicitly creating a binary table. The input arrays ttype, tform, and tunit must be the same length, which determines the number of columns in the table. The tunit and extname parameters may be set to NULL. 3.2.20. _fits_update_key Synopsis Update a keyword or append a new one Usage status = _fits_update_key (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname, comment; Any_Type value; Description This function is a wrapper around the cfitsio library function fits_update_key. See its documentation for additional information. Notes The data-type for the value argument must be an approriate type for FITS keywords. If value is a string, then the string will be written as a cfitsio long-string using the fits_update_key_longstr function. If value is NULL, then the fits_update_key_null function will be called to update the keyword. The comment parameter may be set to NULL to if the comment field associated with the keyword is not to be modified. To update the value of a boolean (logical) keyword, use the _fits_update_logical function. 3.2.21. _fits_update_logical Synopsis Update the value of a boolean keyword Usage status = _fits_update_logical (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname, comment; Int_Type value; Description The _fits_update_logical function is a wrapper around the cfitsio fits_update_key function with TLOGICAL specified as the datatype argument. If the value parameter is non-zero, then a value T (TRUE) will be given to the specified keyword. Otherwise, the value of the keyword will be set to F (FALSE). If the comment parameter is NULL, then the keyword's comment field will not be modified. See Also ``_fits_update_key'' 3.2.22. _fits_write_comment Synopsis Write a COMMENT header Usage status = _fits_write_comment (Fits_File_Type fptr, String_Type comment) Description This function is a wrapper around the cfitsio library function fits_write_comment. See its documentation for additional information. 3.2.23. _fits_write_history Synopsis Write a HISTORY header Usage status = _fits_write_history (Fits_File_Type fptr, String_Type history) Description This function is a wrapper around the cfitsio library function fits_write_history. See its documentation for additional information. 3.2.24. _fits_write_date Synopsis Write a DATE keyword Usage status = _fits_write_date (Fits_File_Type fptr) Description This function is a wrapper around the cfitsio library function fits_write_date. See its documentation for additional information. 3.2.25. _fits_write_record Synopsis Write a keyword record Usage status = _fits_write_record (Fits_File_Type fptr, String_Type card) Description This function is a wrapper around the cfitsio library function fits_write_record. See its documentation for additional information. 3.2.26. _fits_modify_name Synopsis Rename a keyword Usage status = _fits_modify_name (fptr, oldname, newname) Fits_File_Type fptr; String_Type oldname, newname; Description This function is a wrapper around the cfitsio library function fits_modify_name. See its documentation for additional information. 3.2.27. _fits_get_num_keys Synopsis Get the number of keywords in the current HDU Usage status _fits_get_num_keys (Fits_File_Type fptr, Ref_Type numkeys) Description This function is a wrapper around the cfitsio fits_get_hdrspace function. It obtains the number of existing keywords in the current HDU (excluding the END keyword) and assigns that value to variable associated with the numkeys parameter. 3.2.28. _fits_read_key_integer Synopsis Read the value of a keyword as an integer Usage status = _fits_read_key_integer (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; Description This function uses the cfitsio fits_read_key function to read the value of the specifed keyword as an integer. Its value is assigned to the variable referenced by the value parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. See Also ``_fits_read_key'', ``_fits_read_key_string'', ``_fits_read_key_double'' 3.2.29. _fits_read_key_string Synopsis Read the value of a keyword as a string Usage status = _fits_read_key_string (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; Description This function uses the cfitsio fits_read_key_longstr function to read the value of the specifed keyword as a cfitsio long-string. The string is assigned to the variable referenced by the value parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. See Also ``_fits_read_key'', ``_fits_read_key_integer'', ``_fits_read_key_double'' 3.2.30. _fits_read_key_double Synopsis Read the value of a keyword as a double Usage status = _fits_read_key_double (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; Description This function uses the cfitsio fits_read_key function to read the value of the specifed keyword as a double. The keyword's value is assigned to the variable referenced by the value parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. See Also ``_fits_read_key'', ``_fits_read_key_integer'', ``_fits_read_key_string'' 3.2.31. _fits_read_key Synopsis Read the value of a keyword Usage status = _fits_read_key (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; Description This function uses the cfitsio fits_read_key function to read the value of the specifed keyword. It first uses the cfitsio fits_get_keytype function to determine the data-type for the keyword and then calls fits_read_key using that data-type. The resulting value is assigned to the variable referenced by the value parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. See Also ``_fits_read_key_integer'', ``_fits_read_key_string'', ``_fits_read_key_double'' 3.2.32. _fits_read_record Synopsis Read a specified record from the current HDU Usage status = _fits_read_record (fptr, keynum, card) Fits_File_Type fptr; Int_Type keynum; Ref_Type card; Description This function is a wrapper around the cfitsio library function fits_read_record. See its documentation for additional information. 3.2.33. _fits_delete_key Synopsis Delete a keyword from the header Usage status = _fits_delete_key (Fits_File_Type fptr, String_Type keyname) Description This function is a wrapper around the cfitsio library function fits_delete_key. See its documentation for additional information. 3.2.34. _fits_get_colnum Synopsis Get the column number of a specfied table column Usage status = _fits_get_colnum (fptr, colname, colnum) Fits_File_Type fptr; String_Type colname; Ref_Type colnum; Description This function is a wrapper around the cfitsio library function fits_get_colnum. See its documentation for additional information. Notes The corresponding cfitsio function permits a wildcard match to the colname parameter. The current wrapping of this function does not support such matching. The colname parameter is treating in a case-insensitive manner. 3.2.35. _fits_insert_rows Synopsis Insert rows into a table Usage status = _fits_insert_rows (fptr, firstrow, nrows) Fits_File_Type fptr; Int_Type firstrow, nrows; Description This function is a wrapper around the cfitsio library function fits_insert_rows. See its documentation for additional information. 3.2.36. _fits_delete_rows Synopsis Delete rows from a table Usage status = _fits_delete_rows (fptr, firstrow, nrows) Fits_File_Type fptr; Int_Type firstrow, nrows; Description This function is a wrapper around the cfitsio library function fits_delete_rows. See its documentation for additional information. 3.2.37. _fits_insert_cols Synopsis Insert columns into a table Usage status = _fits_insert_cols (fptr, colnum, ttype, tform) Fits_File_Type fptr; Int_Type colnum; Array_Type ttype, tform; Description This function is a wrapper around the cfitsio library function fits_insert_cols. See its documentation for additional information. Notes The number of columns to be inserted is given by the length of the ttype and tform arrays, which must be of the same length. 3.2.38. _fits_delete_col Synopsis Delete a column from a table Usage status = _fits_delete_col (Fits_File_Type fptr, Int_Type colnum) Description This function is a wrapper around the cfitsio library function fits_delete_col. See its documentation for additional information. 3.2.39. _fits_get_num_cols Synopsis Get the number of table columns Usage status = _fits_get_num_cols (Fits_File_Type fptr, Ref_Type ncols) Description This function is a wrapper around the cfitsio library function fits_get_num_cols. See its documentation for additional information. 3.2.40. _fits_get_rowsize Synopsis Get the number of rows to read or write for maximum efficiency Usage status = _fits_get_rowsize (Fits_File_Type fptr, Ref_Type nrows) Description This function is a wrapper around the cfitsio library function fits_get_rowsize. See its documentation for additional information. 3.2.41. _fits_get_num_rows Synopsis Get the number of table rows Usage status = _fits_get_num_cols (Fits_File_Type fptr, Ref_Type nrows) Description This function is a wrapper around the cfitsio library function fits_get_num_rows. See its documentation for additional information. 3.2.42. _fits_write_col Synopsis Write data to a table column Usage status = _fits_write_col (fptr, colnum, firstrow, firstelem, array) Fits_File_Type fptr; Int_Type colnum; Int_Type firstrow, firstelem; Array_Type array; Description This function is a wrapper around the cfitsio library function fits_write_col. See its documentation for additional information. Notes The number of elements written out to the column by this function will be equal to the number of elements in the array. 3.2.43. _fits_read_col Synopsis Read elements from a column Usage status = _fits_read_col (fptr, colnum, firstrow, numrows, array Fits_File_Type fptr; Int_Type colnum, firstrow, numrows; Ref_Type array; Description This function is a complicated wrapper around a number of cfitsio functions to enable it to read any type of column, including vector and variable length columns. The data read by the function is assigned as the appropriately typed array to the variable referenced by the array argument. For ordinary scalar columns, a 1-d array of size numrows will be produced. For a vector column, a 2d array of size [numrows,repeat] will be generated. Here repeat is given by the repeat value associated with the column. For a variable length column, where data are stored in the heap of the HDU, the data will be read as a 1-d array of numrows arrays. If the column is a bit-valued column, then data will be returned as an array of integers of the appropriate size. Currently only 8X, 16X, and 32X bit columns are supported. See Also ``_fits_read_cols'', ``_fits_write_col'' 3.2.44. _fits_get_keytype Synopsis Get a keyword's data type Usage status = _fits_get_keytype (fptr, keyname, type) Fits_File_Type fptr; String_Type keyname; Ref_Type type; Description This function is a wrapper around the cfitsio library function fits_get_keytype. See its documentation for additional information. Notes This function differs from its cfitsio counterpart in that instead of explicitly specifying the keyword's value string, this function uses the value of the specified keyword. It also returns the type as a S-lang DataType_Type object, e.g., Int_Type, Complex_Type, etc. 3.2.45. _fits_get_keyclass Synopsis Get the class of an input header record Usage Int_Type _fits_get_keyclass (String_Type card) Description This function is a wrapper around the cfitsio library function fits_get_keyclass. See its documentation for additional information. 3.2.46. _fits_read_cols Synopsis Read one or more table columns Usage status = _fits_read_cols (fptr, colnums, firstrow, nrows, arrays) Fits_File_Type fptr; Array_Type colnums; Int_Type firstrow, numrows; Ref_Type arrays; Description This function performs a similar task as the _fits_read_col. The main difference is that instead of reading a single column, it is capable of reading multiple columns specified by the colnums parameter. It assigns the data as an array of arrays to the variable referenced by the arrays parameter. See the documentation for the _fits_read_col function for more information. Notes This function takes advantage of the cfitsio buffering mechanism to optimize the reads. 3.2.47. _fits_write_chksum Synopsis Compute and write DATASUM and CHECKSUM keywords Usage status = _fits_write_chksum (Fits_File_Type fptr) Description This function is a wrapper around the cfitsio library function fits_write_chksum. See its documentation for additional information. 3.2.48. _fits_update_chksum Synopsis Update the CHECKSUM keyword Usage status = _fits_update_chksum (Fits_File_Type fptr) Description This function is a wrapper around the cfitsio library function fits_update_chksum. See its documentation for additional information. 3.2.49. _fits_verify_chksum Synopsis Verify the checksums for the current HDU Usage status = _fits_verify_chksum (fptr, dataok, hduok) Fits_File_Type fptr; Ref_Type dataok, hduok; Description This function is a wrapper around the cfitsio library function fits_verify_chksum. See its documentation for additional information. 3.2.50. _fits_get_chksum Synopsis Get the checksums for the current HDU Usage status = _fits_get_chksum (fptr, datasum, hdusum) Fits_File_Type fptr; Ref_Type datasum, hdusum; Description This function is a wrapper around the cfitsio library function fits_get_chksum. See its documentation for additional information. 3.2.51. _fits_get_version Synopsis Get the cfitsio library version number Usage Float_Type _fits_get_version () Description This function is a wrapper around the cfitsio library function fits_get_version. See its documentation for additional information. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 2. The high-level interface . . . . . . . . . . . . . . . . . . . 5 2.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2. Opening and Closing Files . . . . . . . . . . . . . . . . . . 5 2.3. Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.3.1. Reading Header Keywords . . . . . . . . . . . . . . . . . . 7 2.3.2. Writing Header Keywords . . . . . . . . . . . . . . . . . 8 2.4. Binary Tables . . . . . . . . . . . . . . . . . . . . . . . . 8 2.4.1. Reading Binary Tables . . . . . . . . . . . . . . . . . . . 8 2.4.2. Writing Binary Tables . . . . . . . . . . . . . . . . . . . 10 2.5. Images . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.5.1. Preliminaries . . . . . . . . . . . . . . . . . . . . . . . 13 2.5.2. Reading and Writing Images . . . . . . . . . . . . . . . . 13 2.6. WCS Routines . . . . . . . . . . . . . . . . . . . . . . . . 14 2.6.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 14 2.6.2. Examples . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.6.3. Alternate WCS . . . . . . . . . . . . . . . . . . . . . . . 16 2.6.4. Degenerate Axes . . . . . . . . . . . . . . . . . . . . . . 16 2.7. High-level Function Reference . . . . . . . . . . . . . . . . 18 2.7.1. fits_read_errmsgs . . . . . . . . . . . . . . . . . . . . . 18 2.7.2. fits_set_verbose_errors . . . . . . . . . . . . . . . . . . 18 2.7.3. fits_open_file . . . . . . . . . . . . . . . . . . . . . . 19 2.7.4. fits_close_file . . . . . . . . . . . . . . . . . . . . . . 19 2.7.5. fits_move_to_interesting_hdu . . . . . . . . . . . . . . . 19 2.7.6. fits_key_exists . . . . . . . . . . . . . . . . . . . . . . 20 2.7.7. fits_get_colnum . . . . . . . . . . . . . . . . . . . . . . 20 2.7.8. fits_binary_table_column_exists . . . . . . . . . . . . . . 21 2.7.9. fits_read_col . . . . . . . . . . . . . . . . . . . . . . . 21 2.7.10. fits_read_col_struct . . . . . . . . . . . . . . . . . . . 22 2.7.11. fits_read_cell . . . . . . . . . . . . . . . . . . . . . . 22 2.7.12. fits_read_row . . . . . . . . . . . . . . . . . . . . . . 22 2.7.13. fits_read_header . . . . . . . . . . . . . . . . . . . . . 23 2.7.14. fits_read_table . . . . . . . . . . . . . . . . . . . . . 23 2.7.15. fits_read_key . . . . . . . . . . . . . . . . . . . . . . 24 2.7.16. fits_read_key_struct . . . . . . . . . . . . . . . . . . . 24 2.7.17. fits_create_binary_table . . . . . . . . . . . . . . . . . 25 2.7.18. fits_write_binary_table . . . . . . . . . . . . . . . . . 25 2.7.19. fits_update_key . . . . . . . . . . . . . . . . . . . . . 26 2.7.20. fits_update_logical . . . . . . . . . . . . . . . . . . . 27 2.7.21. fits_write_comment . . . . . . . . . . . . . . . . . . . . 27 2.7.22. fits_write_history . . . . . . . . . . . . . . . . . . . . 28 2.7.23. fits_write_date . . . . . . . . . . . . . . . . . . . . . 28 2.7.24. fits_write_chksum . . . . . . . . . . . . . . . . . . . . 28 2.7.25. fits_verify_chksum . . . . . . . . . . . . . . . . . . . . 29 2.7.26. fits_read_records . . . . . . . . . . . . . . . . . . . . 29 2.7.27. fits_write_records . . . . . . . . . . . . . . . . . . . . 29 2.7.28. fits_get_keyclass . . . . . . . . . . . . . . . . . . . . 30 2.7.29. fits_get_bitpix . . . . . . . . . . . . . . . . . . . . . 30 2.7.30. fits_read_img . . . . . . . . . . . . . . . . . . . . . . 31 2.7.31. fits_create_image_hdu . . . . . . . . . . . . . . . . . . 31 2.7.32. fits_write_image_hdu . . . . . . . . . . . . . . . . . . . 31 2.7.33. fits_write_img . . . . . . . . . . . . . . . . . . . . . . 33 2.8. WCS Function Reference . . . . . . . . . . . . . . . . . . . 33 2.8.1. fitswcs_new . . . . . . . . . . . . . . . . . . . . . . . . 33 2.8.2. fitswcs_slice . . . . . . . . . . . . . . . . . . . . . . . 33 2.8.3. fitswcs_get_img_wcs . . . . . . . . . . . . . . . . . . . . 34 2.8.4. fitswcs_get_column_wcs . . . . . . . . . . . . . . . . . . 34 2.8.5. fitswcs_get_vector_wcs . . . . . . . . . . . . . . . . . . 35 2.8.6. fitswcs_new_img_wcs . . . . . . . . . . . . . . . . . . . . 35 2.8.7. fitswcs_put_img_wcs . . . . . . . . . . . . . . . . . . . . 36 2.8.8. fitswcs_put_column_wcs . . . . . . . . . . . . . . . . . . 36 2.8.9. fitswcs_linear_transform_wcs . . . . . . . . . . . . . . . 37 2.8.10. fitswcs_rebin_wcs . . . . . . . . . . . . . . . . . . . . 37 2.8.11. fitswcs_bin_wcs . . . . . . . . . . . . . . . . . . . . . 38 3. The low-level interface . . . . . . . . . . . . . . . . . . . . 39 3.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.2. Low-level Function Reference . . . . . . . . . . . . . . . . 39 3.2.1. _fits_get_errstatus . . . . . . . . . . . . . . . . . . . . 40 3.2.2. _fits_read_errmsg . . . . . . . . . . . . . . . . . . . . . 40 3.2.3. _fits_open_file . . . . . . . . . . . . . . . . . . . . . . 40 3.2.4. _fits_delete_file . . . . . . . . . . . . . . . . . . . . . 41 3.2.5. _fits_close_file . . . . . . . . . . . . . . . . . . . . . 41 3.2.6. _fits_movabs_hdu . . . . . . . . . . . . . . . . . . . . . 41 3.2.7. _fits_movrel_hdu . . . . . . . . . . . . . . . . . . . . . 41 3.2.8. _fits_movnam_hdu . . . . . . . . . . . . . . . . . . . . . 42 3.2.9. _fits_get_num_hdus . . . . . . . . . . . . . . . . . . . . 42 3.2.10. _fits_get_hdu_num . . . . . . . . . . . . . . . . . . . . 42 3.2.11. _fits_get_hdu_type . . . . . . . . . . . . . . . . . . . . 43 3.2.12. _fits_copy_file . . . . . . . . . . . . . . . . . . . . . 43 3.2.13. _fits_copy_hdu . . . . . . . . . . . . . . . . . . . . . . 43 3.2.14. _fits_copy_header . . . . . . . . . . . . . . . . . . . . 44 3.2.15. _fits_delete_hdu . . . . . . . . . . . . . . . . . . . . . 44 3.2.16. _fits_create_img . . . . . . . . . . . . . . . . . . . . . 44 3.2.17. _fits_write_img . . . . . . . . . . . . . . . . . . . . . 45 3.2.18. _fits_read_img . . . . . . . . . . . . . . . . . . . . . . 45 3.2.19. _fits_create_binary_tbl . . . . . . . . . . . . . . . . . 45 3.2.20. _fits_update_key . . . . . . . . . . . . . . . . . . . . . 46 3.2.21. _fits_update_logical . . . . . . . . . . . . . . . . . . . 46 3.2.22. _fits_write_comment . . . . . . . . . . . . . . . . . . . 47 3.2.23. _fits_write_history . . . . . . . . . . . . . . . . . . . 47 3.2.24. _fits_write_date . . . . . . . . . . . . . . . . . . . . . 47 3.2.25. _fits_write_record . . . . . . . . . . . . . . . . . . . . 48 3.2.26. _fits_modify_name . . . . . . . . . . . . . . . . . . . . 48 3.2.27. _fits_get_num_keys . . . . . . . . . . . . . . . . . . . . 48 3.2.28. _fits_read_key_integer . . . . . . . . . . . . . . . . . . 49 3.2.29. _fits_read_key_string . . . . . . . . . . . . . . . . . . 49 3.2.30. _fits_read_key_double . . . . . . . . . . . . . . . . . . 49 3.2.31. _fits_read_key . . . . . . . . . . . . . . . . . . . . . . 50 3.2.32. _fits_read_record . . . . . . . . . . . . . . . . . . . . 50 3.2.33. _fits_delete_key . . . . . . . . . . . . . . . . . . . . . 51 3.2.34. _fits_get_colnum . . . . . . . . . . . . . . . . . . . . . 51 3.2.35. _fits_insert_rows . . . . . . . . . . . . . . . . . . . . 52 3.2.36. _fits_delete_rows . . . . . . . . . . . . . . . . . . . . 52 3.2.37. _fits_insert_cols . . . . . . . . . . . . . . . . . . . . 52 3.2.38. _fits_delete_col . . . . . . . . . . . . . . . . . . . . . 53 3.2.39. _fits_get_num_cols . . . . . . . . . . . . . . . . . . . . 53 3.2.40. _fits_get_rowsize . . . . . . . . . . . . . . . . . . . . 53 3.2.41. _fits_get_num_rows . . . . . . . . . . . . . . . . . . . . 53 3.2.42. _fits_write_col . . . . . . . . . . . . . . . . . . . . . 54 3.2.43. _fits_read_col . . . . . . . . . . . . . . . . . . . . . . 54 3.2.44. _fits_get_keytype . . . . . . . . . . . . . . . . . . . . 55 3.2.45. _fits_get_keyclass . . . . . . . . . . . . . . . . . . . . 55 3.2.46. _fits_read_cols . . . . . . . . . . . . . . . . . . . . . 55 3.2.47. _fits_write_chksum . . . . . . . . . . . . . . . . . . . . 56 3.2.48. _fits_update_chksum . . . . . . . . . . . . . . . . . . . 56 3.2.49. _fits_verify_chksum . . . . . . . . . . . . . . . . . . . 56 3.2.50. _fits_get_chksum . . . . . . . . . . . . . . . . . . . . . 57 3.2.51. _fits_get_version . . . . . . . . . . . . . . . . . . . . 57 slcfitsio-0.3.8/doc/help/0000755002657400265740000000000010621347550014245 5ustar davisdavisslcfitsio-0.3.8/doc/help/cfitsio.hlp0000644002657400265740000015702710611753762016433 0ustar davisdavis_fits_get_errstatus SYNOPSIS Retrieve a text string corresponding to an error code USAGE String_Type _fits_get_errstatus (Int_Type status) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_errstatus'. See its documentation for additional information. SEE ALSO fits_read_errmsgs, _fits_read_errmsg -------------------------------------------------------------- _fits_read_errmsg SYNOPSIS Retrieve an error message from the cfitsio error message stack USAGE String_Type _fits_read_errmsg () DESCRIPTION This function is a wrapper around the CFITSIO function `fits_read_errmsg'. See its documentation for additional information. NOTES This function returns NULL if there are no error messages available. SEE ALSO fits_read_errmsgs, fits_set_verbose_errors -------------------------------------------------------------- _fits_open_file SYNOPSIS Open a fits file USAGE status = _fits_open_file (Ref_Type fptr, String_Type file, String_Type mode) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_open_file'. See its documentation for additional information. The main difference between this function and its cfitsio counterpart is that the `mode' argument is a string whose value must be one of the following: "r" Open the file in read-only mode "w" Open the file in read-write mode "c" Create a new file. Note that if the mode argument is `"c"', then the cfitsio `fits_create_file' function will be called. An important difference between this intrinsic function and the `fits_create_file' library function is that if the file already exists, the library function will return an error, whereas `_fits_open_file' will simply delete the file before creating a new one. -------------------------------------------------------------- _fits_delete_file SYNOPSIS Delete the file associated with a Fits_File_Type object USAGE status = _fits_delete_file (Fits_File_Type fptr) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_delete_file'. See its documentation for additional information. -------------------------------------------------------------- _fits_close_file SYNOPSIS Close a fits file USAGE status = _fits_close_file (Fits_File_Type fptr) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_close_file'. See its documentation for additional information. -------------------------------------------------------------- _fits_movabs_hdu SYNOPSIS Move to an absolute HDU number USAGE status = _fits_movabs_hdu (Fits_File_Type fptr, Int_Type hdunum) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_movabs_hdu'. See its documentation for additional information. NOTES The cfitsio counterpart also returns the HDU type of the resulting HDU. -------------------------------------------------------------- _fits_movrel_hdu SYNOPSIS Move a relative number of HDUs USAGE status = _fits_movrel_hdu (Fits_File_Type fptr, Int_Type nmove) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_movrel_hdu'. See its documentation for additional information. NOTES The cfitsio counterpart also returns the HDU type of the resulting HDU. -------------------------------------------------------------- _fits_movnam_hdu SYNOPSIS Move to a named HDU USAGE status = _fits_movnam_hdu (fptr, hdutype, extname, extvers) Fits_File_Type fptr; Int_Type hdutype, extvers; String_Type extname; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_movnam_hdu'. See its documentation for additional information. -------------------------------------------------------------- _fits_get_num_hdus SYNOPSIS Return the number of HDUs in a FITS file USAGE status = _fits_get_num_hdus (Fits_File_Type fptr, Ref_Type hdunum) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_num_hdus'. See its documentation for additional information. -------------------------------------------------------------- _fits_get_hdu_num SYNOPSIS Return the current HDU number USAGE hdunum = _fits_get_hdu_num (Fits_File_Type fptr) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_hdu_num'. See its documentation for additional information. -------------------------------------------------------------- _fits_get_hdu_type SYNOPSIS Get the current HDU type USAGE status = _fits_get_hdu_type (Fits_File_Type fptr, Ref_Type hdutype) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_hdu_type'. See its documentation for additional information. Upon a sucessful return, the value of the variable associated with the `hdutype' reference will be set to one of the following constants: _FITS_IMAGE_HDU _FITS_ASCII_TBL _FITS_BINARY_TBL -------------------------------------------------------------- _fits_copy_file SYNOPSIS Copy a fits file USAGE status = _fits_copy_file (infptr, outfptr, previous, current, following) Fits_File_Type infptr, outfptr; Int_Type previous, current, following; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_copy_file'. See its documentation for additional information. -------------------------------------------------------------- _fits_copy_hdu SYNOPSIS Copy an HDU USAGE status = _fits_copy_hdu (infptr, outfptr, morekeys) Fits_File_Type infptr, outfptr; Int_Type morekeys; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_copy_hdu'. See its documentation for additional information. -------------------------------------------------------------- _fits_copy_header SYNOPSIS Copy a fits header from one HDU to another USAGE status = _fits_copy_header (Fits_File_Type infptr, Fits_File_Type outfptr) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_copy_header'. See its documentation for additional information. -------------------------------------------------------------- _fits_delete_hdu SYNOPSIS Delete the current HDU USAGE status = _fits_delete_hdu (Fits_File_Type fptr) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_delete_hdu'. See its documentation for additional information. NOTES The corresponding cfitsio function also returns the HDU type of the new HDU. If that information is necessary, make a separate call to `_fits_get_hdu_type'. -------------------------------------------------------------- _fits_create_img SYNOPSIS Create a new image extension USAGE status = _fits_create_img (fptr, bitpix, dims) Fits_File_Type fptr; Int_Type bitpix; Array_Type dims; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_create_img'. See its documentation for additional information. NOTES This function differs from the corresponding cfitsio function in that the `dims' array is assumed to be a 1-d integer array whose elements specify the number of axes and the size of each axis. In particular, the value of the NAXIS keyword will be given by `length(dims)', the value of NAXIS1 will be given by `dims[0]', and so forth. -------------------------------------------------------------- _fits_write_img SYNOPSIS Write an image USAGE status = _fits_write_img (Fits_File_Type fptr, Array_Type img DESCRIPTION This function is a wrapper around the CFITSIO function `fits_write_img'. See its documentation for additional information. NOTES This function differs from its cfitsio counterpart in that the whole image represented by the array `img' will be written out. -------------------------------------------------------------- _fits_read_img SYNOPSIS Read an image USAGE status = _fits_read_img (Fits_File_Type fptr, Ref_Type img) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_read_img'. See its documentation for additional information. NOTES This function differs from the corresponding cfitsio routine in that the type of the image returned is automatically determined by the routine via a call to `fits_get_img_type'. The dimensionality of the returned image is given by `[...,NAXIS2,NAXIS1]' such that `NAXIS1' corresponds to the fastest varying dimension, `NAXIS2' the next fastest varying, etc. -------------------------------------------------------------- _fits_create_binary_tbl SYNOPSIS Create a binary table extension USAGE status = _fits_create_binary_tbl (fptr, naxis2, ttype, tform, tunit, extname) Fits_File_Type fptr; Array_Type tunit, tform, ttype; Int_Type naxis2; String_Type extname; NOTES The `_fits_create_binary_tbl' function is a wrapper around the fits_create_tbl function explicitly creating a binary table. The input arrays `ttype', `tform', and `tunit' must be the same length, which determines the number of columns in the table. The `tunit' and `extname' parameters may be set to NULL. -------------------------------------------------------------- _fits_update_key SYNOPSIS Update a keyword or append a new one USAGE status = _fits_update_key (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname, comment; Any_Type value; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_update_key'. See its documentation for additional information. NOTES The data-type for the `value' argument must be an approriate type for FITS keywords. If `value' is a string, then the string will be written as a cfitsio long-string using the fits_update_key_longstr function. If `value' is NULL, then the fits_update_key_null function will be called to update the keyword. The `comment' parameter may be set to NULL to if the comment field associated with the keyword is not to be modified. To update the value of a boolean (logical) keyword, use the `_fits_update_logical' function. -------------------------------------------------------------- _fits_update_logical SYNOPSIS Update the value of a boolean keyword USAGE status = _fits_update_logical (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname, comment; Int_Type value; DESCRIPTION The `_fits_update_logical' function is a wrapper around the cfitsio fits_update_key function with TLOGICAL specified as the datatype argument. If the `value' parameter is non-zero, then a value `T' (TRUE) will be given to the specified keyword. Otherwise, the value of the keyword will be set to `F' (FALSE). If the `comment' parameter is NULL, then the keyword's comment field will not be modified. SEE ALSO _fits_update_key -------------------------------------------------------------- _fits_write_comment SYNOPSIS Write a COMMENT header USAGE status = _fits_write_comment (Fits_File_Type fptr, String_Type comment) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_write_comment'. See its documentation for additional information. -------------------------------------------------------------- _fits_write_history SYNOPSIS Write a HISTORY header USAGE status = _fits_write_history (Fits_File_Type fptr, String_Type history) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_write_history'. See its documentation for additional information. -------------------------------------------------------------- _fits_write_date SYNOPSIS Write a DATE keyword USAGE status = _fits_write_date (Fits_File_Type fptr) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_write_date'. See its documentation for additional information. -------------------------------------------------------------- _fits_write_record SYNOPSIS Write a keyword record USAGE status = _fits_write_record (Fits_File_Type fptr, String_Type card) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_write_record'. See its documentation for additional information. -------------------------------------------------------------- _fits_modify_name SYNOPSIS Rename a keyword USAGE status = _fits_modify_name (fptr, oldname, newname) Fits_File_Type fptr; String_Type oldname, newname; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_modify_name'. See its documentation for additional information. -------------------------------------------------------------- _fits_get_num_keys SYNOPSIS Get the number of keywords in the current HDU USAGE status _fits_get_num_keys (Fits_File_Type fptr, Ref_Type numkeys) DESCRIPTION This function is a wrapper around the cfitsio fits_get_hdrspace function. It obtains the number of existing keywords in the current HDU (excluding the END keyword) and assigns that value to variable associated with the `numkeys' parameter. -------------------------------------------------------------- _fits_read_key_integer SYNOPSIS Read the value of a keyword as an integer USAGE status = _fits_read_key_integer (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; DESCRIPTION This function uses the cfitsio fits_read_key function to read the value of the specifed keyword as an integer. Its value is assigned to the variable referenced by the `value' parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. SEE ALSO _fits_read_key, _fits_read_key_string, _fits_read_key_double -------------------------------------------------------------- _fits_read_key_string SYNOPSIS Read the value of a keyword as a string USAGE status = _fits_read_key_string (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; DESCRIPTION This function uses the cfitsio fits_read_key_longstr function to read the value of the specifed keyword as a cfitsio long-string. The string is assigned to the variable referenced by the `value' parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. SEE ALSO _fits_read_key, _fits_read_key_integer, _fits_read_key_double -------------------------------------------------------------- _fits_read_key_double SYNOPSIS Read the value of a keyword as a double USAGE status = _fits_read_key_double (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; DESCRIPTION This function uses the cfitsio fits_read_key function to read the value of the specifed keyword as a double. The keyword's value is assigned to the variable referenced by the `value' parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. SEE ALSO _fits_read_key, _fits_read_key_integer, _fits_read_key_string -------------------------------------------------------------- _fits_read_key SYNOPSIS Read the value of a keyword USAGE status = _fits_read_key (fptr, keyname, value, comment) Fits_File_Type fptr; String_Type keyname; Ref_Type value, comment; DESCRIPTION This function uses the cfitsio fits_read_key function to read the value of the specifed keyword. It first uses the cfitsio fits_get_keytype function to determine the data-type for the keyword and then calls fits_read_key using that data-type. The resulting value is assigned to the variable referenced by the `value' parameter. If the comment parameter is non-NULL, then the value of the comment field will be assigned to it. SEE ALSO _fits_read_key_integer, _fits_read_key_string, _fits_read_key_double -------------------------------------------------------------- _fits_read_record SYNOPSIS Read a specified record from the current HDU USAGE status = _fits_read_record (fptr, keynum, card) Fits_File_Type fptr; Int_Type keynum; Ref_Type card; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_read_record'. See its documentation for additional information. -------------------------------------------------------------- _fits_delete_key SYNOPSIS Delete a keyword from the header USAGE status = _fits_delete_key (Fits_File_Type fptr, String_Type keyname) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_delete_key'. See its documentation for additional information. -------------------------------------------------------------- _fits_get_colnum SYNOPSIS Get the column number of a specfied table column USAGE status = _fits_get_colnum (fptr, colname, colnum) Fits_File_Type fptr; String_Type colname; Ref_Type colnum; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_colnum'. See its documentation for additional information. NOTES The corresponding cfitsio function permits a wildcard match to the `colname' parameter. The current wrapping of this function does not support such matching. The `colname' parameter is treating in a case-insensitive manner. -------------------------------------------------------------- _fits_insert_rows SYNOPSIS Insert rows into a table USAGE status = _fits_insert_rows (fptr, firstrow, nrows) Fits_File_Type fptr; Int_Type firstrow, nrows; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_insert_rows'. See its documentation for additional information. -------------------------------------------------------------- _fits_delete_rows SYNOPSIS Delete rows from a table USAGE status = _fits_delete_rows (fptr, firstrow, nrows) Fits_File_Type fptr; Int_Type firstrow, nrows; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_delete_rows'. See its documentation for additional information. -------------------------------------------------------------- _fits_insert_cols SYNOPSIS Insert columns into a table USAGE status = _fits_insert_cols (fptr, colnum, ttype, tform) Fits_File_Type fptr; Int_Type colnum; Array_Type ttype, tform; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_insert_cols'. See its documentation for additional information. NOTES The number of columns to be inserted is given by the length of the `ttype' and `tform' arrays, which must be of the same length. -------------------------------------------------------------- _fits_delete_col SYNOPSIS Delete a column from a table USAGE status = _fits_delete_col (Fits_File_Type fptr, Int_Type colnum) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_delete_col'. See its documentation for additional information. -------------------------------------------------------------- _fits_get_num_cols SYNOPSIS Get the number of table columns USAGE status = _fits_get_num_cols (Fits_File_Type fptr, Ref_Type ncols) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_num_cols'. See its documentation for additional information. -------------------------------------------------------------- _fits_get_rowsize SYNOPSIS Get the number of rows to read or write for maximum efficiency USAGE status = _fits_get_rowsize (Fits_File_Type fptr, Ref_Type nrows) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_rowsize'. See its documentation for additional information. -------------------------------------------------------------- _fits_get_num_rows SYNOPSIS Get the number of table rows USAGE status = _fits_get_num_cols (Fits_File_Type fptr, Ref_Type nrows) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_num_rows'. See its documentation for additional information. -------------------------------------------------------------- _fits_write_col SYNOPSIS Write data to a table column USAGE status = _fits_write_col (fptr, colnum, firstrow, firstelem, array) Fits_File_Type fptr; Int_Type colnum; Int_Type firstrow, firstelem; Array_Type array; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_write_col'. See its documentation for additional information. NOTES The number of elements written out to the column by this function will be equal to the number of elements in the array. -------------------------------------------------------------- _fits_read_col SYNOPSIS Read elements from a column USAGE status = _fits_read_col (fptr, colnum, firstrow, numrows, array Fits_File_Type fptr; Int_Type colnum, firstrow, numrows; Ref_Type array; DESCRIPTION This function is a complicated wrapper around a number of cfitsio functions to enable it to read any type of column, including vector and variable length columns. The data read by the function is assigned as the appropriately typed array to the variable referenced by the `array' argument. For ordinary scalar columns, a 1-d array of size `numrows' will be produced. For a vector column, a 2d array of size `[numrows,repeat]' will be generated. Here `repeat' is given by the repeat value associated with the column. For a variable length column, where data are stored in the heap of the HDU, the data will be read as a 1-d array of `numrows' arrays. If the column is a bit-valued column, then data will be returned as an array of integers of the appropriate size. Currently only 8X, 16X, and 32X bit columns are supported. SEE ALSO _fits_read_cols, _fits_write_col -------------------------------------------------------------- _fits_get_keytype SYNOPSIS Get a keyword's data type USAGE status = _fits_get_keytype (fptr, keyname, type) Fits_File_Type fptr; String_Type keyname; Ref_Type type; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_keytype'. See its documentation for additional information. NOTES This function differs from its cfitsio counterpart in that instead of explicitly specifying the keyword's value string, this function uses the value of the specified keyword. It also returns the type as a S-Lang `DataType_Type' object, e.g., `Int_Type', `Complex_Type', etc. -------------------------------------------------------------- _fits_get_keyclass SYNOPSIS Get the class of an input header record USAGE Int_Type _fits_get_keyclass (String_Type card) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_keyclass'. See its documentation for additional information. -------------------------------------------------------------- _fits_read_cols SYNOPSIS Read one or more table columns USAGE status = _fits_read_cols (fptr, colnums, firstrow, nrows, arrays) Fits_File_Type fptr; Array_Type colnums; Int_Type firstrow, numrows; Ref_Type arrays; DESCRIPTION This function performs a similar task as the `_fits_read_col'. The main difference is that instead of reading a single column, it is capable of reading multiple columns specified by the `colnums' parameter. It assigns the data as an array of arrays to the variable referenced by the `arrays' parameter. See the documentation for the `_fits_read_col' function for more information. NOTES This function takes advantage of the cfitsio buffering mechanism to optimize the reads. -------------------------------------------------------------- _fits_write_chksum SYNOPSIS Compute and write DATASUM and CHECKSUM keywords USAGE status = _fits_write_chksum (Fits_File_Type fptr) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_write_chksum'. See its documentation for additional information. -------------------------------------------------------------- _fits_update_chksum SYNOPSIS Update the CHECKSUM keyword USAGE status = _fits_update_chksum (Fits_File_Type fptr) DESCRIPTION This function is a wrapper around the CFITSIO function `fits_update_chksum'. See its documentation for additional information. -------------------------------------------------------------- _fits_verify_chksum SYNOPSIS Verify the checksums for the current HDU USAGE status = _fits_verify_chksum (fptr, dataok, hduok) Fits_File_Type fptr; Ref_Type dataok, hduok; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_verify_chksum'. See its documentation for additional information. -------------------------------------------------------------- _fits_get_chksum SYNOPSIS Get the checksums for the current HDU USAGE status = _fits_get_chksum (fptr, datasum, hdusum) Fits_File_Type fptr; Ref_Type datasum, hdusum; DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_chksum'. See its documentation for additional information. -------------------------------------------------------------- _fits_get_version SYNOPSIS Get the cfitsio library version number USAGE Float_Type _fits_get_version () DESCRIPTION This function is a wrapper around the CFITSIO function `fits_get_version'. See its documentation for additional information. -------------------------------------------------------------- fits_read_errmsgs SYNOPSIS Retrieve all error messages from the CFITSIO error stack USAGE String_Type[] fits_read_errmsgs () DESCRIPTION This function returns all the error messages from the CFITSIO error message stack as an array of strings. NOTES Using this function will cause the error message stack to be cleared. SEE ALSO _fits_read_errmsg, fits_set_verbose_errors -------------------------------------------------------------- fits_set_verbose_errors SYNOPSIS Set the verbosity level of the cfitsio error messages USAGE fits_set_verbose_errors (Int_Type level) DESCRIPTION When a call to a function in the high-level interface fails, a error message will get generated. By default, all messages from the underlying cfitsio error stack are printed. This behavior may be turned off by calling this function with `level' equal to 0. SEE ALSO fits_read_errmsgs -------------------------------------------------------------- fits_open_file SYNOPSIS Open a fits file USAGE Fits_File_Type fits_open_file (String_Type filename, String_Type mode) DESCRIPTION The `fits_open_file' function can be used to open and existing fits file for reading or updating, or to create a new fits file, depending upon the value of the `mode' parameter. Specifically, if `mode' is `"r"', the file will be opened for reading. If `mode' is `"w"', the file will be opened for updating (both reading and writing). Otherwise, `mode' must be `"c"', which indicates that a new file is to be created. In the latter case, if a file already exists with the specified name, it will get deleted and a new one created in its place. If the function fails, it will signal an error; otherwise an open file pointer will be returned. SEE ALSO fits_close_file, fits_create_binary_table -------------------------------------------------------------- fits_close_file SYNOPSIS Close a fits file USAGE fits_close_file (Fits_File_Type f) DESCRIPTION The `fits_close_file' closes a previously opened fits file. The function will signal an error if the operation fails. NOTES This function could fail if it fails to write out any buffered data because of filesystem errors (disk full, etc.). SEE ALSO fits_open_file -------------------------------------------------------------- fits_move_to_interesting_hdu SYNOPSIS Move to an extension that looks interesting USAGE fits_move_to_interesting_hdu (fp [, hdu_type] Fits_File_Type fp; Int_Type hdu_type; DESCRIPTION The function move the fits file pointer `fp' forward to an HDU that looks interesting. By definition, an interesting HDU is one in which NAXIS is non-zero. The first parameter `fp' must be a pointer to an already open fits file. The second parameter, if present, may be used to specifiy the type of HDU, e.g., either an image (`hdu_type=_FITS_IMAGE_HDU') or a binary table (`hdu_type=_FITS_BINARY_TBL'). If the function fails to find an interesting HDU of the appropriate type, an exception will be generated. SEE ALSO fits_open_file -------------------------------------------------------------- fits_key_exists SYNOPSIS Check for the existence of a keyword USAGE Int_Type fits_key_exists (fd, key) Fits_File_Type or String_Type fd; String_Type key; DESCRIPTION The `fits_key_exists' function checks for the existence of a specified keyword in the file specified by the descriptor `fd', which must specify the name of a file or an open file pointer. If the specified key exists, the function return 1, otherwise it returns 0. SEE ALSO fits_read_key, fits_read_header -------------------------------------------------------------- fits_get_colnum SYNOPSIS Get the column numbers of specified columns USAGE column_num = fits_get_colnum (fd, column_name) Fits_File_Type or String_Type fd; String_Type column_name; DESCRIPTION This function returns the column number of the column with the specified name. The file-descriptor `fd' must specify the name of a file, or an open fits file pointer. SEE ALSO fits_binary_table_column_exists -------------------------------------------------------------- fits_binary_table_column_exists SYNOPSIS Check for the existence of a binary table column USAGE Int_Type fits_binary_table_column_exists (fd, col) Fits_File_Type or String_Type fd; String_Type col; DESCRIPTION This function may be used to determine whether or not a named column exists in a binary table. The table is specified via the `fd' parameter which must either be the name of a file containing the binary table, or an file pointer. If the specified column exists, 1 will be returned; otherwise the function will return 0. SEE ALSO fits_key_exists, fits_open_file -------------------------------------------------------------- fits_read_col SYNOPSIS Read one or more columns from a FITS binary table USAGE (x1, ...xN) = fits_read_col (file, c1, ... cN) Fits_File_Type or String_Type file; Int_Type or String_Type c1, ...cN; DESCRIPTION This function returns one or more vectors containing objects in the specified columns of the binary table indicated by `file'. If `file' is a string, then the file will be opened via the virtual file specification implied by `file'. Otherwise, `file' should represent an already opened FITS file. The column parameters may either be strings denoting the column names, or integers representing the column numbers. SEE ALSO fits_read_cell, fits_read_row, fits_read_table -------------------------------------------------------------- fits_read_col_struct SYNOPSIS Read one or more columns from a FITS binary table USAGE struct = fits_read_col_struct (file, col1, ...) Fits_File_Type or String_Type file; String_Type col1, ...; DESCRIPTION This function works exactly like `fits_read_col' except it returns the values in a structure. See the documentation on that function for more information. SEE ALSO fits_read_col, fits_read_key_struct, fits_read_row, fits_read_header -------------------------------------------------------------- fits_read_cell SYNOPSIS Read a cell from a FITS binary table USAGE X = fits_read_cell (file, c, r) Fits_File_Type or String_Type file; Int_Type r, c; DESCRIPTION This function returns the object in the column `c' and row `r' of the binary table indicated by `file'. If `file' is a string, then the file will be opened via the virtual file specification implied by `file'. Otherwise, `file' should represent an already opened FITS file. SEE ALSO fits_read_col, fits_read_row -------------------------------------------------------------- fits_read_row SYNOPSIS Read a row from a FITS binary table USAGE Struct_Type fits_read_cell (file, r) Fits_File_Type or String_Type file; Int_Type r; DESCRIPTION This function returns a structure containing the data in the columns of the row `r' of the binary table indicated by `file'. If `file' is a string, then the file will be opened via the virtual file specification implied by `file'. Otherwise, `file' should represent an already opened FITS file. SEE ALSO fits_read_col, fits_read_cell -------------------------------------------------------------- fits_read_header SYNOPSIS Read a FITS header USAGE Struct_Type fits_read_header (file) Fits_File_Type or String_Type file; DESCRIPTION This function reads the header of the fits file given by the `file' parameter and returns it as a structure. If `file' is a string, then the file will be opened via the virtual file specification implied by `file'. Otherwise, `file' should represent an already opened FITS file. SEE ALSO fits_read_table -------------------------------------------------------------- fits_read_table SYNOPSIS Read a FITS table USAGE Struct_Type fits_read_table (file [,columns...]) Fits_File_Type or String_Type file; DESCRIPTION `fits_read_table' reads the data in a table of the FITS file specified by `file' and returns it as a structure. If the optional column name parameters are specified, then only those columns will be read. Otherwise, the entire table will be returned. If `file' is a string, then the file will be opened via the virtual file specification implied by `file'. Otherwise, `file' should represent an already opened FITS file. SEE ALSO fits_read_col, fits_read_cell, fits_read_row, fits_read_header -------------------------------------------------------------- fits_read_key SYNOPSIS Read one or more keywords from a FITS file USAGE (val1,...) = fits_read_key (file, key1, ...) Fits_File_Type or String_Type file; String_Type key1, ...; DESCRIPTION `fits_read_key' reads the values of one or more keywords in the fits file specified by `file' and returns them. If `file' is a string, then the file will be opened via the virtual file specification implied by `file'. Otherwise, `file' should represent an already opened FITS file. If any of the keywords do not exist, a value of NULL will be returned for the corresponding keyword. SEE ALSO fits_read_key_struct, fits_read_col, fits_read_cell, fits_read_row, fits_read_header -------------------------------------------------------------- fits_read_key_struct SYNOPSIS Read one or more keywords from a FITS file USAGE struct = fits_read_key (file, key1, ...) Fits_File_Type or String_Type file; String_Type key1, ...; DESCRIPTION This function works exactly like `fits_read_key' excepts returns the values in a structure. See the documentation on that function for more information. SEE ALSO fits_read_key, fits_read_col, fits_read_cell, fits_read_row, fits_read_header -------------------------------------------------------------- fits_create_binary_table SYNOPSIS Prepare a binary table USAGE fits_create_binary_table (file, extname, nrows, ttype, tform, tunit) Fits_File_Type or String_Type file; String_Type extname; Int_Type nrows; String_Type ttype[]; String_Type tform[]; String_Type tunit[]; DESCRIPTION This creates a new binary table with the specified structure. The parameters `ttype', `tform', and `tunit' are string arrays that specify the column names, column data type, and column units, respectively. The binary table will be given the extension name `extname'. SEE ALSO fits_write_binary_table, fits_open_file -------------------------------------------------------------- fits_write_binary_table SYNOPSIS Write a binary table USAGE fits_write_binary_table (file, extname, sdata, [skeys [,hist]]) Fits_File_Type or String_Type file; String_Type extname; Struct_Type sdata; Struct_Type skeys; Struct_Type hist; DESCRIPTION The `fits_write_binary_table' function creates a new binary table in the specified file. The parameter `file' specifies either a filename or an open file pointer. The `extname' parameter specifies the extension name of the binary table. The data written to table are specified in the `sdata' structure, where the name of the structure field specifies the column name. If `skeys' is non-NULL, then it is a structure indicating additional keywords to be written to the header of the binary table. If the optional parameter `hist' is present and non-NULL, then it is a structure whose fields indicate either comment or history information to be written to the header. EXAMPLE The following code variable data = struct { x, cosx, sinx }; data.x = [0:2*PI:0.01]; data.cosx = cos(data.x); data.sinx = sin(data.x); variable keys = struct { hduname, username}; keys.hduname = "COSXSINX"; keys.username = "John Doe"; variable hist = struct { history, comment}; hist.history = ["This is a history record", "This is another"]; hist.comment = ["This is a comment", "And this is another"]; fits_write_binary_table ("foo.fits", "COSXSINX", data, keys, hist); produces a binary table with the header: XTENSION= 'BINTABLE' / binary table extension BITPIX = 8 / 8-bit bytes NAXIS = 2 / 2-dimensional binary table NAXIS1 = 24 / width of table in bytes NAXIS2 = 629 / number of rows in table PCOUNT = 0 / size of special data area GCOUNT = 1 / one data group (required keyword) TFIELDS = 3 / number of fields in each row TTYPE1 = 'x ' / label for field 1 TFORM1 = 'D ' / data format of field: 8-byte DOUBLE TTYPE2 = 'cosx ' / label for field 2 TFORM2 = 'D ' / data format of field: 8-byte DOUBLE TTYPE3 = 'sinx ' / label for field 3 TFORM3 = 'D ' / data format of field: 8-byte DOUBLE EXTNAME = 'COSXSINX' / name of this binary table extension HDUNAME = 'COSXSINX' USERNAME= 'John Doe' HISTORY This is a history record HISTORY This is another COMMENT This is a comment COMMENT And this is another NOTES This function provides no mechanism to mix comments and keyword records. As the example shows, this function places the comment and history records at the end of the table. SEE ALSO fits_create_binary_table, fits_open_file -------------------------------------------------------------- fits_update_key SYNOPSIS Update the value of a keyword USAGE fits_update_key (fd, key, val [,comment]) String_Type or Fits_File_Type fd; String_Type key; Any type val; String_Type comment; DESCRIPTION The `fits_update_key' function updates the value and comment fields of an existing keyword with the specified name. If the keyword does not exist, a new keyword will be appended to the end of the header. SEE ALSO fits_update_logical, fits_read_key -------------------------------------------------------------- fits_update_logical SYNOPSIS Update the value of a logical (boolean) keyword USAGE fits_update_logical (fd, key, val, comment) String_Type or Fits_File_Type fd; String_Type key; Any type val; String_Type comment; DESCRIPTION The `fits_update_logical' function updates the value and comment fields of an existing keyword of the specified name with the specified boolean value. If the keyword does not exist, a new keyword will be appended to the end of the header. SEE ALSO fits_update_key -------------------------------------------------------------- fits_write_comment SYNOPSIS Write a comment to the header USAGE fits_write_comment (fd, comment) Fits_File_Type or String_Type fd; String_Type comment; DESCRIPTION As the name indicates, this function writes a comment record to the specified fits file. The file-descriptor `fd' must either be the name of a fits file or an open fits file pointer. SEE ALSO fits_update_key, fits_write_history -------------------------------------------------------------- fits_write_history SYNOPSIS Write a history record to the header USAGE fits_write_history (fd, history) Fits_File_Type or String_Type fd; String_Type history; DESCRIPTION As the name indicates, this function writes a history record to the specified fits file. The file-descriptor `fd' must either be the name of a fits file or an open fits file pointer. SEE ALSO fits_update_key, fits_write_comment -------------------------------------------------------------- fits_write_date SYNOPSIS Write the DATE keyword to the current HDU USAGE fits_write_date (fd) Fits_File_Type or String_Type fd; DESCRIPTION The `fits_write_date' function calls `_fits_write_date' to write the DATE to the header of the specified file descriptor, which must either be the name of a fits file or an open fits file pointer. SEE ALSO fits_update_key -------------------------------------------------------------- fits_write_chksum SYNOPSIS Compute and write the DATASUM and CHECKSUM keywords USAGE fits_write_chksum (fd) Fits_File_Type or String_Type fd; DESCRIPTION The `fits_write_chksum' function calls `_fits_write_comment' to compute and write the DATASUM and CHECKSUM keywords to the header of the specified file descriptor, which must either be the name of a fits file or an open fits file pointer. SEE ALSO fits_update_key, fits_verify_chksum -------------------------------------------------------------- fits_verify_chksum SYNOPSIS Verify the checksums for the current HDU USAGE isok = fits_verify_chksum (fd [,dataok, hduok]) Fits_File_Type or String_Type fd; Ref_Type dataok, hduok; DESCRIPTION The `fits_verify_chksum' function calls `_fits_verify_chksum' to verify the header and data checksums of the current HDU. A non-zero return value signifies that the checksums are ok, otherwise the function returns 0 to indicate that the checksums are invalid. The individual checksums of the HDU or data can be checked through the use of the optional parameters. SEE ALSO fits_write_chksum -------------------------------------------------------------- fits_read_records SYNOPSIS Read all the records in a fits header USAGE String_Type[] fits_read_records (Fits_File_Type or String_Type fp) DESCRIPTION This function returns a list of all the header records associated with the fits file descriptor as an array of strings. SEE ALSO fits_write_records, fits_read_key -------------------------------------------------------------- fits_write_records SYNOPSIS Write records to fits header USAGE fits_write_records (fd, records) Fits_File_Type or String_Type fd; Array_Type records; DESCRIPTION This function uses the `_fits_write_record' function to write a series of records to the current HDU. SEE ALSO fits_read_records -------------------------------------------------------------- fits_get_keyclass SYNOPSIS Obtain the key classes for a set of cards USAGE Int_Type[] = fits_get_keyclass (Array_Type cards) DESCRIPTION This function uses the `_fits_get_keyclass' function to obtain the key-classes associated with one or more cards. The function returns an integer-valued array of the same length as the `cards' array. EXAMPLE Obtain set of header cards to those that are not associated with the cards describing the structure of the HDU: variable cards = fits_read_records ("evt2.fits[EVENTS]"); variable classes = fits_get_keyclass (cards); cards = cards[where (classes != _FITS_TYP_STRUC_KEY)]; SEE ALSO fits_read_records, fits_read_key -------------------------------------------------------------- fits_get_bitpix SYNOPSIS Get the fits bitpix value for an array USAGE Int_Type fits_get_bitpix (array) DESCRIPTION This function may be used to obtain the bitpix value for a specified image array. The array must be an integer or floating point type, otherwise and error will be generated. The bitpix value is returned. SEE ALSO fits_write_image_hdu, fits_read_img -------------------------------------------------------------- fits_read_img SYNOPSIS Read image data from a fits file USAGE Array_Type fits_read_img (fd) Fits_File_Type or String_Type fd; DESCRIPTION This function reads an image from the specified file descriptor. The file descriptor must be either the name of an existing file, or an open file pointer. It returns the image upon sucess, or signals an error upon failure. SEE ALSO fits_read_table, fits_read_col, fits_open_file, fits_write_img -------------------------------------------------------------- fits_create_image_hdu SYNOPSIS Create a primary array or image extension USAGE fits_create_image_hdu (fd, extname, type, dims) Fits_File_Type or String_Type fd; String_Type extname; Array_Type dims; DataType_Type type; DESCRIPTION This function make use of the `_fits_create_img' function to create an image extension or primary array of the specified type and size. If the `extname' parameter is non-NULL, then an EXTNAME keyword will be written out with the value of the extname parameter. The `dims' parameter must be a 1-d integer array that corresponds to the dimensions of the array to be written. If `fd' is specified as a string, then a new file of that name will be created. If a file by that name already exists, it will be deleted and a new one created. If this behavior is undesired, then explicitly open the file and pass this routine the resulting file pointer. SEE ALSO fits_write_image_hdu -------------------------------------------------------------- fits_write_image_hdu SYNOPSIS Write an image extension USAGE fits_write_image_hdu (file, extname, image [,skeys [,hist]]) Fits_File_Type or String_Type file; String_Type extname; Any_Type image Struct_Type skeys; Struct_Type hist; DESCRIPTION The `fits_write_image_hdu' function creates a new image extension in the specified file. The parameter `file' specifies either a filename or an open file pointer. The `extname' parameter specifies the extension name of the image, or NULL for the primary image. The image data written to the file are specified by the `image' parameter. If the optional parameter `skeys' is non-NULL, then it is a structure indicating additional keywords to be written to the HDU. If the optional parameter `hist' is present and non-NULL, then it is a structure whose fields indicate either comment or history information to be written to the header. EXAMPLE The following code variable img = [1:128*128]; reshape (img, [128,128]); variable keys = struct { hduname, username}; keys.hduname = "MY_IMAGE"; keys.username = "John Doe"; variable hist = struct { history, comment}; hist.history = ["This is a history record", "This is another"]; hist.comment = ["This is a comment", "And this is another"]; fits_write_image_hdu ("foo.fits", NULL, img, keys, hist); produces an image HDU with the header: SIMPLE = T / file does conform to FITS standard BITPIX = 32 / number of bits per data pixel NAXIS = 2 / number of data axes NAXIS1 = 128 / length of data axis 1 NAXIS2 = 128 / length of data axis 2 EXTEND = T / FITS dataset may contain extensions COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H HDUNAME = 'MY_IMAGE' USERNAME= 'John Doe' HISTORY This is a history record HISTORY This is another COMMENT This is a comment COMMENT And this is another NOTES This function provides no mechanism to mix comments and keyword records. As the example shows, this function places the comment and history records at the end of the table. SEE ALSO fits_create_binary_table, fits_open_file -------------------------------------------------------------- fits_write_img SYNOPSIS Write the image data to an Image HDU USAGE fits_write_img (Fits_File_Type fptr, Any_Type data) DESCRIPTION This function writes the image data out to current HDU, assumed to be an Image HDU. SEE ALSO fits_write_image_hdu, fits_create_image_hdu -------------------------------------------------------------- fitswcs_new SYNOPSIS Create a new-ndimensional linear WCS USAGE wcs = fitswcs_new (Int_Type naxis) DESCRIPTION This function returns a new WCS structure of the specified dimensionality that represents an identity (linear) transformation. SEE ALSO fitswcs_get_img_wcs, fitswcs_get_column_wcs, fitswcs_get_vector_wcs -------------------------------------------------------------- fitswcs_slice SYNOPSIS Form a new wcs from one or more axes of another USAGE new_wcs = fitswcs_slice (wcs, dims) DESCRIPTION This function may be used to construct a new wcs from another by rearranging its axes or by using a subset of them. The `dims' argument specifies the dimensions to use. EXAMPLE Suppose that `wcs' represents a 4 dimensional WCS. Then wcs2 = fitswcs_slice (wcs, [0,1]); will result in a 2 dimensional WCS from the first 2 axis of the input WCS. Similarly, wcs2 = fitswcs_slice (wcs, [1,0]); will produce a 2d WCS with the first two axes swapped. SEE ALSO fitswcs_get_img_wcs, fitswcs_get_column_wcs, fitswcs_get_vector_wcs -------------------------------------------------------------- fitswcs_get_img_wcs SYNOPSIS Read a WCS for a FITS image USAGE wcs = fitswcs_get_img_wcs (fp [,alt]) DESCRIPTION The `fitswcs_get_img_wcs' returns a structure representing a WCS from the specified file descriptor `fp' corresponding to an image HDU. An optional parameter may be used to specified an alternate WCS. EXAMPLE wcs = fitswcs_get_img_wcs ("img.fits[IMAGE]", 'P'); SEE ALSO fitswcs_put_img_wcs, fitswcs_get_column_wcs, fitswcs_get_vector_wcs -------------------------------------------------------------- fitswcs_get_column_wcs SYNOPSIS Get the WCS attached to one or more columns of a binary table USAGE fitswcs_get_column_wcs (fp, columns-array [,alt] DESCRIPTION This function may be used to obtain the WCS associated with one or more columns of a binary table. The file descriptor `fp' must specify a binary table. The `columns-array' parameter should be an array of columns names. The third parameter is optional and is used to specify an alternate WCS. EXAMPLE wcs = fitswcs_get_column_wcs ("evt1.fits[EVENTS]", ["X","Y"]); SEE ALSO fitswcs_put_column_wcs, fitswcs_get_img_wcs, fitswcs_get_vector_wcs -------------------------------------------------------------- fitswcs_get_vector_wcs SYNOPSIS Get the WCS of an image in a specified table cell USAGE wcs = fitswcs_get_vector_wcs (fp, column_name, row [,alt]) DESCRIPTION This function reads the WCS of an image in a specified cell of a binary table given by `fp' parameter. The second and third parameters specify the column name and row number of the cell. An optional fourth parameter may be used to obtain the corresponding alternate WCS. EXAMPLE This example reads the WCS associated with the image in the second row of the QEU column of the binary table with HDUNAME equal to AXAF_QEU1 in the file "HRCQEU.fits": wcs = fitswcs_get_vector_wcs ("HRCQEU.fits[AXAF_QEU1], "QEU", 2); NOTES The current implementation does not yet support references to the WCS of other cells. SEE ALSO fitswcs_get_column_wcs, fitswcs_get_img_wcs -------------------------------------------------------------- fitswcs_new_img_wcs SYNOPSIS Create a linear WCS for an image USAGE wcs = fitswcs_new_img_wcs (grid0,grid1,...) DESCRIPTION This function may be used to construct a linear WCS for an image with the specified grids. The grids are assumed to be linear. EXAMPLE Use the histogram module's hist2d function to create an image from the X and Y columns in a file, and the construct a corresponding WCS: (x,y) = fits_read_col ("table.fits", "X", "Y"); gridx = [min(x):max(x):0.5]; gridy = [min(y):max(y):0.5]; img = hist2d (y,x,gridy,gridx); wcs = fitswcs_new_img_wcs (gridy, gridx); SEE ALSO fitswcs_new, fitswcs_get_img_wcs -------------------------------------------------------------- fitswcs_put_img_wcs SYNOPSIS Write a WCS out to an image header USAGE fitswcs_put_img_wcs (fp, wcs [,alt]) DESCRIPTION The `fitswcs_put_img_wcs' may be used to write the specified wcs out to the image HDU specified by the `fp' parameter. An optional third parameter may be used to specify an alternate WCS. EXAMPLE fp = fits_open_file ("img.fits", "w"); . . . fits_put_img_wcs (fp, wcs, 'P'); fits_close_file (fp); SEE ALSO fitswcs_put_column_wcs -------------------------------------------------------------- fitswcs_put_column_wcs SYNOPSIS Write the WCS attached to one or more table columns USAGE fitswcs_put_column_wcs (fp, wcs, columns-array [,alt]) DESCRIPTION This function may be used to attach a WCS to one or more columns of a binary table. The dimensionality of the specified WCS must match the length of the array specifying the column names. The first parameter, `fp' must specify a binary table extension. The fourth parameter is optional and may be used to specify an alternate WCS. EXAMPLE fitswcs_put_column_wcs ("evt2.fits[EVENTS], wcs, ["X","Y"]); SEE ALSO fitswcs_get_column_wcs, fitswcs_put_img_wcs, fitswcs_get_img_wcs -------------------------------------------------------------- fitswcs_linear_transform_wcs SYNOPSIS Apply a linear transformation to a WCS USAGE wcs1 = fitswcs_linear_transform_wcs (wcs, U0, A, X0) wcs: The specified WCS to transform U0,X0: 1-d arrays A: 2-d array (or 1-d array representing a diagonal matrix) DESCRIPTION This function may be used to create a new WCS by applying a linear transformation to an existing one. This is useful when one has a WCS associated with physical coordinates `X', and then applies the linear transformation U = U0 + A#(X-X0) to the coordinates X. Then corresponding WCS for the resulting image is given by new_wcs = fitswcs_linear_transform_wcs (wcs, U0, A, X0); NOTES The dimensionality of the WCS is limited to 2 in the current implementation. SEE ALSO fitswcs_rebin_wcs, fitswcs_bin_wcs -------------------------------------------------------------- fitswcs_rebin_wcs SYNOPSIS This function may be used to obtain the wcs for a rebinned image USAGE wcs1 = fitswcs_rebin_wcs (wcs, old_dims, new_dims...) DESCRIPTION This function may be used to construct the WCS for a rebinned image from the WCS of of the unbinned image. The grid parameters specify the linear grids the new image. EXAMPLE new_img = hist2d_rebin (new_yrid, new_xgrid, old_ygrid, old_xgrid, old_img); new_wcs = fitswcs_rebin_wcs (old_wcs, array_shape(old_img), array_shape(new_img)); SEE ALSO fitswcs_bin_wcs, fitswcs_linear_transform_wcs, fitswcs_slice -------------------------------------------------------------- fitswcs_bin_wcs SYNOPSIS This function may be used to obtain the wcs for a rebinned image USAGE wcs1 = fitswcs_rebin_wcs (wcs, grid0, grid1, ...) DESCRIPTION This function may be used to construct the WCS for an image created by binning a set of coordinates from, e.g., a pixel-list. The `wcs' parameter represents the wcs attached to the unbinnned coordinates. The grid parameters specify the linear grids that were used to create the image. SEE ALSO fitswcs_rebin_wcs, fitswcs_linear_transform_wcs, fitswcs_slice -------------------------------------------------------------- slcfitsio-0.3.8/src/0000755002657400265740000000000010621347550013337 5ustar davisdavisslcfitsio-0.3.8/src/tests/0000755002657400265740000000000010621347550014501 5ustar davisdavisslcfitsio-0.3.8/src/tests/test_fits.sl0000644002657400265740000000654010602532746017054 0ustar davisdavisprivate variable MODULE_NAME = "cfitsio"; prepend_to_slang_load_path ("."); set_import_module_path (".:" + get_import_module_path ()); require ("fits"); private variable Failed = 0; private define warn () { variable args = __pop_args (_NARGS); () = fprintf (stderr, "**** Warning: %s\n", sprintf (__push_args (args))); Failed++; } private define check_key_read_write (fptr, key, val) { variable val1; fits_update_key (fptr, key, val, NULL); val1 = fits_read_key (fptr, key); if ((val != val1) or (typeof (val) != typeof (val1))) warn ("failed to write and then read key %S (%S != %S)", key, typeof (val), typeof (val1)); } define is_identical (a, b) { variable dims_a, dims_b; (dims_a,,) = array_info (a); (dims_b,,) = array_info (b); if (length (dims_a) != length (dims_b)) return 0; if (length (where(dims_a != dims_b))) return 0; if (_typeof (a) != _typeof(b)) return 0; if (length (where (a != b))) return 0; return 1; } define test_img (filename) { variable fptr = fits_open_file (filename, "c"); variable dims = [2,10]; variable npixels = dims[0]*dims[1]; fits_create_image_hdu (fptr, NULL, UInt32_Type, dims); variable card = "key_prec= 'This keyword was written by fxprec' / comment goes here"; fits_write_records (fptr, [card]); variable val = "1234567890123456789012345678901234567890" + "12345678901234567890123456789012345"; check_key_read_write (fptr, "card1", val); check_key_read_write (fptr, "keyint", 1); check_key_read_write (fptr, "keydbl", 1.2); check_key_read_write (fptr, "tstring", "a string"); fits_update_logical (fptr, "tlogical", 1, NULL); if (1 != fits_read_key (fptr, "tlogical")) warn ("failed to read and write logical"); fits_write_comment (fptr, " This keyword was written by fxpcom."); fits_write_history (fptr, " This keyword written by fxphis (w/ 2 leading spaces)."); fits_write_date (fptr); % Write data % define the null value (must do this before writing any data) % fits_update_key (fptr, "BLANK", -99, "value to use for undefined pixels"); variable array = typecast ([1:npixels], UChar_Type); fits_write_img (fptr, array); fits_close_file (fptr); array = typecast (array, UInt32_Type); reshape (array, dims); fptr = fits_open_file (filename, "w"); variable img = fits_read_img (fptr); if (0 == is_identical (img, array)) { warn ("Write then read image failed: %S vs %S", array, img); } fits_close_file (fptr); } private define test_bt (filename) { variable uint16s = UInt16_Type[65]; uint16s[*] = [1:65]; variable uint32s = UInt32_Type[65]; uint32s[*] = [1:65]; variable data = struct {u16, u32}; data.u16 = uint16s; data.u32 = uint16s; fits_write_binary_table (filename, "FOO", data); variable delete = 1; variable table = fits_read_table (filename + "[FOO]"); if (0 == is_identical (table.u16, data.u16)) { warn ("testbt: failed to read/write an unsigned 16 bit column"); delete = 0; } if (0 == is_identical (table.u32, data.u32)) { warn ("testbt: failed to read/write an unsigned 16 bit column"); delete = 0; } if (delete) () = remove (filename); } test_img ("testimg.fit"); test_bt ("testbt.fit"); if (Failed == 0) message ("Passed"); else message ("Failed"); slcfitsio-0.3.8/src/tests/test_wcs.sl0000644002657400265740000000362410602532746016703 0ustar davisdavisprivate variable MODULE_NAME = "cfitsio"; prepend_to_slang_load_path ("."); set_import_module_path (".:" + get_import_module_path ()); require ("fitswcs"); private variable Failed = 0; private define warn () { variable args = __pop_args (_NARGS); () = fprintf (stderr, "**** Warning: %s\n", sprintf (__push_args (args))); Failed++; } private define test_wcs () { variable wcs = fitswcs_new (2); variable xmin = 100.0; variable ymin = 200.0; variable crpix = [ymin+10.0, xmin+20.0]; wcs.cdelt = [1,1]; wcs.crpix = crpix; wcs.crval = [7,8]; wcs.pc=NULL; % Suppose that (x,y) coordinates are binned into an image of size % [M,M] using a grid [xmin, xmin+1, ..., xmin+(M-1)]; variable M = 73; variable dx = 0.1, dy = 0.3; variable xgrid = xmin + dx*[0:M-1]; variable ygrid = ymin + dy*[0:M-1]; variable wcs_M = fitswcs_bin_wcs (wcs, ygrid, xgrid); % Now the reference pixel crpix will have the pixel coordinate i % given by % crpix[1] = xmin + dx*(i-0.5) % or i = (crpix[1]-xmin)/dx + 0.5; variable ix = (crpix[1]-xmin)/dx + 0.5; if (fneqs (ix,wcs_M.crpix[1])) warn ("fitswcs_bin_wcs: CRPIX was improperly computed"); if (fneqs (dx, wcs_M.cdelt[1])) warn ("fitswcs_bin_wcs: CDELT was improperly computed"); % Now rebin the image to NxN % The image currently runs from xmin to M*dx. We want it to go % from xmin to N*(M/N*dx) variable N = 93; dx = (M*dx)/N; dy = (M*dy)/N; xgrid = xmin + dx*[0:N-1]; ygrid = ymin + dy*[0:N-1]; variable wcs_N = fitswcs_rebin_wcs (wcs_M, [M,M], [N,N]); variable iy = (crpix[0]-ymin)/dy + 0.5; if (fneqs (iy,wcs_N.crpix[0])) warn ("fitswcs_rebin_wcs: CRPIX was improperly computed"); if (fneqs (dy, wcs_N.cdelt[0])) warn ("fitswcs_rebin_wcs: CDELT was improperly computed"); } test_wcs (); if (Failed == 0) message ("Passed"); else message ("Failed"); slcfitsio-0.3.8/src/fitswcs.sl0000644002657400265740000007337110602561520015366 0ustar davisdavis% Copyright (C) 2004-2007 Massachusetts Institute of Technology % % Author: John E. Davis % % 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 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. % TODO: % % * Add support for cross-references when dealing with vector columns. % % * Add support for writing binary table WCS info % % Notes: % % Some fits files do not use the WCSAXES keyword to specifiy the dimensionality % of the WCS. Instead a common practice is to add so-called degenerate axes % where one increases the NAXIS keyword to the WCS dimensionality and adds % keywords NAXISj=1 for the new dimensions. To deal with this hack, the % user will be required to reshape the image to its proper dimensionality. % Then the projection routines defined here may be used on any subspace of % the WCS by extracting that subspace via the fitswcs_slice routine. require ("fits"); variable _fitswcs_version = 0*10000 + 2*100 + 0; variable _fitswcs_version_string = "0.2.0-1"; % FITS WCS may be attached to images or pixel-lists. The images may be % found in a standard image HDU, or as a cell of a binary table. % Pixel lists are encoded as columns of a FITS binary table. Hence, there % are three forms of keywords that describe the wcs. private variable CTYPE_INDX = 0; private variable CUNIT_INDX = 1; private variable CRVAL_INDX = 2; private variable CDELT_INDX = 3; private variable CRPIX_INDX = 4; private variable PC_INDX = 5; private variable CD_INDX = 6; private variable PV_INDX = 7; private variable PS_INDX = 8; private variable Image_Formats = ["CTYPE%d", "CUNIT%d", "CRVAL%d", "CDELT%d", "CRPIX%d", "PC%d_%d", "CD%d_%d", "PV%d_%d", "PS%d_%d"]; private variable Image_Formats_Alt = Image_Formats + "%c"; private variable Column_Formats = ["TCTYP%d", "TCUNI%d", "TCRVL%d", "TCDLT%d", "TCRPX%d", "TP%d_%d", "TC%d_%d", "TV%d_%d", "TS%d_%d"]; private variable Column_Formats_Alt = ["TCTY%d%c", "TCUN%d%c", "TCRV%d%c", "TCDE%d%c", "TCRP%d%c", "TP%d_%d%c", "TC%d_%d%c", "TV%d_%d%c", "TS%d_%d%c"]; private variable Vector_Formats = ["%dCTYP%d", "%dCUNI%d", "%dCRVL%d", "%dCDLT%d", "%dCRPX%d", "%dP%d_%d", "%dC%d_%d", "%dV%d_%d", "%dS%d_%d"]; private variable Vector_Formats_Alt = ["%dCTY%d%c", "%dCUN%d%c", "%dCRV%d%c", "%dCDE%d%c", "%dCRP%d%c", "%dP%d_%d%c", "%dC%d_%d%c", "%dV%d_%d%c", "%dS%d_%d%c"]; % This structure defines a transformation of the following form: % % B_i = CDELT_i PC_ij (A_j - CRPIX_j) (no sum on i) % {X} = PROJ_FUNC({CTYPE}, {PV}, {PS}, {B}) % % where {X} signifies the set of values. Using this notation, the first % equation could have been written % % {B}_i = {CDELT}_i {PC}_ij ({A}_j - {CRPIX}_j) (no sum on i) % private variable WCS_Type = struct { naxis, % number of axis to transform ctype, % String_Type[naxis] cunit, % String_Type[naxis] crval, % Double_Type[naxis] crpix, % Double_Type[naxis] cdelt, % Double_Type[naxis] pc, % Double_Type[naxis,naxis] or NULL pv, % array of parameters ps, % array of string parms wcsname, % String_Type radsys, equinox }; % Notes: For usage of the and default values for the radsys and % equinox, see, e.g., % %!%+ %\function{fitswcs_new} %\synopsis{Create a new-ndimensional linear WCS} %\usage{wcs = fitswcs_new (Int_Type naxis)} %\description % This function returns a new WCS structure of the specified dimensionality % that represents an identity (linear) transformation. %\seealso{fitswcs_get_img_wcs, fitswcs_get_column_wcs, fitswcs_get_vector_wcs} %!%- define fitswcs_new (naxis) { variable wcs = @WCS_Type; wcs.naxis = naxis; wcs.ctype = String_Type[naxis]; wcs.ctype[*] = "linear"; wcs.cunit = String_Type[naxis]; wcs.crval = Double_Type[naxis]; wcs.crval[*] = 0.0; wcs.crpix = Double_Type[naxis]; wcs.crpix[*] = 0.0; wcs.cdelt = Double_Type[naxis]; wcs.cdelt[*] = 1.0; wcs.pc = NULL; wcs.pv = NULL; wcs.ps = NULL; return wcs; } %!%+ %\function{fitswcs_slice} %\synopsis{Form a new wcs from one or more axes of another} %\usage{new_wcs = fitswcs_slice (wcs, dims)} %\description % This function may be used to construct a new wcs from another by rearranging % its axes or by using a subset of them. The \exmp{dims} argument specifies % the dimensions to use. %\example % Suppose that \exmp{wcs} represents a 4 dimensional WCS. Then %#v+ % wcs2 = fitswcs_slice (wcs, [0,1]); %#v- % will result in a 2 dimensional WCS from the first 2 axis of the input WCS. % Similarly, %#v+ % wcs2 = fitswcs_slice (wcs, [1,0]); %#v- % will produce a 2d WCS with the first two axes swapped. %\seealso{fitswcs_get_img_wcs, fitswcs_get_column_wcs, fitswcs_get_vector_wcs} %!%- define fitswcs_slice () { if (_NARGS < 2) usage ("wcs1 = %s(wcs, dims-array)", _function_name ()); variable wcs, dims; (wcs, dims) = (); variable new_wcs = @wcs; new_wcs.naxis = length (dims); new_wcs.ctype = wcs.ctype[dims]; new_wcs.cunit = wcs.cunit[dims]; new_wcs.crval = wcs.crval[dims]; new_wcs.crpix = wcs.crpix[dims]; new_wcs.cdelt = wcs.cdelt[dims]; if (wcs.pc != NULL) new_wcs.pc = wcs.pc[dims, dims]; return new_wcs; } %--------------------------------------------------------------------------- % Some simple utility functions %--------------------------------------------------------------------------- private define make_diag_matrix (n, diag) { variable d = Double_Type[n, n]; d [[0:n*n-1:n+1]] = diag; return d; } private define det_2x2 (a) { return a[0,0]*a[1,1] - a[0,1]*a[1,0]; } private define inverse_2x2 (a) { variable det = det_2x2 (a); if (det == 0.0) verror ("FITS wcs matrix has no inverse"); variable a1 = Double_Type[2,2]; a1[0,0] = a[1,1]; a1[0,1] = -a[0,1]; a1[1,0] = -a[1,0]; a1[1,1] = a[0,0]; return a1/det; } private define dup_wcs (wcs) { wcs = @wcs; foreach (get_struct_field_names (wcs)) { variable field = (); variable value = get_struct_field (wcs, field); if (typeof (value) == Array_Type) set_struct_field (wcs, field, @value); } return wcs; } % Convert to/from FORTRAN/C order private define reverse_wcs (wcs) { return fitswcs_slice (wcs, [wcs.naxis-1:0:-1]); } private define read_simple_wcs_keywords () { variable indices = __pop_args (_NARGS-2); variable formats = (); variable fp = (); variable ctype, cunit, crval, crpix, cdelt; (ctype, cunit, crval, crpix, cdelt) = fits_read_key (fp, sprintf (formats[CTYPE_INDX], __push_args(indices)), sprintf (formats[CUNIT_INDX], __push_args(indices)), sprintf (formats[CRVAL_INDX], __push_args(indices)), sprintf (formats[CRPIX_INDX], __push_args(indices)), sprintf (formats[CDELT_INDX], __push_args(indices))); if (ctype == NULL) ctype = "linear"; if (crval == NULL) crval = 0.0; if (crpix == NULL) crpix = 0.0; if (cdelt == NULL) cdelt = 1.0; return (ctype, cunit, crval, crpix, cdelt); } private define read_matrix_wcs_keywords (fp, pc_fmt, is, js, a, diag) { variable pc = NULL; variable n = length (is); foreach (is) { variable i = (); variable i1 = i-1; foreach (js) { variable j = (); variable j1 = j-1; variable pc_ij = sprintf (pc_fmt, i, j, a); pc_ij = fits_read_key (fp, pc_ij); if ((pc_ij == NULL) and (pc == NULL)) continue; if (pc == NULL) pc = make_diag_matrix (n, diag); if (pc_ij != NULL) pc [i1,j1] = pc_ij; } } return pc; } private define get_wcs_naxis (fp) { variable naxis = fits_read_key (fp, "WCSAXES"); if (naxis == NULL) naxis = fits_read_key (fp, "NAXIS"); return naxis; } private define open_interesting_hdu (file, type) { variable fp = fits_open_file (file, "r"); fits_move_to_interesting_hdu (fp, type); return fp; } private define check_for_crota_hack (fp, wcs) { if (wcs.naxis < 2) return NULL; variable rot = fits_read_key (fp, "CROTA2"); if ((rot == NULL) or (rot == 0.0)) { rot = fits_read_key (fp, "CROTA1"); if ((rot == NULL) or (rot == 0.0)) return NULL; } rot *= PI/180.0; % Apparantly, this angle gets applied AFTER cdelts applied. Hence, we have % % B_i = R(rot)_ij CDELT_j (A_j - CRPIX_j) (no sum on i) % % instead of % % B_i = CDELT_i PC_ij (A_j - CRPIX_j) (no sum on i) % % Hence, % % PC_ij = R(rot)_ij CDELT_j/CDELT_i (no sum) variable pc = make_diag_matrix (wcs.naxis); variable cdelt0 = wcs.cdelts[0]; variable cdelt1 = wcs.cdelts[0]; variable c = cos(rot), s = sin(rot); pc[0,0] = c; pc[0,1] = -s*cdelt1/cdelt0; pc[1,0] = s*cdelt0/cdelt1; pc[1,1] = c; return pc; } %!%+ %\function{fitswcs_get_img_wcs} %\synopsis{Read a WCS for a FITS image} %\usage{wcs = fitswcs_get_img_wcs (fp [,alt])} %\description % The \sfun{fitswcs_get_img_wcs} returns a structure representing a WCS from % the specified file descriptor \exmp{fp} corresponding to an image HDU. % An optional parameter may be used to specified an alternate WCS. %\example %#v+ % wcs = fitswcs_get_img_wcs ("img.fits[IMAGE]", 'P'); %#v- %\seealso{fitswcs_put_img_wcs, fitswcs_get_column_wcs, fitswcs_get_vector_wcs} %!%- define fitswcs_get_img_wcs () { variable fp, a = 0; if (_NARGS == 1) fp = (); else if (_NARGS == 2) (fp, a) = (); else usage ("wcs = %s(file [,alt_axis_char])", _function_name); if (typeof (fp) == String_Type) fp = open_interesting_hdu (fp, _FITS_IMAGE_HDU); variable naxis = get_wcs_naxis (fp); variable wcs = fitswcs_new (naxis); variable ctype = wcs.ctype, cunit = wcs.cunit, crval = wcs.crval, crpix = wcs.crpix, cdelt = wcs.cdelt; wcs.wcsname = fits_read_key (fp, sprintf ("WCSNAME%c", a)); variable formats = Image_Formats; if (a) formats = Image_Formats_Alt; _for (0, naxis-1 , 1) { variable i = (); (ctype[i], cunit[i], crval[i], crpix[i], cdelt[i]) = read_simple_wcs_keywords (fp, formats, i+1, a); } variable pc; pc = read_matrix_wcs_keywords (fp, formats[PC_INDX], [1:naxis], [1:naxis], a, 1.0); if (pc == NULL) pc = read_matrix_wcs_keywords (fp, formats[CD_INDX], [1:naxis], [1:naxis], a, 0.0); if ((pc == NULL) and (a == 0)) pc = check_for_crota_hack (fp, wcs); wcs.pc = pc; return reverse_wcs (wcs); } %!%+ %\function{fitswcs_get_column_wcs} %\synopsis{Get the WCS attached to one or more columns of a binary table} %\usage{fitswcs_get_column_wcs (fp, columns-array [,alt]} %\description % This function may be used to obtain the WCS associated with one or more % columns of a binary table. The file descriptor \exmp{fp} must specify % a binary table. The \exmp{columns-array} parameter should be an array % of columns names. The third parameter is optional and is used to specify % an alternate WCS. %\example %#v+ % wcs = fitswcs_get_column_wcs ("evt1.fits[EVENTS]", ["X","Y"]); %#v- %\seealso{fitswcs_put_column_wcs, fitswcs_get_img_wcs, fitswcs_get_vector_wcs} %!%- define fitswcs_get_column_wcs () { variable fp, a = 0, column_names = NULL; if (_NARGS == 3) (fp, column_names, a) = (); else if (_NARGS == 2) (fp, column_names) = (); if ((column_names == NULL) or (typeof(a) == String_Type)) usage ("wcs = %s(file, array_of_column_names [,alt_axis_char]);\n%s", _function_name, sprintf ("Example: wcs = %s(\"evt1.fits\", [\"X\",\"Y\"],'A');\n", _function_name)); if (typeof (fp) == String_Type) fp = open_interesting_hdu (fp, _FITS_BINARY_TBL); variable naxis = length (column_names); variable wcs = fitswcs_new (naxis); variable ctype = wcs.ctype, cunit = wcs.cunit, crval = wcs.crval, crpix = wcs.crpix, cdelt = wcs.cdelt; % The wcsname is not supported. The specification of this is flawed for % "pixel-lists". A wcsname applies to the WCS as a whole-- not just a % column. wcs.wcsname = NULL; variable formats = Column_Formats; if (a) formats = Column_Formats_Alt; variable column_nums = Int_Type[naxis]; _for (0, naxis-1 , 1) { variable i = (); variable col = fits_get_colnum (fp, column_names[i]); column_nums[i] = col; (ctype[i], cunit[i], crval[i], crpix[i], cdelt[i]) = read_simple_wcs_keywords (fp, formats, col, a); } variable pc; pc = read_matrix_wcs_keywords (fp, formats[PC_INDX], column_nums, column_nums, a, 1.0); if (pc == NULL) pc = read_matrix_wcs_keywords (fp, formats[CD_INDX], column_nums, column_nums, a, 0.0); wcs.pc = pc; return wcs; } private define read_key_or_col (fp, key, row) { %vmessage ("Looking for %s in row %d", key, row); variable val = fits_read_key (fp, key); if (val != NULL) return val; % Perhaps it is the name of a column. if (fits_binary_table_column_exists (fp, key)) val = fits_read_cell (fp, key, row); return val; } private define read_vector_matrix_wcs_keywords (fp, pc_fmt, is, js, col, row, a, diag) { variable pc = NULL; variable n = length (is); foreach (is) { variable i = (); variable i1 = i-1; foreach (js) { variable j = (); variable j1 = j-1; variable pc_ij = sprintf (pc_fmt, i, j, col, a); pc_ij = read_key_or_col (fp, pc_ij, row); if ((pc_ij == NULL) and (pc == NULL)) continue; if (pc == NULL) pc = make_diag_matrix (n, diag); if (pc_ij != NULL) pc [i1,j1] = pc_ij; } } return pc; } %!%+ %\function{fitswcs_get_vector_wcs} %\synopsis{Get the WCS of an image in a specified table cell} %\usage{wcs = fitswcs_get_vector_wcs (fp, column_name, row [,alt])} %\description % This function reads the WCS of an image in a specified cell of a binary % table given by \exmp{fp} parameter. The second and third parameters specify % the column name and row number of the cell. An optional fourth parameter % may be used to obtain the corresponding alternate WCS. %\example % This example reads the WCS associated with the image in the second row % of the QEU column of the binary table with HDUNAME equal to AXAF_QEU1 % in the file "HRCQEU.fits": %#v+ % wcs = fitswcs_get_vector_wcs ("HRCQEU.fits[AXAF_QEU1], "QEU", 2); %#v- %\notes % The current implementation does not yet support references to the WCS % of other cells. %\seealso{fitswcs_get_column_wcs, fitswcs_get_img_wcs} %!%- define fitswcs_get_vector_wcs () { variable fp, col, row, a = 0; switch (_NARGS) { case 3: (fp, col, row) = (); } { case 4: (fp, col, row, a) = (); } { usage ("wcs = %s(file, column, row [,alt])", _function_name); } if (typeof (fp) == String_Type) fp = open_interesting_hdu (fp, _FITS_BINARY_TBL); if (typeof (col) == String_Type) col = fits_get_colnum (fp, col); % Get the number of axes for the WCS. This may be given explicitly by % the variable naxis = read_key_or_col (fp, sprintf ("WCAX%d%c", col, a), row); if (naxis == NULL) { % Read the image and get its dimensions variable img = fits_read_cell (fp, col, row); variable dims; (dims,,) = array_info (__tmp(img)); naxis = length (dims); } variable wcs = fitswcs_new (naxis); variable ctype = wcs.ctype, cunit = wcs.cunit, crval = wcs.crval, crpix = wcs.crpix, cdelt = wcs.cdelt; wcs.wcsname = read_key_or_col (fp, sprintf ("WCSN%d%c", col, a), row); variable formats = Vector_Formats; if (a) formats = Vector_Formats_Alt; _for (0, naxis-1 , 1) { variable i = (); variable i1 = i+1; variable val; val = read_key_or_col (fp, sprintf (formats[CTYPE_INDX], i1, col, a), row); if (val != NULL) ctype[i] = val; val = read_key_or_col (fp, sprintf (formats[CUNIT_INDX], i1, col, a), row); if (val != NULL) cunit[i] = val; val = read_key_or_col (fp, sprintf (formats[CRVAL_INDX], i1, col, a), row); if (val != NULL) crval[i] = val; val = read_key_or_col (fp, sprintf (formats[CRPIX_INDX], i1, col, a), row); if (val != NULL) crpix[i] = val; val = read_key_or_col (fp, sprintf (formats[CDELT_INDX], i1, col, a), row); if (val != NULL) cdelt[i] = val; } variable pc; dims = [1:naxis]; pc = read_vector_matrix_wcs_keywords (fp, formats[PC_INDX], dims, dims, col, row, a, 1.0); if (pc == NULL) pc = read_vector_matrix_wcs_keywords (fp, formats[CD_INDX], dims, dims, col, row, a, 0.0); wcs.pc = pc; return reverse_wcs (wcs); } %!%+ %\function{fitswcs_new_img_wcs} %\synopsis{Create a linear WCS for an image} %\usage{wcs = fitswcs_new_img_wcs (grid0,grid1,...)} %\description % This function may be used to construct a linear WCS for an image with the % specified grids. The grids are assumed to be linear. %\example % Use the histogram module's hist2d function to create an image from the X % and Y columns in a file, and the construct a corresponding WCS: %#v+ % (x,y) = fits_read_col ("table.fits", "X", "Y"); % gridx = [min(x):max(x):0.5]; % gridy = [min(y):max(y):0.5]; % img = hist2d (y,x,gridy,gridx); % wcs = fitswcs_new_img_wcs (gridy, gridx); %#v- %\seealso{fitswcs_new, fitswcs_get_img_wcs} %!%- define fitswcs_new_img_wcs () { variable naxis = _NARGS; if (naxis == 0) usage ("wcs = %s(grid_dim0, grid_dim1, ..., grid_dimN)", _function_name()); variable wcs = fitswcs_new (naxis); variable i = naxis; loop (naxis) { i--; variable grid = (); variable x0 = grid[0]; wcs.crpix[i] = 0.5; wcs.crval[i] = x0; wcs.cdelt[i] = grid[1]-x0; } return wcs; } private define write_wcs_keyword (fp, format, index, axis, a, value, i) { if (value == NULL) return; value = value[i]; if (value == NULL) return; variable key = sprintf (format[index], axis, a); fits_update_key (fp, key, value, ""); } %!%+ %\function{fitswcs_put_img_wcs} %\synopsis{Write a WCS out to an image header} %\usage{fitswcs_put_img_wcs (fp, wcs [,alt])} %\description % The \sfun{fitswcs_put_img_wcs} may be used to write the specified wcs % out to the image HDU specified by the \exmp{fp} parameter. An optional % third parameter may be used to specify an alternate WCS. %\example %#v+ % fp = fits_open_file ("img.fits", "w"); % . % . % . % fits_put_img_wcs (fp, wcs, 'P'); % fits_close_file (fp); %#v- %\seealso{fitswcs_put_column_wcs} %!%- define fitswcs_put_img_wcs () { variable fp, a = 0; variable wcs; if (_NARGS == 2) (fp, wcs) = (); else if (_NARGS == 3) (fp, wcs, a) = (); else usage ("%s(fp, wcs-struct [,alt_axis_char])", _function_name); if (typeof (fp) != Fits_File_Type) fp = fits_open_file (fp, "w"); % Write the wcs out in FORTRAN order wcs = reverse_wcs (wcs); variable ctype = wcs.ctype, cunit = wcs.cunit, crval = wcs.crval, crpix = wcs.crpix, cdelt = wcs.cdelt, naxis = wcs.naxis; fits_update_key (fp, sprintf ("WCSAXES%c", a), naxis); if (wcs.wcsname != NULL) fits_update_key (fp, sprintf ("WCSNAME%c", a), wcs.wcsname); variable i, j; variable formats = Image_Formats; if (a) formats = Image_Formats_Alt; variable axes = [1:naxis]; _for (0, naxis-1 , 1) { i = (); j = axes[i]; write_wcs_keyword (fp, formats, CTYPE_INDX, j, a, ctype, i); write_wcs_keyword (fp, formats, CUNIT_INDX, j, a, cunit, i); write_wcs_keyword (fp, formats, CRVAL_INDX, j, a, crval, i); write_wcs_keyword (fp, formats, CRPIX_INDX, j, a, crpix, i); write_wcs_keyword (fp, formats, CDELT_INDX, j, a, cdelt, i); } variable pc = wcs.pc; if (pc != NULL) _for (0, naxis-1, 1) { i = (); _for (0, naxis-1, 1) { j = (); fits_update_key (fp, sprintf (formats[PC_INDX], axes[i], axes[j], a), pc[i, j], NULL); } } % FIXME: Write the rest of the wcs structure } %!%+ %\function{fitswcs_put_column_wcs} %\synopsis{Write the WCS attached to one or more table columns} %\usage{fitswcs_put_column_wcs (fp, wcs, columns-array [,alt])} %\description % This function may be used to attach a WCS to one or more columns of a binary % table. The dimensionality of the specified WCS must match the length of the % array specifying the column names. The first parameter, \exmp{fp} must specify % a binary table extension. The fourth parameter is optional and may be used % to specify an alternate WCS. %\example %#v+ % fitswcs_put_column_wcs ("evt2.fits[EVENTS], wcs, ["X","Y"]); %#v- %\seealso{fitswcs_get_column_wcs, fitswcs_put_img_wcs, fitswcs_get_img_wcs} %!%- define fitswcs_put_column_wcs () { variable fp, wcs, columns, a = 0; switch (_NARGS) { case 3: (fp, wcs, columns) = (); } { case 4: (fp, wcs, columns, a) = (); } { usage ("%s(fp, wcs-struct, columns-array [,alt])", _function_name()); } variable ctype = wcs.ctype, cunit = wcs.cunit, crval = wcs.crval, crpix = wcs.crpix, cdelt = wcs.cdelt, naxis = wcs.naxis; if (length (columns) != naxis) verror ("The dimensionality of the specified WCS does not match the number of columns"); if (typeof (fp) != Fits_File_Type) fp = fits_open_file (fp, "w"); variable i, cols = Int_Type[naxis]; _for (0, naxis-1, 1) { i = (); variable colname = columns[i]; if (0 == fits_binary_table_column_exists (fp, colname)) verror ("Binary table column %s does not exist", colname); cols[i] = fits_get_colnum (fp, colname); } variable formats = Column_Formats; if (a) formats = Column_Formats_Alt; _for (0, naxis-1 , 1) { i = (); variable j = cols[i]; write_wcs_keyword (fp, formats, CTYPE_INDX, j, a, ctype, i); write_wcs_keyword (fp, formats, CUNIT_INDX, j, a, cunit, i); write_wcs_keyword (fp, formats, CRVAL_INDX, j, a, crval, i); write_wcs_keyword (fp, formats, CRPIX_INDX, j, a, crpix, i); write_wcs_keyword (fp, formats, CDELT_INDX, j, a, cdelt, i); } variable pc = wcs.pc; if (pc != NULL) _for (0, naxis-1, 1) { i = (); _for (0, naxis-1, 1) { j = (); fits_update_key (fp, sprintf (formats[PC_INDX], cols[i], cols[j], a), pc[i, j], NULL); } } % FIXME: Write the rest of the wcs structure } % This function will be used later when applying the wcs private define simplify_wcs (wcs) { variable pc = wcs.pc; variable n = wcs.naxis; if (pc != NULL) { % If pc is diagonal, then factor diagonal elements into the cdelts variable d = @pc; variable i = [0:n*n-1:n+1]*1; % *1 to force it from being a range. Huh?? d[i] = 0.0; if (0 == length (where (d != 0))) { wcs.cdelt *= pc[i]; wcs.pc = NULL; } else { _for (0, n-1, 1) { i = (); #iffalse % Unfortunately ds9 is unable to grok files that contain % a PC matrix and unequal CDELT values. So, we will not % use this code. d = max(abs(pc[i,*])); if (d != 0.0) { pc[i,*] /= d; wcs.cdelt[i] *= d; } #else % part 1 of ds9 hack d = abs (wcs.cdelt[i]); if (d != 0.0) { pc[i,*] *= d; wcs.cdelt[i] /= d; } #endif } #iftrue % part 2 of ds9 hack d = max (abs(pc)); wcs.cdelt *= d; pc /= d; #endif if (n == 2) { d = abs(det_2x2 (pc)); if (d != 0.0) { pc /= d; wcs.cdelt *= d; } } wcs.pc = pc; } } return wcs; } %!%+ %\function{fitswcs_linear_transform_wcs} %\synopsis{Apply a linear transformation to a WCS} %\usage{wcs1 = fitswcs_linear_transform_wcs (wcs, U0, A, X0)} %#v+ % wcs: The specified WCS to transform % U0,X0: 1-d arrays % A: 2-d array (or 1-d array representing a diagonal matrix) %#v- %\description % This function may be used to create a new WCS by applying a linear % transformation to an existing one. This is useful when one % has a WCS associated with physical coordinates \exmp{X}, and then % applies the linear transformation %#v+ % U = U0 + A#(X-X0) %#v- % to the coordinates X. Then corresponding WCS for the resulting image is % given by %#v+ % new_wcs = fitswcs_linear_transform_wcs (wcs, U0, A, X0); %#v- %\notes % The dimensionality of the WCS is limited to 2 in the % current implementation. %\seealso{fitswcs_rebin_wcs, fitswcs_bin_wcs} %!%- % The algorithm: % % The existing WCS maps X to the world coordinate W via % W = CRVAL + CD#(X-CRPIX) % Now, a linear transformation is applied to X: % U = U0 + A#(X-X0) % Then % X = X0 + invA#(U-U0) % So: % W = CRVAL + CD#(X0 + invA#(U-U0) - CRPIX) % = CRVAL + CD#invA#(U-CRPIX') % = CRVAL + CD'#(U-CRPIX') % where % CRPIX' = U0+A#(CRPIX-X0) % CD' = CD#invA % % Note: CD_ij = CDELT_i PC_ij (no sum on i) % or CD = CDELT#PC % ==> CD' = CDELT#PC#invA = CDELT#PC' % In other words, CDELT is unaffected by this transformation. define fitswcs_linear_transform_wcs () { if (_NARGS != 4) usage ("new_wcs = %s(old_wcs, U0, A, X0);\n%s\n%s", _function_name, "where U = U0 + A#(X-X0) is the relationship between the new coordinates U", "and the old coordintes X"); variable wcs, u0, a, x0; (wcs, u0, a, x0) = (); variable wcs_naxis = wcs.naxis; if (wcs_naxis != 2) verror ("%s: Currently this routine supports only 2d wcs systems", _function_name); variable dims, num_dims; (dims, num_dims, ) = array_info (a); variable naxis; if (num_dims == 1) { naxis = dims[0]; variable tmp = Double_Type[naxis, naxis]; tmp[[0:naxis*naxis-1:naxis+1]] = a; a = tmp; } else if (num_dims == 2) { naxis = dims[0]; if (naxis != dims[1]) verror ("%s: The A matrix must be square", _function_name); } else verror ("%s: The A matrix must be square", _function_name); if (wcs_naxis != naxis) verror ("%s: The wcs requires A to be [%d,%d]", _function_name, wcs_naxis, wcs_naxis); wcs = dup_wcs (wcs); % Compute this: CRPIX' = U0 + A#(CRPIX-X0) wcs.crpix = u0 + a#(wcs.crpix-x0); variable inv_a = inverse_2x2(a); variable pc = wcs.pc; if (pc != NULL) { pc = pc#inv_a; } else pc = inv_a; wcs.pc = pc; return simplify_wcs (wcs); } %!%+ %\function{fitswcs_rebin_wcs} %\synopsis{This function may be used to obtain the wcs for a rebinned image} %\usage{wcs1 = fitswcs_rebin_wcs (wcs, old_dims, new_dims...)} %\description % This function may be used to construct the WCS for a rebinned image from % the WCS of of the unbinned image. The grid parameters specify the linear % grids the new image. %\example % new_img = hist2d_rebin (new_yrid, new_xgrid, % old_ygrid, old_xgrid, old_img); % new_wcs = fitswcs_rebin_wcs (old_wcs, % array_shape(old_img), % array_shape(new_img)); %\seealso{fitswcs_bin_wcs, fitswcs_linear_transform_wcs, fitswcs_slice} %!%- define fitswcs_rebin_wcs () { if (_NARGS < 2) usage ("wcs = %s (wcs, grid_dim0, grid_dim1,...)", _function_name()); variable naxis = _NARGS-1; variable X0 = Double_Type[naxis]; variable dX = Double_Type[naxis]; variable I0 = 0.5 + Double_Type[naxis]; variable i = naxis; loop (naxis) { i--; variable grid = (); X0[i] = grid[0]; dX[i] = grid[1]-grid[0]; } variable wcs = (); return fitswcs_linear_transform_wcs (wcs, X0, dX, I0); } %!%+ %\function{fitswcs_bin_wcs} %\synopsis{This function may be used to obtain the wcs for a rebinned image} %\usage{wcs1 = fitswcs_rebin_wcs (wcs, grid0, grid1, ...)} %\description % % This function may be used to construct the WCS for an image created % by binning a set of coordinates from, e.g., a pixel-list. The % \exmp{wcs} parameter represents the wcs attached to the unbinnned % coordinates. The grid parameters specify the linear grids that were % used to create the image. % %\seealso{fitswcs_rebin_wcs, fitswcs_linear_transform_wcs, fitswcs_slice} %!%- % % Denote the grid used for binning by % X = [X0,X0+dX,...,X0+(N)dX] = X0+[0,1,..,N]*dX % The associated image system will be % I = [0.5,1.5,,...0.5+(N)] = 0.5+[0,1,..N] % This defines a linear transformation from X to I: % % I = 0.5+(1/dX)*(X-X0) define fitswcs_bin_wcs () { if (_NARGS < 2) usage ("wcs = %s (wcs, grid_dim0, grid_dim1,...)", _function_name()); variable naxis = _NARGS-1; variable X0 = Double_Type[naxis]; variable dX = Double_Type[naxis]; variable I0 = 0.5 + Double_Type[naxis]; variable i = naxis; loop (naxis) { i--; variable grid = (); X0[i] = grid[0]; dX[i] = grid[1]-grid[0]; } variable wcs = (); return fitswcs_linear_transform_wcs (wcs, I0, 1.0/dX, X0); } % Suppose an image I[M0,M1,...] is rebinnned to J[N0,N1,...] % This is a mapping I to J: % 0.5 <= I <= M+0.5 % 0.5 <= J <= N+0.5 % or % (J-0.5)/(I-0.5) = N/M % J = 0.5 + N/M(I-0.5) % define fitswcs_rebin_wcs () { if (_NARGS != 3) usage ("wcs = %s (wcs, old_dims, new_dims)", _function_name()); variable wcs, old_dims, new_dims; (wcs, old_dims, new_dims) = (); variable n = length (old_dims); if (n != length(new_dims)) verror ("The old_dims and new_dims must have an equal number of dimensions"); variable u0 = 0.5 + Double_Type[n]; variable x0 = @u0; variable a = double (new_dims)/old_dims; return fitswcs_linear_transform_wcs (wcs, u0, a, x0); } define fitswcs_translate_wcs () { if (_NARGS < 2) usage ("wcs = %s (wcs, dX_array)", _function_name()); verror ("Not Implemented"); } provide("fitswcs"); slcfitsio-0.3.8/src/Makefile.in0000644002657400265740000001032710330234177015404 0ustar davisdavis# -*- sh -*- #--------------------------------------------------------------------------- # List of modules and associated .sl files to install #--------------------------------------------------------------------------- MODULES = cfitsio-module.so SL_FILES = cfitsio.sl fits.sl fitswcs.sl HLP_FILES = ../doc/help/cfitsio.hlp MODULE_VERSION = `./mkversion.sh` #--------------------------------------------------------------------------- # Installation Directories #--------------------------------------------------------------------------- prefix = @prefix@ exec_prefix = @exec_prefix@ MODULE_INSTALL_DIR = @MODULE_INSTALL_DIR@ SL_FILES_INSTALL_DIR = @SL_FILES_INSTALL_DIR@ HLP_FILES_INSTALL_DIR = $(SL_FILES_INSTALL_DIR)/help #--------------------------------------------------------------------------- # C Compiler to create a shared library #--------------------------------------------------------------------------- CC_SHARED = @CC_SHARED@ #--------------------------------------------------------------------------- # Location of the S-Lang library and its include file #--------------------------------------------------------------------------- SLANG_INC = @SLANG_INC@ SLANG_LIB = @SLANG_LIB@ -lslang #--------------------------------------------------------------------------- # Additional Libraries required by the module #--------------------------------------------------------------------------- CFITSIO_INC = @CFITSIO_INC@ CFITSIO_LIB = @CFITSIO_LIB@ -lcfitsio OTHER_LIBS = @X_EXTRA_LIBS@ MODULE_LIBS = $(CFITSIO_LIB) $(OTHER_LIBS) RPATH = @RPATH@ #--------------------------------------------------------------------------- # Misc Programs required for installation #--------------------------------------------------------------------------- INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ MKINSDIR = ../autoconf/mkinsdir.sh RM = rm -f LN = ln -s #--------------------------------------------------------------------------- # DESTDIR is designed to facilitate making packages. Normally it is empty #--------------------------------------------------------------------------- DESTDIR = DEST_MODULE_INSTALL_DIR = $(DESTDIR)$(MODULE_INSTALL_DIR) DEST_SL_FILES_INSTALL_DIR = $(DESTDIR)$(SL_FILES_INSTALL_DIR) DEST_HLP_FILES_INSTALL_DIR = $(DESTDIR)$(HLP_FILES_INSTALL_DIR) #--------------------------------------------------------------------------- LIBS = $(SLANG_LIB) $(MODULE_LIBS) $(RPATH) $(DL_LIB) -lm INCS = $(SLANG_INC) $(CFITSIO_INC) all: $(MODULES) #--------------------------------------------------------------------------- # Put Rules to create the modules here #--------------------------------------------------------------------------- cfitsio-module.so: cfitsio-module.c $(CC_SHARED) $(INCS) cfitsio-module.c -o cfitsio-module.so $(LIBS) #--------------------------------------------------------------------------- # Regression tests #--------------------------------------------------------------------------- test: @for X in tests/test_*.sl; \ do \ slsh $$X; \ done #--------------------------------------------------------------------------- # Installation Rules #--------------------------------------------------------------------------- install_directories: $(MKINSDIR) $(DEST_MODULE_INSTALL_DIR) $(MKINSDIR) $(DEST_SL_FILES_INSTALL_DIR) $(MKINSDIR) $(DEST_HLP_FILES_INSTALL_DIR) install_modules: @for X in $(MODULES); \ do \ Y=$$X.$(MODULE_VERSION); \ YDEST=$(DEST_MODULE_INSTALL_DIR)/$$Y; \ echo $(INSTALL_DATA) $$X $$YDEST; \ $(INSTALL_DATA) $$X $$YDEST; \ if [ "$$?" != "0" ]; then \ exit 1; \ fi; \ $(RM) $(DEST_MODULE_INSTALL_DIR)/$$X; \ $(LN) $$Y $(DEST_MODULE_INSTALL_DIR)/$$X; \ done install_slfiles: @for X in $(SL_FILES); \ do \ echo $(INSTALL_DATA) $$X $(DEST_SL_FILES_INSTALL_DIR); \ $(INSTALL_DATA) $$X $(DEST_SL_FILES_INSTALL_DIR); \ if [ "$$?" != "0" ]; then \ exit 1; \ fi; \ done install_hlpfiles: @for X in $(HLP_FILES); \ do \ echo $(INSTALL_DATA) $$X $(DEST_HLP_FILES_INSTALL_DIR); \ $(INSTALL_DATA) $$X $(DEST_HLP_FILES_INSTALL_DIR); \ if [ "$$?" != "0" ]; then \ exit 1; \ fi; \ done install: all install_directories install_modules install_slfiles install_hlpfiles clean: -/bin/rm -f $(MODULES) *~ \#* distclean: clean -/bin/rm -f config.h Makefile $(MODULES) *.fit slcfitsio-0.3.8/src/fits.sl0000644002657400265740000014611510611753762014661 0ustar davisdavis% Copyright (C) 1998-2007 Massachusetts Institute of Technology % % Author: John E. Davis % % 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 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %if (current_namespace () != "") % import ("cfitsio", current_namespace ()); %else import ("cfitsio"); variable _fits_sl_version = 403; variable _fits_sl_version_string = "0.4.3-0"; private variable Verbose = 1; % Forward declarations #ifexists new_exception if (0 == is_defined ("FitsError")) new_exception ("FitsError", RunTimeError, "Fits Error"); #endif private variable Last_Error_Messages = String_Type[0]; private define reverse (a) { #ifexists array_reverse a = @a; array_reverse (a); return a; #else variable i = length (a); if (i <= 1) return a; i--; __tmp(a)[[i:0:-1]]; #endif } %!%+ %\function{fits_read_errmsgs} %\synopsis{Retrieve all error messages from the CFITSIO error stack} %\usage{String_Type[] fits_read_errmsgs ()} %\description % This function returns all the error messages from the CFITSIO error % message stack as an array of strings. %\notes % Using this function will cause the error message stack to be cleared. %\seealso{_fits_read_errmsg, fits_set_verbose_errors} %!%- define fits_read_errmsgs () { variable err; variable errlist = String_Type[0]; while (err = _fits_read_errmsg (), err != NULL) { errlist = [errlist, err]; } return errlist; } define fits_get_errmsgs () { return Last_Error_Messages; } %!%+ %\function{fits_set_verbose_errors} %\synopsis{Set the verbosity level of the cfitsio error messages} %\usage{fits_set_verbose_errors (Int_Type level)} %\description % When a call to a function in the high-level interface fails, a error % message will get generated. By default, all messages from the % underlying cfitsio error stack are printed. This behavior may be % turned off by calling this function with \exmp{level} equal to 0. %\seealso{fits_read_errmsgs} %!%- define fits_set_verbose_errors () { variable v = 1; if (_NARGS) v = (); Verbose = v; } private define do_fits_error () { variable status, file = ""; if (_NARGS == 2) file = (); status = (); if (status == 0) { _fits_clear_errmsg (); Last_Error_Messages = String_Type[0]; return; } if (strlen(file)) file = strcat (": ", file); variable errmsg = strcat (_fits_get_errstatus (status), file); Last_Error_Messages = fits_read_errmsgs (); if (Verbose) errmsg = strjoin ([Last_Error_Messages, errmsg], "\n"); #ifexists new_exception throw FitsError, errmsg, Last_Error_Messages; #else error (errmsg); #endif } %!%+ %\function{fits_open_file} %\synopsis{Open a fits file} %\usage{Fits_File_Type fits_open_file (String_Type filename, String_Type mode)} %\description % The \var{fits_open_file} function can be used to open and existing fits % file for reading or updating, or to create a new fits file, depending upon % the value of the \var{mode} parameter. Specifically, if \var{mode} is % \exmp{"r"}, the file will be opened for reading. If \var{mode} is \exmp{"w"}, % the file will be opened for updating (both reading and writing). Otherwise, % \var{mode} must be \var{"c"}, which indicates that a new file is to be created. % In the latter case, if a file already exists with the specified name, it will % get deleted and a new one created in its place. % % If the function fails, it will signal an error; otherwise an open file % pointer will be returned. %\seealso{fits_close_file, fits_create_binary_table} %!%- define fits_open_file () { variable file, mode; if (_NARGS != 2) usage ("fp = fits_open_file (file, \"r|w|c\")"); (file, mode) = (); variable fp; variable status = _fits_open_file (&fp, file, mode); if (status) do_fits_error (status, file); return fp; } %!%+ %\function{fits_close_file} %\synopsis{Close a fits file} %\usage{fits_close_file (Fits_File_Type f)} %\description % The \var{fits_close_file} closes a previously opened fits file. The function % will signal an error if the operation fails. %\notes % This function could fail if it fails to write out any buffered data because % of filesystem errors (disk full, etc.). %\seealso{fits_open_file} %!%- define fits_close_file (fp) { do_fits_error (_fits_close_file (fp)); } private define do_close_file (fp, needs_close) { if (needs_close) fits_close_file (fp); } private define get_open_fp (fp, needs_close) { @needs_close = 0; if (typeof (fp) != Fits_File_Type) { variable file = fp; do_fits_error (_fits_open_file (&fp, fp, "r"), file); @needs_close = 1; } return fp; } private define find_interesting_hdu (f, hdu_type, check_naxis) { variable type; do { variable status; do_fits_error (_fits_get_hdu_type (f, &type)); if (type == _FITS_ASCII_TBL) type = _FITS_BINARY_TBL; if ((hdu_type == NULL) or (type == hdu_type)) { if (check_naxis == 0) return 0; variable naxis; do_fits_error (_fits_read_key (f, "NAXIS", &naxis, NULL)); if (naxis != 0) return 0; } status = _fits_movrel_hdu (f, 1); } while (not status); return -1; } private define get_open_hdu_of_type (f, hdu_type, needs_close, check_naxis) { variable type; variable type_str; switch (hdu_type) { case _FITS_BINARY_TBL: type_str = "a binary table"; } { case _FITS_IMAGE_HDU: type_str = "an image"; } { case _FITS_ASCII_TBL: type_str = "an ascii table"; } { % default type_str = "an interesting hdu"; } @needs_close = 0; if (typeof (f) == Fits_File_Type) { do_fits_error (_fits_get_hdu_type (f, &type)); if ((hdu_type == _FITS_BINARY_TBL) and (type == _FITS_ASCII_TBL)) hdu_type = type; if ((hdu_type != NULL) and (type != hdu_type)) { verror ("Extension is not %s", type_str); } return f; } f = get_open_fp (f, needs_close); if (0 == find_interesting_hdu (f, hdu_type, check_naxis)) return f; verror ("Unable to locate %s", type_str); } %!%+ %\function{fits_move_to_interesting_hdu} %\synopsis{Move to an extension that looks interesting} %\usage{fits_move_to_interesting_hdu (fp [, hdu_type]} %#v+ % Fits_File_Type fp; % Int_Type hdu_type; %#v- %\description % The function move the fits file pointer \var{fp} forward to an HDU that looks % interesting. By definition, an interesting HDU is one in which NAXIS is % non-zero. The first parameter \var{fp} must be a pointer to an already open % fits file. The second parameter, if present, may be used to specifiy the % type of HDU, e.g., either an image (\exmp{hdu_type=_FITS_IMAGE_HDU}) or a % binary table (\exmp{hdu_type=_FITS_BINARY_TBL}). % % If the function fails to find an interesting HDU of the appropriate type, % an exception will be generated. %\seealso{fits_open_file} %!%- define fits_move_to_interesting_hdu () { variable f, hdu_type = NULL; switch (_NARGS) { case 1: f = (); } { case 2: (f, hdu_type) = (); } { usage ("%s (f, hdu_type); % hdu_type = _FITS_IMAGE_HDU|_FITS_BINARY_TBL", _function_name ()); } if (-1 == find_interesting_hdu (f, hdu_type, 1)) verror ("%s: Unable to find an interesting HDU", _function_name); } private define get_open_binary_table (f, needs_close) { return get_open_hdu_of_type (f, _FITS_BINARY_TBL, needs_close, 1); } private define get_open_image_hdu (f, needs_close) { return get_open_hdu_of_type (f, _FITS_IMAGE_HDU, needs_close, 1); } private define get_open_interesting_hdu (fp, needs_close) { if (needs_close == NULL) { variable nc; needs_close = &nc; } @needs_close = 0; if (typeof (fp) == Fits_File_Type) return fp; return get_open_hdu_of_type (fp, NULL, needs_close, 1); %return get_open_binary_table (fp, needs_close); } %!%+ %\function{fits_key_exists} %\synopsis{Check for the existence of a keyword} %\usage{Int_Type fits_key_exists (fd, key)} %#v+ % Fits_File_Type or String_Type fd; % String_Type key; %#v- %\description % The \var{fits_key_exists} function checks for the existence of a specified % keyword in the file specified by the descriptor \var{fd}, which must specify % the name of a file or an open file pointer. % % If the specified key exists, the function return \1, otherwise it returns \0. %\seealso{fits_read_key, fits_read_header} %!%- define fits_key_exists () { if (_NARGS != 2) usage ("status = fits_key_exists (file, key)"); variable fp, key; variable needs_close; (fp, key) = (); fp = get_open_interesting_hdu (fp, &needs_close); variable value; variable status = _fits_read_key (fp, key, &value, NULL); if (needs_close) fits_close_file (fp); if (status == 0) return 1; if (status == _FITS_KEY_NO_EXIST) return 0; do_fits_error (status); } private define get_fits_btable_info (fp) { variable numrows, numcols, names, name, col; do_fits_error (_fits_get_num_rows (fp, &numrows)); do_fits_error (_fits_get_num_cols (fp, &numcols)); names = String_Type [numcols]; _for (1, numcols, 1) { col = (); do_fits_error (_fits_read_key_string (fp, "TTYPE"+string(col), &name, NULL)); names [col-1] = name; } return (numrows, names); } %!%+ %\function{fits_get_colnum} %\synopsis{Get the column numbers of specified columns} %\usage{column_num = fits_get_colnum (fd, column_name)} %#v+ % Fits_File_Type or String_Type fd; % String_Type column_name; %#v- %\description % This function returns the column number of the column with the specified name. % The file-descriptor \exmp{fd} must specify the name of a file, or an open % fits file pointer. %\seealso{fits_binary_table_column_exists} %!%- define fits_get_colnum () { if (_NARGS != 2) usage ("colnum = %s (file, column_name)", _function_name ()); variable f, column_names; (f, column_names) = (); variable needs_close; f = get_open_binary_table (f, &needs_close); variable colnum; do_fits_error (_fits_get_colnum (f, column_names, &colnum), column_names); do_close_file (f, needs_close); return colnum; } %!%+ %\function{fits_binary_table_column_exists} %\synopsis{Check for the existence of a binary table column} %\usage{Int_Type fits_binary_table_column_exists (fd, col)} %#v+ % Fits_File_Type or String_Type fd; % String_Type col; %#v- %\description % This function may be used to determine whether or not a named column % exists in a binary table. The table is specified via the \var{fd} % parameter which must either be the name of a file containing the binary % table, or an file pointer. % % If the specified column exists, \1 will be returned; otherwise the function % will return \0. %\seealso{fits_key_exists, fits_open_file} %!%- define fits_binary_table_column_exists () { if (_NARGS != 2) usage ("status = %s (file, column_name)", _function_name ()); variable f, col; (f, col) = (); variable needs_close; f = get_open_binary_table (f, &needs_close); variable names; (,names) = get_fits_btable_info (f); do_close_file (f, needs_close); col = strup (col); names = array_map (String_Type, &strup, names); return length (where (col == names)); } private define get_tdim_string (fp, col) { variable tdim = sprintf ("TDIM%d", col); !if (fits_key_exists (fp, tdim)) return NULL; do_fits_error (_fits_read_key (fp, tdim, &tdim, NULL), tdim); return tdim; } private define make_tdim_string (dims) { variable i; variable tdim = "("; dims = reverse (array_map (String_Type, &string, dims)); return sprintf ("(%s)", strjoin (dims, ",")); } private define convert_tdim_string (tdim, num_rows) { tdim = strtrim (tdim, "()"); tdim = reverse (strtok (tdim, " \t,")); tdim = array_map (Int_Type, &integer, tdim); if (num_rows == -1) return tdim; variable new_tdim = Int_Type[length(tdim)+1]; new_tdim[0] = num_rows; new_tdim[[1:]] = tdim; return new_tdim; } private define check_vector_tdim (fp, first_row, col, data) { variable tdim_col = sprintf ("TDIM%d", col); !if (fits_binary_table_column_exists (fp, tdim_col)) return; do_fits_error (_fits_get_colnum (fp, tdim_col, &tdim_col)); if (tdim_col == col) return; variable len = length (data); variable tdim; do_fits_error (_fits_read_col (fp, tdim_col, first_row, len, &tdim)); if (_typeof (tdim) != String_Type) return; _for (0, len-1, 1) { variable i = (); reshape (data[i], convert_tdim_string (tdim[i], -1)); } } % FITS column and keyword names can begin with a number or have dashes. % Bad Design. private define normalize_names (names) { names = @names; _for (0, length (names)-1, 1) { variable i = (); variable name = strlow (names[i]); #iffalse (name,) = strreplace (name, "-", "_", strlen (name)); #else name = strtrans (name, "^a-z0-9", "_"); #endif names[i] = name; variable ch = name[0]; if ((ch == '_') or ((ch >= 'a') and (ch <= 'z'))) continue; names[i] = "_" + name; } return names; } private define get_column_number (fp, col) { if (typeof (col) == String_Type) { variable col_str = col; do_fits_error (_fits_get_colnum (fp, col_str, &col), col_str); return col; } return int (col); } private define get_column_numbers (fp, args) { variable column_nums = Int_Type[0]; foreach (args) { variable arg = (); variable col = arg.value; if (typeof (col) == Array_Type) col = array_map (Int_Type, &get_column_number, fp, col); else col = get_column_number (fp, col); column_nums = [column_nums, col]; } return column_nums; } % This function assumes that fp is an open pointer, and that columns is % an array of column numbers. The data are left on the stack. private define read_cols (fp, columns, first_row, last_row) { variable numrows; do_fits_error (_fits_get_num_rows (fp, &numrows)); if (first_row < 0) first_row += (1+numrows); if (last_row < 0) last_row += (1+numrows); if ((first_row <= 0) or (last_row <= 0) or (first_row > numrows) or (last_row > numrows)) verror ("Invalid first or last row parameters"); variable numcols = length (columns); variable data_arrays; numrows = last_row - first_row + 1; do_fits_error (_fits_read_cols (fp, columns, first_row, numrows, &data_arrays)); _for (0, numcols-1, 1) { variable i = (); variable col = columns[i]; variable data = data_arrays[i]; variable tdim = get_tdim_string (fp, col); if (tdim != NULL) { tdim = convert_tdim_string (tdim, numrows); reshape (data, tdim); } else if (typeof (data) == Array_Type) check_vector_tdim (fp, first_row, col, data); data; % leave it on stack } } %!%+ %\function{fits_read_col} %\synopsis{Read one or more columns from a FITS binary table} %\usage{(x1, ...xN) = fits_read_col (file, c1, ... cN)} %#v+ % Fits_File_Type or String_Type file; % Int_Type or String_Type c1, ...cN; %#v- %\description % This function returns one or more vectors containing objects in the % specified columns of the binary table indicated by \var{file}. If % \var{file} is a string, then the file will be opened via the virtual % file specification implied by \var{file}. Otherwise, \var{file} % should represent an already opened FITS file. The column parameters % may either be strings denoting the column names, or integers % representing the column numbers. %\seealso{fits_read_cell, fits_read_row, fits_read_table} %!%- define fits_read_col () { if (_NARGS < 2) usage ("(x1...xN) = fits_read_col (file, c1, ...cN)"); variable fp, col; variable numrows; variable columns = __pop_args (_NARGS-1); fp = (); variable needs_close; fp = get_open_binary_table (fp, &needs_close); columns = get_column_numbers (fp, columns); read_cols (fp, columns, 1, -1); % data on stack do_close_file (fp, needs_close); } %!%+ %\function{fits_read_col_struct} %\synopsis{Read one or more columns from a FITS binary table} %\usage{struct = fits_read_col_struct (file, col1, ...)} %#v+ % Fits_File_Type or String_Type file; % String_Type col1, ...; %#v- %\description % This function works exactly like \var{fits_read_col} except it returns the % values in a structure. See the documentation on that function for more % information. % %\seealso{fits_read_col, fits_read_key_struct, fits_read_row, fits_read_header} %!%- define fits_read_col_struct () { !if (_NARGS) usage ("struct = fits_read_col_struct(file, COL1, ...)"); variable cols = __pop_args (_NARGS - 1); variable file = (); variable fields = normalize_names ([__push_args(cols)]); variable s = @Struct_Type (fields); set_struct_fields (s, fits_read_col (file, __push_args (cols))); return s; } %!%+ %\function{fits_read_cell} %\synopsis{Read a cell from a FITS binary table} %\usage{X = fits_read_cell (file, c, r)} %#v+ % Fits_File_Type or String_Type file; % Int_Type r, c; %#v- %\description % This function returns the object in the column \var{c} and row % \var{r} of the binary table indicated by \var{file}. If \var{file} % is a string, then the file will be opened via the virtual file % specification implied by \var{file}. Otherwise, \var{file} should % represent an already opened FITS file. %\seealso{fits_read_col, fits_read_row} %!%- define fits_read_cell () { variable fp, r, c; variable needs_close; if (_NARGS != 3) usage ("x = fits_read_cell (file, c, r)"); (fp, c, r) = (); fp = get_open_binary_table (fp, &needs_close); variable a = read_cols (fp, get_column_number (fp, c), r, r); variable dims, nd; (dims,nd,) = array_info (a); if (nd == 1) a = a[0]; else reshape (a, dims[[1:]]); do_close_file (fp, needs_close); return a; } define fits_read_cells () { variable fp, r0, r1, columns; variable needs_close; if (_NARGS < 4) usage ("(x1,...xN) = %s (file, col1, ..., colN, r0, r1)", _function_name); (r0, r1) = (); columns = __pop_args (_NARGS-3); fp = (); fp = get_open_binary_table (fp, &needs_close); columns = get_column_numbers (fp, columns); read_cols (fp, columns, r0, r1); % on stack do_close_file (fp, needs_close); } %!%+ %\function{fits_read_row} %\synopsis{Read a row from a FITS binary table} %\usage{Struct_Type fits_read_cell (file, r)} %#v+ % Fits_File_Type or String_Type file; % Int_Type r; %#v- %\description % This function returns a structure containing the data in the columns % of the row \var{r} of the binary table indicated by \var{file}. If % \var{file} is a string, then the file will be opened via the virtual % file specification implied by \var{file}. Otherwise, \var{file} % should represent an already opened FITS file. %\seealso{fits_read_col, fits_read_cell} %!%- define fits_read_row () { verror ("Not yet implemented"); } %!%+ %\function{fits_read_header} %\synopsis{Read a FITS header} %\usage{Struct_Type fits_read_header (file)} %#v+ % Fits_File_Type or String_Type file; %#v- %\description % This function reads the header of the fits file given by the % \var{file} parameter and returns it as a structure. If \var{file} is % a string, then the file will be opened via the virtual file % specification implied by \var{file}. Otherwise, \var{file} should % represent an already opened FITS file. %\seealso{fits_read_table} %!%- define fits_read_header () { !if (_NARGS) usage ("Struct_Type fits_read_header (file)"); verror ("Not implemented"); variable fp = (); variable needs_close; fp = get_open_fp (fp, &needs_close); do_close_file (fp, needs_close); } %!%+ %\function{fits_read_table} %\synopsis{Read a FITS table} %\usage{Struct_Type fits_read_table (file [,columns...])} %#v+ % Fits_File_Type or String_Type file; %#v- %\description % \var{fits_read_table} reads the data in a table of the FITS file % specified by \var{file} and returns it as a structure. If the optional % column name parameters are specified, then only those columns will be read. % Otherwise, the entire table will be returned. % % If \var{file} is a string, then the file will be opened via the virtual file % specification implied by \var{file}. Otherwise, \var{file} should % represent an already opened FITS file. %\seealso{fits_read_col, fits_read_cell, fits_read_row, fits_read_header} %!%- define fits_read_table () { if (_NARGS == 0) usage ("S = fits_read_table (FILE [,columns,...])"); variable f, names = NULL; if (_NARGS > 1) { names = __pop_args (_NARGS-1); names = [__push_args(names)]; } f = (); variable needs_close; f = get_open_binary_table (f, &needs_close); if (names == NULL) (, names) = get_fits_btable_info (f); variable s = fits_read_col_struct (f, names); do_close_file (f, needs_close); return s; } define fits_info () { !if (_NARGS) %usage ("(numrows, numcols, colnames[]) = fits_info (file);"); usage ("fits_info (file);"); variable file = (); variable fp; variable numrows, numcols, names; variable needs_close; %do_fits_error (_fits_open_file (&fp, file, "r")); fp = get_open_interesting_hdu (file, &needs_close); (numrows, names) = get_fits_btable_info (fp); numcols = length (names); () = fprintf (stdout, "%s contains %d rows and %d columns:\n", file, numrows, numcols); _for (1, numcols, 1) { variable i = (); variable tform, name; name = names[i-1]; do_fits_error (_fits_read_key_string (fp, "TFORM" + string(i), &tform, NULL)); variable tdim = get_tdim_string (fp, i); if (tdim == NULL) tdim = ""; else tdim = "TDIM=" + tdim; () = fprintf (stdout, "[%2d] %s %s %s\n", i, name, tform, tdim); } do_close_file (fp, needs_close); %return (numrows, numcols, names); } %!%+ %\function{fits_read_key} %\synopsis{Read one or more keywords from a FITS file} %\usage{(val1,...) = fits_read_key (file, key1, ...)} %#v+ % Fits_File_Type or String_Type file; % String_Type key1, ...; %#v- %\description % \var{fits_read_key} reads the values of one or more keywords in the fits % file specified by \var{file} and returns them. If \var{file} % is a string, then the file will be opened via the virtual file % specification implied by \var{file}. Otherwise, \var{file} should % represent an already opened FITS file. If any of the keywords do not exist, % a value of \NULL will be returned for the corresponding keyword. %\seealso{fits_read_key_struct, fits_read_col, fits_read_cell, fits_read_row, fits_read_header} %!%- define fits_read_key () { !if (_NARGS) usage ("(x,...) = fits_read_key (file, X_KEY, ...)"); variable fp, keys; keys = __pop_args (_NARGS - 1); fp = (); variable needs_close; fp = get_open_interesting_hdu (fp, &needs_close); foreach (keys) { variable key = ().value; variable value, status; status = _fits_read_key (fp, key, &value, NULL); if (status == _FITS_KEY_NO_EXIST) value = NULL; else if (status) do_fits_error (status, key); value; } do_close_file (fp, needs_close); } %!%+ %\function{fits_read_key_struct} %\synopsis{Read one or more keywords from a FITS file} %\usage{struct = fits_read_key (file, key1, ...)} %#v+ % Fits_File_Type or String_Type file; % String_Type key1, ...; %#v- %\description % This function works exactly like \var{fits_read_key} excepts returns the % values in a structure. See the documentation on that function for more % information. %\seealso{fits_read_key, fits_read_col, fits_read_cell, fits_read_row, fits_read_header} %!%- define fits_read_key_struct () { !if (_NARGS) usage ("struct = fits_read_key_struct(file, X_KEY, ...)"); variable keys = __pop_args (_NARGS - 1); variable file = (); variable fields = normalize_names ([__push_args(keys)]); variable s = @Struct_Type (fields); set_struct_fields (s, fits_read_key (file, __push_args (keys))); return s; } private define get_open_write_fp (fp, mode, needs_close) { @needs_close = 0; if (typeof (fp) != Fits_File_Type) { @needs_close = 1; do_fits_error (_fits_open_file (&fp, fp, mode)); } return fp; } %!%+ %\function{fits_create_binary_table} %\synopsis{Prepare a binary table} %\usage{fits_create_binary_table (file, extname, nrows, ttype, tform, tunit)} %#v+ % Fits_File_Type or String_Type file; % String_Type extname; % Int_Type nrows; % String_Type ttype[]; % String_Type tform[]; % String_Type tunit[]; %#v- %\description % This creates a new binary table with the specified structure. The parameters % \var{ttype}, \var{tform}, and \var{tunit} are string arrays that specify % the column names, column data type, and column units, respectively. % The binary table will be given the extension name \var{extname}. %\seealso{fits_write_binary_table, fits_open_file} %!%- define fits_create_binary_table () { if (_NARGS != 6) usage ("fits_create_binary_table (file, extname, nrows, ttype[], tform[], tunit[])"); variable fp, nrows, ttype, tform, tunit, extnam; (fp, extnam, nrows, ttype, tform, tunit) = (); variable needs_close; fp = get_open_write_fp (fp, "c", &needs_close); do_fits_error (_fits_create_binary_tbl (fp, nrows, ttype, tform, tunit, extnam)); do_close_file (fp, needs_close); } %!%+ %\function{fits_write_binary_table} %\synopsis{Write a binary table} %\usage{fits_write_binary_table (file, extname, sdata, [skeys [,hist]])} %#v+ %Fits_File_Type or String_Type file; %String_Type extname; %Struct_Type sdata; %Struct_Type skeys; %Struct_Type hist; %#v- %\description % The \var{fits_write_binary_table} function creates a new binary table in % the specified file. The parameter \var{file} specifies either a filename or % an open file pointer. The \var{extname} parameter specifies the extension % name of the binary table. The data written to table are specified in the % \var{sdata} structure, where the name of the structure field specifies the % column name. If \var{skeys} is non-NULL, then it is a structure indicating % additional keywords to be written to the header of the binary table. If the % optional parameter \var{hist} is present and non-NULL, then it is a structure % whose fields indicate either comment or history information to be written % to the header. %\example % The following code %#v+ % variable data = struct { x, cosx, sinx }; % data.x = [0:2*PI:0.01]; % data.cosx = cos(data.x); % data.sinx = sin(data.x); % % variable keys = struct { hduname, username}; % keys.hduname = "COSXSINX"; % keys.username = "John Doe"; % % variable hist = struct { history, comment}; % hist.history = ["This is a history record", "This is another"]; % hist.comment = ["This is a comment", "And this is another"]; % % fits_write_binary_table ("foo.fits", "COSXSINX", data, keys, hist); %#v- % produces a binary table with the header: %#v+ % XTENSION= 'BINTABLE' / binary table extension % BITPIX = 8 / 8-bit bytes % NAXIS = 2 / 2-dimensional binary table % NAXIS1 = 24 / width of table in bytes % NAXIS2 = 629 / number of rows in table % PCOUNT = 0 / size of special data area % GCOUNT = 1 / one data group (required keyword) % TFIELDS = 3 / number of fields in each row % TTYPE1 = 'x ' / label for field 1 % TFORM1 = 'D ' / data format of field: 8-byte DOUBLE % TTYPE2 = 'cosx ' / label for field 2 % TFORM2 = 'D ' / data format of field: 8-byte DOUBLE % TTYPE3 = 'sinx ' / label for field 3 % TFORM3 = 'D ' / data format of field: 8-byte DOUBLE % EXTNAME = 'COSXSINX' / name of this binary table extension % HDUNAME = 'COSXSINX' % USERNAME= 'John Doe' % HISTORY This is a history record % HISTORY This is another % COMMENT This is a comment % COMMENT And this is another %#v- %\notes % This function provides no mechanism to mix comments and keyword records. As % the example shows, this function places the comment and history records at % the end of the table. %\seealso{fits_create_binary_table, fits_open_file} %!%- private define add_keys_and_history_func (fp, keys, history) { variable val; if (keys != NULL) { foreach (get_struct_field_names (keys)) { variable keyword = (); val = get_struct_field (keys, keyword); do_fits_error (_fits_update_key (fp, keyword, val, NULL), keyword); } } if (typeof (history) == String_Type) { history; history = struct {history}; history.history = (); } if (history == NULL) return; foreach (get_struct_field_names (history)) { keyword = (); val = get_struct_field (history, keyword); if (typeof (val) == String_Type) val = [val]; keyword = strlow (keyword); foreach (val) { val = (); if (keyword == "history") { do_fits_error (_fits_write_history (fp, val)); continue; } if (keyword == "comment") { do_fits_error (_fits_write_comment (fp, val)); continue; } vmessage ("*** WARNING: history/comment record name '%s' is not supported", history); } } } define fits_write_binary_table () { variable fp, extname, s, keys, history; variable needs_close; variable keyfunc, keyfunc_args; variable usage_str = "\n" + "Form 1: fits_write_binary_table (file, extname, data_struct [,opt-keyword_struct [,opt-history]])\n" + "Form 2: fits_write_binary_table (file, extname, data_struct, &keyfunc [,opt-args...])"; if (_NARGS < 3) usage (usage_str); keyfunc = NULL; if (_NARGS > 3) { _stk_reverse (_NARGS - 3); keyfunc = (); _stk_reverse (_NARGS - 4); if (typeof (keyfunc) != Ref_Type) { % keyfunc must be the keys struct if (_NARGS == 4) history = NULL; else if (_NARGS == 5) history = (); else { _pop_n (_NARGS); usage (usage_str); } (keyfunc, history); % put back on stack keyfunc_args = __pop_args (2); keyfunc = &add_keys_and_history_func; } else keyfunc_args = __pop_args (_NARGS - 4); } (fp, extname, s) = (); fp = get_open_write_fp (fp, "c", &needs_close); variable ttype; if (s == NULL) ttype = String_Type[0]; else ttype = get_struct_field_names (s); variable ncols = length (ttype); variable tform = String_Type [ncols]; variable nrows = -1; variable tdim = String_Type[ncols]; _for (0, ncols-1, 1) { variable i = (); variable colname = ttype[i]; variable val = get_struct_field (s, colname); if (colname[0] == '_') % unnormalize colname = substr (colname, 2, -1); variable t = _typeof (val); variable ndims; switch (t) { case Int32_Type: t = "J"; } { case Float_Type: t = "E"; } { case Double_Type: t = "D"; } { case Int16_Type: t = "I"; } { case UInt16_Type: t = "U"; } { case UInt32_Type: t = "V"; } { case String_Type: (,ndims,) = array_info (val); if (ndims > 1) verror ("This function does not support %d-d strings", ndims); t = sprintf ("%dA", max (array_map (Int_Type, &strlen, val))); } { case Char_Type or case UChar_Type: t = "B"; } { verror ("%s: %s column: %S type not supported", _function_name, colname, t); } variable nrows_i = length (val); if ((typeof (val) == Array_Type) and nrows_i) { variable tdim_i; (tdim_i,ndims,) = array_info (val); if (ndims > 1) { t = string (nrows_i/tdim_i[0]) + t; tdim[i] = make_tdim_string (tdim_i[[1:]]); nrows_i = tdim_i[0]; } } if (nrows != nrows_i) { if (nrows != -1) verror ("Expecting field %s to have %d rows", ttype[i], nrows); nrows = nrows_i; } tform[i] = t; ttype[i] = colname; } if (nrows == -1) % ncols is 0 nrows = 0; fits_create_binary_table (fp, extname, nrows, ttype, tform, NULL); _for (0, ncols-1, 1) { i = (); if (NULL != tdim[i]) do_fits_error (_fits_update_key (fp, sprintf("TDIM%d", i+1), tdim[i], NULL)); } if (keyfunc != NULL) (@keyfunc)(fp, __push_args(keyfunc_args)); _for (0, ncols-1, 1) { i = (); val = get_struct_field (s, ttype[i]); do_fits_error (_fits_write_col (fp, i+1, 1, 1, val)); } do_close_file (fp, needs_close); } private define do_write_xxx (func, nargs) { variable args = __pop_args (nargs-1); variable fp = (); variable needs_close; fp = get_open_write_fp (fp, "w", &needs_close); if (nargs > 1) do_fits_error ((@func)(fp, __push_args(args))); else do_fits_error ((@func)(fp)); do_close_file (fp, needs_close); } private define do_read_xxx (func, nargs) { variable args = __pop_args (nargs-1); variable fp = (); variable needs_close; fp = get_open_fp (fp, &needs_close); if (nargs > 1) do_fits_error ((@func)(fp, __push_args(args))); else do_fits_error ((@func)(fp)); do_close_file (fp, needs_close); } %!%+ %\function{fits_update_key} %\synopsis{Update the value of a keyword} %\usage{fits_update_key (fd, key, val [,comment])} %#v+ % String_Type or Fits_File_Type fd; % String_Type key; % Any type val; % String_Type comment; %#v- %\description % The \var{fits_update_key} function updates the value and comment fields % of an existing keyword with the specified name. If the keyword does not % exist, a new keyword will be appended to the end of the header. %\seealso{fits_update_logical, fits_read_key} %!%- define fits_update_key () { variable nargs = _NARGS; if (nargs < 3) usage ("fits_update_key (fp, key, value, comment)"); if (nargs == 3) { NULL; % add comment nargs++; } do_write_xxx (&_fits_update_key, 4); } %!%+ %\function{fits_update_logical} %\synopsis{Update the value of a logical (boolean) keyword} %\usage{fits_update_logical (fd, key, val, comment)} %#v+ % String_Type or Fits_File_Type fd; % String_Type key; % Any type val; % String_Type comment; %#v- %\description % The \var{fits_update_logical} function updates the value and comment fields % of an existing keyword of the specified name with the specified boolean value. % If the keyword does not exist, a new keyword will be appended to the end of % the header. %\seealso{fits_update_key} %!%- define fits_update_logical () { if (_NARGS != 4) usage ("fits_update_logical (fp, key, value, comment)"); do_write_xxx (&_fits_update_logical, _NARGS); } %!%+ %\function{fits_write_comment} %\synopsis{Write a comment to the header} %\usage{fits_write_comment (fd, comment)} %#v+ % Fits_File_Type or String_Type fd; % String_Type comment; %#v- %\description % As the name indicates, this function writes a comment record to the specified % fits file. The file-descriptor \exmp{fd} must either be the name of a fits % file or an open fits file pointer. %\seealso{fits_update_key, fits_write_history} %!%- define fits_write_comment () { if (_NARGS != 2) usage ("fits_write_comment (fp, value)"); do_write_xxx (&_fits_write_comment, _NARGS); } %!%+ %\function{fits_write_history} %\synopsis{Write a history record to the header} %\usage{fits_write_history (fd, history)} %#v+ % Fits_File_Type or String_Type fd; % String_Type history; %#v- %\description % As the name indicates, this function writes a history record to the specified % fits file. The file-descriptor \exmp{fd} must either be the name of a fits % file or an open fits file pointer. %\seealso{fits_update_key, fits_write_comment} %!%- define fits_write_history () { if (_NARGS != 2) usage ("fits_write_history (fp, value)"); do_write_xxx (&_fits_write_history, _NARGS); } %!%+ %\function{fits_write_date} %\synopsis{Write the DATE keyword to the current HDU} %\usage{fits_write_date (fd)} %#v+ % Fits_File_Type or String_Type fd; %#v- %\description % The \sfun{fits_write_date} function calls \ifun{_fits_write_date} to write % the DATE to the header of the specified file descriptor, which must either % be the name of a fits file or an open fits file pointer. %\seealso{fits_update_key} %!%- define fits_write_date () { if (_NARGS != 1) usage ("fits_write_date (fp)"); do_write_xxx (&_fits_write_date, _NARGS); } %!%+ %\function{fits_write_chksum} %\synopsis{Compute and write the DATASUM and CHECKSUM keywords} %\usage{fits_write_chksum (fd)} %#v+ % Fits_File_Type or String_Type fd; %#v- %\description % The \sfun{fits_write_chksum} function calls \ifun{_fits_write_comment} to % compute and write the DATASUM and CHECKSUM keywords to the % header of the specified file descriptor, which must either % be the name of a fits file or an open fits file pointer. %\seealso{fits_update_key, fits_verify_chksum} %!%- define fits_write_chksum () { if (_NARGS != 1) usage ("fits_write_chksum (fp)"); do_write_xxx (&_fits_write_chksum, _NARGS); } %!%+ %\function{fits_verify_chksum} %\synopsis{Verify the checksums for the current HDU} %\usage{isok = fits_verify_chksum (fd [,dataok, hduok])} %#v+ % Fits_File_Type or String_Type fd; % Ref_Type dataok, hduok; %#v- %\description % The \sfun{fits_verify_chksum} function calls \ifun{_fits_verify_chksum} to % verify the header and data checksums of the current HDU. A non-zero return value % signifies that the checksums are ok, otherwise the function returns 0 to indicate % that the checksums are invalid. The individual checksums of the HDU or data % can be checked through the use of the optional parameters. %\seealso{fits_write_chksum} %!%- define fits_verify_chksum () { variable dataok_buf, hduok_buf; variable dataok = &dataok_buf, hduok = &dataok_buf; if (_NARGS == 3) (dataok, hduok) = (); else if (_NARGS != 1) usage ("ok = fits_verify_chksum (fp [,&dataok, &hduok])"); if (dataok == NULL) dataok = &dataok_buf; if (hduok == NULL) hduok = &hduok_buf; &dataok, &hduok; % push do_read_xxx (&_fits_verify_chksum, 3); return min([@dataok, @hduok]); } %!%+ %\function{fits_read_records} %\synopsis{Read all the records in a fits header} %\usage{String_Type[] fits_read_records (Fits_File_Type or String_Type fp)} %\description % This function returns a list of all the header records associated with the % fits file descriptor as an array of strings. %\seealso{fits_write_records, fits_read_key} %!%- define fits_read_records () { if (_NARGS != 1) usage ("String_Type[] fits_read_records (fp)"); variable fp = (); fp = get_open_interesting_hdu (fp, NULL); variable nkeys; do_fits_error (_fits_get_num_keys (fp, &nkeys)); variable recs = String_Type [nkeys]; _for (0, nkeys-1, 1) { variable i = (); variable rec; do_fits_error (_fits_read_record (fp, i+1, &rec)); recs[i] = rec; } return recs; } %!%+ %\function{fits_write_records} %\synopsis{Write records to fits header} %\usage{fits_write_records (fd, records)} %#v+ % Fits_File_Type or String_Type fd; % Array_Type records; %#v- %\description % This function uses the \ifun{_fits_write_record} function to write a series % of records to the current HDU. %\seealso{fits_read_records} %!%- define fits_write_records () { if (_NARGS != 2) usage ("fits_write_records (fp, records[])"); variable fp, records; (fp, records) = (); variable needs_close; fp = get_open_write_fp (fp, "w", &needs_close); if (String_Type == typeof (records)) records = [records]; foreach (records) { variable rec = (); do_fits_error (_fits_write_record (fp, rec)); } do_close_file (fp, needs_close); } %!%+ %\function{fits_get_keyclass} %\synopsis{Obtain the key classes for a set of cards} %\usage{Int_Type[] = fits_get_keyclass (Array_Type cards)} %\description % This function uses the \ifun{_fits_get_keyclass} function to obtain the % key-classes associated with one or more cards. The function returns an % integer-valued array of the same length as the \exmp{cards} array. %\example % Obtain set of header cards to those that are not associated with the cards % describing the structure of the HDU: %#v+ % variable cards = fits_read_records ("evt2.fits[EVENTS]"); % variable classes = fits_get_keyclass (cards); % cards = cards[where (classes != _FITS_TYP_STRUC_KEY)]; %#v- %\seealso{fits_read_records, fits_read_key} %!%- define fits_get_keyclass () { if (_NARGS != 1) usage ("Int_Type[] = fits_get_keyclass (records)"); variable records = (); if (String_Type == typeof (records)) return _fits_get_keyclass (records); return array_map (Int_Type, &_fits_get_keyclass, records); } % Image routines %!%+ %\function{fits_get_bitpix} %\synopsis{Get the fits bitpix value for an array} %\usage{Int_Type fits_get_bitpix (array)} %\description % This function may be used to obtain the bitpix value for a specified image % array. The array must be an integer or floating point type, otherwise % and error will be generated. The bitpix value is returned. %\seealso{fits_write_image_hdu, fits_read_img} %!%- define fits_get_bitpix (image) { variable types = [Char_Type, UChar_Type, Int16_Type, UInt16_Type, Int32_Type, UInt32_Type, Float32_Type, Float64_Type]; variable bitpix = [10, 8, 16, 20, 32, 40, -32, -64]; variable b; if (typeof (image) == DataType_Type) b = image; else b = _typeof (image); variable i = where (types == b); if (length (i) == 0) verror ("fits_get_bitpix: %S is not supported", b); return bitpix[i[0]]; } %!%+ %\function{fits_read_img} %\synopsis{Read image data from a fits file} %\usage{Array_Type fits_read_img (fd)} %#v+ % Fits_File_Type or String_Type fd; %#v- %\description % This function reads an image from the specified file descriptor. % The file descriptor must be either the name of an existing file, or an % open file pointer. It returns the image upon sucess, or signals an error % upon failure. %\seealso{fits_read_table, fits_read_col, fits_open_file, fits_write_img} %!%- define fits_read_img () { !if (_NARGS) usage ("I=fits_read_img (file);"); variable fp = (); variable needs_close; fp = get_open_image_hdu (fp, &needs_close); variable a; do_fits_error (_fits_read_img (fp, &a)); do_close_file (fp, needs_close); return a; } %!%+ %\function{fits_create_image_hdu} %\synopsis{Create a primary array or image extension} %\usage{fits_create_image_hdu (fd, extname, type, dims)} %#v+ % Fits_File_Type or String_Type fd; % String_Type extname; % Array_Type dims; % DataType_Type type; %#v- %\description % This function make use of the \ifun{_fits_create_img} function to create an % image extension or primary array of the specified type and size. If the % \exmp{extname} parameter is non-NULL, then an EXTNAME keyword will be % written out with the value of the extname parameter. % The \exmp{dims} parameter must be a 1-d integer array that corresponds % to the dimensions of the array to be written. % % If \exmp{fd} is specified as a string, then a new file of that name will be % created. If a file by that name already exists, it will be deleted and % a new one created. If this behavior is undesired, then explicitly open the % file and pass this routine the resulting file pointer. %\seealso{fits_write_image_hdu} %!%- define fits_create_image_hdu () { if (_NARGS != 4) usage ("%s (file, extname, type, dims)", _function_name ()); variable fp, extname, type, dims; (fp, extname, type, dims) = (); variable needs_close; fp = get_open_write_fp (fp, "c", &needs_close); do_fits_error (_fits_create_img (fp, fits_get_bitpix (type), dims)); if (extname != NULL) do_fits_error (_fits_update_key (fp, "EXTNAME", extname, NULL)); do_close_file (fp, needs_close); } %!%+ %\function{fits_write_image_hdu} %\synopsis{Write an image extension} %\usage{fits_write_image_hdu (file, extname, image [,skeys [,hist]])} %#v+ % Fits_File_Type or String_Type file; % String_Type extname; % Any_Type image % Struct_Type skeys; % Struct_Type hist; %#v- %\description % The \var{fits_write_image_hdu} function creates a new image extension in % the specified file. The parameter \var{file} specifies either a filename or % an open file pointer. The \var{extname} parameter specifies the extension % name of the image, or NULL for the primary image. The image data written % to the file are specified by the \var{image} parameter. % If the optional parameter \var{skeys} is non-NULL, then it is a % structure indicating additional keywords to be written to the HDU. % If the optional parameter \var{hist} is present and non-NULL, % then it is a structure whose fields indicate either comment or history % information to be written to the header. %\example % The following code %#v+ % variable img = [1:128*128]; reshape (img, [128,128]); % variable keys = struct { hduname, username}; % keys.hduname = "MY_IMAGE"; % keys.username = "John Doe"; % variable hist = struct { history, comment}; % hist.history = ["This is a history record", "This is another"]; % hist.comment = ["This is a comment", "And this is another"]; % fits_write_image_hdu ("foo.fits", NULL, img, keys, hist); %#v- % produces an image HDU with the header: %#v+ % SIMPLE = T / file does conform to FITS standard % BITPIX = 32 / number of bits per data pixel % NAXIS = 2 / number of data axes % NAXIS1 = 128 / length of data axis 1 % NAXIS2 = 128 / length of data axis 2 % EXTEND = T / FITS dataset may contain extensions % COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy % COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A&A...376..359H % HDUNAME = 'MY_IMAGE' % USERNAME= 'John Doe' % HISTORY This is a history record % HISTORY This is another % COMMENT This is a comment % COMMENT And this is another %#v- %\notes % This function provides no mechanism to mix comments and keyword records. As % the example shows, this function places the comment and history records at % the end of the table. %\seealso{fits_create_binary_table, fits_open_file} %!%- define fits_write_image_hdu () { variable fp, extname, image, keys = NULL, history = NULL; variable needs_close; switch (_NARGS) { case 4: keys = (); } { case 5: (keys, history) = (); } { if (_NARGS != 3) { _pop_n (_NARGS); usage ("%s (file, extname, image [, keyword_struct [, history]]", _function_name ()); } } (fp, extname, image) = (); fp = get_open_write_fp (fp, "c", &needs_close); variable dims; (dims,,) = array_info (image); fits_create_image_hdu (fp, extname, _typeof (image), dims); if (keys != NULL) { foreach (get_struct_field_names (keys)) { variable keyword = (); variable val = get_struct_field (keys, keyword); do_fits_error (_fits_update_key (fp, keyword, val, NULL), keyword); } } if (typeof (history) == String_Type) { history; history = struct {history}; history.history = (); } if (history != NULL) { foreach (get_struct_field_names (history)) { keyword = (); val = get_struct_field (history, keyword); if (typeof (val) == String_Type) val = [val]; keyword = strlow (keyword); foreach (val) { val = (); if (keyword == "history") { do_fits_error (_fits_write_history (fp, val)); continue; } if (keyword == "comment") { do_fits_error (_fits_write_comment (fp, val)); continue; } vmessage ("*** WARNING: history/comment record name '%s' is not supported", history); } } } do_fits_error (_fits_write_img (fp, image)); do_close_file (fp, needs_close); } %!%+ %\function{fits_write_img} %\synopsis{Write the image data to an Image HDU} %\usage{fits_write_img (Fits_File_Type fptr, Any_Type data)} %\description % This function writes the image data out to current HDU, assumed to be % an Image HDU. %\seealso{fits_write_image_hdu, fits_create_image_hdu} %!%- % FIXME: Allow only a portion of the image to be written define fits_write_img () { variable fp, data; switch (_NARGS) { case 2: (fp, data) = (); } { usage ("%s (fptr, img)", _function_name); } do_fits_error (_fits_write_img (fp, data)); } #iffalse define fits_iterate (fp, delta_rows, func, client_data, column_names) { variable numrows; variable num_columns = length (column_names); variable col_nums = Int_Type[num_columns]; variable data = Struct_Type[num_columns]; variable i; for (i = 0; i < num_columns; i++) { variable col; do_fits_error (_fits_get_colnum (fp, column_names[i], &col)); col_nums[i] = col; data[i] = struct { value }; } do_fits_error (_fits_get_num_rows (fp, &numrows)); variable current_row = 1; while (numrows) { variable value; if (numrows < delta_rows) delta_rows = numrows; for (i = 0; i < num_columns; i++) { do_fits_error (_fits_read_col (fp, col_nums[i], current_row, delta_rows, &value)); data[i].value = value; } @func (client_data, __push_args (data)); current_row += delta_rows; numrows -= delta_rows; } } define test_func (info, x, y, ccdid, grade, status) { variable i = where ((ccdid == info.ccdid) and ((grade != 1) and (grade != 5) and (grade != 7)) and (status == 0)); info.sum_x += sum (x[i]); info.sum_y += sum (y[i]); info.num += length (x[i]); } define test_fits_iterate () { variable file = "/tmp/test.fits[EVENTS]"; variable info = struct { sum_x, sum_y, ccdid, num }; variable fp = fits_open_file (file, "r"); variable delta = 1; while (delta < 100000000) { info.sum_x = 0; info.sum_y = 0; info.ccdid = 7; info.num = 0; tic (); fits_iterate (fp, 10000, &test_func, info, ["X", "Y", "CCD_ID", "GRADE", "STATUS"]); () = fprintf (stdout, "delta=%d, CPU=%g secs, mean([x,y]) is [%g,%g]\n", delta, toc (), info.sum_x/info.num, info.sum_y/info.num); () = fflush (stdout); delta *= 10; } } #endif % Obsolete functions define fits_read_image () { () = fprintf (stderr, "*** Warning: fits_read_image is deprecated.\n"); variable args = __pop_args (_NARGS); return fits_read_img (__push_args (args)); } provide ("fits"); #ifexists add_doc_file $1 = path_concat (path_concat (path_dirname (__FILE__), "help"), "cfitsio.hlp"); if (NULL != stat_file ($1)) add_doc_file ($1); #endif #iffalse autoload ("fitswcs_get_img_wcs", "fitswcs.sl") autoload ("fitswcs_get_column_wcs", "fitswcs.sl") autoload ("fitswcs_write_img_wcs", "fitswcs.sl") autoload ("fitswcs_slice", "fitswcs.sl") #endif slcfitsio-0.3.8/src/cfitsio-module.c0000644002657400265740000016045010611753762016441 0ustar davisdavis/* cfitsio interface */ #include "config.h" #include #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif SLANG_MODULE(cfitsio); #ifdef __cplusplus } #endif #include "version.h" #define SLANG_UINT16_TYPE SLANG_USHORT_TYPE #define SLANG_INT16_TYPE SLANG_SHORT_TYPE #if SIZEOF_INT == 32 # define SLANG_INT32_TYPE SLANG_INT_TYPE # define SLANG_INT32_TYPE SLANG_UINT_TYPE #else # define SLANG_INT32_TYPE SLANG_LONG_TYPE # define SLANG_UINT32_TYPE SLANG_LONG_TYPE #endif typedef struct { fitsfile *fptr; } FitsFile_Type; static SLtype Fits_Type_Id = 0; static int map_fitsio_type_to_slang (int type, long *repeat, SLtype *stype) { /* Variable length objects have negative type values */ if (type < 0) type = -type; switch (type) { case TINT: *stype = SLANG_INT_TYPE; break; case TLONG: *stype = SLANG_LONG_TYPE; break; case TSHORT: *stype = SLANG_SHORT_TYPE; break; case TDOUBLE: *stype = SLANG_DOUBLE_TYPE; break; case TFLOAT: *stype = SLANG_FLOAT_TYPE; break; #ifdef TUINT case TUINT: *stype = SLANG_UINT_TYPE; break; #endif case TUSHORT: *stype = SLANG_USHORT_TYPE; break; case TULONG: *stype = SLANG_ULONG_TYPE; break; case TLOGICAL: case TBYTE: *stype = SLANG_UCHAR_TYPE; break; case TBIT: switch ((int)*repeat) { /* Make sure these all map to SIGNED types -- not unsigned. This * way they will be written out as SIGNED types and avoid the * bit corruption that takes place when cfitsio adds, e.g., 0x7FFFFFFF * to push the value into the unsigned range. */ case 32: *stype = SLANG_INT_TYPE; break; case 16: *stype = SLANG_SHORT_TYPE; break; case 8: *stype = SLANG_CHAR_TYPE; break; default: SLang_verror (SL_NOT_IMPLEMENTED, "bit type %ldX is not supported", *repeat); return -1; } *repeat = 1; break; case TSTRING: *stype = SLANG_STRING_TYPE; break; default: SLang_verror (SL_NOT_IMPLEMENTED, "Fits column type %d is not supported", type); return -1; } return 0; } static int open_file (SLang_Ref_Type *ref, char *filename, char *mode) { fitsfile *fptr; int status; FitsFile_Type *ft; SLang_MMT_Type *mmt; if (-1 == SLang_assign_to_ref (ref, SLANG_NULL_TYPE, NULL)) return -1; status = 0; fptr = NULL; switch (*mode) { case 'r': (void) fits_open_file (&fptr, filename, READONLY, &status); break; case 'w': (void) fits_open_file (&fptr, filename, READWRITE, &status); break; case 'c': if ((-1 == remove (filename)) && (errno != ENOENT)) { SLang_verror (SL_OBJ_NOPEN, "Unable to create a new version of %s--- check permissions", filename); return -1; } (void) fits_create_file (&fptr, filename, &status); break; default: SLang_verror (SL_INVALID_PARM, "fits_open_file: iomode \"%s\" is invalid", mode); return -1; } if (status) return status; if (fptr == NULL) return -1; ft = (FitsFile_Type *) SLmalloc (sizeof (FitsFile_Type)); if (ft == NULL) { fits_close_file (fptr, &status); return -1; } memset ((char *) ft, 0, sizeof (FitsFile_Type)); ft->fptr = fptr; if (NULL == (mmt = SLang_create_mmt (Fits_Type_Id, (VOID_STAR) ft))) { fits_close_file (fptr, &status); SLfree ((char *) fptr); return -1; } if (-1 == SLang_assign_to_ref (ref, Fits_Type_Id, &mmt)) { SLang_free_mmt (mmt); /* This will close the file */ return -1; } return status; } static int delete_file (FitsFile_Type *ft) { int status = 0; if (ft->fptr != NULL) fits_delete_file (ft->fptr, &status); ft->fptr = NULL; return status; } static int close_file (FitsFile_Type *ft) { int status = 0; status = 0; if (ft->fptr != NULL) { (void) fits_close_file (ft->fptr, &status); ft->fptr = NULL; } return status; } static int movnam_hdu (FitsFile_Type *ft, int *hdutype, char *extname, int *extvers) { int status = 0; if (ft->fptr == NULL) return -1; return fits_movnam_hdu (ft->fptr, *hdutype, extname, *extvers, &status); } static int movabs_hdu (FitsFile_Type *ft, int *n) { int status = 0; if (ft->fptr == NULL) return -1; return fits_movabs_hdu (ft->fptr, *n, NULL, &status); } static int movrel_hdu (FitsFile_Type *ft, int *n) { int status = 0; if (ft->fptr == NULL) return -1; return fits_movrel_hdu (ft->fptr, *n, NULL, &status); } static int get_num_hdus (FitsFile_Type *ft, SLang_Ref_Type *ref) { int status = 0; int num; if (ft->fptr == NULL) return -1; if (0 == fits_get_num_hdus (ft->fptr, &num, &status)) { if (-1 == SLang_assign_to_ref (ref, SLANG_INT_TYPE, &num)) return -1; } return status; } static int get_hdu_num (FitsFile_Type *ft) { int num; if (ft->fptr == NULL) return -1; return fits_get_hdu_num (ft->fptr, &num); } static int get_hdu_type (FitsFile_Type *ft, SLang_Ref_Type *ref) { int hdutype; int status = 0; if (ft->fptr == NULL) return -1; if (0 == fits_get_hdu_type (ft->fptr, &hdutype, &status)) { if (-1 == SLang_assign_to_ref (ref, SLANG_INT_TYPE, &hdutype)) return -1; } return status; } static int copy_file (FitsFile_Type *ft, FitsFile_Type *gt, int *prev, int *cur, int *next) { int status = 0; if ((ft->fptr == NULL) || (gt->fptr == NULL)) return -1; #ifndef fits_copy_file (void) status; (void) prev; (void) cur; (void) next; SLang_verror (SL_NOT_IMPLEMENTED, "Not supported by this version of cfitsio"); return -1; #else return fits_copy_file (ft->fptr, gt->fptr, *prev, *cur, *next, &status); #endif } static int copy_hdu (FitsFile_Type *ft, FitsFile_Type *gt, int *morekeys) { int status = 0; if ((ft->fptr == NULL) || (gt->fptr == NULL)) return -1; return fits_copy_hdu (ft->fptr, gt->fptr, *morekeys, &status); } static int copy_header (FitsFile_Type *ft, FitsFile_Type *gt) { int status = 0; if ((ft->fptr == NULL) || (gt->fptr == NULL)) return -1; return fits_copy_header (ft->fptr, gt->fptr, &status); } static int delete_hdu (FitsFile_Type *ft) { int status = 0; if (ft->fptr == NULL) return -1; return fits_delete_hdu (ft->fptr, NULL, &status); } static int pop_string_or_null (char **s) { if (SLANG_NULL_TYPE == SLang_peek_at_stack ()) { *s = NULL; return SLang_pop_null (); } return SLang_pop_slstring (s); } static int pop_array_or_null (SLang_Array_Type **a) { if (SLANG_NULL_TYPE == SLang_peek_at_stack ()) { *a = NULL; return SLang_pop_null (); } return SLang_pop_array (a, 1); } static FitsFile_Type *pop_fits_type (SLang_MMT_Type **mmt) { FitsFile_Type *ft; if (NULL == (*mmt = SLang_pop_mmt (Fits_Type_Id))) return NULL; if (NULL == (ft = (FitsFile_Type *) SLang_object_from_mmt (*mmt))) { SLang_free_mmt (*mmt); *mmt = NULL; } return ft; } static int create_img (FitsFile_Type *ft, int *bitpix, SLang_Array_Type *at_naxes) { long *axes; unsigned int i, imax; int status = 0; if (at_naxes->data_type != SLANG_INT_TYPE) { SLang_verror (SL_TYPE_MISMATCH, "fits_create_img: naxis must be an integer array"); return -1; } imax = at_naxes->num_elements; axes = (long *) SLmalloc ((imax+1) * sizeof (long)); if (axes == NULL) return -1; /* Transpose to FORTRAN order */ for (i = 0; i < imax; i++) axes[i] = ((int *) at_naxes->data)[imax-(i+1)]; (void) fits_create_img (ft->fptr, *bitpix, imax, axes, &status); SLfree ((char *) axes); return status; } static int write_img (FitsFile_Type *ft, SLang_Array_Type *at) { int type; int status = 0; if (ft->fptr == NULL) return -1; switch (at->data_type) { case SLANG_STRING_TYPE: type = TSTRING; break; case SLANG_DOUBLE_TYPE: type = TDOUBLE; break; case SLANG_FLOAT_TYPE: type = TFLOAT; break; case SLANG_SHORT_TYPE: type = TSHORT; break; case SLANG_CHAR_TYPE: case SLANG_UCHAR_TYPE: type = TBYTE; break; case SLANG_INT_TYPE: type = TINT; break; case SLANG_LONG_TYPE: type = TLONG; break; case SLANG_UINT_TYPE: type = TUINT; break; case SLANG_USHORT_TYPE: type = TUSHORT; break; case SLANG_ULONG_TYPE: type = TULONG; break; default: SLang_verror (SL_NOT_IMPLEMENTED, "fits_write_img: %s not supported", SLclass_get_datatype_name (at->data_type)); return -1; } return fits_write_img (ft->fptr, type, 1, at->num_elements, at->data, &status); } static int read_img (FitsFile_Type *ft, SLang_Ref_Type *ref) { int status = 0; int anynul = 0; int type, stype; int num_dims, i; long ldims[SLARRAY_MAX_DIMS]; int dims[SLARRAY_MAX_DIMS]; SLang_Array_Type *at; if (ft->fptr == NULL) return -1; #ifdef fits_get_img_equivtype status = fits_get_img_equivtype (ft->fptr, &type, &status); #else status = fits_get_img_type (ft->fptr, &type, &status); #endif if (status) return status; switch (type) { case BYTE_IMG: stype = SLANG_UCHAR_TYPE; type = TBYTE; break; case SHORT_IMG: /* 16 bit image */ stype = SLANG_SHORT_TYPE; type = TSHORT; /* C short */ break; case USHORT_IMG: stype = SLANG_SHORT_TYPE; type = TUSHORT; break; case LONG_IMG: stype = SLANG_LONG_TYPE; type = TLONG; break; case ULONG_IMG: stype = SLANG_ULONG_TYPE; type = TULONG; break; case DOUBLE_IMG: stype = SLANG_DOUBLE_TYPE; type = TDOUBLE; break; case FLOAT_IMG: default: stype = SLANG_FLOAT_TYPE; type = TFLOAT; break; } if (fits_get_img_dim (ft->fptr, &num_dims, &status)) return status; if ((num_dims > SLARRAY_MAX_DIMS) || (num_dims < 0)) { SLang_verror (SL_NOT_IMPLEMENTED, "Image dimensionality is not supported"); return -1; } if (fits_get_img_size (ft->fptr, num_dims, ldims, &status)) return status; #if 0 for (i = 0; i < num_dims; i++) dims[i] = (int) ldims[i]; #else for (i = 0; i < num_dims; i++) dims[num_dims-1-i] = (int) ldims[i]; #endif if (NULL == (at = SLang_create_array (stype, 0, NULL, dims, num_dims))) return -1; status = fits_read_img (ft->fptr, type, 1, at->num_elements, NULL, at->data, &anynul, &status); if (status) { SLang_free_array (at); return status; } if (-1 == SLang_assign_to_ref (ref, SLANG_ARRAY_TYPE, (VOID_STAR)&at)) status = -1; SLang_free_array (at); return status; } static int create_binary_tbl (void) { SLang_MMT_Type *mmt; FitsFile_Type *ft; SLang_Array_Type *at_ttype, *at_tform, *at_tunit; char *extname; int tfields, nrows; int status; status = -1; at_ttype = at_tform = at_tunit = NULL; mmt = NULL; ft = NULL; if (-1 == pop_string_or_null (&extname)) return -1; if (-1 == pop_array_or_null (&at_tunit)) goto free_and_return; if (-1 == SLang_pop_array (&at_tform, 1)) goto free_and_return; if (-1 == SLang_pop_array (&at_ttype, 1)) goto free_and_return; if (-1 == SLang_pop_integer (&nrows)) goto free_and_return; if (NULL == (ft = pop_fits_type (&mmt))) goto free_and_return; if (ft->fptr == NULL) goto free_and_return; tfields = (int) at_ttype->num_elements; if (at_ttype->data_type != SLANG_STRING_TYPE) { SLang_verror (SL_TYPE_MISMATCH, "fits_create_binary_tbl: ttype must be String_Type[%d]", tfields); goto free_and_return; } if ((tfields != (int) at_tform->num_elements) || (at_tform->data_type != SLANG_STRING_TYPE)) { SLang_verror (SL_TYPE_MISMATCH, "fits_create_binary_tbl: tform must be String_Type[%d]", tfields); goto free_and_return; } if ((at_tunit != NULL) && ((tfields != (int) at_tunit->num_elements) || (at_tunit->data_type != SLANG_STRING_TYPE))) { SLang_verror (SL_TYPE_MISMATCH, "fits_create_binary_tbl: tunit must be String_Type[%d]", tfields); goto free_and_return; } status = 0; fits_create_tbl (ft->fptr, BINARY_TBL, nrows, tfields, (char **) at_ttype->data, (char **) at_tform->data, ((at_tunit == NULL) ? NULL : (char **) at_tunit->data), extname, &status); /* drop */ free_and_return: SLang_free_array (at_ttype); SLang_free_array (at_tform); SLang_free_array (at_tunit); SLang_free_mmt (mmt); SLang_free_slstring (extname); return status; } static int update_key (void) { SLang_MMT_Type *mmt; FitsFile_Type *ft; char *comment; int i; double d; char *s; char *key; int type; VOID_STAR v; int status; if (-1 == pop_string_or_null (&comment)) return -1; key = s = NULL; mmt = NULL; status = -1; type = SLang_peek_at_stack (); switch (type) { case SLANG_STRING_TYPE: type = TSTRING; if (-1 == SLang_pop_slstring (&s)) goto free_and_return; v = (VOID_STAR) s; break; case SLANG_INT_TYPE: type = TINT; if (-1 == SLang_pop_integer (&i)) goto free_and_return; v = (VOID_STAR) &i; break; case SLANG_NULL_TYPE: if (-1 == SLang_pop_null ()) goto free_and_return; v = NULL; break; case -1: /* stack underflow */ goto free_and_return; case SLANG_DOUBLE_TYPE: default: type = TDOUBLE; #if SLANG_VERSION < 20000 if (-1 == SLang_pop_double (&d, NULL, NULL)) goto free_and_return; #else if (-1 == SLang_pop_double (&d)) goto free_and_return; #endif v = (VOID_STAR) &d; break; } if (-1 == SLang_pop_slstring (&key)) goto free_and_return; if (NULL == (ft = pop_fits_type (&mmt))) goto free_and_return; if (ft->fptr == NULL) goto free_and_return; status = 0; if (v != NULL) { if (type == TSTRING) fits_update_key_longstr (ft->fptr, key, (char *)v, comment, &status); else fits_update_key (ft->fptr, type, key, v, comment, &status); } else fits_update_key_null (ft->fptr, key, comment, &status); free_and_return: SLang_free_mmt (mmt); SLang_free_slstring (key); SLang_free_slstring (comment); SLang_free_slstring (s); return status; } static int update_logical (void) { SLang_MMT_Type *mmt; FitsFile_Type *ft; char *comment; int i; char *key; int status; if (-1 == pop_string_or_null (&comment)) return -1; key = NULL; mmt = NULL; status = -1; if ((0 == SLang_pop_integer (&i)) && (0 == SLang_pop_slstring (&key)) && (NULL != (ft = pop_fits_type (&mmt))) && (ft->fptr != NULL)) { status = 0; fits_update_key (ft->fptr, TLOGICAL, key, (VOID_STAR) &i, comment, &status); } SLang_free_mmt (mmt); SLang_free_slstring (key); SLang_free_slstring (comment); return status; } static int write_comment (FitsFile_Type *ft, char *comment) { int status = 0; if (ft->fptr == NULL) return -1; return fits_write_comment (ft->fptr, comment, &status); } static int write_history (FitsFile_Type *ft, char *comment) { int status = 0; if (ft->fptr == NULL) return -1; return fits_write_history (ft->fptr, comment, &status); } static int write_date (FitsFile_Type *ft) { int status = 0; if (ft->fptr == NULL) return -1; return fits_write_date (ft->fptr, &status); } static int write_record (FitsFile_Type *ft, char *card) { int status = 0; if (ft->fptr == NULL) return -1; /* How robust is fits_write_record to cards that are not 80 characters long? */ return fits_write_record (ft->fptr, card, &status); } static int insert_record (FitsFile_Type *ft, int *keynum, char *card) { int status = 0; if (ft->fptr == NULL) return -1; return fits_insert_record (ft->fptr, *keynum, card, &status); } static int modify_name (FitsFile_Type *ft, char *oldname, char *newname) { int status = 0; if (ft->fptr == NULL) return -1; return fits_modify_name (ft->fptr, oldname, newname, &status); } static int do_get_keytype (fitsfile *f, char *name, int *stype) { int status = 0; char type; int s; char card [FLEN_CARD + 1]; char value [FLEN_CARD + 1]; if (f == NULL) return -1; if (0 != fits_read_card (f, name, card, &status)) return status; if (0 != fits_parse_value (card, value, NULL, &status)) return status; if (0 != fits_get_keytype (value, &type, &status)) return status; switch (type) { case 'C': s = SLANG_STRING_TYPE; break; case 'L': s = SLANG_INT_TYPE; break; case 'F': s = SLANG_DOUBLE_TYPE; break; case 'X': s = SLANG_COMPLEX_TYPE; break; case 'I': default: s = SLANG_INT_TYPE; break; } *stype = s; return 0; } static int read_key (int type) { SLang_MMT_Type *mmt; FitsFile_Type *ft; int status; char *name; char comment_buf [FLEN_COMMENT]; SLang_Ref_Type *comment_ref, *v_ref; int ival; double dval; char *sval = NULL; int ftype; VOID_STAR v; v_ref = comment_ref = NULL; name = NULL; mmt = NULL; status = -1; if (SLANG_NULL_TYPE == SLang_peek_at_stack ()) { if (-1 == SLang_pop_null ()) return -1; } else if (-1 == SLang_pop_ref (&comment_ref)) return -1; if (-1 == SLang_pop_ref (&v_ref)) goto free_and_return; if (-1 == SLang_pop_slstring (&name)) goto free_and_return; if (NULL == (ft = pop_fits_type (&mmt))) goto free_and_return; if (ft->fptr == NULL) goto free_and_return; if (type == SLANG_VOID_TYPE) { if (0 != (status = do_get_keytype (ft->fptr, name, &type))) goto free_and_return; status = -1; } switch (type) { case SLANG_INT_TYPE: v = (VOID_STAR) &ival; ftype = TINT; ival = 0; break; case SLANG_DOUBLE_TYPE: ftype = TDOUBLE; v = (VOID_STAR) &dval; dval = 0.0; break; case SLANG_STRING_TYPE: ftype = TSTRING; v = (VOID_STAR) &sval; break; default: SLang_verror (SL_INVALID_PARM, "fits_read_key: type %s not supported", SLclass_get_datatype_name (type)); goto free_and_return; } status = 0; if (ftype == TSTRING) fits_read_key_longstr (ft->fptr, name, &sval, comment_buf, &status); else fits_read_key (ft->fptr, ftype, name, v, comment_buf, &status); if (status == 0) { if (comment_ref != NULL) { char *cptr = comment_buf; if (-1 == SLang_assign_to_ref (comment_ref, SLANG_STRING_TYPE, (VOID_STAR) &cptr)) { status = -1; goto free_and_return; } } if (-1 == SLang_assign_to_ref (v_ref, type, v)) { status = -1; goto free_and_return; } } free_and_return: SLfree (sval); SLang_free_ref (comment_ref); SLang_free_ref (v_ref); SLang_free_slstring (name); SLang_free_mmt (mmt); return status; } static int read_key_integer (void) { return read_key (SLANG_INT_TYPE); } static int read_key_double (void) { return read_key (SLANG_DOUBLE_TYPE); } static int read_key_string (void) { return read_key (SLANG_STRING_TYPE); } static int read_generic_key (void) { return read_key (SLANG_VOID_TYPE); } static int read_record (FitsFile_Type *ft, int *keynum, SLang_Ref_Type *ref) { int status = 0; char card[FLEN_CARD+1]; if (ft->fptr == NULL) return -1; if (0 == fits_read_record (ft->fptr, *keynum, card, &status)) { char *c = card; if (-1 == SLang_assign_to_ref (ref, SLANG_STRING_TYPE, &c)) return -1; } return status; } static int delete_key (FitsFile_Type *ft, char *key) { int status = 0; if (ft->fptr == NULL) return -1; return fits_delete_key (ft->fptr, key, &status); } static int get_colnum (FitsFile_Type *ft, char *name, SLang_Ref_Type *ref) { int status = 0; int col; if (ft->fptr == NULL) return -1; /* FIXME: fits_get_colnum may be used to get columns matching a pattern */ col = 1; fits_get_colnum (ft->fptr, CASEINSEN, name, &col, &status); if (-1 == SLang_assign_to_ref (ref, SLANG_INT_TYPE, (VOID_STAR) &col)) status = -1; return status; } static int insert_rows (FitsFile_Type *ft, int *first, int *num) { int status = 0; if (ft->fptr == NULL) return -1; if ((*first <= 0) || (*num < 0)) { SLang_verror (SL_INVALID_PARM, "fits_insert_rows: first and num must be positive"); return -1; } return fits_insert_rows (ft->fptr, *first, *num, &status); } static int delete_rows (FitsFile_Type *ft, int *first, int *num) { int status = 0; if (ft->fptr == NULL) return -1; if ((*first <= 0) || (*num < 0)) { SLang_verror (SL_INVALID_PARM, "fits_delete_rows: first and num must be positive"); return -1; } return fits_delete_rows (ft->fptr, *first, *num, &status); } static int insert_cols (FitsFile_Type *ft, int *colnum, SLang_Array_Type *at_ttype, SLang_Array_Type *at_tform) { int ncols; char **ttype, **tform; int i; int status = 0; if (ft->fptr == NULL) return -1; ncols = at_ttype->num_elements; if ((ncols < 0) || (ncols != (int) at_tform->num_elements) || (at_ttype->data_type != SLANG_STRING_TYPE) || (at_tform->data_type != SLANG_STRING_TYPE)) { SLang_verror (SL_INVALID_PARM, "fits_insert_cols: ttype and tform must be string arrays of same size"); return -1; } if (*colnum <= 0) { SLang_verror (SL_INVALID_PARM, "fits_insert_cols: colnum must be positive"); return -1; } tform = (char **)at_tform->data; ttype = (char **)at_ttype->data; for (i = 0; i < ncols; i++) { if ((tform[i] == NULL) || (ttype[i] == NULL)) { SLang_verror (SL_INVALID_PARM, "fits_insert_cols: ttype and tform elements muts be non NULL"); return -1; } } return fits_insert_cols (ft->fptr, *colnum, ncols, ttype, tform, &status); } static int delete_col (FitsFile_Type *ft, int *col) { int status = 0; if (ft->fptr == NULL) return -1; return fits_delete_col (ft->fptr, *col, &status); } static int get_num_rows (FitsFile_Type *ft, SLang_Ref_Type *ref) { long nrows; int status = 0; if (ft->fptr == NULL) return -1; if (0 == fits_get_num_rows (ft->fptr, &nrows, &status)) { int inrows = (int) nrows; if (-1 == SLang_assign_to_ref (ref, SLANG_INT_TYPE, (VOID_STAR) &inrows)) return -1; } return status; } static int get_rowsize (FitsFile_Type *ft, SLang_Ref_Type *ref) { long nrows; int status = 0; if (ft->fptr == NULL) return -1; if (0 == fits_get_rowsize (ft->fptr, &nrows, &status)) { int inrows = (int) nrows; if (-1 == SLang_assign_to_ref (ref, SLANG_INT_TYPE, (VOID_STAR) &inrows)) return -1; } return status; } static int get_num_cols (FitsFile_Type *ft, SLang_Ref_Type *ref) { int ncols; int status = 0; if (ft->fptr == NULL) return -1; if (0 == fits_get_num_cols (ft->fptr, &ncols, &status)) { if (-1 == SLang_assign_to_ref (ref, SLANG_INT_TYPE, (VOID_STAR) &ncols)) return -1; } return status; } static void byte_swap32 (unsigned char *ss, unsigned int n) { unsigned char *p, *pmax, ch; p = (unsigned char *) ss; pmax = p + 4 * n; while (p < pmax) { ch = *p; *p = *(p + 3); *(p + 3) = ch; ch = *(p + 1); *(p + 1) = *(p + 2); *(p + 2) = ch; p += 4; } } static void byte_swap16 (unsigned char *p, unsigned int nread) { unsigned char *pmax, ch; pmax = p + 2 * nread; while (p < pmax) { ch = *p; *p = *(p + 1); *(p + 1) = ch; p += 2; } } /* MAJOR HACK!!!! */ static int hack_write_bit_col (fitsfile *f, unsigned int col, unsigned int row, unsigned int firstelem, unsigned int sizeof_type, unsigned int num_elements, unsigned char *bytes) { static int status = 0; tcolumn *colptr; long trepeat; int tcode; if ((f == NULL) || (f->Fptr == NULL) || (NULL == (colptr = (f->Fptr)->tableptr))) return WRITE_ERROR; colptr += (col - 1); /* offset to correct column structure */ trepeat = colptr->trepeat; tcode = colptr->tdatatype; colptr->tdatatype = TBYTE; colptr->trepeat = sizeof_type; (void) fits_write_col (f, TBYTE, col, row, firstelem, num_elements*sizeof_type, bytes, &status); colptr->tdatatype = tcode; colptr->trepeat = trepeat; return status; } static int write_tbit_col (fitsfile *f, unsigned int col, unsigned int row, unsigned int firstelem, unsigned int repeat, unsigned int width, SLang_Array_Type *at) { int status = 0; unsigned int num_elements; unsigned int sizeof_type; unsigned char *data, *buf; unsigned short s; void (*bs) (unsigned char *, unsigned int); (void) width; num_elements = at->num_elements; sizeof_type = at->sizeof_type; data = (unsigned char *) at->data; if (8 * sizeof_type != repeat) { SLang_verror (SL_NOT_IMPLEMENTED, "Writing a %dX bit column requires the appropriately sized integer", repeat); return -1; } s = 0x1234; if ((*(unsigned char *) &s == 0x12) || (sizeof_type == 1)) { return hack_write_bit_col (f, col, row, firstelem, sizeof_type, num_elements, data); } /* Sigh. Need to byteswap */ switch (sizeof_type) { case 2: bs = byte_swap16; break; case 4: bs = byte_swap32; break; default: SLang_verror (SL_NOT_IMPLEMENTED, "writing to a %dX column is not supported", repeat); return -1; } buf = (unsigned char *) SLmalloc (num_elements * sizeof_type); if (buf == NULL) return -1; memcpy (buf, data, num_elements * sizeof_type); (*bs) (buf, num_elements); status = hack_write_bit_col (f, col, row, firstelem, sizeof_type, num_elements, buf); SLfree ((char *) buf); return status; } #ifdef fits_get_eqcoltype # define GET_COL_TYPE fits_get_eqcoltype #else # define GET_COL_TYPE my_fits_get_coltype static int my_fits_get_coltype (fitsfile *fptr, int col, int *type, long *repeat, long *width, int *statusp) { int status = *statusp; char tscaln[32]; char tzeron[32]; double tscal, tzero; double min_val, max_val; if (0 != fits_get_coltype (fptr, col, type, repeat, width, &status)) { *statusp = status; return status; } sprintf (tscaln, "TSCAL%d", col); sprintf (tzeron, "TZERO%d", col); if (0 != fits_read_key (fptr, TDOUBLE, tscaln, &tscal, NULL, &status)) { fits_clear_errmsg (); tscal = 1.0; } if (0 != fits_read_key (fptr, TDOUBLE, tzeron, &tzero, NULL, &status)) { fits_clear_errmsg (); tzero = 0; } switch (*type) { case TSHORT: min_val = -32768.0; max_val = 32767.0; break; case TLONG: min_val = -2147483648.0; max_val = 2147483647.0; break; default: return 0; } min_val = tzero + tscal * min_val; max_val = tzero + tscal * max_val; if (min_val > max_val) { double tmp = max_val; max_val = min_val; min_val = tmp; } if ((min_val >= -32768.0) && (max_val <= 32767.0)) { *type = TSHORT; return 0; } if ((min_val >= 0) && (max_val <= 65535.0)) { *type = TUSHORT; return 0; } if ((min_val >= -2147483648.0) && (max_val <= 2147483647.0)) { *type = TLONG; return 0; } if ((min_val >= 0.0) && (max_val <= 4294967295.0)) { *type = TULONG; return 0; } *type = TDOUBLE; return 0; } #endif static int write_col (FitsFile_Type *ft, int *colnum, int *firstrow, int *firstelem, SLang_Array_Type *at) { int type; int status = 0; int col; long repeat; long width; if (ft->fptr == NULL) return -1; col = *colnum; if (0 != GET_COL_TYPE (ft->fptr, col, &type, &repeat, &width, &status)) return status; if (type == TBIT) return write_tbit_col (ft->fptr, col, *firstrow, *firstelem, repeat, width, at); switch (at->data_type) { case SLANG_USHORT_TYPE: type = TUSHORT; break; case SLANG_SHORT_TYPE: type = TSHORT; break; case SLANG_UINT_TYPE: type = TUINT; break; case SLANG_INT_TYPE: type = TINT; break; case SLANG_ULONG_TYPE: type = TULONG; break; case SLANG_LONG_TYPE: type = TLONG; break; case SLANG_DOUBLE_TYPE: type = TDOUBLE; break; case SLANG_FLOAT_TYPE: type = TFLOAT; break; case SLANG_STRING_TYPE: type = TSTRING; break; case SLANG_CHAR_TYPE: case SLANG_UCHAR_TYPE: type = TBYTE; break; default: SLang_verror (SL_NOT_IMPLEMENTED, "fits_write_col: %s not suppported", SLclass_get_datatype_name (at->data_type)); return -1; } return fits_write_col (ft->fptr, type, *colnum, *firstrow, *firstelem, at->num_elements, at->data, &status); } static int read_string_cell (fitsfile *f, unsigned int row, unsigned int col, unsigned int len, char **sp) { char *s; char *sls; int status = 0; int anynul; *sp = NULL; if (f == NULL) return -1; if (NULL == (s = SLmalloc (len + 1))) return -1; /* Note that the number of elements passed to this must be 1 */ if (0 != fits_read_col (f, TSTRING, col, row, 1, 1, NULL, &s, &anynul, &status)) { SLfree (s); return status; } sls = SLang_create_slstring (s); SLfree (s); if (sls == NULL) return -1; *sp = sls; return 0; } static int read_string_column (fitsfile *f, int is_var, long repeat, int col, unsigned int firstrow, unsigned int numrows, SLang_Array_Type **atp) { int num_elements; char **ats; unsigned int i; int status = 0; SLang_Array_Type *at; *atp = NULL; if (f == NULL) return -1; num_elements = (int) numrows; at = SLang_create_array (SLANG_STRING_TYPE, 0, NULL, &num_elements, 1); if (at == NULL) return -1; ats = (char **) at->data; for (i = 0; i < numrows; i++) { long offset; long row; row = firstrow + i; if (is_var) { if (0 != fits_read_descript (f, col, row, &repeat, &offset, &status)) { SLang_free_array (at); return status; } } status = read_string_cell (f, row, col, repeat, ats+i); if (status != 0) { SLang_free_array (at); return status; } } *atp = at; return 0; } static int read_bit_column (fitsfile *f, unsigned int col, unsigned int row, unsigned int firstelem, unsigned int num_elements, unsigned char *data, unsigned int bytes_per_elem) { int status, anynul; unsigned short s; if (f == NULL) return -1; status = 0; if (0 != fits_read_col (f, TBYTE, col, row, firstelem, num_elements*bytes_per_elem, NULL, data, &anynul, &status)) return status; s = 0x1234; if (*(unsigned char *) &s == 0x12) return status; /* Otherwise, byteswap */ switch (bytes_per_elem) { case 1: break; case 2: byte_swap16 (data, num_elements); break; case 4: byte_swap32 (data, num_elements); break; default: SLang_verror (SL_NOT_IMPLEMENTED, "%u byte integers are unsupported", bytes_per_elem); return -1; } return 0; } static int read_column_values (fitsfile *f, int type, unsigned char datatype, unsigned int row, unsigned int col, unsigned int num_rows, int repeat, SLang_Array_Type **atp) { int num_elements; int status = 0; int anynul; SLang_Array_Type *at; int dims[2]; int num_dims; *atp = NULL; if (f == NULL) return -1; num_elements = num_rows * repeat; if (num_rows <= 1) { dims[0] = num_elements; num_dims = 1; } else /* was repeat>1 */ { dims[0] = num_rows; dims[1] = repeat; num_dims = 2; } at = SLang_create_array (datatype, 0, NULL, dims, num_dims); if (at == NULL) return -1; if (num_elements) { if (type == TBIT) status = read_bit_column (f, col, row, 1, num_elements, (unsigned char *)at->data, at->sizeof_type); else (void) fits_read_col (f, type, col, row, 1, num_elements, NULL, at->data, &anynul, &status); } if (status) { SLang_free_array (at); return status; } *atp = at; return 0; } static int read_var_column (fitsfile *f, int ftype, SLtype datatype, int col, unsigned int firstrow, unsigned int num_rows, SLang_Array_Type **atp) { int num_elements; unsigned int i; SLang_Array_Type **ati; SLang_Array_Type *at; *atp = NULL; if (f == NULL) return -1; num_elements = (int) num_rows; at = SLang_create_array (SLANG_ARRAY_TYPE, 0, NULL, &num_elements, 1); if (at == NULL) return -1; ati = (SLang_Array_Type **) at->data; for (i = 0; i < num_rows; i++) { long offset; long repeat; unsigned int row; int status = 0; row = firstrow + i; if (0 != fits_read_descript (f, col, row, &repeat, &offset, &status)) { SLang_free_array (at); return status; } status = read_column_values (f, ftype, datatype, row, col, 1, repeat, ati+i); if (status) { SLang_free_array (at); return status; } } *atp = at; return 0; } static int read_col (FitsFile_Type *ft, int *colnum, int *firstrowp, int *num_rowsp, SLang_Ref_Type *ref) { SLang_Array_Type *at; int type; long num_rows; long width; int status; SLtype datatype; int num_columns; int firstrow; long repeat; int col; if (ft->fptr == NULL) return -1; status = 0; if (0 != fits_get_num_cols (ft->fptr, &num_columns, &status)) return status; if (0 != fits_get_num_rows (ft->fptr, &num_rows, &status)) return status; if (*num_rowsp <= 0) { SLang_verror (SL_INVALID_PARM, "Number of rows must positive"); return -1; } col = *colnum; if ((col <= 0) || (col > num_columns)) { SLang_verror (SL_INVALID_PARM, "Column number out of range"); return -1; } firstrow = *firstrowp; if ((firstrow <= 0) || (firstrow > num_rows)) { SLang_verror (SL_INVALID_PARM, "Row number out of range"); return -1; } if (firstrow + *num_rowsp > num_rows + 1) num_rows = num_rows - (firstrow - 1); else num_rows = *num_rowsp; if (0 != GET_COL_TYPE (ft->fptr, col, &type, &repeat, &width, &status)) return status; if (-1 == map_fitsio_type_to_slang (type, &repeat, &datatype)) return -1; if (datatype == SLANG_STRING_TYPE) { /* This assumes an ASCII_TBL, which will always have a * repeat of 1, and the number of bytes is given by the * width field. In contrast, a BINARY_TBL will have * repeat = number of bytes, and width represents the * number of bytes in a substring. */ if ((repeat == 1) && (width != 1)) repeat = width; status = read_string_column (ft->fptr, (type < 0), repeat, col, firstrow, num_rows, &at); } else if (type < 0) status = read_var_column (ft->fptr, -type, datatype, col, firstrow, num_rows, &at); else status = read_column_values (ft->fptr, type, datatype, firstrow, col, num_rows, repeat, &at); if (status) return status; if (-1 == SLang_assign_to_ref (ref, SLANG_ARRAY_TYPE, (VOID_STAR)&at)) status = -1; SLang_free_array (at); return status; } typedef struct { int type; long repeat, width; SLtype datatype; unsigned int data_offset; } Column_Info_Type; static int read_var_column_data (fitsfile *f, int ftype, SLtype datatype, int col, unsigned int firstrow, unsigned int num_rows, SLang_Array_Type **at_data) { unsigned int i; for (i = 0; i < num_rows; i++) { long offset; long repeat; unsigned int row; int status = 0; row = firstrow + i; if (0 != fits_read_descript (f, col, row, &repeat, &offset, &status)) return status; status = read_column_values (f, ftype, datatype, row, col, 1, repeat, at_data+i); if (status) return status; } return 0; } static int read_string_column_data (fitsfile *f, int is_var, long repeat, int col, long firstrow, unsigned int num_rows, char **strs) { unsigned int i; int status = 0; for (i = 0; i < num_rows; i++) { long offset; long row; row = firstrow + i; if (is_var) { if (0 != fits_read_descript (f, col, row, &repeat, &offset, &status)) return status; } status = read_string_cell (f, row, col, repeat, strs + i); if (status != 0) return status; } return 0; } /* Usage: read_cols (ft, [columns...], firstrow, nrows, &ref) */ static int read_cols (void) { SLang_MMT_Type *mmt; FitsFile_Type *ft; fitsfile *f; int status; int num_columns_in_table; long num_rows_in_table, delta_rows; int num_rows; int firstrow; int *cols; int num_cols; int i; SLang_Ref_Type *ref; Column_Info_Type *ci = NULL; SLang_Array_Type *data_arrays_at; SLang_Array_Type **data_arrays; SLang_Array_Type *columns_at; if (-1 == SLang_pop_ref (&ref)) return -1; if ((-1 == SLang_pop_integer (&num_rows)) || (-1 == SLang_pop_integer (&firstrow)) || (-1 == SLang_pop_array (&columns_at, 1))) { SLang_free_ref (ref); return -1; } if (NULL == (ft = pop_fits_type (&mmt))) { SLang_free_array (columns_at); SLang_free_ref (ref); return -1; } f = ft->fptr; status = 0; if ((0 != fits_get_num_cols (f, &num_columns_in_table, &status)) || (0 != fits_get_num_rows (f, &num_rows_in_table, &status))) goto free_and_return_status; if (num_rows <= 0) { SLang_verror (SL_INVALID_PARM, "Number of rows must positive"); status = -1; goto free_and_return_status; } if ((firstrow <= 0) || (firstrow > num_rows_in_table)) { SLang_verror (SL_INVALID_PARM, "Row number out of range"); return -1; } if (firstrow + num_rows > num_rows_in_table + 1) num_rows = num_rows_in_table - (firstrow - 1); cols = (int *)columns_at->data; num_cols = columns_at->num_elements; if (NULL == (ci = (Column_Info_Type *) SLmalloc (num_cols*sizeof (Column_Info_Type)))) { status = -1; goto free_and_return_status; } data_arrays_at = SLang_create_array (SLANG_ARRAY_TYPE, 0, NULL, &num_cols, 1); if (data_arrays_at == NULL) { status = -1; goto free_and_return_status; } data_arrays = (SLang_Array_Type **)data_arrays_at->data; for (i = 0; i < num_cols; i++) { SLang_Array_Type *at; SLtype datatype; long repeat; int type; int col; col = cols[i]; if ((col <= 0) || (col > num_columns_in_table)) { SLang_verror (SL_INVALID_PARM, "Column number out of range"); status = -1; goto free_and_return_status; } if (0 != GET_COL_TYPE (f, col, &type, &repeat, &ci[i].width, &status)) goto free_and_return_status; if (-1 == map_fitsio_type_to_slang (type, &repeat, &datatype)) { status = -1; goto free_and_return_status; } ci[i].repeat = repeat; ci[i].type = type; ci[i].datatype = datatype; ci[i].data_offset = 0; if (datatype == SLANG_STRING_TYPE) { at = SLang_create_array (SLANG_STRING_TYPE, 0, NULL, &num_rows, 1); } else if (type < 0) /* variable length */ at = SLang_create_array (SLANG_ARRAY_TYPE, 0, NULL, &num_rows, 1); else { int dims[2]; int num_dims = 1; dims[0] = num_rows; if (repeat > 1) { dims[1] = repeat; num_dims++; } at = SLang_create_array (datatype, 0, NULL, dims, num_dims); } if (at == NULL) { status = -1; goto free_and_return_status; } data_arrays[i] = at; } if (fits_get_rowsize (f, &delta_rows, &status)) goto free_and_return_status; if (delta_rows < 1) delta_rows = 1; while (num_rows) { if (num_rows < delta_rows) delta_rows = num_rows; for (i = 0; i < num_cols; i++) { SLtype datatype = ci[i].datatype; int type = ci[i].type; long repeat = ci[i].repeat; int col = cols[i]; SLang_Array_Type *at = data_arrays[i]; unsigned int data_offset = ci[i].data_offset; if (datatype == SLANG_STRING_TYPE) { /* This assumes an ASCII_TBL, which will always have a * repeat of 1, and the number of bytes is given by the * width field. In contrast, a BINARY_TBL will have * repeat = number of bytes, and width represents the * number of bytes in a substring. */ if ((repeat == 1) && (ci[i].width != 1)) repeat = ci[i].width; status = read_string_column_data (f, (type < 0), repeat, col, firstrow, delta_rows, (char **)at->data + data_offset); data_offset += delta_rows; } else if (type < 0) { status = read_var_column_data (f, -type, datatype, col, firstrow, delta_rows, (SLang_Array_Type **)at->data + data_offset); data_offset += delta_rows; } else { unsigned int num_elements = repeat * delta_rows; unsigned char *data = (unsigned char *)at->data + data_offset; /* int anynul; */ if (type == TBIT) status = read_bit_column (f, col, firstrow, 1, num_elements, data, at->sizeof_type); else (void) fits_read_col (f, type, col, firstrow, 1, num_elements, NULL, data, NULL, &status); data_offset += num_elements * at->sizeof_type; } ci[i].data_offset = data_offset; if (status) goto free_and_return_status; } firstrow += delta_rows; num_rows -= delta_rows; } if (status) return status; if (-1 == SLang_assign_to_ref (ref, SLANG_ARRAY_TYPE, (VOID_STAR)&data_arrays_at)) status = -1; /* drop */ free_and_return_status: SLfree ((char *)ci); SLang_free_mmt (mmt); SLang_free_array (columns_at); SLang_free_ref (ref); SLang_free_array (data_arrays_at); return status; } static void clear_errmsg (void) { fits_clear_errmsg (); } static void get_errstatus (int *status) { char errbuf [FLEN_ERRMSG]; *errbuf = 0; fits_get_errstatus (*status, errbuf); (void) SLang_push_string (errbuf); } static void read_errmsg (void) { char errbuf [FLEN_ERRMSG]; if (0 == fits_read_errmsg (errbuf)) (void) SLang_push_null (); else (void) SLang_push_string (errbuf); } static int get_num_keys (FitsFile_Type *f, SLang_Ref_Type *ref) { int status = 0; int nkeys; if (f->fptr == NULL) return -1; if (0 == fits_get_hdrspace (f->fptr, &nkeys, NULL, &status)) return SLang_assign_to_ref (ref, SLANG_INT_TYPE, (VOID_STAR) &nkeys); return status; } static int get_keytype (FitsFile_Type *f, char *name, SLang_Ref_Type *v) { int status = 0; int type; if (f->fptr == NULL) return -1; if (0 == (status = do_get_keytype (f->fptr, name, &type))) return SLang_assign_to_ref (v, SLANG_DATATYPE_TYPE, (VOID_STAR) &type); return status; } #if 0 static int _read_key_n (FitsFile_Type *f, SLang_Ref_Type *v, SLang_Ref_Type *c) { int status = 0; if (fits_get_keytype (card, &type, &status)) return status; switch (type) { case 'C': /* string */ break; case 'L': /* logical */ break; case 'I': /* integer */ break; case 'F': /* floating point */ break; case 'X': /* complex */ break; } } #endif static void get_version (void) { float v; (void) fits_get_version (&v); (void) SLang_push_float (v); } static int get_keyclass (char *card) { return fits_get_keyclass (card); } static int do_fits_fun_f(int (*fun)(fitsfile *, int *), FitsFile_Type *f) { int status = 0; if (f->fptr == NULL) return -1; (void) (*fun) (f->fptr, &status); return status; } static int write_chksum (FitsFile_Type *f) { return do_fits_fun_f (fits_write_chksum, f); } static int update_chksum (FitsFile_Type *f) { return do_fits_fun_f (fits_update_chksum, f); } static int verify_chksum (FitsFile_Type *f, SLang_Ref_Type *dataok, SLang_Ref_Type *hduok) { int status = 0; int dok=0, hok=0; if (f->fptr == NULL) return -1; if (0 == fits_verify_chksum (f->fptr, &dok, &hok, &status)) { if ((-1 == SLang_assign_to_ref (dataok, SLANG_INT_TYPE, (VOID_STAR)&dok)) || (-1 == SLang_assign_to_ref (hduok, SLANG_INT_TYPE, (VOID_STAR)&hok))) status = -1; } return status; } static int get_chksum (FitsFile_Type *f, SLang_Ref_Type *datasum, SLang_Ref_Type *hdusum) { int status = 0; unsigned long dsum, hsum; if (0 == fits_get_chksum (f->fptr, &dsum, &hsum, &status)) { if ((-1 == SLang_assign_to_ref (datasum, SLANG_ULONG_TYPE, (VOID_STAR)&dsum)) || (-1 == SLang_assign_to_ref (hdusum, SLANG_ULONG_TYPE, (VOID_STAR)&hsum))) status = -1; } return status; } /* DUMMY_FITS_FILE_TYPE is a temporary hack that will be modified to the true * id once the interpreter provides it when the class is registered. See below * for details. The reason for this is simple: for a module, the type-id * must be assigned dynamically. */ #define DUMMY_FITS_FILE_TYPE 255 #define I SLANG_INT_TYPE #define S SLANG_STRING_TYPE #define F DUMMY_FITS_FILE_TYPE #define R SLANG_REF_TYPE #define A SLANG_ARRAY_TYPE #define T SLANG_DATATYPE_TYPE static SLang_Intrin_Fun_Type Fits_Intrinsics [] = { MAKE_INTRINSIC_0("_fits_clear_errmsg", clear_errmsg, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("_fits_read_errmsg", read_errmsg, SLANG_VOID_TYPE), MAKE_INTRINSIC_I("_fits_get_errstatus", get_errstatus, SLANG_VOID_TYPE), MAKE_INTRINSIC_3("_fits_open_file", open_file, I, R, S, S), MAKE_INTRINSIC_1("_fits_delete_file", delete_file, I, F), MAKE_INTRINSIC_1("_fits_close_file", close_file, SLANG_INT_TYPE, F), /* HDU Access Routines */ MAKE_INTRINSIC_2("_fits_movabs_hdu", movabs_hdu, I, F, I), MAKE_INTRINSIC_2("_fits_movrel_hdu", movrel_hdu, I, F, I), MAKE_INTRINSIC_4("_fits_movnam_hdu", movnam_hdu, I, F, I, S, I), MAKE_INTRINSIC_2("_fits_get_num_hdus", get_num_hdus, I, F, R), MAKE_INTRINSIC_1("_fits_get_hdu_num", get_hdu_num, I, F), MAKE_INTRINSIC_2("_fits_get_hdu_type", get_hdu_type, I, F, R), MAKE_INTRINSIC_5("_fits_copy_file", copy_file, I, F, F, I, I, I), MAKE_INTRINSIC_3("_fits_copy_hdu", copy_hdu, I, F, F, I), MAKE_INTRINSIC_2("_fits_copy_header", copy_header, I, F, F), MAKE_INTRINSIC_1("_fits_delete_hdu", delete_hdu, I, F), MAKE_INTRINSIC_3("_fits_create_img", create_img, I, F, I, A), MAKE_INTRINSIC_2("_fits_write_img", write_img, I, F, A), MAKE_INTRINSIC_2("_fits_read_img", read_img, I, F, R), /* Keword Writing Routines */ MAKE_INTRINSIC_0("_fits_create_binary_tbl", create_binary_tbl, I), MAKE_INTRINSIC_0("_fits_update_key", update_key, I), MAKE_INTRINSIC_0("_fits_update_logical", update_logical, I), MAKE_INTRINSIC_2("_fits_write_comment", write_comment, I, F, S), MAKE_INTRINSIC_2("_fits_write_history", write_history, I, F, S), MAKE_INTRINSIC_1("_fits_write_date", write_date, I, F), MAKE_INTRINSIC_2("_fits_write_record", &write_record, I, F, S), MAKE_INTRINSIC_3("_fits_insert_record", &insert_record, I, F, I, S), MAKE_INTRINSIC_3("_fits_modify_name", modify_name, I, F, S, S), MAKE_INTRINSIC_2("_fits_get_num_keys", get_num_keys, I, F, R), MAKE_INTRINSIC_0("_fits_read_key_integer", read_key_integer, I), MAKE_INTRINSIC_0("_fits_read_key_string", read_key_string, I), MAKE_INTRINSIC_0("_fits_read_key_double", read_key_double, I), MAKE_INTRINSIC_0("_fits_read_key", read_generic_key, I), MAKE_INTRINSIC_3("_fits_read_record", read_record, I, F, I, R), MAKE_INTRINSIC_2("_fits_delete_key", delete_key, I, F, S), MAKE_INTRINSIC_3("_fits_get_colnum", get_colnum, I, F, S, R), MAKE_INTRINSIC_3("_fits_insert_rows", insert_rows, I, F, I, I), MAKE_INTRINSIC_3("_fits_delete_rows", delete_rows, I, F, I, I), MAKE_INTRINSIC_4("_fits_insert_cols", insert_cols, I, F, I, A, A), MAKE_INTRINSIC_2("_fits_delete_col", delete_col, I, F, I), MAKE_INTRINSIC_2("_fits_get_num_cols", get_num_cols, I, F, R), MAKE_INTRINSIC_2("_fits_get_rowsize", get_rowsize, I, F, R), MAKE_INTRINSIC_2("_fits_get_num_rows", get_num_rows, I, F, R), MAKE_INTRINSIC_5("_fits_write_col", write_col, I, F, I, I, I, A), MAKE_INTRINSIC_5("_fits_read_col", read_col, I, F, I, I, I, R), MAKE_INTRINSIC_3("_fits_get_keytype", get_keytype, I, F, S, R), MAKE_INTRINSIC_1("_fits_get_keyclass", get_keyclass, I, S), MAKE_INTRINSIC_0("_fits_read_cols", read_cols, I), /* checksum routines */ MAKE_INTRINSIC_1("_fits_write_chksum", write_chksum, I, F), MAKE_INTRINSIC_1("_fits_update_chksum", update_chksum, I, F), MAKE_INTRINSIC_3("_fits_verify_chksum", verify_chksum, I, F, R, R), MAKE_INTRINSIC_3("_fits_get_chksum", get_chksum, I, F, R, R), MAKE_INTRINSIC_0("_fits_get_version", get_version, SLANG_VOID_TYPE), SLANG_END_INTRIN_FUN_TABLE }; static SLang_IConstant_Type IConst_Table [] = { MAKE_ICONSTANT("_FITS_BINARY_TBL", BINARY_TBL), MAKE_ICONSTANT("_FITS_ASCII_TBL", ASCII_TBL), MAKE_ICONSTANT("_FITS_IMAGE_HDU", IMAGE_HDU), MAKE_ICONSTANT("_FITS_SAME_FILE", SAME_FILE), MAKE_ICONSTANT("_FITS_TOO_MANY_FILES", TOO_MANY_FILES), MAKE_ICONSTANT("_FITS_FILE_NOT_OPENED", FILE_NOT_OPENED), MAKE_ICONSTANT("_FITS_FILE_NOT_CREATED", FILE_NOT_CREATED), MAKE_ICONSTANT("_FITS_WRITE_ERROR", WRITE_ERROR), MAKE_ICONSTANT("_FITS_END_OF_FILE", END_OF_FILE), MAKE_ICONSTANT("_FITS_READ_ERROR", READ_ERROR), MAKE_ICONSTANT("_FITS_FILE_NOT_CLOSED", FILE_NOT_CLOSED), MAKE_ICONSTANT("_FITS_ARRAY_TOO_BIG", ARRAY_TOO_BIG), MAKE_ICONSTANT("_FITS_READONLY_FILE", READONLY_FILE), MAKE_ICONSTANT("_FITS_MEMORY_ALLOCATION", MEMORY_ALLOCATION), MAKE_ICONSTANT("_FITS_BAD_FILEPTR", BAD_FILEPTR), MAKE_ICONSTANT("_FITS_NULL_INPUT_PTR", NULL_INPUT_PTR), MAKE_ICONSTANT("_FITS_SEEK_ERROR", SEEK_ERROR), MAKE_ICONSTANT("_FITS_BAD_URL_PREFIX", BAD_URL_PREFIX), MAKE_ICONSTANT("_FITS_TOO_MANY_DRIVERS", TOO_MANY_DRIVERS), MAKE_ICONSTANT("_FITS_DRIVER_INIT_FAILED", DRIVER_INIT_FAILED), MAKE_ICONSTANT("_FITS_NO_MATCHING_DRIVER", NO_MATCHING_DRIVER), MAKE_ICONSTANT("_FITS_URL_PARSE_ERROR", URL_PARSE_ERROR), MAKE_ICONSTANT("_FITS_HEADER_NOT_EMPTY", HEADER_NOT_EMPTY), MAKE_ICONSTANT("_FITS_KEY_NO_EXIST", KEY_NO_EXIST), MAKE_ICONSTANT("_FITS_KEY_OUT_BOUNDS", KEY_OUT_BOUNDS), MAKE_ICONSTANT("_FITS_VALUE_UNDEFINED", VALUE_UNDEFINED), MAKE_ICONSTANT("_FITS_NO_QUOTE", NO_QUOTE), MAKE_ICONSTANT("_FITS_BAD_KEYCHAR", BAD_KEYCHAR), MAKE_ICONSTANT("_FITS_BAD_ORDER", BAD_ORDER), MAKE_ICONSTANT("_FITS_NOT_POS_INT", NOT_POS_INT), MAKE_ICONSTANT("_FITS_NO_END", NO_END), MAKE_ICONSTANT("_FITS_BAD_BITPIX", BAD_BITPIX), MAKE_ICONSTANT("_FITS_BAD_NAXIS", BAD_NAXIS), MAKE_ICONSTANT("_FITS_BAD_NAXES", BAD_NAXES), MAKE_ICONSTANT("_FITS_BAD_PCOUNT", BAD_PCOUNT), MAKE_ICONSTANT("_FITS_BAD_GCOUNT", BAD_GCOUNT), MAKE_ICONSTANT("_FITS_BAD_TFIELDS", BAD_TFIELDS), MAKE_ICONSTANT("_FITS_NEG_WIDTH", NEG_WIDTH), MAKE_ICONSTANT("_FITS_NEG_ROWS", NEG_ROWS), MAKE_ICONSTANT("_FITS_COL_NOT_FOUND", COL_NOT_FOUND), MAKE_ICONSTANT("_FITS_BAD_SIMPLE", BAD_SIMPLE), MAKE_ICONSTANT("_FITS_NO_SIMPLE", NO_SIMPLE), MAKE_ICONSTANT("_FITS_NO_BITPIX", NO_BITPIX), MAKE_ICONSTANT("_FITS_NO_NAXIS", NO_NAXIS), MAKE_ICONSTANT("_FITS_NO_NAXES", NO_NAXES), MAKE_ICONSTANT("_FITS_NO_XTENSION", NO_XTENSION), MAKE_ICONSTANT("_FITS_NOT_ATABLE", NOT_ATABLE), MAKE_ICONSTANT("_FITS_NOT_BTABLE", NOT_BTABLE), MAKE_ICONSTANT("_FITS_NO_PCOUNT", NO_PCOUNT), MAKE_ICONSTANT("_FITS_NO_GCOUNT", NO_GCOUNT), MAKE_ICONSTANT("_FITS_NO_TFIELDS", NO_TFIELDS), MAKE_ICONSTANT("_FITS_NO_TBCOL", NO_TBCOL), MAKE_ICONSTANT("_FITS_NO_TFORM", NO_TFORM), MAKE_ICONSTANT("_FITS_NOT_IMAGE", NOT_IMAGE), MAKE_ICONSTANT("_FITS_BAD_TBCOL", BAD_TBCOL), MAKE_ICONSTANT("_FITS_NOT_TABLE", NOT_TABLE), MAKE_ICONSTANT("_FITS_COL_TOO_WIDE", COL_TOO_WIDE), MAKE_ICONSTANT("_FITS_COL_NOT_UNIQUE", COL_NOT_UNIQUE), MAKE_ICONSTANT("_FITS_BAD_ROW_WIDTH", BAD_ROW_WIDTH), MAKE_ICONSTANT("_FITS_UNKNOWN_EXT", UNKNOWN_EXT), MAKE_ICONSTANT("_FITS_UNKNOWN_REC", UNKNOWN_REC), MAKE_ICONSTANT("_FITS_END_JUNK", END_JUNK), MAKE_ICONSTANT("_FITS_BAD_HEADER_FILL", BAD_HEADER_FILL), MAKE_ICONSTANT("_FITS_BAD_DATA_FILL", BAD_DATA_FILL), MAKE_ICONSTANT("_FITS_BAD_TFORM", BAD_TFORM), MAKE_ICONSTANT("_FITS_BAD_TFORM_DTYPE", BAD_TFORM_DTYPE), MAKE_ICONSTANT("_FITS_BAD_TDIM", BAD_TDIM), MAKE_ICONSTANT("_FITS_BAD_HDU_NUM", BAD_HDU_NUM), MAKE_ICONSTANT("_FITS_BAD_COL_NUM", BAD_COL_NUM), MAKE_ICONSTANT("_FITS_NEG_FILE_POS", NEG_FILE_POS), MAKE_ICONSTANT("_FITS_NEG_BYTES", NEG_BYTES), MAKE_ICONSTANT("_FITS_BAD_ROW_NUM", BAD_ROW_NUM), MAKE_ICONSTANT("_FITS_BAD_ELEM_NUM", BAD_ELEM_NUM), MAKE_ICONSTANT("_FITS_NOT_ASCII_COL", NOT_ASCII_COL), MAKE_ICONSTANT("_FITS_NOT_LOGICAL_COL", NOT_LOGICAL_COL), MAKE_ICONSTANT("_FITS_BAD_ATABLE_FORMAT", BAD_ATABLE_FORMAT), MAKE_ICONSTANT("_FITS_BAD_BTABLE_FORMAT", BAD_BTABLE_FORMAT), MAKE_ICONSTANT("_FITS_NO_NULL", NO_NULL), MAKE_ICONSTANT("_FITS_NOT_VARI_LEN", NOT_VARI_LEN), MAKE_ICONSTANT("_FITS_BAD_DIMEN", BAD_DIMEN), MAKE_ICONSTANT("_FITS_BAD_PIX_NUM", BAD_PIX_NUM), MAKE_ICONSTANT("_FITS_ZERO_SCALE", ZERO_SCALE), MAKE_ICONSTANT("_FITS_NEG_AXIS", NEG_AXIS), /* get_keyclass return value */ MAKE_ICONSTANT("_FITS_TYP_STRUC_KEY",TYP_STRUC_KEY), MAKE_ICONSTANT("_FITS_TYP_CMPRS_KEY",TYP_CMPRS_KEY), MAKE_ICONSTANT("_FITS_TYP_SCAL_KEY", TYP_SCAL_KEY), MAKE_ICONSTANT("_FITS_TYP_NULL_KEY", TYP_NULL_KEY), MAKE_ICONSTANT("_FITS_TYP_DIM_KEY", TYP_DIM_KEY), MAKE_ICONSTANT("_FITS_TYP_RANG_KEY", TYP_RANG_KEY), MAKE_ICONSTANT("_FITS_TYP_UNIT_KEY", TYP_UNIT_KEY), MAKE_ICONSTANT("_FITS_TYP_DISP_KEY", TYP_DISP_KEY), MAKE_ICONSTANT("_FITS_TYP_HDUID_KEY",TYP_HDUID_KEY), MAKE_ICONSTANT("_FITS_TYP_CKSUM_KEY",TYP_CKSUM_KEY), MAKE_ICONSTANT("_FITS_TYP_WCS_KEY", TYP_WCS_KEY), MAKE_ICONSTANT("_FITS_TYP_REFSYS_KEY",TYP_REFSYS_KEY), MAKE_ICONSTANT("_FITS_TYP_COMM_KEY", TYP_COMM_KEY), MAKE_ICONSTANT("_FITS_TYP_CONT_KEY", TYP_CONT_KEY), MAKE_ICONSTANT("_FITS_TYP_USER_KEY", TYP_USER_KEY), MAKE_ICONSTANT("_cfitsio_module_version", MODULE_VERSION_NUMBER), SLANG_END_ICONST_TABLE }; static SLang_Intrin_Var_Type Intrin_Vars[] = { MAKE_VARIABLE("_cfitsio_module_version_string", &Module_Version_String, SLANG_STRING_TYPE, 1), SLANG_END_INTRIN_VAR_TABLE }; static void patchup_intrinsic_table (void) { SLang_Intrin_Fun_Type *f; f = Fits_Intrinsics; while (f->name != NULL) { unsigned int i, nargs; SLtype *args; nargs = f->num_args; args = f->arg_types; for (i = 0; i < nargs; i++) { if (args[i] == DUMMY_FITS_FILE_TYPE) args[i] = Fits_Type_Id; } /* For completeness */ if (f->return_type == DUMMY_FITS_FILE_TYPE) f->return_type = Fits_Type_Id; f++; } } static void free_fits_file_type (SLtype type, VOID_STAR f) { FitsFile_Type *ft; int status = 0; (void) type; ft = (FitsFile_Type *) f; if (ft->fptr != NULL) fits_close_file (ft->fptr, &status); SLfree ((char *) ft); } static int check_version (void) { float compiled_version = 0; float linked_version = 0; float tol = 0.0001; #ifdef CFITSIO_VERSION compiled_version = CFITSIO_VERSION; (void) fits_get_version (&linked_version); #endif if (fabs (linked_version - compiled_version) <= tol) return 0; fprintf (stderr, "\n\ ***WARNING: The version of CFITSIO that this module is linked against (%g)\n\ is not the same as the version it was compiled against (%g).\n\ As the CFITSIO developers make no guarantees of binary compatibility,\n\ you may experience problems with this module. You are stongly urged to\n\ recompile the module.\n\n\ ", linked_version, compiled_version); return -1; } int init_cfitsio_module_ns (char *ns_name) { SLang_NameSpace_Type *ns; ns = SLns_create_namespace (ns_name); if (ns == NULL) return -1; if (Fits_Type_Id == 0) { SLang_Class_Type *cl; (void) check_version (); cl = SLclass_allocate_class ("Fits_File_Type"); if (cl == NULL) return -1; (void) SLclass_set_destroy_function (cl, free_fits_file_type); /* By registering as SLANG_VOID_TYPE, slang will dynamically allocate a * type. */ if (-1 == SLclass_register_class (cl, SLANG_VOID_TYPE, sizeof (FitsFile_Type), SLANG_CLASS_TYPE_MMT)) return -1; Fits_Type_Id = SLclass_get_class_id (cl); patchup_intrinsic_table (); } if (-1 == SLns_add_intrin_fun_table (ns, Fits_Intrinsics, "__CFITSIO__")) return -1; if (-1 == SLns_add_iconstant_table (ns, IConst_Table, NULL)) return -1; if (-1 == SLns_add_intrin_var_table (ns, Intrin_Vars, NULL)) return -1; return 0; } slcfitsio-0.3.8/src/config.hin0000644002657400265740000000042410054700047015276 0ustar davisdavis/* -*- c -*- */ /* Define this if have stdlib.h */ #undef HAVE_STDLIB_H /* Define this if you have unistd.h */ #undef HAVE_UNISTD_H /* Set these to the appropriate values */ #undef SIZEOF_SHORT #undef SIZEOF_INT #undef SIZEOF_LONG #undef SIZEOF_FLOAT #undef SIZEOF_DOUBLE slcfitsio-0.3.8/src/mkversion.sh0000755002657400265740000000034410220064357015710 0ustar davisdavis#version 1.0 # The initial echo is necessary because the solaris version of sed cannot # grok input without a trailing newline. echo `grep "^#define MODULE_[MP]" version.h | sed -e 's/[^0-9]*//' | tr '\012' .` | sed -e 's/.$//' slcfitsio-0.3.8/src/version.h0000644002657400265740000000057510611753762015211 0ustar davisdavis#define MODULE_MAJOR_VERSION 0 #define MODULE_MINOR_VERSION 3 #define MODULE_PATCH_LEVEL 8 #define MKSTR1(x) #x #define MKSTR(x) MKSTR1(x) static char *Module_Version_String = MKSTR(MODULE_MAJOR_VERSION) "." \ MKSTR(MODULE_MINOR_VERSION) "." MKSTR(MODULE_PATCH_LEVEL); #define MODULE_VERSION_NUMBER \ (MODULE_MAJOR_VERSION*10000+MODULE_MINOR_VERSION*100+MODULE_PATCH_LEVEL) slcfitsio-0.3.8/src/cfitsio.sl0000644002657400265740000000002410145314557015335 0ustar davisdavisimport ("cfitsio"); slcfitsio-0.3.8/INSTALL.txt0000644002657400265740000001712310602532746014425 0ustar davisdavisSee the README file before reading this. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. slcfitsio-0.3.8/autoconf/0000755002657400265740000000000010621347550014366 5ustar davisdavisslcfitsio-0.3.8/autoconf/Makefile.in0000644002657400265740000000114610330235626016432 0ustar davisdavis# -*- sh -*- @SET_MAKE@ SHELL = /bin/sh all: cd src; $(MAKE) all clean: /bin/rm -f *~ \#* cd src; $(MAKE) clean distclean: clean cd src; $(MAKE) distclean install: cd src; $(MAKE) install # # These targets are used by the maintainer # configure: autoconf/aclocal.m4 autoconf/configure.in cd autoconf && autoconf && mv ./configure .. update: autoconf/config.sub autoconf/config.guess autoconf/config.guess: /usr/share/misc/config.guess /bin/cp -f /usr/share/misc/config.guess autoconf/config.guess autoconf/config.sub: /usr/share/misc/config.sub /bin/cp -f /usr/share/misc/config.sub autoconf/config.sub slcfitsio-0.3.8/autoconf/configure.in0000644002657400265740000000231210330235626016672 0ustar davisdavisdnl -*- sh -*- AC_INIT(src/cfitsio-module.c) AC_PREFIX_DEFAULT(/usr/local) AC_CONFIG_AUX_DIR(autoconf) AC_CANONICAL_HOST AC_PROG_RANLIB AC_PROG_INSTALL AC_PROG_MAKE_SET JD_INIT JD_ANSI_CC JD_ELF_COMPILER JD_IEEE_CFLAGS AC_PATH_XTRA dnl# JD_FIND_GENERIC(slang) JD_WITH_LIBRARY(slang) JD_WITH_LIBRARY(cfitsio, fitsio.h) JD_SLANG_MODULE_INSTALL_DIR dnl Check these header since they cause trouble AC_CHECK_HEADERS( \ stdlib.h \ unistd.h \ ) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(float, 4) AC_CHECK_SIZEOF(double, 8) dnl #JD_SET_RPATH($libdir) ELF_CFLAGS="$ELF_CFLAGS $IEEE_CFLAGS" CFLAGS="$CFLAGS $IEEE_CFLAGS" AC_CONFIG_HEADER(src/config.h:src/config.hin) AC_OUTPUT(Makefile:autoconf/Makefile.in src/Makefile) echo "" echo "You are compiling with the following compiler configuration:" echo " CC =" "$CC" echo " CC_SHARED =" "$CC_SHARED" echo " CFLAGS =" "$CFLAGS" echo " LDFLAGS =" "$LDFLAGS" "$DYNAMIC_LINK_FLAGS" echo "" echo "The modules will be installed in $MODULE_INSTALL_DIR." echo "Any associated .sl files will be install in $SL_FILES_INSTALL_DIR" echo "" echo "If any of these quantities are incorrect, edit src/Makefile accordingly." echo "" slcfitsio-0.3.8/autoconf/mkinsdir.sh0000755002657400265740000000113610054700047016540 0ustar davisdavis#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d in ${1+"$@"} ; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" || errstatus=$? fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here slcfitsio-0.3.8/autoconf/config.guess0000755002657400265740000012546610330235626016721 0ustar davisdavis#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-04-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 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # 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 -q "$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 ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amd64:OpenBSD:*:*) echo x86_64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; luna88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit 0 ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit 0 ;; *:OS400:*:*) echo powerpc-ibm-os400 exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; 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 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -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 # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; 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 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; amd64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 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 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit 0 ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms && exit 0 ;; I*) echo ia64-dec-vms && exit 0 ;; V*) echo vax-dec-vms && exit 0 ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: slcfitsio-0.3.8/autoconf/config.sub0000755002657400265740000007547010330235626016363 0ustar davisdavis#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-04-22' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | msp430-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # 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* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: slcfitsio-0.3.8/autoconf/aclocal.m40000644002657400265740000005674610602533163016244 0ustar davisdavisdnl# -*- mode: sh; mode: fold -*- dnl# Version 0.1.10: rpath support for netbsd dnl# Version 0.1.9: When searching for libs, use dylib on darwin dnl# Version 0.1.8: Add rpath support for OpenBSD dnl# Version 0.1.7: removed "-K pic" from IRIX compiler lines dnl# Version 0.1.6: Added cygwin module support dnl# Version 0.1.5: Added gcc version-script support. dnl# AC_DEFUN(JD_INIT, dnl#{{{ [ #These variable are initialized by JD init function CONFIG_DIR=`pwd` cd $srcdir if test "`pwd`" != "$CONFIG_DIR" then AC_MSG_ERROR("This software does not support configuring from another directory. See the INSTALL file") fi dnl# if test "X$PWD" != "X" dnl# then dnl# CONFIG_DIR="$PWD" dnl# fi AC_SUBST(CONFIG_DIR)dnl # Note: these will differ if one is a symbolic link if test -f /usr/bin/dirname; then JD_Above_Dir=`dirname $CONFIG_DIR` else # system is a loser JD_Above_Dir=`cd ..;pwd` fi JD_Above_Dir2=`cd ..;pwd` ]) dnl#}}} dnl# This function expand the "prefix variables. For example, it will expand dnl# values such as ${exec_prefix}/foo when ${exec_prefix} itself has a dnl# of ${prefix}. This function produces the shell variables: dnl# jd_prefix_libdir, jd_prefix_incdir AC_DEFUN(JD_EXPAND_PREFIX, dnl#{{{ [ if test "X$jd_prefix" = "X" then jd_prefix=$ac_default_prefix if test "X$prefix" != "XNONE" then jd_prefix="$prefix" fi jd_exec_prefix="$jd_prefix" if test "X$exec_prefix" != "XNONE" then jd_exec_prefix="$exec_prefix" fi dnl#Unfortunately, exec_prefix may have a value like ${prefix}, etc. dnl#Let the shell expand those. Yuk. eval `sh <>)dnl define(<<$2>>, translit($1, [a-z], [A-Z]))dnl changequote([, ])dnl ]) #}}} AC_DEFUN(JD_SIMPLE_LIB_DIR, dnl#{{{ [ JD_UPPERCASE($1,JD_UP_NAME) JD_UP_NAME[]_LIB_DIR=$JD_Above_Dir/$1/libsrc/"$ARCH"objs JD_UP_NAME[]_INCLUDE=$JD_Above_Dir/$1/libsrc if test ! -d "[$]JD_UP_NAME[]_INCLUDE" then JD_UP_NAME[]_LIB_DIR=$JD_Above_Dir/$1/src/"$ARCH"objs JD_UP_NAME[]_INCLUDE=$JD_Above_Dir/$1/src if test ! -d "[$]JD_UP_NAME[]_INCLUDE" then echo "" echo WARNING------Unable to find the JD_UP_NAME directory echo You may have to edit $CONFIG_DIR/src/Makefile. echo "" fi fi AC_SUBST(JD_UP_NAME[]_LIB_DIR)dnl AC_SUBST(JD_UP_NAME[]_INCLUDE)dnl undefine([JD_UP_NAME])dnl ]) dnl#}}} AC_DEFUN(JD_FIND_GENERIC, dnl#{{{ [ AC_REQUIRE([JD_EXPAND_PREFIX])dnl changequote(<<, >>)dnl define(<>, translit($1, [a-z], [A-Z]))dnl changequote([, ])dnl # Look for the JD_UP_NAME package #JD_UP_NAME[]_INCLUDE="" #JD_UP_NAME[]_LIB_DIR="" # This list consists of "include,lib include,lib ..." JD_Search_Dirs="$JD_Above_Dir2/$1/libsrc,$JD_Above_Dir2/$1/libsrc/"$ARCH"objs \ $JD_Above_Dir/$1/libsrc,$JD_Above_Dir/$1/libsrc/"$ARCH"objs \ $JD_Above_Dir2/$1/src,$JD_Above_Dir2/$1/src/"$ARCH"objs \ $JD_Above_Dir/$1/src,$JD_Above_Dir/$1/src/"$ARCH"objs" JD_Search_Dirs="$JD_Search_Dirs \ $jd_prefix_incdir,$jd_prefix_libdir \ $HOME/include,$HOME/lib" if test -n "$ARCH" then JD_Search_Dirs="$JD_Search_Dirs $HOME/include,$HOME/$ARCH/lib" JD_Search_Dirs="$JD_Search_Dirs $HOME/include,$HOME/sys/$ARCH/lib" fi # Now add the standard system includes. The reason for doing this is that # the other directories may have a better chance of containing a more recent # version. JD_Search_Dirs="$JD_Search_Dirs \ /usr/local/include,/usr/local/lib \ /usr/include,/usr/lib \ /usr/include/$1,/usr/lib \ /usr/include/$1,/usr/lib/$1" echo looking for the JD_UP_NAME library for include_and_lib in $JD_Search_Dirs do # Yuk. Is there a better way to set these variables?? generic_include=`echo $include_and_lib | tr ',' ' ' | awk '{print [$]1}'` generic_lib=`echo $include_and_lib | tr ',' ' ' | awk '{print [$]2}'` echo Looking for $1.h in $generic_include echo and lib$1.a in $generic_lib if test -r $generic_include/$1.h && test -r $generic_lib/lib$1.a then echo Found it. JD_UP_NAME[]_LIB_DIR="$generic_lib" JD_UP_NAME[]_INCLUDE="$generic_include" break else if test -r $generic_include/$1.h && test -r $generic_lib/lib$1.so then echo Found it. JD_UP_NAME[]_LIB_DIR="$generic_lib" JD_UP_NAME[]_INCLUDE="$generic_include" break fi fi done if test -n "[$]JD_UP_NAME[]_LIB_DIR" then jd_have_$1="yes" else echo Unable to find the $JD_UP_NAME library. echo You may have to edit $CONFIG_DIR/src/Makefile. JD_UP_NAME[]_INCLUDE=$JD_Above_Dir/$1/src JD_UP_NAME[]_LIB_DIR=$JD_Above_Dir/$1/src/"$ARCH"objs jd_have_$1="no" fi JD_UP_NAME[]_INC="-I[$]JD_UP_NAME[]_INCLUDE" JD_UP_NAME[]_LIB="-L[$]JD_UP_NAME[]_LIB_DIR" JD_SET_RPATH([$]JD_UP_NAME[]_LIB_DIR) dnl if test "X$GCC" = Xyes dnl then dnl RPATH_[]JD_UP_NAME="-Wl,-R[$]JD_UP_NAME[]_LIB_DIR" dnl else dnl RPATH_[]JD_UP_NAME="-R[$]JD_UP_NAME[]_LIB_DIR" dnl fi # gcc under solaris is often not installed correctly. Avoid specifying # -I/usr/include. if test "[$]JD_UP_NAME[]_INC" = "-I/usr/include" then JD_UP_NAME[]_INC="" fi if test "[$]JD_UP_NAME[]_LIB" = "-L/usr/lib" then JD_UP_NAME[]_LIB="" RPATH_[]JD_UP_NAME="" fi AC_SUBST(JD_UP_NAME[]_LIB)dnl AC_SUBST(JD_UP_NAME[]_INC)dnl AC_SUBST(JD_UP_NAME[]_LIB_DIR)dnl AC_SUBST(JD_UP_NAME[]_INCLUDE)dnl dnl AC_SUBST(RPATH_[]JD_UP_NAME)dnl undefine([JD_UP_NAME])dnl ]) dnl#}}} AC_DEFUN(JD_FIND_SLANG, dnl#{{{ [ JD_FIND_GENERIC(slang) ]) dnl#}}} AC_DEFUN(JD_GCC_WARNINGS, dnl#{{{ [ AC_ARG_ENABLE(warnings, [ --enable-warnings turn on GCC compiler warnings], [gcc_warnings=$enableval]) if test -n "$GCC" then #CFLAGS="$CFLAGS -fno-strength-reduce" if test -n "$gcc_warnings" then CFLAGS="$CFLAGS -Wall -W -pedantic -Winline -Wmissing-prototypes \ -Wnested-externs -Wpointer-arith -Wcast-align -Wshadow -Wstrict-prototypes" # Now trim excess whitespace CFLAGS=`echo $CFLAGS` fi fi ]) dnl#}}} IEEE_CFLAGS="" AC_DEFUN(JD_IEEE_CFLAGS, dnl#{{{ [ case "$host_cpu" in *alpha* ) if test "$GCC" = yes then IEEE_CFLAGS="-mieee" else IEEE_CFLAGS="-ieee_with_no_inexact" fi ;; * ) IEEE_CFLAGS="" esac ]) dnl#}}} AC_DEFUN(JD_CREATE_ORULE, dnl#{{{ [ PROGRAM_OBJECT_RULES="$PROGRAM_OBJECT_RULES \$(OBJDIR)/$1.o : \$(SRCDIR)/$1.c \$(DOT_O_DEPS) \$("$1"_O_DEP) cd \$(OBJDIR); \$(COMPILE_CMD) \$("$1"_C_FLAGS) \$(SRCDIR)/$1.c " ]) dnl#}}} AC_DEFUN(JD_CREATE_ELFORULE, dnl#{{{ [ PROGRAM_ELF_ORULES="$PROGRAM_ELF_ORULES \$(ELFDIR)/$1.o : \$(SRCDIR)/$1.c \$(DOT_O_DEPS) \$("$1"_O_DEP) cd \$(ELFDIR); \$(ELFCOMPILE_CMD) \$("$1"_C_FLAGS) \$(SRCDIR)/$1.c " ]) dnl#}}} AC_DEFUN(JD_CREATE_EXEC_RULE, dnl#{{{ [ PROGRAM_OBJECT_RULES="$PROGRAM_OBJECT_RULES $1 : \$(OBJDIR)/$1 @echo $1 created in \$(OBJDIR) \$(OBJDIR)/$1 : \$(OBJDIR)/$1.o \$("$1"_DEPS) \$(EXECDEPS) \$(CC) -o \$(OBJDIR)/$1 \$(LDFLAGS) \$(OBJDIR)/$1.o \$("$1"_LIBS) \$(EXECLIBS) \$(OBJDIR)/$1.o : \$(SRCDIR)/$1.c \$(DOT_O_DEPS) \$("$1"_O_DEP) cd \$(OBJDIR); \$(COMPILE_CMD) \$("$1"_INC) \$(EXECINC) \$(SRCDIR)/$1.c " ]) dnl#}}} AC_DEFUN(JD_CREATE_MODULE_ORULES, dnl#{{{ [ for program_module in $Program_Modules; do JD_CREATE_ORULE($program_module) JD_CREATE_ELFORULE($program_module) done ]) dnl#}}} AC_DEFUN(JD_GET_MODULES, dnl#{{{ [ PROGRAM_HFILES="" PROGRAM_OFILES="" PROGRAM_CFILES="" PROGRAM_OBJECTS="" PROGRAM_ELFOBJECTS="" PROGRAM_OBJECT_RULES="" PROGRAM_ELF_ORULES="" if test -z "$1" then Program_Modules="" else comment_re="^#" Program_Modules=`grep -v '$comment_re' $1 | awk '{print [$]1}'` Program_H_Modules=`grep -v '$comment_re' $1 | awk '{print [$]2}'` for program_module in $Program_H_Modules; do PROGRAM_HFILES="$PROGRAM_HFILES $program_module" done fi for program_module in $Program_Modules; do PROGRAM_OFILES="$PROGRAM_OFILES $program_module.o" PROGRAM_CFILES="$PROGRAM_CFILES $program_module.c" PROGRAM_OBJECTS="$PROGRAM_OBJECTS \$(OBJDIR)/$program_module.o" PROGRAM_ELFOBJECTS="$PROGRAM_ELFOBJECTS \$(ELFDIR)/$program_module.o" done dnl echo $PROGRAM_OFILES dnl echo $PROGRAM_HFILES AC_SUBST(PROGRAM_OFILES)dnl AC_SUBST(PROGRAM_CFILES)dnl AC_SUBST(PROGRAM_HFILES)dnl AC_SUBST(PROGRAM_OBJECTS)dnl AC_SUBST(PROGRAM_ELFOBJECTS)dnl ]) dnl#}}} AC_DEFUN(JD_APPEND_RULES, dnl#{{{ [ echo "$PROGRAM_OBJECT_RULES" >> $1 ]) dnl#}}} AC_DEFUN(JD_APPEND_ELFRULES, dnl#{{{ [ echo "$PROGRAM_ELF_ORULES" >> $1 ]) dnl#}}} AC_DEFUN(JD_CREATE_MODULE_EXEC_RULES, dnl#{{{ [ for program_module in $Program_Modules; do JD_CREATE_EXEC_RULE($program_module) done ]) dnl#}}} AC_DEFUN(JD_TERMCAP, dnl#{{{ [ AC_MSG_CHECKING(for Terminfo) MISC_TERMINFO_DIRS="$FINKPREFIX/share/terminfo" if test ! -d $MISC_TERMINFO_DIRS then MISC_TERMINFO_DIRS="" fi JD_Terminfo_Dirs="/usr/lib/terminfo \ /usr/share/terminfo \ /usr/share/lib/terminfo \ /usr/local/lib/terminfo \ $MISC_TERMINFO_DIRS" TERMCAP=-ltermcap for terminfo_dir in $JD_Terminfo_Dirs do if test -d $terminfo_dir then AC_MSG_RESULT(yes) TERMCAP="" break fi done if test "$TERMCAP"; then AC_MSG_RESULT(no) AC_DEFINE(USE_TERMCAP) fi AC_SUBST(TERMCAP)dnl AC_SUBST(MISC_TERMINFO_DIRS)dnl ]) dnl#}}} AC_DEFUN(JD_ANSI_CC, dnl#{{{ [ AC_PROG_CC AC_PROG_CPP AC_PROG_GCC_TRADITIONAL AC_ISC_POSIX AC_AIX dnl #This stuff came from Yorick config script dnl dnl # HPUX needs special stuff dnl AC_EGREP_CPP(yes, [#ifdef hpux yes #endif ], [ AC_DEFINE(_HPUX_SOURCE) if test "$CC" = cc; then CC="cc -Ae"; fi ])dnl dnl dnl #Be sure we've found compiler that understands prototypes dnl AC_MSG_CHECKING(C compiler that understands ANSI prototypes) AC_TRY_COMPILE([ ],[ extern int silly (int);], [ AC_MSG_RESULT($CC looks ok. Good.)], [ AC_MSG_RESULT($CC is not a good enough compiler) AC_MSG_ERROR(Set env variable CC to your ANSI compiler and rerun configure.) ])dnl ])dnl dnl#}}} AC_DEFUN(JD_ELF_COMPILER, dnl#{{{ [ dnl #------------------------------------------------------------------------- dnl # Check for dynamic linker dnl #------------------------------------------------------------------------- DYNAMIC_LINK_LIB="" AC_CHECK_HEADER(dlfcn.h,[ AC_DEFINE(HAVE_DLFCN_H) AC_CHECK_LIB(dl,dlopen,[ DYNAMIC_LINK_LIB="-ldl" AC_DEFINE(HAVE_DLOPEN) ],[ AC_CHECK_FUNC(dlopen,AC_DEFINE(HAVE_DLOPEN)) if test "$ac_cv_func_dlopen" != yes then AC_MSG_WARN(cannot perform dynamic linking) fi ])]) AC_SUBST(DYNAMIC_LINK_LIB) ELFLIB="lib\$(THIS_LIB).so" ELFLIB_MAJOR="\$(ELFLIB).\$(ELF_MAJOR_VERSION)" ELFLIB_MAJOR_MINOR="\$(ELFLIB).\$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION)" if test "$GCC" = yes then if test X"$CFLAGS" = X then CFLAGS="-O2" fi fi INSTALL_MODULE="\$(INSTALL_DATA)" case "$host_os" in *linux*|*gnu*|k*bsd*-gnu ) DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED="\$(CC) \$(CFLAGS) -shared -fPIC" ;; *solaris* ) if test "$GCC" = yes then DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-ztext -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED="\$(CC) \$(CFLAGS) -G -fPIC" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -K PIC" ELF_LINK="\$(CC) \$(LDFLAGS) -G -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED="\$(CC) \$(CFLAGS) -G -K PIC" fi ;; # osr5 or unixware7 with current or late autoconf *sco3.2v5* | *unixware-5* | *sco-sysv5uw7*) if test "$GCC" = yes then DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED="\$(CC) \$(CFLAGS) -G -fPIC" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -K pic" # ELF_LINK="ld -G -z text -h#" ELF_LINK="\$(CC) \$(LDFLAGS) -G -z text -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED="\$(CC) \$(CFLAGS) -G -K pic" fi ;; *irix6.5* ) echo "Note: ELF compiler for host_os=$host_os may not be correct" echo "double-check: 'mode_t', 'pid_t' may be wrong!" if test "$GCC" = yes then # not tested DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED="\$(CC) \$(CFLAGS) -shared -fPIC" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS)" # default anyhow ELF_LINK="\$(CC) \$(LDFLAGS) -shared -o \$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED="\$(CC) \$(CFLAGS) -shared" fi ;; *darwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fno-common" ELF_LINK="\$(CC) \$(LDFLAGS) -dynamiclib -install_name \$(install_lib_dir)/\$(ELFLIB_MAJOR) -compatibility_version \$(ELF_MAJOR_VERSION) -current_version \$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION)" ELF_DEP_LIBS="\$(LDFLAGS) \$(DL_LIB)" CC_SHARED="\$(CC) -bundle -flat_namespace -undefined suppress \$(CFLAGS) -fno-common" ELFLIB="lib\$(THIS_LIB).dylib" ELFLIB_MAJOR="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).dylib" ELFLIB_MAJOR_MINOR="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION).dylib" ;; *freebsd* ) ELFLIB_MAJOR_MINOR="\$(ELFLIB).\$(ELF_MAJOR_VERSION)" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" if test "X$PORTOBJFORMAT" = "Xelf" ; then ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-soname,\$(ELFLIB_MAJOR)" else ELF_LINK="ld -Bshareable -x" fi ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED="\$(CC) \$(CFLAGS) -shared -fPIC" ;; *cygwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) " DLL_IMPLIB_NAME="lib\$(THIS_LIB)\$(ELFLIB_MAJOR_VERSION).dll.a" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR) -Wl,--out-implib=\$(DLL_IMPLIB_NAME) -Wl,-export-all-symbols -Wl,-enable-auto-import" ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED="\$(CC) \$(CFLAGS) -shared" dnl# CYGWIN prohibits undefined symbols when linking shared libs SLANG_LIB_FOR_MODULES="-L\$(ELFDIR) -lslang" INSTALL_MODULE="\$(INSTALL)" ;; * ) echo "Note: ELF compiler for host_os=$host_os may be wrong" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED="\$(CC) \$(CFLAGS) -shared -fPIC" esac AC_SUBST(ELF_CC) AC_SUBST(ELF_CFLAGS) AC_SUBST(ELF_LINK) AC_SUBST(ELF_LINK_CMD) AC_SUBST(ELF_DEP_LIBS) AC_SUBST(DYNAMIC_LINK_FLAGS) AC_SUBST(CC_SHARED) AC_SUBST(ELFLIB) AC_SUBST(ELFLIB_MAJOR) AC_SUBST(ELFLIB_MAJOR_MINOR) AC_SUBST(SLANG_LIB_FOR_MODULES) AC_SUBST(DLL_IMPLIB_NAME) AC_SUBST(INSTALL_MODULE) ]) dnl#}}} AC_DEFUN(JD_F77_COMPILER, dnl#{{{ [ case "$host_os" in *linux* ) F77="g77" F77_LIBS="-lg2c" ;; *solaris*) F77=f77 #F77_LIBS="-lF77 -lM77 -L/opt/SUNWspro/SC4.0/lib -lsunmath" F77_LIBS="-lF77 -lM77 -lsunmath" ;; *) echo "" echo "WARNING: Assuming f77 as your FORTRAN compiler" echo "" F77=f77 F77_LIBS="" esac AC_SUBST(F77) AC_SUBST(F77_LIBS) ]) dnl#}}} dnl# This macro process the --with-xxx, --with-xxxinc, and --with-xxxlib dnl# command line arguments and returns the values as shell variables dnl# jd_xxx_include_dir and jd_xxx_library_dir. It does not perform any dnl# substitutions, nor check for the existence of the supplied values. AC_DEFUN(JD_WITH_LIBRARY_PATHS, dnl#{{{ [ JD_UPPERCASE($1,JD_ARG1) jd_$1_include_dir="" jd_$1_library_dir="" jd_with_$1_library="" AC_ARG_WITH($1, [ --with-$1=DIR Use DIR/lib and DIR/include for $1], [jd_with_$1_arg=$withval], [jd_with_$1_arg=unspecified]) case "x$jd_with_$1_arg" in xno) jd_with_$1_library="no" ;; x) AC_MSG_ERROR(--with-$1 requires a value-- try yes or no) ;; xunspecified) ;; xyes) ;; *) jd_$1_include_dir="$jd_with_$1_arg"/include jd_$1_library_dir="$jd_with_$1_arg"/lib ;; esac AC_ARG_WITH($1lib, [ --with-$1lib=DIR $1 library in DIR], [jd_with_$1lib_arg=$withval], [jd_with_$1lib_arg=unspecified]) case "x$jd_with_$1lib_arg" in xunspecified) ;; xno) ;; x) AC_MSG_ERROR(--with-$1lib requres a value) ;; *) jd_$1_library_dir="$jd_with_$1lib_arg" ;; esac AC_ARG_WITH($1inc, [ --with-$1inc=DIR $1 include files in DIR], [jd_with_$1inc_arg=$withval], [jd_with_$1inc_arg=unspecified]) case "x$jd_with_$1inc_arg" in x) AC_MSG_ERROR(--with-$1inc requres a value) ;; xunspecified) ;; xno) ;; *) jd_$1_include_dir="$jd_with_$1inc_arg" ;; esac ]) dnl#}}} dnl# This function checks for the existence of the specified library $1 with dnl# header file $2. If the library exists, then the shell variables will dnl# be created: dnl# jd_with_$1_library=yes/no, dnl# jd_$1_inc_file dnl# jd_$1_include_dir dnl# jd_$1_library_dir AC_DEFUN(JD_CHECK_FOR_LIBRARY, dnl#{{{ [ AC_REQUIRE([JD_EXPAND_PREFIX])dnl AC_MSG_CHECKING(for the $1 library and header files $2) dnl JD_UPPERCASE($1,JD_ARG1) JD_WITH_LIBRARY_PATHS($1) if test X"$jd_with_$1_library" = X then jd_$1_inc_file=$2 jd_with_$1_library="yes" if test "X$jd_$1_inc_file" = "X" then jd_$1_inc_file=$1.h fi if test X"$jd_$1_include_dir" = X then lib_include_dirs="\ $jd_prefix_incdir \ /usr/local/$1/include \ /usr/local/include/$1 \ /usr/local/include \ /usr/include/$1 \ /usr/$1/include \ /usr/include \ /opt/include/$1 \ /opt/$1/include \ /opt/include" for X in $lib_include_dirs do if test -r "$X/$jd_$1_inc_file" then jd_$1_include_dir="$X" break fi done if test X"$jd_$1_include_dir" = X then jd_with_$1_library="no" fi fi if test X"$jd_$1_library_dir" = X then lib_library_dirs="\ $jd_prefix_libdir \ /usr/local/lib \ /usr/local/lib/$1 \ /usr/local/$1/lib \ /usr/lib \ /usr/lib/$1 \ /usr/$1/lib \ /opt/lib \ /opt/lib/$1 \ /opt/$1/lib" case "$host_os" in *darwin* ) exts="dylib so a" ;; * ) exts="so a" esac found=0 for X in $lib_library_dirs do for E in $exts do if test -r "$X/lib$1.$E" then jd_$1_library_dir="$X" found=1 break fi done if test $found -eq 1 then break fi done if test X"$jd_$1_library_dir" = X then jd_with_$1_library="no" fi fi fi if test "$jd_with_$1_library" = "yes" then AC_MSG_RESULT(yes: $jd_$1_library_dir and $jd_$1_include_dir) dnl# Avoid using /usr/lib and /usr/include because of problems with dnl# gcc on some solaris systems. JD_ARG1[]_LIB=-L$jd_$1_library_dir if test "X$jd_$1_library_dir" = "X/usr/lib" then JD_ARG1[]_LIB="" else JD_SET_RPATH($jd_$1_library_dir) fi JD_ARG1[]_INC=-I$jd_$1_include_dir if test "X$jd_$1_include_dir" = "X/usr/include" then JD_ARG1[]_INC="" fi else AC_MSG_RESULT(no) JD_ARG1[]_INC="" JD_ARG1[]_LIB="" fi AC_SUBST(JD_ARG1[]_LIB) AC_SUBST(JD_ARG1[]_INC) ]) dnl#}}} AC_DEFUN(JD_WITH_LIBRARY, dnl#{{{ [ JD_CHECK_FOR_LIBRARY($1, $2) if test "$jd_with_$1_library" = "no" then AC_MSG_ERROR(unable to find the $1 library and header file $jd_$1_inc_file) fi ]) dnl#}}} AC_DEFUN(JD_SLANG_VERSION, dnl#{{{ [ slang_h=$jd_slang_include_dir/slang.h AC_MSG_CHECKING(SLANG_VERSION in $slang_h) slang_version=`grep "^#define *SLANG_VERSION " $slang_h | awk '{ print [$]3 }'` slang_major_version=`echo $slang_version | awk '{ print int([$]1/10000) }'` slang_minor_version=`echo $slang_version $slang_major_version | awk '{ print int(([$]1 - [$]2*10000)/100) }'` slang_patchlevel_version=`echo $slang_version $slang_major_version $slang_minor_version | awk '{ print ([$]1 - [$]2*10000 - [$]3*100) }'` AC_MSG_RESULT($slang_major_version.$slang_minor_version.$slang_patchlevel_version) AC_SUBST(slang_version) AC_SUBST(slang_major_version) AC_SUBST(slang_minor_version) AC_SUBST(slang_patchlevel_version) ]) #}}} AC_DEFUN(JD_SLANG_MODULE_INSTALL_DIR, dnl#{{{ [ AC_REQUIRE([JD_SLANG_VERSION]) if test "X$slang_major_version" = "X1" then MODULE_INSTALL_DIR="$libdir/slang/modules" else MODULE_INSTALL_DIR="$libdir/slang/v$slang_major_version/modules" fi SL_FILES_INSTALL_DIR=$datadir/slsh/local-packages AC_SUBST(MODULE_INSTALL_DIR) AC_SUBST(SL_FILES_INSTALL_DIR) ]) #}}} AC_DEFUN(JD_CHECK_LONG_LONG, dnl#{{{ [ AC_CHECK_TYPES(long long) AC_CHECK_SIZEOF(long long) ]) dnl#}}} AC_DEFUN(JD_LARGE_FILE_SUPPORTXXX, dnl#{{{ [ AC_REQUIRE([JD_CHECK_LONG_LONG]) AC_MSG_CHECKING(whether to explicitly activate long file support) AC_DEFINE(_LARGEFILE_SOURCE, 1) AC_DEFINE(_FILE_OFFSET_BITS, 64) jd_large_file_support=no if test X$ac_cv_type_long_long = Xyes then if test $ac_cv_sizeof_long_long -ge 8 then jd_large_file_support=yes fi fi if test $jd_large_file_support = yes then AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ]) dnl#}}} AC_DEFUN(JD_LARGE_FILE_SUPPORT, dnl#{{{ [ AC_SYS_LARGEFILE AC_FUNC_FSEEKO AC_TYPE_OFF_T AC_CHECK_SIZEOF(off_t) ]) #}}} AC_DEFUN(JD_HAVE_ISINF, dnl#{{{ [ AC_MSG_CHECKING([for isinf]) AC_LINK_IFELSE([AC_LANG_PROGRAM( [[#include ]], [[isinf (0.0);]])], [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_ISINF, 1)]) ]) #}}} slcfitsio-0.3.8/autoconf/install-sh0000755002657400265740000001273610054700047016375 0ustar davisdavis#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" 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 slcfitsio-0.3.8/cfitsio.lis0000644002657400265740000000062710145314557014730 0ustar davisdavis@cfitsio.lis @configure 0755 @COPYRIGHT @README @INSTALL.txt @ChangeLog @share/readrmf.sl @autoconf/Makefile.in @autoconf/aclocal.m4 @autoconf/config.guess 0755 @autoconf/config.sub 0755 @autoconf/configure.in @autoconf/install-sh 0755 @autoconf/mkinsdir.sh 0755 @src/mkversion.sh 0755 @src/Makefile.in @src/cfitsio-module.c @src/cfitsio.sl @src/fits.sl @src/fitswcs.sl @src/config.hin @doc/fits.txt slcfitsio-0.3.8/ChangeLog0000644002657400265740000001220710611753762014331 0ustar davisdavis2007-4-19 John E. Davis * src/fits.sl: (_fits_sl_version_string): bumped to 0.4.2-0 * src/fits.sl (fits_set_verbose_errors): Used to control the error message verbosity. 2007-4-18 John E. Davis * src/cfitsio-module.c (clear_errmsg): Made _fits_clear_errmsg a wrapper around fits_clear_errmsg. * src/version.h (MODULE_VERSION_NUMBER): bumped to 0.3.8 2007-4-17 John E. Davis * src/fits.sl (do_fits_error): modified to use _fits_read_errmsg. Also added a FitsError exception and added a function called fits_get_errmsgs, which returns the messages from the fits errmsg queue. * src/cfitsio-module.c (read_errmsg): Added wrapper for fits_read_errmsg. * src/version.h (MODULE_VERSION_NUMBER): bumped to 0.3.7 * src/fits.sl (get_open_hdu_of_type): If looking for a binary table, accept an ascii table. * src/cfitsio-module.c (read_col): Support for ascii tables added. For string columns, this required a different interpretation of the TFORM specifier. Binary tables use, e.g, 8A for TFORM whereas ASCII tables use A8. Nice. 2007-4-10 John E. Davis * src/fits.sl (_fits_sl_version_string): bumped to 0.4.1-0 * src/fits.sl: Added additional information to calls to do_fits_error in an effort to improve the error messages. 2007-4-6 John E. Davis * src/version.h (MODULE_PATCH_LEVEL): bumped to 0.3.6 * src/cfitsio-module.c (map_fitsio_type_to_slang): bit types get mapped to SIGNED int values instead of unsigned values. This avoids the silly unsigned integer convention when such values get written out as integers. 2007-3-28 John E. Davis * src/fits.sl (reverse): made reverse a private function. (_fits_sl_version_string): bumped to 0.4.4-0 * src/fitswcs.sl (simplify_wcs): work-around what appears to be a ds9 bug-- if a PC matrix is present, then the CDELT values must be equal. (_fitswcs_version_string): 0.2.0-1 2007-3-27 John E. Davis * src/fitswcs.sl (_fitswcs_version_string): bumped to 0.2.0-0 (fitswcs_linear_transform_wcs): Modified the interface to make it more intuitive. (fitswcs_bin_wcs): New function (fitswcs_rebin_wcs): Changed the interface so that it works with images-- not event lists. 2007-3-22 John E. Davis * src/fitswcs.sl (fitswcs_new): typo that initialized cdelt to 0. (_fitswcs_version_string): bumped to 0.1.1-1 2007-3-8 John E. Davis * src/fits.sl (make_tdim_string): Use array_reverse instead of reverse. (_fits_sl_version_string): bumped to 0.4.3-1 2007-2-21 John E. Davis * src/cfitsio-module.c (open_file): fits_open_file does not set fptr to NULL upon return if an error occurs as assumed. * src/version.h (MODULE_PATCH_LEVEL): bumped to 0.3.5 * src/cfitsio-module.c (check_version): Added a warning message if the compiled and linked cfitsio versions do not match. * src/cfitsio-module.c (read_column_values): change to support repeat = 0 for variable length arrays left an uninitialized variable. 2007-2-16 John E. Davis * src/cfitsio-module.c (write_img): added support for unsigned types. * src/version.h (MODULE_PATCH_LEVEL): bumped to 0.3.4 * src/fits.sl (fits_write_binary_table): Added support for unsigned 16 and 32 bit integers. (fits_get_bitpix): modified bitpix values for unsigned types and Char_Type. (_fits_sl_version_string): version bumped to 0.4.3-0 2007-2-14 John E. Davis * src/version.h (MODULE_PATCH_LEVEL): Bumped to version 0.3-3 * src/cfitsio-module.c (read_column_values): repeat=0 (a column with 0 length was not supported). 2006-6-13 John E. Davis * src/fits.sl (fits_update_logical): Usage message referred to fits_update_key. (_fits_sl_version_string): Updated to 0.4.2-4 2006-4-7 John E. Davis * src/fits.sl (_fits_sl_version_string): bumped to 0.4.2-3 (fits_write_binary_table): allow data struct to be NULL 2006-2-17 John E. Davis * src/fits.sl (fits_write_records): The usage string referred to fits_read+records. (_fits_sl_version_string): version string bumped to 0.4.2-2 2006-1-26 John E. Davis * src/fitswcs.sl (struct): Added radsys and equinox fields to the the wcs structure. 2005-11-10 John E. Davis * src/fits.sl (_fits_sl_version_string): bumped to 0.4.2-1. (read_cols): numrows was not being passed to _fits_read_cols (Ronnie Hoogerwerf ronnieh at head, cfa, harvard, edu) 2005-10-27 John E. Davis * autoconf/configure.in: removed JD_SET_RPATH. * src/Makefile.in: changed *HELP_* to *HLP_* 2005-5-18 John E. Davis * src/fits.sl (_fits_sl_version_string): Bumped to 0.4.2-0 * src/fits.sl: Changed static qualifier to private and dropped the public qualifiers. * src/fitswcs.sl (_fitswcs_version_string): Bumped to 0.1.1-0 * src/fitswcs.sl: Changed static qualifier to private and dropped the public qualifiers. slcfitsio-0.3.8/COPYRIGHT0000644002657400265740000000260310054700747014045 0ustar davisdavis Copyright (c) 2003 Massachusetts Institute of Technology This software was developed by the MIT Center for Space Research under contract SV1-61010 from the Smithsonian Institution. 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 the supporting documentation, and that the name of the Massachusetts Institute of Technology not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The Massachusetts Institute of Technology makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. THE MASSACHUSETTS INSTITUTE OF TECHNOLOGY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE MASSACHUSETTS INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. slcfitsio-0.3.8/README0000644002657400265740000000660410602532746013440 0ustar davisdavisThe code here provides a slang module for the CFITSIO library. It also provides a higher-level interface to the module via the slang wrappers in src/fits.sl. See the documentation in the doc/ directory for information about using the module, or, for the most up to date version, see . To build the code, you will need the following additional libraries: 1. The slang library (http://www.jedsoft.org/slang/) 2. The CFITSIO library (http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html) *** NOTE: You may already have the cfitsio library installed as part of some other package, e.g., CIAO, LHEASOFT, HEADAS, etc. Although unrecommended, if you want to link against cfitsio in one of these packages, be aware that the library may have been renamed to a package specific name, e.g., libcxccfitsio. As such, the configure script may not be able to find the library. If this happens, you will have to edit the cfitsio specific variables in src/Makefile. *** NOTE: The cfitsio developers have informed me that they make no guarantees of binary compatibility between releases. Hence, if you upgrade your cfitsio library, then you should recompile the cfitsio module and anything else that depends upon the upgraded library. This is also true if you have linked against a package-specific version of cfitsio (e.g., from HEADAS) and you have upgraded the package. You must run the configure script before you can compile the module. If either the slang or cfitsio libraries are installed in non-standard locations, then you will need to specify the locations of these libraries as arguments to the configure script. For example, suppose libslang.so is located in /home/bill/lib and its include file slang.h is located in /home/bill/include. Similarly, assume the cfitsio library and include files are located in /home/bill/opt/lib and /home/bill/opt/include, respectively. Then one would run the configure script using: ./configure --with-slanglib=/home/bill/lib \ --with-slanginc=/home/bill/include \ --with-cfitsiolib=/home/bill/opt/lib \ --with-cfitsioinc=/home/bill/opt/include or, the shorter form which assumes a common pathname prefix for the lib include directories: ./configure --with-slang=/home/bill --with-cfitsio=/home/bill/opt You should also specify a location for the modules (*.so) and any associated script (*.sl) files created by this package. The default location for the modules is in $prefix/lib/slang/modules/ Any .sl files will be installed in $exec_prefix/share/slsh/local-packages/ where the values of the variable $prefix defaults to /usr/local, and that of $exec_prefix to the value of $prefix. These values may be changed using the --prefix and --exec-prefix configure script parameters. For example, to set the value of $prefix to /home/bill, use ./configure --prefix=/home/bill ... For more help using the configure script, run it using ./configure --help It is also a good idea to read the INSTALL.txt file located in this directory. Once the configure script has been run, it is a good idea to inspect the Makefile that it generated in the src directory. Then building and installing the library should involve nothing more than: make make install You may have to have root privileges to peform the last step.