source: issm/trunk/src/m/os/ispetsc.m@ 13395

Last change on this file since 13395 was 13395, checked in by Mathieu Morlighem, 12 years ago

merged trunk-jpl and trunk for revision 13393

File size: 776 bytes
RevLine 
[11727]1function flag=ispetsc()
2%ISPETSC - figure out if PETSC package was compiled with ISSM
3%
4% Usage:
5% flag=ispetsc();
6
7
[12155]8configfile=[issmdir() '/bin/config.h']; %should find it in the install target
[11727]9if ~exist(configfile,'file'),
10 error(['File ' configfile ' not found. ISSM has not been configured yet!']);
11end
12
13%go through the file, and recover the line we want
14flag=2;
15fid=fopen(configfile,'r');
16if(fid==-1), error(['could not open file: ' configfile]); end
17
18while(true),
19 tline=fgets(fid);
20 if ~ischar(tline), break, end
21 if strncmp(tline,'/* #undef _HAVE_PETSC_ */',25),
22 flag=0;
23 break;
24 end
25 if strncmp(tline,'#define _HAVE_PETSC_',20),
26 flag=1;
27 break;
28 end
29end
30fclose(fid);
31if flag==2,
32 error('could not determine whether PETSC was or was not compiled');
33end
Note: See TracBrowser for help on using the repository browser.