From b2dbb6d384072c92d7b5e8f3ebfffbab35b7f050 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Sun, 24 Mar 2013 06:04:45 +1100 Subject: package cfitsio: add test program --- src/cfitsio-test.c | 31 +++++++++++++++++++++++++++++++ src/cfitsio.mk | 12 +++++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 src/cfitsio-test.c diff --git a/src/cfitsio-test.c b/src/cfitsio-test.c new file mode 100644 index 0000000..7ae090c --- /dev/null +++ b/src/cfitsio-test.c @@ -0,0 +1,31 @@ +/* + * This file is part of MXE. + * See index.html for further information. + */ + +#include +#include +#include "fitsio.h" + +int main(int argc, char *argv[]) +{ + (void)argc; + + fitsfile *fptr; + char card[FLEN_CARD]; + int status = 0, nkeys, ii; /* MUST initialize status */ + + fits_open_file(&fptr, argv[1], READONLY, &status); + fits_get_hdrspace(fptr, &nkeys, NULL, &status); + + for (ii = 1; ii <= nkeys; ii++) { + fits_read_record(fptr, ii, card, &status); /* read keyword */ + printf("%s\n", card); + } + printf("END\n\n"); /* terminate listing with END */ + fits_close_file(fptr, &status); + + if (status) /* print any error messages */ + fits_report_error(stderr, status); + return(status); +} diff --git a/src/cfitsio.mk b/src/cfitsio.mk index 9993f3b..28bb6ad 100644 --- a/src/cfitsio.mk +++ b/src/cfitsio.mk @@ -15,7 +15,13 @@ endef define $(PKG)_BUILD cd '$(1)' && ./configure \ --host='$(TARGET)' \ - --prefix='$(PREFIX)/$(TARGET)' - $(MAKE) -C '$(1)' -j '$(JOBS)' bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= - $(MAKE) -C '$(1)' -j 1 install bin_PROGRAMS= sbin_PROGRAMS= noinst_PROGRAMS= + --prefix='$(PREFIX)/$(TARGET)' \ + FC='$(TARGET)-gfortran' + $(MAKE) -C '$(1)' -j '$(JOBS)' + $(MAKE) -C '$(1)' -j 1 install + + '$(TARGET)-gcc' \ + -W -Wall -Werror -ansi \ + '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-cfitsio.exe' \ + `'$(TARGET)-pkg-config' cfitsio --cflags --libs` endef -- cgit v0.12