1 /* @source embossversion application
2 **
3 ** Writes the current EMBOSS version number
4 **
5 ** @author Copyright (C) Gary Williams (gwilliam@hgmp.mrc.ac.uk)
6 ** @@
7 **
8 ** This program is free software; you can redistribute it and/or
9 ** modify it under the terms of the GNU General Public License
10 ** as published by the Free Software Foundation; either version 2
11 ** of the License, or (at your option) any later version.
12 **
13 ** This program is distributed in the hope that it will be useful,
14 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ** GNU General Public License for more details.
17 **
18 ** You should have received a copy of the GNU General Public License
19 ** along with this program; if not, write to the Free Software
20 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ******************************************************************************/
22
23 #include "emboss.h"
24 #include "expat.h"
25 #include "zlib.h"
26
27
28
29
30 /* @prog embossversion ********************************************************
31 **
32 ** Writes the current EMBOSS version number
33 **
34 ******************************************************************************/
35
main(int argc,char ** argv)36 int main(int argc, char **argv)
37 {
38 AjPFile outfile = NULL;
39 AjBool full = AJFALSE;
40 AjPStr tmpstr = NULL;
41 char tmpver[512] = {'\0'};
42
43 embInit("embossversion", argc, argv);
44
45 full = ajAcdGetBoolean("full");
46 outfile = ajAcdGetOutfile("outfile");
47
48 tmpstr = ajStrNewRes(128);
49
50 if (!full) {
51 ajStrAssignS(&tmpstr, ajNamValueVersion());
52 if (!ajStrGetLen(tmpstr))
53 ajStrAssignC(&tmpstr, "(unknown)");
54 ajFmtPrintF(outfile, "%S\n", tmpstr);
55 }
56 else {
57 ajStrAssignS(&tmpstr, ajNamValuePackage());
58 if (!ajStrGetLen(tmpstr))
59 ajStrAssignC(&tmpstr, "(unknown)");
60 ajFmtPrintF(outfile, "PackageName: %S\n", tmpstr);
61
62 ajStrAssignS(&tmpstr, ajNamValueVersion());
63 if (!ajStrGetLen(tmpstr))
64 ajStrAssignC(&tmpstr, "(unknown)");
65 ajFmtPrintF(outfile, "LibraryVersion: %S\n", tmpstr);
66
67 ajStrAssignC(&tmpstr, ensSoftwareGetVersion());
68 if (!ajStrGetLen(tmpstr))
69 ajStrAssignC(&tmpstr, "(unknown)");
70 ajFmtPrintF(outfile, "EnsemblVersion: %S\n", tmpstr);
71
72 c_plgver(tmpver);
73 ajStrAssignC(&tmpstr, tmpver);
74 if (!ajStrGetLen(tmpstr))
75 ajStrAssignC(&tmpstr, "(unknown)");
76 ajFmtPrintF(outfile, "PlplotVersion: %S\n", tmpstr);
77
78 #ifdef ELIBSOURCES
79 ajStrAssignC(&tmpstr, pcre_version());
80 #else
81 ajStrAssignC(&tmpstr, "");
82 #endif
83 if (!ajStrGetLen(tmpstr))
84 ajStrAssignC(&tmpstr, "(unknown)");
85 ajFmtPrintF(outfile, "PcreVersion: %S\n", tmpstr);
86
87 ajStrAssignC(&tmpstr, zlibVersion());
88 if (!ajStrGetLen(tmpstr))
89 ajStrAssignC(&tmpstr, "(unknown)");
90 ajFmtPrintF(outfile, "ZlibVersion: %S\n", tmpstr);
91
92 ajStrAssignC(&tmpstr, XML_ExpatVersion());
93 if (!ajStrGetLen(tmpstr))
94 ajStrAssignC(&tmpstr, "(unknown)");
95 ajFmtPrintF(outfile, "ExpatVersion: %S\n", tmpstr);
96
97 ajStrAssignS(&tmpstr, ajNamValueSystem());
98 if (!ajStrGetLen(tmpstr))
99 ajStrAssignC(&tmpstr, "(unknown)");
100 ajFmtPrintF(outfile, "System: %S\n", tmpstr);
101
102 ajStrAssignS(&tmpstr, ajNamValueInstalldir());
103 if (!ajStrGetLen(tmpstr))
104 ajStrAssignC(&tmpstr, "(unknown)");
105 ajFmtPrintF(outfile, "InstallDirectory: %S\n", tmpstr);
106
107 ajStrAssignS(&tmpstr, ajNamValueRootdir());
108 if (!ajStrGetLen(tmpstr))
109 ajStrAssignC(&tmpstr, "(unknown)");
110 ajFmtPrintF(outfile, "RootDirectory: %S\n", tmpstr);
111
112 ajStrAssignS(&tmpstr, ajNamValueBasedir());
113 if (!ajStrGetLen(tmpstr))
114 ajStrAssignC(&tmpstr, "(unknown)");
115 ajFmtPrintF(outfile, "BaseDirectory: %S\n", tmpstr);
116
117 if (!ajNamGetValueC("standard", &tmpstr))
118 ajStrAssignC(&tmpstr, "(default)");
119 ajFmtPrintF(outfile, "Emboss_Standard: %S\n", tmpstr);
120
121 if (!ajNamGetValueC("userdir", &tmpstr))
122 ajStrAssignC(&tmpstr, "(default)");
123 ajFmtPrintF(outfile, "Emboss_UserDir: %S\n", tmpstr);
124
125 if (!ajNamGetValueC("acdroot", &tmpstr))
126 ajStrAssignC(&tmpstr, "(default)");
127 ajFmtPrintF(outfile, "Emboss_AcdRoot: %S\n", tmpstr);
128
129 if (!ajNamGetValueC("data", &tmpstr))
130 ajStrAssignC(&tmpstr, "(default)");
131 ajFmtPrintF(outfile, "Emboss_Data: %S\n", tmpstr);
132
133 if (!ajNamGetValueC("filter", &tmpstr))
134 ajStrAssignC(&tmpstr, "(default)");
135 ajFmtPrintF(outfile, "Emboss_Filter: %S\n", tmpstr);
136
137 if (!ajNamGetValueC("format", &tmpstr))
138 ajStrAssignC(&tmpstr, "(default)");
139 ajFmtPrintF(outfile, "Emboss_Format: %S\n", tmpstr);
140
141 if (!ajNamGetValueC("graphics", &tmpstr))
142 ajStrAssignC(&tmpstr, "(default)");
143 ajFmtPrintF(outfile, "Emboss_Graphics: %S\n", tmpstr);
144
145 if (!ajNamGetValueC("httpversion", &tmpstr))
146 ajStrAssignC(&tmpstr, "(default)");
147 ajFmtPrintF(outfile, "Emboss_HttpVersion: %S\n", tmpstr);
148
149 if (!ajNamGetValueC("language", &tmpstr))
150 ajStrAssignC(&tmpstr, "(default)");
151 ajFmtPrintF(outfile, "Emboss_Language: %S\n", tmpstr);
152
153 if (!ajNamGetValueC("options", &tmpstr))
154 ajStrAssignC(&tmpstr, "(default)");
155 ajFmtPrintF(outfile, "Emboss_Options: %S\n", tmpstr);
156
157 if (!ajNamGetValueC("outdirectory", &tmpstr))
158 ajStrAssignC(&tmpstr, "(default)");
159 ajFmtPrintF(outfile, "Emboss_OutDirectory: %S\n", tmpstr);
160
161 if (!ajNamGetValueC("outfeatformat", &tmpstr))
162 ajStrAssignC(&tmpstr, "(default)");
163 ajFmtPrintF(outfile, "Emboss_OutFeatFormat: %S\n", tmpstr);
164
165 if (!ajNamGetValueC("outformat", &tmpstr))
166 ajStrAssignC(&tmpstr, "(default)");
167 ajFmtPrintF(outfile, "Emboss_OutFormat: %S\n", tmpstr);
168
169 if (!ajNamGetValueC("proxy", &tmpstr))
170 ajStrAssignC(&tmpstr, "(default)");
171 ajFmtPrintF(outfile, "Emboss_Proxy: %S\n", tmpstr);
172
173 if (!ajNamGetValueC("stdout", &tmpstr))
174 ajStrAssignC(&tmpstr, "(default)");
175 ajFmtPrintF(outfile, "Emboss_Stdout: %S\n", tmpstr);
176
177 if (!ajNamGetValueC("debug", &tmpstr))
178 ajStrAssignC(&tmpstr, "(default)");
179 ajFmtPrintF(outfile, "Emboss_Debug: %S\n", tmpstr);
180
181 if (!ajNamGetValueC("acdwarnrange", &tmpstr))
182 ajStrAssignC(&tmpstr, "(default)");
183 ajFmtPrintF(outfile, "Emboss_WarnRange: %S\n", tmpstr);
184
185 if (!ajNamGetValueC("sql", &tmpstr))
186 ajStrAssignC(&tmpstr, "(default)");
187 ajFmtPrintF(outfile, "Emboss_Sql: %S\n", tmpstr);
188
189 if (!ajNamGetValueC("mysql", &tmpstr))
190 ajStrAssignC(&tmpstr, "(default)");
191 ajFmtPrintF(outfile, "Emboss_Mysql: %S\n", tmpstr);
192
193 if (!ajNamGetValueC("postgresql", &tmpstr))
194 ajStrAssignC(&tmpstr, "(default)");
195 ajFmtPrintF(outfile, "Emboss_Postgresql: %S\n", tmpstr);
196
197 if (!ajNamGetValueC("axis2c", &tmpstr))
198 ajStrAssignC(&tmpstr, "(default)");
199 ajFmtPrintF(outfile, "Emboss_Axis2c: %S\n", tmpstr);
200
201 ajFmtPrintF(outfile, "\n");
202 ajFmtPrintF(outfile, "Compile Flag Definitions:\n");
203 ajFmtPrintF(outfile, "\n");
204 #ifdef HAVE64
205 ajFmtPrintF(outfile, "HAVE64\n");
206 #endif
207 #ifdef AJ_Linux64
208 ajFmtPrintF(outfile, "AJ_Linux64\n");
209 #endif
210 #ifdef AJ_Solaris64
211 ajFmtPrintF(outfile, "AJ_Solaris64\n");
212 #endif
213 #ifdef AJ_IRIX64
214 ajFmtPrintF(outfile, "AJ_IRIX64\n");
215 #endif
216 #ifdef AJ_OSF164
217 ajFmtPrintF(outfile, "AJ_OSF164\n");
218 #endif
219 #ifdef AJ_FreeBSD64
220 ajFmtPrintF(outfile, "AJ_FreeBSD64\n");
221 #endif
222 #ifdef AJ_LinuxLF
223 ajFmtPrintF(outfile, "AJ_LinuxLF\n");
224 #endif
225 #ifdef AJ_SolarisLF
226 ajFmtPrintF(outfile, "AJ_SolarisLF\n");
227 #endif
228 #ifdef AJ_IRIXLF
229 ajFmtPrintF(outfile, "AJ_IRIXLF\n");
230 #endif
231 #ifdef AJ_AIXLF
232 ajFmtPrintF(outfile, "AJ_AIXLF\n");
233 #endif
234 #ifdef AJ_HPUXLF
235 ajFmtPrintF(outfile, "AJ_HPUXLF\n");
236 #endif
237 #ifdef AJ_MACOSXLF
238 ajFmtPrintF(outfile, "AJ_MACOSXLF\n");
239 #endif
240 #ifdef AJ_FreeBSDLF
241 ajFmtPrintF(outfile, "AJ_FreeBSDLF\n");
242 #endif
243 #ifdef __CYGWIN__
244 ajFmtPrintF(outfile, "__CYGWIN__\n");
245 #endif
246 #ifdef WIN32
247 ajFmtPrintF(outfile, "WIN32\n");
248 #endif
249 #ifdef HAVE_CONFIG_H
250 ajFmtPrintF(outfile, "HAVE_CONFIG_H\n");
251 #endif
252 #ifdef __GNUC__
253 ajFmtPrintF(outfile, "__GNUC__\n");
254 #endif
255 #ifdef S_IFREG
256 ajFmtPrintF(outfile, "S_IFREG\n");
257 #endif
258 #ifdef S_IFDIR
259 ajFmtPrintF(outfile, "S_IFDIR\n");
260 #endif
261 #ifdef __cplusplus
262 ajFmtPrintF(outfile, "__cplusplus\n");
263 #endif
264
265 /* config.h definitions */
266
267 ajFmtPrintF(outfile, "\n");
268 ajFmtPrintF(outfile, "Config Header Definitions:\n");
269 ajFmtPrintF(outfile, "\n");
270 #ifdef AXIS2C_LOC
271 ajFmtPrintF(outfile, "AXIS2C_LOC '%s'\n", AXIS2C_LOC);
272 #endif
273 #ifdef GETPGRP_VOID
274 ajFmtPrintF(outfile, "GETPGRP_VOID %d\n", GETPGRP_VOID);
275 #endif
276 #ifdef HAVE_AXIS2C
277 ajFmtPrintF(outfile, "HAVE_AXIS2C %d\n", HAVE_AXIS2C);
278 #endif
279 #ifdef HAVE_DIRENT_H
280 ajFmtPrintF(outfile, "HAVE_DIRENT_H %d\n", HAVE_DIRENT_H);
281 #endif
282 #ifdef HAVE_DLFCN_H
283 ajFmtPrintF(outfile, "HAVE_DLFCN_H %d\n", HAVE_DLFCN_H);
284 #endif
285 #ifdef HAVE_DOPRNT
286 ajFmtPrintF(outfile, "HAVE_DOPRNT %d\n", HAVE_DOPRNT);
287 #endif
288 #ifdef HAVE_FORK
289 ajFmtPrintF(outfile, "HAVE_FORK %d\n", HAVE_FORK);
290 #endif
291 #ifdef HAVE_INTTYPES_H
292 ajFmtPrintF(outfile, "HAVE_INTTYPES_H %d\n", HAVE_INTTYPES_H);
293 #endif
294 #ifdef HAVE_JAVA
295 ajFmtPrintF(outfile, "HAVE_JAVA\n");
296 #endif
297 #ifdef HAVE_LIBM
298 ajFmtPrintF(outfile, "HAVE_LIBM %d\n", HAVE_LIBM);
299 #endif
300 #ifdef HAVE_MCHECK
301 ajFmtPrintF(outfile, "HAVE_MCHECK %d\n", HAVE_MCHECK);
302 #endif
303 #ifdef HAVE_MEMMOVE
304 ajFmtPrintF(outfile, "HAVE_MEMMOVE %d\n", HAVE_MEMMOVE);
305 #endif
306 #ifdef HAVE_MEMORY_H
307 ajFmtPrintF(outfile, "HAVE_MEMORY_H %d\n", HAVE_MEMORY_H);
308 #endif
309 #ifdef HAVE_MYSQL
310 ajFmtPrintF(outfile, "HAVE_MYSQL %d\n", HAVE_MYSQL);
311 #endif
312 #ifdef HAVE_NDIR_H
313 ajFmtPrintF(outfile, "HAVE_NDIR_H %d\n", HAVE_NDIR_H);
314 #endif
315 #ifdef HAVE_POSTGRESQL
316 ajFmtPrintF(outfile, "HAVE_POSTGRESQL %d\n", HAVE_POSTGRESQL);
317 #endif
318 #ifdef HAVE_STDINT_H
319 ajFmtPrintF(outfile, "HAVE_STDINT_H %d\n", HAVE_STDINT_H);
320 #endif
321 #ifdef HAVE_STDLIB_H
322 ajFmtPrintF(outfile, "HAVE_STDLIB_H %d\n", HAVE_STDLIB_H);
323 #endif
324 #ifdef HAVE_STRFTIME
325 ajFmtPrintF(outfile, "HAVE_STRFTIME %d\n", HAVE_STRFTIME);
326 #endif
327 #ifdef HAVE_STRINGS_H
328 ajFmtPrintF(outfile, "HAVE_STRINGS_H %d\n", HAVE_STRINGS_H);
329 #endif
330 #ifdef HAVE_STRING_H
331 ajFmtPrintF(outfile, "HAVE_STRING_H %d\n", HAVE_STRING_H);
332 #endif
333 #ifdef HAVE_SYS_DIR_H
334 ajFmtPrintF(outfile, "HAVE_SYS_DIR_H %d\n", HAVE_SYS_DIR_H);
335 #endif
336 #ifdef HAVE_SYS_NDIR_H
337 ajFmtPrintF(outfile, "HAVE_SYS_NDIR_H %d\n", HAVE_SYS_NDIR_H);
338 #endif
339 #ifdef HAVE_SYS_STAT_H
340 ajFmtPrintF(outfile, "HAVE_SYS_STAT_H %d\n", HAVE_SYS_STAT_H);
341 #endif
342 #ifdef HAVE_SYS_TYPES_H
343 ajFmtPrintF(outfile, "HAVE_SYS_TYPES_H %d\n", HAVE_SYS_TYPES_H);
344 #endif
345 #ifdef HAVE_TARGETCONFIG_H
346 ajFmtPrintF(outfile, "HAVE_TARGETCONFIG_H %d\n", HAVE_TARGETCONFIG_H);
347 #endif
348 #ifdef HAVE_UNISTD_
349 ajFmtPrintF(outfile, "HAVE_UNISTD_ %d\n", HAVE_UNISTD_);
350 #endif
351 #ifdef HAVE_VFORK
352 ajFmtPrintF(outfile, "HAVE_VFORK %d\n", HAVE_VFORK);
353 #endif
354 #ifdef HAVE_VFORK_H
355 ajFmtPrintF(outfile, "HAVE_VFORK_H %d\n", HAVE_VFORK_H);
356 #endif
357 #ifdef HAVE_VPRINTF
358 ajFmtPrintF(outfile, "HAVE_VPRINTF %d\n", HAVE_VPRINTF);
359 #endif
360 #ifdef HAVE_WORKING_FORK
361 ajFmtPrintF(outfile, "HAVE_WORKING_FORK %d\n", HAVE_WORKING_FORK);
362 #endif
363 #ifdef HAVE_WORKING_VFORK
364 ajFmtPrintF(outfile, "HAVE_WORKING_VFORK %d\n",HAVE_WORKING_VFORK );
365 #endif
366 #ifdef HPUX64PTRS
367 ajFmtPrintF(outfile, "HPUX64PTRS %d\n", HPUX64PTRS);
368 #endif
369 #ifdef LT_OBJDIR
370 ajFmtPrintF(outfile, "LT_OBJDIR '%s'\n", LT_OBJDIR);
371 #endif
372 #ifdef PACKAGE
373 ajFmtPrintF(outfile, "PACKAGE '%s'\n", PACKAGE);
374 #endif
375 #ifdef PACKAGE_BUGREPORT
376 ajFmtPrintF(outfile, "PACKAGE_BUGREPORT '%s'\n", PACKAGE_BUGREPORT);
377 #endif
378 #ifdef PACKAGE_NAME
379 ajFmtPrintF(outfile, "PACKAGE_NAME '%s'\n", PACKAGE_NAME);
380 #endif
381 #ifdef PACKAGE_STRING
382 ajFmtPrintF(outfile, "PACKAGE_STRING '%s'\n", PACKAGE_STRING);
383 #endif
384 #ifdef PACKAGE_TARNAME
385 ajFmtPrintF(outfile, "PACKAGE_TARNAME '%s'\n", PACKAGE_TARNAME);
386 #endif
387 #ifdef PACKAGE_URL
388 ajFmtPrintF(outfile, "PACKAGE_URL '%s'\n", PACKAGE_URL);
389 #endif
390 #ifdef PACKAGE_VERSION
391 ajFmtPrintF(outfile, "PACKAGE_VERSION '%s'\n", PACKAGE_VERSION);
392 #endif
393 #ifdef PLD_pdf
394 ajFmtPrintF(outfile, "PLD_pdf %d\n", PLD_pdf);
395 #endif
396 #ifdef PLD_png
397 ajFmtPrintF(outfile, "PLD_png %d\n", PLD_png);
398 #endif
399 #ifdef PLD_xwin
400 ajFmtPrintF(outfile, "PLD_xwin %d\n", PLD_xwin);
401 #endif
402 #ifdef STDC_HEADERS
403 ajFmtPrintF(outfile, "STDC_HEADERS %d\n", STDC_HEADERS);
404 #endif
405 #ifdef TM_IN_SYS_TIME
406 ajFmtPrintF(outfile, "TM_IN_SYS_TIME %d\n", TM_IN_SYS_TIME);
407 #endif
408 #ifdef VERSION
409 ajFmtPrintF(outfile, "VERSION '%s'\n", VERSION);
410 #endif
411 #ifdef WORDS_BIGENDIAN
412 ajFmtPrintF(outfile, "WORDS_BIGENDIAN %d\n", WORDS_BIGENDIAN);
413 #endif
414 #ifdef X_DISPLAY_MISSING
415 ajFmtPrintF(outfile, "X_DISPLAY_MISSING %d\n", X_DISPLAY_MISSING);
416 #endif
417 #ifdef _FORTIFY_SOURCE
418 ajFmtPrintF(outfile, "_FORTIFY_SOURCE %d\n", _FORTIFY_SOURCE);
419 #endif
420 ajFmtPrintF(outfile, "\n");
421 ajFmtPrintF(outfile, "Sizes (bytes):\n");
422 ajFmtPrintF(outfile, "\n");
423 ajFmtPrintF(outfile, "int %2u\n", sizeof(int));
424 ajFmtPrintF(outfile, "ajint %2u\n", sizeof(ajint));
425 ajFmtPrintF(outfile, "short %2u\n", sizeof(short));
426 ajFmtPrintF(outfile, "ajshort %2u\n", sizeof(ajshort));
427 ajFmtPrintF(outfile, "long %2u\n", sizeof(long));
428 ajFmtPrintF(outfile, "ajlong %2u\n", sizeof(ajlong));
429 ajFmtPrintF(outfile, "void pointer %2u\n", sizeof(void*));
430 ajFmtPrintF(outfile, "size_t %2u\n", sizeof(size_t));
431 }
432
433 ajStrDel(&tmpstr);
434 ajFileClose(&outfile);
435
436 embExit();
437
438 return 0;
439 }
440