From 12ea0b1d059cd6df83aa419cc2e520c3bf6f51f9 Mon Sep 17 00:00:00 2001 From: Rekhesh Mohan Date: Mon, 2 Jul 2012 22:53:30 +0530 Subject: [PATCH] Minor changes in build scripts so that we respect GNU autotools --- Makefile.am | 4 +++- configure.ac | 11 +++-------- src/Makefile.am | 8 ++++---- src/read_write.c | 15 ++++++++++----- src/zodiacal_model.c | 14 ++++++-------- src/zodiacal_model.h | 15 +++++++++++++-- 6 files changed, 39 insertions(+), 28 deletions(-) diff --git a/Makefile.am b/Makefile.am index 5bdb93a..4858d7f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,4 +3,6 @@ AUTOMAKE_OPTIONS = foreign 1.4 SUBDIRS = src -dist_doc_DATA = README.txt AUTHORS.txt COPYING.txt ChangeLog.txt INSTALL.txt + +cadsdocdir = $(datadir)/cads/@PACKAGE@ +dist_cadsdoc_DATA = README.txt AUTHORS.txt COPYING.txt ChangeLog.txt INSTALL.txt diff --git a/configure.ac b/configure.ac index a8581db..9ccb9d4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,30 +1,25 @@ -AC_PREREQ([2.68]) AC_INIT([CADS_zodiacal_model], [1.0], [cads@iiap.res.in]) +AC_LANG_C +AM_INIT_AUTOMAKE([-Wall -Werror]) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE(CADS_zodiacal_model, 1.0) # Checks for programs. -AC_PROG_CXX AC_PROG_CC -AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET -AC_PROG_RANLIB # Checks for libraries. # Checks for header files. -AC_CHECK_HEADERS([stdlib.h string.h]) +AC_CHECK_HEADERS([stdio.h stdlib.h string.h math.h]) # Checks for typedefs, structures, and compiler characteristics. # Checks for library functions. AC_FUNC_MALLOC -LIBS="$LIBS -lm -Wall -pedantic" - #---------------------------------------------------------------------# # Now we check for libnova headers and library # #---------------------------------------------------------------------# diff --git a/src/Makefile.am b/src/Makefile.am index 18a54a4..ecdf7d9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,9 +1,9 @@ bin_PROGRAMS = uvs_zodiacal_model -# set the include path found by configure -INCLUDES = $(all_includes) - # the library search path. uvs_zodiacal_model_SOURCES = signal_handler.c zodiacal_model.c read_write.c -dist_doc_DATA = leinert_dist.txt zodiacal_spec.txt noinst_HEADERS = zodiacal_model.h + +cadsdatadir = $(datadir)/cads/data +dist_cadsdata_DATA = leinert_dist.txt zodiacal_spec.txt +AM_CFLAGS = -DCADSDATA=\"$(cadsdatadir)/\" \ No newline at end of file diff --git a/src/read_write.c b/src/read_write.c index ecaecf2..2adf54f 100644 --- a/src/read_write.c +++ b/src/read_write.c @@ -137,7 +137,7 @@ void gen_default_params() "# 3. Month of the year (unitless, range: 1 - 12) \n" "MONTH = 12\n\n" "# 4. Year (unitless, range: 1900 - 2100 for max. accuracy) \n" - "YEAR = 2012\n\n" + "YEAR = 2012\n\n\n" ); fprintf(fparam, @@ -146,7 +146,7 @@ void gen_default_params() "# 1. RA (deg. range: 0.0 - 360.0)\n" "RA = 266.50\n\n" "# 2. Declination (deg. range: -90 - +90)\n" - "DECLINATION = -29.0\n\n" + "DECLINATION = -29.0\n\n\n" ); /*The files */ @@ -154,7 +154,7 @@ void gen_default_params() "# OUTPUT FILE:\n" "# -----------------------\n" "# The calculated spectrum is written to this file. \n" - "OUTPUT_FILE = zodiacal_output.txt\n\n" + "OUTPUT_FILE = zodiacal_output.txt\n\n\n" ); fprintf(fparam, @@ -162,14 +162,19 @@ void gen_default_params() "# -----------------------\n" "# zodiacal light spectrum is read from this file. \n" "# Data is based on the solar spectrum from Colina et al\n" - "ZODIAC_SPECTRUM = zodiacal_spec.txt\n\n" + "ZODIAC_SPECTRUM = %szodiacal_spec.txt\n\n", CADSDATA ); fprintf(fparam, "# ZODIACAL LIGHT MODEL FILE:\n" "# --------------------------\n" "# zodiacal light distribution data (Leinert et al.) \n" - "ZODIAC_MODEL = leinert_dist.txt\n" + "ZODIAC_MODEL = %sleinert_dist.txt\n\n", CADSDATA + ); + + fprintf(fparam, + "# --------------------------\n" + "#\n" ); printf("Info : Default Parameter file has been generated.\n"); diff --git a/src/zodiacal_model.c b/src/zodiacal_model.c index 300e644..e1f8724 100644 --- a/src/zodiacal_model.c +++ b/src/zodiacal_model.c @@ -63,10 +63,8 @@ JM: Sep. 27, 2007 3. Removed parse_par => no command line options 4. Can handle comments in spectrum file and removed the 'rather strict' ZOD_SPEC number of elements in spectrum :) + 5. More gnu-autotools friendly. Path to input data files are taken care of *--------------------------------------------------------------------------*/ -#ifdef HAVE_CONFIG_H -#include -#endif #include #include #include @@ -95,9 +93,9 @@ void usage() printf (" If no parameter file exists, new one will be created\n"); printf (" which may be edited as required\n\n"); printf ("-----------------------------------------------------------\n"); - printf ("Copyright (c) 2012, The CADS Team. [GPL v2.0 or later]\n"); - printf ("Bug Reports : cads.iiap.res.in/dropbux \n"); - printf ("Documentation : cads.iiap.res.in/software\n\n"); + printf ("Copyright (c) 2012 The CADS Team, IIAp. [GPL v3.0 or later]\n"); + printf ("Report Bugs to: http://cads.iiap.res.in/bugzilla \n"); + printf ("Documentation : http://cads.iiap.res.in/software\n\n"); }/*End usage */ /* ------------------------------------------------------------------------- */ @@ -131,7 +129,7 @@ void get_sun_hecl(float t_ut, int day, int month, int year, /* things are symmetric around 0 latitude here.. */ f_temp = fabs(eclcoords.lng - sun_ecl.lng); - + /* wrap coordinates around 180 deg.*/ if (f_temp > 180) f_temp = 360 - f_temp; @@ -207,7 +205,7 @@ int main (int argc, char *argv[]) hbeta_index = 0; while (table_beta[hbeta_index] < fabs(helio_beta)) ++hbeta_index; - + zod_intensity = zod_dist[hecl_index + hbeta_index*ZOD_XSIZE]; /*Scale zodiacal light spectrum*/ diff --git a/src/zodiacal_model.h b/src/zodiacal_model.h index 73bdc9d..75a03dd 100644 --- a/src/zodiacal_model.h +++ b/src/zodiacal_model.h @@ -30,15 +30,20 @@ Reks, 22 June 2012 1. Rebranded to cads software group *--------------------------------------------------------------------------*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include #include -/*Maximum number of elements in a text line*/ +/* Maximum number of elements in a text line */ #define MAX_TEXT 150 -/*Define the parameters for reading the zodiacal file*/ +/* Define the parameters for reading the zodiacal file */ #define ZOD_XSIZE 19 /*Number of rows */ #define ZOD_YSIZE 10 /* Number of Columns */ #define ZOD_SPEC 25763 /* Number of elements */ @@ -48,5 +53,11 @@ #define DEFAULT_ZOD_FILE "leinert_dist.txt" /* Leinert's model */ #define DEFAULT_SPEC_FILE "zodiacal_spec.txt" /* Solar Spectrum */ #define DEFAULT_OUT_FILE "zodiacal_output.txt" /* Output file */ + +/* path to input data files, if we were GNU-built by autotools */ +#ifndef CADSDATA +#define CADSDATA ' ' +#endif + /* this is something else */ #define INITVAL -400 -- 2.12.1