1 /*  Copyright (C) 1988-2005 by Brian Doty and the Institute
2                   of Global Environment and Society (IGES).
3 
4     See file COPYRIGHT for more information.   */
5 
6 /*
7  * Include ./configure's header file
8  */
9 #ifdef HAVE_CONFIG_H
10 #include <config.h>
11 #endif
12 
13 /* file: gacfg.c
14  *
15  *   Prints the configuration options of this build of GrADS.
16  *   This function is invoked at startup and with 'q config'.
17  *
18  *   REVISION HISTORY:
19  *
20  *   09sep97   da Silva   Initial code.
21  *   12oct97   da Silva   Small revisions, use of gaprnt().
22  *   15apr98   da Silva    Added BUILDINFO stuff, made gacfg() void.
23  *   24jun02   K Komine   Added 64-bit mode .
24  *
25  *   --
26  *   (c) 1997 by Arlindo da Silva
27  *
28  *   Permission is granted to any individual or institution to use,
29  *   copy, or redistribute this software so long as it is not sold for
30  *   profit, and provided this notice is retained.
31  *
32  */
33 
34 #include <stdio.h>
35 #include "grads.h"
36 #include "buildinfo.h"
37 
38 /*
39  * gacfg() - Prints several configuration parameters.
40  *
41  *           verbose = 0   only config string
42  *                   = 1   config string + verbose description
43  *                   > 1   no screen display.
44  */
45 void
gacfg(int verbose)46 gacfg(int verbose)
47 {
48 
49 char cmd[1024];
50 
51 /* Config: v1.7b2,32-bit,little-endian,readline,NetCDF,sdf/xdf,lats,athena */
52 
53 sprintf(cmd,"Config: v%s",GRADS_VERSION);
54 
55 if(GRADS_CRAY)  strcat(cmd," 64-bit,cray");
56 /*kk 020624 --- s */
57 else if (GRADS_HP64) strcat(cmd," 64-bit,hpux11");
58 /*kk 020624 --- e */
59 else            strcat(cmd," 32-bit");
60 
61 if(BYTEORDER)   strcat(cmd," big-endian");
62 else            strcat(cmd," little-endian");
63 
64 if(READLINE)    strcat(cmd," readline");
65 
66 if(USESDF) {
67                 strcat(cmd," sdf/xdf");
68   if(USEHDF)    strcat(cmd," hdf-sds netcdf");
69   else          strcat(cmd," netcdf");
70   if(USEDODS) strcat(cmd, " dods");
71   if (USEGADODS) strcat(cmd, " dods-stn");
72 }
73 if(USELATS)     strcat(cmd," lats");
74 if(USEGUI)      strcat(cmd," athena");
75 if(USEIMG == 2) strcat(cmd," xa/image-output");
76 if(USEIMG == 1) strcat(cmd," im/image-output");
77 if(GXPNG)       strcat(cmd," printim");
78 
79 strcat(cmd,"\n\n");
80 gaprnt(verbose,cmd);
81 if (verbose==0)
82        printf ("Issue 'q config' command for more information.\n\n");
83 
84 if (verbose == 0) return;
85 
86 gaprnt (verbose, "Grid Analysis and Display System (GrADS) Version " GRADS_VERSION "\n");
87 gaprnt (verbose, "Copyright (c) 1988-2005 by Brian Doty and IGES\n");
88 gaprnt (verbose, "Center for Ocean-Land-Atmosphere Studies (COLA)\n");
89 gaprnt (verbose, "Institute for Global Environment and Society (IGES) \n");
90 gaprnt (verbose, "This program is distributed WITHOUT ANY WARRANTY \n");
91 gaprnt (verbose, "See file COPYRIGHT for more information. \n\n");
92 
93 gaprnt (verbose, buildinfo );
94 
95 gaprnt(verbose,"\n\nThis version of GrADS has been configured with the following options:\n\n");
96 
97 if(!GRADS_CRAY) {
98   if(BYTEORDER) {
99     sprintf (cmd,"   o This is a 32-bit BIG ENDIAN machine version.\n");
100   } else {
101     sprintf (cmd,"   o This is a 32-bit LITTLE ENDIAN machine version.\n");
102   }
103 } else {
104   sprintf (cmd,"   o This is a 64-bit BIG ENDIAN machine version (Cray).\n");
105 }
106   gaprnt(verbose,cmd);
107 
108 if(READLINE)
109   sprintf(cmd,"   o Command line editing (readline) ENABLED.\n");
110 else
111   sprintf(cmd,"   o Command line editing (readline) DISABLED.\n");
112   gaprnt(verbose,cmd);
113 
114 if(USESDF) {
115   sprintf(cmd,"   o CIRES/CDC (http://www.cdc.noaa.gov) SDF/XDF interface ENABLED.\n");
116   gaprnt(verbose,cmd);
117   if(USEHDF)
118     sprintf(cmd,"     Use sdfopen or xdfopen to read both NetCDF and HDF-SDS files.\n"
119                 "   o DTYPE netcdf and DTYPE hdfsds are ENABLED.\n");
120   else
121     sprintf(cmd,"     Use sdfopen/xdfopen to read NetCDF files.\n"
122                 "   o DTYPE netcdf is ENABLED; DTYPE hdfsds is DISABLED.\n");
123     gaprnt(verbose,cmd);
124 }
125 else { /* no USESDF */
126   sprintf(cmd,"   o CIRES/CDC (http://www.cdc.noaa.gov) SDF/XDF interface DISABLED. \n"
127 	      "     This version is NOT configured to read NetCDF/HDF-SDS files.\n"
128 	      "   o DTYPE netcdf and DTYPE hdfsds are DISABLED.\n");
129    gaprnt(verbose,cmd);
130 }
131 
132 if(USEDODS) {
133         gaprnt(verbose,"   o OPeNDAP (a.k.a. DODS) gridded data interface ENABLED. (http://opendap.org)\n");
134         gaprnt(verbose,"     This version is configured to access gridded data on OPeNDAP servers \n");
135         gaprnt(verbose,"     via the sdfopen or xdfopen commands, or using DTYPE netcdf.\n");
136 } else {
137         gaprnt(verbose,"   o OPeNDAP (a.k.a. DODS) gridded data interface DISABLED.\n");
138 }
139 
140 if(USEGADODS) {
141         gaprnt(verbose,"   o OPeNDAP (a.k.a. DODS) station data interface (gadods) ENABLED.\n");
142         gaprnt(verbose,"     This version is configured to access station data on OPeNDAP servers \n");
143         gaprnt(verbose,"     via the open command.\n");
144 } else {
145         gaprnt(verbose,"   o OPeNDAP (a.k.a. DODS) station data interface DISABLED.\n");
146 }
147 
148 
149 if(USELATS) {
150         sprintf(cmd,"   o PCMDI (http://www-pcmdi.llnl.gov) LATS interface ENABLED.\n"
151 		    "     This version is configured to write ");
152         gaprnt(verbose,cmd);
153   if(USESDF) {
154      if(USEHDF)
155         sprintf(cmd,"GRIB and HDF-SDS files.\n");
156      else
157         sprintf(cmd,"GRIB and NetCDF files.\n");
158      gaprnt(verbose,cmd);
159   }
160   else  {
161        sprintf(cmd,"GRIB files (but no NetCDF/HDF files).\n");
162        gaprnt(verbose,cmd);
163   }
164 }
165 
166 else {  /* No USELATS */
167         sprintf(cmd,"   o PCMDI (http://www-pcmdi.llnl.gov) LATS interface DISABLED.\n"
168 		    "     This version is NOT configured to write GRIB, NetCDF, or HDF-SDS files.\n");
169         gaprnt(verbose,cmd);
170 }
171 
172 if(USEGUI)
173     sprintf(cmd,"   o DAO (http://dao.gsfc.nasa.gov) Athena Widget GUI ENABLED.\n ");
174 else
175     sprintf(cmd,"   o DAO (http://dao.gsfc.nasa.gov) Athena Widget GUI DISABLED.\n ");
176 gaprnt(verbose,cmd);
177 
178 if(USEIMG == 2)
179     sprintf(cmd,"  o NRL/PCMDI XA Image Output ENABLED.\n"
180 	        "    Use \"wi filename format\" to output X window to an image file\n");
181 else if(USEIMG == 1)
182     sprintf(cmd,"  o DAO/PCMDI ImageMagick Image Output ENABLED.\n"
183 	        "    Use \"wi filename.format (gif,jpeg,etc)\" to output X window to an image file\n");
184 else
185     sprintf(cmd,"  o NRL/DAO/PCMDI XA or ImageMagick Image Output DISABLED.\n ");
186 gaprnt(verbose,cmd);
187 
188 if (GXPNG) {
189   gaprnt(verbose,"  o printim command for direct png/gif output ENABLED.\n");
190   gaprnt(verbose,"     (via the GD Library -- http://www.boutell.com/gd)\n");
191 } else {
192   gaprnt(verbose,"  o printim command DISABLED\n");
193 }
194 
195 sprintf(cmd,
196        "\nFor additional information please consult http://grads.iges.org/grads/\n\n");
197 gaprnt(verbose,cmd);
198 
199 }
200 
201 
202 /* --------------------------------------------------------------*/
203 #ifdef TEST
204 
gaprnt(int mode,char * cmd)205 void gaprnt ( int mode, char *cmd )
206 {
207    if ( mode < 2 ) printf("%s",cmd);
208 }
209 
main(int argc,char ** argv)210 main(int argc, char **argv )
211 {
212 
213 gacfg(1);
214 
215 }
216 
217 #endif /* TEST */
218 
219 
220 
221