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
|
Rev | Line | |
---|
[11727] | 1 | function flag=ispetsc()
|
---|
| 2 | %ISPETSC - figure out if PETSC package was compiled with ISSM
|
---|
| 3 | %
|
---|
| 4 | % Usage:
|
---|
| 5 | % flag=ispetsc();
|
---|
| 6 |
|
---|
| 7 |
|
---|
[12155] | 8 | configfile=[issmdir() '/bin/config.h']; %should find it in the install target
|
---|
[11727] | 9 | if ~exist(configfile,'file'),
|
---|
| 10 | error(['File ' configfile ' not found. ISSM has not been configured yet!']);
|
---|
| 11 | end
|
---|
| 12 |
|
---|
| 13 | %go through the file, and recover the line we want
|
---|
| 14 | flag=2;
|
---|
| 15 | fid=fopen(configfile,'r');
|
---|
| 16 | if(fid==-1), error(['could not open file: ' configfile]); end
|
---|
| 17 |
|
---|
| 18 | while(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
|
---|
| 29 | end
|
---|
| 30 | fclose(fid);
|
---|
| 31 | if flag==2,
|
---|
| 32 | error('could not determine whether PETSC was or was not compiled');
|
---|
| 33 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.