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