slcfitsio-pre0.4.7-17/0002755000175000000620000000000014146404553013303 5ustar johnstaffslcfitsio-pre0.4.7-17/src/0002755000175000000620000000000014146404553014072 5ustar johnstaffslcfitsio-pre0.4.7-17/src/config.hin0000644000175000000620000000042414124641731016032 0ustar johnstaff/* -*- 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-pre0.4.7-17/src/fitswcs.sl0000644000175000000620000007407314124641731016122 0ustar johnstaff% Copyright (C) 2004-2009 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 CNAME_INDX = 9; 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"]; %, "CNAME%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"]; %, "TCNA%d"]; 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"];%, "%dCNA%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"];% "%dCNA%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); variable i1, j1; _for i1 (0, n-1, 1) { variable i = is[i1]; _for j1 (0, n-1, 1) { variable j = js[j1]; 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]", ["Y","X"]); %#v- %\notes % If the intent is to bin the data in the binary table columns, then % it is best to specify the columns as \exmp{["Y", "X"]} and not the % other way around. This is because the slang routines that deal with % images assumes that the slowest varying index corresponds to the % first one, whereas FITS assumes the opposite. %\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 binned image} %\usage{wcs1 = fitswcs_bin_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-pre0.4.7-17/src/mkversion.sh0000755000175000000620000000010714124641731016437 0ustar johnstaffgrep "^#define MODULE_VERSION_NUMSTR" version.h | tr -dc '0123456789.' slcfitsio-pre0.4.7-17/src/version.h0000644000175000000620000000016514146404553015730 0ustar johnstaff#define MODULE_VERSION_STRING "pre0.4.7-17" #define MODULE_VERSION_NUMBER 407 #define MODULE_VERSION_NUMSTR "0.4.7" slcfitsio-pre0.4.7-17/src/fits.sl0000644000175000000620000016455514124641731015412 0ustar johnstaff% Copyright (C) 1998-2010 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"); % Track the modules's version since it now follows the changes.txt file. variable _fits_sl_version_string = _cfitsio_module_version_string; variable _fits_sl_version = _cfitsio_module_version; 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; } define fits_check_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) fits_check_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) { fits_check_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; fits_check_error (_fits_open_file (&fp, fp, "r"), file); @needs_close = 1; } return fp; } define fits_get_num_hdus () { if (_NARGS != 1) usage ("num = fits_get_num_hdus (file)"); variable fp = (); variable needs_close, num; fp = get_open_fp (fp, &needs_close); variable status = _fits_get_num_hdus (fp, &num); do_close_file (fp, needs_close); if (status == 0) return num; fits_check_error (status); } define fits_movrel_hdu () { if (_NARGS != 2) usage ("num_actual = fits_movrel_hdu (fp, num_to_move)"); variable fp, num_to_move, num_hdus, this_num; (fp, num_to_move) = (); this_num = _fits_get_hdu_num (fp); if (num_to_move > 0) { num_hdus = fits_get_num_hdus (fp); if (this_num + num_to_move > num_hdus) num_to_move = num_hdus - this_num; } else if (num_to_move < 0) { if (this_num + num_to_move <= 0) num_to_move = -this_num; } if (num_to_move == 0) return 0; fits_check_error (_fits_movrel_hdu (fp, num_to_move)); return num_to_move; } define fits_movabs_hdu () { if (_NARGS != 2) usage ("fits_movabs_hdu (fp, n)"); variable fp,n; (fp, n) = (); fits_check_error (_fits_movabs_hdu (fp, n)); } private define find_interesting_hdu (f, hdu_type, check_naxis) { variable type; do { variable status; fits_check_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; fits_check_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) { fits_check_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; } variable name_contains_extno = string_match (f, "\[.+\]$"R, 1) || string_match (f, "+\d+$"R, 1); f = get_open_fp (f, needs_close); if (name_contains_extno || (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); do_close_file (fp, needs_close); if (status == 0) return 1; if (status == _FITS_KEY_NO_EXIST) return 0; fits_check_error (status); } private define get_fits_btable_info (fp) { variable numrows, numcols, names, name, col; fits_check_error (_fits_get_num_rows (fp, &numrows)); fits_check_error (_fits_get_num_cols (fp, &numcols)); names = String_Type [numcols]; _for (1, numcols, 1) { col = (); fits_check_error (_fits_read_key_string (fp, "TTYPE"+string(col), &name, NULL)); names [col-1] = name; } return (numrows, names); } private define get_casesens_qualifier () { % We allow the forms: % func (...; casesen); % func (...; casesen=0); % func (...; casesen=1); ifnot (qualifier_exists ("casesen")) return 0; variable q = qualifier ("casesen"); return (q == NULL) ? 1 : q; } private define _fits_get_colnum_maybe_casesen (ft, name, ref, casesen) { if (casesen) return _fits_get_colnum_casesen (ft, name, ref); return _fits_get_colnum (ft, name, ref); } private define get_column_number (fp, col, casesen) { if (typeof (col) == String_Type) { variable col_str = col; fits_check_error (_fits_get_colnum_maybe_casesen (fp, col_str, &col, casesen), col_str); return col; } return int (col); } private define get_column_numbers (fp, col_list, casesen); private define get_column_numbers (fp, col_list, casesen) { variable column_nums = Int_Type[0]; foreach (col_list) { variable col = (); if ((typeof (col) == Array_Type) || (typeof (col) == List_Type)) col = get_column_numbers (fp, col, casesen); else col = get_column_number (fp, col, casesen); column_nums = [column_nums, col]; } return column_nums; } %!%+ %\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. %\qualifiers %\qualifier{casesen}{use case-sensitive column names} %\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, casesen = get_casesens_qualifier (;;__qualifiers); fits_check_error (_fits_get_colnum_maybe_casesen (f, column_names, &colnum, casesen)); 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. %\qualifiers %\qualifier{casesen}{use case-sensitive column names} %\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); ifnot (get_casesens_qualifier (;;__qualifiers)) { col = strup (col); names = array_map (String_Type, &strup, names); } return length (where (col == names)); } define fits_delete_col () { if (_NARGS != 2) usage ("fits_delete_col (file, col)"); variable f, col; (f, col) = (); variable needs_close; f = get_open_binary_table (f, &needs_close); col = get_column_number (f, col, get_casesens_qualifier(;;__qualifiers)); fits_check_error (_fits_delete_col (f, col)); do_close_file (f, needs_close); } private define get_tdim_string (fp, col) { variable tdim = sprintf ("TDIM%d", col); !if (fits_key_exists (fp, tdim)) return NULL; fits_check_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, tdim_col, data) { if (tdim_col == 0) return; variable len = length (data); variable tdim; fits_check_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)); } } private define reshape_string_array (fp, col, data) { variable tform, repeat, width; fits_check_error (_fits_read_key_string (fp, "TFORM" + string(col), &tform, NULL)); % Look for rAw if (2 != sscanf (tform, "%dA%d", &repeat, &width)) return data; variable num_substrs = repeat/width; if (num_substrs == 1) return data; variable len = length (data); variable new_data = String_Type[len, num_substrs]; variable i, j; _for i (0, len-1, 1) { variable str = data[i]; _for j (0, num_substrs-1, 1) { variable new_str = substrbytes (str, 1+j*width, width); new_str = strtrim_end (new_str, " "); if ((new_str == "") && width) new_str = " "; new_data[i,j] = new_str; } } return new_data; } % FITS column and keyword names can begin with a number or have dashes. % Bad Design. private define normalize_names (names, casesen); private define normalize_names (names, casesen) { variable new_names = String_Type[0]; _for (0, length (names)-1, 1) { variable i = (); variable name = names[i]; variable t = typeof (name); if ((t == Array_Type) || (t == List_Type)) { new_names = [new_names, normalize_names(name, casesen)]; continue; } ifnot (casesen) name = strlow (name); name = strtrans (name, "^a-zA-Z0-9", "_"); if ('0' <= name[0] <= '9') name = "_" + name; new_names = [new_names, name]; } return new_names; } private define open_read_cols (fp, columns) { variable needs_close, numrows, numcols; fp = get_open_binary_table (fp, &needs_close); fits_check_error (_fits_get_num_rows (fp, &numrows)); numcols = length(columns); variable s = struct { fp = fp, needs_close = needs_close, columns = get_column_numbers (fp, columns, get_casesens_qualifier(;;__qualifiers)), num_rows = numrows, num_cols = numcols, tdims = String_Type[numcols], tdim_cols = Int_Type[numcols], }; _for (0, numcols-1, 1) { variable i = (); variable col = s.columns[i]; variable tdim = get_tdim_string (fp, col); if (tdim != NULL) s.tdims[i] = tdim; variable tdim_col = sprintf ("TDIM%d", col); if (fits_binary_table_column_exists (fp, tdim_col)) { fits_check_error (_fits_get_colnum (fp, tdim_col, &tdim_col)); if (tdim_col != col) s.tdim_cols[i] = tdim_col; } } return s; } private define close_read_cols (s) { do_close_file (s.fp, s.needs_close); } % 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 (fpinfo, first_row, last_row) { variable fp = fpinfo.fp, numrows = fpinfo.num_rows, columns = fpinfo.columns, tdims = fpinfo.tdims, tdim_cols = fpinfo.tdim_cols; if (first_row < 0) first_row += (1+numrows); if (last_row < 0) last_row += (1+numrows); variable want_num_rows = last_row - first_row + 1; if ((first_row <= 0) or (last_row < 0) or (want_num_rows > numrows) or (want_num_rows < 0)) throw FitsError, "Invalid first or last row parameters"; variable data_arrays; fits_check_error (_fits_read_cols (fp, columns, first_row, want_num_rows, &data_arrays)); _for (0, fpinfo.num_cols-1, 1) { variable i = (); variable col = columns[i]; variable data = data_arrays[i]; variable tdim = tdims[i]; if (tdim != NULL) { tdim = convert_tdim_string (tdim, want_num_rows); reshape (data, tdim); } else if (typeof (data) == Array_Type) { if (_typeof (data) == String_Type) data = reshape_string_array (fp, col, data); if (tdim_cols[i]>0) check_vector_tdim (fp, first_row, tdim_cols[i], data); } data; % leave it on stack } } private define pop_column_list (nargs) { variable list = {}; _stk_reverse (nargs); % preserve the order loop (nargs) { variable arg = (); variable t = typeof(arg); if ((t == Array_Type) || (t == List_Type)) { foreach arg (arg) list_append (list, arg); continue; } list_append (list, arg); } return list; } %!%+ %\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. %\qualifiers %\qualifier{casesen}{use case-sensitive column names} %\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 [;row=val, num=val])"); variable cols = pop_column_list (_NARGS-1); variable fp = (); variable fpinfo = open_read_cols (fp, cols;; __qualifiers); variable first_row, last_row, num; first_row = qualifier ("row", 1); num = qualifier ("num"); if (num == NULL) last_row = -1; else last_row = first_row + num - 1; read_cols (fpinfo, first_row, last_row); % data on stack close_read_cols (fpinfo); } %!%+ %\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. % % Field names are converted to lowercase unless the \exmp{casesen} qualifier is set. %\qualifiers %\qualifier{casesen}{use case-sensitive column names} %\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_column_list (_NARGS - 1); variable file = (); variable fields = normalize_names (cols, get_casesens_qualifier (;;__qualifiers)); variable s = @Struct_Type (fields); set_struct_fields (s, fits_read_col (file, cols;; __qualifiers)); 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) = (); variable fpinfo = open_read_cols (fp, [c] ;; __qualifiers); variable a = read_cols (fpinfo, r, r); variable dims, nd; (dims,nd,) = array_info (a); if (nd == 1) a = a[0]; else reshape (a, dims[[1:]]); close_read_cols (fpinfo); 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_column_list (_NARGS-3); fp = (); variable fpinfo = open_read_cols (fp, columns;; __qualifiers); read_cols (fpinfo, r0, r1); % on stack close_read_cols (fpinfo); } define fits_get_num_rows () { if (_NARGS != 1) usage ("nrows = fits_get_num_rows (file)"); variable fp = (); variable needs_close, num_rows; fp = get_open_binary_table (fp, &needs_close); fits_check_error (_fits_get_num_rows (fp, &num_rows)); do_close_file (fp, needs_close); return num_rows; } define fits_get_num_cols () { if (_NARGS != 1) usage ("ncols = fits_get_num_cols (file)"); variable fp = (); variable needs_close, num_cols; fp = get_open_binary_table (fp, &needs_close); fits_check_error (_fits_get_num_cols (fp, &num_cols)); do_close_file (fp, needs_close); return num_cols; } %!%+ %\function{fits_read_row} %\synopsis{Read a row from a FITS binary table} %\usage{Struct_Type fits_read_row (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 % \sfun{fits_read_table} reads the data in a table of the FITS file % specified by \exmp{file} and returns it as a structure. Field % names are converted to lowercase unless the \exmp{casesen} qualifier % is set. If the optional column name parameters are specified, % then only those columns will be read. Otherwise, the entire table % will be returned. % % If \exmp{file} is a string, then the file will be opened via the virtual file % specification implied by \exmp{file}. Otherwise, \exmp{file} should % represent an already opened FITS file. %\qualifiers %\qualifier{casesen}{do not convert field names to lowercase} %\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,...] [;casesen])"); variable f, names = NULL; if (_NARGS > 1) names = pop_column_list (_NARGS-1); 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;; __qualifiers); 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; %fits_check_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]; fits_check_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; _fits_clear_errmsg (); } else if (status) fits_check_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_struct (file, key1, ...)} %#v+ % Fits_File_Type or String_Type file; % String_Type key1, ...; %#v- %\description % This function works exactly like \sfun{fits_read_key} except it returns the % values in a structure. See the documentation on that function for more % information. % % Field names are converted to lowercase unless the \exmp{casesen} % qualifier is set. %\qualifiers %\qualifier{casesen}{do not convert field names to lowercase} %\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)], get_casesens_qualifier(;;__qualifiers)); 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; fits_check_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); fits_check_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); if (keyword[0] == '_') keyword = keyword[[1:]]; % HACK!!! FIXME fits_check_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") { fits_check_error (_fits_write_history (fp, val)); continue; } if (keyword == "comment") { fits_check_error (_fits_write_comment (fp, val)); continue; } vmessage ("*** WARNING: history/comment record name '%s' is not supported", history); } } } private define shape_columns_before_write (s, ncols, ttype) { variable reshapes_to = Array_Type[ncols]; variable ndims, dims; _for (0, ncols-1, 1) { variable i = (); variable val = get_struct_field (s, ttype[i]); (dims,ndims,) = array_info (val); if (ndims > 1) { variable dim_0 = dims[0]; if (dim_0 != 0) { reshape (val, [dim_0, length(val)/dim_0]); reshapes_to[i] = dims; } } } return reshapes_to; } private define unshape_columns_after_write (s, ncols, ttype, reshapes_to) { _for (0, ncols-1, 1) { variable i = (); if (reshapes_to[i] == NULL) continue; reshape (get_struct_field (s, ttype[i]), reshapes_to[i]); } } 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))); if (t == "0A") t = "1A"; } { case Char_Type or case UChar_Type: t = "B"; } { case Int64_Type: t = "K"; } { 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]) fits_check_error (_fits_update_key (fp, sprintf("TDIM%d", i+1), tdim[i], NULL)); } if (keyfunc != NULL) (@keyfunc)(fp, __push_args(keyfunc_args)); #iffalse _for (0, ncols-1, 1) { i = (); val = get_struct_field (s, ttype[i]); fits_check_error (_fits_write_col (fp, i+1, 1, 1, val)); } #else variable reshapes_to = shape_columns_before_write (s, ncols, ttype); # ifeval (_slang_version >= 20000) try { # else ERROR_BLOCK { unshape_columns_after_write (s, ncols, ttype, reshapes_to); } # endif variable r = 0; variable drows = 10; while (r < nrows) { variable r1 = r + nrows; if (r1 > nrows) r1 = nrows; variable k = [r:r1-1]; _for (0, ncols-1, 1) { i = (); val = get_struct_field (s, ttype[i]); if (reshapes_to[i] == NULL) fits_check_error (_fits_write_col (fp, i+1, r+1, 1, val[k])); else fits_check_error (_fits_write_col (fp, i+1, r+1, 1, val[k,*])); } r = r1; } #ifeval (_slang_version >= 20000) } finally { unshape_columns_after_write (s, ncols, ttype, reshapes_to); } #endif 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) fits_check_error ((@func)(fp, __push_args(args))); else fits_check_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) fits_check_error ((@func)(fp, __push_args(args))); else fits_check_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, nargs); } define fits_delete_key () { if (_NARGS != 2) usage ("fits_delete_key (fp, key)"); do_write_xxx (&_fits_delete_key, _NARGS); } %!%+ %\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; fits_check_error (_fits_get_num_keys (fp, &nkeys)); variable recs = String_Type [nkeys]; _for (0, nkeys-1, 1) { variable i = (); variable rec; fits_check_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 = (); fits_check_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; fits_check_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); fits_check_error (_fits_create_img (fp, fits_get_bitpix (type), dims)); if (extname != NULL) fits_check_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); fits_check_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") { fits_check_error (_fits_write_history (fp, val)); continue; } if (keyword == "comment") { fits_check_error (_fits_write_comment (fp, val)); continue; } vmessage ("*** WARNING: history/comment record name '%s' is not supported", history); } } } fits_check_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); } fits_check_error (_fits_write_img (fp, data)); } define fits_iterate () { if (_NARGS != 4) { usage ("\ fits_iterate (fp, {col1, col2, ...}, &func, {arg1, arg2,...})\n\ This function iterates over all rows in a binary table calling func,\n\ which should be declared as:\n\ define func(arg1, arg2, ..., data1, data2, ...)\n\ where data1 is read form col1, etc. The function must return 1 for\n\ processing to continue. Any other value will cause iteration to stop.\n\ \n\ Qualifiers: drows=VAL\n\ Use VAL rows for the number of rows to read at one time (default=4096)\n\ " ); } variable fp, col_list, func, func_list; (fp, col_list, func, func_list)=(); variable delta_rows = qualifier ("drows", 4096); if (delta_rows <= 0) throw InvalidParmError, "drows must be >= 1"; variable fpinfo = open_read_cols (fp, col_list;; __qualifiers); variable num_rows = fpinfo.num_rows; variable num_cols = fpinfo.num_cols; variable i; delta_rows--; variable r0 = 1; while (r0 <= num_rows) { variable r1 = r0 + delta_rows; if (r1 > num_rows) r1 = num_rows; if (1 != (@func)(__push_list(func_list), read_cols (fpinfo, r0, r1))) break; r0 = r1 + 1; } } % 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-pre0.4.7-17/src/Makefile.in0000644000175000000620000001177214146404553016145 0ustar johnstaff# -*- 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@ datarootdir = @datarootdir@ 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_INC_DIR = @CFITSIO_INC_DIR@ 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) #--------------------------------------------------------------------------- UPDATE_VERSION_SCRIPT = $(HOME)/bin/update_changes_version #--------------------------------------------------------------------------- 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 version.h config.h cfitsio.h cfitsio-version.h $(CC_SHARED) $(INCS) $(LDFLAGS) cfitsio-module.c -o cfitsio-module.so $(LIBS) cfitsio-version.h: cfitsio-version.c $(CC) $(CPPFLAGS) $(CFLAGS) $(INCS) $(LDFLAGS) cfitsio-version.c -o cfitsio-version $(LIBS) ./cfitsio-version > cfitsio-version.h version.h: ../changes.txt if [ -x $(UPDATE_VERSION_SCRIPT) ]; then \ $(UPDATE_VERSION_SCRIPT) ../changes.txt ./version.h; \ fi cfitsio.h: Makefile @if [ "X$(CFITSIO_INC_DIR)" != "X" ]; then \ echo "#include <$(CFITSIO_INC_DIR)/fitsio.h>" > cfitsio.h; \ else \ echo "#include " > cfitsio.h; \ fi #--------------------------------------------------------------------------- # 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) *~ \#* -/bin/rm -f cfitsio-version cfitsio-version.h distclean: clean -/bin/rm -f config.h cfitsio.h Makefile $(MODULES) *.fit slcfitsio-pre0.4.7-17/src/cfitsio.sl0000644000175000000620000000002414124641731016061 0ustar johnstaffimport ("cfitsio"); slcfitsio-pre0.4.7-17/src/tests/0002755000175000000620000000000014124641731015231 5ustar johnstaffslcfitsio-pre0.4.7-17/src/tests/test_wcs.sl0000644000175000000620000000362414124641731017427 0ustar johnstaffprivate 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-pre0.4.7-17/src/tests/test_fits.sl0000644000175000000620000000771214124641731017602 0ustar johnstaffprivate 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 nrows = 71; variable uint16s = UInt16_Type[nrows]; uint16s[*] = [1:nrows]; variable uint32s = UInt32_Type[nrows]; uint32s[*] = [1:nrows]; variable xs = [1:10:#nrows*3*2]; reshape (xs, [nrows, 3, 2]); variable data = struct {u16 = uint16s, u32 = uint32s, x=xs}; fits_write_binary_table (filename, "FOO", data); variable delete = 0; 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 32 bit column"); delete = 0; } if (0 == is_identical (table.x, data.x)) { warn ("testbt: failed to read/write an array column"); delete = 0; } variable fp = fits_open_file (filename + "[FOO]", "r"); variable r = 0, dr = 7; while (r < nrows) { if (r + dr > nrows) dr = nrows - r; variable x = fits_read_col (fp, "X"; row=r+1, num=dr); if (0 == is_identical (xs[[r:r+dr-1],*,*], x)) { warn ("testbt: failed to read using the row qualifier"); delete = 0; break; } r += nrows; } fits_close_file (fp); if (delete) () = remove (filename); } test_bt ("testbt.fit"); test_img ("testimg.fit"); if (Failed == 0) message ("Passed"); else message ("Failed"); slcfitsio-pre0.4.7-17/src/cfitsio-module.c0000644000175000000620000017561714124641731017175 0ustar johnstaff/* cfitsio interface */ /* Copyright (c) 2003-2009 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. */ #include "config.h" #include #include #include #include #include #include "cfitsio.h" #include "cfitsio-version.h" #ifdef __cplusplus extern "C" { #endif SLANG_MODULE(cfitsio); #ifdef __cplusplus } #endif #include "version.h" /* This is a hack that works for all 32 and 64 bit systems that I know */ /* The CFITSIO_INT*_TYPE objects must refer to the corresponding C type * and have the approriate length. */ #if SIZEOF_SHORT == 2 # define SLANG_UINT16_TYPE SLANG_USHORT_TYPE # define SLANG_INT16_TYPE SLANG_SHORT_TYPE # define CFITSIO_INT16_TYPE TSHORT # define CFITSIO_UINT16_TYPE TUSHORT typedef short int16_type; #endif #if SIZEOF_INT == 4 # define SLANG_INT32_TYPE SLANG_INT_TYPE # define SLANG_UINT32_TYPE SLANG_UINT_TYPE # define CFITSIO_INT32_TYPE TINT # define CFITSIO_UINT32_TYPE TUINT typedef int int32_type; #endif #ifdef TLONGLONG # if (SIZEOF_LONG == 8) # define SLANG_INT64_TYPE SLANG_LONG_TYPE # define CFITSIO_INT64_TYPE TLONG # else # define SLANG_INT64_TYPE SLANG_LLONG_TYPE # define CFITSIO_INT64_TYPE TLONGLONG # endif #endif typedef struct { fitsfile *fptr; } FitsFile_Type; static SLtype Fits_Type_Id = 0; /* This routine is used for binary tables --- not keywords. For a binary table, * TLONG always specifies a 32 bit integer, but for a keyword is simply means * a long integer. */ static int map_fitsio_type_to_slang (int *typep, long *repeat, SLtype *stype) { int type = *typep; int sgn = (type < 0) ? -1 : 1; /* Variable length objects have negative type values */ if (sgn == -1) type = -type; switch (type) { case TSHORT: /* cfitsio 16 bit type */ *stype = SLANG_INT16_TYPE; *typep = sgn * CFITSIO_INT16_TYPE; break; case TUSHORT: /* cfitsio 16 bit type */ *stype = SLANG_UINT16_TYPE; *typep = sgn * CFITSIO_UINT16_TYPE; break; case TINT: *stype = SLANG_INT_TYPE; break; #ifdef TUINT case TUINT: *stype = SLANG_UINT_TYPE; break; #endif case TLONG: /* cfitsio 32 bit value */ *stype = SLANG_INT32_TYPE; *typep = sgn * CFITSIO_INT32_TYPE; break; case TULONG: *stype = SLANG_UINT32_TYPE; *typep = sgn * CFITSIO_UINT32_TYPE; break; #ifdef TLONGLONG case TLONGLONG: *stype = SLANG_INT64_TYPE; break; #endif case TDOUBLE: *stype = SLANG_DOUBLE_TYPE; break; case TFLOAT: *stype = SLANG_FLOAT_TYPE; break; case TLOGICAL: case TBYTE: *stype = SLANG_UCHAR_TYPE; break; case TBIT: /* 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. */ if (*repeat <= 8) { *repeat = 1; *stype = SLANG_CHAR_TYPE; break; } if (*repeat <= 16) { *repeat = 1; *stype = SLANG_INT16_TYPE; break; } if (*repeat <= 32) { *repeat = 1; *stype = SLANG_INT32_TYPE; break; } SLang_verror (SL_NOT_IMPLEMENTED, "bit type %ldX is not supported", *repeat); return -1; 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 (ft->fptr == NULL) return -1; 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_INT16_TYPE: type = CFITSIO_INT16_TYPE; break; case SLANG_UINT16_TYPE: type = CFITSIO_UINT16_TYPE; break; case SLANG_INT32_TYPE: type = CFITSIO_INT32_TYPE; break; case SLANG_UINT32_TYPE: type = CFITSIO_UINT32_TYPE; break; case SLANG_CHAR_TYPE: case SLANG_UCHAR_TYPE: type = TBYTE; break; #ifdef SLANG_INT64_TYPE case SLANG_INT64_TYPE: type = CFITSIO_INT64_TYPE; break; #endif 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_INT16_TYPE; type = CFITSIO_INT16_TYPE; break; case USHORT_IMG: /* 16 bit image */ stype = SLANG_UINT16_TYPE; type = CFITSIO_UINT16_TYPE; break; case LONG_IMG: /* 32 bit image */ stype = SLANG_INT32_TYPE; type = CFITSIO_INT32_TYPE; break; case ULONG_IMG: /* 32 bit image */ stype = SLANG_UINT32_TYPE; type = CFITSIO_UINT32_TYPE; break; #ifdef TLONGLONG case LONGLONG_IMG: /* 64 bit image */ stype = SLANG_INT64_TYPE; type = CFITSIO_INT64_TYPE; break; #endif 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; unsigned int ui; double d; long l; unsigned long ul; 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_CHAR_TYPE: case SLANG_UCHAR_TYPE: type = TLOGICAL; if (-1 == SLang_pop_integer (&i)) goto free_and_return; if (i == 'F') i = 0; i = (i != 0); v = (VOID_STAR) &i; break; case SLANG_SHORT_TYPE: case SLANG_INT_TYPE: type = TINT; if (-1 == SLang_pop_integer (&i)) goto free_and_return; v = (VOID_STAR) &i; break; case SLANG_USHORT_TYPE: case SLANG_UINT_TYPE: type = TUINT; if (-1 == SLang_pop_uint (&ui)) goto free_and_return; v = (VOID_STAR) &ui; break; case SLANG_LONG_TYPE: type = TLONG; if (-1 == SLang_pop_long (&l)) goto free_and_return; v = (VOID_STAR) &l; break; case SLANG_ULONG_TYPE: type = TULONG; if (-1 == SLang_pop_long (&l)) goto free_and_return; v = (VOID_STAR) &ul; 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; long lval; 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; /* if (type == SLANG_INT_TYPE) type = SLANG_LONG_TYPE; */ status = -1; } switch (type) { case SLANG_INT_TYPE: v = (VOID_STAR) &ival; ftype = TINT; ival = 0; break; case SLANG_LONG_TYPE: v = (VOID_STAR) &lval; ftype = TLONG; 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_internal (FitsFile_Type *ft, char *name, SLang_Ref_Type *ref, int casesen) { 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, casesen, name, &col, &status); if (-1 == SLang_assign_to_ref (ref, SLANG_INT_TYPE, (VOID_STAR) &col)) status = -1; return status; } static int get_colnum (FitsFile_Type *ft, char *name, SLang_Ref_Type *ref) { return get_colnum_internal (ft, name, ref, CASEINSEN); } static int get_colnum_casesen (FitsFile_Type *ft, char *name, SLang_Ref_Type *ref) { return get_colnum_internal (ft, name, ref, CASESEN); } 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 non-negative"); 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 (ft->fptr == NULL) return -1; 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_INT16_TYPE: type = CFITSIO_INT16_TYPE; break; case SLANG_UINT16_TYPE: type = CFITSIO_UINT16_TYPE; break; case SLANG_INT32_TYPE: type = CFITSIO_INT32_TYPE; break; case SLANG_UINT32_TYPE: type = CFITSIO_UINT32_TYPE; break; #ifdef CFITSIO_INT64_TYPE case SLANG_INT64_TYPE: type = CFITSIO_INT64_TYPE; break; #endif 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 supported", 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, unsigned int num_substrs, char **sp) { char *s, *ss; char *sls; int status = 0; int anynul; unsigned int i; unsigned int width; *sp = NULL; if (f == NULL) return -1; if (NULL == (s = SLmalloc (len + 1))) return -1; memset (s, ' ', len); width = len/num_substrs; ss = s; for (i = 0; i < num_substrs; i++) { /* Note that the number of elements passed to this must be 1 */ if (0 != fits_read_col (f, TSTRING, col, row, i+1, 1, NULL, &ss, &anynul, &status)) { SLfree (s); return status; } /* If there is more than one substring, append them together. Only the * last substring will have trailing whitespace removed. This is * probably ok because fits does not like trailing whitespace. */ if (i + 1 < num_substrs) { unsigned int len1 = strlen (ss); ss[len1] = ' '; } ss += width; } 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, unsigned int num_substrs, 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, num_substrs, 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, unsigned int bits_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) { SLuindex_Type i; int shift; int16_type *data16; int32_type *data32; case 1: shift = 8*bytes_per_elem - bits_per_elem; if (shift) for (i = 0; i < num_elements; i++) { data[i] = (data[i] >> shift); } break; case 2: byte_swap16 (data, num_elements); shift = 8*bytes_per_elem - bits_per_elem; data16 = (int16_type *)data; if (shift) for (i = 0; i < num_elements; i++) { data16[i] = (data16[i] >> shift); } break; case 4: byte_swap32 (data, num_elements); shift = 8*bytes_per_elem - bits_per_elem; data32 = (int32_type *)data; if (shift) for (i = 0; i < num_elements; i++) { data32[i] = (data32[i] >> shift); } 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, SLtype datatype, unsigned int row, unsigned int col, unsigned int num_rows, int repeat, int repeat_orig, 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, repeat_orig); 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, 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, save_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; save_repeat = repeat; if (-1 == map_fitsio_type_to_slang (&type, &repeat, &datatype)) return -1; if (datatype == SLANG_STRING_TYPE) { unsigned int num_substrs; /* 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)) { num_substrs = 1; repeat = width; } else { if (width > 0) num_substrs = repeat/width; else num_substrs = 0; } status = read_string_column (ft->fptr, (type < 0), repeat, num_substrs, 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, save_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; long repeat_orig; /* used for tbit columns */ 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, repeat, at_data+i); if (status) return status; } return 0; } static int read_string_column_data (fitsfile *f, int is_var, long repeat, unsigned int num_substrs, 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, num_substrs, strs + i); if (status != 0) return status; } return 0; } /* Usage: read_cols (ft, [columns...], firstrow, nrows, &ref) */ /* TODO: Add support for the following calling convention: * read_cols (ft, [columns...], [rows], &ref) * Here rows is an integer-valued array that specifies what rows to be * read. */ 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 = NULL; SLang_Array_Type **data_arrays = NULL; SLang_Array_Type *columns_at = NULL; 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; } status = -1; f = ft->fptr; if (f == NULL) goto free_and_return_status; 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 be non-negative"); status = -1; goto free_and_return_status; } if ((firstrow <= 0) || ((firstrow > num_rows_in_table) && (num_rows > 0))) { 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; ci[i].repeat_orig = repeat; 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 */ { if (-type == TBIT) { SLang_verror (SL_NOT_IMPLEMENTED, "Read bit-data from the heap is not supported. Please report this problem"); status = -1; goto free_and_return_status; } 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) { unsigned int num_substrs; /* 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; num_substrs = 1; } else { if (ci[i].width > 0) num_substrs = repeat / ci[i].width; else num_substrs = 0; } status = read_string_column_data (f, (type < 0), repeat, num_substrs, 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, ci[i].repeat_orig); 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 (f->fptr == NULL) return -1; 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; } static int set_bscale (FitsFile_Type *f, double *scale, double *zero) { int status = 0; if (f->fptr == NULL) return -1; return fits_set_bscale (f->fptr, *scale, *zero, &status); } static int set_tscale (FitsFile_Type *f, int *colp, double *scale, double *zero) { int status = 0; if (f->fptr == NULL) return -1; return fits_set_tscale (f->fptr, *colp, *scale, *zero, &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 #define D SLANG_DOUBLE_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_get_colnum_casesen", get_colnum_casesen, 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), MAKE_INTRINSIC_3("_fits_set_bscale", set_bscale, I, F, D, D), MAKE_INTRINSIC_4("_fits_set_tscale", set_tscale, I, F, I, D, D), /* 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 char *Module_Version_String = MODULE_VERSION_STRING; 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; compiled_version = COMPILED_CFITSIO_VERSION; (void) fits_get_version (&linked_version); 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-pre0.4.7-17/src/cfitsio-version.c0000644000175000000620000000030214124641731017347 0ustar johnstaff#include int main (int argc, char **argv) { float v; (void) argc; (void) argv; fits_get_version (&v); printf ("#define COMPILED_CFITSIO_VERSION %f\n", v); return 0; } slcfitsio-pre0.4.7-17/share/0002755000175000000620000000000014124641731014402 5ustar johnstaffslcfitsio-pre0.4.7-17/share/readrmf.sl0000644000175000000620000000447614124641731016373 0ustar johnstaffrequire ("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-pre0.4.7-17/changes.txt0000644000175000000620000000365614146404553015464 0ustar johnstaffChanges since 0.4.6 1. Documentation tweaks (Manfred Hanke) 2. src/cfitsio-module.c: Added support for SLANG_LONG_TYPE to the read_key function. 3. src/fits.sl: Renamed the private function do_fits_error to fits_check_error and made it public. 4. src/fits.sl, src/version.h,...: Version numbers now track the changes.txt file. 5. src/fits.sl: Added wrappers for fits_get_num_hdus, fits_movrel_hdu, fits_movabs_hdu. 6. src/fits.sl: Added fits_delete_key/col wrappers. 7. src/fits.sl: fits_info: Changed format specifier %s to %S for the fits descriptor. 8. src/fits.sl: Added support for a casesens qualifier to enable case-sensitive column names. (Manfred Hanke, Christian Schmid). 9. src/Makefile.in: generate cfitsio.h to include fitsio.h to ensure that the specified fitsio.h file is picked up. Unfortunately, fitsio.h is often scattered all over the filesystem. 10. src/fits.sl: Fixed a regression in fits_read_cell 11. src/cfitsio-module.c: The fits_get_eqcoltype function returns a width value such that the number of substrings is repeat/width. The module was interpreting the width as the number of substrings. Note that the fits standard does not define a width for TFORM fields. Apparantly this is a cfitsio extension. 12. src/fits.sl:fits_write_binary_table: Added 64 bit integer support. 13. src/cfitsio-module.c: Added explicit support for writing short and long integer keywords. 14. src/cfitsio-module.c: If fits_update_key is passed a char-type, then that value will be written as a fits logical keyword value. 15. configure: Parse /etc/ld.so.conf to find additional system lib directories. 16. Cfitsio version 4.0.0 introduced a backwards-incompatible new versioning scheme. Debian patches (courtesy of Rafael Laboissière) were added to to deal with both the old and new schemes. 17. Updated aclocal.m4; added support for CPPFLAGS (based upon patch from Rafael Laboissière) slcfitsio-pre0.4.7-17/README0000644000175000000620000000660414124641731014164 0ustar johnstaffThe 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. slcfitsio-pre0.4.7-17/autoconf/0002755000175000000620000000000014146404553015121 5ustar johnstaffslcfitsio-pre0.4.7-17/autoconf/config.sub0000755000175000000620000010645014146404553017110 0ustar johnstaff#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # 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 or ALIAS Canonicalize a configuration name. Options: -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 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo "$1" | sed 's/-[^-]*$//'` if [ "$basic_machine" != "$1" ] then os=`echo "$1" | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2*) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; 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 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) 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) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; 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 ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # 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 | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -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 ;; -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 ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-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 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine$os" exit # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: slcfitsio-pre0.4.7-17/autoconf/Makefile0000644000175000000620000000047314124641731016560 0ustar johnstaff../configure: aclocal.m4 configure.in /bin/rm -rf autom4te.cache autoconf && mv ./configure .. update: config.sub config.guess config.guess: /usr/share/misc/config.guess /bin/cp -f /usr/share/misc/config.guess config.guess config.sub: /usr/share/misc/config.sub /bin/cp -f /usr/share/misc/config.sub config.sub slcfitsio-pre0.4.7-17/autoconf/scripts/0002755000175000000620000000000014124641731016605 5ustar johnstaffslcfitsio-pre0.4.7-17/autoconf/scripts/getsyslibs.sh0000755000175000000620000000236614124641731021341 0ustar johnstaff#!/bin/sh # This script parses /etc/ld.so.conf and returns lib and include directories # in a form that JD_CHECK_FOR_LIBRARY can grok. SH_TRUE=0 SH_FALSE=1 # Usage: sh_substr string a b ==> string[a:b] (1s-based) sh_substr() { echo "$1" | cut "-c" "$2-$3" } # if sh_is_comment line; then ... sh_is_comment() { ch=`sh_substr "$1" 1 1` if test "X$ch" = "X#" -o "X$ch" = "X" then return $SH_TRUE; fi return $SH_FALSE; } sh_read_ldsoconf () { file="$1" dirlist="" if test ! -f "$file" then return $SH_FALSE; fi while read line do if sh_is_comment "$line"; then continue; fi read p1 p2 pn << EOF ${line} EOF if test "$p1" = "include" then for file in $p2 do dirs=`sh_read_ldsoconf "$file"` dirlist="$dirlist $dirs" done else dirlist="$dirlist $p1" fi done < "$file" echo "$dirlist" } dirs=`sh_read_ldsoconf "/etc/ld.so.conf"` XY="" for Y in $dirs do if test "/usr/lib" = `sh_substr $Y 1 8` then X="/usr/include" else if test "/lib" = `sh_substr $Y 1 4` then X="/usr/include" else X=`dirname $Y`"/include" fi fi if test -d "$Y" then XY="$XY $X,$Y" fi done echo $XY slcfitsio-pre0.4.7-17/autoconf/install-sh0000755000175000000620000001273614124641731017131 0ustar johnstaff#!/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-pre0.4.7-17/autoconf/configure.in0000644000175000000620000000231214124641731017423 0ustar johnstaffdnl -*- 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-pre0.4.7-17/autoconf/Makefile.in0000644000175000000620000000166414124641731017170 0ustar johnstaff# -*- sh -*- @SET_MAKE@ SHELL = /bin/sh all: Makefile src/Makefile cd src; $(MAKE) all Makefile: configure autoconf/Makefile.in @echo "Makefile is older than the configure script". @echo "Please re-run the configure script." @exit 1 src/Makefile: configure src/Makefile.in src/config.hin @echo "src/Makefile is older than its dependencies". @echo "Please re-run the configure script." @exit 1 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-pre0.4.7-17/autoconf/mkinsdir.sh0000755000175000000620000000113614124641731017274 0ustar johnstaff#! /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-pre0.4.7-17/autoconf/config.guess0000755000175000000620000012637314146404553017453 0ustar johnstaff#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -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 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) if objdump -f /bin/sh | grep -q elf32-x86-64; then echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 else echo "$UNAME_MACHINE"-pc-linux-"$LIBC" fi exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&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-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: slcfitsio-pre0.4.7-17/autoconf/aclocal.m40000644000175000000620000007212414146404553016765 0ustar johnstaffdnl# -*- mode: sh; mode: fold -*- dnl# 0.3.4.0: Added $(CPPFLAGS) dnl# 0.3.3-1: Use INSTALL instead of INSTALL_DATA to install modules to get executable permissions dnl# 0.3.3-0: Added $(OBJ_O_DEPS) and $(ELF_O_DEPS) to PROGRAM_OBJECT_RULES dnl# 0.3.2-0: Add rpath support for freebsd dnl# 0.3.1-0: New output variable: CC_SHARED_FLAGS; CC_SHARED is deprecated dnl# 0.3.0-0: Added support for parsing /etc/ld.so.conf dnl# 0.2.7-3: Change ncurses5w-config to ncursesw5-config (Gilles Espinasse) dnl# 0.2.7-2: For the Makefile rules, use cd foo && bar instead of cd foo; bar dnl# 0.2.7-1: Use "$ARCH"elfobjs instead of elf"$ARCH"objs for better flexibility dnl# 0.2.7-0: Instead of expanding $ARCH at configure time, use \$ARCH for compile-time expansion dnl# 0.2.6-2: Missing hyphen for cygwin ELFLIB_MAJOR (Marco Atzeri) dnl# 0.2.6-1: Added optional second and third arguments to AC_DEFINE (Marco Atzeri) dnl# 0.2.6-0: On cygwin, change libfooX_Y_Z.dll to cygfoo-X_Y_Z.dll (Marco Atzeri) dnl# 0.2.5-3: Changed AC_DEFUN(foo...) to AC_DEFUN([foo]...) dnl# 0.2.5-2: JD_CHECK_FOR_LIBRARY will alse output *_INC_DIR and *_LIB_DIR dnl# 0.2.5-1: Updated using autoupdate dnl# 0.2.5-0: M_LIB output variable created for haiku support (Scott McCreary) dnl# 0.2.4-0: Added optional 3rd argument to JD_WITH_LIBRARY for a default path dnl# 0.2.3-2: X was missing in a "test" statement (Joerg Sommer) dnl# 0.2.3-1: AC_AIX needs to be called before running the compiler (Miroslav Lichvar) dnl# 0.2.3: rewrote JD_CHECK_FOR_LIBRARY to loop over include/lib pairs dnl# 0.2.2-1: JD_WITH_LIBRARY bug-fix dnl# 0.2.2: Use ncurses5-config to search for terminfo dirs. dnl# 0.2.1: Add .dll.a to list of extensions to when searching for libs (cygwin) dnl# 0.2.0: Added install target name and more fixes for cygwin dnl# 0.1.12: Improved support for cygwin dnl# 0.1.11: Fixed elf linking on freebsd (Renato Botelho (garga at freebsd, org) 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. 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, AC_HELP_STRING([--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 \ -Wformat=2" # 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) \$(OBJ_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) \$(ELF_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_PATH_PROG(nc5config, ncurses5-config, no) if test "$nc5config" = "no" then AC_PATH_PROG(nc5config, ncursesw5-config, no) fi AC_MSG_CHECKING(for terminfo) if test "$nc5config" != "no" then MISC_TERMINFO_DIRS=`$nc5config --terminfo` else MISC_TERMINFO_DIRS="" fi JD_Terminfo_Dirs="$MISC_TERMINFO_DIRS \ /usr/lib/terminfo \ /usr/share/terminfo \ /usr/share/lib/terminfo \ /usr/local/lib/terminfo" 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,1,[Define to use termcap]) fi AC_SUBST(TERMCAP)dnl AC_SUBST(MISC_TERMINFO_DIRS)dnl ]) dnl#}}} AC_DEFUN([JD_ANSI_CC], dnl#{{{ [ AC_AIX AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CPP]) AC_REQUIRE([AC_PROG_GCC_TRADITIONAL]) AC_ISC_POSIX 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,1,[Special define needed for HPUX]) 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_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ 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="" dnl# AH_TEMPLATE([HAVE_DLOPEN],1,[Define if you have dlopen]) AC_CHECK_HEADER(dlfcn.h,[ AC_DEFINE(HAVE_DLFCN_H,1,[Define if you have the dlfcn.h header]) AC_CHECK_LIB(dl,dlopen,[ DYNAMIC_LINK_LIB="-ldl" AC_DEFINE(HAVE_DLOPEN,1,[Define if you have dlopen]) ],[ AC_CHECK_FUNC(dlopen,AC_DEFINE(HAVE_DLOPEN,[Define if you have dlopen])) if test "$ac_cv_func_dlopen" != yes then AC_MSG_WARN(cannot perform dynamic linking) fi ])]) AC_SUBST(DYNAMIC_LINK_LIB) if test "$GCC" = yes then if test X"$CFLAGS" = X then CFLAGS="-O2" fi fi dnl #Some defaults ELFLIB="lib\$(THIS_LIB).so" ELFLIB_MAJOR="\$(ELFLIB).\$(ELF_MAJOR_VERSION)" ELFLIB_MAJOR_MINOR="\$(ELFLIB_MAJOR).\$(ELF_MINOR_VERSION)" ELFLIB_MAJOR_MINOR_MICRO="\$(ELFLIB_MAJOR_MINOR).\$(ELF_MICRO_VERSION)" dnl# This specifies the target to use in the makefile to install the shared library INSTALL_ELFLIB_TARGET="install-elf-and-links" ELFLIB_BUILD_NAME="\$(ELFLIB_MAJOR_MINOR_MICRO)" INSTALL_MODULE="\$(INSTALL)" SLANG_DLL_CFLAGS="" M_LIB="-lm" case "$host_os" in *linux*|*gnu*|k*bsd*-gnu ) DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -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_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; *solaris* ) if test "$GCC" = yes then DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-ztext -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-G -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -K PIC" ELF_LINK="\$(CC) \$(LDFLAGS) -G -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-G -K PIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" 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) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-G -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -K pic" # ELF_LINK="ld -G -z text -h#" ELF_LINK="\$(CC) \$(LDFLAGS) -G -z text -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-G -K pic" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" 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) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS)" # default anyhow ELF_LINK="\$(CC) \$(LDFLAGS) -shared -o \$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-shared" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" fi ;; *darwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -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_FLAGS="-bundle -flat_namespace -undefined suppress -fno-common" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" 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" ELFLIB_MAJOR_MINOR_MICRO="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION).\$(ELF_MICRO_VERSION).dylib" ;; *freebsd* ) ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" #if test "X$PORTOBJFORMAT" = "Xelf" ; then # ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-soname,\$(ELFLIB_MAJOR)" #else # ELF_LINK="ld -Bshareable -x" #fi ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; *cygwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" SLANG_DLL_CFLAGS="-DSLANG_DLL=1" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -DBUILD_DLL=1" 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_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR) -Wl,--out-implib=\$(DLL_IMPLIB_NAME)" ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED_FLAGS="-shared -DSLANG_DLL=1" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" dnl# CYGWIN prohibits undefined symbols when linking shared libs SLANG_LIB_FOR_MODULES="-L\$(ELFDIR) -lslang" INSTALL_MODULE="\$(INSTALL)" INSTALL_ELFLIB_TARGET="install-elf-cygwin" ELFLIB="lib\$(THIS_LIB).dll" ELFLIB_MAJOR="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION).dll" ELFLIB_MAJOR_MINOR="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION)_\$(ELF_MINOR_VERSION).dll" ELFLIB_MAJOR_MINOR_MICRO="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION)_\$(ELF_MINOR_VERSION)_\$(ELF_MICRO_VERSION).dll" ELFLIB_BUILD_NAME="\$(ELFLIB_MAJOR)" ;; *haiku* ) M_LIB="" DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB)" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; * ) echo "Note: ELF compiler for host_os=$host_os may be wrong" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" 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_FLAGS) AC_SUBST(CC_SHARED) AC_SUBST(ELFLIB) AC_SUBST(ELFLIB_MAJOR) AC_SUBST(ELFLIB_MAJOR_MINOR) AC_SUBST(ELFLIB_MAJOR_MINOR_MICRO) AC_SUBST(SLANG_LIB_FOR_MODULES) AC_SUBST(DLL_IMPLIB_NAME) AC_SUBST(INSTALL_MODULE) AC_SUBST(INSTALL_ELFLIB_TARGET) AC_SUBST(ELFLIB_BUILD_NAME) AC_SUBST(SLANG_DLL_CFLAGS) AC_SUBST(M_LIB) ]) 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="" if test X"$jd_with_$1_library" = X then jd_with_$1_library="" fi 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) dnl# AC_MSG_ERROR(--with-$1 requires a value-- try yes or no) jd_with_$1_library="yes" ;; xunspecified) ;; xyes) jd_with_$1_library="yes" ;; *) jd_with_$1_library="yes" 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_with_$1_library="yes" 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_with_$1_library="yes" 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 dnl# If $3 is present, then also look in $3/include+$3/lib AC_DEFUN([JD_CHECK_FOR_LIBRARY], dnl#{{{ [ AC_REQUIRE([JD_EXPAND_PREFIX])dnl AC_REQUIRE([JD_GET_SYS_INCLIBS])dnl dnl JD_UPPERCASE($1,JD_ARG1) JD_WITH_LIBRARY_PATHS($1) AC_MSG_CHECKING(for the $1 library and header files $2) if test X"$jd_with_$1_library" != Xno then jd_$1_inc_file=$2 dnl# 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 inc_and_lib_dirs="\ $jd_prefix_incdir,$jd_prefix_libdir \ /usr/local/$1/include,/usr/local/$1/lib \ /usr/local/include/$1,/usr/local/lib \ /usr/local/include,/usr/local/lib \ $JD_SYS_INCLIBS \ /usr/include/$1,/usr/lib \ /usr/$1/include,/usr/$1/lib \ /usr/include,/usr/lib \ /opt/include/$1,/opt/lib \ /opt/$1/include,/opt/$1/lib \ /opt/include,/opt/lib" if test X$3 != X then inc_and_lib_dirs="$3/include,$3/lib $inc_and_lib_dirs" fi case "$host_os" in *darwin* ) exts="dylib so a" ;; *cygwin* ) exts="dll.a so a" ;; * ) exts="so a" esac xincfile="$jd_$1_inc_file" xlibfile="lib$1" jd_with_$1_library="no" for include_and_lib in $inc_and_lib_dirs do # Yuk. Is there a better way to set these variables?? xincdir=`echo $include_and_lib | tr ',' ' ' | awk '{print [$]1}'` xlibdir=`echo $include_and_lib | tr ',' ' ' | awk '{print [$]2}'` found=0 if test -r $xincdir/$xincfile then for E in $exts do if test -r "$xlibdir/$xlibfile.$E" then jd_$1_include_dir="$xincdir" jd_$1_library_dir="$xlibdir" jd_with_$1_library="yes" found=1 break fi done fi if test $found -eq 1 then break fi done fi fi if test X"$jd_$1_include_dir" != X -a X"$jd_$1_library_dir" != X then AC_MSG_RESULT(yes: $jd_$1_library_dir and $jd_$1_include_dir) jd_with_$1_library="yes" 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 JD_ARG1[]_LIB_DIR=$jd_$1_library_dir if test "X$jd_$1_library_dir" = "X/usr/lib" -o "X$jd_$1_include_dir" = "X/usr/include" then JD_ARG1[]_LIB="" else JD_SET_RPATH($jd_$1_library_dir) fi JD_ARG1[]_INC=-I$jd_$1_include_dir JD_ARG1[]_INC_DIR=$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_with_$1_library="no" JD_ARG1[]_INC="" JD_ARG1[]_LIB="" JD_ARG1[]_INC_DIR="" JD_ARG1[]_LIB_DIR="" fi AC_SUBST(JD_ARG1[]_LIB) AC_SUBST(JD_ARG1[]_INC) AC_SUBST(JD_ARG1[]_LIB_DIR) AC_SUBST(JD_ARG1[]_INC_DIR) ]) dnl#}}} AC_DEFUN([JD_WITH_LIBRARY], dnl#{{{ [ JD_CHECK_FOR_LIBRARY($1, $2, $3) 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-pre0.4.7-17/ChangeLog0000644000175000000620000001774014124641731015061 0ustar johnstaff2010-1-27 John E. Davis * src/fits.sl (fits_iterate): Added a fits_iterate function. Docs to come... (_fits_sl_version_string): 0.4.6-0 2010-1-22 John E. Davis * src/fits.sl: fits_read_col can read a subset of rows using the row and num qualifiers. 2009-10-5 John E. Davis * src/version.h (MODULE_PATCH_LEVEL): bumped to 0.4.6 * src/cfitsio-module.c (insert_rows): Bug fix to allow rows to be inserted into an empty table (Manfred Hanke, Christian Schmid) 2009-3-6 John E. Davis * src/fits.sl (reshape_string_array): new function to reshape a rAw string column into r/w substrings. (_fits_sl_version_string): bumped to 0.4.5-0 * src/cfitsio-module.c (read_string_cell): modified to deal with rAw format strings. * src/version.h (MODULE_PATCH_LEVEL): updated to version 0.4.5 2008-12-1 John E. Davis * src/fits.sl (get_open_hdu_of_type): If an extension was specified as part of the name, then open the file at that extension. (Patch provided by Manfred Hanke) (_fits_sl_version_string): bumped to 0.4.4-1 2008-6-12 John E. Davis * src/version.h (MODULE_PATCH_LEVEL): bumped to 0.4.3 * src/cfitsio-module.c (write_col): unsigned ints were getting written as ints, causing integer overflows. 2008-5-1 John E. Davis * src/version.h (MODULE_PATCH_LEVEL): bumped to 0.4.2 * src/cfitsio-module.c (FitsFile_Type): Made changes to use the physical integer sizes where possible instead of the confusing cfitsio types, e.g., INT32_TYPE instead of TLONG. The changes reduces the memory usage on 64 bit systems. 2008-4-29 John E. Davis * src/version.h (MODULE_PATCH_LEVEL): bumped to 0.4.1 * src/cfitsio-module.c (FitsFile_Type): I was using SIZEOF_INT as bits rather than bytes. Gr.... * src/fits.sl (_fits_sl_version_string): Bumped to 0.4.3-3 2008-1-24 John E. Davis * src/fits.sl (fits_write_binary_table): Bug fixed when writing vector columns. 2007-12-7 John E. Davis * src/fits.sl (fits_write_binary_table): Fixed infinite loop bug in fits_write_binary_table (_fits_sl_version_string): bumped to 0.4.3-2 2007-11-16 John E. Davis * src/version.h (MODULE_VERSION_NUMBER): Changed to 0.3.9 2007-10-3 John E. Davis * src/cfitsio-module.c: Started adding support for LONGLONG. 2007-9-18 John E. Davis * src/cfitsio-module.c (map_fitsio_type_to_slang): improved support for bit columns that are not a multiple of 8. 2007-5-15 John E. Davis * src/fits.sl (_fits_sl_version_string): bumped to 0.4.3-1 (fits_read_key): call _fits_clear_errmsg if status==_FITS_KEY_NO_EXIST. 2007-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-pre0.4.7-17/INSTALL.txt0000644000175000000620000001712314124641731015151 0ustar johnstaffSee 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-pre0.4.7-17/cfitsio.lis0000644000175000000620000000064414124641731015453 0ustar johnstaff@cfitsio.lis @configure 0755 @COPYRIGHT @README @INSTALL.txt @ChangeLog @changes.txt @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-pre0.4.7-17/configure0000755000175000000620000061174314146404553015224 0ustar johnstaff#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # 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 as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # 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'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="src/cfitsio-module.c" ac_default_prefix=/usr/local # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS SL_FILES_INSTALL_DIR MODULE_INSTALL_DIR slang_patchlevel_version slang_minor_version slang_major_version slang_version CFITSIO_INC_DIR CFITSIO_LIB_DIR CFITSIO_INC CFITSIO_LIB SLANG_INC_DIR SLANG_LIB_DIR SLANG_INC SLANG_LIB X_EXTRA_LIBS X_LIBS X_PRE_LIBS X_CFLAGS XMKMF M_LIB SLANG_DLL_CFLAGS ELFLIB_BUILD_NAME INSTALL_ELFLIB_TARGET INSTALL_MODULE DLL_IMPLIB_NAME SLANG_LIB_FOR_MODULES ELFLIB_MAJOR_MINOR_MICRO ELFLIB_MAJOR_MINOR ELFLIB_MAJOR ELFLIB CC_SHARED CC_SHARED_FLAGS DYNAMIC_LINK_FLAGS ELF_DEP_LIBS ELF_LINK_CMD ELF_LINK ELF_CFLAGS ELF_CC DYNAMIC_LINK_LIB EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC CONFIG_DIR SET_MAKE INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM RANLIB host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL RPATH' ac_subst_files='' ac_user_opts=' enable_option_checking with_x with_slang with_slanglib with_slanginc with_cfitsio with_cfitsiolib with_cfitsioinc ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP XMKMF' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=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 ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_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'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" 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 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures 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 \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _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 LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* 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_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append 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 as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > 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 cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } 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. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_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 # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_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. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## 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 as_fn_error $? "cannot find install-sh, install.sh, or shtool in autoconf \"$srcdir\"/autoconf" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi 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. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&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_fn_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 rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$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' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 as_fn_error $? "\"This software does not support configuring from another directory. See the INSTALL file\"" "$LINENO" 5 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` 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_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" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h 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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h if test $ac_cv_c_compiler_gnu = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } if ${ac_cv_prog_gcc_traditional+:} false; then : $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 $as_echo_n "checking for library containing strerror... " >&6; } if ${ac_cv_search_strerror+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strerror (); int main () { return strerror (); ; return 0; } _ACEOF for ac_lib in '' cposix; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_strerror=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_strerror+:} false; then : break fi done if ${ac_cv_search_strerror+:} false; then : else ac_cv_search_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 $as_echo "$ac_cv_search_strerror" >&6; } ac_res=$ac_cv_search_strerror if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef hpux yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : $as_echo "#define _HPUX_SOURCE 1" >>confdefs.h if test "$CC" = cc; then CC="cc -Ae"; fi fi rm -f conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: checking C compiler that understands ANSI prototypes" >&5 $as_echo_n "checking C compiler that understands ANSI prototypes... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { extern int silly (int); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC looks ok. Good." >&5 $as_echo "$CC looks ok. Good." >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC is not a good enough compiler" >&5 $as_echo "$CC is not a good enough compiler" >&6; } as_fn_error $? "Set env variable CC to your ANSI compiler and rerun configure." "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext DYNAMIC_LINK_LIB="" ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" if test "x$ac_cv_header_dlfcn_h" = xyes; then : $as_echo "#define HAVE_DLFCN_H 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : DYNAMIC_LINK_LIB="-ldl" $as_echo "#define HAVE_DLOPEN 1" >>confdefs.h else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : $as_echo "#define HAVE_DLOPEN Define if you have dlopen" >>confdefs.h fi if test "$ac_cv_func_dlopen" != yes then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot perform dynamic linking" >&5 $as_echo "$as_me: WARNING: cannot perform dynamic linking" >&2;} fi fi fi if test "$GCC" = yes then if test X"$CFLAGS" = X then CFLAGS="-O2" fi fi ELFLIB="lib\$(THIS_LIB).so" ELFLIB_MAJOR="\$(ELFLIB).\$(ELF_MAJOR_VERSION)" ELFLIB_MAJOR_MINOR="\$(ELFLIB_MAJOR).\$(ELF_MINOR_VERSION)" ELFLIB_MAJOR_MINOR_MICRO="\$(ELFLIB_MAJOR_MINOR).\$(ELF_MICRO_VERSION)" INSTALL_ELFLIB_TARGET="install-elf-and-links" ELFLIB_BUILD_NAME="\$(ELFLIB_MAJOR_MINOR_MICRO)" INSTALL_MODULE="\$(INSTALL)" SLANG_DLL_CFLAGS="" M_LIB="-lm" case "$host_os" in *linux*|*gnu*|k*bsd*-gnu ) DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -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_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; *solaris* ) if test "$GCC" = yes then DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-ztext -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-G -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -K PIC" ELF_LINK="\$(CC) \$(LDFLAGS) -G -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-G -K PIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" 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) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-G -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -K pic" # ELF_LINK="ld -G -z text -h#" ELF_LINK="\$(CC) \$(LDFLAGS) -G -z text -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-G -K pic" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" 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) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS)" # default anyhow ELF_LINK="\$(CC) \$(LDFLAGS) -shared -o \$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-shared" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" fi ;; *darwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -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_FLAGS="-bundle -flat_namespace -undefined suppress -fno-common" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" 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" ELFLIB_MAJOR_MINOR_MICRO="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION).\$(ELF_MICRO_VERSION).dylib" ;; *freebsd* ) ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" #if test "X$PORTOBJFORMAT" = "Xelf" ; then # ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-soname,\$(ELFLIB_MAJOR)" #else # ELF_LINK="ld -Bshareable -x" #fi ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; *cygwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" SLANG_DLL_CFLAGS="-DSLANG_DLL=1" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -DBUILD_DLL=1" 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_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR) -Wl,--out-implib=\$(DLL_IMPLIB_NAME)" ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED_FLAGS="-shared -DSLANG_DLL=1" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" SLANG_LIB_FOR_MODULES="-L\$(ELFDIR) -lslang" INSTALL_MODULE="\$(INSTALL)" INSTALL_ELFLIB_TARGET="install-elf-cygwin" ELFLIB="lib\$(THIS_LIB).dll" ELFLIB_MAJOR="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION).dll" ELFLIB_MAJOR_MINOR="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION)_\$(ELF_MINOR_VERSION).dll" ELFLIB_MAJOR_MINOR_MICRO="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION)_\$(ELF_MINOR_VERSION)_\$(ELF_MICRO_VERSION).dll" ELFLIB_BUILD_NAME="\$(ELFLIB_MAJOR)" ;; *haiku* ) M_LIB="" DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB)" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; * ) echo "Note: ELF compiler for host_os=$host_os may be wrong" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 $as_echo_n "checking for X... " >&6; } # Check whether --with-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 case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : $as_echo_n "(cached) " >&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 -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir cat >Imakefile <<'_ACEOF' incroot: @echo incroot='${INCROOT}' usrlibdir: @echo usrlibdir='${USRLIBDIR}' libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl dylib la dll; 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) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /usr/lib64 | /lib | /lib64) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r 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/X11R7/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R7 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R7/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R7 /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 Xlib.h. # First, try using that file with no special directory specified. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # We can compile using X headers with no special include directory. ac_x_includes= else for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.i 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="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else LIBS=$ac_save_LIBS for ac_dir in `$as_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 dylib la dll; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no case $ac_x_includes,$ac_x_libraries in #( no,* | *,no | *\'*) # Didn't find X, or a directory has "'" in its name. ac_cv_have_x="have_x=no";; #( *) # 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'" esac fi ;; #( *) have_x=yes;; esac eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 $as_echo "$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'" { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 $as_echo "libraries $x_libraries, headers $x_includes" >&6; } fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. $as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h 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 . . . . { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 $as_echo_n "checking whether -R must be followed by a space... " >&6; } ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" ac_xsave_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } X_LIBS="$X_LIBS -R $x_libraries" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 $as_echo "neither works" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_c_werror_flag=$ac_xsave_c_werror_flag LIBS=$ac_xsave_LIBS 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XOpenDisplay (); int main () { return XOpenDisplay (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dnet_dnet_ntoa=yes else ac_cv_lib_dnet_dnet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dnet_stub_dnet_ntoa=yes else ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f core 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. ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" if test "x$ac_cv_func_gethostbyname" = xyes; then : fi if test $ac_cv_func_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 $as_echo_n "checking for gethostbyname in -lbsd... " >&6; } if ${ac_cv_lib_bsd_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bsd_gethostbyname=yes else ac_cv_lib_bsd_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 $as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; 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. ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" if test "x$ac_cv_func_connect" = xyes; then : fi if test $ac_cv_func_connect = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 $as_echo_n "checking for connect in -lsocket... " >&6; } if ${ac_cv_lib_socket_connect+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char connect (); int main () { return connect (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_connect=yes else ac_cv_lib_socket_connect=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 $as_echo "$ac_cv_lib_socket_connect" >&6; } if test "x$ac_cv_lib_socket_connect" = xyes; then : X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove" if test "x$ac_cv_func_remove" = xyes; then : fi if test $ac_cv_func_remove = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 $as_echo_n "checking for remove in -lposix... " >&6; } if ${ac_cv_lib_posix_remove+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char remove (); int main () { return remove (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_posix_remove=yes else ac_cv_lib_posix_remove=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 $as_echo "$ac_cv_lib_posix_remove" >&6; } if test "x$ac_cv_lib_posix_remove" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat" if test "x$ac_cv_func_shmat" = xyes; then : fi if test $ac_cv_func_shmat = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 $as_echo_n "checking for shmat in -lipc... " >&6; } if ${ac_cv_lib_ipc_shmat+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shmat (); int main () { return shmat (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ipc_shmat=yes else ac_cv_lib_ipc_shmat=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 $as_echo "$ac_cv_lib_ipc_shmat" >&6; } if test "x$ac_cv_lib_ipc_shmat" = xyes; 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 $as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char IceConnectionNumber (); int main () { return IceConnectionNumber (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ICE_IceConnectionNumber=yes else ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 $as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; 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 $as_echo_n "checking for the slang library and header files ... " >&6; } if test X"$jd_with_slang_library" != Xno then jd_slang_inc_file= 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 inc_and_lib_dirs="\ $jd_prefix_incdir,$jd_prefix_libdir \ /usr/local/slang/include,/usr/local/slang/lib \ /usr/local/include/slang,/usr/local/lib \ /usr/local/include,/usr/local/lib \ $JD_SYS_INCLIBS \ /usr/include/slang,/usr/lib \ /usr/slang/include,/usr/slang/lib \ /usr/include,/usr/lib \ /opt/include/slang,/opt/lib \ /opt/slang/include,/opt/slang/lib \ /opt/include,/opt/lib" if test X != X then inc_and_lib_dirs="/include,/lib $inc_and_lib_dirs" fi case "$host_os" in *darwin* ) exts="dylib so a" ;; *cygwin* ) exts="dll.a so a" ;; * ) exts="so a" esac xincfile="$jd_slang_inc_file" xlibfile="libslang" jd_with_slang_library="no" for include_and_lib in $inc_and_lib_dirs do # Yuk. Is there a better way to set these variables?? xincdir=`echo $include_and_lib | tr ',' ' ' | awk '{print $1}'` xlibdir=`echo $include_and_lib | tr ',' ' ' | awk '{print $2}'` found=0 if test -r $xincdir/$xincfile then for E in $exts do if test -r "$xlibdir/$xlibfile.$E" then jd_slang_include_dir="$xincdir" jd_slang_library_dir="$xlibdir" jd_with_slang_library="yes" found=1 break fi done fi if test $found -eq 1 then break fi done fi fi if test X"$jd_slang_include_dir" != X -a X"$jd_slang_library_dir" != X then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: $jd_slang_library_dir and $jd_slang_include_dir" >&5 $as_echo "yes: $jd_slang_library_dir and $jd_slang_include_dir" >&6; } jd_with_slang_library="yes" SLANG_LIB=-L$jd_slang_library_dir SLANG_LIB_DIR=$jd_slang_library_dir if test "X$jd_slang_library_dir" = "X/usr/lib" -o "X$jd_slang_include_dir" = "X/usr/include" 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*|*freebsd*) 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 _already_there=0 for X in `echo $RPATH | sed 's/:/ /g'` do if test "$X" = "$jd_slang_library_dir" then _already_there=1 break fi done if test $_already_there = 0 then RPATH="$RPATH:$jd_slang_library_dir" fi fi fi fi SLANG_INC=-I$jd_slang_include_dir SLANG_INC_DIR=$jd_slang_include_dir if test "X$jd_slang_include_dir" = "X/usr/include" then SLANG_INC="" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } jd_with_slang_library="no" SLANG_INC="" SLANG_LIB="" SLANG_INC_DIR="" SLANG_LIB_DIR="" fi if test "$jd_with_slang_library" = "no" then as_fn_error $? "unable to find the slang library and header file $jd_slang_inc_file" "$LINENO" 5 fi jd_cfitsio_include_dir="" jd_cfitsio_library_dir="" if test X"$jd_with_cfitsio_library" = X then jd_with_cfitsio_library="" fi # Check whether --with-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) jd_with_cfitsio_library="yes" ;; xunspecified) ;; xyes) jd_with_cfitsio_library="yes" ;; *) jd_with_cfitsio_library="yes" jd_cfitsio_include_dir="$jd_with_cfitsio_arg"/include jd_cfitsio_library_dir="$jd_with_cfitsio_arg"/lib ;; esac # Check whether --with-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) as_fn_error $? "--with-cfitsiolib requres a value" "$LINENO" 5 ;; *) jd_with_cfitsio_library="yes" jd_cfitsio_library_dir="$jd_with_cfitsiolib_arg" ;; esac # Check whether --with-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) as_fn_error $? "--with-cfitsioinc requres a value" "$LINENO" 5 ;; xunspecified) ;; xno) ;; *) jd_with_cfitsio_library="yes" jd_cfitsio_include_dir="$jd_with_cfitsioinc_arg" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the cfitsio library and header files fitsio.h" >&5 $as_echo_n "checking for the cfitsio library and header files fitsio.h... " >&6; } if test X"$jd_with_cfitsio_library" != Xno then jd_cfitsio_inc_file=fitsio.h 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 inc_and_lib_dirs="\ $jd_prefix_incdir,$jd_prefix_libdir \ /usr/local/cfitsio/include,/usr/local/cfitsio/lib \ /usr/local/include/cfitsio,/usr/local/lib \ /usr/local/include,/usr/local/lib \ $JD_SYS_INCLIBS \ /usr/include/cfitsio,/usr/lib \ /usr/cfitsio/include,/usr/cfitsio/lib \ /usr/include,/usr/lib \ /opt/include/cfitsio,/opt/lib \ /opt/cfitsio/include,/opt/cfitsio/lib \ /opt/include,/opt/lib" if test X != X then inc_and_lib_dirs="/include,/lib $inc_and_lib_dirs" fi case "$host_os" in *darwin* ) exts="dylib so a" ;; *cygwin* ) exts="dll.a so a" ;; * ) exts="so a" esac xincfile="$jd_cfitsio_inc_file" xlibfile="libcfitsio" jd_with_cfitsio_library="no" for include_and_lib in $inc_and_lib_dirs do # Yuk. Is there a better way to set these variables?? xincdir=`echo $include_and_lib | tr ',' ' ' | awk '{print $1}'` xlibdir=`echo $include_and_lib | tr ',' ' ' | awk '{print $2}'` found=0 if test -r $xincdir/$xincfile then for E in $exts do if test -r "$xlibdir/$xlibfile.$E" then jd_cfitsio_include_dir="$xincdir" jd_cfitsio_library_dir="$xlibdir" jd_with_cfitsio_library="yes" found=1 break fi done fi if test $found -eq 1 then break fi done fi fi if test X"$jd_cfitsio_include_dir" != X -a X"$jd_cfitsio_library_dir" != X then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: $jd_cfitsio_library_dir and $jd_cfitsio_include_dir" >&5 $as_echo "yes: $jd_cfitsio_library_dir and $jd_cfitsio_include_dir" >&6; } jd_with_cfitsio_library="yes" CFITSIO_LIB=-L$jd_cfitsio_library_dir CFITSIO_LIB_DIR=$jd_cfitsio_library_dir if test "X$jd_cfitsio_library_dir" = "X/usr/lib" -o "X$jd_cfitsio_include_dir" = "X/usr/include" 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*|*freebsd*) 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 _already_there=0 for X in `echo $RPATH | sed 's/:/ /g'` do if test "$X" = "$jd_cfitsio_library_dir" then _already_there=1 break fi done if test $_already_there = 0 then RPATH="$RPATH:$jd_cfitsio_library_dir" fi fi fi fi CFITSIO_INC=-I$jd_cfitsio_include_dir CFITSIO_INC_DIR=$jd_cfitsio_include_dir if test "X$jd_cfitsio_include_dir" = "X/usr/include" then CFITSIO_INC="" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } jd_with_cfitsio_library="no" CFITSIO_INC="" CFITSIO_LIB="" CFITSIO_INC_DIR="" CFITSIO_LIB_DIR="" fi if test "$jd_with_cfitsio_library" = "no" then as_fn_error $? "unable to find the cfitsio library and header file $jd_cfitsio_inc_file" "$LINENO" 5 fi slang_h=$jd_slang_include_dir/slang.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking SLANG_VERSION in $slang_h" >&5 $as_echo_n "checking SLANG_VERSION in $slang_h... " >&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) }'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $slang_major_version.$slang_minor_version.$slang_patchlevel_version" >&5 $as_echo "$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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : else if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 $as_echo "$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } if ${ac_cv_sizeof_float+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : else if test "$ac_cv_type_float" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_float=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_float" >&5 $as_echo "$ac_cv_sizeof_float" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_FLOAT $ac_cv_sizeof_float _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } if ${ac_cv_sizeof_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : else if test "$ac_cv_type_double" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_double=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_double" >&5 $as_echo "$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, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $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} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # 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 ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent 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 the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. 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=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h:src/config.hin" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:autoconf/Makefile.in" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; 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 against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # 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 || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} 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-pre0.4.7-17/doc/0002755000175000000620000000000014124641731014045 5ustar johnstaffslcfitsio-pre0.4.7-17/doc/help/0002755000175000000620000000000014124641731014775 5ustar johnstaffslcfitsio-pre0.4.7-17/doc/help/cfitsio.hlp0000644000175000000620000016070214124641731017146 0ustar johnstaff_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. QUALIFIERS ; casesen: use case-sensitive column names 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. QUALIFIERS ; casesen: use case-sensitive column names 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. QUALIFIERS ; casesen: use case-sensitive column names 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. Field names are converted to lowercase unless the `casesen' qualifier is set. QUALIFIERS ; casesen: use case-sensitive column names 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. Field names are converted to lowercase unless the `casesen' qualifier is set. 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. QUALIFIERS ; casesen: do not convert field names to lowercase 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_struct (file, key1, ...) Fits_File_Type or String_Type file; String_Type key1, ...; DESCRIPTION This function works exactly like `fits_read_key' except it returns the values in a structure. See the documentation on that function for more information. Field names are converted to lowercase unless the `casesen' qualifier is set. QUALIFIERS ; casesen: do not convert field names to lowercase 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]", ["Y","X"]); NOTES If the intent is to bin the data in the binary table columns, then it is best to specify the columns as `["Y", "X"]' and not the other way around. This is because the slang routines that deal with images assumes that the slowest varying index corresponds to the first one, whereas FITS assumes the opposite. 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 binned image USAGE wcs1 = fitswcs_bin_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-pre0.4.7-17/doc/text/0002755000175000000620000000000014124641731015031 5ustar johnstaffslcfitsio-pre0.4.7-17/doc/text/cfitsio.txt0000644000175000000620000027345014124641731017243 0ustar johnstaff S-Lang CFITSIO Module Reference John E. Davis, davis@space.mit.edu Oct 27, 2010 ____________________________________________________________ Table of Contents 1. Introduction 2. The high-level interface 2.1 Overview 2.2 Opening and Closing Files 2.3 Keywords 2.3.1 Reading Header Keywords 2.3.2 Writing Header Keywords 2.4 Binary Tables 2.4.1 Reading Binary Tables 2.4.2 Writing Binary Tables 2.5 Images 2.5.1 Preliminaries 2.5.2 Reading and Writing Images 2.6 WCS Routines 2.6.1 Introduction 2.6.2 Examples 2.6.3 Alternate WCS 2.6.4 Degenerate Axes 2.7 High-level Function Reference 2.7.1 fits_read_errmsgs 2.7.2 fits_set_verbose_errors 2.7.3 fits_open_file 2.7.4 fits_close_file 2.7.5 fits_move_to_interesting_hdu 2.7.6 fits_key_exists 2.7.7 fits_get_colnum 2.7.8 fits_binary_table_column_exists 2.7.9 fits_read_col 2.7.10 fits_read_col_struct 2.7.11 fits_read_cell 2.7.12 fits_read_row 2.7.13 fits_read_header 2.7.14 fits_read_table 2.7.15 fits_read_key 2.7.16 fits_read_key_struct 2.7.17 fits_create_binary_table 2.7.18 fits_write_binary_table 2.7.19 fits_update_key 2.7.20 fits_update_logical 2.7.21 fits_write_comment 2.7.22 fits_write_history 2.7.23 fits_write_date 2.7.24 fits_write_chksum 2.7.25 fits_verify_chksum 2.7.26 fits_read_records 2.7.27 fits_write_records 2.7.28 fits_get_keyclass 2.7.29 fits_get_bitpix 2.7.30 fits_read_img 2.7.31 fits_create_image_hdu 2.7.32 fits_write_image_hdu 2.7.33 fits_write_img 2.8 WCS Function Reference 2.8.1 fitswcs_new 2.8.2 fitswcs_slice 2.8.3 fitswcs_get_img_wcs 2.8.4 fitswcs_get_column_wcs 2.8.5 fitswcs_get_vector_wcs 2.8.6 fitswcs_new_img_wcs 2.8.7 fitswcs_put_img_wcs 2.8.8 fitswcs_put_column_wcs 2.8.9 fitswcs_linear_transform_wcs 2.8.10 fitswcs_rebin_wcs 2.8.11 fitswcs_bin_wcs 3. The low-level interface 3.1 Overview 3.2 Low-level Function Reference 3.2.1 _fits_get_errstatus 3.2.2 _fits_read_errmsg 3.2.3 _fits_open_file 3.2.4 _fits_delete_file 3.2.5 _fits_close_file 3.2.6 _fits_movabs_hdu 3.2.7 _fits_movrel_hdu 3.2.8 _fits_movnam_hdu 3.2.9 _fits_get_num_hdus 3.2.10 _fits_get_hdu_num 3.2.11 _fits_get_hdu_type 3.2.12 _fits_copy_file 3.2.13 _fits_copy_hdu 3.2.14 _fits_copy_header 3.2.15 _fits_delete_hdu 3.2.16 _fits_create_img 3.2.17 _fits_write_img 3.2.18 _fits_read_img 3.2.19 _fits_create_binary_tbl 3.2.20 _fits_update_key 3.2.21 _fits_update_logical 3.2.22 _fits_write_comment 3.2.23 _fits_write_history 3.2.24 _fits_write_date 3.2.25 _fits_write_record 3.2.26 _fits_modify_name 3.2.27 _fits_get_num_keys 3.2.28 _fits_read_key_integer 3.2.29 _fits_read_key_string 3.2.30 _fits_read_key_double 3.2.31 _fits_read_key 3.2.32 _fits_read_record 3.2.33 _fits_delete_key 3.2.34 _fits_get_colnum 3.2.35 _fits_insert_rows 3.2.36 _fits_delete_rows 3.2.37 _fits_insert_cols 3.2.38 _fits_delete_col 3.2.39 _fits_get_num_cols 3.2.40 _fits_get_rowsize 3.2.41 _fits_get_num_rows 3.2.42 _fits_write_col 3.2.43 _fits_read_col 3.2.44 _fits_get_keytype 3.2.45 _fits_get_keyclass 3.2.46 _fits_read_cols 3.2.47 _fits_write_chksum 3.2.48 _fits_update_chksum 3.2.49 _fits_verify_chksum 3.2.50 _fits_get_chksum 3.2.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 buf- fers 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 displayed 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. Qualifiers ; casesen: use case-sensitive column names 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. Qualifiers ; casesen: use case-sensitive column names 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. Qualifiers ; casesen: use case-sensitive column names 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. Field names are converted to lowercase unless the casesen qualifier is set. Qualifiers ; casesen: use case-sensitive column names 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. Field names are converted to lowercase unless the casesen qualifier is set. 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. Qualifiers ; casesen: do not convert field names to lowercase 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_struct (file, key1, ...) Fits_File_Type or String_Type file; String_Type key1, ...; Description This function works exactly like fits_read_key except it returns the values in a structure. See the documentation on that function for more information. Field names are converted to lowercase unless the casesen qualifier is set. Qualifiers ; casesen: do not convert field names to lowercase 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]", ["Y","X"]); Notes If the intent is to bin the data in the binary table columns, then it is best to specify the columns as ["Y", "X"] and not the other way around. This is because the slang routines that deal with images assumes that the slowest varying index corresponds to the first one, whereas FITS assumes the opposite. 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 binned image Usage wcs1 = fitswcs_bin_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. slcfitsio-pre0.4.7-17/doc/tm/0002755000175000000620000000000014124641731014465 5ustar johnstaffslcfitsio-pre0.4.7-17/doc/tm/Makefile0000644000175000000620000000556514124641731016136 0ustar johnstaff# -*- sh -*- # # To create the SGML files, you will need to install the tmexpand # package. See http://www.jedsoft.org/ for more information. # TMEXPAND = tmexpand SL2TM = tm-strip MODULE = cfitsio HLPFUNS_TM = rtl/cfitsiofuns.tm fitsfuns.tm fitswcsfuns.tm AUTOGEN_TM = fitswcsfuns.tm fitsfuns.tm MODULE_DEPS = rtl/cfitsiofuns.tm $(AUTOGEN_TM) TXT_FILES = $(MODULE).txt SGML_FILES = $(MODULE).sgml HTML_FILES = $(MODULE).html TEX_FILES = $(MODULE).tex PS_FILES = $(MODULE).ps PDF_FILES = $(MODULE).pdf HLP_FILE = $(MODULE).hlp HLP_TM_FILE = helpfile.tm SGML2LATEX = sgml2latex -p letter -o tex SGML2HTML = sgml2html SGML2TXT = sgml2txt -f LATEX = latex PDFLATEX = pdflatex TEXTDIR = ../text PSDIR = ../ps HTMLDIR = ../html SGMLDIR = ../sgml PDFDIR = ../pdf HELPDIR = ../help SUBDIRS = $(TEXTDIR) $(HTMLDIR) $(PSDIR) $(SGMLDIR) $(PDFDIR) $(HELPDIR) SRCDIR = `pwd` all: $(SGML_FILES) $(HTML_FILES) $(TEX_FILES) $(TXT_FILES) fitsfuns.tm: ../../src/fits.sl $(SL2TM) ../../src/fits.sl > 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) $(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) $(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-pre0.4.7-17/doc/tm/helpfile.tm0000644000175000000620000000035614124641731016621 0ustar johnstaff#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-pre0.4.7-17/doc/tm/rtl/0002755000175000000620000000000014124641731015266 5ustar johnstaffslcfitsio-pre0.4.7-17/doc/tm/rtl/cfitsiofuns.tm0000644000175000000620000004573014124641731020173 0ustar johnstaff \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-pre0.4.7-17/doc/tm/mkindex.sl0000644000175000000620000000370514124641731016467 0ustar johnstaff% 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 = "node122.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 (""); 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-pre0.4.7-17/doc/tm/cfitsio.tm0000644000175000000620000007636214124641731016503 0ustar johnstaff#% -*- 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 qualifiers Qualifiers #d qualifier#2:3 ; \tt{$1}: $2 \ifarg{$3}{(default: \tt{$3})} #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-pre0.4.7-17/COPYRIGHT0000644000175000000620000000261014124641731014570 0ustar johnstaff Copyright (c) 2003-2009 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.