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

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

merged trunk-jpl and trunk for revision 13974

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