| 1 |
from systemfuncs import systemFunctions |
| 2 |
from outpututils import rewriteIfChanged |
| 3 |
|
| 4 |
import sys |
| 5 |
|
| 6 |
def iterSystemFuncsHeader(functionResults): |
| 7 |
yield '// Automatically generated by build system.' |
| 8 |
for makeName in sorted( |
| 9 |
func.getMakeName() for func in systemFunctions |
| 10 |
): |
| 11 |
yield '#define HAVE_%s %d' % (makeName, functionResults[makeName]) |
| 12 |
|
| 13 |
def getSystemFuncsInfo(): |
| 14 |
return dict.fromkeys( |
| 15 |
(func.getMakeName() for func in systemFunctions), |
| 16 |
False |
| 17 |
) |
| 18 |
|
| 19 |
if __name__ == '__main__': |
| 20 |
if len(sys.argv) == 2: |
| 21 |
rewriteIfChanged( |
| 22 |
sys.argv[1], |
| 23 |
iterSystemFuncsHeader(getSystemFuncsInfo()) |
| 24 |
) |
| 25 |
else: |
| 26 |
print('Usage: python3 systemfuncs2code.py CONFIG_HEADER ', file=sys.stderr) |
| 27 |
print( |
| 28 |
'Note: Should only be called directly on systems ' |
| 29 |
'where the probe does not work.', |
| 30 |
file=sys.stderr |
| 31 |
) |
| 32 |
sys.exit(2) |